@@ -23,6 +23,7 @@ Features of the CNXK Ethdev PMD are:
- Lock-free Tx queue
- Multiple queues for TX and RX
- Receiver Side Scaling (RSS)
+- MAC filtering
- Inner and Outer Checksum offload
- Link state information
- MTU update
@@ -18,6 +18,7 @@ Queue start/stop = Y
MTU update = Y
TSO = Y
Promiscuous mode = Y
+Unicast MAC filter = Y
RSS hash = Y
Inner RSS = Y
Jumbo frame = Y
@@ -17,6 +17,7 @@ Free Tx mbuf on demand = Y
Queue start/stop = Y
MTU update = Y
Promiscuous mode = Y
+Unicast MAC filter = Y
RSS hash = Y
Inner RSS = Y
Jumbo frame = Y
@@ -1085,6 +1085,8 @@ cnxk_nix_dev_start(struct rte_eth_dev *eth_dev)
/* CNXK platform independent eth dev ops */
struct eth_dev_ops cnxk_eth_dev_ops = {
.mtu_set = cnxk_nix_mtu_set,
+ .mac_addr_add = cnxk_nix_mac_addr_add,
+ .mac_addr_remove = cnxk_nix_mac_addr_del,
.mac_addr_set = cnxk_nix_mac_addr_set,
.dev_infos_get = cnxk_nix_info_get,
.link_update = cnxk_nix_link_update,
@@ -139,6 +139,7 @@ struct cnxk_eth_dev {
/* Max macfilter entries */
uint8_t max_mac_entries;
+ bool dmac_filter_enable;
uint16_t flags;
uint8_t ptype_disable;
@@ -221,6 +222,10 @@ int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
struct rte_pci_device *pci_dev);
int cnxk_nix_remove(struct rte_pci_device *pci_dev);
int cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu);
+int cnxk_nix_mac_addr_add(struct rte_eth_dev *eth_dev,
+ struct rte_ether_addr *addr, uint32_t index,
+ uint32_t pool);
+void cnxk_nix_mac_addr_del(struct rte_eth_dev *eth_dev, uint32_t index);
int cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
struct rte_ether_addr *addr);
int cnxk_nix_promisc_enable(struct rte_eth_dev *eth_dev);
@@ -101,6 +101,43 @@ cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr)
}
int
+cnxk_nix_mac_addr_add(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr,
+ uint32_t index, uint32_t pool)
+{
+ struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+ struct roc_nix *nix = &dev->nix;
+ int rc;
+
+ PLT_SET_USED(index);
+ PLT_SET_USED(pool);
+
+ rc = roc_nix_mac_addr_add(nix, addr->addr_bytes);
+ if (rc < 0) {
+ plt_err("Failed to add mac address, rc=%d", rc);
+ return rc;
+ }
+
+ /* Enable promiscuous mode at NIX level */
+ roc_nix_npc_promisc_ena_dis(nix, true);
+ dev->dmac_filter_enable = true;
+ eth_dev->data->promiscuous = false;
+
+ return 0;
+}
+
+void
+cnxk_nix_mac_addr_del(struct rte_eth_dev *eth_dev, uint32_t index)
+{
+ struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+ struct roc_nix *nix = &dev->nix;
+ int rc;
+
+ rc = roc_nix_mac_addr_del(nix, index);
+ if (rc)
+ plt_err("Failed to delete mac address, rc=%d", rc);
+}
+
+int
cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
{
uint32_t old_frame_size, frame_size = mtu + CNXK_NIX_L2_OVERHEAD;
@@ -212,8 +249,8 @@ cnxk_nix_promisc_disable(struct rte_eth_dev *eth_dev)
if (roc_nix_is_vf_or_sdp(nix))
return rc;
- rc = roc_nix_npc_promisc_ena_dis(nix, false);
- if (rc < 0) {
+ rc = roc_nix_npc_promisc_ena_dis(nix, dev->dmac_filter_enable);
+ if (rc) {
plt_err("Failed to setup promisc mode in npc, rc=%d(%s)", rc,
roc_error_msg_get(rc));
return rc;
@@ -223,9 +260,10 @@ cnxk_nix_promisc_disable(struct rte_eth_dev *eth_dev)
if (rc) {
plt_err("Failed to setup promisc mode in mac, rc=%d(%s)", rc,
roc_error_msg_get(rc));
- roc_nix_npc_promisc_ena_dis(nix, true);
+ roc_nix_npc_promisc_ena_dis(nix, !dev->dmac_filter_enable);
return rc;
}
+ dev->dmac_filter_enable = false;
return 0;
}