DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: dev@dpdk.org
Cc: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>,
	Andy Moreton <amoreton@xilinx.com>
Subject: [dpdk-dev] [PATCH 1/3] common/sfc_efx/base: support unprivileged MAE clients
Date: Fri, 15 Oct 2021 09:49:01 +0300
Message-ID: <20211015064903.3302489-2-andrew.rybchenko@oktetlabs.ru> (raw)
In-Reply-To: <20211015064903.3302489-1-andrew.rybchenko@oktetlabs.ru>

From: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>

In order to differentiate between privileged and unprivileged MAE clients,
add a separate boolean flag to represent a NIC's MAE privilege level.

Allow initializing unprivileged MAE clients by avoiding calls to functions
that can only be called by the admin NIC.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/common/sfc_efx/base/ef10_nic.c  | 12 +++++++++---
 drivers/common/sfc_efx/base/efx.h       |  7 +++++++
 drivers/common/sfc_efx/base/siena_nic.c |  1 +
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c
index 3cd9ff89d0..bbc59811ec 100644
--- a/drivers/common/sfc_efx/base/ef10_nic.c
+++ b/drivers/common/sfc_efx/base/ef10_nic.c
@@ -1442,13 +1442,19 @@ ef10_get_datapath_caps(
 	 * MAE support requires the privilege is granted initially,
 	 * and ignore later dynamic changes.
 	 */
-	if (CAP_FLAGS3(req, MAE_SUPPORTED) &&
-	    EFX_MCDI_HAVE_PRIVILEGE(encp->enc_privilege_mask, MAE))
+	if (CAP_FLAGS3(req, MAE_SUPPORTED)) {
 		encp->enc_mae_supported = B_TRUE;
-	else
+		if (EFX_MCDI_HAVE_PRIVILEGE(encp->enc_privilege_mask, MAE))
+			encp->enc_mae_admin = B_TRUE;
+		else
+			encp->enc_mae_admin = B_FALSE;
+	} else {
 		encp->enc_mae_supported = B_FALSE;
+		encp->enc_mae_admin = B_FALSE;
+	}
 #else
 	encp->enc_mae_supported = B_FALSE;
+	encp->enc_mae_admin = B_FALSE;
 #endif /* EFSYS_OPT_MAE */
 
 #undef CAP_FLAGS1
diff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h
index 8975c6e747..60533881c2 100644
--- a/drivers/common/sfc_efx/base/efx.h
+++ b/drivers/common/sfc_efx/base/efx.h
@@ -1618,6 +1618,13 @@ typedef struct efx_nic_cfg_s {
 	boolean_t		enc_hlb_counters;
 	/* NIC support for Match-Action Engine (MAE). */
 	boolean_t		enc_mae_supported;
+	/*
+	 * NIC is privileged, i.e. it is the MAE admin.
+	 * Only privileged MAE clients can manage MAE flow rules,
+	 * for example, modify, count and route traffic to selected
+	 * destination (a MAE client or network port).
+	 */
+	boolean_t		enc_mae_admin;
 	/* Firmware support for "FLAG" and "MARK" filter actions */
 	boolean_t		enc_filter_action_flag_supported;
 	boolean_t		enc_filter_action_mark_supported;
diff --git a/drivers/common/sfc_efx/base/siena_nic.c b/drivers/common/sfc_efx/base/siena_nic.c
index 29283eac72..8b810d3ae3 100644
--- a/drivers/common/sfc_efx/base/siena_nic.c
+++ b/drivers/common/sfc_efx/base/siena_nic.c
@@ -197,6 +197,7 @@ siena_board_cfg(
 	encp->enc_filter_action_mark_max = 0;
 
 	encp->enc_mae_supported = B_FALSE;
+	encp->enc_mae_admin = B_FALSE;
 
 	return (0);
 
-- 
2.30.2


  reply	other threads:[~2021-10-15  6:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15  6:49 [dpdk-dev] [PATCH 0/3] net/sfc: support transfer rule proxy Andrew Rybchenko
2021-10-15  6:49 ` Andrew Rybchenko [this message]
2021-10-15  6:49 ` [dpdk-dev] [PATCH 2/3] net/sfc: allow ports without MAE privilege Andrew Rybchenko
2021-10-15  6:49 ` [dpdk-dev] [PATCH 3/3] net/sfc: implement the transfer proxy port callback Andrew Rybchenko
2021-10-18 19:16 ` [dpdk-dev] [PATCH 0/3] net/sfc: support transfer rule proxy Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211015064903.3302489-2-andrew.rybchenko@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=amoreton@xilinx.com \
    --cc=dev@dpdk.org \
    --cc=viacheslav.galaktionov@oktetlabs.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git