drivers: net: ethernet: mellanox: use skb_sec_path helper
authorFlorian Westphal <fw@strlen.de>
Tue, 18 Dec 2018 16:15:22 +0000 (17:15 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Dec 2018 19:21:37 +0000 (11:21 -0800)
Will avoid touching this when sp pointer is removed from sk_buff struct.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c

index 128a82b1dbfc66147c1df824613f5d1e807a6e40..f6717c287ff4b84a5d3c147299187a0df59a19a5 100644 (file)
@@ -254,11 +254,13 @@ struct sk_buff *mlx5e_ipsec_handle_tx_skb(struct net_device *netdev,
        struct mlx5e_ipsec_metadata *mdata;
        struct mlx5e_ipsec_sa_entry *sa_entry;
        struct xfrm_state *x;
+       struct sec_path *sp;
 
        if (!xo)
                return skb;
 
-       if (unlikely(skb->sp->len != 1)) {
+       sp = skb_sec_path(skb);
+       if (unlikely(sp->len != 1)) {
                atomic64_inc(&priv->ipsec->sw_stats.ipsec_tx_drop_bundle);
                goto drop;
        }
@@ -372,10 +374,11 @@ struct sk_buff *mlx5e_ipsec_handle_rx_skb(struct net_device *netdev,
 bool mlx5e_ipsec_feature_check(struct sk_buff *skb, struct net_device *netdev,
                               netdev_features_t features)
 {
+       struct sec_path *sp = skb_sec_path(skb);
        struct xfrm_state *x;
 
-       if (skb->sp && skb->sp->len) {
-               x = skb->sp->xvec[0];
+       if (sp && sp->len) {
+               x = sp->xvec[0];
                if (x && x->xso.offload_handle)
                        return true;
        }