Commit fc8da80f authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

tls: rx: don't handle async in tls_sw_advance_skb()

tls_sw_advance_skb() caters to the async case when skb argument
is NULL. In that case it simply unpauses the strparser.

These are surprising semantics to a person reading the code,
and result in higher LoC, so inline the __strp_unpause and
only call tls_sw_advance_skb() when we actually move past
an skb.
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 06554f4f
...@@ -1616,17 +1616,14 @@ static bool tls_sw_advance_skb(struct sock *sk, struct sk_buff *skb, ...@@ -1616,17 +1616,14 @@ static bool tls_sw_advance_skb(struct sock *sk, struct sk_buff *skb,
{ {
struct tls_context *tls_ctx = tls_get_ctx(sk); struct tls_context *tls_ctx = tls_get_ctx(sk);
struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx); struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx);
struct strp_msg *rxm = strp_msg(skb);
if (skb) { if (len < rxm->full_len) {
struct strp_msg *rxm = strp_msg(skb); rxm->offset += len;
rxm->full_len -= len;
if (len < rxm->full_len) { return false;
rxm->offset += len;
rxm->full_len -= len;
return false;
}
consume_skb(skb);
} }
consume_skb(skb);
/* Finished with message */ /* Finished with message */
ctx->recv_pkt = NULL; ctx->recv_pkt = NULL;
...@@ -1898,10 +1895,9 @@ int tls_sw_recvmsg(struct sock *sk, ...@@ -1898,10 +1895,9 @@ int tls_sw_recvmsg(struct sock *sk,
/* For async or peek case, queue the current skb */ /* For async or peek case, queue the current skb */
if (async || is_peek || retain_skb) { if (async || is_peek || retain_skb) {
skb_queue_tail(&ctx->rx_list, skb); skb_queue_tail(&ctx->rx_list, skb);
skb = NULL; ctx->recv_pkt = NULL;
} __strp_unpause(&ctx->strp);
} else if (tls_sw_advance_skb(sk, skb, chunk)) {
if (tls_sw_advance_skb(sk, skb, chunk)) {
/* Return full control message to /* Return full control message to
* userspace before trying to parse * userspace before trying to parse
* another message type * another message type
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment