DPDK patches and discussions
 help / color / mirror / Atom feed
From: Heinrich Kuhn <heinrich.kuhn@netronome.com>
To: dev@dpdk.org
Cc: Heinrich Kuhn <heinrich.kuhn@netronome.com>,
	Simon Horman <simon.horman@corigine.com>
Subject: [dpdk-dev] [PATCH v2 4/7] net/nfp: prototype common functions in header file
Date: Fri, 16 Jul 2021 10:35:43 +0200	[thread overview]
Message-ID: <20210716083545.34444-5-heinrich.kuhn@netronome.com> (raw)
In-Reply-To: <20210716083545.34444-1-heinrich.kuhn@netronome.com>

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 <heinrich.kuhn@netronome.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
---
 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 d79c70c5b7..da35bba4ef 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -53,35 +53,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,
@@ -136,7 +113,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;
@@ -172,7 +149,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;
@@ -215,7 +192,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;
@@ -239,7 +216,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;
@@ -264,14 +241,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;
@@ -279,7 +256,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;
@@ -318,7 +295,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;
@@ -366,7 +343,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)
 {
@@ -410,7 +387,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;
@@ -746,7 +723,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;
@@ -783,7 +760,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;
@@ -819,7 +796,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;
@@ -869,7 +846,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;
@@ -964,7 +941,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;
@@ -1029,7 +1006,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;
@@ -1123,7 +1100,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[] = {
@@ -1140,7 +1117,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;
@@ -1160,7 +1137,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;
@@ -1179,7 +1156,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);
@@ -1208,7 +1185,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;
@@ -1229,7 +1206,7 @@ nfp_net_irq_unmask(struct rte_eth_dev *dev)
 	}
 }
 
-static void
+void
 nfp_net_dev_interrupt_handler(void *param)
 {
 	int64_t timeout;
@@ -1272,7 +1249,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;
@@ -1286,7 +1263,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;
@@ -1321,7 +1298,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;
@@ -1353,7 +1330,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)
@@ -1404,7 +1381,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)
@@ -1430,7 +1407,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)
@@ -1477,7 +1454,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)
 {
@@ -1527,7 +1504,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)
 {
@@ -1563,7 +1540,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)
 {
@@ -1614,7 +1591,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)
 
-- 
2.30.1 (Apple Git-130)


  parent reply	other threads:[~2021-07-16  8:37 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16  8:23 [dpdk-dev] [PATCH 0/7] Refactor the NFP PMD Heinrich Kuhn
2021-07-16  8:23 ` [dpdk-dev] [PATCH 1/7] net/nfp: split rxtx headers into separate file Heinrich Kuhn
2021-07-16  8:23 ` [dpdk-dev] [PATCH 2/7] net/nfp: move rxtx functions to their own file Heinrich Kuhn
2021-07-16  8:23 ` [dpdk-dev] [PATCH 3/7] net/nfp: move CPP bridge to a separate file Heinrich Kuhn
2021-07-16  8:23 ` [dpdk-dev] [PATCH 4/7] net/nfp: prototype common functions in header file Heinrich Kuhn
2021-07-16  8:23 ` [dpdk-dev] [PATCH 5/7] net/nfp: move VF functions into new file Heinrich Kuhn
2021-07-16  8:23 ` [dpdk-dev] [PATCH 6/7] net/nfp: move PF " Heinrich Kuhn
2021-07-16  8:23 ` [dpdk-dev] [PATCH 7/7] net/nfp: batch file rename for consistency Heinrich Kuhn
2021-07-16  8:35 ` [dpdk-dev] [PATCH v2 0/7] Refactor the NFP PMD Heinrich Kuhn
2021-07-16  8:35   ` [dpdk-dev] [PATCH v2 1/7] net/nfp: split rxtx headers into separate file Heinrich Kuhn
2021-07-16  8:35   ` [dpdk-dev] [PATCH v2 2/7] net/nfp: move rxtx functions to their own file Heinrich Kuhn
2021-07-16  8:35   ` [dpdk-dev] [PATCH v2 3/7] net/nfp: move CPP bridge to a separate file Heinrich Kuhn
2021-07-16  8:35   ` Heinrich Kuhn [this message]
2021-07-16  8:35   ` [dpdk-dev] [PATCH v2 5/7] net/nfp: move VF functions into new file Heinrich Kuhn
2021-07-16  8:35   ` [dpdk-dev] [PATCH v2 6/7] net/nfp: move PF " Heinrich Kuhn
2021-07-16  8:35   ` [dpdk-dev] [PATCH v2 7/7] net/nfp: batch file rename for consistency Heinrich Kuhn
2021-07-23  9:18   ` [dpdk-dev] [PATCH v2 0/7] Refactor the NFP PMD Thomas Monjalon
2021-07-29 13:48     ` Heinrich Kuhn
2021-07-29 13:47   ` [dpdk-dev] [PATCH v3 " Heinrich Kuhn
2021-07-29 13:47     ` [dpdk-dev] [PATCH v3 1/7] net/nfp: split rxtx headers into separate file Heinrich Kuhn
2021-07-29 13:47     ` [dpdk-dev] [PATCH v3 2/7] net/nfp: move rxtx functions to their own file Heinrich Kuhn
2021-07-29 13:47     ` [dpdk-dev] [PATCH v3 3/7] net/nfp: move CPP bridge to a separate file Heinrich Kuhn
2021-07-29 13:47     ` [dpdk-dev] [PATCH v3 4/7] net/nfp: prototype common functions in header file Heinrich Kuhn
2021-08-17 14:44       ` Ferruh Yigit
2021-08-17 16:29         ` Ferruh Yigit
2021-07-29 13:47     ` [dpdk-dev] [PATCH v3 5/7] net/nfp: move VF functions into new file Heinrich Kuhn
2021-07-29 13:47     ` [dpdk-dev] [PATCH v3 6/7] net/nfp: move PF " Heinrich Kuhn
2021-07-29 13:47     ` [dpdk-dev] [PATCH v3 7/7] net/nfp: batch file rename for consistency Heinrich Kuhn
2021-08-13 12:46     ` [dpdk-dev] [PATCH v3 0/7] Refactor the NFP PMD Heinrich Kuhn
2021-08-13 14:47       ` Ferruh Yigit
2021-08-17 16:29     ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210716083545.34444-5-heinrich.kuhn@netronome.com \
    --to=heinrich.kuhn@netronome.com \
    --cc=dev@dpdk.org \
    --cc=simon.horman@corigine.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).