DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Ivan Malov <ivan.malov@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH 5/6] net/sfc: port must not fail to start if Rx mode is rejected
Date: Thu, 2 Mar 2017 15:46:47 +0000	[thread overview]
Message-ID: <1488469608-2252-6-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1488469608-2252-1-git-send-email-arybchenko@solarflare.com>

From: Ivan Malov <ivan.malov@oktetlabs.ru>

If Rx mode is unacceptable, in particular, when promiscuous
or all-multicast filters are not allowed while running over
PCI function which is not a member of appropriate privilege
groups, the driver has to cope with the failures gracefully

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
---
 drivers/net/sfc/sfc_rx.c | 54 +++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 51 insertions(+), 3 deletions(-)

diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index 906536e..0a9fa42 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -401,6 +401,56 @@ sfc_rx_qflush(struct sfc_adapter *sa, unsigned int sw_index)
 	sfc_rx_qpurge(rxq);
 }
 
+static int
+sfc_rx_default_rxq_set_filter(struct sfc_adapter *sa, struct sfc_rxq *rxq)
+{
+	boolean_t rss = (sa->rss_channels > 1) ? B_TRUE : B_FALSE;
+	struct sfc_port *port = &sa->port;
+	int rc;
+
+	/*
+	 * If promiscuous or all-multicast mode has been requested, setting
+	 * filter for the default Rx queue might fail, in particular, while
+	 * running over PCI function which is not a member of corresponding
+	 * privilege groups; if this occurs, few iterations will be made to
+	 * repeat this step without promiscuous and all-multicast flags set
+	 */
+retry:
+	rc = efx_mac_filter_default_rxq_set(sa->nic, rxq->common, rss);
+	if (rc == 0)
+		return 0;
+	else if (rc != EOPNOTSUPP)
+		return rc;
+
+	if (port->promisc) {
+		sfc_warn(sa, "promiscuous mode has been requested, "
+			     "but the HW rejects it");
+		sfc_warn(sa, "promiscuous mode will be disabled");
+
+		port->promisc = B_FALSE;
+		rc = sfc_set_rx_mode(sa);
+		if (rc != 0)
+			return rc;
+
+		goto retry;
+	}
+
+	if (port->allmulti) {
+		sfc_warn(sa, "all-multicast mode has been requested, "
+			     "but the HW rejects it");
+		sfc_warn(sa, "all-multicast mode will be disabled");
+
+		port->allmulti = B_FALSE;
+		rc = sfc_set_rx_mode(sa);
+		if (rc != 0)
+			return rc;
+
+		goto retry;
+	}
+
+	return rc;
+}
+
 int
 sfc_rx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
 {
@@ -439,9 +489,7 @@ sfc_rx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
 	sfc_rx_qrefill(rxq);
 
 	if (sw_index == 0) {
-		rc = efx_mac_filter_default_rxq_set(sa->nic, rxq->common,
-						    (sa->rss_channels > 1) ?
-						    B_TRUE : B_FALSE);
+		rc = sfc_rx_default_rxq_set_filter(sa, rxq);
 		if (rc != 0)
 			goto fail_mac_filter_default_rxq_set;
 	}
-- 
2.9.3

  parent reply	other threads:[~2017-03-02 15:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 15:46 [dpdk-dev] [PATCH 0/6] Support running Solarflare PMD over PCI VFs Andrew Rybchenko
2017-03-02 15:46 ` [dpdk-dev] [PATCH 1/6] net/sfc: add VFs to the table of PCI IDs for supported NICs Andrew Rybchenko
2017-03-06 10:10   ` Ferruh Yigit
2017-03-06 14:00     ` Andrew Rybchenko
2017-03-02 15:46 ` [dpdk-dev] [PATCH 2/6] net/sfc/base: don't ignore requested MAC stats update period Andrew Rybchenko
2017-03-02 15:46 ` [dpdk-dev] [PATCH 3/6] net/sfc: add kvarg control for MAC statistics " Andrew Rybchenko
2017-03-02 15:46 ` [dpdk-dev] [PATCH 4/6] net/sfc: port HW stats must work if periodic DMA is absent Andrew Rybchenko
2017-03-02 15:46 ` Andrew Rybchenko [this message]
2017-03-06 10:24   ` [dpdk-dev] [PATCH 5/6] net/sfc: port must not fail to start if Rx mode is rejected Ferruh Yigit
2017-03-02 15:46 ` [dpdk-dev] [PATCH 6/6] net/sfc: add support for MCDI proxy Andrew Rybchenko
2017-03-09 17:22 ` [dpdk-dev] [PATCH v2 0/6] Support running Solarflare PMD over PCI VFs Andrew Rybchenko
2017-03-09 17:22   ` [dpdk-dev] [PATCH v2 1/6] net/sfc/base: don't ignore requested MAC stats update period Andrew Rybchenko
2017-03-09 17:22   ` [dpdk-dev] [PATCH v2 2/6] net/sfc: add kvarg control for MAC statistics " Andrew Rybchenko
2017-03-09 17:23   ` [dpdk-dev] [PATCH v2 3/6] net/sfc: poll MAC stats if periodic DMA is not supported Andrew Rybchenko
2017-03-09 17:23   ` [dpdk-dev] [PATCH v2 4/6] net/sfc: avoid failure on port start if Rx mode is rejected Andrew Rybchenko
2017-03-09 17:23   ` [dpdk-dev] [PATCH v2 5/6] net/sfc: add support for MCDI proxy Andrew Rybchenko
2017-03-15 11:13     ` Ferruh Yigit
2017-03-09 17:23   ` [dpdk-dev] [PATCH v2 6/6] net/sfc: add VFs to the table of PCI IDs for supported NICs Andrew Rybchenko
2017-03-15 11:11   ` [dpdk-dev] [PATCH v2 0/6] Support running Solarflare PMD over PCI VFs 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=1488469608-2252-6-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ivan.malov@oktetlabs.ru \
    /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).