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 30EC6A0542; Thu, 13 Feb 2020 02:52:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 233B32BF4; Thu, 13 Feb 2020 02:52:20 +0100 (CET) Received: from m12-11.163.com (m12-11.163.com [220.181.12.11]) by dpdk.org (Postfix) with ESMTP id 78DD52B86 for ; Thu, 13 Feb 2020 02:52:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Subject:From:Message-ID:Date:MIME-Version; bh=rvxVF YB4ReyPVlzqrXW5VotMUiVy+h6oPf4DiUFv3cg=; b=Ce6B4aT3SM4N/lkiXenRb q/NZtaa6VTZoyMr7XbEJUxTlN3NpH7UN4mqMDnwfvB24nq1Ay8t/04mqZvMZVpHE EwWFaHc8K/vJInOKWLiQ3DaaXib0swev2u4fe5JBkBh+9Z1LX608nKNDkHjhqQ7J NWcGl04ytU4YW+Xfd3vU4w= Received: from [192.168.1.199] (unknown [139.159.243.11]) by smtp7 (Coremail) with SMTP id C8CowABHby_Oq0Re4MEjAw--.27729S2; Thu, 13 Feb 2020 09:52:15 +0800 (CST) To: Ferruh Yigit , dev@dpdk.org Cc: Andrew Rybchenko , Thomas Monjalon , Matan Azrad References: <20200121114433.57543-1-huwei013@chinasoftinc.com> <20200121114433.57543-2-huwei013@chinasoftinc.com> <91ab9f40-80fc-6e3d-e13b-95c0147734da@intel.com> From: "Wei Hu (Xavier)" Message-ID: <69811939-e556-8b2d-37de-b9791e55f7f3@163.com> Date: Thu, 13 Feb 2020 09:52:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-CM-TRANSID: C8CowABHby_Oq0Re4MEjAw--.27729S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxAr47Gr45GF4DZw4kJrW3GFg_yoWrGF13pF 4kGFZagFWDJr13C3WavayYgw4jgr4xGr429ry3Z345AF1qv3srXrWjkrna9Fy8CF18GFyv vr4IqF9FyFyUGa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07be5rxUUUUU= X-Originating-IP: [139.159.243.11] X-CM-SenderInfo: 50dyxv5ubk34lhl6il2tof0z/xtbBzw-Io1aD6RAx1wAAsh Subject: Re: [dpdk-dev] [PATCH 1/3] 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" Hi, Ferruh Yigit On 2020/2/12 8:25, Wei Hu (Xavier) wrote: > Hi, Ferruh Yigit > > On 2020/1/28 19:27, Ferruh Yigit wrote: >> On 1/21/2020 11:44 AM, Wei Hu (Xavier) wrote: >>> 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) >>> --- >>>   app/test-pmd/config.c | 18 +++++++++++++++++- >>>   1 file changed, 17 insertions(+), 1 deletion(-) >>> >>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c >>> index 9669cbd4c..09a1579f5 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,22 @@ 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) { >>> +        /* >>> +         * Ether overhead in driver is equal to the difference of >>> +         * max_rx_pktlen and max_mtu in rte_eth_dev_info. >>> +         */ >>> +        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; >>> +        else >>> +            rte_port->dev_conf.rxmode.offloads &= >>> +                        ~DEV_RX_OFFLOAD_JUMBO_FRAME; >> >> If the jumbo frame capability supported or not should be tested before >> setting it. >> >>> +        rte_port->dev_conf.rxmode.max_rx_pkt_len = mtu + eth_overhead; >> >> May need to check against 'dev_info.max_rx_pktlen', if the >> 'max_rx_pkt_len' is >> bigger than this, it will fail in next configure. >> >> Also some divers already does this in PMD code, should we clean that >> code or not >> is a question. >> > The snippset is adjusted as follows: > > if (mtu > RTE_ETHER_MAX_LEN - eth_overhead && dev_info.rx_offload_capa & > DEV_RX_OFFLOAD_JUMBO_FRAME) { >     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; > > We only modifies the internal variables of testpmd, don't impact on the > implementation of the driver. > > Thanks for more suggestions. > > XavierThe code is modified as follows: diag = rte_eth_dev_set_mtu(port_id, mtu); 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; } We will send V2. Thanks Xavier