[dpdk-dev] [PATCH 29/29] net/sfc/base: add APIs for PTP privilege configuration

Andrew Rybchenko arybchenko at solarflare.com
Mon Jun 10 09:38:44 CEST 2019


From: Gautam Dawar <gdawar at solarflare.com>

Implement the efx_proxy_auth_privilege_mask_get() to get a function's
privilege mask and efx_proxy_auth_privilege_modify() to add/remove
privileges for a function specified by PF and VF index.

Signed-off-by: Gautam Dawar <gdawar at solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
---
 drivers/net/sfc/base/ef10_impl.h  |  7 +++++
 drivers/net/sfc/base/ef10_proxy.c | 11 +++++++
 drivers/net/sfc/base/efx.h        | 15 +++++++++
 drivers/net/sfc/base/efx_impl.h   |  2 ++
 drivers/net/sfc/base/efx_proxy.c  | 64 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 99 insertions(+)

diff --git a/drivers/net/sfc/base/ef10_impl.h b/drivers/net/sfc/base/ef10_impl.h
index 09f97f8..3961801 100644
--- a/drivers/net/sfc/base/ef10_impl.h
+++ b/drivers/net/sfc/base/ef10_impl.h
@@ -1411,6 +1411,13 @@ extern	__checkReturn	__success(return != B_FALSE)	boolean_t
 	__in		efx_nic_t *enp,
 	__inout		efx_proxy_cmd_params_t *paramsp);
 
+	__checkReturn	efx_rc_t
+ef10_proxy_auth_get_privilege_mask(
+	__in		efx_nic_t *enp,
+	__in		uint32_t pf_index,
+	__in		uint32_t vf_index,
+	__out		uint32_t *maskp);
+
 #endif  /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */
 
 #if EFSYS_OPT_RX_PACKED_STREAM
diff --git a/drivers/net/sfc/base/ef10_proxy.c b/drivers/net/sfc/base/ef10_proxy.c
index a3b73f4..059b2f5 100644
--- a/drivers/net/sfc/base/ef10_proxy.c
+++ b/drivers/net/sfc/base/ef10_proxy.c
@@ -451,6 +451,17 @@
 }
 
 	__checkReturn	efx_rc_t
+ef10_proxy_auth_get_privilege_mask(
+	__in		efx_nic_t *enp,
+	__in		uint32_t pf_index,
+	__in		uint32_t vf_index,
+	__out		uint32_t *maskp)
+{
+	return (efx_mcdi_privilege_mask(enp, pf_index, vf_index, maskp));
+}
+
+
+	__checkReturn	efx_rc_t
 ef10_proxy_auth_exec_cmd(
 	__in		efx_nic_t *enp,
 	__inout		efx_proxy_cmd_params_t *paramsp)
diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h
index a43ddd9..53c7b42 100644
--- a/drivers/net/sfc/base/efx.h
+++ b/drivers/net/sfc/base/efx.h
@@ -3513,6 +3513,21 @@ extern	__checkReturn	__success(return != B_FALSE)	boolean_t
 	__in		uint32_t mask,
 	__in		uint32_t value);
 
+	__checkReturn	efx_rc_t
+efx_proxy_auth_privilege_mask_get(
+	__in		efx_nic_t *enp,
+	__in		uint32_t pf_index,
+	__in		uint32_t vf_index,
+	__out		uint32_t *maskp);
+
+	__checkReturn	efx_rc_t
+efx_proxy_auth_privilege_modify(
+	__in		efx_nic_t *enp,
+	__in		uint32_t pf_index,
+	__in		uint32_t vf_index,
+	__in		uint32_t add_privileges_mask,
+	__in		uint32_t remove_privileges_mask);
+
 #endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */
 
 #ifdef	__cplusplus
diff --git a/drivers/net/sfc/base/efx_impl.h b/drivers/net/sfc/base/efx_impl.h
index 3e8b26a..85d984f 100644
--- a/drivers/net/sfc/base/efx_impl.h
+++ b/drivers/net/sfc/base/efx_impl.h
@@ -717,6 +717,8 @@ struct efx_vswitch_s {
 	efx_rc_t	(*epo_complete_request)(efx_nic_t *, uint32_t,
 					uint32_t, uint32_t);
 	efx_rc_t	(*epo_exec_cmd)(efx_nic_t *, efx_proxy_cmd_params_t *);
+	efx_rc_t	(*epo_get_privilege_mask)(efx_nic_t *, uint32_t,
+					uint32_t, uint32_t *);
 } efx_proxy_ops_t;
 
 #endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */
diff --git a/drivers/net/sfc/base/efx_proxy.c b/drivers/net/sfc/base/efx_proxy.c
index b04e7dd..791105a 100644
--- a/drivers/net/sfc/base/efx_proxy.c
+++ b/drivers/net/sfc/base/efx_proxy.c
@@ -19,6 +19,7 @@
 	NULL,			/* epo_set_privilege_mask */
 	NULL,			/* epo_complete_request */
 	NULL,			/* epo_exec_cmd */
+	NULL,			/* epo_get_privilege_mask */
 };
 #endif /* EFSYS_OPT_SIENA */
 
@@ -32,6 +33,7 @@
 	ef10_proxy_auth_set_privilege_mask,	/* epo_set_privilege_mask */
 	ef10_proxy_auth_complete_request,	/* epo_complete_request */
 	ef10_proxy_auth_exec_cmd,		/* epo_exec_cmd */
+	ef10_proxy_auth_get_privilege_mask,	/* epo_get_privilege_mask */
 };
 #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
 
@@ -296,5 +298,67 @@
 	return (rc);
 }
 
+	__checkReturn	efx_rc_t
+efx_proxy_auth_privilege_mask_get(
+	__in		efx_nic_t *enp,
+	__in		uint32_t pf_index,
+	__in		uint32_t vf_index,
+	__out		uint32_t *maskp)
+{
+	const efx_proxy_ops_t *epop = enp->en_epop;
+	efx_rc_t rc;
+
+	EFSYS_ASSERT(enp->en_mod_flags & EFX_MOD_PROXY);
+
+	if (epop->epo_get_privilege_mask == NULL) {
+		rc = ENOTSUP;
+		goto fail1;
+	}
+
+	rc = epop->epo_get_privilege_mask(enp, pf_index, vf_index, maskp);
+	if (rc != 0)
+		goto fail2;
+
+	return (0);
+
+fail2:
+	EFSYS_PROBE(fail2);
+fail1:
+	EFSYS_PROBE1(fail1, efx_rc_t, rc);
+	return (rc);
+}
+
+	__checkReturn	efx_rc_t
+efx_proxy_auth_privilege_modify(
+	__in		efx_nic_t *enp,
+	__in		uint32_t pf_index,
+	__in		uint32_t vf_index,
+	__in		uint32_t add_privileges_mask,
+	__in		uint32_t remove_privileges_mask)
+{
+	const efx_proxy_ops_t *epop = enp->en_epop;
+	efx_rc_t rc;
+
+	EFSYS_ASSERT(enp->en_mod_flags & EFX_MOD_PROXY);
+
+	if (epop->epo_privilege_modify == NULL) {
+		rc = ENOTSUP;
+		goto fail1;
+	}
+
+	rc = epop->epo_privilege_modify(enp, MC_CMD_PRIVILEGE_MODIFY_IN_ONE,
+		    pf_index, vf_index, add_privileges_mask,
+		    remove_privileges_mask);
+	if (rc != 0)
+		goto fail2;
+
+	return (0);
+
+fail2:
+	EFSYS_PROBE(fail2);
+fail1:
+	EFSYS_PROBE1(fail1, efx_rc_t, rc);
+	return (rc);
+}
 
 #endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */
-- 
1.8.3.1



More information about the dev mailing list