DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Gautam Dawar <gdawar@solarflare.com>
Subject: [dpdk-dev] [PATCH 23/29] net/sfc/base: support data path with EVB module
Date: Mon, 10 Jun 2019 08:38:38 +0100	[thread overview]
Message-ID: <1560152324-20538-24-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1560152324-20538-1-git-send-email-arybchenko@solarflare.com>

From: Gautam Dawar <gdawar@solarflare.com>

ef10_nic_init() allocates a vAdaptor for the physical port in current
flow. In case of SR-IOV, this vAdaptor must be created for the PF as the
vSwitch is allocated on the physical port. So, the call to
efx_mcdi_vadaptor_alloc() should be avoided in ef10_nic_init() in SR-IOV
flow. To achieve this, for SR-IOV use case, the vSwitch is created
before NIC initialization and its handle is used to prevent vAdaptor
allocation in ef10_nic_init(). This approach has been taken to minimize
the changes in NIC initilization flow.

This is also the case with Linux driver where vSwitch creation happens
before NIC initialization.

Also, when DMA queues need to be allocated for Tx/Rx functionality
(MC_CMD_INIT_RXQ / MC_CMD_INIT_TXQ), the correct vPort is selected
based on efx_vswitch_t property of efx_nic_t structure - vport
corresponding to PF in case of SR-IOV use case and EVB_PORT_ID_ASSIGNED
for physical port.

Signed-off-by: Gautam Dawar <gdawar@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/ef10_filter.c |  3 +--
 drivers/net/sfc/base/ef10_nic.c    | 18 ++++++++++++++----
 drivers/net/sfc/base/ef10_rx.c     |  4 ++--
 drivers/net/sfc/base/ef10_tx.c     |  2 +-
 4 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/net/sfc/base/ef10_filter.c b/drivers/net/sfc/base/ef10_filter.c
index 9c09a0d..e4f8de5 100644
--- a/drivers/net/sfc/base/ef10_filter.c
+++ b/drivers/net/sfc/base/ef10_filter.c
@@ -202,8 +202,7 @@
 		goto fail1;
 	}
 
-	MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_PORT_ID,
-	    EVB_PORT_ID_ASSIGNED);
+	MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_PORT_ID, enp->en_vport_id);
 	MCDI_IN_SET_DWORD(req, FILTER_OP_EXT_IN_MATCH_FIELDS,
 	    match_flags);
 	if (spec->efs_dmaq_id == EFX_FILTER_SPEC_RX_DMAQ_ID_DROP) {
diff --git a/drivers/net/sfc/base/ef10_nic.c b/drivers/net/sfc/base/ef10_nic.c
index 0cf9ddd..a647daa 100644
--- a/drivers/net/sfc/base/ef10_nic.c
+++ b/drivers/net/sfc/base/ef10_nic.c
@@ -233,8 +233,6 @@
 		MC_CMD_VADAPTOR_ALLOC_OUT_LEN);
 	efx_rc_t rc;
 
-	EFSYS_ASSERT3U(enp->en_vport_id, ==, EVB_PORT_ID_NULL);
-
 	req.emr_cmd = MC_CMD_VADAPTOR_ALLOC;
 	req.emr_in_buf = payload;
 	req.emr_in_length = MC_CMD_VADAPTOR_ALLOC_IN_LEN;
@@ -2517,9 +2515,21 @@
 {
 	uint32_t i;
 	efx_rc_t rc;
+	boolean_t do_vadaptor_free = B_TRUE;
 
-	(void) efx_mcdi_vadaptor_free(enp, enp->en_vport_id);
-	enp->en_vport_id = 0;
+#if EFSYS_OPT_EVB
+	if (enp->en_vswitchp != NULL) {
+		/*
+		 * For SR-IOV the vAdaptor is freed with the vswitch,
+		 * so do not free it here.
+		 */
+		do_vadaptor_free = B_FALSE;
+	}
+#endif
+	if (do_vadaptor_free != B_FALSE) {
+		(void) efx_mcdi_vadaptor_free(enp, enp->en_vport_id);
+		enp->en_vport_id = EVB_PORT_ID_NULL;
+	}
 
 	/* Unlink piobufs from extra VIs in WC mapping */
 	if (enp->en_arch.ef10.ena_piobuf_count > 0) {
diff --git a/drivers/net/sfc/base/ef10_rx.c b/drivers/net/sfc/base/ef10_rx.c
index 27514c1..10eace4 100644
--- a/drivers/net/sfc/base/ef10_rx.c
+++ b/drivers/net/sfc/base/ef10_rx.c
@@ -106,7 +106,7 @@
 	    INIT_RXQ_EXT_IN_FLAG_WANT_OUTER_CLASSES, want_outer_classes,
 	    INIT_RXQ_EXT_IN_FLAG_NO_CONT_EV, no_cont_ev);
 	MCDI_IN_SET_DWORD(req, INIT_RXQ_EXT_IN_OWNER_ID, 0);
-	MCDI_IN_SET_DWORD(req, INIT_RXQ_EXT_IN_PORT_ID, EVB_PORT_ID_ASSIGNED);
+	MCDI_IN_SET_DWORD(req, INIT_RXQ_EXT_IN_PORT_ID, enp->en_vport_id);
 
 	if (es_bufs_per_desc > 0) {
 		MCDI_IN_SET_DWORD(req,
@@ -233,7 +233,7 @@
 	req.emr_out_length = MC_CMD_RSS_CONTEXT_ALLOC_OUT_LEN;
 
 	MCDI_IN_SET_DWORD(req, RSS_CONTEXT_ALLOC_IN_UPSTREAM_PORT_ID,
-	    EVB_PORT_ID_ASSIGNED);
+		enp->en_vport_id);
 	MCDI_IN_SET_DWORD(req, RSS_CONTEXT_ALLOC_IN_TYPE, context_type);
 
 	/*
diff --git a/drivers/net/sfc/base/ef10_tx.c b/drivers/net/sfc/base/ef10_tx.c
index 6a90816..90f4803 100644
--- a/drivers/net/sfc/base/ef10_tx.c
+++ b/drivers/net/sfc/base/ef10_tx.c
@@ -82,7 +82,7 @@
 	    INIT_TXQ_IN_FLAG_TIMESTAMP, 0);
 
 	MCDI_IN_SET_DWORD(req, INIT_TXQ_IN_OWNER_ID, 0);
-	MCDI_IN_SET_DWORD(req, INIT_TXQ_IN_PORT_ID, EVB_PORT_ID_ASSIGNED);
+	MCDI_IN_SET_DWORD(req, INIT_TXQ_IN_PORT_ID, enp->en_vport_id);
 
 	dma_addr = MCDI_IN2(req, efx_qword_t, INIT_TXQ_IN_DMA_ADDR);
 	addr = EFSYS_MEM_ADDR(esmp);
-- 
1.8.3.1


  parent reply	other threads:[~2019-06-10  7:41 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10  7:38 [dpdk-dev] [PATCH 00/29] net/sfc/base: update base driver Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 01/29] net/sfc/base: enable chained multicast on all EF10 cards Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 02/29] net/sfc/base: fix signed/unsigned mismatch errors Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 03/29] net/sfc/base: fix shift by more bits than field width Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 04/29] net/sfc/base: improve code style in sensors decoding Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 05/29] net/sfc/base: do not rely on indirect header inclusion Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 06/29] net/sfc/base: add driver version string registration Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 07/29] net/sfc/base: add capabilities for bundle partition support Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 08/29] net/sfc/base: add extensible NVRAM info function Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 09/29] net/sfc/base: add NVRAM info to API Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 10/29] net/sfc/base: update MCDI headers Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 11/29] net/sfc/base: add firmware ID header Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 12/29] net/sfc/base: support direct FW update for bundle partitions Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 13/29] net/sfc/base: transition to the extensible NVRAM info API Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 14/29] net/sfc/base: add background mode firmware updating Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 15/29] net/sfc/base: add definition of bundle metadata partition Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 16/29] net/sfc/base: add definition of OEM TLV Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 17/29] net/sfc/base: export the zero-based MCDI port number Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 18/29] net/sfc/base: introduce of EVB module for SR-IOV support Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 19/29] net/sfc/base: add MCDI wrappers for vPort and vSwitch in EVB Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 20/29] net/sfc/base: add EVB module vSwitch/vPort/vAdaptor ops Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 21/29] net/sfc/base: implement vSwitch create/destroy Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 22/29] net/sfc/base: factor out upstream port vAdaptor allocation Andrew Rybchenko
2019-06-10  7:38 ` Andrew Rybchenko [this message]
2019-06-10  7:38 ` [dpdk-dev] [PATCH 24/29] net/sfc/base: support proxy auth operations for SR-IOV Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 25/29] net/sfc/base: implement proxy auth MCDI event handling Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 26/29] net/sfc/base: provide proxy APIs to client drivers Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 27/29] net/sfc/base: provide APIs to configure and reset vPort Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 28/29] net/sfc/base: provide API to fetch vPort statistics Andrew Rybchenko
2019-06-10  7:38 ` [dpdk-dev] [PATCH 29/29] net/sfc/base: add APIs for PTP privilege configuration Andrew Rybchenko
2019-06-18  7:52 ` [dpdk-dev] [PATCH 00/29] net/sfc/base: update base driver Ferruh Yigit
2019-06-23 22:37   ` Thomas Monjalon
2019-06-24  7:53     ` Andrew Rybchenko
2019-06-24 11:17       ` Ferruh Yigit
2019-06-24 13:07         ` Thomas Monjalon

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=1560152324-20538-24-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=gdawar@solarflare.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).