From: spinler@cesnet.cz
To: dev@dpdk.org
Cc: Martin Spinler <spinler@cesnet.cz>
Subject: [PATCH 5/6] drivers/nfb: fix multicast/promiscuous mode switching
Date: Mon, 14 Feb 2022 12:25:40 +0100 [thread overview]
Message-ID: <20220214112541.29782-5-spinler@cesnet.cz> (raw)
In-Reply-To: <20220214112541.29782-1-spinler@cesnet.cz>
From: Martin Spinler <spinler@cesnet.cz>
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 <spinler@cesnet.cz>
---
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
next prev parent reply other threads:[~2022-02-14 11:26 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-14 11:25 [PATCH 1/6] net/nfb: add missing libfdt dependency for build spinler
2022-02-14 11:25 ` [PATCH 2/6] drivers/nfb: fix array indexes in deinit functions spinler
2022-02-14 13:34 ` Ferruh Yigit
2022-02-14 16:52 ` Martin Spinler
2022-02-14 11:25 ` [PATCH 3/6] drivers/nfb: do not report zero-sized TX burst spinler
2022-02-14 13:35 ` Ferruh Yigit
2022-02-14 16:53 ` Martin Spinler
2022-02-14 17:34 ` Ferruh Yigit
2022-02-14 11:25 ` [PATCH 4/6] drivers/nfb: use RTE_ETH_RX_OFFLOAD_TIMESTAMP flag spinler
2022-02-14 11:25 ` spinler [this message]
2022-02-14 13:36 ` [PATCH 5/6] drivers/nfb: fix multicast/promiscuous mode switching Ferruh Yigit
2022-02-14 16:53 ` Martin Spinler
2022-02-14 11:25 ` [PATCH 6/6] drivers/nfb: add support for more MAC addresses spinler
2022-02-14 13:37 ` Ferruh Yigit
2022-02-14 16:53 ` Martin Spinler
2022-02-14 17:54 ` Ferruh Yigit
2022-02-15 13:02 ` Martin Spinler
2022-02-14 13:36 ` [PATCH 1/6] net/nfb: add missing libfdt dependency for build Ferruh Yigit
2022-02-14 16:53 ` Martin Spinler
2022-02-15 12:55 ` [PATCH v2 0/5] " spinler
2022-02-15 12:55 ` [PATCH v2 1/5] net/nfb: fix array indexes in deinit functions spinler
2022-02-15 12:55 ` [PATCH v2 2/5] net/nfb: do not report zero-sized TX burst spinler
2022-02-15 12:55 ` [PATCH v2 3/5] net/nfb: use RTE_ETH_RX_OFFLOAD_TIMESTAMP flag spinler
2022-02-15 12:55 ` [PATCH v2 4/5] net/nfb: fix multicast/promiscuous mode switching spinler
2022-02-15 12:55 ` [PATCH v2 5/5] net/nfb: add support for more MAC addresses spinler
2022-02-15 13:55 ` [PATCH v2 0/5] net/nfb: add missing libfdt dependency for build Ferruh Yigit
2022-02-15 13:57 ` Martin Spinler
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=20220214112541.29782-5-spinler@cesnet.cz \
--to=spinler@cesnet.cz \
--cc=dev@dpdk.org \
/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).