netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next] net: add busy_poll device feature
@ 2014-04-02 21:09 Jiri Pirko
  2014-04-03 18:32 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Pirko @ 2014-04-02 21:09 UTC (permalink / raw)
  To: netdev
  Cc: davem, kaber, edumazet, vyasevic, horms, vfalico, nicolas.dichtel,
	ebiederm, stephen, hkchu, yanb, john.r.fastabend, dragos.foianu,
	bjorn, mschmidt, fernando_b1, ben

Currently there is no way how to find out if a device supports busy
polling. So add a feature and make it dependent on ndo_busy_poll
existence.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 include/linux/netdev_features.h | 2 ++
 net/core/dev.c                  | 7 +++++++
 net/core/ethtool.c              | 1 +
 3 files changed, 10 insertions(+)

diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 5a09a48..c26d0ec 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -63,6 +63,7 @@ enum {
 	NETIF_F_HW_VLAN_STAG_RX_BIT,	/* Receive VLAN STAG HW acceleration */
 	NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
 	NETIF_F_HW_L2FW_DOFFLOAD_BIT,	/* Allow L2 Forwarding in Hardware */
+	NETIF_F_BUSY_POLL_BIT,		/* Busy poll */
 
 	/*
 	 * Add your fresh new feature above and remember to update
@@ -118,6 +119,7 @@ enum {
 #define NETIF_F_HW_VLAN_STAG_RX	__NETIF_F(HW_VLAN_STAG_RX)
 #define NETIF_F_HW_VLAN_STAG_TX	__NETIF_F(HW_VLAN_STAG_TX)
 #define NETIF_F_HW_L2FW_DOFFLOAD	__NETIF_F(HW_L2FW_DOFFLOAD)
+#define NETIF_F_BUSY_POLL	__NETIF_F(BUSY_POLL)
 
 /* Features valid for ethtool to change */
 /* = all defined minus driver/device-class-related */
diff --git a/net/core/dev.c b/net/core/dev.c
index 48d81e4..fe30c8e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5696,6 +5696,13 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
 		}
 	}
 
+#ifdef CONFIG_NET_RX_BUSY_POLL
+	if (dev->netdev_ops->ndo_busy_poll)
+		features |= NETIF_F_BUSY_POLL;
+	else
+#endif
+		features &= ~NETIF_F_BUSY_POLL;
+
 	return features;
 }
 
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 30071de..640ba0e 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -97,6 +97,7 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
 	[NETIF_F_RXFCS_BIT] =            "rx-fcs",
 	[NETIF_F_RXALL_BIT] =            "rx-all",
 	[NETIF_F_HW_L2FW_DOFFLOAD_BIT] = "l2-fwd-offload",
+	[NETIF_F_BUSY_POLL_BIT] =        "busy-poll",
 };
 
 static int ethtool_get_features(struct net_device *dev, void __user *useraddr)
-- 
1.9.0

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

* Re: [patch net-next] net: add busy_poll device feature
  2014-04-02 21:09 [patch net-next] net: add busy_poll device feature Jiri Pirko
@ 2014-04-03 18:32 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-04-03 18:32 UTC (permalink / raw)
  To: jiri
  Cc: netdev, kaber, edumazet, vyasevic, horms, vfalico,
	nicolas.dichtel, ebiederm, stephen, hkchu, yanb, john.r.fastabend,
	dragos.foianu, bjorn, mschmidt, fernando_b1, ben

From: Jiri Pirko <jiri@resnulli.us>
Date: Wed,  2 Apr 2014 23:09:31 +0200

> Currently there is no way how to find out if a device supports busy
> polling. So add a feature and make it dependent on ndo_busy_poll
> existence.
> 
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>

Looks reasonable, applied, thanks Jiri.

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

end of thread, other threads:[~2014-04-03 18:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-02 21:09 [patch net-next] net: add busy_poll device feature Jiri Pirko
2014-04-03 18:32 ` 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).