lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 29 Jul 2014 17:10:39 +0530
From:	Govindarajulu Varadarajan <_govind@....com>
To:	davem@...emloft.net, ben@...adent.org.uk, netdev@...r.kernel.org
Cc:	ssujith@...co.com, benve@...co.com,
	Govindarajulu Varadarajan <_govind@....com>
Subject: [PATCH net-next v2 3/3] enic: add ethtool support set/show rx_copybreak

Add ethtools support for get/set_buffparam.

This is used to set the driver rx_copybreak value. Do not allow rx_copybreak
value to be set more than max frame size.

Signed-off-by: Govindarajulu Varadarajan <_govind@....com>
---
 drivers/net/ethernet/cisco/enic/enic_ethtool.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/net/ethernet/cisco/enic/enic_ethtool.c b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
index 523c9ce..4c9eb52 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,27 @@ static int enic_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
 	return ret;
 }
 
+static void enic_get_buffparam(struct net_device *netdev,
+			       struct ethtool_buffparam *data)
+{
+	struct enic *enic = netdev_priv(netdev);
+
+	data->rx_copybreak_cur = enic->rx_copybreak;
+	data->rx_copybreak_max = netdev->mtu + VLAN_ETH_HLEN;
+}
+
+static int enic_set_buffparam(struct net_device *netdev,
+			      struct ethtool_buffparam *data)
+{
+	struct enic *enic = netdev_priv(netdev);
+
+	if (data->rx_copybreak_cur > netdev->mtu + VLAN_ETH_HLEN)
+		return -EINVAL;
+	enic->rx_copybreak = data->rx_copybreak_cur;
+
+	return 0;
+}
+
 static const struct ethtool_ops enic_ethtool_ops = {
 	.get_settings = enic_get_settings,
 	.get_drvinfo = enic_get_drvinfo,
@@ -391,6 +413,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_buffparam = enic_get_buffparam,
+	.set_buffparam = enic_set_buffparam,
 };
 
 void enic_set_ethtool_ops(struct net_device *netdev)
-- 
2.0.3

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ