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 A0EB9A00C5; Mon, 14 Feb 2022 12:26:05 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E51DC41159; Mon, 14 Feb 2022 12:25:50 +0100 (CET) Received: from office2.cesnet.cz (office2.cesnet.cz [195.113.144.244]) by mails.dpdk.org (Postfix) with ESMTP id B100E41150 for ; Mon, 14 Feb 2022 12:25:47 +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 89F9F400077; Mon, 14 Feb 2022 12:25:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=office2-2020; t=1644837947; bh=sRElX5oBNsTyqKmSno0LCBU9MAXfZtYAEs7e3IsRNK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JiURrQRcRzY33MFKVTxdlCU/NW/SpD/GVg2l1NurEkgM2LeakLlyWD8kN3YG7pz5u FaUmwbUMmo+rVWfW1SgqJxxngo9pA2WwbfazKCfKZy03DVTwGBJTkVwud7epwIvWW8 pUbLh9XSOqtGce5j+5zQ4a/L77wFOHv1GjqJyctf+poym7jnvW2XsqHootd1SQQKlt cpnRv5TdrtTtoeHDNA+BvRkazxO/+rceibVtofYgRZyEQNUonmdAgqBwX/qHmIiWYP 7AXUG/v0luYPssUrTPLKhCq2GJV8JOPyx8LIYlfFYsL9L6ysi4E+e+blax2CTp5/ai u1B6TyNMF2F9g== From: spinler@cesnet.cz To: dev@dpdk.org Cc: Martin Spinler Subject: [PATCH 5/6] drivers/nfb: fix multicast/promiscuous mode switching Date: Mon, 14 Feb 2022 12:25:40 +0100 Message-Id: <20220214112541.29782-5-spinler@cesnet.cz> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214112541.29782-1-spinler@cesnet.cz> References: <20220214112541.29782-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. 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