net/nfb: fix multicast/promiscuous mode switching

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: 6435f9a0ac ("net/nfb: add new netcope driver")
Cc: stable@dpdk.org

Signed-off-by: Martin Spinler <spinler@cesnet.cz>
This commit is contained in:
Martin Spinler 2022-02-15 13:55:42 +01:00 committed by Ferruh Yigit
parent 1b4081870e
commit 6685343c48
3 changed files with 8 additions and 17 deletions

View File

@ -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_ */

View File

@ -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;

View File

@ -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;