From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B32CAA00C5; Tue, 15 Feb 2022 13:56:22 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 57C7E4117D; Tue, 15 Feb 2022 13:56:07 +0100 (CET) Received: from office2.cesnet.cz (office2.cesnet.cz [195.113.144.244]) by mails.dpdk.org (Postfix) with ESMTP id 81EF241165; Tue, 15 Feb 2022 13:56:04 +0100 (CET) Received: from emil.fit.vutbr.cz (unknown [IPv6:2001:67c:1220:80c:eb:e00e:9e81:ff5f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by office2.cesnet.cz (Postfix) with ESMTPSA id 55E0A40006C; Tue, 15 Feb 2022 13:56:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=office2-2020; t=1644929764; bh=AJnkQSNMzjUsnA7ZvgMAdur0J1dN+zwOCcZK8N47Uh4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=REnfHibsVunSULSiMXQzFWajaENts3krChCQlRFABax69JKOe3Yk43JEIjhtb/bf6 7WIy0GEDUW/dYdyhWXc8HL1iUejhk9qIsKYSRdkeAz/O3le1wmZc7SX608Wn9OECTq S3upLaakKMXQXZpU8Lpb0zUFZiMeLJEhIenPd0z9K6mgiXlyPQq9R09YOo7qATJOeD KzGsaKPibP9Skd8IvKgGNQPxSBPdox+apdND7W3JOZHdzB1x+bO5oqe9Ci+pbmrtS9 qmPrMupvCzE2+yCpvrdAYtEh+bYDpqCPuj4voqdvue45OGfZirdjGM1k4ViEJJo2R7 XvbkWqQIdYqgA== From: spinler@cesnet.cz To: dev@dpdk.org Cc: Martin Spinler , cernay@netcope.com, stable@dpdk.org Subject: [PATCH v2 4/5] net/nfb: fix multicast/promiscuous mode switching Date: Tue, 15 Feb 2022 13:55:42 +0100 Message-Id: <20220215125543.142108-5-spinler@cesnet.cz> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220215125543.142108-1-spinler@cesnet.cz> References: <20220214112541.29782-1-spinler@cesnet.cz> <20220215125543.142108-1-spinler@cesnet.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Martin Spinler In the firmware, the promisc mode overrides the multicast mode. So when the promisc mode is turned off, driver must check if the multicast mode was active before and conditionally reactivate it. Fixes: 6435f9a0ac22 ("net/nfb: add new netcope driver") Cc: cernay@netcope.com Cc: stable@dpdk.org Signed-off-by: Martin Spinler --- drivers/net/nfb/nfb.h | 4 ---- drivers/net/nfb/nfb_ethdev.c | 1 - drivers/net/nfb/nfb_rxmode.c | 20 ++++++++------------ 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/net/nfb/nfb.h b/drivers/net/nfb/nfb.h index 4de9006ac0..7dc5bd29e4 100644 --- a/drivers/net/nfb/nfb.h +++ b/drivers/net/nfb/nfb.h @@ -47,10 +47,6 @@ struct pmd_internals { char nfb_dev[PATH_MAX]; struct nfb_device *nfb; - /* Place to remember if filter was promiscuous or filtering by table, - * when disabling allmulticast - */ - enum nc_rxmac_mac_filter rx_filter_original; }; #endif /* _NFB_H_ */ diff --git a/drivers/net/nfb/nfb_ethdev.c b/drivers/net/nfb/nfb_ethdev.c index 53a98642b3..5d503e131a 100644 --- a/drivers/net/nfb/nfb_ethdev.c +++ b/drivers/net/nfb/nfb_ethdev.c @@ -534,7 +534,6 @@ nfb_eth_dev_init(struct rte_eth_dev *dev) data->promiscuous = nfb_eth_promiscuous_get(dev); data->all_multicast = nfb_eth_allmulticast_get(dev); - internals->rx_filter_original = data->promiscuous; dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; diff --git a/drivers/net/nfb/nfb_rxmode.c b/drivers/net/nfb/nfb_rxmode.c index 2d0b613d21..ca6e4d5578 100644 --- a/drivers/net/nfb/nfb_rxmode.c +++ b/drivers/net/nfb/nfb_rxmode.c @@ -14,8 +14,6 @@ nfb_eth_promiscuous_enable(struct rte_eth_dev *dev) dev->data->dev_private; uint16_t i; - internals->rx_filter_original = RXMAC_MAC_FILTER_PROMISCUOUS; - for (i = 0; i < internals->max_rxmac; ++i) { nc_rxmac_mac_filter_enable(internals->rxmac[i], RXMAC_MAC_FILTER_PROMISCUOUS); @@ -30,16 +28,13 @@ nfb_eth_promiscuous_disable(struct rte_eth_dev *dev) struct pmd_internals *internals = (struct pmd_internals *) dev->data->dev_private; uint16_t i; + enum nc_rxmac_mac_filter filter = RXMAC_MAC_FILTER_TABLE_BCAST; - internals->rx_filter_original = RXMAC_MAC_FILTER_TABLE; - - /* if promisc is not enabled, do nothing */ - if (!nfb_eth_promiscuous_get(dev)) - return 0; + if (dev->data->all_multicast) + filter = RXMAC_MAC_FILTER_TABLE_BCAST_MCAST; for (i = 0; i < internals->max_rxmac; ++i) { - nc_rxmac_mac_filter_enable(internals->rxmac[i], - RXMAC_MAC_FILTER_TABLE); + nc_rxmac_mac_filter_enable(internals->rxmac[i], filter); } return 0; @@ -67,6 +62,8 @@ nfb_eth_allmulticast_enable(struct rte_eth_dev *dev) dev->data->dev_private; uint16_t i; + if (dev->data->promiscuous) + return 0; for (i = 0; i < internals->max_rxmac; ++i) { nc_rxmac_mac_filter_enable(internals->rxmac[i], RXMAC_MAC_FILTER_TABLE_BCAST_MCAST); @@ -83,13 +80,12 @@ nfb_eth_allmulticast_disable(struct rte_eth_dev *dev) uint16_t i; - /* if multicast is not enabled do nothing */ - if (!nfb_eth_allmulticast_get(dev)) + if (dev->data->promiscuous) return 0; for (i = 0; i < internals->max_rxmac; ++i) { nc_rxmac_mac_filter_enable(internals->rxmac[i], - internals->rx_filter_original); + RXMAC_MAC_FILTER_TABLE_BCAST); } return 0; -- 2.35.1