From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <Allain.Legacy@windriver.com>
Received: from mail1.windriver.com (mail1.windriver.com [147.11.146.13])
 by dpdk.org (Postfix) with ESMTP id 7D28A5598
 for <dev@dpdk.org>; Thu, 23 Mar 2017 12:25:30 +0100 (CET)
Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com
 [147.11.189.40])
 by mail1.windriver.com (8.15.2/8.15.1) with ESMTPS id v2NBPOHJ026356
 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL);
 Thu, 23 Mar 2017 04:25:24 -0700 (PDT)
Received: from yow-cgts4-lx.wrs.com (128.224.145.137) by
 ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server (TLS) id
 14.3.294.0; Thu, 23 Mar 2017 04:25:23 -0700
From: Allain Legacy <allain.legacy@windriver.com>
To: <ferruh.yigit@intel.com>
CC: <dev@dpdk.org>, <ian.jolliffe@windriver.com>, <bruce.richardson@intel.com>,
 <john.mcnamara@intel.com>, <keith.wiles@intel.com>,
 <thomas.monjalon@6wind.com>, <vincent.jardin@6wind.com>,
 <jerin.jacob@caviumnetworks.com>, <stephen@networkplumber.org>,
 <3chas3@gmail.com>
Date: Thu, 23 Mar 2017 07:24:10 -0400
Message-ID: <20170323112413.175202-12-allain.legacy@windriver.com>
X-Mailer: git-send-email 2.12.1
In-Reply-To: <20170323112413.175202-1-allain.legacy@windriver.com>
References: <1489432593-32390-1-git-send-email-allain.legacy@windriver.com>
 <20170323112413.175202-1-allain.legacy@windriver.com>
MIME-Version: 1.0
Content-Type: text/plain
X-Originating-IP: [128.224.145.137]
Subject: [dpdk-dev] [PATCH v5 11/14] net/avp: device promiscuous functions
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 23 Mar 2017 11:25:31 -0000

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 <allain.legacy@windriver.com>
Signed-off-by: Matt Peters <matt.peters@windriver.com>
---
 doc/guides/nics/features/avp.ini |  1 +
 drivers/net/avp/avp_ethdev.c     | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/doc/guides/nics/features/avp.ini b/doc/guides/nics/features/avp.ini
index 0de761c..ceb6993 100644
--- a/doc/guides/nics/features/avp.ini
+++ b/doc/guides/nics/features/avp.ini
@@ -7,6 +7,7 @@
 Link status          = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
+Promiscuous mode     = Y
 Unicast MAC filter   = Y
 VLAN offload         = Y
 Basic stats          = Y
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index f24c6a8..d008e36 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -67,6 +67,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,
@@ -153,6 +156,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,
@@ -1679,6 +1684,29 @@ struct avp_queue {
 	return -1;
 }
 
+static void
+avp_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
+{
+	struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+
+	if ((avp->flags & AVP_F_PROMISC) == 0) {
+		avp->flags |= AVP_F_PROMISC;
+		PMD_DRV_LOG(DEBUG, "Promiscuous mode enabled on %u\n",
+			    eth_dev->data->port_id);
+	}
+}
+
+static void
+avp_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
+{
+	struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+
+	if ((avp->flags & AVP_F_PROMISC) != 0) {
+		avp->flags &= ~AVP_F_PROMISC;
+		PMD_DRV_LOG(DEBUG, "Promiscuous mode disabled on %u\n",
+			    eth_dev->data->port_id);
+	}
+}
 
 static void
 avp_dev_info_get(struct rte_eth_dev *eth_dev,
-- 
1.8.3.1