[net] octeontx2-pf: QOS: Fix HTB queue deletion on reboot

Hariprasad Kelam posted 1 patch 7 months ago
drivers/net/ethernet/marvell/octeontx2/nic/qos.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[net] octeontx2-pf: QOS: Fix HTB queue deletion on reboot
Posted by Hariprasad Kelam 7 months ago
During a system reboot, the interface receives TC_HTB_LEAF_DEL
and TC_HTB_LEAF_DEL_LAST callbacks to delete its HTB queues.
In the case of TC_HTB_LEAF_DEL_LAST, although the same send queue
is reassigned to the parent, the current logic still attempts to update
the real number of queues, leadning to below warnings

        New queues can't be registered after device unregistration.
        WARNING: CPU: 0 PID: 6475 at net/core/net-sysfs.c:1714
        netdev_queue_update_kobjects+0x1e4/0x200

Fixes: 5e6808b4c68d ("octeontx2-pf: Add support for HTB offload")
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/nic/qos.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/qos.c b/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
index 35acc07bd964..5765bac119f0 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
@@ -1638,6 +1638,7 @@ static int otx2_qos_leaf_del_last(struct otx2_nic *pfvf, u16 classid, bool force
 	if (!node->is_static)
 		dwrr_del_node = true;
 
+	WRITE_ONCE(node->qid, OTX2_QOS_QID_INNER);
 	/* destroy the leaf node */
 	otx2_qos_disable_sq(pfvf, qid);
 	otx2_qos_destroy_node(pfvf, node);
@@ -1682,9 +1683,6 @@ static int otx2_qos_leaf_del_last(struct otx2_nic *pfvf, u16 classid, bool force
 	}
 	kfree(new_cfg);
 
-	/* update tx_real_queues */
-	otx2_qos_update_tx_netdev_queues(pfvf);
-
 	return 0;
 }
 
-- 
2.34.1
Re: [net] octeontx2-pf: QOS: Fix HTB queue deletion on reboot
Posted by Simon Horman 7 months ago
On Tue, May 20, 2025 at 01:05:23PM +0530, Hariprasad Kelam wrote:
> During a system reboot, the interface receives TC_HTB_LEAF_DEL
> and TC_HTB_LEAF_DEL_LAST callbacks to delete its HTB queues.
> In the case of TC_HTB_LEAF_DEL_LAST, although the same send queue
> is reassigned to the parent, the current logic still attempts to update
> the real number of queues, leadning to below warnings
> 
>         New queues can't be registered after device unregistration.
>         WARNING: CPU: 0 PID: 6475 at net/core/net-sysfs.c:1714
>         netdev_queue_update_kobjects+0x1e4/0x200
> 
> Fixes: 5e6808b4c68d ("octeontx2-pf: Add support for HTB offload")
> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> ---
>  drivers/net/ethernet/marvell/octeontx2/nic/qos.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/qos.c b/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
> index 35acc07bd964..5765bac119f0 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
> @@ -1638,6 +1638,7 @@ static int otx2_qos_leaf_del_last(struct otx2_nic *pfvf, u16 classid, bool force
>  	if (!node->is_static)
>  		dwrr_del_node = true;
>  
> +	WRITE_ONCE(node->qid, OTX2_QOS_QID_INNER);

Hi Hariprasad,

Perhaps a comment is warranted regarding the line above.
It would probably be more valuable than the one on the line below.

>  	/* destroy the leaf node */
>  	otx2_qos_disable_sq(pfvf, qid);
>  	otx2_qos_destroy_node(pfvf, node);
> @@ -1682,9 +1683,6 @@ static int otx2_qos_leaf_del_last(struct otx2_nic *pfvf, u16 classid, bool force
>  	}
>  	kfree(new_cfg);
>  
> -	/* update tx_real_queues */
> -	otx2_qos_update_tx_netdev_queues(pfvf);
> -
>  	return 0;
>  }
>  
> -- 
> 2.34.1
> 
>
Re: [net] octeontx2-pf: QOS: Fix HTB queue deletion on reboot
Posted by Hariprasad Kelam 7 months ago
On 2025-05-20 at 22:13:39, Simon Horman (horms@kernel.org) wrote:
> On Tue, May 20, 2025 at 01:05:23PM +0530, Hariprasad Kelam wrote:
> > During a system reboot, the interface receives TC_HTB_LEAF_DEL
> > and TC_HTB_LEAF_DEL_LAST callbacks to delete its HTB queues.
> > In the case of TC_HTB_LEAF_DEL_LAST, although the same send queue
> > is reassigned to the parent, the current logic still attempts to update
> > the real number of queues, leadning to below warnings
> > 
> >         New queues can't be registered after device unregistration.
> >         WARNING: CPU: 0 PID: 6475 at net/core/net-sysfs.c:1714
> >         netdev_queue_update_kobjects+0x1e4/0x200
> > 
> > Fixes: 5e6808b4c68d ("octeontx2-pf: Add support for HTB offload")
> > Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> > ---
> >  drivers/net/ethernet/marvell/octeontx2/nic/qos.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/qos.c b/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
> > index 35acc07bd964..5765bac119f0 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
> > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
> > @@ -1638,6 +1638,7 @@ static int otx2_qos_leaf_del_last(struct otx2_nic *pfvf, u16 classid, bool force
> >  	if (!node->is_static)
> >  		dwrr_del_node = true;
> >  
> > +	WRITE_ONCE(node->qid, OTX2_QOS_QID_INNER);
> 
> Hi Hariprasad,
> 
> Perhaps a comment is warranted regarding the line above.
> It would probably be more valuable than the one on the line below.
> 

   During the leaf deletion need to make Queue as INNER (to stop traffic from stack)
   Will update the commit description accordingly.