* [PATCH 1/2] ib/ipoib: allow disabling/enabling TSO through ethtool
@ 2010-03-04 13:16 Or Gerlitz
[not found] ` <Pine.LNX.4.64.1003041516300.2755-aDiYczhfhVLdX2U7gxhm1tBPR1lH4CV8@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Or Gerlitz @ 2010-03-04 13:16 UTC (permalink / raw)
To: Roland Dreier; +Cc: linux-rdma
allow disabling/enabling TSO on the fly by ethtool
Signed-off-by: Or Gerlitz <ogerlitz-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
Index: linux-2.6.33/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
===================================================================
--- linux-2.6.33.orig/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
+++ linux-2.6.33/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
@@ -49,6 +49,24 @@ static u32 ipoib_get_rx_csum(struct net_
!test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
}
+static int ipoib_set_tso(struct net_device *dev, u32 data)
+{
+ struct ipoib_dev_priv *priv = netdev_priv(dev);
+
+ if (data) {
+ if (!test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags) &&
+ (dev->features & NETIF_F_SG) &&
+ (priv->hca_caps & IB_DEVICE_UD_TSO))
+ dev->features |= NETIF_F_TSO;
+ else {
+ ipoib_warn(priv, "can't set TSO on\n");
+ return -EOPNOTSUPP;
+ }
+ } else
+ dev->features &= ~NETIF_F_TSO;
+ return 0;
+}
+
static int ipoib_get_coalesce(struct net_device *dev,
struct ethtool_coalesce *coal)
{
@@ -131,6 +149,7 @@ static void ipoib_get_ethtool_stats(stru
static const struct ethtool_ops ipoib_ethtool_ops = {
.get_drvinfo = ipoib_get_drvinfo,
.get_rx_csum = ipoib_get_rx_csum,
+ .set_tso = ipoib_set_tso,
.get_coalesce = ipoib_get_coalesce,
.set_coalesce = ipoib_set_coalesce,
.get_flags = ethtool_op_get_flags,
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread[parent not found: <Pine.LNX.4.64.1003041516300.2755-aDiYczhfhVLdX2U7gxhm1tBPR1lH4CV8@public.gmane.org>]
* Re: [PATCH 1/2] ib/ipoib: allow disabling/enabling TSO through ethtool [not found] ` <Pine.LNX.4.64.1003041516300.2755-aDiYczhfhVLdX2U7gxhm1tBPR1lH4CV8@public.gmane.org> @ 2010-03-04 13:40 ` Eli Cohen [not found] ` <20100304134018.GA17107-8YAHvHwT2UEvbXDkjdHOrw/a8Rv0c6iv@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Eli Cohen @ 2010-03-04 13:40 UTC (permalink / raw) To: Or Gerlitz; +Cc: Roland Dreier, linux-rdma On Thu, Mar 04, 2010 at 03:16:52PM +0200, Or Gerlitz wrote: > > +static int ipoib_set_tso(struct net_device *dev, u32 data) > +{ > + struct ipoib_dev_priv *priv = netdev_priv(dev); > + > + if (data) { > + if (!test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags) && > + (dev->features & NETIF_F_SG) && > + (priv->hca_caps & IB_DEVICE_UD_TSO)) > + dev->features |= NETIF_F_TSO; > + else { > + ipoib_warn(priv, "can't set TSO on\n"); > + return -EOPNOTSUPP; > + } > + } else > + dev->features &= ~NETIF_F_TSO; > + return 0; > +} > + I believe dev->features should be protected by rtnl lock. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <20100304134018.GA17107-8YAHvHwT2UEvbXDkjdHOrw/a8Rv0c6iv@public.gmane.org>]
* Re: [PATCH 1/2] ib/ipoib: allow disabling/enabling TSO through ethtool [not found] ` <20100304134018.GA17107-8YAHvHwT2UEvbXDkjdHOrw/a8Rv0c6iv@public.gmane.org> @ 2010-03-04 14:42 ` Or Gerlitz 2010-03-04 15:13 ` Or Gerlitz 1 sibling, 0 replies; 4+ messages in thread From: Or Gerlitz @ 2010-03-04 14:42 UTC (permalink / raw) To: Eli Cohen; +Cc: Roland Dreier, linux-rdma Eli Cohen wrote: > I believe dev->features should be protected by rtnl lock. okay, will fix, thanks Or. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ib/ipoib: allow disabling/enabling TSO through ethtool [not found] ` <20100304134018.GA17107-8YAHvHwT2UEvbXDkjdHOrw/a8Rv0c6iv@public.gmane.org> 2010-03-04 14:42 ` Or Gerlitz @ 2010-03-04 15:13 ` Or Gerlitz 1 sibling, 0 replies; 4+ messages in thread From: Or Gerlitz @ 2010-03-04 15:13 UTC (permalink / raw) To: Eli Cohen; +Cc: Roland Dreier, linux-rdma Eli Cohen wrote: > I believe dev->features should be protected by rtnl lock. NAK. ethtool issues the SIOCETHTOOL ioctl which goes to net/core/dev.c :: dev_ioctl who in turn wraps the call to dev_ethtool with rtnl_lock/unlock, see below. I have also verified this in practice, that is rtnl_trylock() always fails if called from ipoib ethtool code Or. > case SIOCETHTOOL: > dev_load(net, ifr.ifr_name); > rtnl_lock(); > ret = dev_ethtool(net, &ifr); > rtnl_unlock(); -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-03-04 15:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-04 13:16 [PATCH 1/2] ib/ipoib: allow disabling/enabling TSO through ethtool Or Gerlitz
[not found] ` <Pine.LNX.4.64.1003041516300.2755-aDiYczhfhVLdX2U7gxhm1tBPR1lH4CV8@public.gmane.org>
2010-03-04 13:40 ` Eli Cohen
[not found] ` <20100304134018.GA17107-8YAHvHwT2UEvbXDkjdHOrw/a8Rv0c6iv@public.gmane.org>
2010-03-04 14:42 ` Or Gerlitz
2010-03-04 15:13 ` Or Gerlitz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox