From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id B05DBA0495 for ; Mon, 10 Jun 2019 09:42:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 83E8F1BF3F; Mon, 10 Jun 2019 09:39:39 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 3C7001BE9B for ; Mon, 10 Jun 2019 09:38:59 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (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 5BFCB140058 for ; Mon, 10 Jun 2019 07:38:58 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 10 Jun 2019 00:38:52 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Mon, 10 Jun 2019 00:38:51 -0700 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 x5A7cod4008879; Mon, 10 Jun 2019 08:38:50 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 72CCA1627D7; Mon, 10 Jun 2019 08:38:50 +0100 (BST) From: Andrew Rybchenko To: CC: Gautam Dawar Date: Mon, 10 Jun 2019 08:38:44 +0100 Message-ID: <1560152324-20538-30-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1560152324-20538-1-git-send-email-arybchenko@solarflare.com> References: <1560152324-20538-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.5.1010-24664.003 X-TM-AS-Result: No-2.290500-4.000000-10 X-TMASE-MatchedRID: tAYJtAlxpuYIHyE1IfGi6Ydlc1JaOB1T3V4UShoTXacYMX/fk94vWzB9 ccde3hbU0ZiHYm0cDqWudjtJNc/3dqH2g9syPs88bBMSu4v05tNNejdAw/bX399RlPzeVuQQg6c H7aDJatYNSyXBXXm7SPquDPDlvbSBOjQXVMc52b3/V0SDC1Do0HLIy0Oi6dswU6K0SLmnabR5g7 FdQG34vMM1QfdaUKwEJdw5r0zwEJsfE8yM4pjsDwtuKBGekqUpnH7sbImOEBQsnHWydaqG2eUjK qGXygcsjNg7iEFyQGHKCbqwExcqdWMlZB21s06kRE5DpMY+rMNFw1EJZ4YrgiCf8i9GPLzkKj9E OII9DpfkA8OrYHdwDGfYlY/yoV/0Up6EHOb2+c7kHZDO53QSwmA7bUFBqh2V X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.290500-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24664.003 X-MDID: 1560152339-HdOb4dS1l0GX Subject: [dpdk-dev] [PATCH 29/29] net/sfc/base: add APIs for PTP privilege configuration 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: Gautam Dawar 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 Signed-off-by: Andrew Rybchenko --- 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