@@ -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;
}
@@ -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;
@@ -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;
@@ -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;
}
@@ -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) {
The functions validate_xmit_xfrm() and xfrm_type_offload.xmit() using netdev_features_t as parameters. For the prototype of netdev_features_t will be extended to be larger than 8 bytes, so change the prototype of the function, change the prototype of input features to 'netdev_features_t *'. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- include/net/xfrm.h | 11 ++++++++--- net/core/dev.c | 2 +- net/ipv4/esp4_offload.c | 5 +++-- net/ipv6/esp6_offload.c | 5 +++-- net/xfrm/xfrm_device.c | 15 +++++++++------ 5 files changed, 24 insertions(+), 14 deletions(-)