BPF List
 help / color / mirror / Atom feed
* [PATCH net 3/3] ice: Fix PF with enabled XDP going no-carrier after reset
       [not found] <20231218192708.3397702-1-anthony.l.nguyen@intel.com>
@ 2023-12-18 19:27 ` Tony Nguyen
  2023-12-19 16:43   ` Maciej Fijalkowski
  2023-12-20  0:09   ` Nelson, Shannon
  0 siblings, 2 replies; 7+ messages in thread
From: Tony Nguyen @ 2023-12-18 19:27 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet, netdev
  Cc: Larysa Zaremba, anthony.l.nguyen, maciej.fijalkowski,
	magnus.karlsson, ast, daniel, hawk, john.fastabend, bpf,
	Przemek Kitszel, Simon Horman, Chandan Kumar Rout

From: Larysa Zaremba <larysa.zaremba@intel.com>

Commit 6624e780a577fc596788 ("ice: split ice_vsi_setup into smaller
functions") has refactored a bunch of code involved in PFR. In this
process, TC queue number adjustment for XDP was lost. Bring it back.

Lack of such adjustment causes interface to go into no-carrier after a
reset, if XDP program is attached, with the following message:

ice 0000:b1:00.0: Failed to set LAN Tx queue context, error: -22
ice 0000:b1:00.0 ens801f0np0: Failed to open VSI 0x0006 on switch 0x0001
ice 0000:b1:00.0: enable VSI failed, err -22, VSI index 0, type ICE_VSI_PF
ice 0000:b1:00.0: PF VSI rebuild failed: -22
ice 0000:b1:00.0: Rebuild failed, unload and reload driver

Fixes: 6624e780a577 ("ice: split ice_vsi_setup into smaller functions")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_lib.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index de7ba87af45d..1bad6e17f9be 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -2371,6 +2371,9 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi)
 		} else {
 			max_txqs[i] = vsi->alloc_txq;
 		}
+
+		if (vsi->type == ICE_VSI_PF)
+			max_txqs[i] += vsi->num_xdp_txq;
 	}
 
 	dev_dbg(dev, "vsi->tc_cfg.ena_tc = %d\n", vsi->tc_cfg.ena_tc);
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net 3/3] ice: Fix PF with enabled XDP going no-carrier after reset
  2023-12-18 19:27 ` [PATCH net 3/3] ice: Fix PF with enabled XDP going no-carrier after reset Tony Nguyen
@ 2023-12-19 16:43   ` Maciej Fijalkowski
  2023-12-20  0:09   ` Nelson, Shannon
  1 sibling, 0 replies; 7+ messages in thread
From: Maciej Fijalkowski @ 2023-12-19 16:43 UTC (permalink / raw)
  To: Tony Nguyen
  Cc: davem, kuba, pabeni, edumazet, netdev, Larysa Zaremba,
	magnus.karlsson, ast, daniel, hawk, john.fastabend, bpf,
	Przemek Kitszel, Simon Horman, Chandan Kumar Rout

On Mon, Dec 18, 2023 at 11:27:06AM -0800, Tony Nguyen wrote:
> From: Larysa Zaremba <larysa.zaremba@intel.com>
> 
> Commit 6624e780a577fc596788 ("ice: split ice_vsi_setup into smaller
> functions") has refactored a bunch of code involved in PFR. In this
> process, TC queue number adjustment for XDP was lost. Bring it back.
> 
> Lack of such adjustment causes interface to go into no-carrier after a
> reset, if XDP program is attached, with the following message:
> 
> ice 0000:b1:00.0: Failed to set LAN Tx queue context, error: -22
> ice 0000:b1:00.0 ens801f0np0: Failed to open VSI 0x0006 on switch 0x0001
> ice 0000:b1:00.0: enable VSI failed, err -22, VSI index 0, type ICE_VSI_PF
> ice 0000:b1:00.0: PF VSI rebuild failed: -22
> ice 0000:b1:00.0: Rebuild failed, unload and reload driver
> 
> Fixes: 6624e780a577 ("ice: split ice_vsi_setup into smaller functions")
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> Reviewed-by: Simon Horman <horms@kernel.org>
> Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_lib.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
> index de7ba87af45d..1bad6e17f9be 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_lib.c
> @@ -2371,6 +2371,9 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi)
>  		} else {
>  			max_txqs[i] = vsi->alloc_txq;
>  		}
> +
> +		if (vsi->type == ICE_VSI_PF)
> +			max_txqs[i] += vsi->num_xdp_txq;

Nit: typically we always preceded this with ice_is_xdp_ena_vsi() call.
However, in this case I suppose it doesn't matter much, as if XDP prog is
not present then this value will just be 0.

Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

>  	}
>  
>  	dev_dbg(dev, "vsi->tc_cfg.ena_tc = %d\n", vsi->tc_cfg.ena_tc);
> -- 
> 2.41.0
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net 3/3] ice: Fix PF with enabled XDP going no-carrier after reset
  2023-12-18 19:27 ` [PATCH net 3/3] ice: Fix PF with enabled XDP going no-carrier after reset Tony Nguyen
  2023-12-19 16:43   ` Maciej Fijalkowski
@ 2023-12-20  0:09   ` Nelson, Shannon
  2023-12-20  9:23     ` Larysa Zaremba
  1 sibling, 1 reply; 7+ messages in thread
From: Nelson, Shannon @ 2023-12-20  0:09 UTC (permalink / raw)
  To: Tony Nguyen, davem, kuba, pabeni, edumazet, netdev
  Cc: Larysa Zaremba, maciej.fijalkowski, magnus.karlsson, ast, daniel,
	hawk, john.fastabend, bpf, Przemek Kitszel, Simon Horman,
	Chandan Kumar Rout

On 12/18/2023 11:27 AM, Tony Nguyen wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> From: Larysa Zaremba <larysa.zaremba@intel.com>
> 
> Commit 6624e780a577fc596788 ("ice: split ice_vsi_setup into smaller
> functions") has refactored a bunch of code involved in PFR. In this
> process, TC queue number adjustment for XDP was lost. Bring it back.
> 
> Lack of such adjustment causes interface to go into no-carrier after a
> reset, if XDP program is attached, with the following message:
> 
> ice 0000:b1:00.0: Failed to set LAN Tx queue context, error: -22
> ice 0000:b1:00.0 ens801f0np0: Failed to open VSI 0x0006 on switch 0x0001
> ice 0000:b1:00.0: enable VSI failed, err -22, VSI index 0, type ICE_VSI_PF
> ice 0000:b1:00.0: PF VSI rebuild failed: -22
> ice 0000:b1:00.0: Rebuild failed, unload and reload driver
> 
> Fixes: 6624e780a577 ("ice: split ice_vsi_setup into smaller functions")
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> Reviewed-by: Simon Horman <horms@kernel.org>
> Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>   drivers/net/ethernet/intel/ice/ice_lib.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
> index de7ba87af45d..1bad6e17f9be 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_lib.c
> @@ -2371,6 +2371,9 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi)
>                  } else {
>                          max_txqs[i] = vsi->alloc_txq;
>                  }
> +
> +               if (vsi->type == ICE_VSI_PF)
> +                       max_txqs[i] += vsi->num_xdp_txq;

Since this new code is coming right after an existing
		if (vsi->type == ICE_VSI_CHNL)
it looks like it would make sense to make it an 'else if' in that last 
block, e.g.:

		if (vsi->type == ICE_VSI_CHNL) {
			if (!vsi->alloc_txq && vsi->num_txq)
				max_txqs[i] = vsi->num_txq;
			else
				max_txqs[i] = pf->num_lan_tx;
		} else if (vsi->type == ICE_VSI_PF) {
			max_txqs[i] += vsi->num_xdp_txq;
		} else {
			max_txqs[i] = vsi->alloc_txq;
		}

Of course this begins to verge on the switch/case/default format.

sln


>          }
> 
>          dev_dbg(dev, "vsi->tc_cfg.ena_tc = %d\n", vsi->tc_cfg.ena_tc);
> --
> 2.41.0
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net 3/3] ice: Fix PF with enabled XDP going no-carrier after reset
  2023-12-20  0:09   ` Nelson, Shannon
@ 2023-12-20  9:23     ` Larysa Zaremba
  2023-12-20 17:04       ` Nelson, Shannon
  0 siblings, 1 reply; 7+ messages in thread
From: Larysa Zaremba @ 2023-12-20  9:23 UTC (permalink / raw)
  To: Nelson, Shannon
  Cc: Tony Nguyen, davem, kuba, pabeni, edumazet, netdev,
	maciej.fijalkowski, magnus.karlsson, ast, daniel, hawk,
	john.fastabend, bpf, Przemek Kitszel, Simon Horman,
	Chandan Kumar Rout

On Tue, Dec 19, 2023 at 04:09:09PM -0800, Nelson, Shannon wrote:
> On 12/18/2023 11:27 AM, Tony Nguyen wrote:
> > Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> > 
> > 
> > From: Larysa Zaremba <larysa.zaremba@intel.com>
> > 
> > Commit 6624e780a577fc596788 ("ice: split ice_vsi_setup into smaller
> > functions") has refactored a bunch of code involved in PFR. In this
> > process, TC queue number adjustment for XDP was lost. Bring it back.
> > 
> > Lack of such adjustment causes interface to go into no-carrier after a
> > reset, if XDP program is attached, with the following message:
> > 
> > ice 0000:b1:00.0: Failed to set LAN Tx queue context, error: -22
> > ice 0000:b1:00.0 ens801f0np0: Failed to open VSI 0x0006 on switch 0x0001
> > ice 0000:b1:00.0: enable VSI failed, err -22, VSI index 0, type ICE_VSI_PF
> > ice 0000:b1:00.0: PF VSI rebuild failed: -22
> > ice 0000:b1:00.0: Rebuild failed, unload and reload driver
> > 
> > Fixes: 6624e780a577 ("ice: split ice_vsi_setup into smaller functions")
> > Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> > Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> > Reviewed-by: Simon Horman <horms@kernel.org>
> > Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
> > Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> > ---
> >   drivers/net/ethernet/intel/ice/ice_lib.c | 3 +++
> >   1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
> > index de7ba87af45d..1bad6e17f9be 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_lib.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_lib.c
> > @@ -2371,6 +2371,9 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi)
> >                  } else {
> >                          max_txqs[i] = vsi->alloc_txq;
> >                  }
> > +
> > +               if (vsi->type == ICE_VSI_PF)
> > +                       max_txqs[i] += vsi->num_xdp_txq;
> 
> Since this new code is coming right after an existing
> 		if (vsi->type == ICE_VSI_CHNL)
> it looks like it would make sense to make it an 'else if' in that last
> block, e.g.:
> 
> 		if (vsi->type == ICE_VSI_CHNL) {
> 			if (!vsi->alloc_txq && vsi->num_txq)
> 				max_txqs[i] = vsi->num_txq;
> 			else
> 				max_txqs[i] = pf->num_lan_tx;
> 		} else if (vsi->type == ICE_VSI_PF) {
> 			max_txqs[i] += vsi->num_xdp_txq;

Would need to be
	max_txqs[i] = vsi->alloc_txq + vsi->num_xdp_txq;

> 		} else {
> 			max_txqs[i] = vsi->alloc_txq;
> 		}
> 
> Of course this begins to verge on the switch/case/default format.
> 
> sln
> 

I was going for logic: assign default values first, adjust based on enabled 
features (well, a single feature) second. The thing that in my opinion would 
make it more clear would be replacing 'vsi->type == ICE_VSI_PF' with 
ice_is_xdp_ena_vsi(). Do you think this is worth doing?

> 
> >          }
> > 
> >          dev_dbg(dev, "vsi->tc_cfg.ena_tc = %d\n", vsi->tc_cfg.ena_tc);
> > --
> > 2.41.0
> > 
> > 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net 3/3] ice: Fix PF with enabled XDP going no-carrier after reset
  2023-12-20  9:23     ` Larysa Zaremba
@ 2023-12-20 17:04       ` Nelson, Shannon
  2023-12-21  7:23         ` Paolo Abeni
  0 siblings, 1 reply; 7+ messages in thread
From: Nelson, Shannon @ 2023-12-20 17:04 UTC (permalink / raw)
  To: Larysa Zaremba
  Cc: Tony Nguyen, davem, kuba, pabeni, edumazet, netdev,
	maciej.fijalkowski, magnus.karlsson, ast, daniel, hawk,
	john.fastabend, bpf, Przemek Kitszel, Simon Horman,
	Chandan Kumar Rout

On 12/20/2023 1:23 AM, Larysa Zaremba wrote:
> 
> On Tue, Dec 19, 2023 at 04:09:09PM -0800, Nelson, Shannon wrote:
>> On 12/18/2023 11:27 AM, Tony Nguyen wrote:
>>> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>>>
>>>
>>> From: Larysa Zaremba <larysa.zaremba@intel.com>
>>>
>>> Commit 6624e780a577fc596788 ("ice: split ice_vsi_setup into smaller
>>> functions") has refactored a bunch of code involved in PFR. In this
>>> process, TC queue number adjustment for XDP was lost. Bring it back.
>>>
>>> Lack of such adjustment causes interface to go into no-carrier after a
>>> reset, if XDP program is attached, with the following message:
>>>
>>> ice 0000:b1:00.0: Failed to set LAN Tx queue context, error: -22
>>> ice 0000:b1:00.0 ens801f0np0: Failed to open VSI 0x0006 on switch 0x0001
>>> ice 0000:b1:00.0: enable VSI failed, err -22, VSI index 0, type ICE_VSI_PF
>>> ice 0000:b1:00.0: PF VSI rebuild failed: -22
>>> ice 0000:b1:00.0: Rebuild failed, unload and reload driver
>>>
>>> Fixes: 6624e780a577 ("ice: split ice_vsi_setup into smaller functions")
>>> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
>>> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
>>> Reviewed-by: Simon Horman <horms@kernel.org>
>>> Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
>>> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
>>> ---
>>>    drivers/net/ethernet/intel/ice/ice_lib.c | 3 +++
>>>    1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
>>> index de7ba87af45d..1bad6e17f9be 100644
>>> --- a/drivers/net/ethernet/intel/ice/ice_lib.c
>>> +++ b/drivers/net/ethernet/intel/ice/ice_lib.c
>>> @@ -2371,6 +2371,9 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi)
>>>                   } else {
>>>                           max_txqs[i] = vsi->alloc_txq;
>>>                   }
>>> +
>>> +               if (vsi->type == ICE_VSI_PF)
>>> +                       max_txqs[i] += vsi->num_xdp_txq;
>>
>> Since this new code is coming right after an existing
>>                if (vsi->type == ICE_VSI_CHNL)
>> it looks like it would make sense to make it an 'else if' in that last
>> block, e.g.:
>>
>>                if (vsi->type == ICE_VSI_CHNL) {
>>                        if (!vsi->alloc_txq && vsi->num_txq)
>>                                max_txqs[i] = vsi->num_txq;
>>                        else
>>                                max_txqs[i] = pf->num_lan_tx;
>>                } else if (vsi->type == ICE_VSI_PF) {
>>                        max_txqs[i] += vsi->num_xdp_txq;
> 
> Would need to be
>          max_txqs[i] = vsi->alloc_txq + vsi->num_xdp_txq;
> 
>>                } else {
>>                        max_txqs[i] = vsi->alloc_txq;
>>                }
>>
>> Of course this begins to verge on the switch/case/default format.
>>
>> sln
>>
> 
> I was going for logic: assign default values first, adjust based on enabled
> features (well, a single feature) second. The thing that in my opinion would
> make it more clear would be replacing 'vsi->type == ICE_VSI_PF' with
> ice_is_xdp_ena_vsi(). Do you think this is worth doing?

Hmm... I made a dumb error in a quick read of the code.  This suggests 
that making the intent of the code more clear would be a good idea.  I 
think that the ice_is_xdp_ena_vsi() would definitely make it more clear 
as opposed to the bare ICE_VCSI_PF.

sln


> 
>>
>>>           }
>>>
>>>           dev_dbg(dev, "vsi->tc_cfg.ena_tc = %d\n", vsi->tc_cfg.ena_tc);
>>> --
>>> 2.41.0
>>>
>>>
>>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net 3/3] ice: Fix PF with enabled XDP going no-carrier after reset
  2023-12-20 17:04       ` Nelson, Shannon
@ 2023-12-21  7:23         ` Paolo Abeni
  2023-12-21  9:05           ` Larysa Zaremba
  0 siblings, 1 reply; 7+ messages in thread
From: Paolo Abeni @ 2023-12-21  7:23 UTC (permalink / raw)
  To: Nelson, Shannon, Larysa Zaremba
  Cc: Tony Nguyen, davem, kuba, edumazet, netdev, maciej.fijalkowski,
	magnus.karlsson, ast, daniel, hawk, john.fastabend, bpf,
	Przemek Kitszel, Simon Horman, Chandan Kumar Rout

On Wed, 2023-12-20 at 09:04 -0800, Nelson, Shannon wrote:
> On 12/20/2023 1:23 AM, Larysa Zaremba wrote:
> > 
> > On Tue, Dec 19, 2023 at 04:09:09PM -0800, Nelson, Shannon wrote:
> > > On 12/18/2023 11:27 AM, Tony Nguyen wrote:
> > > > Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> > > > 
> > > > 
> > > > From: Larysa Zaremba <larysa.zaremba@intel.com>
> > > > 
> > > > Commit 6624e780a577fc596788 ("ice: split ice_vsi_setup into smaller
> > > > functions") has refactored a bunch of code involved in PFR. In this
> > > > process, TC queue number adjustment for XDP was lost. Bring it back.
> > > > 
> > > > Lack of such adjustment causes interface to go into no-carrier after a
> > > > reset, if XDP program is attached, with the following message:
> > > > 
> > > > ice 0000:b1:00.0: Failed to set LAN Tx queue context, error: -22
> > > > ice 0000:b1:00.0 ens801f0np0: Failed to open VSI 0x0006 on switch 0x0001
> > > > ice 0000:b1:00.0: enable VSI failed, err -22, VSI index 0, type ICE_VSI_PF
> > > > ice 0000:b1:00.0: PF VSI rebuild failed: -22
> > > > ice 0000:b1:00.0: Rebuild failed, unload and reload driver
> > > > 
> > > > Fixes: 6624e780a577 ("ice: split ice_vsi_setup into smaller functions")
> > > > Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> > > > Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> > > > Reviewed-by: Simon Horman <horms@kernel.org>
> > > > Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
> > > > Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> > > > ---
> > > >    drivers/net/ethernet/intel/ice/ice_lib.c | 3 +++
> > > >    1 file changed, 3 insertions(+)
> > > > 
> > > > diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
> > > > index de7ba87af45d..1bad6e17f9be 100644
> > > > --- a/drivers/net/ethernet/intel/ice/ice_lib.c
> > > > +++ b/drivers/net/ethernet/intel/ice/ice_lib.c
> > > > @@ -2371,6 +2371,9 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi)
> > > >                   } else {
> > > >                           max_txqs[i] = vsi->alloc_txq;
> > > >                   }
> > > > +
> > > > +               if (vsi->type == ICE_VSI_PF)
> > > > +                       max_txqs[i] += vsi->num_xdp_txq;
> > > 
> > > Since this new code is coming right after an existing
> > >                if (vsi->type == ICE_VSI_CHNL)
> > > it looks like it would make sense to make it an 'else if' in that last
> > > block, e.g.:
> > > 
> > >                if (vsi->type == ICE_VSI_CHNL) {
> > >                        if (!vsi->alloc_txq && vsi->num_txq)
> > >                                max_txqs[i] = vsi->num_txq;
> > >                        else
> > >                                max_txqs[i] = pf->num_lan_tx;
> > >                } else if (vsi->type == ICE_VSI_PF) {
> > >                        max_txqs[i] += vsi->num_xdp_txq;
> > 
> > Would need to be
> >          max_txqs[i] = vsi->alloc_txq + vsi->num_xdp_txq;
> > 
> > >                } else {
> > >                        max_txqs[i] = vsi->alloc_txq;
> > >                }
> > > 
> > > Of course this begins to verge on the switch/case/default format.
> > > 
> > > sln
> > > 
> > 
> > I was going for logic: assign default values first, adjust based on enabled
> > features (well, a single feature) second. The thing that in my opinion would
> > make it more clear would be replacing 'vsi->type == ICE_VSI_PF' with
> > ice_is_xdp_ena_vsi(). Do you think this is worth doing?
> 
> Hmm... I made a dumb error in a quick read of the code.  This suggests 
> that making the intent of the code more clear would be a good idea.  I 
> think that the ice_is_xdp_ena_vsi() would definitely make it more clear 
> as opposed to the bare ICE_VCSI_PF.

I think that the current patch fits well for stable, and the issue
looks relevant enough that we should prefer have it fixed in this
cycle. Any refactoring/change would not allow such result due to the
timing.

I'll apply the series as-is, please follow-up on net-next as needed (no
rush).

Cheers,

Paolo


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net 3/3] ice: Fix PF with enabled XDP going no-carrier after reset
  2023-12-21  7:23         ` Paolo Abeni
@ 2023-12-21  9:05           ` Larysa Zaremba
  0 siblings, 0 replies; 7+ messages in thread
From: Larysa Zaremba @ 2023-12-21  9:05 UTC (permalink / raw)
  To: Paolo Abeni
  Cc: Nelson, Shannon, Tony Nguyen, davem, kuba, edumazet, netdev,
	maciej.fijalkowski, magnus.karlsson, ast, daniel, hawk,
	john.fastabend, bpf, Przemek Kitszel, Simon Horman,
	Chandan Kumar Rout

On Thu, Dec 21, 2023 at 08:23:39AM +0100, Paolo Abeni wrote:
> On Wed, 2023-12-20 at 09:04 -0800, Nelson, Shannon wrote:
> > On 12/20/2023 1:23 AM, Larysa Zaremba wrote:
> > > 
> > > On Tue, Dec 19, 2023 at 04:09:09PM -0800, Nelson, Shannon wrote:
> > > > On 12/18/2023 11:27 AM, Tony Nguyen wrote:
> > > > > Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> > > > > 
> > > > > 
> > > > > From: Larysa Zaremba <larysa.zaremba@intel.com>
> > > > > 
> > > > > Commit 6624e780a577fc596788 ("ice: split ice_vsi_setup into smaller
> > > > > functions") has refactored a bunch of code involved in PFR. In this
> > > > > process, TC queue number adjustment for XDP was lost. Bring it back.
> > > > > 
> > > > > Lack of such adjustment causes interface to go into no-carrier after a
> > > > > reset, if XDP program is attached, with the following message:
> > > > > 
> > > > > ice 0000:b1:00.0: Failed to set LAN Tx queue context, error: -22
> > > > > ice 0000:b1:00.0 ens801f0np0: Failed to open VSI 0x0006 on switch 0x0001
> > > > > ice 0000:b1:00.0: enable VSI failed, err -22, VSI index 0, type ICE_VSI_PF
> > > > > ice 0000:b1:00.0: PF VSI rebuild failed: -22
> > > > > ice 0000:b1:00.0: Rebuild failed, unload and reload driver
> > > > > 
> > > > > Fixes: 6624e780a577 ("ice: split ice_vsi_setup into smaller functions")
> > > > > Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> > > > > Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> > > > > Reviewed-by: Simon Horman <horms@kernel.org>
> > > > > Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com> (A Contingent Worker at Intel)
> > > > > Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> > > > > ---
> > > > >    drivers/net/ethernet/intel/ice/ice_lib.c | 3 +++
> > > > >    1 file changed, 3 insertions(+)
> > > > > 
> > > > > diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
> > > > > index de7ba87af45d..1bad6e17f9be 100644
> > > > > --- a/drivers/net/ethernet/intel/ice/ice_lib.c
> > > > > +++ b/drivers/net/ethernet/intel/ice/ice_lib.c
> > > > > @@ -2371,6 +2371,9 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi)
> > > > >                   } else {
> > > > >                           max_txqs[i] = vsi->alloc_txq;
> > > > >                   }
> > > > > +
> > > > > +               if (vsi->type == ICE_VSI_PF)
> > > > > +                       max_txqs[i] += vsi->num_xdp_txq;
> > > > 
> > > > Since this new code is coming right after an existing
> > > >                if (vsi->type == ICE_VSI_CHNL)
> > > > it looks like it would make sense to make it an 'else if' in that last
> > > > block, e.g.:
> > > > 
> > > >                if (vsi->type == ICE_VSI_CHNL) {
> > > >                        if (!vsi->alloc_txq && vsi->num_txq)
> > > >                                max_txqs[i] = vsi->num_txq;
> > > >                        else
> > > >                                max_txqs[i] = pf->num_lan_tx;
> > > >                } else if (vsi->type == ICE_VSI_PF) {
> > > >                        max_txqs[i] += vsi->num_xdp_txq;
> > > 
> > > Would need to be
> > >          max_txqs[i] = vsi->alloc_txq + vsi->num_xdp_txq;
> > > 
> > > >                } else {
> > > >                        max_txqs[i] = vsi->alloc_txq;
> > > >                }
> > > > 
> > > > Of course this begins to verge on the switch/case/default format.
> > > > 
> > > > sln
> > > > 
> > > 
> > > I was going for logic: assign default values first, adjust based on enabled
> > > features (well, a single feature) second. The thing that in my opinion would
> > > make it more clear would be replacing 'vsi->type == ICE_VSI_PF' with
> > > ice_is_xdp_ena_vsi(). Do you think this is worth doing?
> > 
> > Hmm... I made a dumb error in a quick read of the code.  This suggests 
> > that making the intent of the code more clear would be a good idea.  I 
> > think that the ice_is_xdp_ena_vsi() would definitely make it more clear 
> > as opposed to the bare ICE_VCSI_PF.
> 
> I think that the current patch fits well for stable, and the issue
> looks relevant enough that we should prefer have it fixed in this
> cycle. Any refactoring/change would not allow such result due to the
> timing.
> 
> I'll apply the series as-is, please follow-up on net-next as needed (no
> rush).

Ok, thanks a lot.

> 
> Cheers,
> 
> Paolo
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-12-21  9:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20231218192708.3397702-1-anthony.l.nguyen@intel.com>
2023-12-18 19:27 ` [PATCH net 3/3] ice: Fix PF with enabled XDP going no-carrier after reset Tony Nguyen
2023-12-19 16:43   ` Maciej Fijalkowski
2023-12-20  0:09   ` Nelson, Shannon
2023-12-20  9:23     ` Larysa Zaremba
2023-12-20 17:04       ` Nelson, Shannon
2023-12-21  7:23         ` Paolo Abeni
2023-12-21  9:05           ` Larysa Zaremba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox