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 13912A0548; Thu, 8 Sep 2022 18:24:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF48940697; Thu, 8 Sep 2022 18:24:49 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2086.outbound.protection.outlook.com [40.107.237.86]) by mails.dpdk.org (Postfix) with ESMTP id 9EA544021F for ; Thu, 8 Sep 2022 18:24:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JjqPYYovDK8OFGl78LaMtXiNRpoUp79JF7liG8Jr8XFZaYJa2quq2yY/1gM/xSajjvFQUvwUXvmcjqYoso97oRKJZNnOMu22tBYCDUMmICIfw/WeiYzhAUufFTvGgzlIhGHnq56M0QCFoectKPgLkm4xKKT8/IRKFFHjSiUksnCJ9BU3hRljprMr4WXZJtQVCmuC5AEQzu1uta6K5+zuhgbJ8y8c89mBhGIx1zFO338VmJ50WDjzUc1FU+Iw/WUp2Oh4cKN3BiLcgi8mgvv0af8c34bOluuc1ExyBGAifJtj/wQU1p+rLNxMSUmxacxKcVduhFbwrS8dHFXxlHsCFw== 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=rpsGZsUXzpFACoSE/I58pCbdL4srJvx23w7TBsopvOU=; b=fZvJkQYOtfc923alDe1sdEFuQaqkdh+ijftfsmG3U8ltudkfTh2rm8I7e/LbeZorKE0pd1qXTq6REi8N9qdAuuwfQC2joBy7yB3IUPrpr3ltupQOpwLH9J/zZETEGwLEhvWbogvIfxGrdqAbNsq9YNar9Kgvkfg47ke6M2ZICxdfPfVTNsupeNsWVJPBfiLM3wMFP2kEOHeTwgzepg8q9q0wIACaddzyJqWZaY14jTJbf9NfB0TsW/Y9M3IwRJaB7DzhSudHH3r1mgotsLlPMXygaOrjhsjmxnZPDhmNons4qHGV8RZV8hNvBRd0EEhaKu+cN19XTvzjyA3J5Pob5w== 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=rpsGZsUXzpFACoSE/I58pCbdL4srJvx23w7TBsopvOU=; b=ISVqgnWAoeo5uqlmbc/T5CN6Uz4Z4l799t+KKfactFosFWQyyC5qq8LjdeByQ7zeGEPEIuKqBbz/cZQuT0R/pBfSv55iamS54WTYOp25rM0sTAO8Nm2yANXWCtV6UFaBtUJG5v9wls+K0mb+JHTTv6vD4rUBKcuxTYhHNp80ccM= Received: from SN7PR18CA0007.namprd18.prod.outlook.com (2603:10b6:806:f3::27) by BN8PR02MB6434.namprd02.prod.outlook.com (2603:10b6:408:bd::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.16; Thu, 8 Sep 2022 16:24:36 +0000 Received: from SN1NAM02FT0056.eop-nam02.prod.protection.outlook.com (2603:10b6:806:f3:cafe::db) by SN7PR18CA0007.outlook.office365.com (2603:10b6:806:f3::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.18 via Frontend Transport; Thu, 8 Sep 2022 16:24:36 +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 SN1NAM02FT0056.mail.protection.outlook.com (10.97.4.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5612.13 via Frontend Transport; Thu, 8 Sep 2022 16:24:36 +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.2375.24; Thu, 8 Sep 2022 17:24:35 +0100 Received: from smtp.xilinx.com (172.21.105.198) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server id 15.1.2375.24 via Frontend Transport; Thu, 8 Sep 2022 17:24:35 +0100 Envelope-to: chaoyong.he@corigine.com, dev@dpdk.org, oss-drivers@corigine.com, niklas.soderlund@corigine.com Received: from [10.71.194.74] (port=62274) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1oWKKQ-00073u-MO; Thu, 08 Sep 2022 17:24:35 +0100 Message-ID: <49888fb1-e16a-9d55-9855-7e7807922dea@xilinx.com> Date: Thu, 8 Sep 2022 17:24:34 +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: , References: <1662626702-17254-1-git-send-email-chaoyong.he@corigine.com> <1662626702-17254-6-git-send-email-chaoyong.he@corigine.com> From: Ferruh Yigit In-Reply-To: <1662626702-17254-6-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1NAM02FT0056:EE_|BN8PR02MB6434:EE_ X-MS-Office365-Filtering-Correlation-Id: 26bd221c-d619-4352-2c22-08da91b69f22 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jxBJJIN5NHsZp9AE9vG0breMKJwCITtxAPuN0HTAGjwMO2VJqtQ0ShIX39iPOe4xIChGVUwQcOQ7E/WI4py5Kwe+iDv3KC03ZMgEb9JAT2INJvwVF5UBIaw87yRoRBbUB/zoHpNQkDh7GCZDRjRNb2VVmfE9rwWMameK9hnm8Bc8JFK+PWY9cMvZJADGetZ2279nECgEJ32AOzFCVk0jFzYn5dCplDT29OVlof7WMyDo/CVyf3nzv9beHTTEvKZ6EPI9u/QBXPmT/PI+DFX245q09bg9MZAZpHz1fXmJfpF15G/yaeWzrrgZFwgTeYsXuWN7bPnF2PCwWzQHlGnfrLlT/ph3JnB2dGYorySsm8KgEhYRPu2S8OViaGCg5Wm2MBnJJavQdTb9DB5gkxAuSMACWQqnNGIo9oQ/T4t35VMiZEgXMqkLO4eXtE3nkmxCCZLxIiqexiD0OoGawJivQ6157BODS44yM36g+GPqJ9AYZSugoVkHKKb8sKrrbtp12g2kQjhqLY27tBXqFZ/iirMJIqAcqAdh6FvIGxtwK8HAIFxkh/6cUy/jsU3cys4t9WikQbuDKmS2BeQKrZkqUl7p+jwbXRY4z2+aNXuKXjsvOBoixdazsz2FWkHpHEfina7XynpiNbzabx4EmTcDy6FmsgFPJy4777Z4anSOqtfQ0mQnWQJ5vYr9g6g0TWp2pe27QQCp/jHFBuQ+abQy8QEryxD2jY3XquTXmEkGXXqpToAQPKq4uGgqr6vVb11q7lHwHc0B2aeBoTmo5bVcAPr5ZA9QBvWdLe0AZmRrGcX4R7Z6IghBddIuCQNTnMWXE0bd0Am+bKube/mx0L7uVA== 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)(396003)(136003)(376002)(346002)(39860400002)(36840700001)(40470700004)(46966006)(36860700001)(54906003)(40460700003)(110136005)(316002)(31696002)(2906002)(82310400005)(70206006)(356005)(8936002)(9786002)(7636003)(82740400003)(40480700001)(5660300002)(44832011)(70586007)(31686004)(8676002)(4326008)(2616005)(36756003)(478600001)(426003)(336012)(47076005)(186003)(26005)(53546011)(41300700001)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2022 16:24:36.3895 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 26bd221c-d619-4352-2c22-08da91b69f22 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: SN1NAM02FT0056.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR02MB6434 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/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 > --- > drivers/net/nfp/flower/nfp_flower.c | 398 ++++++++++++++++++++++++- > drivers/net/nfp/flower/nfp_flower.h | 6 + > drivers/net/nfp/flower/nfp_flower_ovs_compat.h | 37 +++ Can you please detail why OVS specific header is required? Having application specific code in PMD can be sign of some design issue, that is why can you please explain more what it does? <...> > +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?