Thread (10 messages) 10 messages, 2 authors, 2014-07-27
STALE4352d
Revisions (4)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]

[PATCH net-next 3/3] enic: add ethtool support for set/get rx_copybreak

From: Govindarajulu Varadarajan <hidden>
Date: 2014-07-22 17:32:17
Subsystem: cisco vic ethernet nic driver, networking drivers, the rest · Maintainers: Satish Kharat, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

This patch provides set_ringparam & get_ringparam ethtool_ops to set/get
rx_copybreak.

As of now, enic does not support change of rx/tx ring size. Allow change of
rx_copybreak alone.

Signed-off-by: Govindarajulu Varadarajan <redacted>
---
 drivers/net/ethernet/cisco/enic/enic_ethtool.c | 31 ++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
diff --git a/drivers/net/ethernet/cisco/enic/enic_ethtool.c b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
index 523c9ce..6780719 100644
--- a/drivers/net/ethernet/cisco/enic/enic_ethtool.c
+++ b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
@@ -18,6 +18,7 @@
 
 #include <linux/netdevice.h>
 #include <linux/ethtool.h>
+#include <linux/if_vlan.h>
 
 #include "enic_res.h"
 #include "enic.h"
@@ -379,6 +380,34 @@ static int enic_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
 	return ret;
 }
 
+static void enic_get_ringparam(struct net_device *netdev,
+			       struct ethtool_ringparam *ring)
+{
+	struct enic *enic = netdev_priv(netdev);
+
+	ring->rx_max_pending = enic->rq[0].ring.desc_count;
+	ring->rx_pending = enic->rq[0].ring.desc_count;
+	ring->tx_max_pending = enic->wq[0].ring.desc_count;
+	ring->tx_pending = enic->wq[0].ring.desc_count;
+	ring->rx_copybreak_pending = enic->rx_copybreak;
+	ring->rx_max_copybreak_pending = netdev->mtu + VLAN_ETH_HLEN;
+}
+
+static int enic_set_ringparam(struct net_device *netdev,
+			      struct ethtool_ringparam *ring)
+{
+	struct enic *enic = netdev_priv(netdev);
+
+	if (ring->rx_copybreak_pending > (netdev->mtu + VLAN_ETH_HLEN) ||
+	    enic->rq[0].ring.desc_count != ring->rx_pending ||
+	    enic->wq[0].ring.desc_count != ring->tx_pending ||
+	    ring->rx_mini_pending || ring->rx_jumbo_pending)
+		return -EINVAL;
+	enic->rx_copybreak = ring->rx_copybreak_pending;
+
+	return 0;
+}
+
 static const struct ethtool_ops enic_ethtool_ops = {
 	.get_settings = enic_get_settings,
 	.get_drvinfo = enic_get_drvinfo,
@@ -391,6 +420,8 @@ static const struct ethtool_ops enic_ethtool_ops = {
 	.get_coalesce = enic_get_coalesce,
 	.set_coalesce = enic_set_coalesce,
 	.get_rxnfc = enic_get_rxnfc,
+	.get_ringparam = enic_get_ringparam,
+	.set_ringparam = enic_set_ringparam,
 };
 
 void enic_set_ethtool_ops(struct net_device *netdev)
-- 
2.0.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help