<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/strparser, branch v4.20</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.20</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.20'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2018-10-15T19:23:19Z</updated>
<entry>
<title>bpf, sockmap: convert to generic sk_msg interface</title>
<updated>2018-10-15T19:23:19Z</updated>
<author>
<name>Daniel Borkmann</name>
<email>daniel@iogearbox.net</email>
</author>
<published>2018-10-13T00:45:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=604326b41a6fb9b4a78b6179335decee0365cd8c'/>
<id>urn:sha1:604326b41a6fb9b4a78b6179335decee0365cd8c</id>
<content type='text'>
Add a generic sk_msg layer, and convert current sockmap and later
kTLS over to make use of it. While sk_buff handles network packet
representation from netdevice up to socket, sk_msg handles data
representation from application to socket layer.

This means that sk_msg framework spans across ULP users in the
kernel, and enables features such as introspection or filtering
of data with the help of BPF programs that operate on this data
structure.

Latter becomes in particular useful for kTLS where data encryption
is deferred into the kernel, and as such enabling the kernel to
perform L7 introspection and policy based on BPF for TLS connections
where the record is being encrypted after BPF has run and came to
a verdict. In order to get there, first step is to transform open
coding of scatter-gather list handling into a common core framework
that subsystems can use.

The code itself has been split and refactored into three bigger
pieces: i) the generic sk_msg API which deals with managing the
scatter gather ring, providing helpers for walking and mangling,
transferring application data from user space into it, and preparing
it for BPF pre/post-processing, ii) the plain sock map itself
where sockets can be attached to or detached from; these bits
are independent of i) which can now be used also without sock
map, and iii) the integration with plain TCP as one protocol
to be used for processing L7 application data (later this could
e.g. also be extended to other protocols like UDP). The semantics
are the same with the old sock map code and therefore no change
of user facing behavior or APIs. While pursuing this work it
also helped finding a number of bugs in the old sockmap code
that we've fixed already in earlier commits. The test_sockmap
kselftest suite passes through fine as well.

Joint work with John.

Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: John Fastabend &lt;john.fastabend@gmail.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>strparser: remove redundant variable 'rd_desc'</title>
<updated>2018-08-01T17:00:06Z</updated>
<author>
<name>YueHaibing</name>
<email>yuehaibing@huawei.com</email>
</author>
<published>2018-08-01T07:10:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bd707f17efc9e5dfc0fd05370cb89d2ee41d3558'/>
<id>urn:sha1:bd707f17efc9e5dfc0fd05370cb89d2ee41d3558</id>
<content type='text'>
Variable 'rd_desc' is being assigned but never used,
so can be removed.

fix this clang warning:
net/strparser/strparser.c:411:20: warning: variable ‘rd_desc’ set but not used [-Wunused-but-set-variable]

Signed-off-by: YueHaibing &lt;yuehaibing@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net</title>
<updated>2018-07-03T01:29:26Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2018-07-03T01:26:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5cd3da4ba2397ef07226ca2aa5094ed21ff8198f'/>
<id>urn:sha1:5cd3da4ba2397ef07226ca2aa5094ed21ff8198f</id>
<content type='text'>
Simple overlapping changes in stmmac driver.

Adjust skb_gro_flush_final_remcsum function signature to make GRO list
changes in net-next, as per Stephen Rothwell's example merge
resolution.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>strparser: Call skb_unclone conditionally</title>
<updated>2018-06-30T12:25:39Z</updated>
<author>
<name>Vakul Garg</name>
<email>vakul.garg@nxp.com</email>
</author>
<published>2018-06-29T19:15:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4e485d06bb8c7811a0d69a811c77befd54b9ab0c'/>
<id>urn:sha1:4e485d06bb8c7811a0d69a811c77befd54b9ab0c</id>
<content type='text'>
Calling skb_unclone() is expensive as it triggers a memcpy operation.
Instead of calling skb_unclone() unconditionally, call it only when skb
has a shared frag_list. This improves tls rx throughout significantly.

Signed-off-by: Vakul Garg &lt;vakul.garg@nxp.com&gt;
Suggested-by: Boris Pismenny &lt;borisp@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>strparser: Remove early eaten to fix full tcp receive buffer stall</title>
<updated>2018-06-28T12:37:26Z</updated>
<author>
<name>Doron Roberts-Kedes</name>
<email>doronrk@fb.com</email>
</author>
<published>2018-06-27T01:33:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=977c7114ebda2e746a114840d3a875e0cdb826fb'/>
<id>urn:sha1:977c7114ebda2e746a114840d3a875e0cdb826fb</id>
<content type='text'>
On receving an incomplete message, the existing code stores the
remaining length of the cloned skb in the early_eaten field instead of
incrementing the value returned by __strp_recv. This defers invocation
of sock_rfree for the current skb until the next invocation of
__strp_recv, which returns early_eaten if early_eaten is non-zero.

This behavior causes a stall when the current message occupies the very
tail end of a massive skb, and strp_peek/need_bytes indicates that the
remainder of the current message has yet to arrive on the socket. The
TCP receive buffer is totally full, causing the TCP window to go to
zero, so the remainder of the message will never arrive.

Incrementing the value returned by __strp_recv by the amount otherwise
stored in early_eaten prevents stalls of this nature.

Signed-off-by: Doron Roberts-Kedes &lt;doronrk@fb.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>strparser: Don't schedule in workqueue in paused state</title>
<updated>2018-06-21T00:54:05Z</updated>
<author>
<name>Vakul Garg</name>
<email>vakul.garg@nxp.com</email>
</author>
<published>2018-06-20T21:59:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=456488cd952c23d451b0bdc5b5226b0707db80f7'/>
<id>urn:sha1:456488cd952c23d451b0bdc5b5226b0707db80f7</id>
<content type='text'>
In function strp_data_ready(), it is useless to call queue_work if
the state of strparser is already paused. The state checking should
be done before calling queue_work. The change reduces the context
switches and improves the ktls-rx throughput by approx 20% (measured
on cortex-a53 based platform).

Signed-off-by: Vakul Garg &lt;vakul.garg@nxp.com&gt;
Acked-by: Dave Watson &lt;davejwatson@fb.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>strparser: Add __strp_unpause and use it in ktls.</title>
<updated>2018-06-06T18:07:53Z</updated>
<author>
<name>Doron Roberts-Kedes</name>
<email>doronrk@fb.com</email>
</author>
<published>2018-06-06T16:33:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7170e6045a6a8b33f4fa5753589dc77b16198e2d'/>
<id>urn:sha1:7170e6045a6a8b33f4fa5753589dc77b16198e2d</id>
<content type='text'>
strp_unpause queues strp_work in order to parse any messages that
arrived while the strparser was paused. However, the process invoking
strp_unpause could eagerly parse a buffered message itself if it held
the sock lock.

__strp_unpause is an alternative to strp_pause that avoids the scheduling
overhead that results when a receiving thread unpauses the strparser
and waits for the next message to be delivered by the workqueue thread.

This patch more than doubled the IOPS achieved in a benchmark of NBD
traffic encrypted using ktls.

Signed-off-by: Doron Roberts-Kedes &lt;doronrk@fb.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>strparser: Do not call mod_delayed_work with a timeout of LONG_MAX</title>
<updated>2018-04-23T01:09:16Z</updated>
<author>
<name>Doron Roberts-Kedes</name>
<email>doronrk@fb.com</email>
</author>
<published>2018-04-20T19:11:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7c5aba211dd61f41d737a2c51729eb9fdcd3edf4'/>
<id>urn:sha1:7c5aba211dd61f41d737a2c51729eb9fdcd3edf4</id>
<content type='text'>
struct sock's sk_rcvtimeo is initialized to
LONG_MAX/MAX_SCHEDULE_TIMEOUT in sock_init_data. Calling
mod_delayed_work with a timeout of LONG_MAX causes spurious execution of
the work function. timer-&gt;expires is set equal to jiffies + LONG_MAX.
When timer_base-&gt;clk falls behind the current value of jiffies,
the delta between timer_base-&gt;clk and jiffies + LONG_MAX causes the
expiration to be in the past. Returning early from strp_start_timer if
timeo == LONG_MAX solves this problem.

Found while testing net/tls_sw recv path.

Fixes: 43a0c6751a322847 ("strparser: Stream parser for messages")
Reviewed-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Doron Roberts-Kedes &lt;doronrk@fb.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>strparser: Fix incorrect strp-&gt;need_bytes value.</title>
<updated>2018-04-13T01:54:59Z</updated>
<author>
<name>Doron Roberts-Kedes</name>
<email>doronrk@fb.com</email>
</author>
<published>2018-04-11T22:05:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9d0c75bf6e03d9bf80c55b0f677dc9b982958fd5'/>
<id>urn:sha1:9d0c75bf6e03d9bf80c55b0f677dc9b982958fd5</id>
<content type='text'>
strp_data_ready resets strp-&gt;need_bytes to 0 if strp_peek_len indicates
that the remainder of the message has been received. However,
do_strp_work does not reset strp-&gt;need_bytes to 0. If do_strp_work
completes a partial message, the value of strp-&gt;need_bytes will continue
to reflect the needed bytes of the previous message, causing
future invocations of strp_data_ready to return early if
strp-&gt;need_bytes is less than strp_peek_len. Resetting strp-&gt;need_bytes
to 0 in __strp_recv on handing a full message to the upper layer solves
this problem.

__strp_recv also calculates strp-&gt;need_bytes using stm-&gt;accum_len before
stm-&gt;accum_len has been incremented by cand_len. This can cause
strp-&gt;need_bytes to be equal to the full length of the message instead
of the full length minus the accumulated length. This, in turn, causes
strp_data_ready to return early, even when there is sufficient data to
complete the partial message. Incrementing stm-&gt;accum_len before using
it to calculate strp-&gt;need_bytes solves this problem.

Found while testing net/tls_sw recv path.

Fixes: 43a0c6751a322847 ("strparser: Stream parser for messages")
Signed-off-by: Doron Roberts-Kedes &lt;doronrk@fb.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>strparser: Fix sign of err codes</title>
<updated>2018-03-27T15:00:18Z</updated>
<author>
<name>Dave Watson</name>
<email>davejwatson@fb.com</email>
</author>
<published>2018-03-26T19:31:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cd00edc179863848abab5cc5683de5b7b5f70954'/>
<id>urn:sha1:cd00edc179863848abab5cc5683de5b7b5f70954</id>
<content type='text'>
strp_parser_err is called with a negative code everywhere, which then
calls abort_parser with a negative code.  strp_msg_timeout calls
abort_parser directly with a positive code.  Negate ETIMEDOUT
to match signed-ness of other calls.

The default abort_parser callback, strp_abort_strp, sets
sk-&gt;sk_err to err.  Also negate the error here so sk_err always
holds a positive value, as the rest of the net code expects.  Currently
a negative sk_err can result in endless loops, or user code that
thinks it actually sent/received err bytes.

Found while testing net/tls_sw recv path.

Fixes: 43a0c6751a322847 ("strparser: Stream parser for messages")
Signed-off-by: Dave Watson &lt;davejwatson@fb.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
