diff options
| -rw-r--r-- | include/linux/netdevice.h | 2 | ||||
| -rw-r--r-- | net/core/netpoll.c | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 4fbccc5f609a..fb20cc55ba52 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -744,6 +744,8 @@ struct net_device_ops { | |||
| 744 | unsigned short vid); | 744 | unsigned short vid); |
| 745 | #ifdef CONFIG_NET_POLL_CONTROLLER | 745 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 746 | void (*ndo_poll_controller)(struct net_device *dev); | 746 | void (*ndo_poll_controller)(struct net_device *dev); |
| 747 | int (*ndo_netpoll_setup)(struct net_device *dev, | ||
| 748 | struct netpoll_info *info); | ||
| 747 | void (*ndo_netpoll_cleanup)(struct net_device *dev); | 749 | void (*ndo_netpoll_cleanup)(struct net_device *dev); |
| 748 | #endif | 750 | #endif |
| 749 | int (*ndo_set_vf_mac)(struct net_device *dev, | 751 | int (*ndo_set_vf_mac)(struct net_device *dev, |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index d10c249bcc8f..7de6dcad5d79 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
| @@ -698,6 +698,7 @@ int netpoll_setup(struct netpoll *np) | |||
| 698 | struct net_device *ndev = NULL; | 698 | struct net_device *ndev = NULL; |
| 699 | struct in_device *in_dev; | 699 | struct in_device *in_dev; |
| 700 | struct netpoll_info *npinfo; | 700 | struct netpoll_info *npinfo; |
| 701 | const struct net_device_ops *ops; | ||
| 701 | unsigned long flags; | 702 | unsigned long flags; |
| 702 | int err; | 703 | int err; |
| 703 | 704 | ||
| @@ -797,6 +798,13 @@ int netpoll_setup(struct netpoll *np) | |||
| 797 | INIT_DELAYED_WORK(&npinfo->tx_work, queue_process); | 798 | INIT_DELAYED_WORK(&npinfo->tx_work, queue_process); |
| 798 | 799 | ||
| 799 | atomic_set(&npinfo->refcnt, 1); | 800 | atomic_set(&npinfo->refcnt, 1); |
| 801 | |||
| 802 | ops = np->dev->netdev_ops; | ||
| 803 | if (ops->ndo_netpoll_setup) { | ||
| 804 | err = ops->ndo_netpoll_setup(ndev, npinfo); | ||
| 805 | if (err) | ||
| 806 | goto free_npinfo; | ||
| 807 | } | ||
| 800 | } else { | 808 | } else { |
| 801 | npinfo = ndev->npinfo; | 809 | npinfo = ndev->npinfo; |
| 802 | atomic_inc(&npinfo->refcnt); | 810 | atomic_inc(&npinfo->refcnt); |
| @@ -817,6 +825,8 @@ int netpoll_setup(struct netpoll *np) | |||
| 817 | 825 | ||
| 818 | return 0; | 826 | return 0; |
| 819 | 827 | ||
| 828 | free_npinfo: | ||
| 829 | kfree(npinfo); | ||
| 820 | unlock: | 830 | unlock: |
| 821 | rtnl_unlock(); | 831 | rtnl_unlock(); |
| 822 | put: | 832 | put: |
