diff mbox series

[v2,3/3] app/testpmd: use API to set max LRO packet size

Message ID b766bb50eef7ea2acc3e3e07b4d4a8cdcd4679c3.1573039466.git.dekelp@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series support API to set max LRO packet size | expand

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/travis-robot success Travis build: passed
ci/checkpatch success coding style OK

Commit Message

Dekel Peled Nov. 6, 2019, 11:34 a.m. UTC
This patch implements use of the API for LRO aggregated packet
max size.
It adds command-line and runtime commands to configure this value,
and adds option to show the supported value.
Documentation is updated accordingly.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
---
 app/test-pmd/cmdline.c                      | 73 +++++++++++++++++++++++++++++
 app/test-pmd/config.c                       |  2 +
 app/test-pmd/parameters.c                   |  5 ++
 app/test-pmd/testpmd.c                      |  1 +
 doc/guides/testpmd_app_ug/run_app.rst       |  5 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  9 ++++
 6 files changed, 95 insertions(+)

Comments

Iremonger, Bernard Nov. 6, 2019, 12:35 p.m. UTC | #1
Hi Dekel,

> -----Original Message-----
> From: Dekel Peled <dekelp@mellanox.com>
> Sent: Wednesday, November 6, 2019 11:35 AM
> To: Mcnamara, John <john.mcnamara@intel.com>; Kovacevic, Marko
> <marko.kovacevic@intel.com>; nhorman@tuxdriver.com;
> ajit.khaparde@broadcom.com; somnath.kotur@broadcom.com; Burakov,
> Anatoly <anatoly.burakov@intel.com>; xuanziyang2@huawei.com;
> cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; matan@mellanox.com;
> shahafs@mellanox.com; viacheslavo@mellanox.com; rmody@marvell.com;
> shshaikh@marvell.com; maxime.coquelin@redhat.com; Bie, Tiwei
> <tiwei.bie@intel.com>; Wang, Zhihong <zhihong.wang@intel.com>;
> yongwang@vmware.com; thomas@monjalon.net; Yigit, Ferruh
> <ferruh.yigit@intel.com>; arybchenko@solarflare.com; Wu, Jingjing
> <jingjing.wu@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>
> Cc: dev@dpdk.org
> Subject: [PATCH v2 3/3] app/testpmd: use API to set max LRO packet size
> 
> This patch implements use of the API for LRO aggregated packet max size.
> It adds command-line and runtime commands to configure this value, and
> adds option to show the supported value.
> Documentation is updated accordingly.
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> ---
>  app/test-pmd/cmdline.c                      | 73
> +++++++++++++++++++++++++++++
>  app/test-pmd/config.c                       |  2 +
>  app/test-pmd/parameters.c                   |  5 ++
>  app/test-pmd/testpmd.c                      |  1 +
>  doc/guides/testpmd_app_ug/run_app.rst       |  5 ++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  9 ++++
>  6 files changed, 95 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> 4478069..edfa60f 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -2037,6 +2037,78 @@ struct cmd_config_max_pkt_len_result {
>  	},
>  };
> 
> +/* *** config max LRO aggregated packet size *** */ struct
> +cmd_config_max_lro_pkt_size_result {
> +	cmdline_fixed_string_t port;
> +	cmdline_fixed_string_t keyword;
> +	cmdline_fixed_string_t all;
> +	cmdline_fixed_string_t name;
> +	uint32_t value;
> +};
> +
> +static void
> +cmd_config_max_lro_pkt_size_parsed(void *parsed_result,
> +				__attribute__((unused)) struct cmdline *cl,
> +				__attribute__((unused)) void *data) {
> +	struct cmd_config_max_lro_pkt_size_result *res = parsed_result;
> +	portid_t pid;
> +
> +	if (!all_ports_stopped()) {
> +		printf("Please stop all ports first\n");
> +		return;
> +	}
> +
> +	RTE_ETH_FOREACH_DEV(pid) {
> +		struct rte_port *port = &ports[pid];
> +
> +		if (!strcmp(res->name, "max-lro-pkt-size")) {
> +			if (res->value ==
> +					port-
> >dev_conf.rxmode.max_lro_pkt_size)
> +				return;
> +

Should there be a check on the input value, max is RTE_ETHER_MAX_LEN ?


> +			port->dev_conf.rxmode.max_lro_pkt_size = res-
> >value;
> +		} else {
> +			printf("Unknown parameter\n");
> +			return;
> +		}
> +	}
> +
> +	init_port_config();
> +
> +	cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); }
> +
> +cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_port =
> +	TOKEN_STRING_INITIALIZER(struct
> cmd_config_max_lro_pkt_size_result,
> +				 port, "port");
> +cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_keyword =
> +	TOKEN_STRING_INITIALIZER(struct
> cmd_config_max_lro_pkt_size_result,
> +				 keyword, "config");
> +cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_all =
> +	TOKEN_STRING_INITIALIZER(struct
> cmd_config_max_lro_pkt_size_result,
> +				 all, "all");
> +cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_name =
> +	TOKEN_STRING_INITIALIZER(struct
> cmd_config_max_lro_pkt_size_result,
> +				 name, "max-lro-pkt-size");
> +cmdline_parse_token_num_t cmd_config_max_lro_pkt_size_value =
> +	TOKEN_NUM_INITIALIZER(struct
> cmd_config_max_lro_pkt_size_result,
> +			      value, UINT32);
> +
> +cmdline_parse_inst_t cmd_config_max_lro_pkt_size = {
> +	.f = cmd_config_max_lro_pkt_size_parsed,
> +	.data = NULL,
> +	.help_str = "port config all max-lro-pkt-size <value>",
> +	.tokens = {
> +		(void *)&cmd_config_max_lro_pkt_size_port,
> +		(void *)&cmd_config_max_lro_pkt_size_keyword,
> +		(void *)&cmd_config_max_lro_pkt_size_all,
> +		(void *)&cmd_config_max_lro_pkt_size_name,
> +		(void *)&cmd_config_max_lro_pkt_size_value,
> +		NULL,
> +	},
> +};
> +
>  /* *** configure port MTU *** */
>  struct cmd_config_mtu_result {
>  	cmdline_fixed_string_t port;
> @@ -19024,6 +19096,7 @@ struct
> cmd_show_port_supported_ptypes_result {
>  	(cmdline_parse_inst_t *)&cmd_config_rx_tx,
>  	(cmdline_parse_inst_t *)&cmd_config_mtu,
>  	(cmdline_parse_inst_t *)&cmd_config_max_pkt_len,
> +	(cmdline_parse_inst_t *)&cmd_config_max_lro_pkt_size,
>  	(cmdline_parse_inst_t *)&cmd_config_rx_mode_flag,
>  	(cmdline_parse_inst_t *)&cmd_config_rss,
>  	(cmdline_parse_inst_t *)&cmd_config_rxtx_ring_size, diff --git
> a/app/test-pmd/config.c b/app/test-pmd/config.c index efe2812..50e6ac0
> 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -629,6 +629,8 @@ static int bus_match_all(const struct rte_bus *bus,
> const void *data)
>  	printf("Minimum size of RX buffer: %u\n",
> dev_info.min_rx_bufsize);
>  	printf("Maximum configurable length of RX packet: %u\n",
>  		dev_info.max_rx_pktlen);
> +	printf("Maximum configurable size of LRO aggregated packet: %u\n",
> +		dev_info.max_lro_pkt_size);
>  	if (dev_info.max_vfs)
>  		printf("Maximum number of VFs: %u\n", dev_info.max_vfs);
>  	if (dev_info.max_vmdq_pools)
> diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index
> 9ea87c1..3e371e2 100644
> --- a/app/test-pmd/parameters.c
> +++ b/app/test-pmd/parameters.c
> @@ -592,6 +592,7 @@
>  		{ "mbuf-size",			1, 0, 0 },
>  		{ "total-num-mbufs",		1, 0, 0 },
>  		{ "max-pkt-len",		1, 0, 0 },
> +		{ "max-lro-pkt-size",		1, 0, 0 },

The max-lro-pkt-size option should be documented in the usage() function around line 110 in parameters.c

>  		{ "pkt-filter-mode",            1, 0, 0 },
>  		{ "pkt-filter-report-hash",     1, 0, 0 },
>  		{ "pkt-filter-size",            1, 0, 0 },
> @@ -888,6 +889,10 @@
>  						 "Invalid max-pkt-len=%d -
> should be > %d\n",
>  						 n, RTE_ETHER_MIN_LEN);
>  			}
> +			if (!strcmp(lgopts[opt_idx].name, "max-lro-pkt-
> size")) {
> +				n = atoi(optarg);

Should there be a check on the value input, max value is RTE_ETHER_MAX_LEN?

> +				rx_mode.max_lro_pkt_size = (uint32_t) n;
> +			}
>  			if (!strcmp(lgopts[opt_idx].name, "pkt-filter-mode"))
> {
>  				if (!strcmp(optarg, "signature"))
>  					fdir_conf.mode =
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> 38acbc5..d4f67ec 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -419,6 +419,7 @@ struct fwd_engine * fwd_engines[] = {  struct
> rte_eth_rxmode rx_mode = {
>  	.max_rx_pkt_len = RTE_ETHER_MAX_LEN,
>  		/**< Default maximum frame length. */
> +	.max_lro_pkt_size = RTE_ETHER_MAX_LEN,
>  };
> 
>  struct rte_eth_txmode tx_mode = {
> diff --git a/doc/guides/testpmd_app_ug/run_app.rst
> b/doc/guides/testpmd_app_ug/run_app.rst
> index ef677ba..bc17f3f 100644
> --- a/doc/guides/testpmd_app_ug/run_app.rst
> +++ b/doc/guides/testpmd_app_ug/run_app.rst
> @@ -112,6 +112,11 @@ The command line options are:
> 
>      Set the maximum packet size to N bytes, where N >= 64. The default value
> is 1518.
> 
> +*   ``--max-lro-pkt-size=N``
> +
> +    Set the maximum LRO aggregated packet size to N bytes, where N >= 64.
> +    The default value is 1518.

Should a max value be specified ?

> +
>  *   ``--eth-peers-configfile=name``
> 
>      Use a configuration file containing the Ethernet addresses of the peer
> ports.
> diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> index c68a742..0267295 100644
> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -2139,6 +2139,15 @@ Set the maximum packet length::
> 
>  This is equivalent to the ``--max-pkt-len`` command-line option.
> 
> +port config - max-lro-pkt-size
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +Set the maximum LRO aggregated packet size::
> +
> +   testpmd> port config all max-lro-pkt-size (value)
> +
> +This is equivalent to the ``--max-lro-pkt-size`` command-line option.
> +
>  port config - Drop Packets
>  ~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> --
> 1.8.3.1

Regards,

Bernard.
Dekel Peled Nov. 6, 2019, 1:14 p.m. UTC | #2
Thanks, PSB.

> -----Original Message-----
> From: Iremonger, Bernard <bernard.iremonger@intel.com>
> Sent: Wednesday, November 6, 2019 2:36 PM
> To: Dekel Peled <dekelp@mellanox.com>; Mcnamara, John
> <john.mcnamara@intel.com>; Kovacevic, Marko
> <marko.kovacevic@intel.com>; nhorman@tuxdriver.com;
> ajit.khaparde@broadcom.com; somnath.kotur@broadcom.com; Burakov,
> Anatoly <anatoly.burakov@intel.com>; xuanziyang2@huawei.com;
> cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; Matan Azrad <matan@mellanox.com>;
> Shahaf Shuler <shahafs@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; rmody@marvell.com;
> shshaikh@marvell.com; maxime.coquelin@redhat.com; Bie, Tiwei
> <tiwei.bie@intel.com>; Wang, Zhihong <zhihong.wang@intel.com>;
> yongwang@vmware.com; Thomas Monjalon <thomas@monjalon.net>; Yigit,
> Ferruh <ferruh.yigit@intel.com>; arybchenko@solarflare.com; Wu, Jingjing
> <jingjing.wu@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH v2 3/3] app/testpmd: use API to set max LRO packet size
> 
> Hi Dekel,
> 
> > -----Original Message-----
> > From: Dekel Peled <dekelp@mellanox.com>
> > Sent: Wednesday, November 6, 2019 11:35 AM
> > To: Mcnamara, John <john.mcnamara@intel.com>; Kovacevic, Marko
> > <marko.kovacevic@intel.com>; nhorman@tuxdriver.com;
> > ajit.khaparde@broadcom.com; somnath.kotur@broadcom.com; Burakov,
> > Anatoly <anatoly.burakov@intel.com>; xuanziyang2@huawei.com;
> > cloud.wangxiaoyun@huawei.com; zhouguoyang@huawei.com; Lu,
> Wenzhuo
> > <wenzhuo.lu@intel.com>; Ananyev, Konstantin
> > <konstantin.ananyev@intel.com>; matan@mellanox.com;
> > shahafs@mellanox.com; viacheslavo@mellanox.com;
> rmody@marvell.com;
> > shshaikh@marvell.com; maxime.coquelin@redhat.com; Bie, Tiwei
> > <tiwei.bie@intel.com>; Wang, Zhihong <zhihong.wang@intel.com>;
> > yongwang@vmware.com; thomas@monjalon.net; Yigit, Ferruh
> > <ferruh.yigit@intel.com>; arybchenko@solarflare.com; Wu, Jingjing
> > <jingjing.wu@intel.com>; Iremonger, Bernard
> > <bernard.iremonger@intel.com>
> > Cc: dev@dpdk.org
> > Subject: [PATCH v2 3/3] app/testpmd: use API to set max LRO packet
> > size
> >
> > This patch implements use of the API for LRO aggregated packet max size.
> > It adds command-line and runtime commands to configure this value, and
> > adds option to show the supported value.
> > Documentation is updated accordingly.
> >
> > Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> > ---
> >  app/test-pmd/cmdline.c                      | 73
> > +++++++++++++++++++++++++++++
> >  app/test-pmd/config.c                       |  2 +
> >  app/test-pmd/parameters.c                   |  5 ++
> >  app/test-pmd/testpmd.c                      |  1 +
> >  doc/guides/testpmd_app_ug/run_app.rst       |  5 ++
> >  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  9 ++++
> >  6 files changed, 95 insertions(+)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > 4478069..edfa60f 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -2037,6 +2037,78 @@ struct cmd_config_max_pkt_len_result {
> >  	},
> >  };
> >
> > +/* *** config max LRO aggregated packet size *** */ struct
> > +cmd_config_max_lro_pkt_size_result {
> > +	cmdline_fixed_string_t port;
> > +	cmdline_fixed_string_t keyword;
> > +	cmdline_fixed_string_t all;
> > +	cmdline_fixed_string_t name;
> > +	uint32_t value;
> > +};
> > +
> > +static void
> > +cmd_config_max_lro_pkt_size_parsed(void *parsed_result,
> > +				__attribute__((unused)) struct cmdline *cl,
> > +				__attribute__((unused)) void *data) {
> > +	struct cmd_config_max_lro_pkt_size_result *res = parsed_result;
> > +	portid_t pid;
> > +
> > +	if (!all_ports_stopped()) {
> > +		printf("Please stop all ports first\n");
> > +		return;
> > +	}
> > +
> > +	RTE_ETH_FOREACH_DEV(pid) {
> > +		struct rte_port *port = &ports[pid];
> > +
> > +		if (!strcmp(res->name, "max-lro-pkt-size")) {
> > +			if (res->value ==
> > +					port-
> > >dev_conf.rxmode.max_lro_pkt_size)
> > +				return;
> > +
> 
> Should there be a check on the input value, max is RTE_ETHER_MAX_LEN ?
> 

Max is device specific, can't check it here.

> 
> > +			port->dev_conf.rxmode.max_lro_pkt_size = res-
> > >value;
> > +		} else {
> > +			printf("Unknown parameter\n");
> > +			return;
> > +		}
> > +	}
> > +
> > +	init_port_config();
> > +
> > +	cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); }
> > +
> > +cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_port =
> > +	TOKEN_STRING_INITIALIZER(struct
> > cmd_config_max_lro_pkt_size_result,
> > +				 port, "port");
> > +cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_keyword
> =
> > +	TOKEN_STRING_INITIALIZER(struct
> > cmd_config_max_lro_pkt_size_result,
> > +				 keyword, "config");
> > +cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_all =
> > +	TOKEN_STRING_INITIALIZER(struct
> > cmd_config_max_lro_pkt_size_result,
> > +				 all, "all");
> > +cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_name =
> > +	TOKEN_STRING_INITIALIZER(struct
> > cmd_config_max_lro_pkt_size_result,
> > +				 name, "max-lro-pkt-size");
> > +cmdline_parse_token_num_t cmd_config_max_lro_pkt_size_value =
> > +	TOKEN_NUM_INITIALIZER(struct
> > cmd_config_max_lro_pkt_size_result,
> > +			      value, UINT32);
> > +
> > +cmdline_parse_inst_t cmd_config_max_lro_pkt_size = {
> > +	.f = cmd_config_max_lro_pkt_size_parsed,
> > +	.data = NULL,
> > +	.help_str = "port config all max-lro-pkt-size <value>",
> > +	.tokens = {
> > +		(void *)&cmd_config_max_lro_pkt_size_port,
> > +		(void *)&cmd_config_max_lro_pkt_size_keyword,
> > +		(void *)&cmd_config_max_lro_pkt_size_all,
> > +		(void *)&cmd_config_max_lro_pkt_size_name,
> > +		(void *)&cmd_config_max_lro_pkt_size_value,
> > +		NULL,
> > +	},
> > +};
> > +
> >  /* *** configure port MTU *** */
> >  struct cmd_config_mtu_result {
> >  	cmdline_fixed_string_t port;
> > @@ -19024,6 +19096,7 @@ struct
> > cmd_show_port_supported_ptypes_result {
> >  	(cmdline_parse_inst_t *)&cmd_config_rx_tx,
> >  	(cmdline_parse_inst_t *)&cmd_config_mtu,
> >  	(cmdline_parse_inst_t *)&cmd_config_max_pkt_len,
> > +	(cmdline_parse_inst_t *)&cmd_config_max_lro_pkt_size,
> >  	(cmdline_parse_inst_t *)&cmd_config_rx_mode_flag,
> >  	(cmdline_parse_inst_t *)&cmd_config_rss,
> >  	(cmdline_parse_inst_t *)&cmd_config_rxtx_ring_size, diff --git
> > a/app/test-pmd/config.c b/app/test-pmd/config.c index efe2812..50e6ac0
> > 100644
> > --- a/app/test-pmd/config.c
> > +++ b/app/test-pmd/config.c
> > @@ -629,6 +629,8 @@ static int bus_match_all(const struct rte_bus
> > *bus, const void *data)
> >  	printf("Minimum size of RX buffer: %u\n",
> dev_info.min_rx_bufsize);
> >  	printf("Maximum configurable length of RX packet: %u\n",
> >  		dev_info.max_rx_pktlen);
> > +	printf("Maximum configurable size of LRO aggregated packet: %u\n",
> > +		dev_info.max_lro_pkt_size);
> >  	if (dev_info.max_vfs)
> >  		printf("Maximum number of VFs: %u\n", dev_info.max_vfs);
> >  	if (dev_info.max_vmdq_pools)
> > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
> > index
> > 9ea87c1..3e371e2 100644
> > --- a/app/test-pmd/parameters.c
> > +++ b/app/test-pmd/parameters.c
> > @@ -592,6 +592,7 @@
> >  		{ "mbuf-size",			1, 0, 0 },
> >  		{ "total-num-mbufs",		1, 0, 0 },
> >  		{ "max-pkt-len",		1, 0, 0 },
> > +		{ "max-lro-pkt-size",		1, 0, 0 },
> 
> The max-lro-pkt-size option should be documented in the usage() function
> around line 110 in parameters.c
> 

I'll add in in v3.

> >  		{ "pkt-filter-mode",            1, 0, 0 },
> >  		{ "pkt-filter-report-hash",     1, 0, 0 },
> >  		{ "pkt-filter-size",            1, 0, 0 },
> > @@ -888,6 +889,10 @@
> >  						 "Invalid max-pkt-len=%d -
> > should be > %d\n",
> >  						 n, RTE_ETHER_MIN_LEN);
> >  			}
> > +			if (!strcmp(lgopts[opt_idx].name, "max-lro-pkt-
> > size")) {
> > +				n = atoi(optarg);
> 
> Should there be a check on the value input, max value is
> RTE_ETHER_MAX_LEN?

Max is device specific, can't check it here.

> 
> > +				rx_mode.max_lro_pkt_size = (uint32_t) n;
> > +			}
> >  			if (!strcmp(lgopts[opt_idx].name, "pkt-filter-mode"))
> {
> >  				if (!strcmp(optarg, "signature"))
> >  					fdir_conf.mode =
> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> > 38acbc5..d4f67ec 100644
> > --- a/app/test-pmd/testpmd.c
> > +++ b/app/test-pmd/testpmd.c
> > @@ -419,6 +419,7 @@ struct fwd_engine * fwd_engines[] = {  struct
> > rte_eth_rxmode rx_mode = {
> >  	.max_rx_pkt_len = RTE_ETHER_MAX_LEN,
> >  		/**< Default maximum frame length. */
> > +	.max_lro_pkt_size = RTE_ETHER_MAX_LEN,
> >  };
> >
> >  struct rte_eth_txmode tx_mode = {
> > diff --git a/doc/guides/testpmd_app_ug/run_app.rst
> > b/doc/guides/testpmd_app_ug/run_app.rst
> > index ef677ba..bc17f3f 100644
> > --- a/doc/guides/testpmd_app_ug/run_app.rst
> > +++ b/doc/guides/testpmd_app_ug/run_app.rst
> > @@ -112,6 +112,11 @@ The command line options are:
> >
> >      Set the maximum packet size to N bytes, where N >= 64. The
> > default value is 1518.
> >
> > +*   ``--max-lro-pkt-size=N``
> > +
> > +    Set the maximum LRO aggregated packet size to N bytes, where N >=
> 64.
> > +    The default value is 1518.
> 
> Should a max value be specified ?

Max is device specific, can't specify it here.

> 
> > +
> >  *   ``--eth-peers-configfile=name``
> >
> >      Use a configuration file containing the Ethernet addresses of the
> > peer ports.
> > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > index c68a742..0267295 100644
> > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > @@ -2139,6 +2139,15 @@ Set the maximum packet length::
> >
> >  This is equivalent to the ``--max-pkt-len`` command-line option.
> >
> > +port config - max-lro-pkt-size
> > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > +
> > +Set the maximum LRO aggregated packet size::
> > +
> > +   testpmd> port config all max-lro-pkt-size (value)
> > +
> > +This is equivalent to the ``--max-lro-pkt-size`` command-line option.
> > +
> >  port config - Drop Packets
> >  ~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > --
> > 1.8.3.1
> 
> Regards,
> 
> Bernard.
diff mbox series

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 4478069..edfa60f 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -2037,6 +2037,78 @@  struct cmd_config_max_pkt_len_result {
 	},
 };
 
+/* *** config max LRO aggregated packet size *** */
+struct cmd_config_max_lro_pkt_size_result {
+	cmdline_fixed_string_t port;
+	cmdline_fixed_string_t keyword;
+	cmdline_fixed_string_t all;
+	cmdline_fixed_string_t name;
+	uint32_t value;
+};
+
+static void
+cmd_config_max_lro_pkt_size_parsed(void *parsed_result,
+				__attribute__((unused)) struct cmdline *cl,
+				__attribute__((unused)) void *data)
+{
+	struct cmd_config_max_lro_pkt_size_result *res = parsed_result;
+	portid_t pid;
+
+	if (!all_ports_stopped()) {
+		printf("Please stop all ports first\n");
+		return;
+	}
+
+	RTE_ETH_FOREACH_DEV(pid) {
+		struct rte_port *port = &ports[pid];
+
+		if (!strcmp(res->name, "max-lro-pkt-size")) {
+			if (res->value ==
+					port->dev_conf.rxmode.max_lro_pkt_size)
+				return;
+
+			port->dev_conf.rxmode.max_lro_pkt_size = res->value;
+		} else {
+			printf("Unknown parameter\n");
+			return;
+		}
+	}
+
+	init_port_config();
+
+	cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1);
+}
+
+cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_max_lro_pkt_size_result,
+				 port, "port");
+cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_keyword =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_max_lro_pkt_size_result,
+				 keyword, "config");
+cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_all =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_max_lro_pkt_size_result,
+				 all, "all");
+cmdline_parse_token_string_t cmd_config_max_lro_pkt_size_name =
+	TOKEN_STRING_INITIALIZER(struct cmd_config_max_lro_pkt_size_result,
+				 name, "max-lro-pkt-size");
+cmdline_parse_token_num_t cmd_config_max_lro_pkt_size_value =
+	TOKEN_NUM_INITIALIZER(struct cmd_config_max_lro_pkt_size_result,
+			      value, UINT32);
+
+cmdline_parse_inst_t cmd_config_max_lro_pkt_size = {
+	.f = cmd_config_max_lro_pkt_size_parsed,
+	.data = NULL,
+	.help_str = "port config all max-lro-pkt-size <value>",
+	.tokens = {
+		(void *)&cmd_config_max_lro_pkt_size_port,
+		(void *)&cmd_config_max_lro_pkt_size_keyword,
+		(void *)&cmd_config_max_lro_pkt_size_all,
+		(void *)&cmd_config_max_lro_pkt_size_name,
+		(void *)&cmd_config_max_lro_pkt_size_value,
+		NULL,
+	},
+};
+
 /* *** configure port MTU *** */
 struct cmd_config_mtu_result {
 	cmdline_fixed_string_t port;
@@ -19024,6 +19096,7 @@  struct cmd_show_port_supported_ptypes_result {
 	(cmdline_parse_inst_t *)&cmd_config_rx_tx,
 	(cmdline_parse_inst_t *)&cmd_config_mtu,
 	(cmdline_parse_inst_t *)&cmd_config_max_pkt_len,
+	(cmdline_parse_inst_t *)&cmd_config_max_lro_pkt_size,
 	(cmdline_parse_inst_t *)&cmd_config_rx_mode_flag,
 	(cmdline_parse_inst_t *)&cmd_config_rss,
 	(cmdline_parse_inst_t *)&cmd_config_rxtx_ring_size,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index efe2812..50e6ac0 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -629,6 +629,8 @@  static int bus_match_all(const struct rte_bus *bus, const void *data)
 	printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize);
 	printf("Maximum configurable length of RX packet: %u\n",
 		dev_info.max_rx_pktlen);
+	printf("Maximum configurable size of LRO aggregated packet: %u\n",
+		dev_info.max_lro_pkt_size);
 	if (dev_info.max_vfs)
 		printf("Maximum number of VFs: %u\n", dev_info.max_vfs);
 	if (dev_info.max_vmdq_pools)
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 9ea87c1..3e371e2 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -592,6 +592,7 @@ 
 		{ "mbuf-size",			1, 0, 0 },
 		{ "total-num-mbufs",		1, 0, 0 },
 		{ "max-pkt-len",		1, 0, 0 },
+		{ "max-lro-pkt-size",		1, 0, 0 },
 		{ "pkt-filter-mode",            1, 0, 0 },
 		{ "pkt-filter-report-hash",     1, 0, 0 },
 		{ "pkt-filter-size",            1, 0, 0 },
@@ -888,6 +889,10 @@ 
 						 "Invalid max-pkt-len=%d - should be > %d\n",
 						 n, RTE_ETHER_MIN_LEN);
 			}
+			if (!strcmp(lgopts[opt_idx].name, "max-lro-pkt-size")) {
+				n = atoi(optarg);
+				rx_mode.max_lro_pkt_size = (uint32_t) n;
+			}
 			if (!strcmp(lgopts[opt_idx].name, "pkt-filter-mode")) {
 				if (!strcmp(optarg, "signature"))
 					fdir_conf.mode =
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 38acbc5..d4f67ec 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -419,6 +419,7 @@  struct fwd_engine * fwd_engines[] = {
 struct rte_eth_rxmode rx_mode = {
 	.max_rx_pkt_len = RTE_ETHER_MAX_LEN,
 		/**< Default maximum frame length. */
+	.max_lro_pkt_size = RTE_ETHER_MAX_LEN,
 };
 
 struct rte_eth_txmode tx_mode = {
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index ef677ba..bc17f3f 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -112,6 +112,11 @@  The command line options are:
 
     Set the maximum packet size to N bytes, where N >= 64. The default value is 1518.
 
+*   ``--max-lro-pkt-size=N``
+
+    Set the maximum LRO aggregated packet size to N bytes, where N >= 64.
+    The default value is 1518.
+
 *   ``--eth-peers-configfile=name``
 
     Use a configuration file containing the Ethernet addresses of the peer ports.
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index c68a742..0267295 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2139,6 +2139,15 @@  Set the maximum packet length::
 
 This is equivalent to the ``--max-pkt-len`` command-line option.
 
+port config - max-lro-pkt-size
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set the maximum LRO aggregated packet size::
+
+   testpmd> port config all max-lro-pkt-size (value)
+
+This is equivalent to the ``--max-lro-pkt-size`` command-line option.
+
 port config - Drop Packets
 ~~~~~~~~~~~~~~~~~~~~~~~~~~