@@ -248,7 +248,7 @@ nfp_repr_fix_features(struct net_device *netdev, netdev_features_t features)
if (netdev_features_intersects(lower_features, netdev_ip_csum_features))
netdev_feature_add(NETIF_F_HW_CSUM_BIT, lower_features);
- features = netdev_intersect_features(features, lower_features);
+ netdev_intersect_features(&features, &features, &lower_features);
tmp = NETIF_F_SOFT_FEATURES;
netdev_feature_add(NETIF_F_HW_TC_BIT, tmp);
netdev_features_mask(tmp, old_features);
@@ -697,21 +697,24 @@ static inline bool __netdev_features_subset(const netdev_features_t *feats1,
#define netdev_gso_partial_features_clear_set(ndev, ...) \
__netdev_gso_partial_features_clear_set(ndev, __UNIQUE_ID(feat_set), __VA_ARGS__)
-static inline netdev_features_t netdev_intersect_features(netdev_features_t f1,
- netdev_features_t f2)
+static inline void netdev_intersect_features(netdev_features_t *ret,
+ const netdev_features_t *f1,
+ const netdev_features_t *f2)
{
- netdev_features_t ret;
-
- if (netdev_feature_test(NETIF_F_HW_CSUM_BIT, f1) !=
- netdev_feature_test(NETIF_F_HW_CSUM_BIT, f2)) {
- if (netdev_feature_test(NETIF_F_HW_CSUM_BIT, f1))
- netdev_features_set(f1, netdev_ip_csum_features);
+ netdev_features_t local_f1;
+ netdev_features_t local_f2;
+
+ netdev_features_copy(local_f1, *f1);
+ netdev_features_copy(local_f2, *f2);
+ if (netdev_feature_test(NETIF_F_HW_CSUM_BIT, local_f1) !=
+ netdev_feature_test(NETIF_F_HW_CSUM_BIT, local_f2)) {
+ if (netdev_feature_test(NETIF_F_HW_CSUM_BIT, local_f1))
+ netdev_features_set(local_f1, netdev_ip_csum_features);
else
- netdev_features_set(f2, netdev_ip_csum_features);
+ netdev_features_set(local_f2, netdev_ip_csum_features);
}
- netdev_features_and(ret, f1, f2);
- return ret;
+ netdev_features_and(*ret, local_f1, local_f2);
}
static inline void
@@ -655,14 +655,14 @@ static netdev_features_t vlan_dev_fix_features(struct net_device *dev,
tmp = real_dev->vlan_features;
netdev_feature_add(NETIF_F_RXCSUM_BIT, tmp);
- lower_features = netdev_intersect_features(tmp, real_dev->features);
+ netdev_intersect_features(&lower_features, &tmp, &real_dev->features);
/* Add HW_CSUM setting to preserve user ability to control
* checksum offload on the vlan device.
*/
if (netdev_features_intersects(lower_features, netdev_ip_csum_features))
netdev_feature_add(NETIF_F_HW_CSUM_BIT, lower_features);
- features = netdev_intersect_features(features, lower_features);
+ netdev_intersect_features(&features, &features, &lower_features);
netdev_features_or(tmp, NETIF_F_SOFT_FEATURES, NETIF_F_GSO_SOFTWARE);
netdev_features_mask(tmp, old_features);
netdev_features_set(features, tmp);
@@ -3565,7 +3565,7 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
if (skb_vlan_tagged(skb)) {
netdev_features_or(tmp, dev->vlan_features,
netdev_tx_vlan_features);
- features = netdev_intersect_features(features, tmp);
+ netdev_intersect_features(&features, &features, &tmp);
}
if (dev->netdev_ops->ndo_features_check)
The fcuntion netdev_intersect_features() using netdev_features_t as parameters, and returns netdev_features_t directly. 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 *', and return the features pointer as output parameters. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- .../net/ethernet/netronome/nfp/nfp_net_repr.c | 2 +- include/linux/netdev_feature_helpers.h | 25 +++++++++++-------- net/8021q/vlan_dev.c | 4 +-- net/core/dev.c | 2 +- 4 files changed, 18 insertions(+), 15 deletions(-)