diff options
author | Himanshu Madhani <himanshu.madhani@qlogic.com> | 2013-04-24 12:42:42 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-24 19:34:05 -0400 |
commit | be273dc197eb84304b740db8965a2103005c49ba (patch) | |
tree | ca802219265eabcfea4e42096e8a538d44806000 /drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |
parent | 522907403b202dea8528c308ffc21e79d0636ee6 (diff) | |
download | linux-be273dc197eb84304b740db8965a2103005c49ba.tar.bz2 |
qlcnic: Enable Interrupt Coalescing for 83xx adapter
Enable Interrupt coalescing through ethtool on 83xx adapter.
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c')
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 68 |
1 files changed, 55 insertions, 13 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 629d901637e1..08efb4635007 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c @@ -1303,6 +1303,9 @@ static int qlcnic_set_intr_coalesce(struct net_device *netdev, struct ethtool_coalesce *ethcoal) { struct qlcnic_adapter *adapter = netdev_priv(netdev); + struct qlcnic_nic_intr_coalesce *coal; + u32 rx_coalesce_usecs, rx_max_frames; + u32 tx_coalesce_usecs, tx_max_frames; if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) return -EINVAL; @@ -1313,8 +1316,8 @@ static int qlcnic_set_intr_coalesce(struct net_device *netdev, */ if (ethcoal->rx_coalesce_usecs > 0xffff || ethcoal->rx_max_coalesced_frames > 0xffff || - ethcoal->tx_coalesce_usecs || - ethcoal->tx_max_coalesced_frames || + ethcoal->tx_coalesce_usecs > 0xffff || + ethcoal->tx_max_coalesced_frames > 0xffff || ethcoal->rx_coalesce_usecs_irq || ethcoal->rx_max_coalesced_frames_irq || ethcoal->tx_coalesce_usecs_irq || @@ -1334,18 +1337,55 @@ static int qlcnic_set_intr_coalesce(struct net_device *netdev, ethcoal->tx_max_coalesced_frames_high) return -EINVAL; - if (!ethcoal->rx_coalesce_usecs || - !ethcoal->rx_max_coalesced_frames) { - adapter->ahw->coal.flag = QLCNIC_INTR_DEFAULT; - adapter->ahw->coal.rx_time_us = - QLCNIC_DEFAULT_INTR_COALESCE_RX_TIME_US; - adapter->ahw->coal.rx_packets = - QLCNIC_DEFAULT_INTR_COALESCE_RX_PACKETS; + coal = &adapter->ahw->coal; + + if (qlcnic_83xx_check(adapter)) { + if (!ethcoal->tx_coalesce_usecs || + !ethcoal->tx_max_coalesced_frames || + !ethcoal->rx_coalesce_usecs || + !ethcoal->rx_max_coalesced_frames) { + coal->flag = QLCNIC_INTR_DEFAULT; + coal->type = QLCNIC_INTR_COAL_TYPE_RX; + coal->rx_time_us = QLCNIC_DEF_INTR_COALESCE_RX_TIME_US; + coal->rx_packets = QLCNIC_DEF_INTR_COALESCE_RX_PACKETS; + coal->tx_time_us = QLCNIC_DEF_INTR_COALESCE_TX_TIME_US; + coal->tx_packets = QLCNIC_DEF_INTR_COALESCE_TX_PACKETS; + } else { + tx_coalesce_usecs = ethcoal->tx_coalesce_usecs; + tx_max_frames = ethcoal->tx_max_coalesced_frames; + rx_coalesce_usecs = ethcoal->rx_coalesce_usecs; + rx_max_frames = ethcoal->rx_max_coalesced_frames; + coal->flag = 0; + + if ((coal->rx_time_us == rx_coalesce_usecs) && + (coal->rx_packets == rx_max_frames)) { + coal->type = QLCNIC_INTR_COAL_TYPE_TX; + coal->tx_time_us = tx_coalesce_usecs; + coal->tx_packets = tx_max_frames; + } else if ((coal->tx_time_us == tx_coalesce_usecs) && + (coal->tx_packets == tx_max_frames)) { + coal->type = QLCNIC_INTR_COAL_TYPE_RX; + coal->rx_time_us = rx_coalesce_usecs; + coal->rx_packets = rx_max_frames; + } else { + coal->type = QLCNIC_INTR_COAL_TYPE_RX; + coal->rx_time_us = rx_coalesce_usecs; + coal->rx_packets = rx_max_frames; + coal->tx_time_us = tx_coalesce_usecs; + coal->tx_packets = tx_max_frames; + } + } } else { - adapter->ahw->coal.flag = 0; - adapter->ahw->coal.rx_time_us = ethcoal->rx_coalesce_usecs; - adapter->ahw->coal.rx_packets = - ethcoal->rx_max_coalesced_frames; + if (!ethcoal->rx_coalesce_usecs || + !ethcoal->rx_max_coalesced_frames) { + coal->flag = QLCNIC_INTR_DEFAULT; + coal->rx_time_us = QLCNIC_DEF_INTR_COALESCE_RX_TIME_US; + coal->rx_packets = QLCNIC_DEF_INTR_COALESCE_RX_PACKETS; + } else { + coal->flag = 0; + coal->rx_time_us = ethcoal->rx_coalesce_usecs; + coal->rx_packets = ethcoal->rx_max_coalesced_frames; + } } qlcnic_config_intr_coalesce(adapter); @@ -1363,6 +1403,8 @@ static int qlcnic_get_intr_coalesce(struct net_device *netdev, ethcoal->rx_coalesce_usecs = adapter->ahw->coal.rx_time_us; ethcoal->rx_max_coalesced_frames = adapter->ahw->coal.rx_packets; + ethcoal->tx_coalesce_usecs = adapter->ahw->coal.tx_time_us; + ethcoal->tx_max_coalesced_frames = adapter->ahw->coal.tx_packets; return 0; } |