Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ice: Fix implicit queue mapping mode in ice_vsi_get_qs

Currently in ice_vsi_get_qs() we set the mapping_mode for Tx and Rx to
vsi->[tx|rx]_mapping_mode, but the problem is vsi->[tx|rx]_mapping_mode
have not been set yet. This was working because ICE_VSI_MAP_CONTIG is
defined to 0. Fix this by being explicit with our mapping mode by
initializing the Tx and Rx structure's mapping_mode to
ICE_VSI_MAP_CONTIG and then setting the vsi->[tx|rx]_mapping_mode to the
[tx|rx]_qs_cfg.mapping_mode values.

Also, only assign the vsi->[tx|rx]_mapping_mode when the queues are
successfully mapped to the VSI. With this change there was no longer a
need to initialize the ret variable to 0 so remove that.

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

authored by

Brett Creeley and committed by
Jeff Kirsher
39066dc5 13a6233b

+12 -9
+12 -9
drivers/net/ethernet/intel/ice/ice_lib.c
··· 443 443 .scatter_count = ICE_MAX_SCATTER_TXQS, 444 444 .vsi_map = vsi->txq_map, 445 445 .vsi_map_offset = 0, 446 - .mapping_mode = vsi->tx_mapping_mode 446 + .mapping_mode = ICE_VSI_MAP_CONTIG 447 447 }; 448 448 struct ice_qs_cfg rx_qs_cfg = { 449 449 .qs_mutex = &pf->avail_q_mutex, ··· 453 453 .scatter_count = ICE_MAX_SCATTER_RXQS, 454 454 .vsi_map = vsi->rxq_map, 455 455 .vsi_map_offset = 0, 456 - .mapping_mode = vsi->rx_mapping_mode 456 + .mapping_mode = ICE_VSI_MAP_CONTIG 457 457 }; 458 - int ret = 0; 459 - 460 - vsi->tx_mapping_mode = ICE_VSI_MAP_CONTIG; 461 - vsi->rx_mapping_mode = ICE_VSI_MAP_CONTIG; 458 + int ret; 462 459 463 460 ret = __ice_vsi_get_qs(&tx_qs_cfg); 464 - if (!ret) 465 - ret = __ice_vsi_get_qs(&rx_qs_cfg); 461 + if (ret) 462 + return ret; 463 + vsi->tx_mapping_mode = tx_qs_cfg.mapping_mode; 466 464 467 - return ret; 465 + ret = __ice_vsi_get_qs(&rx_qs_cfg); 466 + if (ret) 467 + return ret; 468 + vsi->rx_mapping_mode = rx_qs_cfg.mapping_mode; 469 + 470 + return 0; 468 471 } 469 472 470 473 /**