diff options
author | Rajesh Borundia <rajesh.borundia@qlogic.com> | 2012-05-09 01:55:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-09 22:53:04 -0400 |
commit | 01da0c2b0391443d98c2088121901d029f72a4f2 (patch) | |
tree | 086fb635feffda45ab629820127e8442e41ae16e | |
parent | d612698b6246032370b96abc9afe94c8a66772c2 (diff) |
netxen_nic: Fix estimation of recv MSS in case of LRO
o Linux stack estimates MSS from skb->len or skb_shinfo(skb)->gso_size.
In case of LRO skb->len is aggregate of len of number of packets hence MSS
obtained using skb->len would be incorrect. Incorrect estimation of recv MSS
would lead to delayed acks in some traffic patterns (which sends two or three
packets and wait for ack and only then send remaining packets). This leads to
drop in performance. Hence we need to set gso_size to MSS obtained from firmware.
o This is fixed recently in firmware hence the MSS is obtained based on
capability. If fw is capable of sending the MSS then only driver sets the gso_size.
Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 files changed, 23 insertions, 4 deletions
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h index 11b4922a1781..37ccbe54e62d 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h | |||
@@ -53,8 +53,8 @@ | |||
53 | 53 | ||
54 | #define _NETXEN_NIC_LINUX_MAJOR 4 | 54 | #define _NETXEN_NIC_LINUX_MAJOR 4 |
55 | #define _NETXEN_NIC_LINUX_MINOR 0 | 55 | #define _NETXEN_NIC_LINUX_MINOR 0 |
56 | #define _NETXEN_NIC_LINUX_SUBVERSION 78 | 56 | #define _NETXEN_NIC_LINUX_SUBVERSION 79 |
57 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.78" | 57 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.79" |
58 | 58 | ||
59 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) | 59 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) |
60 | #define _major(v) (((v) >> 24) & 0xff) | 60 | #define _major(v) (((v) >> 24) & 0xff) |
@@ -419,6 +419,8 @@ struct rcv_desc { | |||
419 | (((sts_data) >> 52) & 0x1) | 419 | (((sts_data) >> 52) & 0x1) |
420 | #define netxen_get_lro_sts_seq_number(sts_data) \ | 420 | #define netxen_get_lro_sts_seq_number(sts_data) \ |
421 | ((sts_data) & 0x0FFFFFFFF) | 421 | ((sts_data) & 0x0FFFFFFFF) |
422 | #define netxen_get_lro_sts_mss(sts_data1) \ | ||
423 | ((sts_data1 >> 32) & 0x0FFFF) | ||
422 | 424 | ||
423 | 425 | ||
424 | struct status_desc { | 426 | struct status_desc { |
@@ -794,6 +796,7 @@ struct netxen_cmd_args { | |||
794 | #define NX_CAP0_JUMBO_CONTIGUOUS NX_CAP_BIT(0, 7) | 796 | #define NX_CAP0_JUMBO_CONTIGUOUS NX_CAP_BIT(0, 7) |
795 | #define NX_CAP0_LRO_CONTIGUOUS NX_CAP_BIT(0, 8) | 797 | #define NX_CAP0_LRO_CONTIGUOUS NX_CAP_BIT(0, 8) |
796 | #define NX_CAP0_HW_LRO NX_CAP_BIT(0, 10) | 798 | #define NX_CAP0_HW_LRO NX_CAP_BIT(0, 10) |
799 | #define NX_CAP0_HW_LRO_MSS NX_CAP_BIT(0, 21) | ||
797 | 800 | ||
798 | /* | 801 | /* |
799 | * Context state | 802 | * Context state |
@@ -1073,6 +1076,8 @@ typedef struct { | |||
1073 | #define NX_FW_CAPABILITY_FVLANTX (1 << 9) | 1076 | #define NX_FW_CAPABILITY_FVLANTX (1 << 9) |
1074 | #define NX_FW_CAPABILITY_HW_LRO (1 << 10) | 1077 | #define NX_FW_CAPABILITY_HW_LRO (1 << 10) |
1075 | #define NX_FW_CAPABILITY_GBE_LINK_CFG (1 << 11) | 1078 | #define NX_FW_CAPABILITY_GBE_LINK_CFG (1 << 11) |
1079 | #define NX_FW_CAPABILITY_MORE_CAPS (1 << 31) | ||
1080 | #define NX_FW_CAPABILITY_2_LRO_MAX_TCP_SEG (1 << 2) | ||
1076 | 1081 | ||
1077 | /* module types */ | 1082 | /* module types */ |
1078 | #define LINKEVENT_MODULE_NOT_PRESENT 1 | 1083 | #define LINKEVENT_MODULE_NOT_PRESENT 1 |
@@ -1155,6 +1160,7 @@ typedef struct { | |||
1155 | #define NETXEN_NIC_BRIDGE_ENABLED 0X10 | 1160 | #define NETXEN_NIC_BRIDGE_ENABLED 0X10 |
1156 | #define NETXEN_NIC_DIAG_ENABLED 0x20 | 1161 | #define NETXEN_NIC_DIAG_ENABLED 0x20 |
1157 | #define NETXEN_FW_RESET_OWNER 0x40 | 1162 | #define NETXEN_FW_RESET_OWNER 0x40 |
1163 | #define NETXEN_FW_MSS_CAP 0x80 | ||
1158 | #define NETXEN_IS_MSI_FAMILY(adapter) \ | 1164 | #define NETXEN_IS_MSI_FAMILY(adapter) \ |
1159 | ((adapter)->flags & (NETXEN_NIC_MSI_ENABLED | NETXEN_NIC_MSIX_ENABLED)) | 1165 | ((adapter)->flags & (NETXEN_NIC_MSI_ENABLED | NETXEN_NIC_MSIX_ENABLED)) |
1160 | 1166 | ||
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c index c86ea12dbf87..7f556a84925d 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c | |||
@@ -328,6 +328,9 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
328 | cap = (NX_CAP0_LEGACY_CONTEXT | NX_CAP0_LEGACY_MN); | 328 | cap = (NX_CAP0_LEGACY_CONTEXT | NX_CAP0_LEGACY_MN); |
329 | cap |= (NX_CAP0_JUMBO_CONTIGUOUS | NX_CAP0_LRO_CONTIGUOUS); | 329 | cap |= (NX_CAP0_JUMBO_CONTIGUOUS | NX_CAP0_LRO_CONTIGUOUS); |
330 | 330 | ||
331 | if (adapter->flags & NETXEN_FW_MSS_CAP) | ||
332 | cap |= NX_CAP0_HW_LRO_MSS; | ||
333 | |||
331 | prq->capabilities[0] = cpu_to_le32(cap); | 334 | prq->capabilities[0] = cpu_to_le32(cap); |
332 | prq->host_int_crb_mode = | 335 | prq->host_int_crb_mode = |
333 | cpu_to_le32(NX_HOST_INT_CRB_MODE_SHARED); | 336 | cpu_to_le32(NX_HOST_INT_CRB_MODE_SHARED); |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hdr.h b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hdr.h index a41106ba9719..28e076960bcb 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_hdr.h +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_hdr.h | |||
@@ -776,6 +776,7 @@ enum { | |||
776 | #define CRB_SW_INT_MASK_3 (NETXEN_NIC_REG(0x1e8)) | 776 | #define CRB_SW_INT_MASK_3 (NETXEN_NIC_REG(0x1e8)) |
777 | 777 | ||
778 | #define CRB_FW_CAPABILITIES_1 (NETXEN_CAM_RAM(0x128)) | 778 | #define CRB_FW_CAPABILITIES_1 (NETXEN_CAM_RAM(0x128)) |
779 | #define CRB_FW_CAPABILITIES_2 (NETXEN_CAM_RAM(0x12c)) | ||
779 | #define CRB_MAC_BLOCK_START (NETXEN_CAM_RAM(0x1c0)) | 780 | #define CRB_MAC_BLOCK_START (NETXEN_CAM_RAM(0x1c0)) |
780 | 781 | ||
781 | /* | 782 | /* |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c index 718b27440351..0d725dc91bcb 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c | |||
@@ -1131,7 +1131,6 @@ netxen_validate_firmware(struct netxen_adapter *adapter) | |||
1131 | _build(file_fw_ver)); | 1131 | _build(file_fw_ver)); |
1132 | return -EINVAL; | 1132 | return -EINVAL; |
1133 | } | 1133 | } |
1134 | |||
1135 | val = nx_get_bios_version(adapter); | 1134 | val = nx_get_bios_version(adapter); |
1136 | netxen_rom_fast_read(adapter, NX_BIOS_VERSION_OFFSET, (int *)&bios); | 1135 | netxen_rom_fast_read(adapter, NX_BIOS_VERSION_OFFSET, (int *)&bios); |
1137 | if ((__force u32)val != bios) { | 1136 | if ((__force u32)val != bios) { |
@@ -1661,6 +1660,9 @@ netxen_process_lro(struct netxen_adapter *adapter, | |||
1661 | 1660 | ||
1662 | length = skb->len; | 1661 | length = skb->len; |
1663 | 1662 | ||
1663 | if (adapter->flags & NETXEN_FW_MSS_CAP) | ||
1664 | skb_shinfo(skb)->gso_size = netxen_get_lro_sts_mss(sts_data1); | ||
1665 | |||
1664 | netif_receive_skb(skb); | 1666 | netif_receive_skb(skb); |
1665 | 1667 | ||
1666 | adapter->stats.lro_pkts++; | 1668 | adapter->stats.lro_pkts++; |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index d03619cab8dd..342b3a79bd0f 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | |||
@@ -1184,6 +1184,7 @@ netxen_nic_attach(struct netxen_adapter *adapter) | |||
1184 | int err, ring; | 1184 | int err, ring; |
1185 | struct nx_host_rds_ring *rds_ring; | 1185 | struct nx_host_rds_ring *rds_ring; |
1186 | struct nx_host_tx_ring *tx_ring; | 1186 | struct nx_host_tx_ring *tx_ring; |
1187 | u32 capab2; | ||
1187 | 1188 | ||
1188 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) | 1189 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) |
1189 | return 0; | 1190 | return 0; |
@@ -1192,6 +1193,13 @@ netxen_nic_attach(struct netxen_adapter *adapter) | |||
1192 | if (err) | 1193 | if (err) |
1193 | return err; | 1194 | return err; |
1194 | 1195 | ||
1196 | adapter->flags &= ~NETXEN_FW_MSS_CAP; | ||
1197 | if (adapter->capabilities & NX_FW_CAPABILITY_MORE_CAPS) { | ||
1198 | capab2 = NXRD32(adapter, CRB_FW_CAPABILITIES_2); | ||
1199 | if (capab2 & NX_FW_CAPABILITY_2_LRO_MAX_TCP_SEG) | ||
1200 | adapter->flags |= NETXEN_FW_MSS_CAP; | ||
1201 | } | ||
1202 | |||
1195 | err = netxen_napi_add(adapter, netdev); | 1203 | err = netxen_napi_add(adapter, netdev); |
1196 | if (err) | 1204 | if (err) |
1197 | return err; | 1205 | return err; |
@@ -1810,7 +1818,6 @@ netxen_tso_check(struct net_device *netdev, | |||
1810 | flags = FLAGS_VLAN_TAGGED; | 1818 | flags = FLAGS_VLAN_TAGGED; |
1811 | 1819 | ||
1812 | } else if (vlan_tx_tag_present(skb)) { | 1820 | } else if (vlan_tx_tag_present(skb)) { |
1813 | |||
1814 | flags = FLAGS_VLAN_OOB; | 1821 | flags = FLAGS_VLAN_OOB; |
1815 | vid = vlan_tx_tag_get(skb); | 1822 | vid = vlan_tx_tag_get(skb); |
1816 | netxen_set_tx_vlan_tci(first_desc, vid); | 1823 | netxen_set_tx_vlan_tci(first_desc, vid); |