From patchwork Fri Mar 31 10:22:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 22988 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 5810F2B94; Fri, 31 Mar 2017 12:22:40 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 765932B94 for ; Fri, 31 Mar 2017 12:22:35 +0200 (CEST) Received: from pure.maildistiller.com (unknown [10.110.50.29]) by dispatch1-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTP id 1240F80058 for ; Fri, 31 Mar 2017 10:22:35 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx8-us1.ppe-hosted.com (unknown [10.110.49.251]) by pure.maildistiller.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 99B836004B for ; Fri, 31 Mar 2017 10:22:34 +0000 (UTC) Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx8-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 3A529440061 for ; Fri, 31 Mar 2017 10:22:33 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Fri, 31 Mar 2017 03:22:30 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25 via Frontend Transport; Fri, 31 Mar 2017 03:22:30 -0700 Received: from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com [10.17.10.10]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id v2VAMTiY030626 for ; Fri, 31 Mar 2017 11:22:29 +0100 Received: from uklogin.uk.solarflarecom.com (localhost.localdomain [127.0.0.1]) by uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id v2VAMTQg009951 for ; Fri, 31 Mar 2017 11:22:29 +0100 From: Andrew Rybchenko To: Date: Fri, 31 Mar 2017 11:22:12 +0100 Message-ID: <1490955743-9868-3-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1490955743-9868-1-git-send-email-arybchenko@solarflare.com> References: <1490955743-9868-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 X-MDID: 1490955755-Cr4b5NO1MFF8 Subject: [dpdk-dev] [PATCH 02/13] net/sfc: bind EvQ DMA space to EvQ type and type-local index X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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 index of an event queue index is computed from the index of the corresponding transmit or receive queue, and depends on the total number of receive queues. As a consequence, the index of an event queue bound to a transmit queue changes if the total number of receive queues is changed. Fixes: 58294ee65afb ("net/sfc: support event queue") Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/net/sfc/sfc_ev.c | 27 +++++++++++++++++++++++---- drivers/net/sfc/sfc_ev.h | 10 ++++++++++ drivers/net/sfc/sfc_rx.c | 3 ++- drivers/net/sfc/sfc_tx.c | 3 ++- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c index 800b08e..46de7a5 100644 --- a/drivers/net/sfc/sfc_ev.c +++ b/drivers/net/sfc/sfc_ev.c @@ -55,6 +55,21 @@ /* Management event queue polling period in microseconds */ #define SFC_MGMT_EV_QPOLL_PERIOD_US (US_PER_S) +static const char * +sfc_evq_type2str(enum sfc_evq_type type) +{ + switch (type) { + case SFC_EVQ_TYPE_MGMT: + return "mgmt-evq"; + case SFC_EVQ_TYPE_RX: + return "rx-evq"; + case SFC_EVQ_TYPE_TX: + return "tx-evq"; + default: + SFC_ASSERT(B_FALSE); + return NULL; + } +} static boolean_t sfc_ev_initialized(void *arg) @@ -786,13 +801,15 @@ sfc_ev_stop(struct sfc_adapter *sa) int sfc_ev_qinit(struct sfc_adapter *sa, unsigned int sw_index, + enum sfc_evq_type type, unsigned int type_index, unsigned int entries, int socket_id) { struct sfc_evq_info *evq_info; struct sfc_evq *evq; int rc; - sfc_log_init(sa, "sw_index=%u", sw_index); + sfc_log_init(sa, "sw_index=%u type=%s type_index=%u", + sw_index, sfc_evq_type2str(type), type_index); evq_info = &sa->evq_info[sw_index]; @@ -808,9 +825,11 @@ sfc_ev_qinit(struct sfc_adapter *sa, unsigned int sw_index, evq->sa = sa; evq->evq_index = sw_index; + evq->type = type; /* Allocate DMA space */ - rc = sfc_dma_alloc(sa, "evq", sw_index, EFX_EVQ_SIZE(evq_info->entries), + rc = sfc_dma_alloc(sa, sfc_evq_type2str(type), type_index, + EFX_EVQ_SIZE(evq_info->entries), socket_id, &evq->mem); if (rc != 0) goto fail_dma_alloc; @@ -930,8 +949,8 @@ sfc_ev_init(struct sfc_adapter *sa) goto fail_ev_qinit_info; } - rc = sfc_ev_qinit(sa, sa->mgmt_evq_index, SFC_MGMT_EVQ_ENTRIES, - sa->socket_id); + rc = sfc_ev_qinit(sa, sa->mgmt_evq_index, SFC_EVQ_TYPE_MGMT, 0, + SFC_MGMT_EVQ_ENTRIES, sa->socket_id); if (rc != 0) goto fail_mgmt_evq_init; diff --git a/drivers/net/sfc/sfc_ev.h b/drivers/net/sfc/sfc_ev.h index e8d3090..f5e6415 100644 --- a/drivers/net/sfc/sfc_ev.h +++ b/drivers/net/sfc/sfc_ev.h @@ -58,6 +58,14 @@ enum sfc_evq_state { SFC_EVQ_NSTATES }; +enum sfc_evq_type { + SFC_EVQ_TYPE_MGMT = 0, + SFC_EVQ_TYPE_RX, + SFC_EVQ_TYPE_TX, + + SFC_EVQ_NTYPES +}; + struct sfc_evq { /* Used on datapath */ efx_evq_t *common; @@ -72,6 +80,7 @@ struct sfc_evq { struct sfc_adapter *sa; unsigned int evq_index; enum sfc_evq_state init_state; + enum sfc_evq_type type; }; struct sfc_evq_info { @@ -138,6 +147,7 @@ int sfc_ev_start(struct sfc_adapter *sa); void sfc_ev_stop(struct sfc_adapter *sa); int sfc_ev_qinit(struct sfc_adapter *sa, unsigned int sw_index, + enum sfc_evq_type type, unsigned int type_index, unsigned int entries, int socket_id); void sfc_ev_qfini(struct sfc_adapter *sa, unsigned int sw_index); int sfc_ev_qstart(struct sfc_adapter *sa, unsigned int sw_index); diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 403e991..8c929f8 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -902,7 +902,8 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, evq_index = sfc_evq_index_by_rxq_sw_index(sa, sw_index); - rc = sfc_ev_qinit(sa, evq_index, rxq_info->entries, socket_id); + rc = sfc_ev_qinit(sa, evq_index, SFC_EVQ_TYPE_RX, sw_index, + rxq_info->entries, socket_id); if (rc != 0) goto fail_ev_qinit; diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c index 3c4717f..2c45e1a 100644 --- a/drivers/net/sfc/sfc_tx.c +++ b/drivers/net/sfc/sfc_tx.c @@ -150,7 +150,8 @@ sfc_tx_qinit(struct sfc_adapter *sa, unsigned int sw_index, SFC_ASSERT(nb_tx_desc <= sa->txq_max_entries); txq_info->entries = nb_tx_desc; - rc = sfc_ev_qinit(sa, evq_index, txq_info->entries, socket_id); + rc = sfc_ev_qinit(sa, evq_index, SFC_EVQ_TYPE_TX, sw_index, + txq_info->entries, socket_id); if (rc != 0) goto fail_ev_qinit;