From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 38963A0487 for ; Sun, 30 Jun 2019 20:08:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0D0361B9E6; Sun, 30 Jun 2019 20:07:45 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 133FD1B99E for ; Sun, 30 Jun 2019 20:07:18 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5UI5cCI016218; Sun, 30 Jun 2019 11:07:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=z2Eoy+eh5dUagMl0WZ54qjoj+u//Yx+Xz28s5WyLc8I=; b=GYRT3P+RHZapHvaOKQBneSzFH2Mf+YXgb8g4WFRny/5u86dy6oNByhJl4BhVzoNf78pK MM2gWEOaNtWWVdWi7Qi1zaqgGqxYJQyaNYdZ04DfCDp+DnlZfiRYqfinWL3ESuPu7CDC fAN+Uw1XiYDcn5YPbp3myIJW9QXaSeN6FtU/BayZV0OUj2g1G5l2k7VEgIu/mx1e4dvw mq19KFGvV8Tl/9SiJkj5/+kHmrpfhcYRiX03lwVe/DVAMGe83E2t+mJCTp70CNs4PYJH ESjtPJpieIi8T4EnlkYqJp2X3hxO9C3F+hBrKKjmdxHpoomTyjAStSZ3ctmj+yEZ/WGi Xg== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2te7gm3y8u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 30 Jun 2019 11:07:18 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sun, 30 Jun 2019 11:07:16 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Sun, 30 Jun 2019 11:07:16 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 25E3B3F703F; Sun, 30 Jun 2019 11:07:13 -0700 (PDT) From: To: , John McNamara , Marko Kovacevic , Jerin Jacob , "Nithin Dabilpuram" , Kiran Kumar K CC: Vamsi Attunuru , Sunil Kumar Kori Date: Sun, 30 Jun 2019 23:35:26 +0530 Message-ID: <20190630180609.36705-15-jerinj@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190630180609.36705-1-jerinj@marvell.com> References: <20190602152434.23996-1-jerinj@marvell.com> <20190630180609.36705-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-30_08:, , signatures=0 Subject: [dpdk-dev] [PATCH v2 14/57] net/octeontx2: add promiscuous and allmulticast mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Vamsi Attunuru Add promiscuous and allmulticast mode for PF devices and update the respective feature list. Signed-off-by: Vamsi Attunuru Signed-off-by: Sunil Kumar Kori --- doc/guides/nics/features/octeontx2.ini | 2 + doc/guides/nics/features/octeontx2_vec.ini | 2 + doc/guides/nics/octeontx2.rst | 1 + drivers/net/octeontx2/otx2_ethdev.c | 4 ++ drivers/net/octeontx2/otx2_ethdev.h | 6 ++ drivers/net/octeontx2/otx2_ethdev_ops.c | 82 ++++++++++++++++++++++ 6 files changed, 97 insertions(+) diff --git a/doc/guides/nics/features/octeontx2.ini b/doc/guides/nics/features/octeontx2.ini index 8d7c3588c..9f682609d 100644 --- a/doc/guides/nics/features/octeontx2.ini +++ b/doc/guides/nics/features/octeontx2.ini @@ -10,6 +10,8 @@ SR-IOV = Y Multiprocess aware = Y Link status = Y Link status event = Y +Promiscuous mode = Y +Allmulticast mode = Y Basic stats = Y Stats per queue = Y Extended stats = Y diff --git a/doc/guides/nics/features/octeontx2_vec.ini b/doc/guides/nics/features/octeontx2_vec.ini index a6e6876fa..764e95ce6 100644 --- a/doc/guides/nics/features/octeontx2_vec.ini +++ b/doc/guides/nics/features/octeontx2_vec.ini @@ -10,6 +10,8 @@ SR-IOV = Y Multiprocess aware = Y Link status = Y Link status event = Y +Promiscuous mode = Y +Allmulticast mode = Y Basic stats = Y Extended stats = Y Stats per queue = Y diff --git a/doc/guides/nics/octeontx2.rst b/doc/guides/nics/octeontx2.rst index 2944bbb99..9ef7be08f 100644 --- a/doc/guides/nics/octeontx2.rst +++ b/doc/guides/nics/octeontx2.rst @@ -16,6 +16,7 @@ Features Features of the OCTEON TX2 Ethdev PMD are: +- Promiscuous mode - SR-IOV VF - Lock-free Tx queue - Port hardware statistics diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c index 937ba6399..826ce7f4e 100644 --- a/drivers/net/octeontx2/otx2_ethdev.c +++ b/drivers/net/octeontx2/otx2_ethdev.c @@ -237,6 +237,10 @@ static const struct eth_dev_ops otx2_eth_dev_ops = { .stats_get = otx2_nix_dev_stats_get, .stats_reset = otx2_nix_dev_stats_reset, .get_reg = otx2_nix_dev_get_reg, + .promiscuous_enable = otx2_nix_promisc_enable, + .promiscuous_disable = otx2_nix_promisc_disable, + .allmulticast_enable = otx2_nix_allmulticast_enable, + .allmulticast_disable = otx2_nix_allmulticast_disable, .queue_stats_mapping_set = otx2_nix_queue_stats_mapping, .xstats_get = otx2_nix_xstats_get, .xstats_get_names = otx2_nix_xstats_get_names, diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h index 7d53a6643..814fd6ec3 100644 --- a/drivers/net/octeontx2/otx2_ethdev.h +++ b/drivers/net/octeontx2/otx2_ethdev.h @@ -178,6 +178,12 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev) void otx2_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_info); +void otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en); +void otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev); +void otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev); +void otx2_nix_allmulticast_enable(struct rte_eth_dev *eth_dev); +void otx2_nix_allmulticast_disable(struct rte_eth_dev *eth_dev); + /* Link */ void otx2_nix_toggle_flag_link_cfg(struct otx2_eth_dev *dev, bool set); int otx2_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete); diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c index df7e909d2..301a597f8 100644 --- a/drivers/net/octeontx2/otx2_ethdev_ops.c +++ b/drivers/net/octeontx2/otx2_ethdev_ops.c @@ -4,6 +4,88 @@ #include "otx2_ethdev.h" +static void +nix_cgx_promisc_config(struct rte_eth_dev *eth_dev, int en) +{ + struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev); + struct otx2_mbox *mbox = dev->mbox; + + if (otx2_dev_is_vf(dev)) + return; + + if (en) + otx2_mbox_alloc_msg_cgx_promisc_enable(mbox); + else + otx2_mbox_alloc_msg_cgx_promisc_disable(mbox); + + otx2_mbox_process(mbox); +} + +void +otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en) +{ + struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev); + struct otx2_mbox *mbox = dev->mbox; + struct nix_rx_mode *req; + + if (otx2_dev_is_vf(dev)) + return; + + req = otx2_mbox_alloc_msg_nix_set_rx_mode(mbox); + + if (en) + req->mode = NIX_RX_MODE_UCAST | NIX_RX_MODE_PROMISC; + + otx2_mbox_process(mbox); + eth_dev->data->promiscuous = en; +} + +void +otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev) +{ + otx2_nix_promisc_config(eth_dev, 1); + nix_cgx_promisc_config(eth_dev, 1); +} + +void +otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev) +{ + otx2_nix_promisc_config(eth_dev, 0); + nix_cgx_promisc_config(eth_dev, 0); +} + +static void +nix_allmulticast_config(struct rte_eth_dev *eth_dev, int en) +{ + struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev); + struct otx2_mbox *mbox = dev->mbox; + struct nix_rx_mode *req; + + if (otx2_dev_is_vf(dev)) + return; + + req = otx2_mbox_alloc_msg_nix_set_rx_mode(mbox); + + if (en) + req->mode = NIX_RX_MODE_UCAST | NIX_RX_MODE_ALLMULTI; + else if (eth_dev->data->promiscuous) + req->mode = NIX_RX_MODE_UCAST | NIX_RX_MODE_PROMISC; + + otx2_mbox_process(mbox); +} + +void +otx2_nix_allmulticast_enable(struct rte_eth_dev *eth_dev) +{ + nix_allmulticast_config(eth_dev, 1); +} + +void +otx2_nix_allmulticast_disable(struct rte_eth_dev *eth_dev) +{ + nix_allmulticast_config(eth_dev, 0); +} + void otx2_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) { -- 2.21.0