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 EA291A0540; Fri, 9 Sep 2022 14:19:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 95F9940A7E; Fri, 9 Sep 2022 14:19:35 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2071.outbound.protection.outlook.com [40.107.243.71]) by mails.dpdk.org (Postfix) with ESMTP id F25A14003F for ; Fri, 9 Sep 2022 14:19:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T5Cmv9K2oHKB9UhSknojGTWs4+P50kg+ZYkZNlw2loEMtOGim7jtJW9Ia8TNAVpv5uuzLdinv9k7ikziyaV9BrQFZkHlR4ARLFNujTE8UjI/an/R9e71+9HAYp/Zl6rE7w1r/7kL+ETqBq17DPXRfUOC+PrMu+jBEEtC0y4H9uOfs6iZdUyXGMywonGaO4/OatvoEZqC1F5gYn/khUSDcklZxjzOkHvgMydhEOPRHJrgcoxE1aLwDN4YXX6n432scniu3pJrEG3CCRKSGvvKb20DFP4+ZOyY88uu7/3qo24C8132xl2HBcAdqrH4WPtp4lvSzSWRO6GvWytLWSlreA== 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=L8qO9bBoqdrhne9uqu2lrzMmEIcewdabN2U7kv26Hhc=; b=V64Z8AbLzqOo8vnG6TExjlg6TTulEHJbZ/23r6lspBzR2wsp3rHL0xf41N9KWnHSfOF6wsJm8KZg/3AoJ95RRCjspn31Y4C2qjEo8BSXIuhLOR/6xF/4tgb+7tla3cm3wDrBp/yJNRoCvWpxwat5Du20DLEOtGLCCImQxOlkqn9WM94kZOHlvGrv+VGjpH6X07SYhlD5tnvzkubFJmWc2sRG0+aHAmgxgiOmG+YkFra17WkEv054uipJ/XeEgh6HWrIUwBBBupxbEa7XSrs3ahH1mt8JJn8LOZ6dDXKUOjvdnM/wvFMUq6b4YTfimLUrFdrm/FXnktXPR0jIuYNTXw== 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=L8qO9bBoqdrhne9uqu2lrzMmEIcewdabN2U7kv26Hhc=; b=mJ7m1izlKZDk+OZJxtU83oS7r/VgLEZV222OT8QWPOEeIMST+PJeet8orbg3HEwUaiqGUmI6xUMOgUihLQMVCW2O05LPwiciO8kYt7QFQrbsLeqWq1EaW8pRdHUxDkNEoCTRre3wXnhqOEbVcBA9tRLWQBWl3zpZNAou/SolBkc= Received: from SN7PR18CA0020.namprd18.prod.outlook.com (2603:10b6:806:f3::14) by DM8PR02MB8199.namprd02.prod.outlook.com (2603:10b6:8:3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.14; Fri, 9 Sep 2022 12:19:31 +0000 Received: from SN1NAM02FT0039.eop-nam02.prod.protection.outlook.com (2603:10b6:806:f3:cafe::b1) by SN7PR18CA0020.outlook.office365.com (2603:10b6:806:f3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.20 via Frontend Transport; Fri, 9 Sep 2022 12:19:30 +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 SN1NAM02FT0039.mail.protection.outlook.com (10.97.5.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5612.13 via Frontend Transport; Fri, 9 Sep 2022 12:19:29 +0000 Received: from xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) 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.2375.24; Fri, 9 Sep 2022 13:19:27 +0100 Received: from smtp.xilinx.com (172.21.105.197) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server id 15.1.2375.24 via Frontend Transport; Fri, 9 Sep 2022 13:19:27 +0100 Envelope-to: chaoyong.he@corigine.com, oss-drivers@corigine.com, niklas.soderlund@corigine.com, dev@dpdk.org Received: from [10.71.194.74] (port=39060) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1oWcyl-0004DA-GI; Fri, 09 Sep 2022 13:19:27 +0100 Message-ID: <82a90702-3873-02bd-e804-ba66aad2d0ef@xilinx.com> Date: Fri, 9 Sep 2022 13:19:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH v8 05/12] net/nfp: add flower PF setup logic Content-Language: en-US To: Chaoyong He CC: oss-drivers , Niklas Soderlund , "dev@dpdk.org" References: <1662626702-17254-1-git-send-email-chaoyong.he@corigine.com> <1662626702-17254-6-git-send-email-chaoyong.he@corigine.com> <49888fb1-e16a-9d55-9855-7e7807922dea@xilinx.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-TrafficTypeDiagnostic: SN1NAM02FT0039:EE_|DM8PR02MB8199:EE_ X-MS-Office365-Filtering-Correlation-Id: 592cb3ab-86c3-4073-1a2f-08da925d8b43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sVtPM0q9vTUvDB/z/ddHOxas/dGA5vbLawnBRRdnrLY6A4tOZkHQzBClrWuq5U+p0qWm5bIjZHTVnPD2+H+1765NWZymty1YUxi84dLbhT+IahrN7vBDsEnzSyulE2hZJnesc8nZhjPv2XLccYPLnLgC7ldO96Ant5zzCiTNS5bGDprvIfD1D7m7vgSiC0uxIdK4r/wYlVcJ8OQgeZ+zHqF2Sa/Z7hu5afxoGx4pOgKjgzIjv+rr6RWmGeO3Zyr41EBbKN6quTHrswhSQXVWOB5X0vra3xXKdtx6J6FxUKrLxujyjLSu4FYKku2H1aY7S/sSh8mYshdP5co8jEw9V1msxH8xMYwVZjLanv55kg7s0laFB0J6ydgS7Ie76HSSP5779GHeUViAhbVFfAX2N99JB4cXUeG8YGGtLfyonm2khbmFl0Yd+3GtjIbpY9L9+Hc9wecYiEyU1GZfaci3yFy1IiqnxPU4W1HmKMxtR76iYvI2eSl/5fUkDY+zV0kUm6sHs/DkbcvSufj/jMrtRByBrcL/rpQBS7hv7wVx6QMy5ZeU1sZPS8NvvzsG8AFMP7Dq25VNGI3wsiQYX1sLO5i2wVVD7w8Dejxz2cVEWix8tkTqhV3nJb08rqJldIKw2LMrx113jQTlEt6zqxqCfhQkd2/BhdRFauLCA3pQC642pYHzT5UwT4QZfV6TkUXsT8pVNaEIcanwG/FbhLKDyb96SX5RlWpxO+Pk3dooYhYggEzycX5kPRo5H/xkG4/b8oGhZ661N3fUPinTDKHN33GuDZQhDM409V1NJatRZ47tIQkQElofYt0VO0ihL6edrXrl+KfEte4Gl/8hZ14VWA== 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:(13230016)(4636009)(39860400002)(136003)(346002)(396003)(376002)(46966006)(40470700004)(36840700001)(9786002)(8936002)(36860700001)(2616005)(47076005)(31686004)(426003)(36756003)(186003)(44832011)(336012)(82310400005)(2906002)(82740400003)(53546011)(26005)(70586007)(4326008)(6916009)(8676002)(70206006)(316002)(356005)(478600001)(40460700003)(31696002)(54906003)(41300700001)(40480700001)(5660300002)(7636003)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2022 12:19:29.0047 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 592cb3ab-86c3-4073-1a2f-08da925d8b43 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: SN1NAM02FT0039.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR02MB8199 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 9/9/2022 3:36 AM, Chaoyong He wrote: >> On 9/8/2022 9:44 AM, Chaoyong He wrote: >>> Adds the vNIC initialization logic for the flower PF vNIC. The flower >>> firmware exposes this vNIC for the purposes of fallback traffic in the >>> switchdev use-case. >>> >>> Adds minimal dev_ops for this PF device. Because the device is being >>> exposed externally to DPDK it should also be configured using DPDK >>> helpers like rte_eth_configure(). For these helpers to work the flower >>> logic needs to implements a minimal set of dev_ops. >>> >>> Signed-off-by: Chaoyong He >>> Reviewed-by: Niklas Söderlund <...> >>> +static int >>> +nfp_flower_init_pf_vnic(struct nfp_net_hw *hw) { >>> + int ret; >>> + uint16_t i; >>> + uint16_t n_txq; >>> + uint16_t n_rxq; >>> + uint16_t port_id; >>> + unsigned int numa_node; >>> + struct rte_mempool *mp; >>> + struct nfp_pf_dev *pf_dev; >>> + struct rte_eth_dev *eth_dev; >>> + struct nfp_app_fw_flower *app_fw_flower; >>> + >>> + static const struct rte_eth_conf port_conf = { >>> + .rxmode = { >>> + .mq_mode = RTE_ETH_MQ_RX_RSS, >>> + .offloads = RTE_ETH_RX_OFFLOAD_CHECKSUM, >>> + }, >>> + .txmode = { >>> + .mq_mode = RTE_ETH_MQ_TX_NONE, >>> + }, >>> + }; >>> + >>> + /* Set up some pointers here for ease of use */ >>> + pf_dev = hw->pf_dev; >>> + app_fw_flower = NFP_PRIV_TO_APP_FW_FLOWER(pf_dev- >>> app_fw_priv); >>> + >>> + /* >>> + * Perform the "common" part of setting up a flower vNIC. >>> + * Mostly reading configuration from hardware. >>> + */ >>> + ret = nfp_flower_init_vnic_common(hw, "pf_vnic"); >>> + if (ret != 0) >>> + goto done; >>> + >>> + hw->eth_dev = rte_eth_dev_allocate("nfp_pf_vnic"); >>> + if (hw->eth_dev == NULL) { >>> + ret = -ENOMEM; >>> + goto done; >>> + } >>> + >>> + /* Grab the pointer to the newly created rte_eth_dev here */ >>> + eth_dev = hw->eth_dev; >>> + >>> + numa_node = rte_socket_id(); >>> + >>> + /* Fill in some of the eth_dev fields */ >>> + eth_dev->device = &pf_dev->pci_dev->device; >>> + eth_dev->data->dev_private = hw; >>> + >>> + /* Create a mbuf pool for the PF */ >>> + app_fw_flower->pf_pktmbuf_pool = nfp_flower_pf_mp_create(); >>> + if (app_fw_flower->pf_pktmbuf_pool == NULL) { >>> + ret = -ENOMEM; >>> + goto port_release; >>> + } >>> + >>> + mp = app_fw_flower->pf_pktmbuf_pool; >>> + >>> + /* Add Rx/Tx functions */ >>> + eth_dev->dev_ops = &nfp_flower_pf_vnic_ops; >>> + >>> + /* PF vNIC gets a random MAC */ >>> + eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", >> RTE_ETHER_ADDR_LEN, 0); >>> + if (eth_dev->data->mac_addrs == NULL) { >>> + ret = -ENOMEM; >>> + goto mempool_cleanup; >>> + } >>> + >>> + rte_eth_random_addr(eth_dev->data->mac_addrs->addr_bytes); >>> + rte_eth_dev_probing_finish(eth_dev); >>> + >>> + /* Configure the PF device now */ >>> + n_rxq = hw->max_rx_queues; >>> + n_txq = hw->max_tx_queues; >>> + port_id = hw->eth_dev->data->port_id; >>> + >>> + ret = rte_eth_dev_configure(port_id, n_rxq, n_txq, &port_conf); >> >> Still not sure about PMD calling 'rte_eth_dev_configure()', can you please >> give more details on what specific configuration is expected with that call? > > The main configuration we need is the number of rx/tx queue. > So we should use the internal api `eth_dev_rx/tx_queue_config` to instead? > nb_rx_q/nb_tx_q are parameters provided by user (via rte_eth_dev_configure()), won't is wrong for PMD to set a value on its own? Why nb_rx_q/nb_tx_q are required in the probe() stage? Probe stage is not to configure the device.