diff options
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 956d3b006e8..b624fe4d9bd 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1284,11 +1284,13 @@ static int dev_close_many(struct list_head *head) | |||
1284 | */ | 1284 | */ |
1285 | int dev_close(struct net_device *dev) | 1285 | int dev_close(struct net_device *dev) |
1286 | { | 1286 | { |
1287 | LIST_HEAD(single); | 1287 | if (dev->flags & IFF_UP) { |
1288 | LIST_HEAD(single); | ||
1288 | 1289 | ||
1289 | list_add(&dev->unreg_list, &single); | 1290 | list_add(&dev->unreg_list, &single); |
1290 | dev_close_many(&single); | 1291 | dev_close_many(&single); |
1291 | list_del(&single); | 1292 | list_del(&single); |
1293 | } | ||
1292 | return 0; | 1294 | return 0; |
1293 | } | 1295 | } |
1294 | EXPORT_SYMBOL(dev_close); | 1296 | EXPORT_SYMBOL(dev_close); |
@@ -4773,7 +4775,7 @@ static int dev_ifsioc_locked(struct net *net, struct ifreq *ifr, unsigned int cm | |||
4773 | * is never reached | 4775 | * is never reached |
4774 | */ | 4776 | */ |
4775 | WARN_ON(1); | 4777 | WARN_ON(1); |
4776 | err = -EINVAL; | 4778 | err = -ENOTTY; |
4777 | break; | 4779 | break; |
4778 | 4780 | ||
4779 | } | 4781 | } |
@@ -5041,7 +5043,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
5041 | /* Set the per device memory buffer space. | 5043 | /* Set the per device memory buffer space. |
5042 | * Not applicable in our case */ | 5044 | * Not applicable in our case */ |
5043 | case SIOCSIFLINK: | 5045 | case SIOCSIFLINK: |
5044 | return -EINVAL; | 5046 | return -ENOTTY; |
5045 | 5047 | ||
5046 | /* | 5048 | /* |
5047 | * Unknown or private ioctl. | 5049 | * Unknown or private ioctl. |
@@ -5062,7 +5064,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
5062 | /* Take care of Wireless Extensions */ | 5064 | /* Take care of Wireless Extensions */ |
5063 | if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) | 5065 | if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) |
5064 | return wext_handle_ioctl(net, &ifr, cmd, arg); | 5066 | return wext_handle_ioctl(net, &ifr, cmd, arg); |
5065 | return -EINVAL; | 5067 | return -ENOTTY; |
5066 | } | 5068 | } |
5067 | } | 5069 | } |
5068 | 5070 | ||
@@ -5184,33 +5186,37 @@ u32 netdev_fix_features(struct net_device *dev, u32 features) | |||
5184 | /* Fix illegal checksum combinations */ | 5186 | /* Fix illegal checksum combinations */ |
5185 | if ((features & NETIF_F_HW_CSUM) && | 5187 | if ((features & NETIF_F_HW_CSUM) && |
5186 | (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { | 5188 | (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { |
5187 | netdev_info(dev, "mixed HW and IP checksum settings.\n"); | 5189 | netdev_warn(dev, "mixed HW and IP checksum settings.\n"); |
5188 | features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); | 5190 | features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); |
5189 | } | 5191 | } |
5190 | 5192 | ||
5191 | if ((features & NETIF_F_NO_CSUM) && | 5193 | if ((features & NETIF_F_NO_CSUM) && |
5192 | (features & (NETIF_F_HW_CSUM|NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { | 5194 | (features & (NETIF_F_HW_CSUM|NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { |
5193 | netdev_info(dev, "mixed no checksumming and other settings.\n"); | 5195 | netdev_warn(dev, "mixed no checksumming and other settings.\n"); |
5194 | features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM); | 5196 | features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM); |
5195 | } | 5197 | } |
5196 | 5198 | ||
5197 | /* Fix illegal SG+CSUM combinations. */ | 5199 | /* Fix illegal SG+CSUM combinations. */ |
5198 | if ((features & NETIF_F_SG) && | 5200 | if ((features & NETIF_F_SG) && |
5199 | !(features & NETIF_F_ALL_CSUM)) { | 5201 | !(features & NETIF_F_ALL_CSUM)) { |
5200 | netdev_info(dev, | 5202 | netdev_dbg(dev, |
5201 | "Dropping NETIF_F_SG since no checksum feature.\n"); | 5203 | "Dropping NETIF_F_SG since no checksum feature.\n"); |
5202 | features &= ~NETIF_F_SG; | 5204 | features &= ~NETIF_F_SG; |
5203 | } | 5205 | } |
5204 | 5206 | ||
5205 | /* TSO requires that SG is present as well. */ | 5207 | /* TSO requires that SG is present as well. */ |
5206 | if ((features & NETIF_F_TSO) && !(features & NETIF_F_SG)) { | 5208 | if ((features & NETIF_F_ALL_TSO) && !(features & NETIF_F_SG)) { |
5207 | netdev_info(dev, "Dropping NETIF_F_TSO since no SG feature.\n"); | 5209 | netdev_dbg(dev, "Dropping TSO features since no SG feature.\n"); |
5208 | features &= ~NETIF_F_TSO; | 5210 | features &= ~NETIF_F_ALL_TSO; |
5209 | } | 5211 | } |
5210 | 5212 | ||
5213 | /* TSO ECN requires that TSO is present as well. */ | ||
5214 | if ((features & NETIF_F_ALL_TSO) == NETIF_F_TSO_ECN) | ||
5215 | features &= ~NETIF_F_TSO_ECN; | ||
5216 | |||
5211 | /* Software GSO depends on SG. */ | 5217 | /* Software GSO depends on SG. */ |
5212 | if ((features & NETIF_F_GSO) && !(features & NETIF_F_SG)) { | 5218 | if ((features & NETIF_F_GSO) && !(features & NETIF_F_SG)) { |
5213 | netdev_info(dev, "Dropping NETIF_F_GSO since no SG feature.\n"); | 5219 | netdev_dbg(dev, "Dropping NETIF_F_GSO since no SG feature.\n"); |
5214 | features &= ~NETIF_F_GSO; | 5220 | features &= ~NETIF_F_GSO; |
5215 | } | 5221 | } |
5216 | 5222 | ||
@@ -5220,13 +5226,13 @@ u32 netdev_fix_features(struct net_device *dev, u32 features) | |||
5220 | if (!((features & NETIF_F_GEN_CSUM) || | 5226 | if (!((features & NETIF_F_GEN_CSUM) || |
5221 | (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)) | 5227 | (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)) |
5222 | == (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { | 5228 | == (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { |
5223 | netdev_info(dev, | 5229 | netdev_dbg(dev, |
5224 | "Dropping NETIF_F_UFO since no checksum offload features.\n"); | 5230 | "Dropping NETIF_F_UFO since no checksum offload features.\n"); |
5225 | features &= ~NETIF_F_UFO; | 5231 | features &= ~NETIF_F_UFO; |
5226 | } | 5232 | } |
5227 | 5233 | ||
5228 | if (!(features & NETIF_F_SG)) { | 5234 | if (!(features & NETIF_F_SG)) { |
5229 | netdev_info(dev, | 5235 | netdev_dbg(dev, |
5230 | "Dropping NETIF_F_UFO since no NETIF_F_SG feature.\n"); | 5236 | "Dropping NETIF_F_UFO since no NETIF_F_SG feature.\n"); |
5231 | features &= ~NETIF_F_UFO; | 5237 | features &= ~NETIF_F_UFO; |
5232 | } | 5238 | } |
@@ -5408,12 +5414,6 @@ int register_netdevice(struct net_device *dev) | |||
5408 | dev->features |= NETIF_F_SOFT_FEATURES; | 5414 | dev->features |= NETIF_F_SOFT_FEATURES; |
5409 | dev->wanted_features = dev->features & dev->hw_features; | 5415 | dev->wanted_features = dev->features & dev->hw_features; |
5410 | 5416 | ||
5411 | /* Avoid warning from netdev_fix_features() for GSO without SG */ | ||
5412 | if (!(dev->wanted_features & NETIF_F_SG)) { | ||
5413 | dev->wanted_features &= ~NETIF_F_GSO; | ||
5414 | dev->features &= ~NETIF_F_GSO; | ||
5415 | } | ||
5416 | |||
5417 | /* Enable GRO and NETIF_F_HIGHDMA for vlans by default, | 5417 | /* Enable GRO and NETIF_F_HIGHDMA for vlans by default, |
5418 | * vlan_dev_init() will do the dev->features check, so these features | 5418 | * vlan_dev_init() will do the dev->features check, so these features |
5419 | * are enabled only if supported by underlying device. | 5419 | * are enabled only if supported by underlying device. |