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 5D6ECA0560; Tue, 18 Oct 2022 11:36:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09C174021D; Tue, 18 Oct 2022 11:36:11 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2054.outbound.protection.outlook.com [40.107.95.54]) by mails.dpdk.org (Postfix) with ESMTP id 5A66740143; Tue, 18 Oct 2022 11:36:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fZIQ+WZvenCAdVnD9EviMj6nvF/mbCs0EjhB5GPEWguRQFGeVFMZbmMq0SOHMNdfHQYrILbxjSYOOfwtqML7fGia9YcRwGb2+xLYpqKqlHmW8zb3i32i5yY/Cfev3kU4+A0BMoFkTi8myfkQxF0GQYbazHv1R3qUqsQWpwJpKc/o0RdVOGo6r2PfyMmaRePy2RqZ9lQyJfbnvvZHOzOs7UIMu5vOtDu73xF7al36uyoV73hEoIkvRvhqKhkw05Q21WRJKQkXyexY/fM6sZqBvv1d88wn4F3q/4dbHTqrWs1m4Wr9QvOERTMYJJdnRwxRHQRO2yjB2eC7TB8BqvtXIA== 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=yKD0ZJUc4yeHp02fBUyW7duhEwCMr3JUV99gUWcX0DY=; b=MeguhW+ZmDOjDO7vdzvf1haZ6thDtwlN3S9hzHLyjCmFoWrWCSB1KsuquUHazHxA0BNq5AiipinEZgUnDw2zEIdZ2XwyEihhS29EZU1wB0i7s9M3S+1q22MjgUL13IzcZFKUR7kNhVhmwn6tQrjP5I6u1i18w2Pk09miCRSyD8r2Bz9MKnx3B1m9QMwBNug0/zIYDABA56rHZ3k7BiJSW4vhTwIxxygW7gjJYWPUyWTqPobID+mQKpTYoGlZV1liLgiERUcMg0w+ul0HbhAyW0fOCSlZZrTAyPQZ9w66Urh9fVeCdfpqM7Li3SXwBCumOiQ10KePD/rHytWBnNOfYw== 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=yKD0ZJUc4yeHp02fBUyW7duhEwCMr3JUV99gUWcX0DY=; b=5HwHqm/Ch5pX0WUpBYooJIK+EB1HU2m8a2CKWg5XFYMcA1wxSCbDtX3m5Qn9vVwowFNJ1DnNMoiZYJXBCJNTIsPhMT6fv/qv7sLCcqSbGog7vvrG2ekJg6sAeTwJX/LVhj6gNOUTBj4gn4g4kCJkX+3IvDWWil0UosiRlR5jMGc= 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 CY5PR12MB6276.namprd12.prod.outlook.com (2603:10b6:930:f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Tue, 18 Oct 2022 09:36:07 +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 09:36:07 +0000 Message-ID: <62bf28bc-fda3-c4d2-c0c3-46fed4f2984c@amd.com> Date: Tue, 18 Oct 2022 10:36: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 Content-Language: en-US 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> From: Ferruh Yigit In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P123CA0037.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600::25) To DM6PR12MB4297.namprd12.prod.outlook.com (2603:10b6:5:211::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB4297:EE_|CY5PR12MB6276:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ac6d93c-b033-4d3f-72de-08dab0ec2eca X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xVPF9AlswiUVHCwjNr8dzDul4zCM9FlpyEl5vPVFaYXOPhW0UhOm152OqMOqdMqXiqGK0A4GYEYAnyQScnQ/f1lWGFAM/v2A+9YCsU7gBdNQNkPj1FWEHATotMvIaVvhAvLXSemDEQNuY7nZKPxqCnkLIOLXDaolXwapNZYSokxkX8xjWwmbP5VHgKgPEbotMVpe3oJdZBmZr2tAvIF6Hju74u9zWlpe0VgaDwq+an3LBMIS+1fpV+0kFaVjE+8dQUbTXrKs/UeR8u1Eyhm+Ov+YXMgcm1slPox9kKpvDEalHXYKyryK76g3UlMWGFXmp0eVQwUldy2ewFxxN1xWrGjtq6WjVyd4ykMLty/IsM/gN55JaXswlg1/AhuX55OEq0tEiLzPimG+bd2i3cI97ECVxVe3PYdv572GLxzvOAbaiz0uT0BnHCsmRjUAwjgzRMQE+EYa7E/5XoL3nfgrpaqK0dpYeo3WHw1HlJFtlP4wWhUsRoLhXLoRjrlvgablXyZUlkHtHvqlBccM1wyJn1GcrV+6j/G3MiHdy636Powv9oA4YUpNhaYG9giTRuc6ZrVc442kEdEvx4xkZcpAb9JYVECttcreqZ/FogKveoVwJjws1asqsoqIR72Pd7VLGzlekWJtpAUk1lb/3k1ftNSt4PtyS4/EfSbJKxP2XX5YSPGckor2hfpSv1+RxED/cdUj2qBEMKL69k4HERolowl+ihFZz6DLJVSat1dNjcBqqlM26Qb/Wjbb2twsqfhes3zyXcL0ZzAjU7U6kXQv/tT7zMufShmgesGhZZql0Bc= 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)(376002)(136003)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(31686004)(86362001)(31696002)(5660300002)(44832011)(38100700002)(2906002)(186003)(2616005)(83380400001)(26005)(6506007)(316002)(53546011)(478600001)(6486002)(110136005)(54906003)(6512007)(66476007)(66556008)(66946007)(41300700001)(4326008)(8936002)(6666004)(8676002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Z3Jsbi9yTlJLTE9JbERDcXR0TnRFTGdEZHpJUnVVQ015OC9udzJvRWRaTjFn?= =?utf-8?B?QndtZ29qTktSUjBqbGtqTWJiNWhuNk5mYmZ4TnJKdU12djBUWnZoa1NQamtV?= =?utf-8?B?YStlOUV2MTNZU1ZQYnkyS1drZzRJeFZTS0lDUlZYNUkzNVI3UG5KVXZCUXVE?= =?utf-8?B?dEtFM3NQazU2dzZVK1o3ZTArdGJhc0l6bllZa3JKeldpRV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ZEMwVWtVMC9MYWNKZ2RVdlJURjFN?= =?utf-8?B?djQ3TVV0cUtSZElacmtzNEhGaWl6TkF4eFNvTWpLWTBwQVBtb3JKZkdleXRW?= =?utf-8?Q?Xky2YbmPiUXTSdonZ1pxoWrDM?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ac6d93c-b033-4d3f-72de-08dab0ec2eca X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4297.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 09:36:07.2323 (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: UK4fLoSTQH0QMLFU6WfBE/Bvzldq5SU/zxuNrMdWiMQX8zNFHDgmMCNXK8jBw+PI X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6276 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 9:51 AM, Nole Zhang wrote: >> 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. >> > As you said, maybe the ` NFP_FRAME_SIZE_MAX ` is right, for our nic, > the max_rx_pktlen is NFP_FRAME_SIZE_MAX. If 'NFP_FRAME_SIZE_MAX' is your HW limit, agree to set it if it will be a hardcoded value, please see below. >>>> >>>> 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. >> > You mean in the 'nfp_net_configure()', set the value of 'hw->flbufsz', > Like > `if (rxmode->mtu > hw->flbufsz) { > hw->flbufsz = rxmode->mtu; > }` > Because the 'nfp_net_configure()' also isn't only called once. > If it will be set the values every times, so I first just set the > Initial value in the `nfp_net_inital()`. > But during init, 'nfp_net_init()', you don't know the buffer size, that is why you are just setting a hardcoded value, which can be wrong, as you are observing now. Also thinking twice setting "hw->flbufsz = rxmode->mtu" is not correct, since it is not frame size either. What about: - in 'nfp_net_configure()' change check as: if (rxmode->mtu > NFP_FRAME_SIZE_MAX) return error And you may want to save 'mtu' in driver or in device via nn_cfg_writel(hw, NFP_NET_CFG_MTU, mtu); - in start() add check for buffer size: if (mtu > hw->flbufsz) return error - in init() you can either remove setting 'hw->flbufsz' or set it to max (NFP_FRAME_SIZE_MAX) as you suggested. If you remove setting it in init, you can have logic in configure() as ` bufsize = hw->flbufsz ? hw->flbufsz : NFP_FRAME_SIZE_MAX; if (rxmode->mtu > bufsize) return error ` >>> Thanks for your advice. >>>> >>>>>> >>>>>> >>>>>>> Fixes: 5c305e218f15 ("net/nfp: fix initialization") >>>>>>> Cc: stable@dpdk.org > ... >>>>>>> /* VLAN insertion is incompatible with LSOv2 */ >>>>>>> if (hw->cap & NFP_NET_CFG_CTRL_LSO2) >>>>> >>> >