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 A82B8A0503; Thu, 19 May 2022 10:04:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 63CCD42B72; Thu, 19 May 2022 10:04:45 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 930BE42686 for ; Thu, 19 May 2022 10:04:42 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 115) id 58D9592; Thu, 19 May 2022 11:04:42 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mail1.oktetlabs.ru X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_DISCARD autolearn=no autolearn_force=no version=3.4.6 Received: from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17]) by shelob.oktetlabs.ru (Postfix) with ESMTP id 275948C; Thu, 19 May 2022 11:04:41 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 275948C Authentication-Results: shelob.oktetlabs.ru/275948C; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: Pankaj Gupta , Jochen Behrens Cc: dev@dpdk.org Subject: [PATCH v6 2/9] net/vmxnet3: implement RETA query and RETA update Date: Thu, 19 May 2022 11:04:08 +0300 Message-Id: <20220519080415.1577680-3-andrew.rybchenko@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220519080415.1577680-1-andrew.rybchenko@oktetlabs.ru> References: <20220503042257.15626-1-pagupta@vmware.com> <20220519080415.1577680-1-andrew.rybchenko@oktetlabs.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Pankaj Gupta Add RETA query and RETA update support for VMXNET3. Tested, using testpmd, for different hardware versions on ESXi 7.0 Update 2. Signed-off-by: Pankaj Gupta Reviewed-by: Jochen Behrens --- drivers/net/vmxnet3/vmxnet3_ethdev.c | 67 ++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index a7e1e5fef5..d5f9903946 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -95,6 +95,14 @@ static int vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr); static void vmxnet3_process_events(struct rte_eth_dev *dev); static void vmxnet3_interrupt_handler(void *param); +static int +vmxnet3_rss_reta_update(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size); +static int +vmxnet3_rss_reta_query(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size); static int vmxnet3_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id); static int vmxnet3_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, @@ -137,6 +145,8 @@ static const struct eth_dev_ops vmxnet3_eth_dev_ops = { .tx_queue_release = vmxnet3_dev_tx_queue_release, .rx_queue_intr_enable = vmxnet3_dev_rx_queue_intr_enable, .rx_queue_intr_disable = vmxnet3_dev_rx_queue_intr_disable, + .reta_update = vmxnet3_rss_reta_update, + .reta_query = vmxnet3_rss_reta_query, }; struct vmxnet3_xstats_name_off { @@ -1696,3 +1706,60 @@ RTE_PMD_REGISTER_PCI_TABLE(net_vmxnet3, pci_id_vmxnet3_map); RTE_PMD_REGISTER_KMOD_DEP(net_vmxnet3, "* igb_uio | uio_pci_generic | vfio-pci"); RTE_LOG_REGISTER_SUFFIX(vmxnet3_logtype_init, init, NOTICE); RTE_LOG_REGISTER_SUFFIX(vmxnet3_logtype_driver, driver, NOTICE); + +static int +vmxnet3_rss_reta_update(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size) +{ + int i, idx, shift; + struct vmxnet3_hw *hw = dev->data->dev_private; + struct VMXNET3_RSSConf *dev_rss_conf = hw->rss_conf; + + if (reta_size != dev_rss_conf->indTableSize) { + PMD_DRV_LOG(ERR, + "The size of hash lookup table configured (%d) doesn't match " + "the supported number (%d)", + reta_size, dev_rss_conf->indTableSize); + return -EINVAL; + } + + for (i = 0; i < reta_size; i++) { + idx = i / RTE_ETH_RETA_GROUP_SIZE; + shift = i % RTE_ETH_RETA_GROUP_SIZE; + if (reta_conf[idx].mask & RTE_BIT64(shift)) + dev_rss_conf->indTable[i] = (uint8_t)reta_conf[idx].reta[shift]; + } + + VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, + VMXNET3_CMD_UPDATE_RSSIDT); + + return 0; +} + +static int +vmxnet3_rss_reta_query(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size) +{ + int i, idx, shift; + struct vmxnet3_hw *hw = dev->data->dev_private; + struct VMXNET3_RSSConf *dev_rss_conf = hw->rss_conf; + + if (reta_size != dev_rss_conf->indTableSize) { + PMD_DRV_LOG(ERR, + "Size of requested hash lookup table (%d) doesn't " + "match the configured size (%d)", + reta_size, dev_rss_conf->indTableSize); + return -EINVAL; + } + + for (i = 0; i < reta_size; i++) { + idx = i / RTE_ETH_RETA_GROUP_SIZE; + shift = i % RTE_ETH_RETA_GROUP_SIZE; + if (reta_conf[idx].mask & RTE_BIT64(shift)) + reta_conf[idx].reta[shift] = dev_rss_conf->indTable[i]; + } + + return 0; +} -- 2.30.2