diff options
author | Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> | 2011-01-02 16:58:44 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-03 14:56:18 -0500 |
commit | e4baaf719807ffc87c6321f3914b93dd512b64c4 (patch) | |
tree | 5359b43fa0ec3aa362cd7bb1c48c26d044d2510a /drivers/net/netxen | |
parent | 0cf445ceaf43be31c5fc70b0e2d5fdccb291c925 (diff) |
netxen: enable LRO based on NETIF_F_LRO
o Enable/disable LRO in device based on NETIF_F_LRO flag, instead of using
driver private flag.
o Disable LRO, if rx csum offloading is off.
David Miller,
You should use netdev_info() instead of dev_info().
Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 1 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_ethtool.c | 26 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 5 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 4 |
4 files changed, 26 insertions, 10 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 8e8a97839cb0..4e545873a2b9 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -1132,6 +1132,7 @@ typedef struct { | |||
1132 | #define NETXEN_NIC_MSI_ENABLED 0x02 | 1132 | #define NETXEN_NIC_MSI_ENABLED 0x02 |
1133 | #define NETXEN_NIC_MSIX_ENABLED 0x04 | 1133 | #define NETXEN_NIC_MSIX_ENABLED 0x04 |
1134 | #define NETXEN_NIC_LRO_ENABLED 0x08 | 1134 | #define NETXEN_NIC_LRO_ENABLED 0x08 |
1135 | #define NETXEN_NIC_LRO_DISABLED 0x00 | ||
1135 | #define NETXEN_NIC_BRIDGE_ENABLED 0X10 | 1136 | #define NETXEN_NIC_BRIDGE_ENABLED 0X10 |
1136 | #define NETXEN_NIC_DIAG_ENABLED 0x20 | 1137 | #define NETXEN_NIC_DIAG_ENABLED 0x20 |
1137 | #define NETXEN_IS_MSI_FAMILY(adapter) \ | 1138 | #define NETXEN_IS_MSI_FAMILY(adapter) \ |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index b30de24f4a52..587498e140bb 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -720,7 +720,21 @@ static u32 netxen_nic_get_rx_csum(struct net_device *dev) | |||
720 | static int netxen_nic_set_rx_csum(struct net_device *dev, u32 data) | 720 | static int netxen_nic_set_rx_csum(struct net_device *dev, u32 data) |
721 | { | 721 | { |
722 | struct netxen_adapter *adapter = netdev_priv(dev); | 722 | struct netxen_adapter *adapter = netdev_priv(dev); |
723 | adapter->rx_csum = !!data; | 723 | |
724 | if (data) { | ||
725 | adapter->rx_csum = data; | ||
726 | return 0; | ||
727 | } | ||
728 | |||
729 | if (dev->features & NETIF_F_LRO) { | ||
730 | if (netxen_config_hw_lro(adapter, NETXEN_NIC_LRO_DISABLED)) | ||
731 | return -EIO; | ||
732 | |||
733 | dev->features &= ~NETIF_F_LRO; | ||
734 | netxen_send_lro_cleanup(adapter); | ||
735 | netdev_info(dev, "disabling LRO as rx_csum is off\n"); | ||
736 | } | ||
737 | adapter->rx_csum = data; | ||
724 | return 0; | 738 | return 0; |
725 | } | 739 | } |
726 | 740 | ||
@@ -893,11 +907,19 @@ static int netxen_nic_set_flags(struct net_device *netdev, u32 data) | |||
893 | if (!(adapter->capabilities & NX_FW_CAPABILITY_HW_LRO)) | 907 | if (!(adapter->capabilities & NX_FW_CAPABILITY_HW_LRO)) |
894 | return -EINVAL; | 908 | return -EINVAL; |
895 | 909 | ||
910 | if (!adapter->rx_csum) { | ||
911 | netdev_info(netdev, "rx csum is off, cannot toggle LRO\n"); | ||
912 | return -EINVAL; | ||
913 | } | ||
914 | |||
915 | if (!!(data & ETH_FLAG_LRO) == !!(netdev->features & NETIF_F_LRO)) | ||
916 | return 0; | ||
917 | |||
896 | if (data & ETH_FLAG_LRO) { | 918 | if (data & ETH_FLAG_LRO) { |
897 | hw_lro = NETXEN_NIC_LRO_ENABLED; | 919 | hw_lro = NETXEN_NIC_LRO_ENABLED; |
898 | netdev->features |= NETIF_F_LRO; | 920 | netdev->features |= NETIF_F_LRO; |
899 | } else { | 921 | } else { |
900 | hw_lro = 0; | 922 | hw_lro = NETXEN_NIC_LRO_DISABLED; |
901 | netdev->features &= ~NETIF_F_LRO; | 923 | netdev->features &= ~NETIF_F_LRO; |
902 | } | 924 | } |
903 | 925 | ||
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index e42d26e03af5..5cef718fe35f 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -809,9 +809,6 @@ int netxen_config_hw_lro(struct netxen_adapter *adapter, int enable) | |||
809 | u64 word; | 809 | u64 word; |
810 | int rv = 0; | 810 | int rv = 0; |
811 | 811 | ||
812 | if ((adapter->flags & NETXEN_NIC_LRO_ENABLED) == enable) | ||
813 | return 0; | ||
814 | |||
815 | memset(&req, 0, sizeof(nx_nic_req_t)); | 812 | memset(&req, 0, sizeof(nx_nic_req_t)); |
816 | 813 | ||
817 | req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23); | 814 | req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23); |
@@ -827,8 +824,6 @@ int netxen_config_hw_lro(struct netxen_adapter *adapter, int enable) | |||
827 | "configure hw lro request\n"); | 824 | "configure hw lro request\n"); |
828 | } | 825 | } |
829 | 826 | ||
830 | adapter->flags ^= NETXEN_NIC_LRO_ENABLED; | ||
831 | |||
832 | return rv; | 827 | return rv; |
833 | } | 828 | } |
834 | 829 | ||
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 58a3643948c3..33fac32e0d9f 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -762,8 +762,6 @@ netxen_check_options(struct netxen_adapter *adapter) | |||
762 | if (adapter->fw_version >= NETXEN_VERSION_CODE(4, 0, 222)) | 762 | if (adapter->fw_version >= NETXEN_VERSION_CODE(4, 0, 222)) |
763 | adapter->capabilities = NXRD32(adapter, CRB_FW_CAPABILITIES_1); | 763 | adapter->capabilities = NXRD32(adapter, CRB_FW_CAPABILITIES_1); |
764 | 764 | ||
765 | adapter->flags &= ~NETXEN_NIC_LRO_ENABLED; | ||
766 | |||
767 | if (adapter->ahw.port_type == NETXEN_NIC_XGBE) { | 765 | if (adapter->ahw.port_type == NETXEN_NIC_XGBE) { |
768 | adapter->num_rxd = DEFAULT_RCV_DESCRIPTORS_10G; | 766 | adapter->num_rxd = DEFAULT_RCV_DESCRIPTORS_10G; |
769 | adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_10G; | 767 | adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_10G; |
@@ -990,7 +988,7 @@ __netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev) | |||
990 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | 988 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) |
991 | netxen_config_intr_coalesce(adapter); | 989 | netxen_config_intr_coalesce(adapter); |
992 | 990 | ||
993 | if (adapter->capabilities & NX_FW_CAPABILITY_HW_LRO) | 991 | if (netdev->features & NETIF_F_LRO) |
994 | netxen_config_hw_lro(adapter, NETXEN_NIC_LRO_ENABLED); | 992 | netxen_config_hw_lro(adapter, NETXEN_NIC_LRO_ENABLED); |
995 | 993 | ||
996 | netxen_napi_enable(adapter); | 994 | netxen_napi_enable(adapter); |