Subject: [PATCH 3/3] qla3xxx: ethtool ops for controlling checksum

From: Stephen Hemminger <[email-masked]>
Date: Wed, 30 May 2007 14:23:19 -0700

Add the ability to control scatter/gather and checksumming
via ethtool.

Compile tested only, no hardware available.

Signed-off-by: Stephen Hemminger <[email-masked]>

---
 drivers/net/qla3xxx.c |   33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

--- a/drivers/net/qla3xxx.c	2007-05-30 14:10:42.000000000 -0700
+++ b/drivers/net/qla3xxx.c	2007-05-30 14:15:37.000000000 -0700
@@ -1901,6 +1901,35 @@ static void ql_get_pauseparam(struct net
 	pause->tx_pause = (reg & MAC_CONFIG_REG_TF) >> 1;
 }
 
+static int ql_set_tx_csum(struct net_device *dev, u32 data)
+{
+	if (data) {
+		struct ql3_adapter *qdev = netdev_priv(ndev);
+
+		if (qdev->device_id != QL3032_DEVICE_ID)
+			return -EINVAL;
+
+		dev->features |= NETIF_F_IP_CSUM;
+	} else
+		dev->features &= ~NETIF_F_IP_CSUM;
+
+	return 0;
+}
+
+static int ql_set_sg(struct net_device *dev, u32 data)
+{
+	if (data) {
+		struct ql3_adapter *qdev = netdev_priv(ndev);
+
+		if (qdev->device_id != QL3032_DEVICE_ID)
+			return -EINVAL;
+		dev->features |= NETIF_F_SG;
+	} else
+		dev->features &= ~NETIF_F_SG;
+
+	return 0;
+}
+
 static const struct ethtool_ops ql3xxx_ethtool_ops = {
 	.get_settings = ql_get_settings,
 	.get_drvinfo = ql_get_drvinfo,
@@ -1909,6 +1938,10 @@ static const struct ethtool_ops ql3xxx_e
 	.get_msglevel = ql_get_msglevel,
 	.set_msglevel = ql_set_msglevel,
 	.get_pauseparam = ql_get_pauseparam,
+	.get_tx_csum = ql_op_get_tx_csum,
+	.set_tx_csum = ethtool_op_set_tx_csum,
+	.get_sg = ethtool_op_get_sg,
+	.set_sg = ql_get_sg,
 };
 
 static int ql_populate_free_queue(struct ql3_adapter *qdev)

-- 
Stephen Hemminger <[email-masked]>