From 47ac8ca7351578bfd7eb57eac3b63edb320fb6a7 Mon Sep 17 00:00:00 2001 From: Gautam Dawar Date: Mon, 10 Jun 2019 08:38:40 +0100 Subject: [PATCH] net/sfc/base: implement proxy auth MCDI event handling Add the capability to receive MCDI proxy event from firmware and invoke the client driver registered function to handle it. Signed-off-by: Gautam Dawar Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/base/ef10_ev.c | 7 +++++++ drivers/net/sfc/base/efx.h | 3 +++ drivers/net/sfc/base/efx_check.h | 9 ++++++++- drivers/net/sfc/base/efx_mcdi.c | 12 ++++++++++++ drivers/net/sfc/base/efx_mcdi.h | 7 +++++++ 5 files changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/net/sfc/base/ef10_ev.c b/drivers/net/sfc/base/ef10_ev.c index 99cae3fa3b..8cabb4e928 100644 --- a/drivers/net/sfc/base/ef10_ev.c +++ b/drivers/net/sfc/base/ef10_ev.c @@ -1227,6 +1227,13 @@ ef10_ev_mcdi( break; #endif /* EFSYS_OPT_MCDI_PROXY_AUTH */ +#if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER + case MCDI_EVENT_CODE_PROXY_REQUEST: + efx_mcdi_ev_proxy_request(enp, + MCDI_EV_FIELD(eqp, PROXY_REQUEST_BUFF_INDEX)); + break; +#endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */ + case MCDI_EVENT_CODE_LINKCHANGE: { efx_link_mode_t link_mode; diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h index 8a3eb17a6c..97c4e62340 100644 --- a/drivers/net/sfc/base/efx.h +++ b/drivers/net/sfc/base/efx.h @@ -243,6 +243,9 @@ typedef struct efx_mcdi_transport_s { #if EFSYS_OPT_MCDI_PROXY_AUTH void (*emt_ev_proxy_response)(void *, uint32_t, efx_rc_t); #endif /* EFSYS_OPT_MCDI_PROXY_AUTH */ +#if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER + void (*emt_ev_proxy_request)(void *, uint32_t); +#endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */ } efx_mcdi_transport_t; extern __checkReturn efx_rc_t diff --git a/drivers/net/sfc/base/efx_check.h b/drivers/net/sfc/base/efx_check.h index 85edaef7d7..06983dc593 100644 --- a/drivers/net/sfc/base/efx_check.h +++ b/drivers/net/sfc/base/efx_check.h @@ -119,8 +119,15 @@ # endif #endif /* EFSYS_OPT_MCDI_LOGGING */ +#if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER +/* Support MCDI proxy authorization (server) */ +# if !EFSYS_OPT_MCDI_PROXY_AUTH +# error "MCDI_PROXY_AUTH_SERVER requires MCDI_PROXY_AUTH" +# endif +#endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */ + #if EFSYS_OPT_MCDI_PROXY_AUTH -/* Support MCDI proxy authorization */ +/* Support MCDI proxy authorization (client) */ # if !EFSYS_OPT_MCDI # error "MCDI_PROXY_AUTH requires MCDI" # endif diff --git a/drivers/net/sfc/base/efx_mcdi.c b/drivers/net/sfc/base/efx_mcdi.c index 584fd4d2f7..325c2e44dd 100644 --- a/drivers/net/sfc/base/efx_mcdi.c +++ b/drivers/net/sfc/base/efx_mcdi.c @@ -845,6 +845,18 @@ efx_mcdi_ev_proxy_response( } #endif /* EFSYS_OPT_MCDI_PROXY_AUTH */ +#if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER + void +efx_mcdi_ev_proxy_request( + __in efx_nic_t *enp, + __in unsigned int index) +{ + const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; + + if (emtp->emt_ev_proxy_request != NULL) + emtp->emt_ev_proxy_request(emtp->emt_context, index); +} +#endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */ void efx_mcdi_ev_death( __in efx_nic_t *enp, diff --git a/drivers/net/sfc/base/efx_mcdi.h b/drivers/net/sfc/base/efx_mcdi.h index a9e0255371..56c0ab1050 100644 --- a/drivers/net/sfc/base/efx_mcdi.h +++ b/drivers/net/sfc/base/efx_mcdi.h @@ -87,6 +87,13 @@ efx_mcdi_ev_proxy_response( __in unsigned int status); #endif +#if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER +extern void +efx_mcdi_ev_proxy_request( + __in efx_nic_t *enp, + __in unsigned int index); +#endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */ + extern void efx_mcdi_ev_death( __in efx_nic_t *enp, -- 2.20.1