From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 19/30] net/sfc: remove RxQ control from shared RxQ info
Date: Thu, 7 Feb 2019 12:17:42 +0000 [thread overview]
Message-ID: <1549541873-17403-20-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1549541873-17403-1-git-send-email-arybchenko@solarflare.com>
libefx is not multi-process aware and all related structures
should be moved to primary process only.
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
drivers/net/sfc/sfc.h | 3 ++
drivers/net/sfc/sfc_ethdev.c | 2 +-
drivers/net/sfc/sfc_flow.c | 8 ++--
drivers/net/sfc/sfc_rx.c | 77 ++++++++++++++++++++++--------------
drivers/net/sfc/sfc_rx.h | 4 +-
5 files changed, 57 insertions(+), 37 deletions(-)
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index f04127bbc..f19a9dafb 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -110,6 +110,8 @@ struct sfc_intr {
boolean_t lsc_intr;
};
+struct sfc_rxq;
+
struct sfc_rxq_info;
struct sfc_txq_info;
struct sfc_dp_rx;
@@ -256,6 +258,7 @@ struct sfc_adapter {
unsigned int rxq_count;
struct sfc_rxq_info *rxq_info;
+ struct sfc_rxq *rxq_ctrl;
unsigned int txq_count;
struct sfc_txq_info *txq_info;
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index a00ea9ce4..3d38bf661 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1196,7 +1196,7 @@ sfc_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
if (sa->state != SFC_ADAPTER_STARTED)
goto fail_not_started;
- if (sa->rxq_info[rx_queue_id].rxq == NULL)
+ if (sa->rxq_info[rx_queue_id].state != SFC_RXQ_INITIALIZED)
goto fail_not_setup;
rc = sfc_rx_qstart(sa, rx_queue_id);
diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c
index 41d388735..e20c2e612 100644
--- a/drivers/net/sfc/sfc_flow.c
+++ b/drivers/net/sfc/sfc_flow.c
@@ -1244,7 +1244,7 @@ sfc_flow_parse_queue(struct sfc_adapter *sa,
if (queue->index >= sa->rxq_count)
return -EINVAL;
- rxq = sa->rxq_info[queue->index].rxq;
+ rxq = &sa->rxq_ctrl[queue->index];
flow->spec.template.efs_dmaq_id = (uint16_t)rxq->hw_index;
return 0;
@@ -1269,7 +1269,7 @@ sfc_flow_parse_rss(struct sfc_adapter *sa,
return -EINVAL;
rxq_sw_index = sa->rxq_count - 1;
- rxq = sa->rxq_info[rxq_sw_index].rxq;
+ rxq = &sa->rxq_ctrl[rxq_sw_index];
rxq_hw_index_min = rxq->hw_index;
rxq_hw_index_max = 0;
@@ -1279,7 +1279,7 @@ sfc_flow_parse_rss(struct sfc_adapter *sa,
if (rxq_sw_index >= sa->rxq_count)
return -EINVAL;
- rxq = sa->rxq_info[rxq_sw_index].rxq;
+ rxq = &sa->rxq_ctrl[rxq_sw_index];
if (rxq->hw_index < rxq_hw_index_min)
rxq_hw_index_min = rxq->hw_index;
@@ -1344,7 +1344,7 @@ sfc_flow_parse_rss(struct sfc_adapter *sa,
for (i = 0; i < RTE_DIM(sfc_rss_conf->rss_tbl); ++i) {
unsigned int nb_queues = action_rss->queue_num;
unsigned int rxq_sw_index = action_rss->queue[i % nb_queues];
- struct sfc_rxq *rxq = sa->rxq_info[rxq_sw_index].rxq;
+ struct sfc_rxq *rxq = &sa->rxq_ctrl[rxq_sw_index];
sfc_rss_conf->rss_tbl[i] = rxq->hw_index - rxq_hw_index_min;
}
diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index 3c1e77974..eb4875fec 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -395,12 +395,17 @@ sfc_rxq_info_by_dp_rxq(const struct sfc_dp_rxq *dp_rxq)
struct sfc_rxq *
sfc_rxq_by_dp_rxq(const struct sfc_dp_rxq *dp_rxq)
{
- struct sfc_rxq_info *rxq_info;
+ const struct sfc_dp_queue *dpq = &dp_rxq->dpq;
+ struct rte_eth_dev *eth_dev;
+ struct sfc_adapter *sa;
- rxq_info = sfc_rxq_info_by_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;
- SFC_ASSERT(rxq_info->rxq != NULL);
- return rxq_info->rxq;
+ SFC_ASSERT(dpq->queue_id < sa->rxq_count);
+ return &sa->rxq_ctrl[dpq->queue_id];
}
static sfc_dp_rx_qsize_up_rings_t sfc_efx_rx_qsize_up_rings;
@@ -563,9 +568,10 @@ sfc_rx_qflush(struct sfc_adapter *sa, unsigned int sw_index)
int rc;
rxq_info = &sa->rxq_info[sw_index];
- rxq = rxq_info->rxq;
SFC_ASSERT(rxq_info->state & SFC_RXQ_STARTED);
+ rxq = &sa->rxq_ctrl[sw_index];
+
/*
* Retry Rx queue flushing in the case of flush failed or
* timeout. In the worst case it can delay for 6 seconds.
@@ -674,10 +680,9 @@ sfc_rx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
SFC_ASSERT(sw_index < sa->rxq_count);
rxq_info = &sa->rxq_info[sw_index];
- rxq = rxq_info->rxq;
- SFC_ASSERT(rxq != NULL);
SFC_ASSERT(rxq_info->state == SFC_RXQ_INITIALIZED);
+ rxq = &sa->rxq_ctrl[sw_index];
evq = rxq->evq;
rc = sfc_ev_qstart(evq, sfc_evq_index_by_rxq_sw_index(sa, sw_index));
@@ -764,9 +769,8 @@ sfc_rx_qstop(struct sfc_adapter *sa, unsigned int sw_index)
SFC_ASSERT(sw_index < sa->rxq_count);
rxq_info = &sa->rxq_info[sw_index];
- rxq = rxq_info->rxq;
- if (rxq == NULL || rxq_info->state == SFC_RXQ_INITIALIZED)
+ if (rxq_info->state == SFC_RXQ_INITIALIZED)
return;
SFC_ASSERT(rxq_info->state & SFC_RXQ_STARTED);
@@ -774,6 +778,7 @@ sfc_rx_qstop(struct sfc_adapter *sa, unsigned int sw_index)
sa->eth_dev->data->rx_queue_state[sw_index] =
RTE_ETH_QUEUE_STATE_STOPPED;
+ rxq = &sa->rxq_ctrl[sw_index];
sa->priv.dp_rx->qstop(rxq_info->dp, &rxq->evq->read_ptr);
if (sw_index == 0)
@@ -1026,14 +1031,7 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
if (rc != 0)
goto fail_ev_qinit;
- rc = ENOMEM;
- rxq = rte_zmalloc_socket("sfc-rxq", sizeof(*rxq), RTE_CACHE_LINE_SIZE,
- socket_id);
- if (rxq == NULL)
- goto fail_rxq_alloc;
-
- rxq_info->rxq = rxq;
-
+ rxq = &sa->rxq_ctrl[sw_index];
rxq->evq = evq;
rxq->hw_index = sw_index;
rxq_info->refill_threshold =
@@ -1083,10 +1081,6 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
sfc_dma_free(sa, &rxq->mem);
fail_dma_alloc:
- rxq_info->rxq = NULL;
- rte_free(rxq);
-
-fail_rxq_alloc:
sfc_ev_qfini(evq);
fail_ev_qinit:
@@ -1109,21 +1103,20 @@ sfc_rx_qfini(struct sfc_adapter *sa, unsigned int sw_index)
rxq_info = &sa->rxq_info[sw_index];
- rxq = rxq_info->rxq;
SFC_ASSERT(rxq_info->state == SFC_RXQ_INITIALIZED);
sa->priv.dp_rx->qdestroy(rxq_info->dp);
rxq_info->dp = NULL;
- rxq_info->rxq = NULL;
+ rxq_info->state &= ~SFC_RXQ_INITIALIZED;
rxq_info->entries = 0;
+ rxq = &sa->rxq_ctrl[sw_index];
+
sfc_dma_free(sa, &rxq->mem);
sfc_ev_qfini(rxq->evq);
rxq->evq = NULL;
-
- rte_free(rxq);
}
/*
@@ -1366,7 +1359,7 @@ sfc_rx_start(struct sfc_adapter *sa)
goto fail_rss_config;
for (sw_index = 0; sw_index < sa->rxq_count; ++sw_index) {
- if (sa->rxq_info[sw_index].rxq != NULL &&
+ if (sa->rxq_info[sw_index].state == SFC_RXQ_INITIALIZED &&
(!sa->rxq_info[sw_index].deferred_start ||
sa->rxq_info[sw_index].deferred_started)) {
rc = sfc_rx_qstart(sa, sw_index);
@@ -1398,7 +1391,7 @@ sfc_rx_stop(struct sfc_adapter *sa)
sw_index = sa->rxq_count;
while (sw_index-- > 0) {
- if (sa->rxq_info[sw_index].rxq != NULL)
+ if (sa->rxq_info[sw_index].state & SFC_RXQ_STARTED)
sfc_rx_qstop(sa, sw_index);
}
@@ -1476,7 +1469,7 @@ sfc_rx_fini_queues(struct sfc_adapter *sa, unsigned int nb_rx_queues)
sw_index = sa->rxq_count;
while (--sw_index >= (int)nb_rx_queues) {
- if (sa->rxq_info[sw_index].rxq != NULL)
+ if (sa->rxq_info[sw_index].state & SFC_RXQ_INITIALIZED)
sfc_rx_qfini(sa, sw_index);
}
@@ -1516,8 +1509,18 @@ sfc_rx_configure(struct sfc_adapter *sa)
sa->socket_id);
if (sa->rxq_info == NULL)
goto fail_rxqs_alloc;
+
+ /*
+ * Allocate primary process only RxQ control from heap
+ * since it should not be shared.
+ */
+ rc = ENOMEM;
+ sa->rxq_ctrl = calloc(nb_rx_queues, sizeof(sa->rxq_ctrl[0]));
+ if (sa->rxq_ctrl == NULL)
+ goto fail_rxqs_ctrl_alloc;
} else {
struct sfc_rxq_info *new_rxq_info;
+ struct sfc_rxq *new_rxq_ctrl;
if (nb_rx_queues < sa->rxq_count)
sfc_rx_fini_queues(sa, nb_rx_queues);
@@ -1529,11 +1532,22 @@ sfc_rx_configure(struct sfc_adapter *sa)
if (new_rxq_info == NULL && nb_rx_queues > 0)
goto fail_rxqs_realloc;
+ rc = ENOMEM;
+ new_rxq_ctrl = realloc(sa->rxq_ctrl,
+ nb_rx_queues * sizeof(sa->rxq_ctrl[0]));
+ if (new_rxq_ctrl == NULL && nb_rx_queues > 0)
+ goto fail_rxqs_ctrl_realloc;
+
sa->rxq_info = new_rxq_info;
- if (nb_rx_queues > sa->rxq_count)
+ sa->rxq_ctrl = new_rxq_ctrl;
+ if (nb_rx_queues > sa->rxq_count) {
memset(&sa->rxq_info[sa->rxq_count], 0,
(nb_rx_queues - sa->rxq_count) *
sizeof(sa->rxq_info[0]));
+ memset(&sa->rxq_ctrl[sa->rxq_count], 0,
+ (nb_rx_queues - sa->rxq_count) *
+ sizeof(sa->rxq_ctrl[0]));
+ }
}
while (sa->rxq_count < nb_rx_queues) {
@@ -1565,7 +1579,9 @@ sfc_rx_configure(struct sfc_adapter *sa)
fail_rx_process_adv_conf_rss:
fail_rx_qinit_info:
+fail_rxqs_ctrl_realloc:
fail_rxqs_realloc:
+fail_rxqs_ctrl_alloc:
fail_rxqs_alloc:
sfc_rx_close(sa);
@@ -1588,6 +1604,9 @@ sfc_rx_close(struct sfc_adapter *sa)
rss->channels = 0;
+ free(sa->rxq_ctrl);
+ sa->rxq_ctrl = NULL;
+
rte_free(sa->rxq_info);
sa->rxq_info = NULL;
}
diff --git a/drivers/net/sfc/sfc_rx.h b/drivers/net/sfc/sfc_rx.h
index 963d487c0..73b70249c 100644
--- a/drivers/net/sfc/sfc_rx.h
+++ b/drivers/net/sfc/sfc_rx.h
@@ -50,8 +50,7 @@ enum sfc_rxq_state_bit {
};
/**
- * Receive queue control information.
- * Allocated on the socket specified on the queue setup.
+ * Receive queue control primary process-only information.
*/
struct sfc_rxq {
struct sfc_evq *evq;
@@ -110,7 +109,6 @@ struct sfc_rxq_info {
unsigned int entries;
efx_rxq_type_t type;
unsigned int type_flags;
- struct sfc_rxq *rxq;
struct sfc_dp_rxq *dp;
boolean_t deferred_start;
boolean_t deferred_started;
--
2.17.1
next prev 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 ` Andrew Rybchenko [this message]
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 ` [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-20-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).