From: Herbert Xu Date: Thu, 10 Jun 2010 16:12:47 +0000 (+0000) Subject: netpoll: Add ndo_netpoll_setup X-Git-Tag: v2.6.36-rc1~571^2~585 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4247e161b12f8dffb7ee3ee07bc5e61f714ebe2d;p=platform%2Fkernel%2Flinux-3.10.git netpoll: Add ndo_netpoll_setup This patch adds ndo_netpoll_setup as the initialisation primitive to complement ndo_netpoll_cleanup. Signed-off-by: Herbert Xu Signed-off-by: David S. Miller --- diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 4fbccc5..fb20cc5 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -744,6 +744,8 @@ struct net_device_ops { unsigned short vid); #ifdef CONFIG_NET_POLL_CONTROLLER void (*ndo_poll_controller)(struct net_device *dev); + int (*ndo_netpoll_setup)(struct net_device *dev, + struct netpoll_info *info); void (*ndo_netpoll_cleanup)(struct net_device *dev); #endif int (*ndo_set_vf_mac)(struct net_device *dev, diff --git a/net/core/netpoll.c b/net/core/netpoll.c index d10c249..7de6dca 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -698,6 +698,7 @@ int netpoll_setup(struct netpoll *np) struct net_device *ndev = NULL; struct in_device *in_dev; struct netpoll_info *npinfo; + const struct net_device_ops *ops; unsigned long flags; int err; @@ -797,6 +798,13 @@ int netpoll_setup(struct netpoll *np) INIT_DELAYED_WORK(&npinfo->tx_work, queue_process); atomic_set(&npinfo->refcnt, 1); + + ops = np->dev->netdev_ops; + if (ops->ndo_netpoll_setup) { + err = ops->ndo_netpoll_setup(ndev, npinfo); + if (err) + goto free_npinfo; + } } else { npinfo = ndev->npinfo; atomic_inc(&npinfo->refcnt); @@ -817,6 +825,8 @@ int netpoll_setup(struct netpoll *np) return 0; +free_npinfo: + kfree(npinfo); unlock: rtnl_unlock(); put: