Commit f9566265 authored by Himanshu Madhani's avatar Himanshu Madhani Committed by David S. Miller

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
  34e8c406 ("qlcnic: refactor Tx/SDS
  ring calculation and validation in driver.")
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3bf517df
...@@ -2073,8 +2073,8 @@ int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter) ...@@ -2073,8 +2073,8 @@ int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter)
ahw->nic_mode = QLCNIC_DEFAULT_MODE; ahw->nic_mode = QLCNIC_DEFAULT_MODE;
adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver; adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver;
ahw->idc.state_entry = qlcnic_83xx_idc_ready_state_entry; ahw->idc.state_entry = qlcnic_83xx_idc_ready_state_entry;
adapter->max_sds_rings = ahw->max_rx_ques; adapter->max_sds_rings = QLCNIC_MAX_SDS_RINGS;
adapter->max_tx_rings = ahw->max_tx_ques; adapter->max_tx_rings = QLCNIC_MAX_TX_RINGS;
} else { } else {
return -EIO; return -EIO;
} }
......
...@@ -667,9 +667,13 @@ qlcnic_set_ringparam(struct net_device *dev, ...@@ -667,9 +667,13 @@ qlcnic_set_ringparam(struct net_device *dev,
static int qlcnic_validate_ring_count(struct qlcnic_adapter *adapter, static int qlcnic_validate_ring_count(struct qlcnic_adapter *adapter,
u8 rx_ring, u8 tx_ring) u8 rx_ring, u8 tx_ring)
{ {
if (rx_ring == 0 || tx_ring == 0)
return -EINVAL;
if (rx_ring != 0) { if (rx_ring != 0) {
if (rx_ring > adapter->max_sds_rings) { if (rx_ring > adapter->max_sds_rings) {
netdev_err(adapter->netdev, "Invalid ring count, SDS ring count %d should not be greater than max %d driver sds rings.\n", netdev_err(adapter->netdev,
"Invalid ring count, SDS ring count %d should not be greater than max %d driver sds rings.\n",
rx_ring, adapter->max_sds_rings); rx_ring, adapter->max_sds_rings);
return -EINVAL; return -EINVAL;
} }
......
...@@ -1178,6 +1178,7 @@ qlcnic_initialize_nic(struct qlcnic_adapter *adapter) ...@@ -1178,6 +1178,7 @@ qlcnic_initialize_nic(struct qlcnic_adapter *adapter)
} else { } else {
adapter->ahw->nic_mode = QLCNIC_DEFAULT_MODE; adapter->ahw->nic_mode = QLCNIC_DEFAULT_MODE;
adapter->max_tx_rings = QLCNIC_MAX_HW_TX_RINGS; adapter->max_tx_rings = QLCNIC_MAX_HW_TX_RINGS;
adapter->max_sds_rings = QLCNIC_MAX_SDS_RINGS;
adapter->flags &= ~QLCNIC_ESWITCH_ENABLED; adapter->flags &= ~QLCNIC_ESWITCH_ENABLED;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment