From: Jerin Jacob Date: Sun, 8 Oct 2017 12:44:20 +0000 (+0530) Subject: net/octeontx: add promiscuous mode ops X-Git-Tag: spdx-start~1567 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=15bce35b7568b8a66089754566169a32e2e5d8bb;p=dpdk.git net/octeontx: add promiscuous mode ops Mark Promiscuous mode in features. Signed-off-by: Jerin Jacob Signed-off-by: Santosh Shukla --- diff --git a/doc/guides/nics/features/octeontx.ini b/doc/guides/nics/features/octeontx.ini index 56b135060a..ed5de9a74a 100644 --- a/doc/guides/nics/features/octeontx.ini +++ b/doc/guides/nics/features/octeontx.ini @@ -8,6 +8,7 @@ Speed capabilities = Y Link status = Y Lock-free Tx queue = Y Jumbo frame = Y +Promiscuous mode = Y CRC offload = Y Linux VFIO = Y ARMv8 = Y diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 2c39d553e7..e71a0cbb5c 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -160,6 +160,28 @@ octeontx_port_close(struct octeontx_nic *nic) octeontx_log_dbg("port closed %d", nic->port_id); } +static void +octeontx_port_promisc_set(struct octeontx_nic *nic, int en) +{ + struct rte_eth_dev *dev; + int res; + + res = 0; + PMD_INIT_FUNC_TRACE(); + dev = nic->dev; + + res = octeontx_bgx_port_promisc_set(nic->port_id, en); + if (res < 0) + octeontx_log_err("failed to set promiscuous mode %d", + nic->port_id); + + /* Set proper flag for the mode */ + dev->data->promiscuous = (en != 0) ? 1 : 0; + + octeontx_log_dbg("port %d : promiscuous mode %s", + nic->port_id, en ? "set" : "unset"); +} + static inline void devconf_set_default_sane_values(struct rte_event_dev_config *dev_conf, struct rte_event_dev_info *info) @@ -273,6 +295,24 @@ octeontx_dev_configure(struct rte_eth_dev *dev) return 0; } +static void +octeontx_dev_promisc_enable(struct rte_eth_dev *dev) +{ + struct octeontx_nic *nic = octeontx_pmd_priv(dev); + + PMD_INIT_FUNC_TRACE(); + octeontx_port_promisc_set(nic, 1); +} + +static void +octeontx_dev_promisc_disable(struct rte_eth_dev *dev) +{ + struct octeontx_nic *nic = octeontx_pmd_priv(dev); + + PMD_INIT_FUNC_TRACE(); + octeontx_port_promisc_set(nic, 0); +} + static inline int octeontx_atomic_write_link_status(struct rte_eth_dev *dev, struct rte_eth_link *link) @@ -401,6 +441,8 @@ octeontx_dev_info(struct rte_eth_dev *dev, static const struct eth_dev_ops octeontx_dev_ops = { .dev_configure = octeontx_dev_configure, .dev_infos_get = octeontx_dev_info, + .promiscuous_enable = octeontx_dev_promisc_enable, + .promiscuous_disable = octeontx_dev_promisc_disable, .link_update = octeontx_dev_link_update, };