Patchwork [PATCHv3,NEXT,7/7] qlcnic: turn off lro when rxcsum is disabled.

login
register
mail settings
Submitter amit salecha
Date Aug. 17, 2010, 10:34 a.m.
Message ID <1282041265-32591-8-git-send-email-amit.salecha@qlogic.com>
Download mbox | patch
Permalink /patch/61880/
State Accepted
Delegated to: David Miller
Headers show

Comments

amit salecha - Aug. 17, 2010, 10:34 a.m.
From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>

o Also dont allow lro to be turn on, if rx csum is disabled

Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
 drivers/net/qlcnic/qlcnic.h         |    1 +
 drivers/net/qlcnic/qlcnic_ethtool.c |   23 +++++++++++++++++++++++
 drivers/net/qlcnic/qlcnic_main.c    |    2 +-
 3 files changed, 25 insertions(+), 1 deletions(-)
Joe Perches - Aug. 17, 2010, 2:48 p.m.
On Tue, 2010-08-17 at 03:34 -0700, Amit Kumar Salecha wrote:
> From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>

Thanks all, 2 minor comments below.

> --- a/drivers/net/qlcnic/qlcnic_ethtool.c
> +++ b/drivers/net/qlcnic/qlcnic_ethtool.c
> @@ -818,7 +818,21 @@ static u32 qlcnic_get_rx_csum(struct net_device *dev)
>  static int qlcnic_set_rx_csum(struct net_device *dev, u32 data)
[]
> 	dev_info(&adapter->pdev->dev, "disabling LRO as rx_csum is off\n");

I think netdev_<level> should be used when a
struct net_device * is available.

	netdev_info(dev, "disabling LRO as rx_csum is off\n");

> @@ -1001,6 +1015,15 @@ static int qlcnic_set_flags(struct net_device *netdev, u32 data)
[]
> +	if (!adapter->rx_csum) {
> +		dev_info(&adapter->pdev->dev, "rx csum is off, "
> +			"cannot toggle lro\n");

		netdev_info(netdev, "rx csum is off, cannot toggle LRO\n");

and please use consistent acronym case.

--
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
amit salecha - Aug. 18, 2010, 6:39 a.m.
>> I think netdev_<level> should be used when a struct net_device * is available.


Will take care in future.

-----Original Message-----
From: Joe Perches [mailto:joe@perches.com] 

Sent: Tuesday, August 17, 2010 8:19 PM
To: Amit Salecha
Cc: davem@davemloft.net; netdev@vger.kernel.org; Ameen Rahman; Sucheta Chakraborty
Subject: Re: [PATCHv3 NEXT 7/7] qlcnic: turn off lro when rxcsum is disabled.

On Tue, 2010-08-17 at 03:34 -0700, Amit Kumar Salecha wrote:
> From: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>


Thanks all, 2 minor comments below.

> --- a/drivers/net/qlcnic/qlcnic_ethtool.c

> +++ b/drivers/net/qlcnic/qlcnic_ethtool.c

> @@ -818,7 +818,21 @@ static u32 qlcnic_get_rx_csum(struct net_device *dev)

>  static int qlcnic_set_rx_csum(struct net_device *dev, u32 data)

[]
> 	dev_info(&adapter->pdev->dev, "disabling LRO as rx_csum is off\n");


I think netdev_<level> should be used when a
struct net_device * is available.

	netdev_info(dev, "disabling LRO as rx_csum is off\n");

> @@ -1001,6 +1015,15 @@ static int qlcnic_set_flags(struct net_device *netdev, u32 data)

[]
> +	if (!adapter->rx_csum) {

> +		dev_info(&adapter->pdev->dev, "rx csum is off, "

> +			"cannot toggle lro\n");


		netdev_info(netdev, "rx csum is off, cannot toggle LRO\n");

and please use consistent acronym case.

Patch

diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 7f4e11b..f6b887d 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -894,6 +894,7 @@  struct qlcnic_mac_req {
 #define QLCNIC_MSI_ENABLED		0x02
 #define QLCNIC_MSIX_ENABLED		0x04
 #define QLCNIC_LRO_ENABLED		0x08
+#define QLCNIC_LRO_DISABLED		0x00
 #define QLCNIC_BRIDGE_ENABLED       	0X10
 #define QLCNIC_DIAG_ENABLED		0x20
 #define QLCNIC_ESWITCH_ENABLED		0x40
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 3d4655d..e38fc3d 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -818,7 +818,21 @@  static u32 qlcnic_get_rx_csum(struct net_device *dev)
 static int qlcnic_set_rx_csum(struct net_device *dev, u32 data)
 {
 	struct qlcnic_adapter *adapter = netdev_priv(dev);
+
+	if (!!data) {
+		adapter->rx_csum = !!data;
+		return 0;
+	}
+
+	if (adapter->flags & QLCNIC_LRO_ENABLED) {
+		if (qlcnic_config_hw_lro(adapter, QLCNIC_LRO_DISABLED))
+			return -EIO;
+
+		dev->features &= ~NETIF_F_LRO;
+		qlcnic_send_lro_cleanup(adapter);
+	}
 	adapter->rx_csum = !!data;
+	dev_info(&adapter->pdev->dev, "disabling LRO as rx_csum is off\n");
 	return 0;
 }
 
@@ -1001,6 +1015,15 @@  static int qlcnic_set_flags(struct net_device *netdev, u32 data)
 	if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO))
 		return -EINVAL;
 
+	if (!adapter->rx_csum) {
+		dev_info(&adapter->pdev->dev, "rx csum is off, "
+			"cannot toggle lro\n");
+		return -EINVAL;
+	}
+
+	if ((data & ETH_FLAG_LRO) && (adapter->flags & QLCNIC_LRO_ENABLED))
+		return 0;
+
 	if (data & ETH_FLAG_LRO) {
 		hw_lro = QLCNIC_LRO_ENABLED;
 		netdev->features |= NETIF_F_LRO;
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index bf4077a..abd7cd6 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -995,7 +995,7 @@  __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev)
 
 	qlcnic_config_intr_coalesce(adapter);
 
-	if (adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO)
+	if (netdev->features & NETIF_F_LRO)
 		qlcnic_config_hw_lro(adapter, QLCNIC_LRO_ENABLED);
 
 	qlcnic_napi_enable(adapter);