@@ -2210,9 +2210,11 @@ static int pch_gbe_set_features(struct net_device *netdev,
netdev_features_t features)
{
struct pch_gbe_adapter *adapter = netdev_priv(netdev);
- netdev_features_t changed = features ^ netdev->features;
+ netdev_features_t changed;
- if (!(changed & NETIF_F_RXCSUM))
+ netdev_feature_xor(&changed, features, netdev->features);
+
+ if (!netdev_feature_test_bit(NETIF_F_RXCSUM_BIT, changed))
return 0;
if (netif_running(netdev))
@@ -2523,9 +2525,10 @@ static int pch_gbe_probe(struct pci_dev *pdev,
netdev->watchdog_timeo = PCH_GBE_WATCHDOG_PERIOD;
netif_napi_add(netdev, &adapter->napi,
pch_gbe_napi_poll, PCH_GBE_RX_WEIGHT);
- netdev->hw_features = NETIF_F_RXCSUM |
- NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
- netdev->features = netdev->hw_features;
+ netdev_feature_zero(&netdev->hw_features);
+ netdev_feature_set_bits(NETIF_F_RXCSUM | NETIF_F_IP_CSUM |
+ NETIF_F_IPV6_CSUM, &netdev->hw_features);
+ netdev_feature_copy(&netdev->features, netdev->hw_features);
pch_gbe_set_ethtool_ops(netdev);
/* MTU range: 46 - 10300 */
@@ -477,7 +477,8 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter)
val = XsumRX;
pch_gbe_validate_option(&val, &opt, adapter);
if (!val)
- dev->features &= ~NETIF_F_RXCSUM;
+ netdev_feature_clear_bit(NETIF_F_RXCSUM_BIT,
+ &dev->features);
}
{ /* Checksum Offload Enable/Disable */
static const struct pch_gbe_option opt = {
@@ -489,7 +490,8 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter)
val = XsumTX;
pch_gbe_validate_option(&val, &opt, adapter);
if (!val)
- dev->features &= ~NETIF_F_CSUM_MASK;
+ netdev_feature_clear_bits(NETIF_F_CSUM_MASK,
+ &dev->features);
}
{ /* Flow Control */
static const struct pch_gbe_option opt = {
Use netdev_feature_xxx helpers to replace the logical operation for netdev features. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 13 ++++++++----- .../net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c | 6 ++++-- 2 files changed, 12 insertions(+), 7 deletions(-)