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 5DEECA0548; Fri, 3 Jun 2022 00:53:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E27140691; Fri, 3 Jun 2022 00:53:49 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2052.outbound.protection.outlook.com [40.107.96.52]) by mails.dpdk.org (Postfix) with ESMTP id 8EAC84021E for ; Fri, 3 Jun 2022 00:53:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a+5WpR1cKCOAHkfgzVdAFzy+v9qE2EisNM3e9KT0RsVQesXcovy8V40mMe1SMs+Qp6EWuns6sXW/P6GPrAkE+aTr4bsUTJWcvSjwa98PcoyfwsVT6mVc8sKb9jk6CupRKrswl0VBn8u3hcHYOOiWJBQ4ZDe2uFhlnRNBDlbPjDrnDhgv/THfEh/VrDv7F5vvnrLvAii8DME+3baUdTuBZ7rBY0/jqlY4HGCBV9+eHu7x09JZUE8mamjKXoDIDb/cw+aQ7GMmkKZLrJyE93V1e97b9qTSAVpRB9tWaaLfOjEvt9KONgk5meVbV75txDkSz3QWua7Wv3wO0Q7no6AuMg== 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=YUsoTtpfSgTD3M4HaKHcLs/PO2wsjvoMGOV1uXgNEUI=; b=lD/1U7HRoSZ8uzF/gIdI6TpXXfftSD7AGDtv0mgEx6l4tFNIb6ebsTy+9xCBRqnfjygHGBzqIxd1F0g4dLqbjbgQbyeOc9mRYlpRMYnrDTH5QmqoJIO/iPTm+agyYdUKOnNEgoEzq0moqXfA6iaK+fHahydJS+It4wSF/ofsR3N0SYcMEG3DT/Ghh7bCIvVmRKLTFWxW9rlAWXCnlJr3Tu2iUuEmkbJlgt+iOYrTYIAtgDGv0rleplc4+vUIvTPjzmKjoYS7A/XFvn8C/JY049ta8Jwam8/wKGfmxLojVN0y2e8tWKPX+P96KBXM+yHdG2Rk/A9EjzBeINDjUFH4Tw== 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=YUsoTtpfSgTD3M4HaKHcLs/PO2wsjvoMGOV1uXgNEUI=; b=lxbPtY/wFV5ycxmyZtF8o/O5QfzijoKwcMeAuisWIWdRBFozBcfg01Dq603F+V5ocag5U7Rt05OUE4q6CX4TJMfE/JMM7WFKAlAthvBUKkGTk5QUy8tHqvCGed5kiBqfVtaAQD3b9+TlGgIRLXJBzHEScAWy9nx3pyyIQ+QjQTo= Received: from SA0PR11CA0145.namprd11.prod.outlook.com (2603:10b6:806:131::30) by BL0PR02MB4530.namprd02.prod.outlook.com (2603:10b6:208:42::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12; Thu, 2 Jun 2022 22:53:45 +0000 Received: from SN1NAM02FT0022.eop-nam02.prod.protection.outlook.com (2603:10b6:806:131:cafe::1) by SA0PR11CA0145.outlook.office365.com (2603:10b6:806:131::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12 via Frontend Transport; Thu, 2 Jun 2022 22:53:45 +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-pvapexch02.xlnx.xilinx.com; pr=C Received: from xir-pvapexch02.xlnx.xilinx.com (149.199.80.198) by SN1NAM02FT0022.mail.protection.outlook.com (10.97.5.0) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5314.12 via Frontend Transport; Thu, 2 Jun 2022 22:53:44 +0000 Received: from xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Thu, 2 Jun 2022 23:53:43 +0100 Received: from smtp.xilinx.com (172.21.105.197) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Thu, 2 Jun 2022 23:53:43 +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.116.16] (port=61965) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nwthH-0005aY-3s; Thu, 02 Jun 2022 23:53:43 +0100 Message-ID: Date: Thu, 2 Jun 2022 23:53:42 +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: Jin Liu , CC: , Diana Wang , Peng Zhang , Chaoyong He References: <20220602015304.710197-1-jin.liu@corigine.com> <20220602015304.710197-8-jin.liu@corigine.com> From: Ferruh Yigit In-Reply-To: <20220602015304.710197-8-jin.liu@corigine.com> 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: 6f4b28e0-4475-42b5-41b9-08da44eabf87 X-MS-TrafficTypeDiagnostic: BL0PR02MB4530: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: 36l56UV23kLYKgQQDIHQCKHAFn33G7v1ssmYAvsZ85e+Xxq42rj58+WxepR8AMl8UmNPqPmEI+S/yzWIGcAdmq3l3hQir4m5WnM+kG8voNO7AefHgxBltQR+AaXuTRWRAigmzN7yNj4lt5BugMkkTwA2IxDEXOmmVhmKIb21evuYG1nFgHvOYnTA2Q/310t6Gcimns6ShcCytzgfUK23sLU6bUBT1IbpMz0pVsx4S0FIrA+vCg9BN2SAXbNjyg08Tl8mloTB/y9hOW5HuClCHPFh00EvBp36ziRHZX5MuSLi6q95JSaEAOu/9t89GobgYffZJXJx7blmAxBjfhMtmo6Rw5I1r9rXNROjibyCtWbOS0KJoJ4UpBv20zUB4kG/vLtB8R1Br5pW42tvvbXrTUBQZRDqLAfDu3gGsm/B/teMECQn5bapamEnUN90hrLEgNXXBSxn7rQynHt+eWFYB0paCLlgQgfw2h2K1sPW57r/LhubHbPaHyv+LkCLJnxYJQk26M7M4w9Qifc2N2mqhGh6jCICIAF20tGNK2CQ8yvobTZlcopBo7Qm1gr3VfhGnlWH2r/7Wgw9kdmppJv+aR2715hxFAdyb6ULSfkK3y1WcvkshqYSbijMFI1llS3Fya9kSxy2riUI03T6/1+ePwvqhW495wL1Uk3EcOYvdLaTfJFbTcQ/CBBxMWX5sBuqh5QSiqrvQOLWOCs1XhwrBCb/QTghuRNgofLklezL0Ak= X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch02.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(8936002)(2616005)(8676002)(40460700003)(110136005)(36756003)(36860700001)(31696002)(82310400005)(508600001)(31686004)(4326008)(7636003)(44832011)(5660300002)(356005)(186003)(316002)(26005)(83380400001)(54906003)(9786002)(53546011)(47076005)(426003)(336012)(70586007)(70206006)(2906002)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2022 22:53:44.9882 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f4b28e0-4475-42b5-41b9-08da44eabf87 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-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0022.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB4530 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/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.