diff options
author | Jon Mason <jon.mason@exar.com> | 2010-06-24 14:45:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-29 02:04:10 -0400 |
commit | 958de1931cbfbcd9c0d425a2291a769a851f15d0 (patch) | |
tree | 5fba4cc2888f6c7276957c8a6936fd885bb554aa /drivers/net | |
parent | 172d69e63c7f1e8300d0e1c1bbd8eb0f630faa15 (diff) |
s2io: add dynamic LRO disable support
This patch adds dynamic LRO disable support for s2io net driver,
enables LRO by default, increases the driver version number, and
corrects the name of the LRO modparm.
This is mostly Wang's patch based on Neil's initial work, heavily
modified based on Ramkrishna's suggestions. This has been tested on
a Neterion Xframe adapter and verified via adapter LRO statistics.
Signed-off-by: Jon Mason <jon.mason@exar.com>
Signed-off-by: WANG Cong <amwang@redhat.com>
Signed-off-by: Neil Horman <nhorman@redhat.com>
Acked-by: Neil Horman <nhorman@redhat.com>
Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Ramkrishna Vepa <Ramkrishna.Vepa@exar.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/s2io.c | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 668327ccd8d0..a032d726d640 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -38,7 +38,7 @@ | |||
38 | * Tx descriptors that can be associated with each corresponding FIFO. | 38 | * Tx descriptors that can be associated with each corresponding FIFO. |
39 | * intr_type: This defines the type of interrupt. The values can be 0(INTA), | 39 | * intr_type: This defines the type of interrupt. The values can be 0(INTA), |
40 | * 2(MSI_X). Default value is '2(MSI_X)' | 40 | * 2(MSI_X). Default value is '2(MSI_X)' |
41 | * lro_enable: Specifies whether to enable Large Receive Offload (LRO) or not. | 41 | * lro: Specifies whether to enable Large Receive Offload (LRO) or not. |
42 | * Possible values '1' for enable '0' for disable. Default is '0' | 42 | * Possible values '1' for enable '0' for disable. Default is '0' |
43 | * lro_max_pkts: This parameter defines maximum number of packets can be | 43 | * lro_max_pkts: This parameter defines maximum number of packets can be |
44 | * aggregated as a single large packet | 44 | * aggregated as a single large packet |
@@ -90,7 +90,7 @@ | |||
90 | #include "s2io.h" | 90 | #include "s2io.h" |
91 | #include "s2io-regs.h" | 91 | #include "s2io-regs.h" |
92 | 92 | ||
93 | #define DRV_VERSION "2.0.26.25" | 93 | #define DRV_VERSION "2.0.26.26" |
94 | 94 | ||
95 | /* S2io Driver name & version. */ | 95 | /* S2io Driver name & version. */ |
96 | static char s2io_driver_name[] = "Neterion"; | 96 | static char s2io_driver_name[] = "Neterion"; |
@@ -496,7 +496,7 @@ S2IO_PARM_INT(rxsync_frequency, 3); | |||
496 | /* Interrupt type. Values can be 0(INTA), 2(MSI_X) */ | 496 | /* Interrupt type. Values can be 0(INTA), 2(MSI_X) */ |
497 | S2IO_PARM_INT(intr_type, 2); | 497 | S2IO_PARM_INT(intr_type, 2); |
498 | /* Large receive offload feature */ | 498 | /* Large receive offload feature */ |
499 | static unsigned int lro_enable; | 499 | static unsigned int lro_enable = 1; |
500 | module_param_named(lro, lro_enable, uint, 0); | 500 | module_param_named(lro, lro_enable, uint, 0); |
501 | 501 | ||
502 | /* Max pkts to be aggregated by LRO at one time. If not specified, | 502 | /* Max pkts to be aggregated by LRO at one time. If not specified, |
@@ -795,7 +795,6 @@ static int init_shared_mem(struct s2io_nic *nic) | |||
795 | ring->rx_curr_put_info.ring_len = rx_cfg->num_rxd - 1; | 795 | ring->rx_curr_put_info.ring_len = rx_cfg->num_rxd - 1; |
796 | ring->nic = nic; | 796 | ring->nic = nic; |
797 | ring->ring_no = i; | 797 | ring->ring_no = i; |
798 | ring->lro = lro_enable; | ||
799 | 798 | ||
800 | blk_cnt = rx_cfg->num_rxd / (rxd_count[nic->rxd_mode] + 1); | 799 | blk_cnt = rx_cfg->num_rxd / (rxd_count[nic->rxd_mode] + 1); |
801 | /* Allocating all the Rx blocks */ | 800 | /* Allocating all the Rx blocks */ |
@@ -6675,6 +6674,7 @@ static u32 s2io_ethtool_op_get_tso(struct net_device *dev) | |||
6675 | { | 6674 | { |
6676 | return (dev->features & NETIF_F_TSO) != 0; | 6675 | return (dev->features & NETIF_F_TSO) != 0; |
6677 | } | 6676 | } |
6677 | |||
6678 | static int s2io_ethtool_op_set_tso(struct net_device *dev, u32 data) | 6678 | static int s2io_ethtool_op_set_tso(struct net_device *dev, u32 data) |
6679 | { | 6679 | { |
6680 | if (data) | 6680 | if (data) |
@@ -6685,6 +6685,42 @@ static int s2io_ethtool_op_set_tso(struct net_device *dev, u32 data) | |||
6685 | return 0; | 6685 | return 0; |
6686 | } | 6686 | } |
6687 | 6687 | ||
6688 | static int s2io_ethtool_set_flags(struct net_device *dev, u32 data) | ||
6689 | { | ||
6690 | struct s2io_nic *sp = netdev_priv(dev); | ||
6691 | int rc = 0; | ||
6692 | int changed = 0; | ||
6693 | |||
6694 | if (data & ~ETH_FLAG_LRO) | ||
6695 | return -EOPNOTSUPP; | ||
6696 | |||
6697 | if (data & ETH_FLAG_LRO) { | ||
6698 | if (lro_enable) { | ||
6699 | if (!(dev->features & NETIF_F_LRO)) { | ||
6700 | dev->features |= NETIF_F_LRO; | ||
6701 | changed = 1; | ||
6702 | } | ||
6703 | } else | ||
6704 | rc = -EINVAL; | ||
6705 | } else if (dev->features & NETIF_F_LRO) { | ||
6706 | dev->features &= ~NETIF_F_LRO; | ||
6707 | changed = 1; | ||
6708 | } | ||
6709 | |||
6710 | if (changed && netif_running(dev)) { | ||
6711 | s2io_stop_all_tx_queue(sp); | ||
6712 | s2io_card_down(sp); | ||
6713 | sp->lro = !!(dev->features & NETIF_F_LRO); | ||
6714 | rc = s2io_card_up(sp); | ||
6715 | if (rc) | ||
6716 | s2io_reset(sp); | ||
6717 | else | ||
6718 | s2io_start_all_tx_queue(sp); | ||
6719 | } | ||
6720 | |||
6721 | return rc; | ||
6722 | } | ||
6723 | |||
6688 | static const struct ethtool_ops netdev_ethtool_ops = { | 6724 | static const struct ethtool_ops netdev_ethtool_ops = { |
6689 | .get_settings = s2io_ethtool_gset, | 6725 | .get_settings = s2io_ethtool_gset, |
6690 | .set_settings = s2io_ethtool_sset, | 6726 | .set_settings = s2io_ethtool_sset, |
@@ -6701,6 +6737,8 @@ static const struct ethtool_ops netdev_ethtool_ops = { | |||
6701 | .get_rx_csum = s2io_ethtool_get_rx_csum, | 6737 | .get_rx_csum = s2io_ethtool_get_rx_csum, |
6702 | .set_rx_csum = s2io_ethtool_set_rx_csum, | 6738 | .set_rx_csum = s2io_ethtool_set_rx_csum, |
6703 | .set_tx_csum = s2io_ethtool_op_set_tx_csum, | 6739 | .set_tx_csum = s2io_ethtool_op_set_tx_csum, |
6740 | .set_flags = s2io_ethtool_set_flags, | ||
6741 | .get_flags = ethtool_op_get_flags, | ||
6704 | .set_sg = ethtool_op_set_sg, | 6742 | .set_sg = ethtool_op_set_sg, |
6705 | .get_tso = s2io_ethtool_op_get_tso, | 6743 | .get_tso = s2io_ethtool_op_get_tso, |
6706 | .set_tso = s2io_ethtool_op_set_tso, | 6744 | .set_tso = s2io_ethtool_op_set_tso, |
@@ -7229,6 +7267,7 @@ static int s2io_card_up(struct s2io_nic *sp) | |||
7229 | struct ring_info *ring = &mac_control->rings[i]; | 7267 | struct ring_info *ring = &mac_control->rings[i]; |
7230 | 7268 | ||
7231 | ring->mtu = dev->mtu; | 7269 | ring->mtu = dev->mtu; |
7270 | ring->lro = sp->lro; | ||
7232 | ret = fill_rx_buffers(sp, ring, 1); | 7271 | ret = fill_rx_buffers(sp, ring, 1); |
7233 | if (ret) { | 7272 | if (ret) { |
7234 | DBG_PRINT(ERR_DBG, "%s: Out of memory in Open\n", | 7273 | DBG_PRINT(ERR_DBG, "%s: Out of memory in Open\n", |
@@ -7974,7 +8013,8 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
7974 | dev->netdev_ops = &s2io_netdev_ops; | 8013 | dev->netdev_ops = &s2io_netdev_ops; |
7975 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 8014 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
7976 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | 8015 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; |
7977 | 8016 | if (lro_enable) | |
8017 | dev->features |= NETIF_F_LRO; | ||
7978 | dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; | 8018 | dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; |
7979 | if (sp->high_dma_flag == true) | 8019 | if (sp->high_dma_flag == true) |
7980 | dev->features |= NETIF_F_HIGHDMA; | 8020 | dev->features |= NETIF_F_HIGHDMA; |