From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Rybchenko Subject: [PATCH v2 4/6] net/sfc: avoid failure on port start if Rx mode is rejected Date: Thu, 9 Mar 2017 17:23:01 +0000 Message-ID: <1489080183-21467-5-git-send-email-arybchenko@solarflare.com> References: <1488469608-2252-1-git-send-email-arybchenko@solarflare.com> <1489080183-21467-1-git-send-email-arybchenko@solarflare.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Ferruh Yigit , Ivan Malov To: Return-path: Received: from nbfkord-smmo01.seg.att.com (nbfkord-smmo01.seg.att.com [209.65.160.76]) by dpdk.org (Postfix) with ESMTP id 3CCB62C49 for ; Thu, 9 Mar 2017 18:26:00 +0100 (CET) In-Reply-To: <1489080183-21467-1-git-send-email-arybchenko@solarflare.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Ivan Malov 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 Signed-off-by: Andrew Rybchenko Reviewed-by: Andrew Lee --- 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