From: Dengdui Huang <huangdengdui@huawei.com>
To: <dev@dpdk.org>
Cc: <stephen@networkplumber.org>, <anatoly.burakov@intel.com>,
<david.hunt@intel.com>, <sivaprasad.tummala@amd.com>,
<huisong@huawei.com>, <fengchengwen@huawei.com>,
<liuyonglong@huawei.com>
Subject: [PATCH 2/2] examples/l3fwd-power: support specify link speed
Date: Wed, 27 Aug 2025 09:31:06 +0800 [thread overview]
Message-ID: <20250827013106.2453922-2-huangdengdui@huawei.com> (raw)
In-Reply-To: <20250827013106.2453922-1-huangdengdui@huawei.com>
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
next prev parent reply other threads:[~2025-08-27 1:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-27 1:31 [PATCH 1/2] examples/l3fwd: " Dengdui Huang
2025-08-27 1:31 ` Dengdui Huang [this message]
2025-08-27 11:02 ` [PATCH 2/2] examples/l3fwd-power: " fengchengwen
2025-08-27 11:01 ` [PATCH 1/2] examples/l3fwd: " fengchengwen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250827013106.2453922-2-huangdengdui@huawei.com \
--to=huangdengdui@huawei.com \
--cc=anatoly.burakov@intel.com \
--cc=david.hunt@intel.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=huisong@huawei.com \
--cc=liuyonglong@huawei.com \
--cc=sivaprasad.tummala@amd.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).