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);
28 nfb_eth_promiscuous_disable(struct rte_eth_dev *dev)
30 struct pmd_internals *internals = (struct pmd_internals *)
31 dev->data->dev_private;
34 internals->rx_filter_original = RXMAC_MAC_FILTER_TABLE;
36 /* if promisc is not enabled, do nothing */
37 if (!nfb_eth_promiscuous_get(dev))
40 for (i = 0; i < internals->max_rxmac; ++i) {
41 nc_rxmac_mac_filter_enable(internals->rxmac[i],
42 RXMAC_MAC_FILTER_TABLE);
49 nfb_eth_promiscuous_get(struct rte_eth_dev *dev)
51 struct pmd_internals *internals = (struct pmd_internals *)
52 dev->data->dev_private;
54 struct nc_rxmac_status status;
55 status.mac_filter = RXMAC_MAC_FILTER_PROMISCUOUS;
57 if (internals->max_rxmac > 0)
58 nc_rxmac_read_status(internals->rxmac[0], &status);
60 return (status.mac_filter == RXMAC_MAC_FILTER_PROMISCUOUS);
64 nfb_eth_allmulticast_enable(struct rte_eth_dev *dev)
66 struct pmd_internals *internals = (struct pmd_internals *)
67 dev->data->dev_private;
70 for (i = 0; i < internals->max_rxmac; ++i) {
71 nc_rxmac_mac_filter_enable(internals->rxmac[i],
72 RXMAC_MAC_FILTER_TABLE_BCAST_MCAST);
79 nfb_eth_allmulticast_disable(struct rte_eth_dev *dev)
81 struct pmd_internals *internals = (struct pmd_internals *)
82 dev->data->dev_private;
86 /* if multicast is not enabled do nothing */
87 if (!nfb_eth_allmulticast_get(dev))
90 for (i = 0; i < internals->max_rxmac; ++i) {
91 nc_rxmac_mac_filter_enable(internals->rxmac[i],
92 internals->rx_filter_original);
99 nfb_eth_allmulticast_get(struct rte_eth_dev *dev)
101 struct pmd_internals *internals = (struct pmd_internals *)
102 dev->data->dev_private;
104 struct nc_rxmac_status status;
105 status.mac_filter = RXMAC_MAC_FILTER_PROMISCUOUS;
107 if (internals->max_rxmac > 0)
108 nc_rxmac_read_status(internals->rxmac[0], &status);
110 return (status.mac_filter == RXMAC_MAC_FILTER_TABLE_BCAST_MCAST);