From patchwork Wed Jun 9 10:05:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amerigo Wang X-Patchwork-Id: 55068 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4096FB7D5B for ; Wed, 9 Jun 2010 20:05:36 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756778Ab0FIKFc (ORCPT ); Wed, 9 Jun 2010 06:05:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1026 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751677Ab0FIKFb (ORCPT ); Wed, 9 Jun 2010 06:05:31 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o59A5Sg8019667 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 9 Jun 2010 06:05:28 -0400 Received: from localhost.localdomain (dhcp-65-141.nay.redhat.com [10.66.65.141]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o59A5OOB022299; Wed, 9 Jun 2010 06:05:25 -0400 Date: Wed, 9 Jun 2010 06:05:24 -0400 From: Amerigo Wang To: netdev@vger.kernel.org Cc: nhorman@redhat.com, sgruszka@redhat.com, herbert.xu@redhat.com, Amerigo Wang , bhutchings@solarflare.com, Ramkrishna.Vepa@exar.com, davem@davemloft.net Message-Id: <20100609100928.6573.14199.sendpatchset@localhost.localdomain> Subject: [v2 Patch 1/2] s2io: add dynamic LRO disable support X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch adds dynamic LRO diable support for s2io net driver. I don't have s2io card, so only did compiling test. Anyone who wants to test this is more than welcome. This is based on Neil's initial work. Signed-off-by: WANG Cong Signed-off-by: Neil Horman Acked-by: Neil Horman Reviewed-by: Stanislaw Gruszka Cc: Ramkrishna Vepa --- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 668327c..e558aa7 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c @@ -795,7 +795,6 @@ static int init_shared_mem(struct s2io_nic *nic) ring->rx_curr_put_info.ring_len = rx_cfg->num_rxd - 1; ring->nic = nic; ring->ring_no = i; - ring->lro = lro_enable; blk_cnt = rx_cfg->num_rxd / (rxd_count[nic->rxd_mode] + 1); /* Allocating all the Rx blocks */ @@ -6684,6 +6683,35 @@ static int s2io_ethtool_op_set_tso(struct net_device *dev, u32 data) return 0; } +static int s2io_ethtool_set_flags(struct net_device *dev, u32 data) +{ + struct s2io_nic *sp = netdev_priv(dev); + int rc = 0; + int changed = 0; + + if (data & ETH_FLAG_LRO) { + if (lro_enable) { + if (!(dev->features & NETIF_F_LRO)) { + dev->features |= NETIF_F_LRO; + changed = 1; + } + } else + rc = -EINVAL; + } else if (dev->features & NETIF_F_LRO) { + dev->features &= ~NETIF_F_LRO; + changed = 1; + } + + if (changed && netif_running(dev)) { + s2io_stop_all_tx_queue(sp); + s2io_card_down(sp); + sp->lro = dev->features & NETIF_F_LRO; + rc = s2io_card_up(sp); + s2io_start_all_tx_queue(sp); + } + + return rc; +} static const struct ethtool_ops netdev_ethtool_ops = { .get_settings = s2io_ethtool_gset, @@ -6701,6 +6729,8 @@ static const struct ethtool_ops netdev_ethtool_ops = { .get_rx_csum = s2io_ethtool_get_rx_csum, .set_rx_csum = s2io_ethtool_set_rx_csum, .set_tx_csum = s2io_ethtool_op_set_tx_csum, + .set_flags = s2io_ethtool_set_flags, + .get_flags = ethtool_op_get_flags, .set_sg = ethtool_op_set_sg, .get_tso = s2io_ethtool_op_get_tso, .set_tso = s2io_ethtool_op_set_tso, @@ -7229,6 +7259,7 @@ static int s2io_card_up(struct s2io_nic *sp) struct ring_info *ring = &mac_control->rings[i]; ring->mtu = dev->mtu; + ring->lro = sp->lro; ret = fill_rx_buffers(sp, ring, 1); if (ret) { DBG_PRINT(ERR_DBG, "%s: Out of memory in Open\n",