From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 15697A04B1;
	Wed, 23 Sep 2020 13:57:41 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 390141DB4E;
	Wed, 23 Sep 2020 13:57:40 +0200 (CEST)
Received: from incedge.chinasoftinc.com (unknown [114.113.233.8])
 by dpdk.org (Postfix) with ESMTP id B8C4D1DAD1
 for <dev@dpdk.org>; Wed, 23 Sep 2020 13:57:38 +0200 (CEST)
X-ASG-Debug-ID: 1600862256-149d111baf21f0b0001-TfluYd
Received: from mail.chinasoftinc.com (inccas001.ito.icss [10.168.0.51]) by
 incedge.chinasoftinc.com with ESMTP id GvXl8HMp8dl8816y (version=TLSv1
 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO);
 Wed, 23 Sep 2020 19:57:36 +0800 (CST)
X-Barracuda-Envelope-From: huwei013@chinasoftinc.com
X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.51
X-ASG-Whitelist: Client
Received: from [192.168.1.199] (139.159.243.11) by INCCAS001.ito.icss
 (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Wed, 23 Sep 2020
 19:57:36 +0800
X-Barracuda-RBL-Trusted-Forwarder: 192.168.1.199
From: "Wei Hu (Xavier)" <huwei013@chinasoftinc.com>
X-ASG-Orig-Subj: Re: [dpdk-dev] [PATCH v3 3/6] app/testpmd: remove restriction
 on txpkts set
To: Ferruh Yigit <ferruh.yigit@intel.com>
CC: <dev@dpdk.org>, <xavier.huwei@huawei.com>, Chengchang Tang
 <tangchengchang@huawei.com>
References: <20200818120254.72792-1-huwei013@chinasoftinc.com>
 <20200919104708.58451-1-xavier_huwei@163.com>
 <20200919104708.58451-4-xavier_huwei@163.com>
 <72499939-f3c1-1caa-cded-b46b489c1863@intel.com>
 <887fa0c9-73f4-401c-85ca-ad8a1f1b5a1c@chinasoftinc.com>
Message-ID: <5fbb620a-498c-a404-4183-f78190890a78@chinasoftinc.com>
Date: Wed, 23 Sep 2020 19:57:35 +0800
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101
 Thunderbird/68.12.0
MIME-Version: 1.0
In-Reply-To: <887fa0c9-73f4-401c-85ca-ad8a1f1b5a1c@chinasoftinc.com>
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Originating-IP: [139.159.243.11]
X-Barracuda-Connect: inccas001.ito.icss[10.168.0.51]
X-Barracuda-Start-Time: 1600862256
X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA
X-Barracuda-URL: https://incspam.chinasofti.com:443/cgi-mod/mark.cgi
X-Virus-Scanned: by bsmtpd at chinasoftinc.com
X-Barracuda-Scan-Msg-Size: 3748
Subject: Re: [dpdk-dev] [PATCH v3 3/6] app/testpmd: remove restriction on
 txpkts set
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Hi, Ferruh Yigit

On 2020/9/23 11:14, Wei Hu (Xavier) wrote:
> Hi, Ferruh Yigit
> 
> On 2020/9/22 22:51, Ferruh Yigit wrote:
>> On 9/19/2020 11:47 AM, Wei Hu (Xavier) wrote:
>>> From: Chengchang Tang <tangchengchang@huawei.com>
>>>
>>> Currently, if nb_txd is not set, the txpkts is not allowed to be set
>>> because the nb_txd is used to avoid the numer of segments exceed the Tx
>>> ring size and the default value of nb_txd is 0. And there is a bug that
>>> nb_txd is the global configuration for Tx ring size and the ring size
>>> could be changed by some command per queue. So these valid check is
>>> unreliable and introduced unnecessary constraints.
>>>
>>> This patch adds a valid check function to use the real Tx ring size to
>>> check the validity of txpkts.
>>>
>>> Fixes: af75078fece3 ("first public release")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
>>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>>> ---
>>>   app/test-pmd/config.c | 42 ++++++++++++++++++++++++++++++++++++++----
>>>   1 file changed, 38 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>>> index 4e33208..882de2d 100644
>>> --- a/app/test-pmd/config.c
>>> +++ b/app/test-pmd/config.c
>>> @@ -2984,17 +2984,51 @@ show_tx_pkt_segments(void)
>>>       printf("Split packet: %s\n", split);
>>>   }
>>>   +static bool
>>> +nb_segs_is_invalid(unsigned int nb_segs)
>>> +{
>>> +    uint16_t port_id;
>>> +
>>> +    RTE_ETH_FOREACH_DEV(port_id) {
>>> +        struct rte_port *port = &ports[port_id];
>>> +        uint16_t ring_size;
>>> +        uint16_t queue_id;
>>> +
>>> +        /*
>>> +         * When configure the txq by rte_eth_tx_queue_setup with
>>> +         * nb_tx_desc being 0, it will use a default value provided by
>>> +         * PMDs to setup this txq. If the default value is 0, it will
>>> +         * use the RTE_ETH_DEV_FALLBACK_TX_RINGSIZE to setup this txq.
>>> +         */
>>> +        for (queue_id = 0; queue_id < nb_txq; queue_id++) {
>>> +            if (port->nb_tx_desc[queue_id])
>>> +                ring_size = port->nb_tx_desc[queue_id];
>>> +            else if (port->dev_info.default_txportconf.ring_size)
>>> +                ring_size =
>>> + port->dev_info.default_txportconf.ring_size;
>>> +            else
>>> +                ring_size = RTE_ETH_DEV_FALLBACK_TX_RINGSIZE;
>>> +
>>> +            if (ring_size < nb_segs) {
>>> +                printf("nb segments per TX packets=%u >= TX "
>>> +                       "queue(%u) ring_size=%u - ignored\n",
>>> +                    nb_segs, queue_id, ring_size);
>>> +                return true;
>>> +            }
>>> +        }
>>
>> What do you think calling 'rte_eth_rx_queue_info_get()' & 
>> 'rte_eth_tx_queue_info_get()' to get the 'nb_desc'?
> 
> Currently not all PMD driver implement the .rxq_info_get and
> 
> .txq_info_get hook function. If calling rte_eth_rx_queue_info_get
> 
> return -ENOSTUP, we still need to obtain the ring_size in this way.
> 
If calling rte_eth_rx_queue_info_get function get ring_size, because not 
all PMDS implement the relevant the related hook function, we need to
check the return value and if the return value is -ENOSTUP, we must 
obtain the ring_size in this way.
Do you prefer this method, right?

Hopes for your suggestion.
Thanks, Xavier
> 
> Thanks, Xavier