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 56A50A0560; Tue, 18 Oct 2022 09:51:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EE3D14021D; Tue, 18 Oct 2022 09:51:12 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2045.outbound.protection.outlook.com [40.107.243.45]) by mails.dpdk.org (Postfix) with ESMTP id E933740143; Tue, 18 Oct 2022 09:51:10 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JgO6w4vmImIsq6TLiDQMjo8+BPRbdq5U38tZA5wkKVDfMegewpBF311g3RK/tJYVYUp/HSD6adgClhu9Zl44Z/G0rNw6K/PFu3n+LhtJy6g2/I47Q1akyTKNuCXqJuEQ7rIgm4LQvFBlvYnYI08K3gDR/wM5z51JbiUxjj55UXGLM0yYkzvbAV1fNZZpazFirauNWPEhftDXdDWNLvz70mE6zRKvcYPOqXvtUrqC3gGmLvlRhSAoJdiQxBjuQPOTGtM0A3PZUOgKHkLfNlVLp/He9B00aakEkvM5mpvr7qKRPVhu2e5h5wJpx6+igWV19+488285hEZpfqG6eycZ9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=35p7j/+TNxxIWvKrfKbqaqusvstkYvVWjBgxgnDdoMY=; b=cOuj2vGTnB/p1LQBHatWadiEozCgTHZBVBfz6O2tozGQFG9l9/DUhkmfDt6+4MvLwknFkDmg53+Ep9rCcxdRJthCKhFZAGK0xMT9cXtcX+UGYHH/Za7K49bor7djtz/QwuxPHMMwHY0fL8O3H5Si3w4Kif8a7bT60sDiE7oqwi3AFdRKm2sjJh1PYwTktPz3CTAThAw/VbrLfJzX70Y64X1yBO2i9Izix0PmHKt7IrifwfmmqQ+i5eMvLMoWS1KD+TOUhns5Rxf50kxLNJniCyP79f7jxGif/Tdd+NLnwGzWh4P1BwmAvA4MmasYKlG+srAOklczIkqwrMUMW+KLaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=35p7j/+TNxxIWvKrfKbqaqusvstkYvVWjBgxgnDdoMY=; b=rNpCl6z/8JdZ/PgpIqKPRYH5Zh9xAAV96ClpxvGaxKm3eem6q/OLtihOoRpJ+y8yygRCP1UaXJR70NC7mUU9MgETOJNTUP+Z7zvrVc3I5Nuras234KuC/rCujllR+5zVCiZIDVSYk+r+amuHW5/YWwin3I8IaYvFO1CoLc3ZOoo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM6PR12MB4297.namprd12.prod.outlook.com (2603:10b6:5:211::20) by DM4PR12MB6110.namprd12.prod.outlook.com (2603:10b6:8:ad::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 07:51:09 +0000 Received: from DM6PR12MB4297.namprd12.prod.outlook.com ([fe80::b9fd:e732:4585:6b25]) by DM6PR12MB4297.namprd12.prod.outlook.com ([fe80::b9fd:e732:4585:6b25%7]) with mapi id 15.20.5723.033; Tue, 18 Oct 2022 07:51:09 +0000 Message-ID: Date: Tue, 18 Oct 2022 08:51:02 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH] net/nfp: set the appropriate initialized value of flbufsz To: Nole Zhang , Chaoyong He , "dev@dpdk.org" Cc: oss-drivers , Niklas Soderlund , "stable@dpdk.org" References: <1665384495-24990-1-git-send-email-chaoyong.he@corigine.com> <482436be-c20f-09a0-d4e7-b46458026317@amd.com> <005358b0-33cf-1fb1-bf1a-08b82c2a08cd@amd.com> Content-Language: en-US From: Ferruh Yigit In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO2P265CA0306.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::30) To DM6PR12MB4297.namprd12.prod.outlook.com (2603:10b6:5:211::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB4297:EE_|DM4PR12MB6110:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a20dad0-3c36-4800-d254-08dab0dd84aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hbbm8qNFKXEyuvw2CvchFFXJ4ihe7bWUpAF7u/Zv+66Usc/HgUaWNnwNjA6agkwGaC5Z9DA1WblEkcV9em6pgRGwACYDlgjgJJqWoCxwhI9tsYqyGr7+eK1rQM4HxMhXxYgMQJxS/5eFw5iU4HLLNPEnsmLjukWzbWFd+PQVbXsVJ62S/rhbpTcCDKad+/0t+YTNMx0HGwp3KNxfbej512TGE8foyPaHN8UHsvezvAoHvqFga9f4gkE7av5Xchkf4JHMSFb4/fLIPGfaG8PKlG1H3GJuTXzk7uZJvXNDOKzdQUkQSimUNil6JZQpEEunauU6NdFHxEhBQQ+oTW4Cst+Ur6u2UrHP9jFk5zlq9Mi6yKrjzPE44XY4aq9QfOfkLDib+Xp2tdeLid72kBtRIwxuHFWjQU7bV9xJ2NfopPkw8YVtqSKLCcaqkNecICiXiv9q+VX9CxqHICsqUmBwMyidS+nz3pY85doJbDqX7OOzprPH6HJ2pZoBHXb/Wh+sYyYoVwFTsVE+Qf9r29NnKQRFvteHZZXGn9pWBPTg3U0moMk4vJYJgHLfZySFHwohOmqWTervQna4yOfzk/6xX8SckciIhIkmoXdMRfobaAJ0f+EGkh9QvNMW0PepD8nGYMb8wJMXwLYJ5CCUw96VpI6Hw83euomI7Yxc9GTtUSe10vIYVFi3nNP3LtzgaDnTzeRkbhXyLkcKLMHk15Uhhzl6oos8j3pN1GKgPLOK/D2sTuw0l0JPvp0nENc7J5s9meN/fm+fMT1SVSkEOExt0lwDLf6Cx+z9EnzajjWBqgs= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB4297.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199015)(5660300002)(31686004)(2906002)(41300700001)(66556008)(66946007)(54906003)(8676002)(110136005)(4326008)(316002)(36756003)(6486002)(478600001)(6666004)(6506007)(8936002)(83380400001)(6512007)(53546011)(26005)(44832011)(66574015)(66476007)(38100700002)(186003)(86362001)(2616005)(31696002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?V1VPSmZXcHIrU21qWHJmdldnTFgxalNPcnQ1RTAxUWY4bGRvY25GaHFQVWZ2?= =?utf-8?B?Nm9hMWdLdzZTN2xQOEVST0tyZFVrUDlMblI3Rkx4ZVhibHc1SkZYaE5XK0gy?= =?utf-8?B?MHdqSEpSbmhIaEdpV0FrSDVzdU5yZkkxRWZtR1k2dTFkejFWaXRqVXZMRmc2?= =?utf-8?B?aG9mRW5PZkdyYk9zbGc0UHFDb05lZlJ3Skk5MWN4cnhpQzRBS3pES0lSU1Vk?= =?utf-8?B?SzdVUW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iszSnFBak5qWFJxNjdrSHpqREtj?= =?utf-8?B?Y2g5OSs4Z3g2SGk4czRRV3FVMVN2ZEptTlpIbnM0TndpT3VCMHM3K1ZJR1l2?= =?utf-8?Q?L6LXWVxsytWdp+mLioaHOgMe6?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a20dad0-3c36-4800-d254-08dab0dd84aa X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4297.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 07:51:08.9675 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SDAEG24GYu8emtA7k1A4BNqMP+4IYy9tqrLwRJ9Lq+f/6bOS1WztUJoaGSP/s+W/ X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6110 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 On 10/18/2022 2:41 AM, Nole Zhang wrote: > >> On 10/15/2022 8:38 AM, Nole Zhang wrote: >>> > On 10/10/2022 7:48 AM, Chaoyong He wrote: >>>>> From: Peng Zhang >>>>> >>>>> When the testpmd app start-up with parameter max-pkt-len, it will >>>>> set >>>> MTU. >>>>> But the initialized value of flubfsz is inappropriate, if the value >>>>> of flbufsz is smaller than the valude of max-pkt-len, the testpmd >>>>> app will start fail. >>>>> >>>> >>>> What is the failure in the testpmd? >>> >>> The log is as follows: >>> [root@volstruis ~]# dpdk-testpmd --main-lcore 10 -l 10,11,12 -n 4 -a >>> 0000:81:00.0 --socket-mem 2048,2048 --proc-type auto -- --portmask 0x3 >>> --nb-cores 2 --rxq 1 --txq 1 --rxd 1024 --txd 1024 --port-topology >>> loop --forward-mode macswap --max-pkt-len 9216 --mbuf-size 9600 >>> --rss-udp --burst=32 >>> EAL: Detected CPU lcores: 40 >>> EAL: Detected NUMA nodes: 2 >>> EAL: Auto-detected process type: PRIMARY >>> EAL: Detected static linkage of DPDK >>> EAL: Multi-process socket /var/run/dpdk/rte/mp_socket >>> EAL: Selected IOVA mode 'VA' >>> EAL: VFIO support initialized >>> EAL: Using IOMMU type 1 (Type 1) >>> EAL: Probe PCI driver: net_nfp_pf (19ee:4000) device: 0000:81:00.0 >>> (socket 1) NFP HWINFO header: 48490200 >>> TELEMETRY: No legacy callbacks, legacy socket not created Set macswap >>> packet forwarding mode >>> testpmd: create a new mbuf pool : n=163456, size=9600, >>> socket=1 >>> testpmd: preferred mempool ops selected: ring_mp_mc Configuring Port 0 >>> (socket 1) >>> Port0 dev_configure = -34 >>> Fail to configure port 0 >>> EAL: Error - exiting with code: 1 >>> Cause: Start ports failed >>> >>> First in the `nfp_net_configure()`, we will judge the value of MTU and hw- >>> flbufsz, If MTU > hw->flbufsz, it will have the error. >>> >>> And the `--max-pkt-len` is setting the MTU in the initialize process, the >> initialized value of hw->flbufsz is just 1500 at first. >>> >>> So if we set the `max-pkt-len` bigger than the initialized value of flbufsz, It >> will lead the error. >>> >>> Hence we set the new value of hw->flbufsz, it can large the range max-pkt- >> len in the initialized process. >>> >>> >>>> >>>> This patch is fixing something but it is not clear what is fixed, the >>>> concern is it may be changing driver to make something pass in test >> application (testpmd). >>>> >>>> What is 'flubfsz', is it Hw configured frame buffer size? >>> >>> >>> It is configured in the `nfp_net_rx_queue_setup()`{`hw->flbufsz = rxq- >>> mbuf_size`}. >>> If the rxq->mbuf_size < MTU, the MTU can't work. >>> >> >> It looks like `hw->flbufsz` holds the Rx buffer size, as you highlighted above. >> >> And you don't want to accept frames bigger than buffer size, since it seems >> driver doesn't support `RTE_ETH_RX_OFFLOAD_SCATTER`, all looks OK. >> >> >> According above logic, I agree "hw->flbufsz = RTE_ETHER_MTU;" is wrong, >> but equally `hw->flbufsz = hw->max_mtu;` seems wrong. >> >> In above command line, it is safe because "mbuf-size=9600" and >> "max-pkt-len=9216", buffer size is bigger than packet size. > Yes, if I need set the hardcoded value, I should set the max max-pkt-len. I think it should be 'mbuf-size', since 'hw->flbufsz' is the buffer size. 'max-pkt-len' is the max Rx frame accepted by NIC, for some devices 'max-pkt-len' can be bigger than buffer size but it will work fine because of segmented Rx, but it seems this config doesn't work for nfp. >> >> You should able to set `hw->flbufsz` to current buffer size, instead of >> a hardcoded value. >> >> In `nfp_net_init()`, most probably you don't know the buffer size yet, >> can't you skip setting this value here and set it in >> `nfp_net_rx_queue_setup()` when you know the buffer size? >> > > But If I just depends on the `nfp_net_rx_queue_setup()`, in the `nfp_net_init()`, it will > Call the `nfp_net_configure()`, it will lead the testpmd start failed, so I add the hardcoded value > in the initialize process. Or I can remove the judge about `hw->flbufsz` in the `nfp_net_init()`. > Instead of setting 'hw->flbufsz' in 'nfp_net_init()' and check it in 'nfp_net_configure()', why not set 'hw->flbufsz' in 'nfp_net_configure()'? Because in 'nfp_net_configure()', 'mtu' is a configuration parameter. It can be possible to convert 'mtu' to frame size and set it. If there is a HW limitation on buffer size, it can fail in 'nfp_net_configure()' when that limit hit. > Thanks for your advice. >> >>>> >>>> >>>>> Fixes: 5c305e218f15 ("net/nfp: fix initialization") >>>>> Cc: stable@dpdk.org >>>>> >>>>> Signed-off-by: Peng Zhang >>>>> Reviewed-by: Chaoyong He >>>>> Reviewed-by: Niklas Söderlund >>>>> --- >>>>> drivers/net/nfp/nfp_ethdev.c | 2 +- >>>>> drivers/net/nfp/nfp_ethdev_vf.c | 2 +- >>>>> 2 files changed, 2 insertions(+), 2 deletions(-) >>>>> >>>>> diff --git a/drivers/net/nfp/nfp_ethdev.c >>>>> b/drivers/net/nfp/nfp_ethdev.c index 5cdd34e588..b95e623f1f 100644 >>>>> --- a/drivers/net/nfp/nfp_ethdev.c >>>>> +++ b/drivers/net/nfp/nfp_ethdev.c >>>>> @@ -517,7 +517,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) >>>>> hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP); >>>>> hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU); >>>>> hw->mtu = RTE_ETHER_MTU; >>>>> - hw->flbufsz = RTE_ETHER_MTU; >>>>> + hw->flbufsz = hw->max_mtu; >>>>> >>>>> /* VLAN insertion is incompatible with LSOv2 */ >>>>> if (hw->cap & NFP_NET_CFG_CTRL_LSO2) diff --git >>>>> a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c >>>>> index d304d78d34..47acb4c60e 100644 >>>>> --- a/drivers/net/nfp/nfp_ethdev_vf.c >>>>> +++ b/drivers/net/nfp/nfp_ethdev_vf.c >>>>> @@ -396,7 +396,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) >>>>> hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP); >>>>> hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU); >>>>> hw->mtu = RTE_ETHER_MTU; >>>>> - hw->flbufsz = RTE_ETHER_MTU; >>>>> + hw->flbufsz = hw->max_mtu; >>>>> >>>>> /* VLAN insertion is incompatible with LSOv2 */ >>>>> if (hw->cap & NFP_NET_CFG_CTRL_LSO2) >>> >