* [PATCH 1/2] examples/l3fwd: support specify link speed
@ 2025-08-27 1:31 Dengdui Huang
2025-08-27 1:31 ` [PATCH 2/2] examples/l3fwd-power: " Dengdui Huang
2025-08-27 11:01 ` [PATCH 1/2] examples/l3fwd: " fengchengwen
0 siblings, 2 replies; 4+ messages in thread
From: Dengdui Huang @ 2025-08-27 1:31 UTC (permalink / raw)
To: dev
Cc: stephen, anatoly.burakov, david.hunt, sivaprasad.tummala,
huisong, fengchengwen, liuyonglong
Currently, l3fwd starts in auto-negotiation mode, but it may fail to
link up when auto-negotiation is not supported. Therefore, it is
necessary to support starting with a specified speed for port.
Additionally, this patch does not support changing the duplex mode.
So speeds like 10M, 100M are not configurable using this method.
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
---
examples/l3fwd/main.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index ae3b4f6439..86235b39d7 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -423,6 +423,7 @@ print_usage(const char *prgname)
" Accepted: em (Exact Match), lpm (Longest Prefix Match), fib (Forwarding Information Base),\n"
" acl (Access Control List)\n"
" --config (port,queue,lcore): Rx queue configuration\n"
+ " --eth-link-speed: force link speed\n"
" --rx-queue-size NPKTS: Rx queue size in decimal\n"
" Default: %d\n"
" --tx-queue-size NPKTS: Tx queue size in decimal\n"
@@ -747,6 +748,7 @@ static const char short_options[] =
;
#define CMD_LINE_OPT_CONFIG "config"
+#define CMD_LINK_OPT_ETH_LINK_SPEED "eth-link-speed"
#define CMD_LINE_OPT_RX_QUEUE_SIZE "rx-queue-size"
#define CMD_LINE_OPT_TX_QUEUE_SIZE "tx-queue-size"
#define CMD_LINE_OPT_ETH_DEST "eth-dest"
@@ -778,6 +780,7 @@ enum {
* conflict with short options */
CMD_LINE_OPT_MIN_NUM = 256,
CMD_LINE_OPT_CONFIG_NUM,
+ CMD_LINK_OPT_ETH_LINK_SPEED_NUM,
CMD_LINE_OPT_RX_QUEUE_SIZE_NUM,
CMD_LINE_OPT_TX_QUEUE_SIZE_NUM,
CMD_LINE_OPT_ETH_DEST_NUM,
@@ -805,6 +808,7 @@ enum {
static const struct option lgopts[] = {
{CMD_LINE_OPT_CONFIG, 1, 0, CMD_LINE_OPT_CONFIG_NUM},
+ {CMD_LINK_OPT_ETH_LINK_SPEED, 1, 0, CMD_LINK_OPT_ETH_LINK_SPEED_NUM},
{CMD_LINE_OPT_RX_QUEUE_SIZE, 1, 0, CMD_LINE_OPT_RX_QUEUE_SIZE_NUM},
{CMD_LINE_OPT_TX_QUEUE_SIZE, 1, 0, CMD_LINE_OPT_TX_QUEUE_SIZE_NUM},
{CMD_LINE_OPT_ETH_DEST, 1, 0, CMD_LINE_OPT_ETH_DEST_NUM},
@@ -860,6 +864,7 @@ parse_args(int argc, char **argv)
uint8_t eth_rx_q = 0;
struct l3fwd_event_resources *evt_rsrc = l3fwd_get_eventdev_rsrc();
#endif
+ int speed_num;
argvopt = argv;
@@ -908,7 +913,17 @@ parse_args(int argc, char **argv)
}
lcore_params = 1;
break;
-
+ case CMD_LINK_OPT_ETH_LINK_SPEED_NUM:
+ speed_num = atoi(optarg);
+ if ((speed_num == RTE_ETH_SPEED_NUM_10M) ||
+ (speed_num == RTE_ETH_SPEED_NUM_100M)) {
+ fprintf(stderr, "Unsupported fixed speed\n");
+ print_usage(prgname);
+ return -1;
+ }
+ if (speed_num >= 0 && rte_eth_speed_bitflag(speed_num, 0) > 0)
+ port_conf.link_speeds = rte_eth_speed_bitflag(speed_num, 0);
+ break;
case CMD_LINE_OPT_RX_QUEUE_SIZE_NUM:
parse_queue_size(optarg, &nb_rxd, 1);
break;
--
2.33.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] examples/l3fwd-power: support specify link speed
2025-08-27 1:31 [PATCH 1/2] examples/l3fwd: support specify link speed Dengdui Huang
@ 2025-08-27 1:31 ` Dengdui Huang
2025-08-27 11:02 ` fengchengwen
2025-08-27 11:01 ` [PATCH 1/2] examples/l3fwd: " fengchengwen
1 sibling, 1 reply; 4+ messages in thread
From: Dengdui Huang @ 2025-08-27 1:31 UTC (permalink / raw)
To: dev
Cc: stephen, anatoly.burakov, david.hunt, sivaprasad.tummala,
huisong, fengchengwen, liuyonglong
Currently, l3fwd-power starts in auto-negotiation mode, but it may fail
to link up when auto-negotiation is not supported. Therefore, it is
necessary to support starting with a specified speed for port.
Additionally, this patch does not support changing the duplex mode.
So speeds like 10M, 100M are not configurable using this method.
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
---
examples/l3fwd-power/main.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index e27b8531b5..ef2a086572 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -1501,6 +1501,7 @@ print_usage(const char *prgname)
" -U: set min/max frequency for uncore to maximum value\n"
" -i (frequency index): set min/max frequency for uncore to specified frequency index\n"
" --config (port,queue,lcore): rx queues configuration\n"
+ " --eth-link-speed: force link speed\n"
" --cpu-resume-latency LATENCY: set CPU resume latency to control C-state selection,"
" 0 : just allow to enter C0-state\n"
" --high-perf-cores CORELIST: list of high performance cores\n"
@@ -1742,12 +1743,14 @@ parse_pmd_mgmt_config(const char *name)
#define CMD_LINE_OPT_SCALE_FREQ_MIN "scale-freq-min"
#define CMD_LINE_OPT_SCALE_FREQ_MAX "scale-freq-max"
#define CMD_LINE_OPT_CPU_RESUME_LATENCY "cpu-resume-latency"
+#define CMD_LINK_OPT_ETH_LINK_SPEED "eth-link-speed"
/* Parse the argument given in the command line of the application */
static int
parse_args(int argc, char **argv)
{
int opt, ret;
+ int speed_num;
char **argvopt;
int option_index;
char *prgname = argv[0];
@@ -1767,6 +1770,7 @@ parse_args(int argc, char **argv)
{CMD_LINE_OPT_PAUSE_DURATION, 1, 0, 0},
{CMD_LINE_OPT_SCALE_FREQ_MIN, 1, 0, 0},
{CMD_LINE_OPT_SCALE_FREQ_MAX, 1, 0, 0},
+ {CMD_LINK_OPT_ETH_LINK_SPEED, 1, 0, 0},
{NULL, 0, 0, 0}
};
@@ -1951,6 +1955,20 @@ parse_args(int argc, char **argv)
printf("PM QoS configured\n");
}
+ if (!strncmp(lgopts[option_index].name,
+ CMD_LINK_OPT_ETH_LINK_SPEED,
+ sizeof(CMD_LINK_OPT_ETH_LINK_SPEED))) {
+ speed_num = atoi(optarg);
+ if ((speed_num == RTE_ETH_SPEED_NUM_10M) ||
+ (speed_num == RTE_ETH_SPEED_NUM_100M)) {
+ fprintf(stderr, "Unsupported fixed speed\n");
+ print_usage(prgname);
+ return -1;
+ }
+ if (speed_num >= 0 && rte_eth_speed_bitflag(speed_num, 0) > 0)
+ port_conf.link_speeds = rte_eth_speed_bitflag(speed_num, 0);
+ }
+
break;
default:
--
2.33.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] examples/l3fwd: support specify link speed
2025-08-27 1:31 [PATCH 1/2] examples/l3fwd: support specify link speed Dengdui Huang
2025-08-27 1:31 ` [PATCH 2/2] examples/l3fwd-power: " Dengdui Huang
@ 2025-08-27 11:01 ` fengchengwen
1 sibling, 0 replies; 4+ messages in thread
From: fengchengwen @ 2025-08-27 11:01 UTC (permalink / raw)
To: Dengdui Huang, dev
Cc: stephen, anatoly.burakov, david.hunt, sivaprasad.tummala,
huisong, liuyonglong
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
On 8/27/2025 9:31 AM, Dengdui Huang wrote:
> Currently, l3fwd starts in auto-negotiation mode, but it may fail to
> link up when auto-negotiation is not supported. Therefore, it is
> necessary to support starting with a specified speed for port.
>
> Additionally, this patch does not support changing the duplex mode.
> So speeds like 10M, 100M are not configurable using this method.
>
> Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] examples/l3fwd-power: support specify link speed
2025-08-27 1:31 ` [PATCH 2/2] examples/l3fwd-power: " Dengdui Huang
@ 2025-08-27 11:02 ` fengchengwen
0 siblings, 0 replies; 4+ messages in thread
From: fengchengwen @ 2025-08-27 11:02 UTC (permalink / raw)
To: Dengdui Huang, dev
Cc: stephen, anatoly.burakov, david.hunt, sivaprasad.tummala,
huisong, liuyonglong
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
On 8/27/2025 9:31 AM, Dengdui Huang wrote:
> Currently, l3fwd-power starts in auto-negotiation mode, but it may fail
> to link up when auto-negotiation is not supported. Therefore, it is
> necessary to support starting with a specified speed for port.
>
> Additionally, this patch does not support changing the duplex mode.
> So speeds like 10M, 100M are not configurable using this method.
>
> Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-27 11:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-27 1:31 [PATCH 1/2] examples/l3fwd: support specify link speed Dengdui Huang
2025-08-27 1:31 ` [PATCH 2/2] examples/l3fwd-power: " Dengdui Huang
2025-08-27 11:02 ` fengchengwen
2025-08-27 11:01 ` [PATCH 1/2] examples/l3fwd: " fengchengwen
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).