From: Steve Yang <stevex.yang@intel.com>
To: dev@dpdk.org
Cc: wenzhuo.lu@intel.com, xiaoyun.li@intel.com,
bernard.iremonger@intel.com, thomas@monjalon.net,
ferruh.yigit@intel.com, andrew.rybchenko@oktetlabs.ru,
stevex.yang@intel.com, qiming.yang@intel.com
Subject: [dpdk-dev] [PATCH v3 2/3] app/testpmd: fix max-pkt-len option invalid
Date: Fri, 22 Jan 2021 09:01:09 +0000 [thread overview]
Message-ID: <20210122090110.50453-3-stevex.yang@intel.com> (raw)
In-Reply-To: <20210122090110.50453-1-stevex.yang@intel.com>
Moved the setting of 'DEV_RX_OFFLOAD_JUMBO_FRAME' from
'cmd_config_max_pkt_len_parsed()' to 'init_config()' caused fail the case
where 'max_rx_pkt_len' is changed from the command line via
"port config all max-pkt-len".
The 'init_config()' function is only called when testpmd is started,
but the DEV_RX_OFFLOAD_JUMBO_FRAME setting needs to be recomputed whenever
'max_rx_pkt_len' changes.
Define the 'update_jumbo_frame_offload()' function for both 'init_config()'
and 'cmd_config_max_pkt_len_parsed()', and detect if 'max_rx_pkt_len'
should be update to 1500 + overhead as default configuration.
Fixes: 761c4d6690 ("app/testpmd: fix max Rx packet length for VLAN packets")
Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
app/test-pmd/cmdline.c | 1 +
app/test-pmd/parameters.c | 1 +
app/test-pmd/testpmd.c | 47 +++++++++++++++++++++++++--------------
app/test-pmd/testpmd.h | 2 ++
4 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 89034c8b72..600e0f8943 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1901,6 +1901,7 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
printf("Unknown parameter\n");
return;
}
+ update_jumbo_frame_offload(port, false);
}
init_port_config();
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index df5eb10d84..1c63156ddd 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -833,6 +833,7 @@ launch_args_parse(int argc, char** argv)
"total-num-mbufs should be > 1024\n");
}
if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
+ default_max_pktlen = false;
n = atoi(optarg);
if (n >= RTE_ETHER_MIN_LEN)
rx_mode.max_rx_pkt_len = (uint32_t) n;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index c256e719ae..a2c9aad960 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -531,6 +531,8 @@ uint16_t gso_max_segment_size = RTE_ETHER_MAX_LEN - RTE_ETHER_CRC_LEN;
/* Holds the registered mbuf dynamic flags names. */
char dynf_names[64][RTE_MBUF_DYN_NAMESIZE];
+bool default_max_pktlen = true;
+
/*
* Helper function to check if socket is already discovered.
* If yes, return positive value. If not, return zero.
@@ -1410,7 +1412,6 @@ init_config(void)
struct rte_gro_param gro_param;
uint32_t gso_types;
uint16_t data_size;
- uint16_t eth_overhead;
bool warning = 0;
int k;
int ret;
@@ -1447,22 +1448,7 @@ init_config(void)
rte_exit(EXIT_FAILURE,
"rte_eth_dev_info_get() failed\n");
- /* Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU */
- if (port->dev_info.max_mtu != UINT16_MAX &&
- port->dev_info.max_rx_pktlen > port->dev_info.max_mtu)
- eth_overhead = port->dev_info.max_rx_pktlen -
- port->dev_info.max_mtu;
- else
- eth_overhead =
- RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
-
- if (port->dev_conf.rxmode.max_rx_pkt_len <=
- (uint32_t)(RTE_ETHER_MTU + eth_overhead))
- port->dev_conf.rxmode.max_rx_pkt_len =
- RTE_ETHER_MTU + eth_overhead;
- else
- port->dev_conf.rxmode.offloads |=
- DEV_RX_OFFLOAD_JUMBO_FRAME;
+ update_jumbo_frame_offload(port, default_max_pktlen);
if (!(port->dev_info.tx_offload_capa &
DEV_TX_OFFLOAD_MBUF_FAST_FREE))
@@ -3358,6 +3344,33 @@ rxtx_port_config(struct rte_port *port)
}
}
+void
+update_jumbo_frame_offload(struct rte_port *port, bool def_max_pktlen)
+{
+ uint16_t eth_overhead;
+
+ /* Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU */
+ if (port->dev_info.max_mtu != UINT16_MAX &&
+ port->dev_info.max_rx_pktlen > port->dev_info.max_mtu)
+ eth_overhead = port->dev_info.max_rx_pktlen -
+ port->dev_info.max_mtu;
+ else
+ eth_overhead = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
+
+ if (port->dev_conf.rxmode.max_rx_pkt_len <=
+ (uint32_t)(RTE_ETHER_MTU + eth_overhead)) {
+ /*
+ * If command line option doesn't include --max-pkt-len,
+ * the default max_rx_pkt_len should be set to 1500 + overhead.
+ */
+ if (def_max_pktlen)
+ port->dev_conf.rxmode.max_rx_pkt_len =
+ RTE_ETHER_MTU + eth_overhead;
+ port->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
+ } else
+ port->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+}
+
void
init_port_config(void)
{
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 5f23162107..aac7b69735 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -304,6 +304,7 @@ extern cmdline_parse_inst_t cmd_show_set_raw_all;
extern uint16_t mempool_flags;
+extern bool default_max_pktlen;
/**
* Forwarding Configuration
*
@@ -1005,6 +1006,7 @@ uint16_t tx_pkt_set_dynf(uint16_t port_id, __rte_unused uint16_t queue,
__rte_unused void *user_param);
void add_tx_dynf_callback(portid_t portid);
void remove_tx_dynf_callback(portid_t portid);
+void update_jumbo_frame_offload(struct rte_port *port, bool def_max_pktlen);
/*
* Work-around of a compilation error with ICC on invocations of the
--
2.17.1
next prev parent reply other threads:[~2021-01-22 9:04 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-22 8:13 [dpdk-dev] [PATCH v1] app/testpmd: fix dynamic config error for max-pkt-len Steve Yang
2020-12-23 2:27 ` Li, Xiaoyun
2020-12-23 8:51 ` [dpdk-dev] [PATCH v2] app/testpmd: fix dynamic config error Steve Yang
2020-12-23 9:00 ` Li, Xiaoyun
2021-01-13 8:13 ` Chen, BoX C
2021-01-19 15:44 ` Ferruh Yigit
2021-01-22 9:01 ` [dpdk-dev] [PATCH v3 0/3] fix 'max-pkt-len' errors Steve Yang
2021-01-22 9:01 ` [dpdk-dev] [PATCH v3 1/3] ethdev: fix MTU doesn't update when jumbo frame disabled Steve Yang
2021-01-25 7:12 ` Huisong Li
[not found] ` <DM6PR11MB43628A600BAAEC75FFF1343BF9BD9@DM6PR11MB4362.namprd11.prod.outlook.com>
2021-01-25 12:38 ` Ferruh Yigit
2021-01-22 9:01 ` Steve Yang [this message]
2021-01-22 9:01 ` [dpdk-dev] [PATCH v3 3/3] app/testpmd: fix dynamic config error Steve Yang
2021-01-22 17:04 ` Ferruh Yigit
2021-01-22 17:15 ` Ferruh Yigit
2021-01-25 8:32 ` [dpdk-dev] [PATCH v4 0/2] fix 'max-pkt-len' errors Steve Yang
2021-01-25 8:32 ` [dpdk-dev] [PATCH v4 1/2] ethdev: fix MTU doesn't update when jumbo frame disabled Steve Yang
2021-01-25 12:41 ` Ferruh Yigit
2021-01-25 8:32 ` [dpdk-dev] [PATCH v4 2/2] app/testpmd: fix max-pkt-len option invalid Steve Yang
2021-01-25 14:45 ` Ferruh Yigit
2021-01-25 15:46 ` Lance Richardson
2021-01-25 17:57 ` Ferruh Yigit
2021-01-25 18:15 ` [dpdk-dev] [PATCH v5] app/testpmd: fix setting maximum packet length Ferruh Yigit
2021-01-25 19:41 ` Lance Richardson
2021-01-26 0:44 ` Ferruh Yigit
2021-01-26 3:22 ` Lance Richardson
2021-01-26 3:45 ` Lance Richardson
2021-01-26 7:54 ` Li, Xiaoyun
2021-01-26 11:01 ` Ferruh Yigit
2021-01-28 21:36 ` Lance Richardson
2021-01-28 22:12 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2021-01-26 9:02 ` [dpdk-dev] " Wisam Monther
2021-01-27 3:04 ` Li, Xiaoyun
2021-01-28 1:57 ` Chen, BoX C
2021-01-28 9:18 ` Wisam Monther
2021-01-28 9:26 ` Ferruh Yigit
2021-01-28 11:08 ` Wisam Monther
2021-01-28 12:07 ` [dpdk-dev] [PATCH v6] " Ferruh Yigit
2021-01-29 9:34 ` Ferruh Yigit
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=20210122090110.50453-3-stevex.yang@intel.com \
--to=stevex.yang@intel.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=bernard.iremonger@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=qiming.yang@intel.com \
--cc=thomas@monjalon.net \
--cc=wenzhuo.lu@intel.com \
--cc=xiaoyun.li@intel.com \
/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).