netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch v2 net-next] veth: add netpoll support
@ 2014-06-23 22:36 Cong Wang
  2014-06-24 11:07 ` Neil Horman
  2014-06-25 23:35 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Cong Wang @ 2014-06-23 22:36 UTC (permalink / raw)
  To: netdev; +Cc: Stefan Priebe, Cong Wang, David S. Miller, Neil Horman

It is trivial to add netpoll support to veth, since
it is not a stacked device, we don't need to setup and
clean up netpoll.

Reported-by: Stefan Priebe <s.priebe@profihost.ag>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 drivers/net/veth.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index b4a10bc..9b945e6 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -248,6 +248,21 @@ static void veth_dev_free(struct net_device *dev)
 	free_netdev(dev);
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static void veth_poll_controller(struct net_device *dev)
+{
+	/* veth only receives frames when its peer sends one
+	 * Since it's a synchronous operation, we are guaranteed
+	 * never to have pending data when we poll for it so
+	 * there is nothing to do here.
+	 *
+	 * We need this though so netpoll recognizes us as an interface that
+	 * supports polling, which enables bridge devices in virt setups to
+	 * still use netconsole
+	 */
+}
+#endif	/* CONFIG_NET_POLL_CONTROLLER */
+
 static const struct net_device_ops veth_netdev_ops = {
 	.ndo_init            = veth_dev_init,
 	.ndo_open            = veth_open,
@@ -257,6 +272,9 @@ static const struct net_device_ops veth_netdev_ops = {
 	.ndo_get_stats64     = veth_get_stats64,
 	.ndo_set_rx_mode     = veth_set_multicast_list,
 	.ndo_set_mac_address = eth_mac_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	.ndo_poll_controller	= veth_poll_controller,
+#endif
 };
 
 #define VETH_FEATURES (NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_ALL_TSO |    \
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Patch v2 net-next] veth: add netpoll support
  2014-06-23 22:36 [Patch v2 net-next] veth: add netpoll support Cong Wang
@ 2014-06-24 11:07 ` Neil Horman
  2014-06-25 23:35 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Horman @ 2014-06-24 11:07 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, Stefan Priebe, David S. Miller

On Mon, Jun 23, 2014 at 03:36:02PM -0700, Cong Wang wrote:
> It is trivial to add netpoll support to veth, since
> it is not a stacked device, we don't need to setup and
> clean up netpoll.
> 
> Reported-by: Stefan Priebe <s.priebe@profihost.ag>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Neil Horman <nhorman@tuxdriver.com>
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
>  drivers/net/veth.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index b4a10bc..9b945e6 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -248,6 +248,21 @@ static void veth_dev_free(struct net_device *dev)
>  	free_netdev(dev);
>  }
>  
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> +static void veth_poll_controller(struct net_device *dev)
> +{
> +	/* veth only receives frames when its peer sends one
> +	 * Since it's a synchronous operation, we are guaranteed
> +	 * never to have pending data when we poll for it so
> +	 * there is nothing to do here.
> +	 *
> +	 * We need this though so netpoll recognizes us as an interface that
> +	 * supports polling, which enables bridge devices in virt setups to
> +	 * still use netconsole
> +	 */
> +}
> +#endif	/* CONFIG_NET_POLL_CONTROLLER */
> +
>  static const struct net_device_ops veth_netdev_ops = {
>  	.ndo_init            = veth_dev_init,
>  	.ndo_open            = veth_open,
> @@ -257,6 +272,9 @@ static const struct net_device_ops veth_netdev_ops = {
>  	.ndo_get_stats64     = veth_get_stats64,
>  	.ndo_set_rx_mode     = veth_set_multicast_list,
>  	.ndo_set_mac_address = eth_mac_addr,
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> +	.ndo_poll_controller	= veth_poll_controller,
> +#endif
>  };
>  
>  #define VETH_FEATURES (NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_ALL_TSO |    \
> -- 
> 1.8.3.1
> 
> 

Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch v2 net-next] veth: add netpoll support
  2014-06-23 22:36 [Patch v2 net-next] veth: add netpoll support Cong Wang
  2014-06-24 11:07 ` Neil Horman
@ 2014-06-25 23:35 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-06-25 23:35 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, s.priebe, nhorman

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 23 Jun 2014 15:36:02 -0700

> It is trivial to add netpoll support to veth, since
> it is not a stacked device, we don't need to setup and
> clean up netpoll.
> 
> Reported-by: Stefan Priebe <s.priebe@profihost.ag>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Neil Horman <nhorman@tuxdriver.com>
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-25 23:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-23 22:36 [Patch v2 net-next] veth: add netpoll support Cong Wang
2014-06-24 11:07 ` Neil Horman
2014-06-25 23:35 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).