net/idpf: refine idpf_dev_vport_init() function
PATCH 1/1 net/idpf: refine idpf_dev_vport_init() function
This patch adds 'cur_vports' and 'cur_vport_nb' updation in error path.
--- drivers/net/idpf/idpf_ethdev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/idpf/idpf_ethdev.c +2 -0
@@ -1300,6 +1300,8 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params) err_mac_addrs: adapter->vports[param->idx] =NULL ;/* reset */ idpf_vport_deinit (vport); + adapter->cur_vports &= ~RTE_BIT32 (param->devarg_id); + adapter->cur_vport_nb--; err:return ret; }
Signature · 1 line
2.34.1
Quoted 22 lines
-----Original Message-----
From: Mingxia Liu <[email protected]>
Sent: Monday, June 26, 2023 10:06 PM
To: [email protected]
Cc: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Liu, Mingxia <[email protected]>
Subject: [PATCH] net/idpf: refineidpf_dev_vport_init()functionThis patch adds '
cur_vports' and 'cur_vport_nb' updation in error path.Signed-off-by Mingxia Liu <[email protected]>--- drivers/net/idpf/idpf_ethdev.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/idpf/idpf_ethdev.c +0
-0
drivers/net/idpf/idpf_ethdev.c idpf_dev_vport_init(struct rte_eth_dev *dev, void · line 1305
Quoted 6 lines
drivers/net/idpf/idpf_ethdev.c +2
-0@@ -1300,6 +1300,8 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params) err_mac_addrs: adapter->vports[param->idx] =NULL ;/* reset */ idpf_vport_deinit (vport); + adapter->cur_vports &= ~RTE_BIT32 (param->devarg_id); + adapter->cur_vport_nb--;
Can we move below two lines to the last?
adapter->cur_vports |= RTE_BIT32(param->devarg_id); adapter->cur_vport_nb++;
so we don't need to revert them in error handle
Quoted 5 lines
drivers/net/idpf/idpf_ethdev.c +0
-0err:return ret;}
--
2.34.1
Quoted 42 lines
-----Original Message-----
From: Zhang, Qi Z
Sent: Friday, June 30, 2023 4:13 PM
To: Mingxia Liu <[email protected]>; [email protected]
Cc: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Liu, Mingxia <[email protected]>
Subject: RE: [PATCH] net/idpf: refineidpf_dev_vport_init()functionQuoted 23 lines
-----Original Message-----
From: Mingxia Liu <[email protected]>
Sent: Monday, June 26, 2023 10:06 PM
To: [email protected]
Cc: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Liu, Mingxia <[email protected]>
Subject: [PATCH] net/idpf: refineidpf_dev_vport_init()functionThis patch adds '
cur_vports' and 'cur_vport_nb' updation in error path.Signed-off-by Mingxia Liu <[email protected]>--- drivers/net/idpf/idpf_ethdev.c | 2 ++ 1 file changed, 2 insertions(+)(quoted diff) +0
-0
b/drivers/net/idpf/idpf_ethdev.cindex801da57472..3e66898aaf100644drivers/net/idpf/idpf_ethdev.c +0
-0@@ -1300,6 +1300,8 @@ idpf_dev_vport_init(struct rte_eth_dev *dev,void
*init_params)
err_mac_addrs:drivers/net/idpf/idpf_ethdev.c idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params) · line 1304
Quoted 4 lines
drivers/net/idpf/idpf_ethdev.c +2
-0adapter->vports[param->idx] =NULL ;/* reset */ idpf_vport_deinit (vport); + adapter->cur_vports &= ~RTE_BIT32 (param->devarg_id); + adapter->cur_vport_nb--;Can we move below two lines to the last?
Quoted 3 lines
adapter->cur_vports|=RTE_BIT32(param->devarg_id); cur_vport_nb++;so we don't need to revert them in error handle
Btw this is a fix, please also add the fixline.
Quoted 6 lines
Quoted 6 lines
err:
return ret;
}
--
2.34.1
Quoted 52 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Friday, June 30, 2023 4:14 PM
To: Liu, Mingxia <[email protected]>; [email protected]
Cc: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Liu, Mingxia <[email protected]>
Subject: RE: [PATCH] net/idpf: refineidpf_dev_vport_init()functionQuoted 40 lines
-----Original Message-----
From: Zhang, Qi Z
Sent: Friday, June 30, 2023 4:13 PM
To: Mingxia Liu <[email protected]>; [email protected]
Cc: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Liu, Mingxia <[email protected]>
Subject: RE: [PATCH] net/idpf: refineidpf_dev_vport_init()functionQuoted 23 lines
-----Original Message-----
From: Mingxia Liu <[email protected]>
Sent: Monday, June 26, 2023 10:06 PM
To: [email protected]
Cc: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Liu, Mingxia <[email protected]>
Subject: [PATCH] net/idpf: refineidpf_dev_vport_init()functionThis patch adds '
cur_vports' and 'cur_vport_nb' updation in error path.Signed-off-by Mingxia Liu <[email protected]>--- drivers/net/idpf/idpf_ethdev.c | 2 ++ 1 file changed, 2 insertions(+)(quoted diff) +0
-0
b/drivers/net/idpf/idpf_ethdev.cindex801da57472..3e66898aaf100644drivers/net/idpf/idpf_ethdev.c +0
-0@@ -1300,6 +1300,8 @@ idpf_dev_vport_init(struct rte_eth_dev *dev,void
*init_params)
err_mac_addrs:drivers/net/idpf/idpf_ethdev.c idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params) · line 1304
Quoted 4 lines
drivers/net/idpf/idpf_ethdev.c +2
-0adapter->vports[param->idx] =NULL ;/* reset */ idpf_vport_deinit (vport); + adapter->cur_vports &= ~RTE_BIT32 (param->devarg_id); + adapter->cur_vport_nb--;Can we move below two lines to the last?
Quoted 6 lines
Quoted 3 lines
adapter->cur_vports|=RTE_BIT32(param->devarg_id); cur_vport_nb++;so we don't need to revert them in error handle
Btw this is a fix, please also add the fixline.
Quoted 1 line
[Liu, Mingxia] Thanks, new patch has been sent.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
err:
return ret;
}
--
2.34.1
PATCH v2 1/1 net/idpf: fix error path processing
In reply to Mingxia LiuThis patch moves vport info updating lines to the last, in order to fix reverting missing in the error handle.
--- drivers/net/idpf/idpf_ethdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/idpf/idpf_ethdev.c +4 -4
@@ -1277,10 +1277,6 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params) goto err; } - adapter->vports[param->idx] = vport; - adapter->cur_vports |=RTE_BIT32 (param->devarg_id); - adapter->cur_vport_nb++; - dev->data->mac_addrs =rte_zmalloc (NULL ,RTE_ETHER_ADDR_LEN ,0 );if (dev->data->mac_addrs ==NULL ) {PMD_INIT_LOG (ERR ,"Cannot allocate mac_addr memory." );
@@ -1291,6 +1287,10 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params)rte_ether_addr_copy ((struct rte_ether_addr *)vport->default_mac_addr, &dev->data->mac_addrs[0 ]); + adapter->vports[param->idx] = vport; + adapter->cur_vports |=RTE_BIT32 (param->devarg_id); + adapter->cur_vport_nb++; +return 0 ; err_mac_addrs:
Signature · 1 line
2.34.1
RE: [PATCH v2] net/idpf: fix error path processing
Quoted 10 lines
-----Original Message-----
From: Mingxia Liu <[email protected]>
Sent: Saturday, July 1, 2023 2:54 AM
To: [email protected]
Cc: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Liu, Mingxia <[email protected]>
Subject: [PATCH v2] net/idpf: fix error path processing
Quoted 5 lines
This patch moves vport info updating lines to the last, in order to fix reverting missing in the error handle.
Fixes 5e0f60527e5b ("net/idpf: remove vport req and recv info from adapter")
Added Cc: [email protected]
Quoted 1 line
Signed-off-by Mingxia Liu <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi