diff options
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 67 |
1 files changed, 40 insertions, 27 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index a17e00662363..f1129706ce7b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2267,12 +2267,6 @@ int netif_receive_skb(struct sk_buff *skb) | |||
2267 | 2267 | ||
2268 | rcu_read_lock(); | 2268 | rcu_read_lock(); |
2269 | 2269 | ||
2270 | /* Don't receive packets in an exiting network namespace */ | ||
2271 | if (!net_alive(dev_net(skb->dev))) { | ||
2272 | kfree_skb(skb); | ||
2273 | goto out; | ||
2274 | } | ||
2275 | |||
2276 | #ifdef CONFIG_NET_CLS_ACT | 2270 | #ifdef CONFIG_NET_CLS_ACT |
2277 | if (skb->tc_verd & TC_NCLS) { | 2271 | if (skb->tc_verd & TC_NCLS) { |
2278 | skb->tc_verd = CLR_TC_NCLS(skb->tc_verd); | 2272 | skb->tc_verd = CLR_TC_NCLS(skb->tc_verd); |
@@ -2488,6 +2482,9 @@ static int __napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) | |||
2488 | 2482 | ||
2489 | int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) | 2483 | int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) |
2490 | { | 2484 | { |
2485 | if (netpoll_receive_skb(skb)) | ||
2486 | return NET_RX_DROP; | ||
2487 | |||
2491 | switch (__napi_gro_receive(napi, skb)) { | 2488 | switch (__napi_gro_receive(napi, skb)) { |
2492 | case -1: | 2489 | case -1: |
2493 | return netif_receive_skb(skb); | 2490 | return netif_receive_skb(skb); |
@@ -2558,6 +2555,9 @@ int napi_gro_frags(struct napi_struct *napi, struct napi_gro_fraginfo *info) | |||
2558 | if (!skb) | 2555 | if (!skb) |
2559 | goto out; | 2556 | goto out; |
2560 | 2557 | ||
2558 | if (netpoll_receive_skb(skb)) | ||
2559 | goto out; | ||
2560 | |||
2561 | err = NET_RX_SUCCESS; | 2561 | err = NET_RX_SUCCESS; |
2562 | 2562 | ||
2563 | switch (__napi_gro_receive(napi, skb)) { | 2563 | switch (__napi_gro_receive(napi, skb)) { |
@@ -4282,6 +4282,39 @@ unsigned long netdev_fix_features(unsigned long features, const char *name) | |||
4282 | } | 4282 | } |
4283 | EXPORT_SYMBOL(netdev_fix_features); | 4283 | EXPORT_SYMBOL(netdev_fix_features); |
4284 | 4284 | ||
4285 | /* Some devices need to (re-)set their netdev_ops inside | ||
4286 | * ->init() or similar. If that happens, we have to setup | ||
4287 | * the compat pointers again. | ||
4288 | */ | ||
4289 | void netdev_resync_ops(struct net_device *dev) | ||
4290 | { | ||
4291 | #ifdef CONFIG_COMPAT_NET_DEV_OPS | ||
4292 | const struct net_device_ops *ops = dev->netdev_ops; | ||
4293 | |||
4294 | dev->init = ops->ndo_init; | ||
4295 | dev->uninit = ops->ndo_uninit; | ||
4296 | dev->open = ops->ndo_open; | ||
4297 | dev->change_rx_flags = ops->ndo_change_rx_flags; | ||
4298 | dev->set_rx_mode = ops->ndo_set_rx_mode; | ||
4299 | dev->set_multicast_list = ops->ndo_set_multicast_list; | ||
4300 | dev->set_mac_address = ops->ndo_set_mac_address; | ||
4301 | dev->validate_addr = ops->ndo_validate_addr; | ||
4302 | dev->do_ioctl = ops->ndo_do_ioctl; | ||
4303 | dev->set_config = ops->ndo_set_config; | ||
4304 | dev->change_mtu = ops->ndo_change_mtu; | ||
4305 | dev->neigh_setup = ops->ndo_neigh_setup; | ||
4306 | dev->tx_timeout = ops->ndo_tx_timeout; | ||
4307 | dev->get_stats = ops->ndo_get_stats; | ||
4308 | dev->vlan_rx_register = ops->ndo_vlan_rx_register; | ||
4309 | dev->vlan_rx_add_vid = ops->ndo_vlan_rx_add_vid; | ||
4310 | dev->vlan_rx_kill_vid = ops->ndo_vlan_rx_kill_vid; | ||
4311 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
4312 | dev->poll_controller = ops->ndo_poll_controller; | ||
4313 | #endif | ||
4314 | #endif | ||
4315 | } | ||
4316 | EXPORT_SYMBOL(netdev_resync_ops); | ||
4317 | |||
4285 | /** | 4318 | /** |
4286 | * register_netdevice - register a network device | 4319 | * register_netdevice - register a network device |
4287 | * @dev: device to register | 4320 | * @dev: device to register |
@@ -4326,27 +4359,7 @@ int register_netdevice(struct net_device *dev) | |||
4326 | * This is temporary until all network devices are converted. | 4359 | * This is temporary until all network devices are converted. |
4327 | */ | 4360 | */ |
4328 | if (dev->netdev_ops) { | 4361 | if (dev->netdev_ops) { |
4329 | const struct net_device_ops *ops = dev->netdev_ops; | 4362 | netdev_resync_ops(dev); |
4330 | |||
4331 | dev->init = ops->ndo_init; | ||
4332 | dev->uninit = ops->ndo_uninit; | ||
4333 | dev->open = ops->ndo_open; | ||
4334 | dev->change_rx_flags = ops->ndo_change_rx_flags; | ||
4335 | dev->set_rx_mode = ops->ndo_set_rx_mode; | ||
4336 | dev->set_multicast_list = ops->ndo_set_multicast_list; | ||
4337 | dev->set_mac_address = ops->ndo_set_mac_address; | ||
4338 | dev->validate_addr = ops->ndo_validate_addr; | ||
4339 | dev->do_ioctl = ops->ndo_do_ioctl; | ||
4340 | dev->set_config = ops->ndo_set_config; | ||
4341 | dev->change_mtu = ops->ndo_change_mtu; | ||
4342 | dev->tx_timeout = ops->ndo_tx_timeout; | ||
4343 | dev->get_stats = ops->ndo_get_stats; | ||
4344 | dev->vlan_rx_register = ops->ndo_vlan_rx_register; | ||
4345 | dev->vlan_rx_add_vid = ops->ndo_vlan_rx_add_vid; | ||
4346 | dev->vlan_rx_kill_vid = ops->ndo_vlan_rx_kill_vid; | ||
4347 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
4348 | dev->poll_controller = ops->ndo_poll_controller; | ||
4349 | #endif | ||
4350 | } else { | 4363 | } else { |
4351 | char drivername[64]; | 4364 | char drivername[64]; |
4352 | pr_info("%s (%s): not using net_device_ops yet\n", | 4365 | pr_info("%s (%s): not using net_device_ops yet\n", |