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 95606A0560; Mon, 17 Oct 2022 14:11:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7376740A84; Mon, 17 Oct 2022 14:11:28 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2051.outbound.protection.outlook.com [40.107.243.51]) by mails.dpdk.org (Postfix) with ESMTP id C551740143; Mon, 17 Oct 2022 14:11:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mhWAlpHydeDfam8I1R/zNA5bS2CQpotLtb66XWdyQ9kkmwi6DSP8zy+72WF1wnJjipNeoGqTX2lKwQB/tXsgUicnfTQl1sz9GrV4V9PE78gVZgMg6JIPqYFNNVaY2qQ7p+v8tTRR+gAk5HIClUkkZtjyKJozcHrUWU7PlXsDnRLvJVFGOuFteFgsouy4JadyhdBJnONUq5LHmI3rfl22ER3k8hf5E9+MmvhTTP6zTToVDG0rXwsu0h3xcuGon5v1XLxMrxwnsISzfZ/a9cOaBdiSTjesnyzZ0Zdi/r082IYIAk2f8EIbqs5ImqngGCe0waHjPW9YwGX84rsk2Qz46g== 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=Hc/sMFjp7dirEIvfHnVnQqXTv0ODhdP86buJz9hzurA=; b=CTCwEDGRJ0dQFQAx2XoKwPf25TMFg6F5W7KLc6xIyIQGxWn6RKZLsi8zViKOkfHiyqbSJGXsmOA2X/WpvCHNFl2UkfUhOqGQ0uJQlN+yTNlPldOswxAqJsyYsPKRIBFNsPzuSuBSRbKSYK7qESvYoNITdxqASYIRH3e+c/Luj0EawR6XKYyZvmYJXd40Q2j5ZrBKP4vBZ6eB+hh2Hkr14BuU5VMAGqf3yxiDNs9vI5d+56UrgwN3YQU6idVimiaeMABschhLCCRZs4QT69sTZPlv8Jt6PIvboXCI9PU+0I+gf7z5eEVD5wM3vw24wEu6ZOOc1ypkwDF2h0s5w1/BTA== 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=Hc/sMFjp7dirEIvfHnVnQqXTv0ODhdP86buJz9hzurA=; b=pHIlDmUiJByFs1KpLAabBBGj0yBIHsD2peFYpvwPOHg6QtHjkJ+pVGMczqqS6zoE10Tv/+pApOVvpo3U/Imn87xECZll4YsIdV1KxvAU9IqooeGHdkPNMXrdz9pLQVhkdV3pssOO+f9GoQdQDdtvvFWJzwW0nK1Z95F3roEfCLw= 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 CH2PR12MB4102.namprd12.prod.outlook.com (2603:10b6:610:a9::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Mon, 17 Oct 2022 12:11:25 +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; Mon, 17 Oct 2022 12:11:25 +0000 Message-ID: <005358b0-33cf-1fb1-bf1a-08b82c2a08cd@amd.com> Date: Mon, 17 Oct 2022 13:11:19 +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> 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: LO4P123CA0608.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:314::8) To DM6PR12MB4297.namprd12.prod.outlook.com (2603:10b6:5:211::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB4297:EE_|CH2PR12MB4102:EE_ X-MS-Office365-Filtering-Correlation-Id: c49c0e49-5b0f-48ca-87ff-08dab038b62d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: evPIFtpRpFacYvSHPF9tIflfi06rHeAwJKgaVRpBxr4QIZNOtrnBlpUpeigmD9AybKz1eZZCR1LVyueO0gqrqBuwVvsrJ4/2RywjjDt5BAtCp1+mmDi7sf6X4NYuDFVmfFb9rk6cIwvS18suOgZ/ecSjNIB8zfFr+7+/zTyIEQYrX+uoeTb4KkkDIXeDYBzIrjT/cmXeNgFkWHVVG+4r8q0lzhWGQBbUUpdrZq4pym2ZGIr0tBFE0ax6bPIF8NjlmIkW/ZWFvyJvqaRhJHW3YF3r/7okFXGJsKhOJNpWVq/XPCxS9qEq5/ExggV9fNSOyaZ+aArKRaR1OGnx6WIiavQx9+oGlBxWA2oz8m0M71gukLiVsdKjFBLXf8yd3O4vDJyHfNx4J6TCNX/QPOWZEu5ZoHhtOXqyjxs7aXDKieNNb66KtoZch1/qw6MJByq2KjVwS94rHFizdrV538+GYOUV25lxq72VyJGByW4clXic8gL8BgRMqmqVKLWFByW9qPCnBr7f8ItQGJoiJeBJizFTO7jgcUaoqbaMdtq+iZsdRuQdU/qsKIO+yNpwJxxgwwIiDywVj/3PmzFBwJ4gFgEBlBrW0QjbHS6j+jf7sO+8egWV8zOWo3mSZeYte7LEho9Zcn7ozUbZUJAGqygYWl2CDUWBi4UgSU5/DWIVLZxoW5yNLLH1ritVzAhLZQEhN+Ns4qaACzxv/Rq1g3sXXfKcC+p7WGhPDUjLV/DZdo3Jf6N8b+9GV4pQdHSlbx17oI2tFl0xjc5jomlOIE1VSpZjhBlbyxVmmBvNYoWHhws= 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)(346002)(396003)(376002)(39860400002)(136003)(366004)(451199015)(66574015)(2906002)(186003)(83380400001)(31696002)(36756003)(38100700002)(31686004)(86362001)(6486002)(478600001)(6506007)(54906003)(110136005)(53546011)(41300700001)(44832011)(6512007)(316002)(66476007)(8936002)(5660300002)(26005)(2616005)(8676002)(66946007)(66556008)(4326008)(6666004)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MjI2N2duWUFKNnRRVFpYdEJJQUU0c2d2b1lDOThpOE4yYUdlMzRIQ1ZtRGkz?= =?utf-8?B?OHpWa2dSaTRtOEM5aXpHUkE1WDl2OXo0dGlQTWt0eUZsdDhGSi9hNm5zNk1i?= =?utf-8?B?cmtkUUh2YktvWEJncGN1Nmk2RysrZ29xOHVVZ1lFRStCVDY1aW1FN0JhQVdP?= =?utf-8?B?QzBUeHg1MlFPVmEzNzdjTnptdHhvUnJYMTZvSU84b1IxQk1xN3NWVlgzNUtT?=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vSmcx?= =?utf-8?B?MnZKbkQ0ZjNsZ2JNSjEzMk8wNFBZOTcwRU9aTG9RWm4xZWdVc2ZDK2ZTYUsx?= =?utf-8?Q?f/JTRtAVWOkmMt/h4ASRKIbgo?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: c49c0e49-5b0f-48ca-87ff-08dab038b62d X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4297.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2022 12:11:24.9315 (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: FazjoYZ/KFI7r5/RAyG2NLsw4GM1FNP/37MnuVkXp8PX7iN2U85m6vxGwcSM9h8X X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4102 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/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. 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? >> >> >>> 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) >