Re: [PATCH v5 4/5] i40e: Fix broken support for floating VEBs

From: Ivan Vecera
Date: Wed Nov 29 2023 - 03:39:29 EST


On 27. 11. 23 9:43, Dan Carpenter wrote:
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.

Yes, if the VEB has uplink (veb->uplink_seid != 0) then it has to have a downlink VSI that owns it (vsi->flags has I40E_VSI_FLAG_VEB_OWNER set)

Ivan

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;