f-stack/dpdk/drivers/net/nfb/nfb_rxmode.c

108 lines
2.3 KiB
C
Raw Normal View History

2020-06-18 16:55:50 +00:00
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2019 Cesnet
* Copyright(c) 2019 Netcope Technologies, a.s. <info@netcope.com>
* All rights reserved.
*/
#include "nfb_rxmode.h"
#include "nfb.h"
int
nfb_eth_promiscuous_enable(struct rte_eth_dev *dev)
{
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
uint16_t i;
for (i = 0; i < internals->max_rxmac; ++i) {
nc_rxmac_mac_filter_enable(internals->rxmac[i],
RXMAC_MAC_FILTER_PROMISCUOUS);
}
return 0;
}
int
nfb_eth_promiscuous_disable(struct rte_eth_dev *dev)
{
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
uint16_t i;
2022-09-02 04:40:05 +00:00
enum nc_rxmac_mac_filter filter = RXMAC_MAC_FILTER_TABLE_BCAST;
2020-06-18 16:55:50 +00:00
2022-09-02 04:40:05 +00:00
if (dev->data->all_multicast)
filter = RXMAC_MAC_FILTER_TABLE_BCAST_MCAST;
2020-06-18 16:55:50 +00:00
for (i = 0; i < internals->max_rxmac; ++i) {
2022-09-02 04:40:05 +00:00
nc_rxmac_mac_filter_enable(internals->rxmac[i], filter);
2020-06-18 16:55:50 +00:00
}
return 0;
}
int
nfb_eth_promiscuous_get(struct rte_eth_dev *dev)
{
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
struct nc_rxmac_status status;
status.mac_filter = RXMAC_MAC_FILTER_PROMISCUOUS;
2021-02-05 08:48:47 +00:00
if (internals->max_rxmac > 0)
nc_rxmac_read_status(internals->rxmac[0], &status);
2020-06-18 16:55:50 +00:00
return (status.mac_filter == RXMAC_MAC_FILTER_PROMISCUOUS);
}
int
nfb_eth_allmulticast_enable(struct rte_eth_dev *dev)
{
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
uint16_t i;
2022-09-02 04:40:05 +00:00
if (dev->data->promiscuous)
return 0;
2020-06-18 16:55:50 +00:00
for (i = 0; i < internals->max_rxmac; ++i) {
nc_rxmac_mac_filter_enable(internals->rxmac[i],
RXMAC_MAC_FILTER_TABLE_BCAST_MCAST);
}
return 0;
}
int
nfb_eth_allmulticast_disable(struct rte_eth_dev *dev)
{
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
uint16_t i;
2022-09-02 04:40:05 +00:00
if (dev->data->promiscuous)
2020-06-18 16:55:50 +00:00
return 0;
for (i = 0; i < internals->max_rxmac; ++i) {
nc_rxmac_mac_filter_enable(internals->rxmac[i],
2022-09-02 04:40:05 +00:00
RXMAC_MAC_FILTER_TABLE_BCAST);
2020-06-18 16:55:50 +00:00
}
return 0;
}
int
nfb_eth_allmulticast_get(struct rte_eth_dev *dev)
{
struct pmd_internals *internals = (struct pmd_internals *)
dev->data->dev_private;
struct nc_rxmac_status status;
status.mac_filter = RXMAC_MAC_FILTER_PROMISCUOUS;
2021-02-05 08:48:47 +00:00
if (internals->max_rxmac > 0)
nc_rxmac_read_status(internals->rxmac[0], &status);
2020-06-18 16:55:50 +00:00
return (status.mac_filter == RXMAC_MAC_FILTER_TABLE_BCAST_MCAST);
}