From mboxrd@z Thu Jan 1 00:00:00 1970 From: Allain Legacy Subject: [PATCH v2 13/15] net/avp: device promiscuous functions Date: Sun, 26 Feb 2017 14:09:01 -0500 Message-ID: <1488136143-116389-14-git-send-email-allain.legacy@windriver.com> References: <1487985795-136044-1-git-send-email-allain.legacy@windriver.com> <1488136143-116389-1-git-send-email-allain.legacy@windriver.com> Mime-Version: 1.0 Content-Type: text/plain Cc: To: Return-path: Received: from mail.windriver.com (mail.windriver.com [147.11.1.11]) by dpdk.org (Postfix) with ESMTP id 7F8CF37B2 for ; Sun, 26 Feb 2017 20:09:55 +0100 (CET) In-Reply-To: <1488136143-116389-1-git-send-email-allain.legacy@windriver.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Adds support for setting and clearing promiscuous mode on an AVP device. When enabled the _mac_filter function will allow packets destined to any MAC address to be processed by the receive functions. Signed-off-by: Allain Legacy Signed-off-by: Matt Peters --- drivers/net/avp/avp_ethdev.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 514e27d..dc08737 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -72,6 +72,9 @@ static void avp_dev_info_get(struct rte_eth_dev *dev, static void avp_vlan_offload_set(struct rte_eth_dev *dev, int mask); static int avp_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete); +static void avp_dev_promiscuous_enable(struct rte_eth_dev *dev); +static void avp_dev_promiscuous_disable(struct rte_eth_dev *dev); + static int avp_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, uint16_t nb_rx_desc, @@ -158,6 +161,8 @@ static void avp_dev_stats_get(struct rte_eth_dev *dev, .stats_get = avp_dev_stats_get, .stats_reset = avp_dev_stats_reset, .link_update = avp_dev_link_update, + .promiscuous_enable = avp_dev_promiscuous_enable, + .promiscuous_disable = avp_dev_promiscuous_disable, .rx_queue_setup = avp_dev_rx_queue_setup, .rx_queue_release = avp_dev_rx_queue_release, .tx_queue_setup = avp_dev_tx_queue_setup, @@ -2041,6 +2046,35 @@ struct avp_queue { return -1; } +static void +avp_dev_promiscuous_enable(struct rte_eth_dev *eth_dev) +{ + struct avp_dev *avp = + RTE_AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + + rte_spinlock_lock(&avp->lock); + if ((avp->flags & RTE_AVP_F_PROMISC) == 0) { + avp->flags |= RTE_AVP_F_PROMISC; + PMD_DRV_LOG(DEBUG, "Promiscuous mode enabled on %u\n", + eth_dev->data->port_id); + } + rte_spinlock_unlock(&avp->lock); +} + +static void +avp_dev_promiscuous_disable(struct rte_eth_dev *eth_dev) +{ + struct avp_dev *avp = + RTE_AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + + rte_spinlock_lock(&avp->lock); + if ((avp->flags & RTE_AVP_F_PROMISC) != 0) { + avp->flags &= ~RTE_AVP_F_PROMISC; + PMD_DRV_LOG(DEBUG, "Promiscuous mode disabled on %u\n", + eth_dev->data->port_id); + } + rte_spinlock_unlock(&avp->lock); +} static void avp_dev_info_get(struct rte_eth_dev *eth_dev, -- 1.8.3.1