* [PATCH] net/idpf: refine dev_link_update function
@ 2023-06-26 11:14 Mingxia Liu
2023-06-30 8:27 ` Zhang, Qi Z
2023-06-30 18:55 ` [PATCH v2] " Mingxia Liu
0 siblings, 2 replies; 8+ messages in thread
From: Mingxia Liu @ 2023-06-26 11:14 UTC (permalink / raw)
To: dev; +Cc: jingjing.wu, beilei.xing, Mingxia Liu
This patch refines idpf_dev_link_update callback function according to
CPFL PMD basic code.
Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
---
drivers/net/idpf/idpf_ethdev.c | 63 ++++++++++++++++------------------
1 file changed, 30 insertions(+), 33 deletions(-)
diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index fb59655555..bfdac92b95 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -30,6 +30,23 @@ static const char * const idpf_valid_args[] = {
NULL
};
+uint32_t idpf_supported_speeds[] = {
+ RTE_ETH_SPEED_NUM_NONE,
+ RTE_ETH_SPEED_NUM_10M,
+ RTE_ETH_SPEED_NUM_100M,
+ RTE_ETH_SPEED_NUM_1G,
+ RTE_ETH_SPEED_NUM_2_5G,
+ RTE_ETH_SPEED_NUM_5G,
+ RTE_ETH_SPEED_NUM_10G,
+ RTE_ETH_SPEED_NUM_20G,
+ RTE_ETH_SPEED_NUM_25G,
+ RTE_ETH_SPEED_NUM_40G,
+ RTE_ETH_SPEED_NUM_50G,
+ RTE_ETH_SPEED_NUM_56G,
+ RTE_ETH_SPEED_NUM_100G,
+ RTE_ETH_SPEED_NUM_200G
+};
+
static const uint64_t idpf_map_hena_rss[] = {
[IDPF_HASH_NONF_UNICAST_IPV4_UDP] =
RTE_ETH_RSS_NONFRAG_IPV4_UDP,
@@ -110,42 +127,22 @@ idpf_dev_link_update(struct rte_eth_dev *dev,
{
struct idpf_vport *vport = dev->data->dev_private;
struct rte_eth_link new_link;
+ unsigned int i;
memset(&new_link, 0, sizeof(new_link));
- switch (vport->link_speed) {
- case RTE_ETH_SPEED_NUM_10M:
- new_link.link_speed = RTE_ETH_SPEED_NUM_10M;
- break;
- case RTE_ETH_SPEED_NUM_100M:
- new_link.link_speed = RTE_ETH_SPEED_NUM_100M;
- break;
- case RTE_ETH_SPEED_NUM_1G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_1G;
- break;
- case RTE_ETH_SPEED_NUM_10G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_10G;
- break;
- case RTE_ETH_SPEED_NUM_20G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_20G;
- break;
- case RTE_ETH_SPEED_NUM_25G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_25G;
- break;
- case RTE_ETH_SPEED_NUM_40G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_40G;
- break;
- case RTE_ETH_SPEED_NUM_50G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_50G;
- break;
- case RTE_ETH_SPEED_NUM_100G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_100G;
- break;
- case RTE_ETH_SPEED_NUM_200G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_200G;
- break;
- default:
- new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;
+ for (i = 0; i < RTE_DIM(idpf_supported_speeds); i++) {
+ if (vport->link_speed == idpf_supported_speeds[i]) {
+ new_link.link_speed = vport->link_speed;
+ break;
+ }
+ }
+
+ if (i == RTE_DIM(idpf_supported_speeds)) {
+ if (vport->link_up)
+ new_link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN;
+ else
+ new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;
}
new_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] net/idpf: refine dev_link_update function
2023-06-26 11:14 [PATCH] net/idpf: refine dev_link_update function Mingxia Liu
@ 2023-06-30 8:27 ` Zhang, Qi Z
2023-06-30 10:46 ` Liu, Mingxia
2023-06-30 18:55 ` [PATCH v2] " Mingxia Liu
1 sibling, 1 reply; 8+ messages in thread
From: Zhang, Qi Z @ 2023-06-30 8:27 UTC (permalink / raw)
To: Liu, Mingxia, dev; +Cc: Wu, Jingjing, Xing, Beilei, Liu, Mingxia
> -----Original Message-----
> From: Mingxia Liu <mingxia.liu@intel.com>
> Sent: Monday, June 26, 2023 7:15 PM
> To: dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> Liu, Mingxia <mingxia.liu@intel.com>
> Subject: [PATCH] net/idpf: refine dev_link_update function
>
> This patch refines idpf_dev_link_update callback function according to CPFL
> PMD basic code.
>
> Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
> ---
> drivers/net/idpf/idpf_ethdev.c | 63 ++++++++++++++++------------------
> 1 file changed, 30 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
> index fb59655555..bfdac92b95 100644
> --- a/drivers/net/idpf/idpf_ethdev.c
> +++ b/drivers/net/idpf/idpf_ethdev.c
> @@ -30,6 +30,23 @@ static const char * const idpf_valid_args[] = {
> NULL
> };
>
> +uint32_t idpf_supported_speeds[] = {
> + RTE_ETH_SPEED_NUM_NONE,
> + RTE_ETH_SPEED_NUM_10M,
> + RTE_ETH_SPEED_NUM_100M,
> + RTE_ETH_SPEED_NUM_1G,
> + RTE_ETH_SPEED_NUM_2_5G,
> + RTE_ETH_SPEED_NUM_5G,
> + RTE_ETH_SPEED_NUM_10G,
> + RTE_ETH_SPEED_NUM_20G,
> + RTE_ETH_SPEED_NUM_25G,
> + RTE_ETH_SPEED_NUM_40G,
> + RTE_ETH_SPEED_NUM_50G,
> + RTE_ETH_SPEED_NUM_56G,
> + RTE_ETH_SPEED_NUM_100G,
> + RTE_ETH_SPEED_NUM_200G
> +};
> +
> static const uint64_t idpf_map_hena_rss[] = {
> [IDPF_HASH_NONF_UNICAST_IPV4_UDP] =
> RTE_ETH_RSS_NONFRAG_IPV4_UDP,
> @@ -110,42 +127,22 @@ idpf_dev_link_update(struct rte_eth_dev *dev, {
> struct idpf_vport *vport = dev->data->dev_private;
> struct rte_eth_link new_link;
> + unsigned int i;
>
> memset(&new_link, 0, sizeof(new_link));
>
> - switch (vport->link_speed) {
> - case RTE_ETH_SPEED_NUM_10M:
> - new_link.link_speed = RTE_ETH_SPEED_NUM_10M;
> - break;
> - case RTE_ETH_SPEED_NUM_100M:
> - new_link.link_speed = RTE_ETH_SPEED_NUM_100M;
> - break;
> - case RTE_ETH_SPEED_NUM_1G:
> - new_link.link_speed = RTE_ETH_SPEED_NUM_1G;
> - break;
> - case RTE_ETH_SPEED_NUM_10G:
> - new_link.link_speed = RTE_ETH_SPEED_NUM_10G;
> - break;
> - case RTE_ETH_SPEED_NUM_20G:
> - new_link.link_speed = RTE_ETH_SPEED_NUM_20G;
> - break;
> - case RTE_ETH_SPEED_NUM_25G:
> - new_link.link_speed = RTE_ETH_SPEED_NUM_25G;
> - break;
> - case RTE_ETH_SPEED_NUM_40G:
> - new_link.link_speed = RTE_ETH_SPEED_NUM_40G;
> - break;
> - case RTE_ETH_SPEED_NUM_50G:
> - new_link.link_speed = RTE_ETH_SPEED_NUM_50G;
> - break;
> - case RTE_ETH_SPEED_NUM_100G:
> - new_link.link_speed = RTE_ETH_SPEED_NUM_100G;
> - break;
> - case RTE_ETH_SPEED_NUM_200G:
> - new_link.link_speed = RTE_ETH_SPEED_NUM_200G;
> - break;
> - default:
> - new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;
> + for (i = 0; i < RTE_DIM(idpf_supported_speeds); i++) {
> + if (vport->link_speed == idpf_supported_speeds[i]) {
> + new_link.link_speed = vport->link_speed;
> + break;
> + }
> + }
> +
> + if (i == RTE_DIM(idpf_supported_speeds)) {
> + if (vport->link_up)
> + new_link.link_speed =
> RTE_ETH_SPEED_NUM_UNKNOWN;
> + else
> + new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;
> }
What about
/* initialize with default value */
new_link.link_speed = vport->link_up ? RTE_ETH_SPEED_NUM_UNKNOWN : RTE_ETH_SPEED_NUM_NONE
/ * update in case a match */
for (i = 0; i < RTE_DIM(idpf_supported_speeds); i++) {
....
}
>
> new_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
> --
> 2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] net/idpf: refine dev_link_update function
2023-06-30 8:27 ` Zhang, Qi Z
@ 2023-06-30 10:46 ` Liu, Mingxia
0 siblings, 0 replies; 8+ messages in thread
From: Liu, Mingxia @ 2023-06-30 10:46 UTC (permalink / raw)
To: Zhang, Qi Z, dev; +Cc: Wu, Jingjing, Xing, Beilei
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Friday, June 30, 2023 4:27 PM
> To: Liu, Mingxia <mingxia.liu@intel.com>; dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> Liu, Mingxia <mingxia.liu@intel.com>
> Subject: RE: [PATCH] net/idpf: refine dev_link_update function
>
>
>
> > -----Original Message-----
> > From: Mingxia Liu <mingxia.liu@intel.com>
> > Sent: Monday, June 26, 2023 7:15 PM
> > To: dev@dpdk.org
> > Cc: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> > <beilei.xing@intel.com>; Liu, Mingxia <mingxia.liu@intel.com>
> > Subject: [PATCH] net/idpf: refine dev_link_update function
> >
> > This patch refines idpf_dev_link_update callback function according to
> > CPFL PMD basic code.
> >
> > Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
> > ---
> > drivers/net/idpf/idpf_ethdev.c | 63
> > ++++++++++++++++------------------
> > 1 file changed, 30 insertions(+), 33 deletions(-)
> >
> > diff --git a/drivers/net/idpf/idpf_ethdev.c
> > b/drivers/net/idpf/idpf_ethdev.c index fb59655555..bfdac92b95 100644
> > --- a/drivers/net/idpf/idpf_ethdev.c
> > +++ b/drivers/net/idpf/idpf_ethdev.c
> > @@ -30,6 +30,23 @@ static const char * const idpf_valid_args[] = {
> > NULL
> > };
> >
> > +uint32_t idpf_supported_speeds[] = {
> > + RTE_ETH_SPEED_NUM_NONE,
> > + RTE_ETH_SPEED_NUM_10M,
> > + RTE_ETH_SPEED_NUM_100M,
> > + RTE_ETH_SPEED_NUM_1G,
> > + RTE_ETH_SPEED_NUM_2_5G,
> > + RTE_ETH_SPEED_NUM_5G,
> > + RTE_ETH_SPEED_NUM_10G,
> > + RTE_ETH_SPEED_NUM_20G,
> > + RTE_ETH_SPEED_NUM_25G,
> > + RTE_ETH_SPEED_NUM_40G,
> > + RTE_ETH_SPEED_NUM_50G,
> > + RTE_ETH_SPEED_NUM_56G,
> > + RTE_ETH_SPEED_NUM_100G,
> > + RTE_ETH_SPEED_NUM_200G
> > +};
> > +
> > static const uint64_t idpf_map_hena_rss[] = {
> > [IDPF_HASH_NONF_UNICAST_IPV4_UDP] =
> > RTE_ETH_RSS_NONFRAG_IPV4_UDP,
> > @@ -110,42 +127,22 @@ idpf_dev_link_update(struct rte_eth_dev *dev, {
> > struct idpf_vport *vport = dev->data->dev_private;
> > struct rte_eth_link new_link;
> > + unsigned int i;
> >
> > memset(&new_link, 0, sizeof(new_link));
> >
> > - switch (vport->link_speed) {
> > - case RTE_ETH_SPEED_NUM_10M:
> > - new_link.link_speed = RTE_ETH_SPEED_NUM_10M;
> > - break;
> > - case RTE_ETH_SPEED_NUM_100M:
> > - new_link.link_speed = RTE_ETH_SPEED_NUM_100M;
> > - break;
> > - case RTE_ETH_SPEED_NUM_1G:
> > - new_link.link_speed = RTE_ETH_SPEED_NUM_1G;
> > - break;
> > - case RTE_ETH_SPEED_NUM_10G:
> > - new_link.link_speed = RTE_ETH_SPEED_NUM_10G;
> > - break;
> > - case RTE_ETH_SPEED_NUM_20G:
> > - new_link.link_speed = RTE_ETH_SPEED_NUM_20G;
> > - break;
> > - case RTE_ETH_SPEED_NUM_25G:
> > - new_link.link_speed = RTE_ETH_SPEED_NUM_25G;
> > - break;
> > - case RTE_ETH_SPEED_NUM_40G:
> > - new_link.link_speed = RTE_ETH_SPEED_NUM_40G;
> > - break;
> > - case RTE_ETH_SPEED_NUM_50G:
> > - new_link.link_speed = RTE_ETH_SPEED_NUM_50G;
> > - break;
> > - case RTE_ETH_SPEED_NUM_100G:
> > - new_link.link_speed = RTE_ETH_SPEED_NUM_100G;
> > - break;
> > - case RTE_ETH_SPEED_NUM_200G:
> > - new_link.link_speed = RTE_ETH_SPEED_NUM_200G;
> > - break;
> > - default:
> > - new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;
> > + for (i = 0; i < RTE_DIM(idpf_supported_speeds); i++) {
> > + if (vport->link_speed == idpf_supported_speeds[i]) {
> > + new_link.link_speed = vport->link_speed;
> > + break;
> > + }
> > + }
> > +
> > + if (i == RTE_DIM(idpf_supported_speeds)) {
> > + if (vport->link_up)
> > + new_link.link_speed =
> > RTE_ETH_SPEED_NUM_UNKNOWN;
> > + else
> > + new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;
> > }
>
> What about
>
> /* initialize with default value */
> new_link.link_speed = vport->link_up ? RTE_ETH_SPEED_NUM_UNKNOWN :
> RTE_ETH_SPEED_NUM_NONE
>
> / * update in case a match */
> for (i = 0; i < RTE_DIM(idpf_supported_speeds); i++) {
> ....
> }
>
[Liu, Mingxia] Good idea, new patch has been sent.
> >
> > new_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
> > --
> > 2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] net/idpf: refine dev_link_update function
2023-06-26 11:14 [PATCH] net/idpf: refine dev_link_update function Mingxia Liu
2023-06-30 8:27 ` Zhang, Qi Z
@ 2023-06-30 18:55 ` Mingxia Liu
2023-07-03 2:21 ` Zhang, Qi Z
2023-07-03 11:22 ` [PATCH v3] " Mingxia Liu
1 sibling, 2 replies; 8+ messages in thread
From: Mingxia Liu @ 2023-06-30 18:55 UTC (permalink / raw)
To: dev; +Cc: jingjing.wu, beilei.xing, Mingxia Liu
This patch refines idpf_dev_link_update callback function according to
CPFL PMD basic code.
Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
---
drivers/net/idpf/idpf_ethdev.c | 63 +++++++++++++++-------------------
1 file changed, 28 insertions(+), 35 deletions(-)
diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index fb59655555..4aa0a18cd8 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -30,6 +30,23 @@ static const char * const idpf_valid_args[] = {
NULL
};
+uint32_t idpf_supported_speeds[] = {
+ RTE_ETH_SPEED_NUM_NONE,
+ RTE_ETH_SPEED_NUM_10M,
+ RTE_ETH_SPEED_NUM_100M,
+ RTE_ETH_SPEED_NUM_1G,
+ RTE_ETH_SPEED_NUM_2_5G,
+ RTE_ETH_SPEED_NUM_5G,
+ RTE_ETH_SPEED_NUM_10G,
+ RTE_ETH_SPEED_NUM_20G,
+ RTE_ETH_SPEED_NUM_25G,
+ RTE_ETH_SPEED_NUM_40G,
+ RTE_ETH_SPEED_NUM_50G,
+ RTE_ETH_SPEED_NUM_56G,
+ RTE_ETH_SPEED_NUM_100G,
+ RTE_ETH_SPEED_NUM_200G
+};
+
static const uint64_t idpf_map_hena_rss[] = {
[IDPF_HASH_NONF_UNICAST_IPV4_UDP] =
RTE_ETH_RSS_NONFRAG_IPV4_UDP,
@@ -110,47 +127,23 @@ idpf_dev_link_update(struct rte_eth_dev *dev,
{
struct idpf_vport *vport = dev->data->dev_private;
struct rte_eth_link new_link;
+ unsigned int i;
memset(&new_link, 0, sizeof(new_link));
- switch (vport->link_speed) {
- case RTE_ETH_SPEED_NUM_10M:
- new_link.link_speed = RTE_ETH_SPEED_NUM_10M;
- break;
- case RTE_ETH_SPEED_NUM_100M:
- new_link.link_speed = RTE_ETH_SPEED_NUM_100M;
- break;
- case RTE_ETH_SPEED_NUM_1G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_1G;
- break;
- case RTE_ETH_SPEED_NUM_10G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_10G;
- break;
- case RTE_ETH_SPEED_NUM_20G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_20G;
- break;
- case RTE_ETH_SPEED_NUM_25G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_25G;
- break;
- case RTE_ETH_SPEED_NUM_40G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_40G;
- break;
- case RTE_ETH_SPEED_NUM_50G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_50G;
- break;
- case RTE_ETH_SPEED_NUM_100G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_100G;
- break;
- case RTE_ETH_SPEED_NUM_200G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_200G;
- break;
- default:
- new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;
+ /* initialize with default value */
+ new_link.link_speed = vport->link_up ? RTE_ETH_SPEED_NUM_UNKNOWN : RTE_ETH_SPEED_NUM_NONE;
+
+ /* update in case a match */
+ for (i = 0; i < RTE_DIM(idpf_supported_speeds); i++) {
+ if (vport->link_speed == idpf_supported_speeds[i]) {
+ new_link.link_speed = vport->link_speed;
+ break;
+ }
}
new_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
- new_link.link_status = vport->link_up ? RTE_ETH_LINK_UP :
- RTE_ETH_LINK_DOWN;
+ new_link.link_status = vport->link_up ? RTE_ETH_LINK_UP : RTE_ETH_LINK_DOWN;
new_link.link_autoneg = (dev->data->dev_conf.link_speeds & RTE_ETH_LINK_SPEED_FIXED) ?
RTE_ETH_LINK_FIXED : RTE_ETH_LINK_AUTONEG;
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH v2] net/idpf: refine dev_link_update function
2023-06-30 18:55 ` [PATCH v2] " Mingxia Liu
@ 2023-07-03 2:21 ` Zhang, Qi Z
2023-07-03 3:17 ` Liu, Mingxia
2023-07-03 11:22 ` [PATCH v3] " Mingxia Liu
1 sibling, 1 reply; 8+ messages in thread
From: Zhang, Qi Z @ 2023-07-03 2:21 UTC (permalink / raw)
To: Liu, Mingxia, dev; +Cc: Wu, Jingjing, Xing, Beilei, Liu, Mingxia
> -----Original Message-----
> From: Mingxia Liu <mingxia.liu@intel.com>
> Sent: Saturday, July 1, 2023 2:56 AM
> To: dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> Liu, Mingxia <mingxia.liu@intel.com>
> Subject: [PATCH v2] net/idpf: refine dev_link_update function
net/idpf: refine dev link update
>
> This patch refines idpf_dev_link_update callback function according to CPFL
> PMD basic code.
The patch is for idpf PMD, not the common/idpf part, why ref CPFL PMD here?
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH v2] net/idpf: refine dev_link_update function
2023-07-03 2:21 ` Zhang, Qi Z
@ 2023-07-03 3:17 ` Liu, Mingxia
0 siblings, 0 replies; 8+ messages in thread
From: Liu, Mingxia @ 2023-07-03 3:17 UTC (permalink / raw)
To: Zhang, Qi Z, dev; +Cc: Wu, Jingjing, Xing, Beilei
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Monday, July 3, 2023 10:22 AM
> To: Liu, Mingxia <mingxia.liu@intel.com>; dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> Liu, Mingxia <mingxia.liu@intel.com>
> Subject: RE: [PATCH v2] net/idpf: refine dev_link_update function
>
>
>
> > -----Original Message-----
> > From: Mingxia Liu <mingxia.liu@intel.com>
> > Sent: Saturday, July 1, 2023 2:56 AM
> > To: dev@dpdk.org
> > Cc: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei
> > <beilei.xing@intel.com>; Liu, Mingxia <mingxia.liu@intel.com>
> > Subject: [PATCH v2] net/idpf: refine dev_link_update function
>
> net/idpf: refine dev link update
>
> >
> > This patch refines idpf_dev_link_update callback function according to
> > CPFL PMD basic code.
>
> The patch is for idpf PMD, not the common/idpf part, why ref CPFL PMD here?
>
[Liu, Mingxia] Because this change referred to cpfl basic code, maybe it's better to delete it. New patch has been sent.
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH v3] net/idpf: refine dev_link_update function
2023-07-03 11:22 ` [PATCH v3] " Mingxia Liu
@ 2023-07-03 6:51 ` Zhang, Qi Z
0 siblings, 0 replies; 8+ messages in thread
From: Zhang, Qi Z @ 2023-07-03 6:51 UTC (permalink / raw)
To: Liu, Mingxia, dev; +Cc: Wu, Jingjing, Xing, Beilei, Liu, Mingxia
> -----Original Message-----
> From: Mingxia Liu <mingxia.liu@intel.com>
> Sent: Monday, July 3, 2023 7:22 PM
> To: dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> Liu, Mingxia <mingxia.liu@intel.com>
> Subject: [PATCH v3] net/idpf: refine dev_link_update function
>
> This patch refines dev_link_update() of IDPF PMD, optimizing the code style.
>
> Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Applied to dpdk-next-net-intel.
Thanks
Qi
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3] net/idpf: refine dev_link_update function
2023-06-30 18:55 ` [PATCH v2] " Mingxia Liu
2023-07-03 2:21 ` Zhang, Qi Z
@ 2023-07-03 11:22 ` Mingxia Liu
2023-07-03 6:51 ` Zhang, Qi Z
1 sibling, 1 reply; 8+ messages in thread
From: Mingxia Liu @ 2023-07-03 11:22 UTC (permalink / raw)
To: dev; +Cc: jingjing.wu, beilei.xing, Mingxia Liu
This patch refines dev_link_update() of IDPF PMD, optimizing
the code style.
Signed-off-by: Mingxia Liu <mingxia.liu@intel.com>
---
drivers/net/idpf/idpf_ethdev.c | 63 +++++++++++++++-------------------
1 file changed, 28 insertions(+), 35 deletions(-)
diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index fb59655555..4aa0a18cd8 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -30,6 +30,23 @@ static const char * const idpf_valid_args[] = {
NULL
};
+uint32_t idpf_supported_speeds[] = {
+ RTE_ETH_SPEED_NUM_NONE,
+ RTE_ETH_SPEED_NUM_10M,
+ RTE_ETH_SPEED_NUM_100M,
+ RTE_ETH_SPEED_NUM_1G,
+ RTE_ETH_SPEED_NUM_2_5G,
+ RTE_ETH_SPEED_NUM_5G,
+ RTE_ETH_SPEED_NUM_10G,
+ RTE_ETH_SPEED_NUM_20G,
+ RTE_ETH_SPEED_NUM_25G,
+ RTE_ETH_SPEED_NUM_40G,
+ RTE_ETH_SPEED_NUM_50G,
+ RTE_ETH_SPEED_NUM_56G,
+ RTE_ETH_SPEED_NUM_100G,
+ RTE_ETH_SPEED_NUM_200G
+};
+
static const uint64_t idpf_map_hena_rss[] = {
[IDPF_HASH_NONF_UNICAST_IPV4_UDP] =
RTE_ETH_RSS_NONFRAG_IPV4_UDP,
@@ -110,47 +127,23 @@ idpf_dev_link_update(struct rte_eth_dev *dev,
{
struct idpf_vport *vport = dev->data->dev_private;
struct rte_eth_link new_link;
+ unsigned int i;
memset(&new_link, 0, sizeof(new_link));
- switch (vport->link_speed) {
- case RTE_ETH_SPEED_NUM_10M:
- new_link.link_speed = RTE_ETH_SPEED_NUM_10M;
- break;
- case RTE_ETH_SPEED_NUM_100M:
- new_link.link_speed = RTE_ETH_SPEED_NUM_100M;
- break;
- case RTE_ETH_SPEED_NUM_1G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_1G;
- break;
- case RTE_ETH_SPEED_NUM_10G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_10G;
- break;
- case RTE_ETH_SPEED_NUM_20G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_20G;
- break;
- case RTE_ETH_SPEED_NUM_25G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_25G;
- break;
- case RTE_ETH_SPEED_NUM_40G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_40G;
- break;
- case RTE_ETH_SPEED_NUM_50G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_50G;
- break;
- case RTE_ETH_SPEED_NUM_100G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_100G;
- break;
- case RTE_ETH_SPEED_NUM_200G:
- new_link.link_speed = RTE_ETH_SPEED_NUM_200G;
- break;
- default:
- new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;
+ /* initialize with default value */
+ new_link.link_speed = vport->link_up ? RTE_ETH_SPEED_NUM_UNKNOWN : RTE_ETH_SPEED_NUM_NONE;
+
+ /* update in case a match */
+ for (i = 0; i < RTE_DIM(idpf_supported_speeds); i++) {
+ if (vport->link_speed == idpf_supported_speeds[i]) {
+ new_link.link_speed = vport->link_speed;
+ break;
+ }
}
new_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
- new_link.link_status = vport->link_up ? RTE_ETH_LINK_UP :
- RTE_ETH_LINK_DOWN;
+ new_link.link_status = vport->link_up ? RTE_ETH_LINK_UP : RTE_ETH_LINK_DOWN;
new_link.link_autoneg = (dev->data->dev_conf.link_speeds & RTE_ETH_LINK_SPEED_FIXED) ?
RTE_ETH_LINK_FIXED : RTE_ETH_LINK_AUTONEG;
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-07-03 6:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-26 11:14 [PATCH] net/idpf: refine dev_link_update function Mingxia Liu
2023-06-30 8:27 ` Zhang, Qi Z
2023-06-30 10:46 ` Liu, Mingxia
2023-06-30 18:55 ` [PATCH v2] " Mingxia Liu
2023-07-03 2:21 ` Zhang, Qi Z
2023-07-03 3:17 ` Liu, Mingxia
2023-07-03 11:22 ` [PATCH v3] " Mingxia Liu
2023-07-03 6:51 ` Zhang, Qi Z
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).