DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, Radu Bulie <radu-andrei.bulie@nxp.com>,
	Jun Yang <jun.yang@nxp.com>, Nipun Gupta <nipun.gupta@nxp.com>
Subject: [dpdk-dev] [PATCH v3 4/8] bus/dpaa: add shared MAC support
Date: Sat, 11 Jul 2020 13:47:12 +0530
Message-ID: <20200711081716.25173-4-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20200711081716.25173-1-hemant.agrawal@nxp.com>

From: Radu Bulie <radu-andrei.bulie@nxp.com>

A shared MAC interface is an interface which can be used
by both kernel and userspace based on classification configuration
It is defined in dts with the compatible string "fsl,dpa-ethernet-shared"
which bpool will be seeded by the dpdk partition and configured
as a netdev by the dpaa Linux eth driver.
User space buffers from the bpool will be kmapped by the kernel.

Signed-off-by: Radu Bulie <radu-andrei.bulie@nxp.com>
Signed-off-by: Jun Yang <jun.yang@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/dpaa/base/fman/fman.c | 27 ++++++++++++++++++++++-----
 drivers/bus/dpaa/include/fman.h   |  2 ++
 drivers/net/dpaa/dpaa_ethdev.c    | 31 +++++++++++++++++--------------
 drivers/net/dpaa/dpaa_flow.c      | 18 ++++++++++++++----
 4 files changed, 55 insertions(+), 23 deletions(-)

diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index 33be9e5d7..3ae29bf06 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -167,13 +167,21 @@ fman_if_init(const struct device_node *dpa_node)
 	const char *mname, *fname;
 	const char *dname = dpa_node->full_name;
 	size_t lenp;
-	int _errno;
+	int _errno, is_shared = 0;
 	const char *char_prop;
 	uint32_t na;
 
 	if (of_device_is_available(dpa_node) == false)
 		return 0;
 
+	if (!of_device_is_compatible(dpa_node, "fsl,dpa-ethernet-init") &&
+		!of_device_is_compatible(dpa_node, "fsl,dpa-ethernet-shared")) {
+		return 0;
+	}
+
+	if (of_device_is_compatible(dpa_node, "fsl,dpa-ethernet-shared"))
+		is_shared = 1;
+
 	rprop = "fsl,qman-frame-queues-rx";
 	mprop = "fsl,fman-mac";
 
@@ -387,7 +395,7 @@ fman_if_init(const struct device_node *dpa_node)
 		goto err;
 	}
 
-	assert(lenp == (4 * sizeof(phandle)));
+	assert(lenp >= (4 * sizeof(phandle)));
 
 	na = of_n_addr_cells(mac_node);
 	/* Get rid of endianness (issues). Convert to host byte order */
@@ -408,7 +416,7 @@ fman_if_init(const struct device_node *dpa_node)
 		goto err;
 	}
 
-	assert(lenp == (4 * sizeof(phandle)));
+	assert(lenp >= (4 * sizeof(phandle)));
 	/*TODO: Fix for other cases also */
 	na = of_n_addr_cells(mac_node);
 	/* Get rid of endianness (issues). Convert to host byte order */
@@ -508,6 +516,9 @@ fman_if_init(const struct device_node *dpa_node)
 		pools_phandle++;
 	}
 
+	if (is_shared)
+		__if->__if.is_shared_mac = 1;
+
 	/* Parsing of the network interface is complete, add it to the list */
 	DPAA_BUS_LOG(DEBUG, "Found %s, Tx Channel = %x, FMAN = %x,"
 		    "Port ID = %x",
@@ -524,7 +535,7 @@ fman_if_init(const struct device_node *dpa_node)
 int
 fman_init(void)
 {
-	const struct device_node *dpa_node;
+	const struct device_node *dpa_node, *parent_node;
 	int _errno;
 
 	/* If multiple dependencies try to initialise the Fman driver, don't
@@ -539,7 +550,13 @@ fman_init(void)
 		return fman_ccsr_map_fd;
 	}
 
-	for_each_compatible_node(dpa_node, NULL, "fsl,dpa-ethernet-init") {
+	parent_node = of_find_compatible_node(NULL, NULL, "fsl,dpaa");
+	if (!parent_node) {
+		DPAA_BUS_LOG(ERR, "Unable to find fsl,dpaa node");
+		return -ENODEV;
+	}
+
+	for_each_child_node(parent_node, dpa_node) {
 		_errno = fman_if_init(dpa_node);
 		if (_errno) {
 			FMAN_ERR(_errno, "if_init(%s)\n", dpa_node->full_name);
diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h
index 7a0a7d405..cb7f18ca2 100644
--- a/drivers/bus/dpaa/include/fman.h
+++ b/drivers/bus/dpaa/include/fman.h
@@ -320,6 +320,8 @@ struct fman_if {
 	struct rte_ether_addr mac_addr;
 	/* The Qman channel to schedule Tx FQs to */
 	u16 tx_channel_id;
+
+	uint8_t is_shared_mac;
 	/* The hard-coded FQIDs for this interface. Note: this doesn't cover
 	 * the PCD nor the "Rx default" FQIDs, which are configured via FMC
 	 * and its XML-based configuration.
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index c5b9ac1a5..c2d480397 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -351,7 +351,8 @@ static void dpaa_eth_dev_stop(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	fman_if_disable_rx(fif);
+	if (!fif->is_shared_mac)
+		fman_if_disable_rx(fif);
 	dev->tx_pkt_burst = dpaa_eth_tx_drop_all;
 }
 
@@ -1807,19 +1808,21 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 		fman_intf->mac_addr.addr_bytes[4],
 		fman_intf->mac_addr.addr_bytes[5]);
 
-
-	/* Disable RX mode */
-	fman_if_discard_rx_errors(fman_intf);
-	fman_if_disable_rx(fman_intf);
-	/* Disable promiscuous mode */
-	fman_if_promiscuous_disable(fman_intf);
-	/* Disable multicast */
-	fman_if_reset_mcast_filter_table(fman_intf);
-	/* Reset interface statistics */
-	fman_if_stats_reset(fman_intf);
-	/* Disable SG by default */
-	fman_if_set_sg(fman_intf, 0);
-	fman_if_set_maxfrm(fman_intf, RTE_ETHER_MAX_LEN + VLAN_TAG_SIZE);
+	if (!fman_intf->is_shared_mac) {
+		/* Disable RX mode */
+		fman_if_discard_rx_errors(fman_intf);
+		fman_if_disable_rx(fman_intf);
+		/* Disable promiscuous mode */
+		fman_if_promiscuous_disable(fman_intf);
+		/* Disable multicast */
+		fman_if_reset_mcast_filter_table(fman_intf);
+		/* Reset interface statistics */
+		fman_if_stats_reset(fman_intf);
+		/* Disable SG by default */
+		fman_if_set_sg(fman_intf, 0);
+		fman_if_set_maxfrm(fman_intf,
+				   RTE_ETHER_MAX_LEN + VLAN_TAG_SIZE);
+	}
 
 	return 0;
 
diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c
index 860f2f59b..7b920b055 100644
--- a/drivers/net/dpaa/dpaa_flow.c
+++ b/drivers/net/dpaa/dpaa_flow.c
@@ -739,6 +739,14 @@ int dpaa_fm_deconfig(struct dpaa_if *dpaa_intf,
 	}
 	dpaa_intf->netenv_handle = NULL;
 
+	if (fif && fif->is_shared_mac) {
+		ret = FM_PORT_Enable(dpaa_intf->port_handle);
+		if (ret != E_OK) {
+			DPAA_PMD_ERR("shared mac re-enable failed");
+			return ret;
+		}
+	}
+
 	/* FM PORT Close */
 	FM_PORT_Close(dpaa_intf->port_handle);
 	dpaa_intf->port_handle = NULL;
@@ -788,10 +796,12 @@ int dpaa_fm_config(struct rte_eth_dev *dev, uint64_t req_dist_set)
 		}
 	}
 	/* Set default netenv and scheme */
-	ret = set_default_scheme(dpaa_intf);
-	if (ret) {
-		DPAA_PMD_ERR("Set PCD NetEnv and Scheme: Failed");
-		goto unset_pcd_netenv_scheme1;
+	if (!fif->is_shared_mac) {
+		ret = set_default_scheme(dpaa_intf);
+		if (ret) {
+			DPAA_PMD_ERR("Set PCD NetEnv and Scheme: Failed");
+			goto unset_pcd_netenv_scheme1;
+		}
 	}
 
 	/* Set Port PCD */
-- 
2.17.1


  parent reply	other threads:[~2020-07-11  8:22 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10 17:19 [dpdk-dev] [PATCH v2 1/9] net/dpaa: support Rxq and Txq info routines Hemant Agrawal
2020-07-10 17:19 ` [dpdk-dev] [PATCH v2 2/9] net/dpaa: add support for fmlib in dpdk Hemant Agrawal
2020-07-10 17:19 ` [dpdk-dev] [PATCH v2 3/9] net/dpaa: add VSP support in FMLIB Hemant Agrawal
2020-07-10 17:19 ` [dpdk-dev] [PATCH v2 4/9] net/dpaa: add support for fmcless mode Hemant Agrawal
2020-07-10 17:19 ` [dpdk-dev] [PATCH v2 5/9] bus/dpaa: add shared MAC support Hemant Agrawal
2020-07-10 17:19 ` [dpdk-dev] [PATCH v2 6/9] bus/dpaa: add Virtual Storage Profile port init Hemant Agrawal
2020-07-10 17:19 ` [dpdk-dev] [PATCH v2 7/9] net/dpaa: add support for Virtual Storage Profile Hemant Agrawal
2020-07-10 17:19 ` [dpdk-dev] [PATCH v2 8/9] net/dpaa: add fmc parser support for VSP Hemant Agrawal
2020-07-10 17:19 ` [dpdk-dev] [PATCH v2 9/9] net/dpaa: add RSS update func with FMCless Hemant Agrawal
2020-07-11  8:17 ` [dpdk-dev] [PATCH v3 1/8] net/dpaa: add support for fmlib in dpdk Hemant Agrawal
2020-07-11  8:17   ` [dpdk-dev] [PATCH v3 2/8] net/dpaa: add VSP support in FMLIB Hemant Agrawal
2020-07-11  8:17   ` [dpdk-dev] [PATCH v3 3/8] net/dpaa: add support for fmcless mode Hemant Agrawal
2020-07-11  8:17   ` Hemant Agrawal [this message]
2020-07-11  8:17   ` [dpdk-dev] [PATCH v3 5/8] bus/dpaa: add Virtual Storage Profile port init Hemant Agrawal
2020-07-11  8:17   ` [dpdk-dev] [PATCH v3 6/8] net/dpaa: add support for Virtual Storage Profile Hemant Agrawal
2020-07-11  8:17   ` [dpdk-dev] [PATCH v3 7/8] net/dpaa: add fmc parser support for VSP Hemant Agrawal
2020-07-11  8:17   ` [dpdk-dev] [PATCH v3 8/8] net/dpaa: add RSS update func with FMCless Hemant Agrawal
2020-07-17 11:36   ` [dpdk-dev] [PATCH v3 1/8] net/dpaa: add support for fmlib in dpdk Ferruh Yigit
2020-07-19 20:10     ` Thomas Monjalon
2020-07-20  4:50       ` Hemant Agrawal
2020-07-20 17:06         ` Thomas Monjalon
2020-07-21  3:26           ` Hemant Agrawal
2020-07-20 18:42         ` Stephen Hemminger
2020-07-28 13:41         ` David Marchand
2020-07-29  6:39           ` Hemant Agrawal
2020-07-29 12:07             ` Thomas Monjalon
2020-07-29 14:33             ` Kevin Traynor
2020-07-20  9:51       ` Ferruh Yigit
2020-08-11 12:29   ` [dpdk-dev] [PATCH v4 " Hemant Agrawal
2020-08-11 12:29     ` [dpdk-dev] [PATCH v4 2/8] net/dpaa: add VSP support in FMLIB Hemant Agrawal
2020-08-11 12:29     ` [dpdk-dev] [PATCH v4 3/8] net/dpaa: add support for fmcless mode Hemant Agrawal
2020-08-11 12:29     ` [dpdk-dev] [PATCH v4 4/8] bus/dpaa: add shared MAC support Hemant Agrawal
2020-08-11 12:29     ` [dpdk-dev] [PATCH v4 5/8] bus/dpaa: add Virtual Storage Profile port init Hemant Agrawal
2020-08-11 12:29     ` [dpdk-dev] [PATCH v4 6/8] net/dpaa: add support for Virtual Storage Profile Hemant Agrawal
2020-08-11 12:30     ` [dpdk-dev] [PATCH v4 7/8] net/dpaa: add fmc parser support for VSP Hemant Agrawal
2020-08-11 12:30     ` [dpdk-dev] [PATCH v4 8/8] net/dpaa: add RSS update func with FMCless Hemant Agrawal
2020-08-13 18:01     ` [dpdk-dev] [PATCH v5 1/8] net/dpaa: add support for fmlib in dpdk Hemant Agrawal
2020-08-13 18:01       ` [dpdk-dev] [PATCH v5 2/8] net/dpaa: add VSP support in FMLIB Hemant Agrawal
2020-08-13 18:01       ` [dpdk-dev] [PATCH v5 3/8] net/dpaa: add support for fmcless mode Hemant Agrawal
2020-08-13 18:01       ` [dpdk-dev] [PATCH v5 4/8] bus/dpaa: add shared MAC support Hemant Agrawal
2020-08-13 18:01       ` [dpdk-dev] [PATCH v5 5/8] bus/dpaa: add Virtual Storage Profile port init Hemant Agrawal
2020-08-13 18:01       ` [dpdk-dev] [PATCH v5 6/8] net/dpaa: add support for Virtual Storage Profile Hemant Agrawal
2020-08-13 18:01       ` [dpdk-dev] [PATCH v5 7/8] net/dpaa: add fmc parser support for VSP Hemant Agrawal
2020-08-13 18:01       ` [dpdk-dev] [PATCH v5 8/8] net/dpaa: add RSS update func with FMCless Hemant Agrawal
2020-08-26 13:54       ` [dpdk-dev] [PATCH v5 1/8] net/dpaa: add support for fmlib in dpdk Ferruh Yigit
2020-08-26 14:52         ` Ferruh Yigit
2020-08-26 17:06           ` Hemant Agrawal
2020-08-26 21:20             ` Ferruh Yigit
2020-09-01 12:36       ` [dpdk-dev] [PATCH v6 " Hemant Agrawal
2020-09-01 12:36         ` [dpdk-dev] [PATCH v6 2/8] net/dpaa: add VSP support in FMLIB Hemant Agrawal
2020-09-01 12:36         ` [dpdk-dev] [PATCH v6 3/8] net/dpaa: add support for fmcless mode Hemant Agrawal
2020-09-01 12:36         ` [dpdk-dev] [PATCH v6 4/8] bus/dpaa: add shared MAC support Hemant Agrawal
2020-09-01 12:36         ` [dpdk-dev] [PATCH v6 5/8] bus/dpaa: add Virtual Storage Profile port init Hemant Agrawal
2020-09-01 12:36         ` [dpdk-dev] [PATCH v6 6/8] net/dpaa: add support for Virtual Storage Profile Hemant Agrawal
2020-09-01 12:36         ` [dpdk-dev] [PATCH v6 7/8] net/dpaa: add fmc parser support for VSP Hemant Agrawal
2020-09-01 12:36         ` [dpdk-dev] [PATCH v6 8/8] net/dpaa: add RSS update func with FMCless Hemant Agrawal
2020-09-01 15:48         ` [dpdk-dev] [PATCH v6 1/8] net/dpaa: add support for fmlib in dpdk Ferruh Yigit
2020-09-02  5:15           ` Hemant Agrawal
2020-09-02 13:32             ` Ferruh Yigit
2020-09-03  3:24               ` Hemant Agrawal
2020-09-03 19:54                 ` Ferruh Yigit
2020-09-04  8:29         ` [dpdk-dev] [PATCH v7 1/7] net/dpaa: add VSP support in FMLIB Hemant Agrawal
2020-09-04  8:29           ` [dpdk-dev] [PATCH v7 2/7] net/dpaa: add support for fmcless mode Hemant Agrawal
2020-09-04  8:29           ` [dpdk-dev] [PATCH v7 3/7] bus/dpaa: add shared MAC support Hemant Agrawal
2020-09-04  8:29           ` [dpdk-dev] [PATCH v7 4/7] bus/dpaa: add Virtual Storage Profile port init Hemant Agrawal
2020-09-04  8:29           ` [dpdk-dev] [PATCH v7 5/7] net/dpaa: add support for Virtual Storage Profile Hemant Agrawal
2020-09-04  8:29           ` [dpdk-dev] [PATCH v7 6/7] net/dpaa: add fmc parser support for VSP Hemant Agrawal
2020-09-04  8:29           ` [dpdk-dev] [PATCH v7 7/7] net/dpaa: add RSS update func with FMCless Hemant Agrawal
2020-09-04  8:39           ` [dpdk-dev] [PATCH v8 1/8] net/dpaa: add support for fmlib in dpdk Hemant Agrawal
2020-09-04  8:39             ` [dpdk-dev] [PATCH v8 2/8] net/dpaa: add VSP support in FMLIB Hemant Agrawal
2020-09-04  8:39             ` [dpdk-dev] [PATCH v8 3/8] net/dpaa: add support for fmcless mode Hemant Agrawal
2020-09-04  8:39             ` [dpdk-dev] [PATCH v8 4/8] bus/dpaa: add shared MAC support Hemant Agrawal
2020-09-04  8:39             ` [dpdk-dev] [PATCH v8 5/8] bus/dpaa: add Virtual Storage Profile port init Hemant Agrawal
2020-09-04  8:39             ` [dpdk-dev] [PATCH v8 6/8] net/dpaa: add support for Virtual Storage Profile Hemant Agrawal
2020-09-04  8:39             ` [dpdk-dev] [PATCH v8 7/8] net/dpaa: add fmc parser support for VSP Hemant Agrawal
2020-09-04  8:39             ` [dpdk-dev] [PATCH v8 8/8] net/dpaa: add RSS update func with FMCless Hemant Agrawal
2020-09-04 12:51             ` [dpdk-dev] [PATCH v8 1/8] net/dpaa: add support for fmlib in dpdk Ferruh Yigit
2020-09-08  9:55               ` Ferruh Yigit
2020-09-08 10:19                 ` Thomas Monjalon
2020-09-08 12:10                   ` Ferruh Yigit
2020-09-09 11:16                     ` [dpdk-dev] [dpdk-ci] " 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=20200711081716.25173-4-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jun.yang@nxp.com \
    --cc=nipun.gupta@nxp.com \
    --cc=radu-andrei.bulie@nxp.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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git