* [PATCH] net/nfp: fix the initialization of physical representors
@ 2023-10-10 6:03 Chaoyong He
2023-10-12 14:49 ` Ferruh Yigit
0 siblings, 1 reply; 2+ messages in thread
From: Chaoyong He @ 2023-10-10 6:03 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Zerun Fu, chaoyong.he, stable, Long Wu, Peng Zhang
From: Zerun Fu <zerun.fu@corigine.com>
The former logic of initializing the array of physical port
representors is according to 'nfp_idx', but referencing based
on 'port_id'. This is a potential bug and will cause segment
fault when these two values are not equal. Fix it by using the
'port_id' as index at all time.
Fixes: e1124c4f8a45 ("net/nfp: add flower representor framework")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Zerun Fu <zerun.fu@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
drivers/net/nfp/flower/nfp_flower_representor.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 55ca3e6db0..e4c5d765e7 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -646,6 +646,7 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev,
void *init_params)
{
int ret;
+ uint16_t index;
unsigned int numa_node;
char ring_name[RTE_ETH_NAME_MAX_LEN];
struct nfp_app_fw_flower *app_fw_flower;
@@ -719,10 +720,13 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev,
}
/* Add repr to correct array */
- if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT)
- app_fw_flower->phy_reprs[repr->nfp_idx] = repr;
- else
- app_fw_flower->vf_reprs[repr->vf_id] = repr;
+ if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) {
+ index = NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM(repr->port_id);
+ app_fw_flower->phy_reprs[index] = repr;
+ } else {
+ index = repr->vf_id;
+ app_fw_flower->vf_reprs[index] = repr;
+ }
return 0;
--
2.39.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] net/nfp: fix the initialization of physical representors
2023-10-10 6:03 [PATCH] net/nfp: fix the initialization of physical representors Chaoyong He
@ 2023-10-12 14:49 ` Ferruh Yigit
0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2023-10-12 14:49 UTC (permalink / raw)
To: Chaoyong He, dev; +Cc: oss-drivers, Zerun Fu, stable, Long Wu, Peng Zhang
On 10/10/2023 7:03 AM, Chaoyong He wrote:
> From: Zerun Fu <zerun.fu@corigine.com>
>
> The former logic of initializing the array of physical port
> representors is according to 'nfp_idx', but referencing based
> on 'port_id'. This is a potential bug and will cause segment
> fault when these two values are not equal. Fix it by using the
> 'port_id' as index at all time.
>
> Fixes: e1124c4f8a45 ("net/nfp: add flower representor framework")
> Cc: chaoyong.he@corigine.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Zerun Fu <zerun.fu@corigine.com>
> Reviewed-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
>
Applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-12 14:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-10 6:03 [PATCH] net/nfp: fix the initialization of physical representors Chaoyong He
2023-10-12 14:49 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).