DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 21/30] net/sfc: start to factor out multi-process shared data
Date: Thu, 7 Feb 2019 12:17:44 +0000	[thread overview]
Message-ID: <1549541873-17403-22-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1549541873-17403-1-git-send-email-arybchenko@solarflare.com>

sfc_adapter structure will become primary process only private data.
Start to factor out shared data into dedicated structure which will
become separate structure finally.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc.h        | 15 +++++++++++++--
 drivers/net/sfc/sfc_debug.h  |  9 +++++----
 drivers/net/sfc/sfc_ethdev.c |  8 ++++++--
 drivers/net/sfc/sfc_log.h    | 13 +++++++------
 drivers/net/sfc/sfc_mcdi.c   |  2 +-
 5 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index 7e95170bc..766336f8c 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -174,8 +174,15 @@ struct sfc_rss {
 	uint8_t				key[EFX_RSS_KEY_SIZE];
 };
 
+/* Adapter private data shared by primary and secondary processes */
+struct sfc_adapter_shared {
+	struct rte_pci_addr		pci_addr;
+	uint16_t			port_id;
+};
+
 /* Adapter process private data */
 struct sfc_adapter_priv {
+	struct sfc_adapter_shared	*shared;
 	const struct sfc_dp_rx		*dp_rx;
 	const struct sfc_dp_tx		*dp_tx;
 	uint32_t			logtype_main;
@@ -199,6 +206,12 @@ struct sfc_adapter {
 	 */
 	struct sfc_adapter_priv		priv;
 
+	/*
+	 * Temporary placeholder for multi-process shared data for
+	 * transition.
+	 */
+	struct sfc_adapter_shared	_shared;
+
 	/*
 	 * PMD setup and configuration is not thread safe. Since it is not
 	 * performance sensitive, it is better to guarantee thread-safety
@@ -207,8 +220,6 @@ struct sfc_adapter {
 	 */
 	rte_spinlock_t			lock;
 	enum sfc_adapter_state		state;
-	struct rte_pci_addr		pci_addr;
-	uint16_t			port_id;
 	struct rte_eth_dev		*eth_dev;
 	struct rte_kvargs		*kvargs;
 	int				socket_id;
diff --git a/drivers/net/sfc/sfc_debug.h b/drivers/net/sfc/sfc_debug.h
index 62f3937e8..ea1b43295 100644
--- a/drivers/net/sfc/sfc_debug.h
+++ b/drivers/net/sfc/sfc_debug.h
@@ -25,13 +25,14 @@
 /* Log PMD message, automatically add prefix and \n */
 #define sfc_panic(sa, fmt, args...) \
 	do {								\
-		const struct sfc_adapter *_sa = (sa);			\
+		const struct sfc_adapter_shared *_sas;			\
 									\
+		_sas = (sa)->priv.shared;				\
 		rte_panic("sfc " PCI_PRI_FMT				\
 			  " #%" PRIu16 ": " fmt "\n",			\
-			  _sa->pci_addr.domain, _sa->pci_addr.bus,	\
-			  _sa->pci_addr.devid, _sa->pci_addr.function,	\
-			  _sa->port_id, ##args);			\
+			  _sas->pci_addr.domain, _sas->pci_addr.bus,	\
+			  _sas->pci_addr.devid, _sas->pci_addr.function,\
+			  _sas->port_id, ##args);			\
 	} while (0)
 
 #endif /* _SFC_DEBUG_H_ */
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index aa857ec74..88dbecd46 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -2023,6 +2023,7 @@ static int
 sfc_eth_dev_init(struct rte_eth_dev *dev)
 {
 	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter_shared *sas;
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	uint32_t logtype_main;
 	int rc;
@@ -2035,6 +2036,9 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)
 					    SFC_LOGTYPE_MAIN_STR,
 					    RTE_LOG_NOTICE);
 
+	sa->priv.shared = &sa->_shared;
+	sas = sa->priv.shared;
+
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return -sfc_eth_dev_secondary_init(dev, logtype_main);
 
@@ -2047,8 +2051,8 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)
 	dev->process_private = sa;
 
 	/* Required for logging */
-	sa->pci_addr = pci_dev->addr;
-	sa->port_id = dev->data->port_id;
+	sas->pci_addr = pci_dev->addr;
+	sas->port_id = dev->data->port_id;
 	sa->priv.logtype_main = logtype_main;
 
 	sa->eth_dev = dev;
diff --git a/drivers/net/sfc/sfc_log.h b/drivers/net/sfc/sfc_log.h
index 405cc2a26..97de9ae53 100644
--- a/drivers/net/sfc/sfc_log.h
+++ b/drivers/net/sfc/sfc_log.h
@@ -34,17 +34,18 @@ extern uint32_t sfc_logtype_driver;
 /* Log PMD message, automatically add prefix and \n */
 #define SFC_LOG(sa, level, type, ...) \
 	do {								\
-		const struct sfc_adapter *__sa = (sa);			\
+		const struct sfc_adapter_shared *_sas;			\
 									\
+		_sas = (sa)->priv.shared;				\
 		rte_log(level, type,					\
 			RTE_FMT("PMD: sfc_efx "				\
 				PCI_PRI_FMT " #%" PRIu16		\
 				": " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n",	\
-				__sa->pci_addr.domain,			\
-				__sa->pci_addr.bus,			\
-				__sa->pci_addr.devid,			\
-				__sa->pci_addr.function,		\
-				__sa->port_id,				\
+				_sas->pci_addr.domain,			\
+				_sas->pci_addr.bus,			\
+				_sas->pci_addr.devid,			\
+				_sas->pci_addr.function,		\
+				_sas->port_id,				\
 				RTE_FMT_TAIL(__VA_ARGS__,)));		\
 	} while (0)
 
diff --git a/drivers/net/sfc/sfc_mcdi.c b/drivers/net/sfc/sfc_mcdi.c
index e485e07d6..dede33688 100644
--- a/drivers/net/sfc/sfc_mcdi.c
+++ b/drivers/net/sfc/sfc_mcdi.c
@@ -256,7 +256,7 @@ sfc_mcdi_init(struct sfc_adapter *sa)
 	if (rc != 0)
 		goto fail_dma_alloc;
 
-	mcdi->logtype = sfc_register_logtype(&sa->pci_addr,
+	mcdi->logtype = sfc_register_logtype(&sa->priv.shared->pci_addr,
 					     SFC_LOGTYPE_MCDI_STR,
 					     RTE_LOG_NOTICE);
 
-- 
2.17.1

  parent reply	other threads:[~2019-02-07 12:18 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07 12:17 [dpdk-dev] [PATCH 00/30] net/sfc: improve multi-process support Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 01/30] net/sfc: log port ID as 16-bit unsigned integer on panic Andrew Rybchenko
2019-02-08 10:13   ` Ferruh Yigit
2019-02-08 10:31     ` Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 02/30] net/sfc: remove control path logging from Rx queue count Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 03/30] net/sfc: fix logging from secondary process Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 04/30] net/sfc: avoid usage of RxQ control structure in info get Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 05/30] net/sfc: avoid usage of TxQ " Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 06/30] net/sfc: remove wrappers around Rx descriptor count and done Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 07/30] net/sfc: make it simpler to change datapath ops location Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 08/30] net/sfc: move datapath ops pointers to process private data Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 09/30] net/sfc: move main log type " Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 10/30] net/sfc: move RxQ state to multi-process shared location Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 11/30] net/sfc: move datapath RxQ handle to shared RxQ info Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 12/30] net/sfc: support Rx descriptor status in secondary process Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 13/30] net/sfc: move TxQ state to multi-process shared location Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 14/30] net/sfc: move datapath TxQ handle to shared TxQ info Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 15/30] net/sfc: support Tx descriptor status in secondary process Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 16/30] net/sfc: support RSS RETA and hash config get in secondary Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 17/30] net/sfc: remove unnecessary functions to get RxQ index Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 18/30] net/sfc: remove unnecessary functions to get TxQ index Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 19/30] net/sfc: remove RxQ control from shared RxQ info Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 20/30] net/sfc: remove TxQ control from shared TxQ info Andrew Rybchenko
2019-02-07 12:17 ` Andrew Rybchenko [this message]
2019-02-07 12:17 ` [dpdk-dev] [PATCH 22/30] net/sfc: move Rx/Tx datapath names to shared state Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 23/30] net/sfc: make main logging macro reusable in secondary Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 24/30] net/sfc: move RxQ shared information to adapter shared Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 25/30] net/sfc: move TxQ " Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 26/30] net/sfc: move RSS config " Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 27/30] net/sfc: move isolated flag in " Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 28/30] net/sfc: remove adapter locks from secondary process ops Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 29/30] net/sfc: separate adapter primary process and shared data Andrew Rybchenko
2019-02-07 12:17 ` [dpdk-dev] [PATCH 30/30] net/sfc: support Rx packet types get in secondary process Andrew Rybchenko
2019-02-07 15:08 ` [dpdk-dev] [PATCH 00/30] net/sfc: improve multi-process support 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=1549541873-17403-22-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    /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).