]> git.baikalelectronics.ru Git - kernel.git/commitdiff
cxgb4/ch_ktls: decrypted bit is not enough
authorRohit Maheshwari <rohitm@chelsio.com>
Mon, 9 Nov 2020 10:51:31 +0000 (16:21 +0530)
committerJakub Kicinski <kuba@kernel.org>
Thu, 12 Nov 2020 00:30:37 +0000 (16:30 -0800)
If skb has retransmit data starting before start marker, e.g. ccs,
decrypted bit won't be set for that, and if it has some data to
encrypt, then it must be given to crypto ULD. So in place of
decrypted, check if socket is tls offloaded. Also, unless skb has
some data to encrypt, no need to give it for tls offload handling.

v2->v3:
- Removed ifdef.

Fixes: 33acbcec9b50 ("cxgb4/chcr: complete record tx handling")
Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
drivers/net/ethernet/chelsio/cxgb4/sge.c
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c

index a952fe198eb923e7b574b67637e822cbe3d7c416..7fd264a6d08546c8783e3ba8270d853fe218824c 100644 (file)
@@ -1176,6 +1176,7 @@ static u16 cxgb_select_queue(struct net_device *dev, struct sk_buff *skb,
                txq = netdev_pick_tx(dev, skb, sb_dev);
                if (xfrm_offload(skb) || is_ptp_enabled(skb, dev) ||
                    skb->encapsulation ||
+                   cxgb4_is_ktls_skb(skb) ||
                    (proto != IPPROTO_TCP && proto != IPPROTO_UDP))
                        txq = txq % pi->nqsets;
 
index b169776ab4845af3fa5cb498c289b44d8a6e1822..e2a4941fa802d09629d0d24a6a5c21a3d279d712 100644 (file)
@@ -493,6 +493,11 @@ struct cxgb4_uld_info {
 #endif
 };
 
+static inline bool cxgb4_is_ktls_skb(struct sk_buff *skb)
+{
+       return skb->sk && tls_is_sk_tx_device_offloaded(skb->sk);
+}
+
 void cxgb4_uld_enable(struct adapter *adap);
 void cxgb4_register_uld(enum cxgb4_uld type, const struct cxgb4_uld_info *p);
 int cxgb4_unregister_uld(enum cxgb4_uld type);
index a9e9c7ae565dca4e6d1e21c155401cf5038e7c35..01bd9c0dfe4eff1d43f0f96b78eb634bdd6808ea 100644 (file)
@@ -1422,7 +1422,8 @@ static netdev_tx_t cxgb4_eth_xmit(struct sk_buff *skb, struct net_device *dev)
 #endif /* CHELSIO_IPSEC_INLINE */
 
 #if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
-       if (skb->decrypted)
+       if (cxgb4_is_ktls_skb(skb) &&
+           (skb->len - (skb_transport_offset(skb) + tcp_hdrlen(skb))))
                return adap->uld[CXGB4_ULD_KTLS].tx_handler(skb, dev);
 #endif /* CHELSIO_TLS_DEVICE */
 
index 5195f692f14d1f3f4fe3412afe61040d85757117..43c723c72c618fa7481758a2bf63a3cc0cd947cd 100644 (file)
@@ -1878,10 +1878,6 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev)
 
        mss = skb_is_gso(skb) ? skb_shinfo(skb)->gso_size : skb->data_len;
 
-       /* check if we haven't set it for ktls offload */
-       if (!skb->sk || !tls_is_sk_tx_device_offloaded(skb->sk))
-               goto out;
-
        tls_ctx = tls_get_ctx(skb->sk);
        if (unlikely(tls_ctx->netdev != dev))
                goto out;