From patchwork Thu Jul 29 13:47:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Kuhn X-Patchwork-Id: 96408 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 370F7A034F; Thu, 29 Jul 2021 15:47:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BE5AE4111D; Thu, 29 Jul 2021 15:47:40 +0200 (CEST) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by mails.dpdk.org (Postfix) with ESMTP id 7EA9A4111C for ; Thu, 29 Jul 2021 15:47:38 +0200 (CEST) Received: by mail-wr1-f52.google.com with SMTP id z4so7025880wrv.11 for ; Thu, 29 Jul 2021 06:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m/mvSOjr5ciNhZc2JgxfCCC82PVK6Fz79Y//9z2zASU=; b=pr2+frdNMFwy/Cqz0V2FlWANqS5DOotREljiAtgWzDGM4YcDvXWlw8iBmTtfzWKiI1 cv4MckPEL9dkpNhSjb9QYHNZU7pPZv8ces7BRdgIRKedgQ2Jbv2W8NhnfDqpCeOTEq0s 6hjKnF+gZvkS8fMF75KMhjxqo8HwRVZdOeS+uCinnJJfRfa+mBv0NyQaw6CWQixSSrdL 4LmG8d6YD7Okmzb9c2mhOyyHroYsgbswpPAJYIEr1Fm7iVPgjS5DzKowuo5qNGmT7UKb X717Pg2GRVHyk/Zsgo+uHNzWnex7mbnookzPLNB4vTmDidhhF8WVrcQxmxXoyxQ6coRe mRhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m/mvSOjr5ciNhZc2JgxfCCC82PVK6Fz79Y//9z2zASU=; b=rjyKjW5Bqyd2znnlzkZ9rNwiuDcuo6dYgDyI+CpHATXSxGXfH4lGf4+kueMguV8Jx1 1MUCZkSS3m5OrQJv9zzwUQJerKWSnxmcM3RwKAU7JuOAlTg4yaWVSEPjDIn6iEPa7H/u /kOnW4ha19Mly3Mdy5D6bZd3Rda0kyim2spYXFIIBeNHxY5wbvQZHFudLkUeMi5F9SPX Dk3yGBFgJY/cwnjfE/2rHtGXGrT5HD+XcJypS5PgEsMRwgmCvkXda+k23AZIHCtwzDTV 3rMwhszm3HH0KaFlkxueezlkaAnYIBK3IdnPEVA+C49GTcqfgtGXaE6XU4SisWvdHFH7 bqHA== X-Gm-Message-State: AOAM531kmdT7IdM3q8gtk/n5+XUeL3XvS+rHCZljETWjHLWMWu/tA8dA BBe8b85ajr8M7uowGqDq4KvPYiKb2IZQ3mq150Hf3Bd9j7u14W9lT5VvWNY9noE++NIPT2yhxEc e8VftsiZTyHZQFhxMsXWdVX3mR7fBcWtXcHiFzn4nhsO84l7pBZDgWjvJYwxbXvqJ X-Google-Smtp-Source: ABdhPJy6sHTrfVoAieg7EKrqpzh9yXslaH2G+S8EatgXwZg1KPbQH+sJR3CEMj8phJlEFdM82U/vsQ== X-Received: by 2002:adf:fc0c:: with SMTP id i12mr4954729wrr.373.1627566458087; Thu, 29 Jul 2021 06:47:38 -0700 (PDT) Received: from localhost.localdomain (dsl-197-245-41-228.voxdsl.co.za. [197.245.41.228]) by smtp.gmail.com with ESMTPSA id v2sm3498246wro.48.2021.07.29.06.47.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jul 2021 06:47:37 -0700 (PDT) From: Heinrich Kuhn To: dev@dpdk.org Cc: Heinrich Kuhn , Simon Horman Date: Thu, 29 Jul 2021 15:47:08 +0200 Message-Id: <20210729134711.35870-5-heinrich.kuhn@netronome.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210729134711.35870-1-heinrich.kuhn@netronome.com> References: <20210716083545.34444-1-heinrich.kuhn@netronome.com> <20210729134711.35870-1-heinrich.kuhn@netronome.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 4/7] net/nfp: prototype common functions in header file 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 Sender: "dev" The majority of "ethdev" type functions are used for both PF devices and VF devices. Prototype these functions in the nfp_net_pmd header file in preparation of splitting PF and VF specific functions. Signed-off-by: Heinrich Kuhn Signed-off-by: Simon Horman --- drivers/net/nfp/nfp_net.c | 87 +++++++++++++---------------------- drivers/net/nfp/nfp_net_pmd.h | 49 ++++++++++++++++++++ 2 files changed, 81 insertions(+), 55 deletions(-) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index af94219729..d42d267c6a 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -55,35 +55,12 @@ /* Prototypes */ static int nfp_net_close(struct rte_eth_dev *dev); -static int nfp_net_configure(struct rte_eth_dev *dev); -static void nfp_net_dev_interrupt_handler(void *param); -static void nfp_net_dev_interrupt_delayed_handler(void *param); -static int nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); -static int nfp_net_infos_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); static int nfp_net_init(struct rte_eth_dev *eth_dev); static int nfp_pf_init(struct rte_pci_device *pci_dev); static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev); static int nfp_pci_uninit(struct rte_eth_dev *eth_dev); static int nfp_init_phyports(struct nfp_pf_dev *pf_dev); -static int nfp_net_link_update(struct rte_eth_dev *dev, int wait_to_complete); -static int nfp_net_promisc_enable(struct rte_eth_dev *dev); -static int nfp_net_promisc_disable(struct rte_eth_dev *dev); -static int nfp_net_start(struct rte_eth_dev *dev); -static int nfp_net_stats_get(struct rte_eth_dev *dev, - struct rte_eth_stats *stats); -static int nfp_net_stats_reset(struct rte_eth_dev *dev); static int nfp_net_stop(struct rte_eth_dev *dev); -static int nfp_net_rss_config_default(struct rte_eth_dev *dev); -static int nfp_net_rss_hash_update(struct rte_eth_dev *dev, - struct rte_eth_rss_conf *rss_conf); -static int nfp_net_rss_reta_write(struct rte_eth_dev *dev, - struct rte_eth_rss_reta_entry64 *reta_conf, - uint16_t reta_size); -static int nfp_net_rss_hash_write(struct rte_eth_dev *dev, - struct rte_eth_rss_conf *rss_conf); -static int nfp_set_mac_addr(struct rte_eth_dev *dev, - struct rte_ether_addr *mac_addr); static int nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp, struct nfp_eth_table *nfp_eth_table, @@ -138,7 +115,7 @@ __nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t update) * Write the update word to the BAR and ping the reconfig queue. Then poll * until the firmware has acknowledged the update by zeroing the update word. */ -static int +int nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t ctrl, uint32_t update) { uint32_t err; @@ -174,7 +151,7 @@ nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t ctrl, uint32_t update) * before any other function in the Ethernet API. This function can * also be re-invoked when a device is in the stopped state. */ -static int +int nfp_net_configure(struct rte_eth_dev *dev) { struct rte_eth_conf *dev_conf; @@ -217,7 +194,7 @@ nfp_net_configure(struct rte_eth_dev *dev) return 0; } -static void +void nfp_net_enable_queues(struct rte_eth_dev *dev) { struct nfp_net_hw *hw; @@ -241,7 +218,7 @@ nfp_net_enable_queues(struct rte_eth_dev *dev) nn_cfg_writeq(hw, NFP_NET_CFG_RXRS_ENABLE, enabled_queues); } -static void +void nfp_net_disable_queues(struct rte_eth_dev *dev) { struct nfp_net_hw *hw; @@ -266,14 +243,14 @@ nfp_net_disable_queues(struct rte_eth_dev *dev) hw->ctrl = new_ctrl; } -static void +void nfp_net_params_setup(struct nfp_net_hw *hw) { nn_cfg_writel(hw, NFP_NET_CFG_MTU, hw->mtu); nn_cfg_writel(hw, NFP_NET_CFG_FLBUFSZ, hw->flbufsz); } -static void +void nfp_net_cfg_queue_setup(struct nfp_net_hw *hw) { hw->qcp_cfg = hw->tx_bar + NFP_QCP_QUEUE_ADDR_SZ; @@ -281,7 +258,7 @@ nfp_net_cfg_queue_setup(struct nfp_net_hw *hw) #define ETH_ADDR_LEN 6 -static void +void nfp_eth_copy_mac(uint8_t *dst, const uint8_t *src) { int i; @@ -320,7 +297,7 @@ nfp_net_vf_read_mac(struct nfp_net_hw *hw) memcpy(&hw->mac_addr[4], &tmp, 2); } -static void +void nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac) { uint32_t mac0 = *(uint32_t *)mac; @@ -368,7 +345,7 @@ nfp_set_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) return 0; } -static int +int nfp_configure_rx_interrupt(struct rte_eth_dev *dev, struct rte_intr_handle *intr_handle) { @@ -412,7 +389,7 @@ nfp_configure_rx_interrupt(struct rte_eth_dev *dev, return 0; } -static uint32_t +uint32_t nfp_check_offloads(struct rte_eth_dev *dev) { struct nfp_net_hw *hw; @@ -748,7 +725,7 @@ nfp_net_close(struct rte_eth_dev *dev) return 0; } -static int +int nfp_net_promisc_enable(struct rte_eth_dev *dev) { uint32_t new_ctrl, update = 0; @@ -785,7 +762,7 @@ nfp_net_promisc_enable(struct rte_eth_dev *dev) return 0; } -static int +int nfp_net_promisc_disable(struct rte_eth_dev *dev) { uint32_t new_ctrl, update = 0; @@ -821,7 +798,7 @@ nfp_net_promisc_disable(struct rte_eth_dev *dev) * Wait to complete is needed as it can take up to 9 seconds to get the Link * status. */ -static int +int nfp_net_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete) { struct nfp_net_hw *hw; @@ -871,7 +848,7 @@ nfp_net_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete) return ret; } -static int +int nfp_net_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) { int i; @@ -966,7 +943,7 @@ nfp_net_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) return -EINVAL; } -static int +int nfp_net_stats_reset(struct rte_eth_dev *dev) { int i; @@ -1031,7 +1008,7 @@ nfp_net_stats_reset(struct rte_eth_dev *dev) return 0; } -static int +int nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct nfp_net_hw *hw; @@ -1125,7 +1102,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) return 0; } -static const uint32_t * +const uint32_t * nfp_net_supported_ptypes_get(struct rte_eth_dev *dev) { static const uint32_t ptypes[] = { @@ -1142,7 +1119,7 @@ nfp_net_supported_ptypes_get(struct rte_eth_dev *dev) return NULL; } -static int +int nfp_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) { struct rte_pci_device *pci_dev; @@ -1162,7 +1139,7 @@ nfp_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) return 0; } -static int +int nfp_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) { struct rte_pci_device *pci_dev; @@ -1181,7 +1158,7 @@ nfp_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) return 0; } -static void +void nfp_net_dev_link_status_print(struct rte_eth_dev *dev) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); @@ -1210,7 +1187,7 @@ nfp_net_dev_link_status_print(struct rte_eth_dev *dev) * If MSI-X auto-masking is enabled clear the mask bit, otherwise * clear the ICR for the entry. */ -static void +void nfp_net_irq_unmask(struct rte_eth_dev *dev) { struct nfp_net_hw *hw; @@ -1231,7 +1208,7 @@ nfp_net_irq_unmask(struct rte_eth_dev *dev) } } -static void +void nfp_net_dev_interrupt_handler(void *param) { int64_t timeout; @@ -1274,7 +1251,7 @@ nfp_net_dev_interrupt_handler(void *param) * * @return void */ -static void +void nfp_net_dev_interrupt_delayed_handler(void *param) { struct rte_eth_dev *dev = (struct rte_eth_dev *)param; @@ -1288,7 +1265,7 @@ nfp_net_dev_interrupt_delayed_handler(void *param) nfp_net_irq_unmask(dev); } -static int +int nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { struct nfp_net_hw *hw; @@ -1323,7 +1300,7 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) return 0; } -static int +int nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask) { uint32_t new_ctrl, update; @@ -1355,7 +1332,7 @@ nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask) return ret; } -static int +int nfp_net_rss_reta_write(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) @@ -1406,7 +1383,7 @@ nfp_net_rss_reta_write(struct rte_eth_dev *dev, } /* Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device */ -static int +int nfp_net_reta_update(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) @@ -1432,7 +1409,7 @@ nfp_net_reta_update(struct rte_eth_dev *dev, } /* Query Redirection Table(RETA) of Receive Side Scaling of Ethernet device. */ -static int +int nfp_net_reta_query(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) @@ -1479,7 +1456,7 @@ nfp_net_reta_query(struct rte_eth_dev *dev, return 0; } -static int +int nfp_net_rss_hash_write(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) { @@ -1529,7 +1506,7 @@ nfp_net_rss_hash_write(struct rte_eth_dev *dev, return 0; } -static int +int nfp_net_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) { @@ -1565,7 +1542,7 @@ nfp_net_rss_hash_update(struct rte_eth_dev *dev, return 0; } -static int +int nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) { @@ -1616,7 +1593,7 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, return 0; } -static int +int nfp_net_rss_config_default(struct rte_eth_dev *dev) { struct rte_eth_conf *dev_conf; diff --git a/drivers/net/nfp/nfp_net_pmd.h b/drivers/net/nfp/nfp_net_pmd.h index 9265496bf0..dc05e888df 100644 --- a/drivers/net/nfp/nfp_net_pmd.h +++ b/drivers/net/nfp/nfp_net_pmd.h @@ -349,6 +349,55 @@ nfp_qcp_read(uint8_t *q, enum nfp_qcp_ptr ptr) return val & NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask; } +/* Prototypes for common NFP functions */ +int nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t ctrl, uint32_t update); +int nfp_net_configure(struct rte_eth_dev *dev); +void nfp_net_enable_queues(struct rte_eth_dev *dev); +void nfp_net_disable_queues(struct rte_eth_dev *dev); +void nfp_net_params_setup(struct nfp_net_hw *hw); +void nfp_eth_copy_mac(uint8_t *dst, const uint8_t *src); +void nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac); +int nfp_set_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr); +int nfp_configure_rx_interrupt(struct rte_eth_dev *dev, + struct rte_intr_handle *intr_handle); +uint32_t nfp_check_offloads(struct rte_eth_dev *dev); +int nfp_net_promisc_enable(struct rte_eth_dev *dev); +int nfp_net_promisc_disable(struct rte_eth_dev *dev); +int nfp_net_link_update(struct rte_eth_dev *dev, + __rte_unused int wait_to_complete); +int nfp_net_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); +int nfp_net_stats_reset(struct rte_eth_dev *dev); +int nfp_net_infos_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); +const uint32_t *nfp_net_supported_ptypes_get(struct rte_eth_dev *dev); +int nfp_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id); +int nfp_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id); +void nfp_net_params_setup(struct nfp_net_hw *hw); +void nfp_net_cfg_queue_setup(struct nfp_net_hw *hw); +void nfp_eth_copy_mac(uint8_t *dst, const uint8_t *src); +void nfp_net_dev_link_status_print(struct rte_eth_dev *dev); +void nfp_net_irq_unmask(struct rte_eth_dev *dev); +void nfp_net_dev_interrupt_handler(void *param); +void nfp_net_dev_interrupt_delayed_handler(void *param); +int nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); +int nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask); +int nfp_net_rss_reta_write(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size); +int nfp_net_reta_update(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size); +int nfp_net_reta_query(struct rte_eth_dev *dev, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size); +int nfp_net_rss_hash_write(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf); +int nfp_net_rss_hash_update(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf); +int nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf); +int nfp_net_rss_config_default(struct rte_eth_dev *dev); + #define NFP_NET_DEV_PRIVATE_TO_HW(adapter)\ (&((struct nfp_net_adapter *)adapter)->hw)