From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7E6C7A0A0A; Fri, 22 Jan 2021 15:26:38 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3A446140FFF; Fri, 22 Jan 2021 15:26:37 +0100 (CET) Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) by mails.dpdk.org (Postfix) with ESMTP id 8961E140FFD for ; Fri, 22 Jan 2021 15:26:35 +0100 (CET) Received: by mail-oi1-f173.google.com with SMTP id q205so6077612oig.13 for ; Fri, 22 Jan 2021 06:26:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VekMUviQM1HDSIo5uT1No8za8ljnbElZ1rbLTRjnVZI=; b=HRwCEt8BWrI5f0I5intush5mtJvG2MEVrVeodClVxUnqulr52qW+9ernON95rj7cwO 4vMWWxL+qHg27iUbdqZPnF0JGJUod3BMcY0ndNkFyUDplj4jymsAG7yYRiV3TsEH+BSM pW1eD950jvF6opvEr/hVIQF9zUXuctYMh0rg4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VekMUviQM1HDSIo5uT1No8za8ljnbElZ1rbLTRjnVZI=; b=FSaDA+VlpND1PFc5ablWPymuV9xA/APG0b96IcxSFV4UTxowUiIzHnIBKsVKbtDYsj 8R2BiEfGV0QYEQp7RVnFYn2CtP4llifuohhRV/dx5sswNoAVFtmFx98wbGN69NTQbenC i7zOmy4zknVuP6kibity029THLSm5HaVlPvAU1XR/ahFz1uaHQ9A0QfiUgwP2320n0Qb wdtFaebCDyOth5GoT37OCr7tEtfZZVxqQBREcAqMuKm21ni6M1oO/sPifhunylqqKsqd /S4FlYTX38SziS/Dc5RhSRnbiDOtTj+Tsms83a16nrdv8UySRmPxEdH2pMEoEIzMjhD0 RtCA== X-Gm-Message-State: AOAM531E6A8ko7SleHqMB0g29FqwoazDZgc6KIALBR9iW1iJV5ZOJvHw sA0ix4oFCMjmpoPDHJKiSS04JkXaRQ43tGx98tz13Q== X-Google-Smtp-Source: ABdhPJy7/BPsxWvJoylanYWk6tLnIYfZtt1/gUWSGopfoEYlj7++SKE0utlTExhbp7XNfV039GOY+U9gOVvwcyKEpDA= X-Received: by 2002:a05:6808:18:: with SMTP id u24mr3359651oic.89.1611325594535; Fri, 22 Jan 2021 06:26:34 -0800 (PST) MIME-Version: 1.0 References: <20210114094537.13661-1-stevex.yang@intel.com> <20210118070428.36998-1-stevex.yang@intel.com> <20210118070428.36998-3-stevex.yang@intel.com> In-Reply-To: From: Lance Richardson Date: Fri, 22 Jan 2021 09:26:23 -0500 Message-ID: To: Steve Yang , Ferruh Yigit Cc: dev@dpdk.org, Wenzhuo Lu , Beilei Xing , Bernard Iremonger Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000b4008905b97df908" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [dpdk-dev] [PATCH v4 02/22] app/testpmd: fix max rx packet length for VLAN packets X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" --000000000000b4008905b97df908 Content-Type: text/plain; charset="UTF-8" On Thu, Jan 21, 2021 at 10:27 AM Lance Richardson wrote: > > On Mon, Jan 18, 2021 at 2:08 AM Steve Yang wrote: > > > > When the max rx packet length is smaller than the sum of mtu size and > > ether overhead size, it should be enlarged, otherwise the VLAN packets > > will be dropped. > > > > Removed the rx_offloads assignment for jumbo frame during command line > > parsing, and set the correct jumbo frame flag if MTU size is larger than > > the default value 'RTE_ETHER_MTU' within 'init_config()'. > > > > Fixes: 384161e00627 ("app/testpmd: adjust on the fly VLAN configuration") > > Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines") > > Fixes: ce17eddefc20 ("ethdev: introduce Rx queue offloads API") > > Fixes: 150c9ac2df13 ("app/testpmd: update Rx offload after setting MTU") > > > > Cc: Wenzhuo Lu > > Cc: Beilei Xing > > Cc: Bernard Iremonger > > > > Signed-off-by: Steve Yang > > --- > > app/test-pmd/cmdline.c | 6 ------ > > app/test-pmd/config.c | 2 +- > > app/test-pmd/parameters.c | 7 ++----- > > app/test-pmd/testpmd.c | 18 ++++++++++++++++++ > > 4 files changed, 21 insertions(+), 12 deletions(-) > > > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > > index 2ccbaa039e..65042fcff5 100644 > > --- a/app/test-pmd/cmdline.c > > +++ b/app/test-pmd/cmdline.c > > @@ -1886,7 +1886,6 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, > > > > RTE_ETH_FOREACH_DEV(pid) { > > struct rte_port *port = &ports[pid]; > > - uint64_t rx_offloads = port->dev_conf.rxmode.offloads; > > > > if (!strcmp(res->name, "max-pkt-len")) { > > if (res->value < RTE_ETHER_MIN_LEN) { > > @@ -1898,11 +1897,6 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, > > return; > > > > port->dev_conf.rxmode.max_rx_pkt_len = res->value; > > - if (res->value > RTE_ETHER_MAX_LEN) > > - rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; > > - else > > - rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; > > - port->dev_conf.rxmode.offloads = rx_offloads; > > } else { > > printf("Unknown parameter\n"); > > return; > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > > index 3f6c8642b1..1195f054f3 100644 > > --- a/app/test-pmd/config.c > > +++ b/app/test-pmd/config.c > > @@ -1434,7 +1434,7 @@ port_mtu_set(portid_t port_id, uint16_t mtu) > > * device supports jumbo frame. > > */ > > eth_overhead = dev_info.max_rx_pktlen - dev_info.max_mtu; > > - if (mtu > RTE_ETHER_MAX_LEN - eth_overhead) { > > + if (mtu > RTE_ETHER_MTU) { > > rte_port->dev_conf.rxmode.offloads |= > > DEV_RX_OFFLOAD_JUMBO_FRAME; > > rte_port->dev_conf.rxmode.max_rx_pkt_len = > > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c > > index 414a0068fb..df5eb10d84 100644 > > --- a/app/test-pmd/parameters.c > > +++ b/app/test-pmd/parameters.c > > @@ -834,12 +834,9 @@ launch_args_parse(int argc, char** argv) > > } > > if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) { > > n = atoi(optarg); > > - if (n >= RTE_ETHER_MIN_LEN) { > > + if (n >= RTE_ETHER_MIN_LEN) > > rx_mode.max_rx_pkt_len = (uint32_t) n; > > - if (n > RTE_ETHER_MAX_LEN) > > - rx_offloads |= > > - DEV_RX_OFFLOAD_JUMBO_FRAME; > > - } else > > + else > > rte_exit(EXIT_FAILURE, > > "Invalid max-pkt-len=%d - should be > %d\n", > > n, RTE_ETHER_MIN_LEN); > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > > index 2b60f6c5d3..c256e719ae 100644 > > --- a/app/test-pmd/testpmd.c > > +++ b/app/test-pmd/testpmd.c > > @@ -1410,6 +1410,7 @@ 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; > > @@ -1446,6 +1447,23 @@ 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; > > + > > if (!(port->dev_info.tx_offload_capa & > > DEV_TX_OFFLOAD_MBUF_FAST_FREE)) > > port->dev_conf.txmode.offloads &= > > -- > > 2.17.1 > > > > Moving the setting of DEV_RX_OFFLOAD_JUMBO_FRAME from > cmd_config_max_pkt_len_parsed() to init_config() doesn't seem to > be correct for 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. > > (Of course this won't matter when DEV_RX_OFFLOAD_JUMBO_FRAME > is removed, which seems like a great idea, but for now this is impacting > some test automation with 21.02-rc1.) +Ferruh (sorry, thought he was already on this thread.) --000000000000b4008905b97df908--