aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-01-24 18:45:15 -0500
committerDavid S. Miller <davem@davemloft.net>2011-01-24 18:45:15 -0500
commitacd1130e8793fb150fb522da8ec51675839eb4b1 (patch)
tree0da6f9f8f7690b426ff069f95bb28bf9e692d534
parent04ed3e741d0f133e02bed7fa5c98edba128f90e7 (diff)
net: reduce and unify printk level in netdev_fix_features()
Reduce printk() levels to KERN_INFO in netdev_fix_features() as this will be used by ethtool and might spam dmesg unnecessarily. This converts the function to use netdev_info() instead of plain printk(). As a side effect, bonding and bridge devices will now log dropped features on every slave device change. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bonding/bond_main.c4
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--net/bridge/br_if.c2
-rw-r--r--net/core/dev.c33
4 files changed, 16 insertions, 25 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 7047b406b8ba..1df9f0ea9184 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1400,8 +1400,8 @@ static int bond_compute_features(struct bonding *bond)
1400 1400
1401done: 1401done:
1402 features |= (bond_dev->features & BOND_VLAN_FEATURES); 1402 features |= (bond_dev->features & BOND_VLAN_FEATURES);
1403 bond_dev->features = netdev_fix_features(features, NULL); 1403 bond_dev->features = netdev_fix_features(bond_dev, features);
1404 bond_dev->vlan_features = netdev_fix_features(vlan_features, NULL); 1404 bond_dev->vlan_features = netdev_fix_features(bond_dev, vlan_features);
1405 bond_dev->hard_header_len = max_hard_header_len; 1405 bond_dev->hard_header_len = max_hard_header_len;
1406 1406
1407 return 0; 1407 return 0;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 0de3c59720fa..8858422c5c5d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2399,7 +2399,7 @@ extern char *netdev_drivername(const struct net_device *dev, char *buffer, int l
2399extern void linkwatch_run_queue(void); 2399extern void linkwatch_run_queue(void);
2400 2400
2401u32 netdev_increment_features(u32 all, u32 one, u32 mask); 2401u32 netdev_increment_features(u32 all, u32 one, u32 mask);
2402u32 netdev_fix_features(u32 features, const char *name); 2402u32 netdev_fix_features(struct net_device *dev, u32 features);
2403 2403
2404void netif_stacked_transfer_operstate(const struct net_device *rootdev, 2404void netif_stacked_transfer_operstate(const struct net_device *rootdev,
2405 struct net_device *dev); 2405 struct net_device *dev);
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 52ce4a30f8b3..2a6801d8b728 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -379,7 +379,7 @@ void br_features_recompute(struct net_bridge *br)
379 } 379 }
380 380
381done: 381done:
382 br->dev->features = netdev_fix_features(features, NULL); 382 br->dev->features = netdev_fix_features(br->dev, features);
383} 383}
384 384
385/* called with RTNL */ 385/* called with RTNL */
diff --git a/net/core/dev.c b/net/core/dev.c
index 7103f89fde0c..1b4c07fe295f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5213,58 +5213,49 @@ static void rollback_registered(struct net_device *dev)
5213 rollback_registered_many(&single); 5213 rollback_registered_many(&single);
5214} 5214}
5215 5215
5216u32 netdev_fix_features(u32 features, const char *name) 5216u32 netdev_fix_features(struct net_device *dev, u32 features)
5217{ 5217{
5218 /* Fix illegal checksum combinations */ 5218 /* Fix illegal checksum combinations */
5219 if ((features & NETIF_F_HW_CSUM) && 5219 if ((features & NETIF_F_HW_CSUM) &&
5220 (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { 5220 (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {
5221 if (name) 5221 netdev_info(dev, "mixed HW and IP checksum settings.\n");
5222 printk(KERN_NOTICE "%s: mixed HW and IP checksum settings.\n",
5223 name);
5224 features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); 5222 features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);
5225 } 5223 }
5226 5224
5227 if ((features & NETIF_F_NO_CSUM) && 5225 if ((features & NETIF_F_NO_CSUM) &&
5228 (features & (NETIF_F_HW_CSUM|NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { 5226 (features & (NETIF_F_HW_CSUM|NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {
5229 if (name) 5227 netdev_info(dev, "mixed no checksumming and other settings.\n");
5230 printk(KERN_NOTICE "%s: mixed no checksumming and other settings.\n",
5231 name);
5232 features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM); 5228 features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM);
5233 } 5229 }
5234 5230
5235 /* Fix illegal SG+CSUM combinations. */ 5231 /* Fix illegal SG+CSUM combinations. */
5236 if ((features & NETIF_F_SG) && 5232 if ((features & NETIF_F_SG) &&
5237 !(features & NETIF_F_ALL_CSUM)) { 5233 !(features & NETIF_F_ALL_CSUM)) {
5238 if (name) 5234 netdev_info(dev,
5239 printk(KERN_NOTICE "%s: Dropping NETIF_F_SG since no " 5235 "Dropping NETIF_F_SG since no checksum feature.\n");
5240 "checksum feature.\n", name);
5241 features &= ~NETIF_F_SG; 5236 features &= ~NETIF_F_SG;
5242 } 5237 }
5243 5238
5244 /* TSO requires that SG is present as well. */ 5239 /* TSO requires that SG is present as well. */
5245 if ((features & NETIF_F_TSO) && !(features & NETIF_F_SG)) { 5240 if ((features & NETIF_F_TSO) && !(features & NETIF_F_SG)) {
5246 if (name) 5241 netdev_info(dev, "Dropping NETIF_F_TSO since no SG feature.\n");
5247 printk(KERN_NOTICE "%s: Dropping NETIF_F_TSO since no "
5248 "SG feature.\n", name);
5249 features &= ~NETIF_F_TSO; 5242 features &= ~NETIF_F_TSO;
5250 } 5243 }
5251 5244
5245 /* UFO needs SG and checksumming */
5252 if (features & NETIF_F_UFO) { 5246 if (features & NETIF_F_UFO) {
5253 /* maybe split UFO into V4 and V6? */ 5247 /* maybe split UFO into V4 and V6? */
5254 if (!((features & NETIF_F_GEN_CSUM) || 5248 if (!((features & NETIF_F_GEN_CSUM) ||
5255 (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)) 5249 (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))
5256 == (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { 5250 == (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {
5257 if (name) 5251 netdev_info(dev,
5258 printk(KERN_ERR "%s: Dropping NETIF_F_UFO " 5252 "Dropping NETIF_F_UFO since no checksum offload features.\n");
5259 "since no checksum offload features.\n",
5260 name);
5261 features &= ~NETIF_F_UFO; 5253 features &= ~NETIF_F_UFO;
5262 } 5254 }
5263 5255
5264 if (!(features & NETIF_F_SG)) { 5256 if (!(features & NETIF_F_SG)) {
5265 if (name) 5257 netdev_info(dev,
5266 printk(KERN_ERR "%s: Dropping NETIF_F_UFO " 5258 "Dropping NETIF_F_UFO since no NETIF_F_SG feature.\n");
5267 "since no NETIF_F_SG feature.\n", name);
5268 features &= ~NETIF_F_UFO; 5259 features &= ~NETIF_F_UFO;
5269 } 5260 }
5270 } 5261 }
@@ -5407,7 +5398,7 @@ int register_netdevice(struct net_device *dev)
5407 if (dev->iflink == -1) 5398 if (dev->iflink == -1)
5408 dev->iflink = dev->ifindex; 5399 dev->iflink = dev->ifindex;
5409 5400
5410 dev->features = netdev_fix_features(dev->features, dev->name); 5401 dev->features = netdev_fix_features(dev, dev->features);
5411 5402
5412 /* Enable software GSO if SG is supported. */ 5403 /* Enable software GSO if SG is supported. */
5413 if (dev->features & NETIF_F_SG) 5404 if (dev->features & NETIF_F_SG)