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 A7467A00BE; Tue, 14 Jun 2022 11:21:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 54A1D4068E; Tue, 14 Jun 2022 11:21:42 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2078.outbound.protection.outlook.com [40.107.223.78]) by mails.dpdk.org (Postfix) with ESMTP id AB4154067C for ; Tue, 14 Jun 2022 11:21:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FPt9gE3z4CtjaTpKLcHeBNzjh837ALWjnHSGFSb3WafovM2oIY25eGnlfQ2pvmvgwHVr0Wi8gjLvoRaBF41BEiUV0yIFbTub4h92b47aFuCeJ2zkaCPvT65SJdTtFrRVKcSvFGtRawI09NhyHzNf6yayaU462KXWhB10JkXNjS0UcvTcCEPJuiYZ8xZ/BT5THWRf3U59GX2Hu8qmeIeINb7tzWCfk7NI64w2itBhK8cnEdFG5UZuoYgy+koRelWHrMR9XD5uXTV+fSOAqc16gqrSKObFQ9iDWFsmH70ahooNstwYA30FpwaywgVWhJcR2ajb1LDIN5Fi/8SXyeAjEw== 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=cUfOAlIj/senuQao52CitP9B0I/dIGQ7MM9RxBnzJyo=; b=lWvqUWtLq0Ar13cQaeDDTWxK6MTtNGqgUVtCsVsggGxF7KRFHF/DhHjb632vTs3FRBMpoVdOPLYr/4DH+Uqmx3Kx/Oz4nLAVwCILitPeDCRxCcoiFJGGF4vucuQTGY/6Ggm5aP4o+6sWvvtYkj+2e9+R0Hs9+PIqNj8OR9LtzpsgjhDXn6yq9Tj2qvLlITKM44JCa1v69xeaKHdbIQV1bcfXor6DSV0l+BRS6X5c7KRJ/6RFzwyKqJOWyVYvJUIgJCmDmqZvEc6ZJs9uH/MpMKk5ukRbsMTm50OMhf1a02l2g7m441tYUCJI2FrL+Cn+oBEqJIGU5LMvN7RGIViqpw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.80.198) smtp.rcpttodomain=corigine.com smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cUfOAlIj/senuQao52CitP9B0I/dIGQ7MM9RxBnzJyo=; b=HVGEYi5os8fyJPhR1GocL2yJpi+UfqD9IdRFYHB7K1E2zPFBbKBbzBT54lwj43V1ipitotjdtC8Qgz1Lr/K493PWUU9VetLoPD9Vcguqk7KCuXqPI5hqt9ycWkJYl1o217ajhjHj5/JxQVSaSHP3Ulcr/uWPKnWlw+O6CXvy8sM= Received: from BN9PR03CA0062.namprd03.prod.outlook.com (2603:10b6:408:fc::7) by BN0PR02MB8174.namprd02.prod.outlook.com (2603:10b6:408:149::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.12; Tue, 14 Jun 2022 09:21:37 +0000 Received: from BN1NAM02FT018.eop-nam02.prod.protection.outlook.com (2603:10b6:408:fc:cafe::d4) by BN9PR03CA0062.outlook.office365.com (2603:10b6:408:fc::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.13 via Frontend Transport; Tue, 14 Jun 2022 09:21:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.80.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.80.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.80.198; helo=xir-pvapexch01.xlnx.xilinx.com; pr=C Received: from xir-pvapexch01.xlnx.xilinx.com (149.199.80.198) by BN1NAM02FT018.mail.protection.outlook.com (10.13.3.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5332.12 via Frontend Transport; Tue, 14 Jun 2022 09:21:37 +0000 Received: from xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 14 Jun 2022 10:21:36 +0100 Received: from smtp.xilinx.com (172.21.105.198) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 14 Jun 2022 10:21:36 +0100 Envelope-to: jin.liu@corigine.com, dev@dpdk.org, niklas.soderlund@corigine.com, na.wang@corigine.com, peng.zhang@corigine.com, chaoyong.he@corigine.com Received: from [10.71.119.224] (port=59498) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1o12jw-0006Aq-0B; Tue, 14 Jun 2022 10:21:36 +0100 Message-ID: <95cf1563-b99f-968b-6bc4-7dd08c6a3ebe@xilinx.com> Date: Tue, 14 Jun 2022 10:21:35 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 07/14] net/nfp: support NFDK firmware Content-Language: en-US To: Kevin Liu , "dev@dpdk.org" CC: Niklas Soderlund , Diana Wang , Nole Zhang , Chaoyong He References: <20220602015304.710197-1-jin.liu@corigine.com> <20220602015304.710197-8-jin.liu@corigine.com> From: Ferruh Yigit In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bcc96e43-cd53-4614-b09e-08da4de7487f X-MS-TrafficTypeDiagnostic: BN0PR02MB8174:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Sa8rf8Y8ZVCAZjdc0PaxeBJrjIoWbGWbeBCz/6aTMgDWRtfWB46ZvjKj5sLx8nxpC3uCEjDLMbDiuWFzmnaZahYfS1yhcNQIyNihJpN2eR2uGyT3s4qVqWwrfPU11Z6y9kdcPPaHl6bVO2hClfoCMLqkI2eVOJbsvlTGwm/4ymAkLDC4v4mKNVKNdISe3+KdDctfNPCZSPCUapLUjb5dWnjJtdALkwetbnxRqaDE4/UdiG05d4U2LEi+KqU0l7Pyy6pbQocgf0hBLEcNT1X7XObOo9uat8VGUknDRTHFeBGgojHmSE9UGYMP9W/ORnRVAciw8kAQXbGtbX8LnqCB+/AScUEue3Te0+RrdYPs/V6lhoTWaxiYwRRYHuBU4n3ZpWGoUhNTQWj7jlTGu0LTft+n9ry8XeY5wpfz8o2W2C+3XYNEoOw6S7z0OGUEzvEnsVj3dgRMp9t/HYwNPUKL6Zq71zGF7ZVqGReQdzlynEvRjqjo5Q21iHq0eVPgKRQn11yEMoOHpqtcSZzEcfx7VglVr9UvyLmAk2oO5WTyMGNZPZzbVXeBUJ7av9PYyde6Y96dpdBx/DtVRCVF1cwajPw0OcoTGlw4r2WN0i8jMG84YPUa9j/6JlKFTArWhRH0cPehW6GvOblAhonq95+VK02u0Bk8DUiBpJMcgvr8pKxoy5o0oWnuW7YvO08kS0mnzB5FwUlAAxR4LF0csVBmzpMa4ViEmn4hRMwDI19g3nc= X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch01.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230016)(4636009)(36840700001)(46966006)(40470700004)(40460700003)(44832011)(26005)(70586007)(82310400005)(2616005)(8676002)(186003)(426003)(66574015)(336012)(4326008)(47076005)(70206006)(9786002)(54906003)(36756003)(110136005)(8936002)(5660300002)(36860700001)(316002)(31686004)(7636003)(2906002)(53546011)(83380400001)(508600001)(356005)(31696002)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2022 09:21:37.3739 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bcc96e43-cd53-4614-b09e-08da4de7487f X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.80.198]; Helo=[xir-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT018.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR02MB8174 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 6/14/2022 9:49 AM, Kevin Liu wrote: > We also want to just use one function 'nfp_net_tx_queue_release()' to service both NFD3 and NFDk, But we can not get the version of NFD in function 'nfp_net_tx_queue_release()', now get NFD version through 'hw->ver' > Again, it is up to you, but it should be possible to add 'dev' or 'hw' reference to the queue struct, to be able to access the version information. And it can be possible to have something like 'struct fw_ops', set it during initialization and use in rest of the dev_ops. > For the function 'nfp_net_ethdev_ops_mount()', the logic below is in two different C files, nfp_ethdev.c and nfp_ethdev_vf.c And the variable of struct eth_dev_ops is defined as static, if we want to use function both in nfp_ethdev.c and nfp_ethdev_vf.c We need to change the eth_dev_ops variable as non-static, this is not we want. > > > + switch (NFD_CFG_CLASS_VER_of(hw->ver)) { > > + case NFP_NET_CFG_VERSION_DP_NFD3: > > + break; > > + case NFP_NET_CFG_VERSION_DP_NFDK: > > + if (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 5) { > > + PMD_DRV_LOG(ERR, "NFDK must use ABI 5 or newer,found: %d", > > + NFD_CFG_MAJOR_VERSION_of(hw->ver)); > > + return -EINVAL; > > + } > > + break; > > + default: > > + PMD_DRV_LOG(ERR, "The version of firmware is not correct."); > > + return -EINVAL; > My comment was to extract the logic into its own function as it is done is PF, so to have something like 'nfp_netvf_ethdev_ops_mount()'. > -----Original Message----- > From: Ferruh Yigit > Sent: Friday, June 3, 2022 06:54 > To: Kevin Liu ; dev@dpdk.org > Cc: Niklas Soderlund ; Diana Wang ; Nole Zhang ; Chaoyong He > Subject: Re: [PATCH 07/14] net/nfp: support NFDK firmware > > On 6/2/2022 2:52 AM, Jin Liu wrote: >> Modify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, >> will according to the firmware version, mount different driver functions. >> > > Creating a new set of dev_ops for new FW is a way and it works, but it looks like it creates some duplication of the code, and maintaining multiple dev_ops can be difficult (driver already has different ones for PF & VF). > > Another option can be keeping ethdev interface same, but manage different FWs closer to FW, where directly interacted with FW. > Like keeping dev_ops as 'nfp_net_tx_queue_release()' and managing different FW within this function, instead of having two dev_ops, 'nfp_net_nfdk_tx_queue_release()' & 'nfp_net_nfd3_tx_queue_release()'. > If difference is small, this can be better to reduce duplication. > > What is the difference between two FWs, as far as I can see Tx descriptor is different and queue setup is affected, is it only diff? > >> Signed-off-by: Jin Liu >> Signed-off-by: Diana Wang >> Signed-off-by: Peng Zhang >> Signed-off-by: Chaoyong He >> Signed-off-by: Niklas Söderlund > > <...> > >> @@ -296,6 +296,32 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) >> eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; >> eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; >> >> + hw->ctrl_bar = (uint8_t *)pci_dev->mem_resource[0].addr; >> + if (hw->ctrl_bar == NULL) { >> + PMD_DRV_LOG(ERR, >> + "hw->ctrl_bar is NULL. BAR0 not configured"); >> + return -ENODEV; >> + } >> + >> + PMD_INIT_LOG(DEBUG, "ctrl bar: %p", hw->ctrl_bar); >> + >> + hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION); >> + >> + switch (NFD_CFG_CLASS_VER_of(hw->ver)) { >> + case NFP_NET_CFG_VERSION_DP_NFD3: >> + break; >> + case NFP_NET_CFG_VERSION_DP_NFDK: >> + if (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 5) { >> + PMD_DRV_LOG(ERR, "NFDK must use ABI 5 or newer,found: %d", >> + NFD_CFG_MAJOR_VERSION_of(hw->ver)); >> + return -EINVAL; >> + } >> + break; >> + default: >> + PMD_DRV_LOG(ERR, "The version of firmware is not correct."); >> + return -EINVAL; >> + } >> + > > This part seems extracted to its own function for PF ('nfp_net_ethdev_ops_mount()'), why not do the same for VF, to have same logic between them. > >