|
@@ -5236,7 +5236,7 @@ u32 netdev_fix_features(struct net_device *dev, u32 features)
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(netdev_fix_features);
|
|
EXPORT_SYMBOL(netdev_fix_features);
|
|
|
|
|
|
-void netdev_update_features(struct net_device *dev)
|
|
|
|
|
|
+int __netdev_update_features(struct net_device *dev)
|
|
{
|
|
{
|
|
u32 features;
|
|
u32 features;
|
|
int err = 0;
|
|
int err = 0;
|
|
@@ -5250,7 +5250,7 @@ void netdev_update_features(struct net_device *dev)
|
|
features = netdev_fix_features(dev, features);
|
|
features = netdev_fix_features(dev, features);
|
|
|
|
|
|
if (dev->features == features)
|
|
if (dev->features == features)
|
|
- return;
|
|
|
|
|
|
+ return 0;
|
|
|
|
|
|
netdev_info(dev, "Features changed: 0x%08x -> 0x%08x\n",
|
|
netdev_info(dev, "Features changed: 0x%08x -> 0x%08x\n",
|
|
dev->features, features);
|
|
dev->features, features);
|
|
@@ -5258,12 +5258,23 @@ void netdev_update_features(struct net_device *dev)
|
|
if (dev->netdev_ops->ndo_set_features)
|
|
if (dev->netdev_ops->ndo_set_features)
|
|
err = dev->netdev_ops->ndo_set_features(dev, features);
|
|
err = dev->netdev_ops->ndo_set_features(dev, features);
|
|
|
|
|
|
- if (!err)
|
|
|
|
- dev->features = features;
|
|
|
|
- else if (err < 0)
|
|
|
|
|
|
+ if (unlikely(err < 0)) {
|
|
netdev_err(dev,
|
|
netdev_err(dev,
|
|
"set_features() failed (%d); wanted 0x%08x, left 0x%08x\n",
|
|
"set_features() failed (%d); wanted 0x%08x, left 0x%08x\n",
|
|
err, features, dev->features);
|
|
err, features, dev->features);
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!err)
|
|
|
|
+ dev->features = features;
|
|
|
|
+
|
|
|
|
+ return 1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void netdev_update_features(struct net_device *dev)
|
|
|
|
+{
|
|
|
|
+ if (__netdev_update_features(dev))
|
|
|
|
+ netdev_features_change(dev);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(netdev_update_features);
|
|
EXPORT_SYMBOL(netdev_update_features);
|
|
|
|
|
|
@@ -5430,7 +5441,7 @@ int register_netdevice(struct net_device *dev)
|
|
goto err_uninit;
|
|
goto err_uninit;
|
|
dev->reg_state = NETREG_REGISTERED;
|
|
dev->reg_state = NETREG_REGISTERED;
|
|
|
|
|
|
- netdev_update_features(dev);
|
|
|
|
|
|
+ __netdev_update_features(dev);
|
|
|
|
|
|
/*
|
|
/*
|
|
* Default initial state at registry is that the
|
|
* Default initial state at registry is that the
|