From patchwork Thu Mar 4 13:16:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Or Gerlitz X-Patchwork-Id: 83592 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o24DGuWo000836 for ; Thu, 4 Mar 2010 13:16:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752601Ab0CDNQz (ORCPT ); Thu, 4 Mar 2010 08:16:55 -0500 Received: from fwil.voltaire.com ([193.47.165.2]:13084 "EHLO exil.voltaire.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752597Ab0CDNQz (ORCPT ); Thu, 4 Mar 2010 08:16:55 -0500 Received: from zuben.voltaire.com ([172.25.5.15]) by exil.voltaire.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 4 Mar 2010 15:16:52 +0200 Date: Thu, 4 Mar 2010 15:16:52 +0200 (IST) From: Or Gerlitz To: Roland Dreier cc: linux-rdma Subject: [PATCH 1/2] ib/ipoib: allow disabling/enabling TSO through ethtool Message-ID: MIME-Version: 1.0 X-OriginalArrivalTime: 04 Mar 2010 13:16:52.0109 (UTC) FILETIME=[F4475BD0:01CABB9C] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 04 Mar 2010 13:16:56 +0000 (UTC) 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,