diff mbox series

[net,V2] octeontx2-pf: Fix pfc_alloc_status array overflow

Message ID 20221123105938.2824933-1-sumang@marvell.com (mailing list archive)
State Accepted
Commit 32b931c86d0aef4f3263de457f58d82e9cbae2a2
Delegated to: Netdev Maintainers
Headers show
Series [net,V2] octeontx2-pf: Fix pfc_alloc_status array overflow | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
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: 14 this patch: 14
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 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 Nov. 23, 2022, 10:59 a.m. UTC
This patch addresses pfc_alloc_status array overflow occurring for
send queue index value greater than PFC priority. Queue index can be
greater than supported PFC priority for multiple scenarios (e.g. QoS,
during non zero SMQ allocation for a PF/VF).
In those scenarios the API should return default tx scheduler '0'.
This is causing mbox errors as otx2_get_smq_idx returing invalid smq value.

Fixes: 99c969a83d82 ("octeontx2-pf: Add egress PFC support")
Signed-off-by: Suman Ghosh <sumang@marvell.com>
---
Changes since v1:
- Updated commit message.

 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky Nov. 23, 2022, 11:08 a.m. UTC | #1
On Wed, Nov 23, 2022 at 04:29:38PM +0530, Suman Ghosh wrote:
> This patch addresses pfc_alloc_status array overflow occurring for
> send queue index value greater than PFC priority. Queue index can be
> greater than supported PFC priority for multiple scenarios (e.g. QoS,
> during non zero SMQ allocation for a PF/VF).
> In those scenarios the API should return default tx scheduler '0'.
> This is causing mbox errors as otx2_get_smq_idx returing invalid smq value.
> 
> Fixes: 99c969a83d82 ("octeontx2-pf: Add egress PFC support")
> Signed-off-by: Suman Ghosh <sumang@marvell.com>
> ---
> Changes since v1:
> - Updated commit message.
> 
>  drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
patchwork-bot+netdevbpf@kernel.org Nov. 25, 2022, 9:40 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed, 23 Nov 2022 16:29:38 +0530 you wrote:
> This patch addresses pfc_alloc_status array overflow occurring for
> send queue index value greater than PFC priority. Queue index can be
> greater than supported PFC priority for multiple scenarios (e.g. QoS,
> during non zero SMQ allocation for a PF/VF).
> In those scenarios the API should return default tx scheduler '0'.
> This is causing mbox errors as otx2_get_smq_idx returing invalid smq value.
> 
> [...]

Here is the summary with links:
  - [net,V2] octeontx2-pf: Fix pfc_alloc_status array overflow
    https://git.kernel.org/netdev/net/c/32b931c86d0a

You are awesome, thank you!
Fijalkowski, Maciej Nov. 25, 2022, 2:58 p.m. UTC | #3
On Wed, Nov 23, 2022 at 04:29:38PM +0530, Suman Ghosh wrote:
> This patch addresses pfc_alloc_status array overflow occurring for

Nit: use imperative mood

> send queue index value greater than PFC priority. Queue index can be
> greater than supported PFC priority for multiple scenarios (e.g. QoS,
> during non zero SMQ allocation for a PF/VF).
> In those scenarios the API should return default tx scheduler '0'.
> This is causing mbox errors as otx2_get_smq_idx returing invalid smq value.
> 
> Fixes: 99c969a83d82 ("octeontx2-pf: Add egress PFC support")
> Signed-off-by: Suman Ghosh <sumang@marvell.com>
> ---
> Changes since v1:
> - Updated commit message.
> 
>  drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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

> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
> index 282db6fe3b08..67aa02bb2b85 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
> @@ -884,7 +884,7 @@ static inline void otx2_dma_unmap_page(struct otx2_nic *pfvf,
>  static inline u16 otx2_get_smq_idx(struct otx2_nic *pfvf, u16 qidx)
>  {
>  #ifdef CONFIG_DCB
> -	if (pfvf->pfc_alloc_status[qidx])
> +	if (qidx < NIX_PF_PFC_PRIO_MAX && pfvf->pfc_alloc_status[qidx])
>  		return pfvf->pfc_schq_list[NIX_TXSCH_LVL_SMQ][qidx];
>  #endif
>  
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
index 282db6fe3b08..67aa02bb2b85 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
@@ -884,7 +884,7 @@  static inline void otx2_dma_unmap_page(struct otx2_nic *pfvf,
 static inline u16 otx2_get_smq_idx(struct otx2_nic *pfvf, u16 qidx)
 {
 #ifdef CONFIG_DCB
-	if (pfvf->pfc_alloc_status[qidx])
+	if (qidx < NIX_PF_PFC_PRIO_MAX && pfvf->pfc_alloc_status[qidx])
 		return pfvf->pfc_schq_list[NIX_TXSCH_LVL_SMQ][qidx];
 #endif