diff mbox series

[net,V3,1/3] octeontx2-pf: Fix PFC TX scheduler free

Message ID 20230821052516.398572-2-sumang@marvell.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Fix PFC related issues | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 1351 this patch: 1351
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1356 this patch: 1356
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 30 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Suman Ghosh Aug. 21, 2023, 5:25 a.m. UTC
During PFC TX schedulers free, flag TXSCHQ_FREE_ALL was being set
which caused free up all schedulers other than the PFC schedulers.
This patch fixes that to free only the PFC Tx schedulers.

Fixes: 99c969a83d82 ("octeontx2-pf: Add egress PFC support")
Signed-off-by: Suman Ghosh <sumang@marvell.com>
---
 .../ethernet/marvell/octeontx2/nic/otx2_common.c  |  1 +
 .../ethernet/marvell/octeontx2/nic/otx2_dcbnl.c   | 15 ++++-----------
 2 files changed, 5 insertions(+), 11 deletions(-)

Comments

Simon Horman Aug. 22, 2023, 7:11 a.m. UTC | #1
On Mon, Aug 21, 2023 at 10:55:14AM +0530, Suman Ghosh wrote:
> During PFC TX schedulers free, flag TXSCHQ_FREE_ALL was being set
> which caused free up all schedulers other than the PFC schedulers.
> This patch fixes that to free only the PFC Tx schedulers.
> 
> Fixes: 99c969a83d82 ("octeontx2-pf: Add egress PFC support")
> Signed-off-by: Suman Ghosh <sumang@marvell.com>
> ---
>  .../ethernet/marvell/octeontx2/nic/otx2_common.c  |  1 +
>  .../ethernet/marvell/octeontx2/nic/otx2_dcbnl.c   | 15 ++++-----------
>  2 files changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> index 77c8f650f7ac..289371b8ce4f 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> @@ -804,6 +804,7 @@ void otx2_txschq_free_one(struct otx2_nic *pfvf, u16 lvl, u16 schq)
>  
>  	mutex_unlock(&pfvf->mbox.lock);
>  }
> +EXPORT_SYMBOL(otx2_txschq_free_one);

Hi Suman,

Given that the licence of both this file and otx2_dcbnl.c is GPLv2,
I wonder if EXPORT_SYMBOL_GPL would be more appropriate here.

>  
>  void otx2_txschq_stop(struct otx2_nic *pfvf)
>  {
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c
> index ccaf97bb1ce0..6492749dd7c8 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c
> @@ -125,19 +125,12 @@ int otx2_pfc_txschq_alloc(struct otx2_nic *pfvf)
>  
>  static int otx2_pfc_txschq_stop_one(struct otx2_nic *pfvf, u8 prio)
>  {
> -	struct nix_txsch_free_req *free_req;
> +	int lvl;
>  
> -	mutex_lock(&pfvf->mbox.lock);
>  	/* free PFC TLx nodes */
> -	free_req = otx2_mbox_alloc_msg_nix_txsch_free(&pfvf->mbox);
> -	if (!free_req) {
> -		mutex_unlock(&pfvf->mbox.lock);
> -		return -ENOMEM;
> -	}
> -
> -	free_req->flags = TXSCHQ_FREE_ALL;
> -	otx2_sync_mbox_msg(&pfvf->mbox);
> -	mutex_unlock(&pfvf->mbox.lock);
> +	for (lvl = 0; lvl < pfvf->hw.txschq_link_cfg_lvl; lvl++)
> +		otx2_txschq_free_one(pfvf, lvl,
> +				     pfvf->pfc_schq_list[lvl][prio]);
>  
>  	pfvf->pfc_alloc_status[prio] = false;
>  	return 0;
> -- 
> 2.25.1
> 
>
Paolo Abeni Aug. 22, 2023, 10:58 a.m. UTC | #2
On Tue, 2023-08-22 at 09:11 +0200, Simon Horman wrote:
> On Mon, Aug 21, 2023 at 10:55:14AM +0530, Suman Ghosh wrote:
> > During PFC TX schedulers free, flag TXSCHQ_FREE_ALL was being set
> > which caused free up all schedulers other than the PFC schedulers.
> > This patch fixes that to free only the PFC Tx schedulers.
> > 
> > Fixes: 99c969a83d82 ("octeontx2-pf: Add egress PFC support")
> > Signed-off-by: Suman Ghosh <sumang@marvell.com>
> > ---
> >  .../ethernet/marvell/octeontx2/nic/otx2_common.c  |  1 +
> >  .../ethernet/marvell/octeontx2/nic/otx2_dcbnl.c   | 15 ++++-----------
> >  2 files changed, 5 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> > index 77c8f650f7ac..289371b8ce4f 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> > @@ -804,6 +804,7 @@ void otx2_txschq_free_one(struct otx2_nic *pfvf, u16 lvl, u16 schq)
> >  
> >  	mutex_unlock(&pfvf->mbox.lock);
> >  }
> > +EXPORT_SYMBOL(otx2_txschq_free_one);
> 
> Hi Suman,
> 
> Given that the licence of both this file and otx2_dcbnl.c is GPLv2,
> I wonder if EXPORT_SYMBOL_GPL would be more appropriate here.

AFAICS all the symbols exported by otx2_common use plain
EXPORT_SYMBOL(). I think we can keep that for consistency in a -net
patch. In the long run it would be nice to move all of them to
EXPORT_SYMBOL_GPL :)

Cheers,

Paolo
Simon Horman Aug. 22, 2023, 8:05 p.m. UTC | #3
On Tue, Aug 22, 2023 at 12:58:04PM +0200, Paolo Abeni wrote:
> On Tue, 2023-08-22 at 09:11 +0200, Simon Horman wrote:
> > On Mon, Aug 21, 2023 at 10:55:14AM +0530, Suman Ghosh wrote:
> > > During PFC TX schedulers free, flag TXSCHQ_FREE_ALL was being set
> > > which caused free up all schedulers other than the PFC schedulers.
> > > This patch fixes that to free only the PFC Tx schedulers.
> > > 
> > > Fixes: 99c969a83d82 ("octeontx2-pf: Add egress PFC support")
> > > Signed-off-by: Suman Ghosh <sumang@marvell.com>
> > > ---
> > >  .../ethernet/marvell/octeontx2/nic/otx2_common.c  |  1 +
> > >  .../ethernet/marvell/octeontx2/nic/otx2_dcbnl.c   | 15 ++++-----------
> > >  2 files changed, 5 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> > > index 77c8f650f7ac..289371b8ce4f 100644
> > > --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> > > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> > > @@ -804,6 +804,7 @@ void otx2_txschq_free_one(struct otx2_nic *pfvf, u16 lvl, u16 schq)
> > >  
> > >  	mutex_unlock(&pfvf->mbox.lock);
> > >  }
> > > +EXPORT_SYMBOL(otx2_txschq_free_one);
> > 
> > Hi Suman,
> > 
> > Given that the licence of both this file and otx2_dcbnl.c is GPLv2,
> > I wonder if EXPORT_SYMBOL_GPL would be more appropriate here.
> 
> AFAICS all the symbols exported by otx2_common use plain
> EXPORT_SYMBOL(). I think we can keep that for consistency in a -net
> patch.

Sure, no objection.

> In the long run it would be nice to move all of them to
> EXPORT_SYMBOL_GPL :)
> 
> Cheers,
> 
> Paolo
>
Suman Ghosh Aug. 23, 2023, 1:18 p.m. UTC | #4
>> >
>> > Hi Suman,
>> >
>> > Given that the licence of both this file and otx2_dcbnl.c is GPLv2,
>> > I wonder if EXPORT_SYMBOL_GPL would be more appropriate here.
>>
>> AFAICS all the symbols exported by otx2_common use plain
>> EXPORT_SYMBOL(). I think we can keep that for consistency in a -net
>> patch.
>
>Sure, no objection.
>
>> In the long run it would be nice to move all of them to
>> EXPORT_SYMBOL_GPL :)
>>
>> Cheers,
>>
>> Paolo
[Suman] Sure Paolo, we can push a separate patch in future.
>>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
index 77c8f650f7ac..289371b8ce4f 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
@@ -804,6 +804,7 @@  void otx2_txschq_free_one(struct otx2_nic *pfvf, u16 lvl, u16 schq)
 
 	mutex_unlock(&pfvf->mbox.lock);
 }
+EXPORT_SYMBOL(otx2_txschq_free_one);
 
 void otx2_txschq_stop(struct otx2_nic *pfvf)
 {
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c
index ccaf97bb1ce0..6492749dd7c8 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c
@@ -125,19 +125,12 @@  int otx2_pfc_txschq_alloc(struct otx2_nic *pfvf)
 
 static int otx2_pfc_txschq_stop_one(struct otx2_nic *pfvf, u8 prio)
 {
-	struct nix_txsch_free_req *free_req;
+	int lvl;
 
-	mutex_lock(&pfvf->mbox.lock);
 	/* free PFC TLx nodes */
-	free_req = otx2_mbox_alloc_msg_nix_txsch_free(&pfvf->mbox);
-	if (!free_req) {
-		mutex_unlock(&pfvf->mbox.lock);
-		return -ENOMEM;
-	}
-
-	free_req->flags = TXSCHQ_FREE_ALL;
-	otx2_sync_mbox_msg(&pfvf->mbox);
-	mutex_unlock(&pfvf->mbox.lock);
+	for (lvl = 0; lvl < pfvf->hw.txschq_link_cfg_lvl; lvl++)
+		otx2_txschq_free_one(pfvf, lvl,
+				     pfvf->pfc_schq_list[lvl][prio]);
 
 	pfvf->pfc_alloc_status[prio] = false;
 	return 0;