diff options
Diffstat (limited to 'drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c')
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 247a9f9b7bdc..0052953a255d 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -3273,20 +3273,40 @@ qlcnicvf_start_firmware(struct qlcnic_adapter *adapter) | |||
3273 | return err; | 3273 | return err; |
3274 | } | 3274 | } |
3275 | 3275 | ||
3276 | int qlcnic_validate_max_rss(u8 max_hw, u8 val) | 3276 | int qlcnic_validate_max_rss(struct qlcnic_adapter *adapter, |
3277 | __u32 val) | ||
3277 | { | 3278 | { |
3279 | struct net_device *netdev = adapter->netdev; | ||
3280 | u8 max_hw = adapter->ahw->max_rx_ques; | ||
3278 | u32 max_allowed; | 3281 | u32 max_allowed; |
3279 | 3282 | ||
3280 | if (max_hw > QLC_MAX_SDS_RINGS) { | 3283 | if (val > QLC_MAX_SDS_RINGS) { |
3281 | max_hw = QLC_MAX_SDS_RINGS; | 3284 | netdev_err(netdev, "RSS value should not be higher than %u\n", |
3282 | pr_info("max rss reset to %d\n", QLC_MAX_SDS_RINGS); | 3285 | QLC_MAX_SDS_RINGS); |
3286 | return -EINVAL; | ||
3283 | } | 3287 | } |
3284 | 3288 | ||
3285 | max_allowed = rounddown_pow_of_two(min_t(int, max_hw, | 3289 | max_allowed = rounddown_pow_of_two(min_t(int, max_hw, |
3286 | num_online_cpus())); | 3290 | num_online_cpus())); |
3287 | if ((val > max_allowed) || (val < 2) || !is_power_of_2(val)) { | 3291 | if ((val > max_allowed) || (val < 2) || !is_power_of_2(val)) { |
3288 | pr_info("rss_ring valid range [2 - %x] in powers of 2\n", | 3292 | if (!is_power_of_2(val)) |
3289 | max_allowed); | 3293 | netdev_err(netdev, "RSS value should be a power of 2\n"); |
3294 | |||
3295 | if (val < 2) | ||
3296 | netdev_err(netdev, "RSS value should not be lower than 2\n"); | ||
3297 | |||
3298 | if (val > max_hw) | ||
3299 | netdev_err(netdev, | ||
3300 | "RSS value should not be higher than[%u], the max RSS rings supported by the adapter\n", | ||
3301 | max_hw); | ||
3302 | |||
3303 | if (val > num_online_cpus()) | ||
3304 | netdev_err(netdev, | ||
3305 | "RSS value should not be higher than[%u], number of online CPUs in the system\n", | ||
3306 | num_online_cpus()); | ||
3307 | |||
3308 | netdev_err(netdev, "Unable to configure %u RSS rings\n", val); | ||
3309 | |||
3290 | return -EINVAL; | 3310 | return -EINVAL; |
3291 | } | 3311 | } |
3292 | return 0; | 3312 | return 0; |