Patchwork [dpdk-dev,27/30] net/sfc: move isolated flag in adapter shared

login
register
mail settings
Submitter Andrew Rybchenko
Date Feb. 7, 2019, 12:17 p.m.
Message ID <1549541873-17403-28-git-send-email-arybchenko@solarflare.com>
Download mbox | patch
Permalink /patch/720451/
State New
Headers show

Comments

Andrew Rybchenko - Feb. 7, 2019, 12:17 p.m.
The flag is required in default RSS RETA get which does not make sense
in isolated mode.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc.h        |  3 ++-
 drivers/net/sfc/sfc_ethdev.c | 15 ++++++---------
 drivers/net/sfc/sfc_flow.c   |  3 +--
 drivers/net/sfc/sfc_port.c   |  2 +-
 drivers/net/sfc/sfc_rx.c     |  3 +--
 5 files changed, 11 insertions(+), 15 deletions(-)

Patch

diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index 72992d68b..e8569bbbc 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -131,7 +131,6 @@  struct sfc_port {
 	 * Flow API isolated mode overrides promisc and allmulti settings;
 	 * they won't be applied if isolated mode is active
 	 */
-	boolean_t			isolated;
 	boolean_t			promisc;
 	boolean_t			allmulti;
 
@@ -184,6 +183,8 @@  struct sfc_adapter_shared {
 
 	struct sfc_rss			rss;
 
+	boolean_t			isolated;
+
 	struct rte_pci_addr		pci_addr;
 	uint16_t			port_id;
 
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 034229f37..c6bee09ee 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -357,7 +357,7 @@  sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 	if (*toggle != enabled) {
 		*toggle = enabled;
 
-		if (port->isolated) {
+		if (sfc_sa2shared(sa)->isolated) {
 			sfc_warn(sa, "isolated mode is active on the port");
 			sfc_warn(sa, "the change is to be applied on the next "
 				     "start provided that isolated mode is "
@@ -957,7 +957,7 @@  sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
 	 * on the next port start if the user prevents
 	 * isolated mode from being enabled.
 	 */
-	if (port->isolated) {
+	if (sfc_sa2shared(sa)->isolated) {
 		sfc_warn(sa, "isolated mode is active on the port");
 		sfc_warn(sa, "will not set MAC address");
 		goto unlock;
@@ -1027,7 +1027,7 @@  sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set,
 	int rc;
 	unsigned int i;
 
-	if (port->isolated) {
+	if (sfc_sa2shared(sa)->isolated) {
 		sfc_err(sa, "isolated mode is active on the port");
 		sfc_err(sa, "will not set multicast address list");
 		return -ENOTSUP;
@@ -1451,11 +1451,10 @@  sfc_dev_rss_hash_update(struct rte_eth_dev *dev,
 {
 	struct sfc_adapter *sa = dev->data->dev_private;
 	struct sfc_rss *rss = &sfc_sa2shared(sa)->rss;
-	struct sfc_port *port = &sa->port;
 	unsigned int efx_hash_types;
 	int rc = 0;
 
-	if (port->isolated)
+	if (sfc_sa2shared(sa)->isolated)
 		return -ENOTSUP;
 
 	if (rss->context_type != EFX_RX_SCALE_EXCLUSIVE) {
@@ -1529,10 +1528,9 @@  sfc_dev_rss_reta_query(struct rte_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_rss *rss = &sas->rss;
-	struct sfc_port *port = &sa->port;
 	int entry;
 
-	if (rss->context_type != EFX_RX_SCALE_EXCLUSIVE || port->isolated)
+	if (rss->context_type != EFX_RX_SCALE_EXCLUSIVE || sas->isolated)
 		return -ENOTSUP;
 
 	if (rss->channels == 0)
@@ -1563,13 +1561,12 @@  sfc_dev_rss_reta_update(struct rte_eth_dev *dev,
 {
 	struct sfc_adapter *sa = dev->data->dev_private;
 	struct sfc_rss *rss = &sfc_sa2shared(sa)->rss;
-	struct sfc_port *port = &sa->port;
 	unsigned int *rss_tbl_new;
 	uint16_t entry;
 	int rc = 0;
 
 
-	if (port->isolated)
+	if (sfc_sa2shared(sa)->isolated)
 		return -ENOTSUP;
 
 	if (rss->context_type != EFX_RX_SCALE_EXCLUSIVE) {
diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c
index 201c6cd06..01a81eab8 100644
--- a/drivers/net/sfc/sfc_flow.c
+++ b/drivers/net/sfc/sfc_flow.c
@@ -2425,7 +2425,6 @@  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_port *port = &sa->port;
 	int ret = 0;
 
 	sfc_adapter_lock(sa);
@@ -2435,7 +2434,7 @@  sfc_flow_isolate(struct rte_eth_dev *dev, int enable,
 				   NULL, "please close the port first");
 		ret = -rte_errno;
 	} else {
-		port->isolated = (enable) ? B_TRUE : B_FALSE;
+		sfc_sa2shared(sa)->isolated = (enable) ? B_TRUE : B_FALSE;
 	}
 	sfc_adapter_unlock(sa);
 
diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c
index 5eb4b3aca..1709dba4e 100644
--- a/drivers/net/sfc/sfc_port.c
+++ b/drivers/net/sfc/sfc_port.c
@@ -226,7 +226,7 @@  sfc_port_start(struct sfc_adapter *sa)
 	if (rc != 0)
 		goto fail_mac_pdu_set;
 
-	if (!port->isolated) {
+	if (!sfc_sa2shared(sa)->isolated) {
 		struct ether_addr *addr = &port->default_mac_addr;
 
 		sfc_log_init(sa, "set MAC address");
diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index 3b4b65f6e..cd8abc8ea 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -669,7 +669,6 @@  sfc_rx_default_rxq_set_filter(struct sfc_adapter *sa, struct sfc_rxq *rxq)
 int
 sfc_rx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
 {
-	struct sfc_port *port = &sa->port;
 	struct sfc_rxq_info *rxq_info;
 	struct sfc_rxq *rxq;
 	struct sfc_evq *evq;
@@ -731,7 +730,7 @@  sfc_rx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
 
 	rxq_info->state |= SFC_RXQ_STARTED;
 
-	if ((sw_index == 0) && !port->isolated) {
+	if (sw_index == 0 && !sfc_sa2shared(sa)->isolated) {
 		rc = sfc_rx_default_rxq_set_filter(sa, rxq);
 		if (rc != 0)
 			goto fail_mac_filter_default_rxq_set;