[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220918094336.28958-40-shenjian15@huawei.com>
Date: Sun, 18 Sep 2022 09:43:20 +0000
From: Jian Shen <shenjian15@...wei.com>
To: <davem@...emloft.net>, <kuba@...nel.org>, <ecree.xilinx@...il.com>,
<andrew@...n.ch>, <hkallweit1@...il.com>,
<alexandr.lobakin@...el.com>, <saeed@...nel.org>, <leon@...nel.org>
CC: <netdev@...r.kernel.org>, <linuxarm@...wei.com>
Subject: [RFCv8 PATCH net-next 39/55] net: adjust the prototype of netdev_intersect_features()
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@...wei.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(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
index 8a15ec010282..0ab4f1b5e547 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
@@ -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);
diff --git a/include/linux/netdev_feature_helpers.h b/include/linux/netdev_feature_helpers.h
index 60bc021648e4..a15bd3a3b574 100644
--- a/include/linux/netdev_feature_helpers.h
+++ b/include/linux/netdev_feature_helpers.h
@@ -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
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 04588800df24..d03348e29f36 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -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);
diff --git a/net/core/dev.c b/net/core/dev.c
index ac53e727d88f..e36347e0abe7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -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)
--
2.33.0
Powered by blists - more mailing lists