在 2021/9/23 11:00, moyufeng 写道:
On 2021/9/22 22:56, Jian Shen wrote:
For the origin type for netdev_features_t would be changed to be unsigned long * from u64, so changes the prototype of netdev_intersect_features for adaption.
Signed-off-by: Jian Shen shenjian15@huawei.com
drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | 2 +- include/linux/netdevice.h | 7 ++++--- net/8021q/vlan_dev.c | 8 ++++---- net/core/dev.c | 8 ++++---- 4 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c index 369f6ae700c7..f04b79f04a9d 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c @@ -246,7 +246,7 @@ nfp_repr_fix_features(struct net_device *netdev, netdev_features_t features) if (lower_features & (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)) lower_features |= NETIF_F_HW_CSUM;
- features = netdev_intersect_features(features, lower_features);
- netdev_intersect_features(&features, features, lower_features); features |= old_features & (NETIF_F_SOFT_FEATURES | NETIF_F_HW_TC); features |= NETIF_F_LLTX;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index d79163208dfd..5d5129d4791f 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -5017,8 +5017,9 @@ const char *netdev_drivername(const struct net_device *dev);
void linkwatch_run_queue(void);
-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,
netdev_features_t f1,
{ if ((f1 ^ f2) & NETIF_F_HW_CSUM) { if (f1 & NETIF_F_HW_CSUM)netdev_features_t f2)
@@ -5027,7 +5028,7 @@ static inline netdev_features_t netdev_intersect_features(netdev_features_t f1, f2 |= (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); }
- return f1 & f2;
*ret = f1 & f2; }
static inline netdev_features_t netdev_get_wanted_features(
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 0c21d1fec852..2987201ec93d 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -640,16 +640,16 @@ static netdev_features_t vlan_dev_fix_features(struct net_device *dev, netdev_features_t old_features = features; netdev_features_t lower_features;
- lower_features = netdev_intersect_features((real_dev->vlan_features |
NETIF_F_RXCSUM),
real_dev->features);
- netdev_intersect_features(&lower_features,
(real_dev->vlan_features | NETIF_F_RXCSUM),
Is the "()" here necessary? Will it get some warning in static check tools or checkpatch.pl? Below change in netif_skb_features() doesn't get this.
No warning reported, for it's unrelated for the interface change, so I think should keep it .
@@ -3548,10 +3548,10 @@ netdev_features_t netif_skb_features(struct sk_buff *skb) features &= dev->hw_enc_features;
if (skb_vlan_tagged(skb))
features = netdev_intersect_features(features,
dev->vlan_features |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX);
netdev_intersect_features(&features, features,
dev->vlan_features |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX);
real_dev->features);
/* Add HW_CSUM setting to preserve user ability to control
- checksum offload on the vlan device.
*/ if (lower_features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)) lower_features |= NETIF_F_HW_CSUM;
- features = netdev_intersect_features(features, lower_features);
- netdev_intersect_features(&features, features, lower_features); features |= old_features & (NETIF_F_SOFT_FEATURES | NETIF_F_GSO_SOFTWARE); features |= NETIF_F_LLTX;
diff --git a/net/core/dev.c b/net/core/dev.c index f930329f0dc2..f1d2224ace75 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3548,10 +3548,10 @@ netdev_features_t netif_skb_features(struct sk_buff *skb) features &= dev->hw_enc_features;
if (skb_vlan_tagged(skb))
features = netdev_intersect_features(features,
dev->vlan_features |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX);
netdev_intersect_features(&features, features,
dev->vlan_features |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX);
if (dev->netdev_ops->ndo_features_check) features &= dev->netdev_ops->ndo_features_check(skb, dev,
.