]> xenbits.xensource.com Git - people/pauldu/linux.git/commitdiff
tls: rx: don't handle async in tls_sw_advance_skb()
authorJakub Kicinski <kuba@kernel.org>
Fri, 8 Apr 2022 18:31:29 +0000 (11:31 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 10 Apr 2022 16:32:11 +0000 (17:32 +0100)
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: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tls/tls_sw.c

index 103a1aaca9344e352c6125d4735fead9b38c43d4..6f17f599a6d4f4cf96bd825b7a886a5698fa2224 100644 (file)
@@ -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_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx);
+       struct strp_msg *rxm = strp_msg(skb);
 
-       if (skb) {
-               struct strp_msg *rxm = strp_msg(skb);
-
-               if (len < rxm->full_len) {
-                       rxm->offset += len;
-                       rxm->full_len -= len;
-                       return false;
-               }
-               consume_skb(skb);
+       if (len < rxm->full_len) {
+               rxm->offset += len;
+               rxm->full_len -= len;
+               return false;
        }
+       consume_skb(skb);
 
        /* Finished with message */
        ctx->recv_pkt = NULL;
@@ -1898,10 +1895,9 @@ pick_next_record:
                /* For async or peek case, queue the current skb */
                if (async || is_peek || retain_skb) {
                        skb_queue_tail(&ctx->rx_list, skb);
-                       skb = NULL;
-               }
-
-               if (tls_sw_advance_skb(sk, skb, chunk)) {
+                       ctx->recv_pkt = NULL;
+                       __strp_unpause(&ctx->strp);
+               } else if (tls_sw_advance_skb(sk, skb, chunk)) {
                        /* Return full control message to
                         * userspace before trying to parse
                         * another message type