From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 287A8A04DD;
	Tue, 20 Oct 2020 11:00:52 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id D9C81C80A;
	Tue, 20 Oct 2020 10:49:51 +0200 (CEST)
Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com
 [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 53DC5BBAC
 for <dev@dpdk.org>; Tue, 20 Oct 2020 10:49:04 +0200 (CEST)
Received: from mx1-us1.ppe-hosted.com (unknown [10.7.65.62])
 by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id
 219CC60087 for <dev@dpdk.org>; Tue, 20 Oct 2020 08:49:04 +0000 (UTC)
Received: from us4-mdac16-61.ut7.mdlocal (unknown [10.7.66.58])
 by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 20AF88009B
 for <dev@dpdk.org>; Tue, 20 Oct 2020 08:49:04 +0000 (UTC)
X-Virus-Scanned: Proofpoint Essentials engine
Received: from mx1-us1.ppe-hosted.com (unknown [10.7.65.200])
 by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id A530C280053
 for <dev@dpdk.org>; Tue, 20 Oct 2020 08:49:03 +0000 (UTC)
Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))
 (No client certificate requested)
 by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 5AFF3800058
 for <dev@dpdk.org>; Tue, 20 Oct 2020 08:49:03 +0000 (UTC)
Received: from ukex01.SolarFlarecom.com (10.17.10.4) by
 ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id
 15.0.1497.2; Tue, 20 Oct 2020 09:48:50 +0100
Received: from opal.uk.solarflarecom.com (10.17.10.1) by
 ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id
 15.0.1497.2 via Frontend Transport; Tue, 20 Oct 2020 09:48:50 +0100
Received: from ukv-loginhost.uk.solarflarecom.com
 (ukv-loginhost.uk.solarflarecom.com [10.17.10.39])
 by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id 09K8mn1W030804;
 Tue, 20 Oct 2020 09:48:50 +0100
Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1])
 by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id B684A1627DA;
 Tue, 20 Oct 2020 09:48:49 +0100 (BST)
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <y@solarflare.com>
CC: <dev@dpdk.org>, Ivan Malov <ivan.malov@oktetlabs.ru>
Date: Tue, 20 Oct 2020 09:48:05 +0100
Message-ID: <1603183709-23420-39-git-send-email-arybchenko@solarflare.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1603183709-23420-1-git-send-email-arybchenko@solarflare.com>
References: <1603183709-23420-1-git-send-email-arybchenko@solarflare.com>
MIME-Version: 1.0
Content-Type: text/plain
X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.6.1012-25736.003
X-TM-AS-Result: No-1.100700-8.000000-10
X-TMASE-MatchedRID: aYY/z8vMijzecSkNT7l/2W/BUkaRdR0Jas1wAJHsfyJeOpN49cSJ3Q2o
 6ebnCAbg3Mltz09ZqJNA08Pbjdhi2R1YpEPWJiyziJwEp8weVXxSQLJ/PYofeAaYevV4zG3ZO8+
 BEoNgmT98qLeh0f6YVhXXfLCAeq/9krMo37I6x/7MbQu1fPiCD45Wj4EMKY2smyiLZetSf8mfop
 0ytGwvXiq2rl3dzGQ1cOg+TLV4WO10Tf7IGuGYrx/0CrLQi3i2nL+X7dzMxiALyz/82ADZx+avn
 jEmI7dIIQ+gd8TOwCJrvIq+8tRwmhMk/TLr7x7bIi1e3fcsfhc4oGQUCbwY5Q+g7mdwjo656FtD
 ZCmYBJ1ty4Dch3o7okMMprcbiest
X-TM-AS-User-Approved-Sender: Yes
X-TM-AS-User-Blocked-Sender: No
X-TMASE-Result: 10--1.100700-8.000000
X-TMASE-Version: SMEX-12.5.0.1300-8.6.1012-25736.003
X-MDID: 1603183744-mkw3yf_qmmqQ
X-PPE-DISP: 1603183744;mkw3yf_qmmqQ
Subject: [dpdk-dev] [PATCH 38/62] common/sfc_efx/base: add an API for adding
	action DROP
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

From: Ivan Malov <ivan.malov@oktetlabs.ru>

Client drivers may need to request that matching traffic be dropped.
Add a dedicated API to support this. The API relies on action
DELIVER with properly constructed NULL MPORT argument.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/common/sfc_efx/base/efx.h             |  5 +++++
 drivers/common/sfc_efx/base/efx_mae.c         | 19 +++++++++++++++++++
 .../sfc_efx/rte_common_sfc_efx_version.map    |  1 +
 3 files changed, 25 insertions(+)

diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h
index 96ea93f75a..4a4dc8ba4d 100644
--- a/drivers/common/sfc_efx/base/efx.h
+++ b/drivers/common/sfc_efx/base/efx.h
@@ -4211,6 +4211,11 @@ efx_mae_action_set_populate_deliver(
 	__in				efx_mae_actions_t *spec,
 	__in				const efx_mport_sel_t *mportp);
 
+LIBEFX_API
+extern	__checkReturn			efx_rc_t
+efx_mae_action_set_populate_drop(
+	__in				efx_mae_actions_t *spec);
+
 LIBEFX_API
 extern	__checkReturn			boolean_t
 efx_mae_action_set_specs_equal(
diff --git a/drivers/common/sfc_efx/base/efx_mae.c b/drivers/common/sfc_efx/base/efx_mae.c
index ee51f19e5e..0cfa3f6c06 100644
--- a/drivers/common/sfc_efx/base/efx_mae.c
+++ b/drivers/common/sfc_efx/base/efx_mae.c
@@ -1028,6 +1028,25 @@ efx_mae_action_set_populate_deliver(
 	return (rc);
 }
 
+	__checkReturn			efx_rc_t
+efx_mae_action_set_populate_drop(
+	__in				efx_mae_actions_t *spec)
+{
+	efx_mport_sel_t mport;
+	const uint8_t *arg;
+	efx_dword_t dword;
+
+	EFX_POPULATE_DWORD_1(dword,
+	    MAE_MPORT_SELECTOR_FLAT, MAE_MPORT_SELECTOR_NULL);
+
+	mport.sel = dword.ed_u32[0];
+
+	arg = (const uint8_t *)&mport.sel;
+
+	return (efx_mae_action_set_spec_populate(spec,
+	    EFX_MAE_ACTION_DELIVER, sizeof (mport.sel), arg));
+}
+
 	__checkReturn			boolean_t
 efx_mae_action_set_specs_equal(
 	__in				const efx_mae_actions_t *left,
diff --git a/drivers/common/sfc_efx/rte_common_sfc_efx_version.map b/drivers/common/sfc_efx/rte_common_sfc_efx_version.map
index cb92955a64..7cc692db3f 100644
--- a/drivers/common/sfc_efx/rte_common_sfc_efx_version.map
+++ b/drivers/common/sfc_efx/rte_common_sfc_efx_version.map
@@ -90,6 +90,7 @@ INTERNAL {
 	efx_mae_action_set_alloc;
 	efx_mae_action_set_free;
 	efx_mae_action_set_populate_deliver;
+	efx_mae_action_set_populate_drop;
 	efx_mae_action_set_populate_flag;
 	efx_mae_action_set_populate_mark;
 	efx_mae_action_set_populate_vlan_pop;
-- 
2.17.1