From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0119DA0542; Thu, 13 Feb 2020 02:57:56 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EE40A2BF4; Thu, 13 Feb 2020 02:57:55 +0100 (CET) Received: from incedge.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id 9CABF2B86 for ; Thu, 13 Feb 2020 02:57:53 +0100 (CET) X-ASG-Debug-ID: 1581559069-0a3dd167495cb50001-TfluYd Received: from mail.chinasoftinc.com (inccas002.ito.icss [10.168.0.52]) by incedge.chinasoftinc.com with ESMTP id RLvRg2bIdU6ueNoj (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 13 Feb 2020 09:57:49 +0800 (CST) X-Barracuda-Envelope-From: huwei013@chinasoftinc.com X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.52 X-ASG-Whitelist: Client Received: from localhost.localdomain (114.119.4.74) by INCCAS002.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.439.0; Thu, 13 Feb 2020 09:57:49 +0800 From: "Wei Hu (Xavier)" X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.60 To: Date: Thu, 13 Feb 2020 09:57:43 +0800 X-ASG-Orig-Subj: [PATCH v2] app/testpmd: update Rx offload after setting MTU sccessfully Message-ID: <20200213015743.16854-1-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [114.119.4.74] X-Barracuda-Connect: inccas002.ito.icss[10.168.0.52] X-Barracuda-Start-Time: 1581559069 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://spam.chinasoftinc.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at chinasoftinc.com X-Barracuda-Scan-Msg-Size: 2209 Subject: [dpdk-dev] [PATCH v2] app/testpmd: update Rx offload after setting MTU sccessfully X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" From: "Wei Hu (Xavier)" Currently, Rx offload capabilities and max_rx_pkt_len in the struct variable named rte_port are not updated after setting mtu successfully in port_mtu_set function by 'port config mtu ' command. This may lead to reconfig mtu to the initial value in the driver when recalling rte_eth_dev_configure API interface. This patch updates Rx offload capabilities and max_rx_pkt_len after setting mtu successfully when configuring mtu. Fixes: ae03d0d18adf ("app/testpmd: command to configure MTU") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Wei Hu (Xavier) --- v1 -> v2: Address the comments form Ferruh Yigit, the related link as below: http://patches.dpdk.org/patch/65007/ --- app/test-pmd/config.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 9669cbd4c..409c1327a 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1216,7 +1216,9 @@ void port_mtu_set(portid_t port_id, uint16_t mtu) { int diag; + struct rte_port *rte_port = &ports[port_id]; struct rte_eth_dev_info dev_info; + uint16_t eth_overhead; int ret; if (port_id_is_invalid(port_id, ENABLED_WARN)) @@ -1232,8 +1234,25 @@ port_mtu_set(portid_t port_id, uint16_t mtu) return; } diag = rte_eth_dev_set_mtu(port_id, mtu); - if (diag == 0) + if (diag == 0 && + dev_info.rx_offload_capa & DEV_RX_OFFLOAD_JUMBO_FRAME) { + /* + * Ether overhead in driver is equal to the difference of + * max_rx_pktlen and max_mtu in rte_eth_dev_info when the + * device supports jumbo frame. + */ + eth_overhead = dev_info.max_rx_pktlen - dev_info.max_mtu; + if (mtu > RTE_ETHER_MAX_LEN - eth_overhead) { + rte_port->dev_conf.rxmode.offloads |= + DEV_RX_OFFLOAD_JUMBO_FRAME; + rte_port->dev_conf.rxmode.max_rx_pkt_len = + mtu + eth_overhead; + } else + rte_port->dev_conf.rxmode.offloads &= + ~DEV_RX_OFFLOAD_JUMBO_FRAME; + return; + } printf("Set MTU failed. diag=%d\n", diag); } -- 2.23.0