Re: [PATCH] Allow TSO to be disabled for forcedeth driver

From: Zachary Amsden
Date: Fri Jun 02 2006 - 01:53:44 EST


Ayaz Abdulla wrote:

However, please change your patch to account for the ifdef NETIF_F_TSO and you don't need spin lock around this change. For example, here are the snippets:

Done Implement get / set tso for forcedeth driver.

Signed-off-by: Zachary Amsden <zach@xxxxxxxxxx>

Index: linux-2.6.17-rc/drivers/net/forcedeth.c
===================================================================
--- linux-2.6.17-rc.orig/drivers/net/forcedeth.c 2006-05-18 13:31:55.000000000 -0700
+++ linux-2.6.17-rc/drivers/net/forcedeth.c 2006-06-01 16:00:58.000000000 -0700
@@ -2615,6 +2615,23 @@ static int nv_nway_reset(struct net_devi
return ret;
}

+#ifdef NETIF_F_TSO
+static int nv_set_tso(struct net_device *dev, u32 value)
+{
+ struct fe_priv *np = netdev_priv(dev);
+ int ret;
+
+ spin_lock_irq(&np->lock);
+ if ((np->driver_data & DEV_HAS_CHECKSUM))
+ ret = ethtool_op_set_tso(dev, value);
+ else
+ ret = value ? -EOPNOTSUPP : 0;
+ spin_unlock_irq(&np->lock);
+
+ return ret;
+}
+#endif
+
static struct ethtool_ops ops = {
.get_drvinfo = nv_get_drvinfo,
.get_link = ethtool_op_get_link,
@@ -2626,6 +2643,10 @@ static struct ethtool_ops ops = {
.get_regs = nv_get_regs,
.nway_reset = nv_nway_reset,
.get_perm_addr = ethtool_op_get_perm_addr,
+#ifdef NETIF_F_TSO
+ .get_tso = ethtool_op_get_tso,
+ .set_tso = nv_set_tso
+#endif
};

static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)