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

Make sfc_adapter primary process only.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc.h        |  20 ++++---
 drivers/net/sfc/sfc_ethdev.c | 105 +++++++++++++++++++----------------
 drivers/net/sfc/sfc_flow.c   |  10 ++--
 drivers/net/sfc/sfc_rx.c     |   2 +-
 drivers/net/sfc/sfc_tx.c     |   2 +-
 5 files changed, 77 insertions(+), 62 deletions(-)

diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index e8569bbbc..39b4ba52c 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -218,12 +218,6 @@ 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
@@ -291,9 +285,19 @@ struct sfc_adapter {
 static inline struct sfc_adapter_shared *
 sfc_adapter_shared_by_eth_dev(struct rte_eth_dev *eth_dev)
 {
-	struct sfc_adapter *sa = eth_dev->data->dev_private;
+	struct sfc_adapter_shared *sas = eth_dev->data->dev_private;
 
-	return sa->priv.shared;
+	return sas;
+}
+
+static inline struct sfc_adapter *
+sfc_adapter_by_eth_dev(struct rte_eth_dev *eth_dev)
+{
+	struct sfc_adapter_priv *sap = sfc_adapter_priv_by_eth_dev(eth_dev);
+
+	SFC_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);
+
+	return container_of(sap, struct sfc_adapter, priv);
 }
 
 static inline struct sfc_adapter_shared *
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 6b00601fc..a54a9e66b 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -36,7 +36,7 @@ static struct sfc_dp_list sfc_dp_head =
 static int
 sfc_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	efx_nic_fw_info_t enfi;
 	int ret;
 	int rc;
@@ -86,7 +86,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
 	const struct sfc_adapter_priv *sap = sfc_adapter_priv_by_eth_dev(dev);
 	struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct sfc_rss *rss = &sas->rss;
 	uint64_t txq_offloads_def = 0;
 
@@ -182,7 +182,7 @@ static const uint32_t *
 sfc_dev_supported_ptypes_get(struct rte_eth_dev *dev)
 {
 	const struct sfc_adapter_priv *sap = sfc_adapter_priv_by_eth_dev(dev);
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
 	uint32_t tunnel_encaps = encp->enc_tunnel_encapsulations_supported;
 
@@ -193,7 +193,7 @@ static int
 sfc_dev_configure(struct rte_eth_dev *dev)
 {
 	struct rte_eth_dev_data *dev_data = dev->data;
-	struct sfc_adapter *sa = dev_data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	int rc;
 
 	sfc_log_init(sa, "entry n_rxq=%u n_txq=%u",
@@ -222,7 +222,7 @@ sfc_dev_configure(struct rte_eth_dev *dev)
 static int
 sfc_dev_start(struct rte_eth_dev *dev)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	int rc;
 
 	sfc_log_init(sa, "entry");
@@ -239,7 +239,7 @@ sfc_dev_start(struct rte_eth_dev *dev)
 static int
 sfc_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct rte_eth_link current_link;
 	int ret;
 
@@ -270,7 +270,7 @@ sfc_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 static void
 sfc_dev_stop(struct rte_eth_dev *dev)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 
 	sfc_log_init(sa, "entry");
 
@@ -284,7 +284,7 @@ sfc_dev_stop(struct rte_eth_dev *dev)
 static int
 sfc_dev_set_link_up(struct rte_eth_dev *dev)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	int rc;
 
 	sfc_log_init(sa, "entry");
@@ -300,7 +300,7 @@ sfc_dev_set_link_up(struct rte_eth_dev *dev)
 static int
 sfc_dev_set_link_down(struct rte_eth_dev *dev)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 
 	sfc_log_init(sa, "entry");
 
@@ -314,7 +314,7 @@ sfc_dev_set_link_down(struct rte_eth_dev *dev)
 static void
 sfc_dev_close(struct rte_eth_dev *dev)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 
 	sfc_log_init(sa, "entry");
 
@@ -345,7 +345,7 @@ sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 {
 	struct sfc_port *port;
 	boolean_t *toggle;
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	boolean_t allmulti = (mode == SFC_DEV_FILTER_MODE_ALLMULTI);
 	const char *desc = (allmulti) ? "all-multi" : "promiscuous";
 
@@ -404,7 +404,7 @@ sfc_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
 		   struct rte_mempool *mb_pool)
 {
 	struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	int rc;
 
 	sfc_log_init(sa, "RxQ=%u nb_rx_desc=%u socket_id=%u",
@@ -459,7 +459,7 @@ sfc_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
 		   const struct rte_eth_txconf *tx_conf)
 {
 	struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	int rc;
 
 	sfc_log_init(sa, "TxQ = %u, nb_tx_desc = %u, socket_id = %u",
@@ -534,7 +534,7 @@ sfc_update_diff_stat(uint64_t *stat, uint64_t newval)
 static int
 sfc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct sfc_port *port = &sa->port;
 	uint64_t *mac_stats;
 	int ret;
@@ -611,7 +611,7 @@ sfc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 static void
 sfc_stats_reset(struct rte_eth_dev *dev)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct sfc_port *port = &sa->port;
 	int rc;
 
@@ -633,7 +633,7 @@ static int
 sfc_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
 	       unsigned int xstats_count)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct sfc_port *port = &sa->port;
 	uint64_t *mac_stats;
 	int rc;
@@ -672,7 +672,7 @@ sfc_xstats_get_names(struct rte_eth_dev *dev,
 		     struct rte_eth_xstat_name *xstats_names,
 		     unsigned int xstats_count)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct sfc_port *port = &sa->port;
 	unsigned int i;
 	unsigned int nstats = 0;
@@ -694,7 +694,7 @@ static int
 sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 		     uint64_t *values, unsigned int n)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct sfc_port *port = &sa->port;
 	uint64_t *mac_stats;
 	unsigned int nb_supported = 0;
@@ -741,7 +741,7 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,
 			   struct rte_eth_xstat_name *xstats_names,
 			   const uint64_t *ids, unsigned int size)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct sfc_port *port = &sa->port;
 	unsigned int nb_supported = 0;
 	unsigned int nb_written = 0;
@@ -771,7 +771,7 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,
 static int
 sfc_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	unsigned int wanted_fc, link_fc;
 
 	memset(fc_conf, 0, sizeof(*fc_conf));
@@ -811,7 +811,7 @@ sfc_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 static int
 sfc_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct sfc_port *port = &sa->port;
 	unsigned int fcntl;
 	int rc;
@@ -867,7 +867,7 @@ sfc_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 static int
 sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	size_t pdu = EFX_MAC_PDU(mtu);
 	size_t old_pdu;
 	int rc;
@@ -936,7 +936,7 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 static int
 sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
 	struct sfc_port *port = &sa->port;
 	struct ether_addr *old_addr = &dev->data->mac_addrs[0];
@@ -1021,7 +1021,7 @@ static int
 sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set,
 		     uint32_t nb_mc_addr)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct sfc_port *port = &sa->port;
 	uint8_t *mc_addrs = port->mcast_addrs;
 	int rc;
@@ -1181,7 +1181,7 @@ static int
 sfc_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 {
 	struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	int rc;
 
 	sfc_log_init(sa, "RxQ=%u", rx_queue_id);
@@ -1217,7 +1217,7 @@ static int
 sfc_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 {
 	struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 
 	sfc_log_init(sa, "RxQ=%u", rx_queue_id);
 
@@ -1235,7 +1235,7 @@ static int
 sfc_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 {
 	struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	int rc;
 
 	sfc_log_init(sa, "TxQ = %u", tx_queue_id);
@@ -1271,7 +1271,7 @@ static int
 sfc_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 {
 	struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 
 	sfc_log_init(sa, "TxQ = %u", tx_queue_id);
 
@@ -1308,7 +1308,7 @@ sfc_dev_udp_tunnel_op(struct rte_eth_dev *dev,
 		      struct rte_eth_udp_tunnel *tunnel_udp,
 		      enum sfc_udp_tunnel_op_e op)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	efx_tunnel_protocol_t tunnel_proto;
 	int rc;
 
@@ -1434,7 +1434,7 @@ static int
 sfc_dev_rss_hash_update(struct rte_eth_dev *dev,
 			struct rte_eth_rss_conf *rss_conf)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct sfc_rss *rss = &sfc_sa2shared(sa)->rss;
 	unsigned int efx_hash_types;
 	int rc = 0;
@@ -1539,7 +1539,7 @@ sfc_dev_rss_reta_update(struct rte_eth_dev *dev,
 			struct rte_eth_rss_reta_entry64 *reta_conf,
 			uint16_t reta_size)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct sfc_rss *rss = &sfc_sa2shared(sa)->rss;
 	unsigned int *rss_tbl_new;
 	uint16_t entry;
@@ -1612,7 +1612,7 @@ sfc_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type,
 		    enum rte_filter_op filter_op,
 		    void *arg)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	int rc = ENOTSUP;
 
 	sfc_log_init(sa, "entry");
@@ -1755,7 +1755,7 @@ sfc_strdup(const char *str)
 static int
 sfc_eth_dev_set_ops(struct rte_eth_dev *dev)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
 	const struct sfc_dp_rx *dp_rx;
 	const struct sfc_dp_tx *dp_tx;
@@ -1880,7 +1880,7 @@ sfc_eth_dev_set_ops(struct rte_eth_dev *dev)
 static void
 sfc_eth_dev_clear_ops(struct rte_eth_dev *dev)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
 
 	dev->dev_ops = NULL;
@@ -2007,10 +2007,10 @@ sfc_register_dp(void)
 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 sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	uint32_t logtype_main;
+	struct sfc_adapter *sa;
 	int rc;
 	const efx_nic_cfg_t *encp;
 	const struct ether_addr *from;
@@ -2021,23 +2021,27 @@ 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);
 
+	/* Required for logging */
+	sas->pci_addr = pci_dev->addr;
+	sas->port_id = dev->data->port_id;
+
 	/*
-	 * sfc_adapter is a mixture of shared and process private data.
-	 * During transition period use it in both kinds. When the
-	 * driver becomes ready to separate it, sfc_adapter will become
-	 * primary process private only.
+	 * Allocate process private data from heap, since it should not
+	 * be located in shared memory allocated using rte_malloc() API.
 	 */
+	sa = calloc(1, sizeof(*sa));
+	if (sa == NULL) {
+		rc = ENOMEM;
+		goto fail_alloc_sa;
+	}
+
 	dev->process_private = sa;
 
 	/* Required for logging */
-	sas->pci_addr = pci_dev->addr;
-	sas->port_id = dev->data->port_id;
+	sa->priv.shared = sas;
 	sa->priv.logtype_main = logtype_main;
 
 	sa->eth_dev = dev;
@@ -2107,6 +2111,9 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)
 fail_kvargs_parse:
 	sfc_log_init(sa, "failed %d", rc);
 	dev->process_private = NULL;
+	free(sa);
+
+fail_alloc_sa:
 	SFC_ASSERT(rc > 0);
 	return -rc;
 }
@@ -2121,7 +2128,7 @@ sfc_eth_dev_uninit(struct rte_eth_dev *dev)
 		return 0;
 	}
 
-	sa = dev->data->dev_private;
+	sa = sfc_adapter_by_eth_dev(dev);
 	sfc_log_init(sa, "entry");
 
 	sfc_adapter_lock(sa);
@@ -2140,6 +2147,10 @@ sfc_eth_dev_uninit(struct rte_eth_dev *dev)
 
 	/* Required for logging, so cleanup last */
 	sa->eth_dev = NULL;
+
+	dev->process_private = NULL;
+	free(sa);
+
 	return 0;
 }
 
@@ -2159,7 +2170,7 @@ static int sfc_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	struct rte_pci_device *pci_dev)
 {
 	return rte_eth_dev_pci_generic_probe(pci_dev,
-		sizeof(struct sfc_adapter), sfc_eth_dev_init);
+		sizeof(struct sfc_adapter_shared), sfc_eth_dev_init);
 }
 
 static int sfc_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c
index 01a81eab8..cffcd9a4c 100644
--- a/drivers/net/sfc/sfc_flow.c
+++ b/drivers/net/sfc/sfc_flow.c
@@ -2254,7 +2254,7 @@ sfc_flow_parse(struct rte_eth_dev *dev,
 	       struct rte_flow *flow,
 	       struct rte_flow_error *error)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	int rc;
 
 	rc = sfc_flow_parse_attr(attr, flow, error);
@@ -2300,7 +2300,7 @@ sfc_flow_create(struct rte_eth_dev *dev,
 		const struct rte_flow_action actions[],
 		struct rte_flow_error *error)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct rte_flow *flow = NULL;
 	int rc;
 
@@ -2373,7 +2373,7 @@ sfc_flow_destroy(struct rte_eth_dev *dev,
 		 struct rte_flow *flow,
 		 struct rte_flow_error *error)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct rte_flow *flow_ptr;
 	int rc = EINVAL;
 
@@ -2402,7 +2402,7 @@ static int
 sfc_flow_flush(struct rte_eth_dev *dev,
 	       struct rte_flow_error *error)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	struct rte_flow *flow;
 	int rc = 0;
 	int ret = 0;
@@ -2424,7 +2424,7 @@ static int
 sfc_flow_isolate(struct rte_eth_dev *dev, int enable,
 		 struct rte_flow_error *error)
 {
-	struct sfc_adapter *sa = dev->data->dev_private;
+	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	int ret = 0;
 
 	sfc_adapter_lock(sa);
diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index cd8abc8ea..54d4b5872 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -402,7 +402,7 @@ sfc_rxq_by_dp_rxq(const struct sfc_dp_rxq *dp_rxq)
 	SFC_ASSERT(rte_eth_dev_is_valid_port(dpq->port_id));
 	eth_dev = &rte_eth_devices[dpq->port_id];
 
-	sa = eth_dev->data->dev_private;
+	sa = sfc_adapter_by_eth_dev(eth_dev);
 
 	SFC_ASSERT(dpq->queue_id < sfc_sa2shared(sa)->rxq_count);
 	return &sa->rxq_ctrl[dpq->queue_id];
diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c
index 515f4afdc..acdbf1602 100644
--- a/drivers/net/sfc/sfc_tx.c
+++ b/drivers/net/sfc/sfc_tx.c
@@ -911,7 +911,7 @@ sfc_txq_by_dp_txq(const struct sfc_dp_txq *dp_txq)
 	SFC_ASSERT(rte_eth_dev_is_valid_port(dpq->port_id));
 	eth_dev = &rte_eth_devices[dpq->port_id];
 
-	sa = eth_dev->data->dev_private;
+	sa = sfc_adapter_by_eth_dev(eth_dev);
 
 	SFC_ASSERT(dpq->queue_id < sfc_sa2shared(sa)->txq_count);
 	return &sa->txq_ctrl[dpq->queue_id];
-- 
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 ` [dpdk-dev] [PATCH 21/30] net/sfc: start to factor out multi-process shared data Andrew Rybchenko
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 ` Andrew Rybchenko [this message]
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-30-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).