diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 6e8fa98f786f..0646a47d8b18 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -415,7 +415,8 @@ struct xfrm_type_offload {
u8 proto;
void (*encap)(struct xfrm_state *, struct sk_buff *pskb);
int (*input_tail)(struct xfrm_state *x, struct sk_buff *skb);
- int (*xmit)(struct xfrm_state *, struct sk_buff *pskb, netdev_features_t features);
+ int (*xmit)(struct xfrm_state *, struct sk_buff *pskb,
+ const netdev_features_t *features);
};
int xfrm_register_type_offload(const struct xfrm_type_offload *type, unsigned short family);@@ -1877,7 +1878,9 @@ void __init xfrm_dev_init(void);
#ifdef CONFIG_XFRM_OFFLOAD
void xfrm_dev_resume(struct sk_buff *skb);
void xfrm_dev_backlog(struct softnet_data *sd);
-struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t features, bool *again);
+struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb,
+ const netdev_features_t *features,
+ bool *again);
int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
struct xfrm_user_offload *xuo);
bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x);
@@ -1937,7 +1940,9 @@ static inline void xfrm_dev_backlog(struct softnet_data *sd)
{
}
-static inline struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t features, bool *again)
+static inline struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb,
+ const netdev_features_t *features,
+ bool *again)
{
return skb;
}diff --git a/net/core/dev.c b/net/core/dev.c
index b8bb83a65221..54cb150d9db1 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3696,7 +3696,7 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device
}
}
- skb = validate_xmit_xfrm(skb, features, again);
+ skb = validate_xmit_xfrm(skb, &features, again);
return skb;
diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c
index 36d76cff3075..b72ec9e3447e 100644
--- a/net/ipv4/esp4_offload.c
+++ b/net/ipv4/esp4_offload.c
@@ -250,7 +250,8 @@ static int esp_input_tail(struct xfrm_state *x, struct sk_buff *skb)
return esp_input_done2(skb, 0);
}
-static int esp_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features_t features)
+static int esp_xmit(struct xfrm_state *x, struct sk_buff *skb,
+ const netdev_features_t *features)
{
int err;
int alen;@@ -269,7 +270,7 @@ static int esp_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features_
if (!xo)
return -EINVAL;
- if ((!netdev_feature_test(NETIF_F_HW_ESP_BIT, features) &&
+ if ((!netdev_feature_test(NETIF_F_HW_ESP_BIT, *features) &&
!netdev_gso_partial_feature_test(skb->dev, NETIF_F_HW_ESP_BIT)) ||
x->xso.dev != skb->dev) {
xo->flags |= CRYPTO_FALLBACK;diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c
index 4956a83d409a..ce7d02b5e184 100644
--- a/net/ipv6/esp6_offload.c
+++ b/net/ipv6/esp6_offload.c
@@ -287,7 +287,8 @@ static int esp6_input_tail(struct xfrm_state *x, struct sk_buff *skb)
return esp6_input_done2(skb, 0);
}
-static int esp6_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features_t features)
+static int esp6_xmit(struct xfrm_state *x, struct sk_buff *skb,
+ const netdev_features_t *features)
{
int len;
int err;@@ -306,7 +307,7 @@ static int esp6_xmit(struct xfrm_state *x, struct sk_buff *skb, netdev_features
if (!xo)
return -EINVAL;
- if (!netdev_feature_test(NETIF_F_HW_ESP_BIT, features) || x->xso.dev != skb->dev) {
+ if (!netdev_feature_test(NETIF_F_HW_ESP_BIT, *features) || x->xso.dev != skb->dev) {
xo->flags |= CRYPTO_FALLBACK;
hw_offload = false;
}diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
index b53f142b02de..3a8f11aec189 100644
--- a/net/xfrm/xfrm_device.c
+++ b/net/xfrm/xfrm_device.c
@@ -97,23 +97,26 @@ static void xfrm_outer_mode_prep(struct xfrm_state *x, struct sk_buff *skb)
}
}
-struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t features, bool *again)
+struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb,
+ const netdev_features_t *features,
+ bool *again)
{
int err;
unsigned long flags;
struct xfrm_state *x;
struct softnet_data *sd;
struct sk_buff *skb2, *nskb, *pskb = NULL;
- netdev_features_t esp_features = features;
struct xfrm_offload *xo = xfrm_offload(skb);
struct net_device *dev = skb->dev;
+ netdev_features_t esp_features;
struct sec_path *sp;
if (!xo || (xo->flags & XFRM_XMIT))
return skb;
- if (!netdev_feature_test(NETIF_F_HW_ESP_BIT, features)) {
- esp_features = features;
+ netdev_features_copy(esp_features, *features);
+ if (!netdev_feature_test(NETIF_F_HW_ESP_BIT, *features)) {
+ netdev_features_copy(esp_features, *features);
netdev_feature_del(NETIF_F_SG_BIT, esp_features);
netdev_features_clear(esp_features, NETIF_F_CSUM_MASK);
}@@ -162,7 +165,7 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur
xo->flags |= XFRM_DEV_RESUME;
- err = x->type_offload->xmit(x, skb, esp_features);
+ err = x->type_offload->xmit(x, skb, &esp_features);
if (err) {
if (err == -EINPROGRESS)
return NULL;@@ -187,7 +190,7 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur
xfrm_outer_mode_prep(x, skb2);
- err = x->type_offload->xmit(x, skb2, esp_features);
+ err = x->type_offload->xmit(x, skb2, &esp_features);
if (!err) {
skb2->next = nskb;
} else if (err != -EINPROGRESS) {--
2.33.0