diff options
author | Himanshu Madhani <himanshu.madhani@qlogic.com> | 2013-12-16 15:36:58 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-17 16:24:50 -0500 |
commit | f9566265d7b44fea789072dcfa9a454e7e433af6 (patch) | |
tree | dad3b78e251ba491fb1b63f7a897780789f0233d | |
parent | 3bf517df0d99f1cf5d369c73ab68e0afe6a3c2f9 (diff) |
qlcnic: Fix TSS/RSS ring validation logic.
o TSS/RSS ring validation does not take into account that either
of these ring values can be 0. This patch fixes this validation
and would fail set_channel operation if any of these ring value
is 0. This regression was added as part of commit id
34e8c406fda5b5a9d2e126a92bab84cd28e3b5fa ("qlcnic: refactor Tx/SDS
ring calculation and validation in driver.")
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 1 |
3 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index 89208e5b25d6..fae1b7171576 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | |||
@@ -2073,8 +2073,8 @@ int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter) | |||
2073 | ahw->nic_mode = QLCNIC_DEFAULT_MODE; | 2073 | ahw->nic_mode = QLCNIC_DEFAULT_MODE; |
2074 | adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver; | 2074 | adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver; |
2075 | ahw->idc.state_entry = qlcnic_83xx_idc_ready_state_entry; | 2075 | ahw->idc.state_entry = qlcnic_83xx_idc_ready_state_entry; |
2076 | adapter->max_sds_rings = ahw->max_rx_ques; | 2076 | adapter->max_sds_rings = QLCNIC_MAX_SDS_RINGS; |
2077 | adapter->max_tx_rings = ahw->max_tx_ques; | 2077 | adapter->max_tx_rings = QLCNIC_MAX_TX_RINGS; |
2078 | } else { | 2078 | } else { |
2079 | return -EIO; | 2079 | return -EIO; |
2080 | } | 2080 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 6d3edf6b6a96..78f5e815139e 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -667,9 +667,13 @@ qlcnic_set_ringparam(struct net_device *dev, | |||
667 | static int qlcnic_validate_ring_count(struct qlcnic_adapter *adapter, | 667 | static int qlcnic_validate_ring_count(struct qlcnic_adapter *adapter, |
668 | u8 rx_ring, u8 tx_ring) | 668 | u8 rx_ring, u8 tx_ring) |
669 | { | 669 | { |
670 | if (rx_ring == 0 || tx_ring == 0) | ||
671 | return -EINVAL; | ||
672 | |||
670 | if (rx_ring != 0) { | 673 | if (rx_ring != 0) { |
671 | if (rx_ring > adapter->max_sds_rings) { | 674 | if (rx_ring > adapter->max_sds_rings) { |
672 | netdev_err(adapter->netdev, "Invalid ring count, SDS ring count %d should not be greater than max %d driver sds rings.\n", | 675 | netdev_err(adapter->netdev, |
676 | "Invalid ring count, SDS ring count %d should not be greater than max %d driver sds rings.\n", | ||
673 | rx_ring, adapter->max_sds_rings); | 677 | rx_ring, adapter->max_sds_rings); |
674 | return -EINVAL; | 678 | return -EINVAL; |
675 | } | 679 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index aa019c398e9b..2c8cac0c6a55 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -1178,6 +1178,7 @@ qlcnic_initialize_nic(struct qlcnic_adapter *adapter) | |||
1178 | } else { | 1178 | } else { |
1179 | adapter->ahw->nic_mode = QLCNIC_DEFAULT_MODE; | 1179 | adapter->ahw->nic_mode = QLCNIC_DEFAULT_MODE; |
1180 | adapter->max_tx_rings = QLCNIC_MAX_HW_TX_RINGS; | 1180 | adapter->max_tx_rings = QLCNIC_MAX_HW_TX_RINGS; |
1181 | adapter->max_sds_rings = QLCNIC_MAX_SDS_RINGS; | ||
1181 | adapter->flags &= ~QLCNIC_ESWITCH_ENABLED; | 1182 | adapter->flags &= ~QLCNIC_ESWITCH_ENABLED; |
1182 | } | 1183 | } |
1183 | 1184 | ||