Re: [PATCH v5 4/5] i40e: Fix broken support for floating VEBs
From: Dan Carpenter
Date: Mon Nov 27 2023 - 03:43:38 EST
Hi Ivan,
kernel test robot noticed the following build warnings:
url: https://github.com/intel-lab-lkp/linux/commits/Ivan-Vecera/i40e-Use-existing-helper-to-find-flow-director-VSI/20231124-230616
base: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue
patch link: https://lore.kernel.org/r/20231124150343.81520-5-ivecera%40redhat.com
patch subject: [PATCH v5 4/5] i40e: Fix broken support for floating VEBs
config: x86_64-randconfig-161-20231127 (https://download.01.org/0day-ci/archive/20231127/202311270851.Ie6aegcS-lkp@xxxxxxxxx/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce: (https://download.01.org/0day-ci/archive/20231127/202311270851.Ie6aegcS-lkp@xxxxxxxxx/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <error27@xxxxxxxxx>
| Closes: https://lore.kernel.org/r/202311270851.Ie6aegcS-lkp@xxxxxxxxx/
New smatch warnings:
drivers/net/ethernet/intel/i40e/i40e_main.c:14743 i40e_veb_release() error: potentially dereferencing uninitialized 'vsi'.
Old smatch warnings:
[ low confidence ]
drivers/net/ethernet/intel/i40e/i40e_main.c:5966 i40e_set_bw_limit() warn: error code type promoted to positive: 'speed'
drivers/net/ethernet/intel/i40e/i40e_main.c:13476 i40e_queue_pair_toggle_rings() warn: missing error code? 'ret'
drivers/net/ethernet/intel/i40e/i40e_main.c:14272 i40e_vsi_setup_vectors() warn: missing error code? 'ret'
drivers/net/ethernet/intel/i40e/i40e_main.c:15566 i40e_init_recovery_mode() warn: 'vsi->netdev' from register_netdev() not released on lines: 15566.
vim +/vsi +14743 drivers/net/ethernet/intel/i40e/i40e_main.c
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14715 void i40e_veb_release(struct i40e_veb *veb)
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14716 {
0aab77d67d37d09 Ivan Vecera 2023-11-24 14717 struct i40e_vsi *vsi, *vsi_it;
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14718 struct i40e_pf *pf;
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14719 int i, n = 0;
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14720
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14721 pf = veb->pf;
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14722
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14723 /* find the remaining VSI and check for extras */
0aab77d67d37d09 Ivan Vecera 2023-11-24 14724 i40e_pf_for_each_vsi(pf, i, vsi_it)
0aab77d67d37d09 Ivan Vecera 2023-11-24 14725 if (vsi_it->uplink_seid == veb->seid) {
93a1bc91a1ccc5a Ivan Vecera 2023-11-24 14726 if (vsi_it->flags & I40E_VSI_FLAG_VEB_OWNER)
0aab77d67d37d09 Ivan Vecera 2023-11-24 14727 vsi = vsi_it;
Do we always find a vsi? Presumably, yes, but it's not obvious just
from reading this function.
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14728 n++;
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14729 }
0aab77d67d37d09 Ivan Vecera 2023-11-24 14730
93a1bc91a1ccc5a Ivan Vecera 2023-11-24 14731 /* Floating VEB has to be empty and regular one must have
93a1bc91a1ccc5a Ivan Vecera 2023-11-24 14732 * single owner VSI.
93a1bc91a1ccc5a Ivan Vecera 2023-11-24 14733 */
93a1bc91a1ccc5a Ivan Vecera 2023-11-24 14734 if ((veb->uplink_seid && n != 1) || (!veb->uplink_seid && n != 0)) {
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14735 dev_info(&pf->pdev->dev,
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14736 "can't remove VEB %d with %d VSIs left\n",
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14737 veb->seid, n);
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14738 return;
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14739 }
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14740
93a1bc91a1ccc5a Ivan Vecera 2023-11-24 14741 /* For regular VEB move the owner VSI to uplink VEB */
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14742 if (veb->uplink_seid) {
93a1bc91a1ccc5a Ivan Vecera 2023-11-24 @14743 vsi->flags &= ~I40E_VSI_FLAG_VEB_OWNER;
^^^^^^^^^^
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14744 vsi->uplink_seid = veb->uplink_seid;
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14745 if (veb->uplink_seid == pf->mac_seid)
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14746 vsi->veb_idx = I40E_NO_VEB;
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14747 else
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14748 vsi->veb_idx = veb->veb_idx;
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14749 }
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14750
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14751 i40e_aq_delete_element(&pf->hw, veb->seid, NULL);
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14752 i40e_veb_clear(veb);
41c445ff0f482bb Jesse Brandeburg 2013-09-11 14753 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki