octeon: add promisc support

We add the capability to enable and disable promiscous mode on the
octeon port.

Type: feature
Signed-off-by: Guillaume Solignac <gsoligna@cisco.com>
Change-Id: I9a1464d2e1e8a0570ff16e221a4896aedc3ed6f8
This commit is contained in:
Guillaume Solignac
2024-04-09 11:40:51 +02:00
committed by Damjan Marion
parent f13534e79d
commit 9abc01f251

View File

@ -378,6 +378,44 @@ oct_port_stop (vlib_main_t *vm, vnet_dev_port_t *port)
oct_txq_stop (vm, q);
}
vnet_dev_rv_t
oct_validate_config_promisc_mode (vnet_dev_port_t *port, int enable)
{
vnet_dev_t *dev = port->dev;
oct_device_t *cd = vnet_dev_get_data (dev);
struct roc_nix *nix = cd->nix;
if (roc_nix_is_vf_or_sdp (nix))
return VNET_DEV_ERR_UNSUPPORTED_DEVICE;
return VNET_DEV_OK;
}
vnet_dev_rv_t
oct_op_config_promisc_mode (vlib_main_t *vm, vnet_dev_port_t *port, int enable)
{
vnet_dev_t *dev = port->dev;
oct_device_t *cd = vnet_dev_get_data (dev);
struct roc_nix *nix = cd->nix;
int rv;
rv = roc_nix_npc_promisc_ena_dis (nix, enable);
if (rv)
{
return oct_roc_err (dev, rv, "roc_nix_npc_promisc_ena_dis failed");
}
rv = roc_nix_mac_promisc_mode_enable (nix, enable);
if (rv)
{
return oct_roc_err (dev, rv,
"roc_nix_mac_promisc_mode_enable(%s) failed",
enable ? "true" : "false");
}
return VNET_DEV_OK;
}
vnet_dev_rv_t
oct_port_cfg_change_validate (vlib_main_t *vm, vnet_dev_port_t *port,
vnet_dev_port_cfg_change_req_t *req)
@ -392,6 +430,8 @@ oct_port_cfg_change_validate (vlib_main_t *vm, vnet_dev_port_t *port,
break;
case VNET_DEV_PORT_CFG_PROMISC_MODE:
rv = oct_validate_config_promisc_mode (port, req->promisc);
break;
case VNET_DEV_PORT_CFG_CHANGE_PRIMARY_HW_ADDR:
case VNET_DEV_PORT_CFG_ADD_SECONDARY_HW_ADDR:
case VNET_DEV_PORT_CFG_REMOVE_SECONDARY_HW_ADDR:
@ -421,6 +461,7 @@ oct_port_cfg_change (vlib_main_t *vm, vnet_dev_port_t *port,
switch (req->type)
{
case VNET_DEV_PORT_CFG_PROMISC_MODE:
rv = oct_op_config_promisc_mode (vm, port, req->promisc);
break;
case VNET_DEV_PORT_CFG_CHANGE_PRIMARY_HW_ADDR: