1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019 Cesnet
3 * Copyright(c) 2019 Netcope Technologies, a.s. <info@netcope.com>
7 #include "nfb_rxmode.h"
11 nfb_eth_promiscuous_enable(struct rte_eth_dev *dev)
13 struct pmd_internals *internals = (struct pmd_internals *)
14 dev->data->dev_private;
17 internals->rx_filter_original = RXMAC_MAC_FILTER_PROMISCUOUS;
19 for (i = 0; i < internals->max_rxmac; ++i) {
20 nc_rxmac_mac_filter_enable(internals->rxmac[i],
21 RXMAC_MAC_FILTER_PROMISCUOUS);
26 nfb_eth_promiscuous_disable(struct rte_eth_dev *dev)
28 struct pmd_internals *internals = (struct pmd_internals *)
29 dev->data->dev_private;
32 internals->rx_filter_original = RXMAC_MAC_FILTER_TABLE;
34 /* if promisc is not enabled, do nothing */
35 if (!nfb_eth_promiscuous_get(dev))
38 for (i = 0; i < internals->max_rxmac; ++i) {
39 nc_rxmac_mac_filter_enable(internals->rxmac[i],
40 RXMAC_MAC_FILTER_TABLE);
45 nfb_eth_promiscuous_get(struct rte_eth_dev *dev)
47 struct pmd_internals *internals = (struct pmd_internals *)
48 dev->data->dev_private;
50 struct nc_rxmac_status status;
51 status.mac_filter = RXMAC_MAC_FILTER_PROMISCUOUS;
53 nc_rxmac_read_status(internals->rxmac[0], &status);
55 return (status.mac_filter == RXMAC_MAC_FILTER_PROMISCUOUS);
59 nfb_eth_allmulticast_enable(struct rte_eth_dev *dev)
61 struct pmd_internals *internals = (struct pmd_internals *)
62 dev->data->dev_private;
65 for (i = 0; i < internals->max_rxmac; ++i) {
66 nc_rxmac_mac_filter_enable(internals->rxmac[i],
67 RXMAC_MAC_FILTER_TABLE_BCAST_MCAST);
72 nfb_eth_allmulticast_disable(struct rte_eth_dev *dev)
74 struct pmd_internals *internals = (struct pmd_internals *)
75 dev->data->dev_private;
79 /* if multicast is not enabled do nothing */
80 if (!nfb_eth_allmulticast_get(dev))
83 for (i = 0; i < internals->max_rxmac; ++i) {
84 nc_rxmac_mac_filter_enable(internals->rxmac[i],
85 internals->rx_filter_original);
90 nfb_eth_allmulticast_get(struct rte_eth_dev *dev)
92 struct pmd_internals *internals = (struct pmd_internals *)
93 dev->data->dev_private;
95 struct nc_rxmac_status status;
96 status.mac_filter = RXMAC_MAC_FILTER_PROMISCUOUS;
97 nc_rxmac_read_status(internals->rxmac[0], &status);
99 return (status.mac_filter == RXMAC_MAC_FILTER_TABLE_BCAST_MCAST);