Re: [RFCv4 PATCH net-next] net: extend netdev_features_t
From: Andrew Lunn <andrew@lunn.ch>
Date: 2021-11-10 13:36:30
On Wed, Nov 10, 2021 at 09:17:12AM +0800, shenjian (K) wrote:
在 2021/11/10 6:32, Andrew Lunn 写道:quoted
quoted
- if ((netdev->features & NETIF_F_HW_TC) > (features & NETIF_F_HW_TC) && + if ((netdev_active_features_test_bit(netdev, NETIF_F_HW_TC_BIT) > + netdev_features_test_bit(NETIF_F_NTUPLE_BIT, features)) &&Using > is interesting.will use if (netdev_active_features_test_bit(netdev, NETIF_F_HW_TC_BIT) && !netdev_features_test_bit(netdev, NETIF_F_HW_TC_BIT)) instead.
I don't think it needs changing. It is just unusual. I had to think about it, a while, and i was not initial sure it would still work.
quoted
But where did NETIF_F_NTUPLE_BIT come from?Thanks for catching this!
quoted
quoted
- netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | - NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | - NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO | - NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_GRE | - NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | - NETIF_F_SCTP_CRC | NETIF_F_FRAGLIST; + netdev_features_zero(&features); + netdev_features_set_array(hns3_default_features_array, + ARRAY_SIZE(hns3_default_features_array), + &features);The original code is netdev->features |= so it is appending these bits. Yet the first thing the new code does is zero features? Andrew .The features is a local variable, the change for netdev->active_features is later, by calling netdev_active_features_direct_or(netdev, features);
O.K. This and the NETIF_F_NTPLE_BIT points towards another issue. The
new API looks O.K. to me and we need to encourage more people to
review it. This patch allows us to see where you are going with the
change, and i think it is O.K.
However, you are about to modify a large number of files to swap to
this new API. Accidentally changing NETIF_F_HW_TC to
NETIF_F_NTUPLE_BIT is unlikely to be noticed in review given the size
of the change you are about to make. Changing the structure of the
code to later call netdev_active_features_direct_or() is going to be
messy. In order to have confidence you are not introducing a lot of
new bugs we are going to want to see the semantic patches which make
all the needed changes. So while waiting for further reviews, i
suggest you are start on the semantic patches. It could also be that
you want to modify the proposed API in minor ways to make it easier to
write the semantic patches.
Andrew