Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jan 2016 08:05:56 +0000 (UTC)
From:      Andrew Rybchenko <arybchik@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r294389 - stable/10/sys/dev/sfxge/common
Message-ID:  <201601200805.u0K85uKd030556@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arybchik
Date: Wed Jan 20 08:05:56 2016
New Revision: 294389
URL: https://svnweb.freebsd.org/changeset/base/294389

Log:
  MFC r294076
  
  sfxge: rework MCDI request completion
  
  Submitted by:   Andy Moreton <amoreton at solarflare.com>
  Reviewed by:    gnn
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  stable/10/sys/dev/sfxge/common/efx_impl.h
  stable/10/sys/dev/sfxge/common/efx_mcdi.c
  stable/10/sys/dev/sfxge/common/efx_mcdi.h
  stable/10/sys/dev/sfxge/common/hunt_impl.h
  stable/10/sys/dev/sfxge/common/hunt_mcdi.c
  stable/10/sys/dev/sfxge/common/siena_impl.h
  stable/10/sys/dev/sfxge/common/siena_mcdi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efx_impl.h
==============================================================================
--- stable/10/sys/dev/sfxge/common/efx_impl.h	Wed Jan 20 08:03:30 2016	(r294388)
+++ stable/10/sys/dev/sfxge/common/efx_impl.h	Wed Jan 20 08:05:56 2016	(r294389)
@@ -463,7 +463,6 @@ typedef struct efx_mcdi_ops_s {
 	efx_rc_t	(*emco_init)(efx_nic_t *, const efx_mcdi_transport_t *);
 	void		(*emco_send_request)(efx_nic_t *, void *, size_t,
 					void *, size_t);
-	void		(*emco_request_copyout)(efx_nic_t *, efx_mcdi_req_t *);
 	efx_rc_t	(*emco_poll_reboot)(efx_nic_t *);
 	boolean_t	(*emco_poll_response)(efx_nic_t *);
 	void		(*emco_read_response)(efx_nic_t *, void *, size_t, size_t);

Modified: stable/10/sys/dev/sfxge/common/efx_mcdi.c
==============================================================================
--- stable/10/sys/dev/sfxge/common/efx_mcdi.c	Wed Jan 20 08:03:30 2016	(r294388)
+++ stable/10/sys/dev/sfxge/common/efx_mcdi.c	Wed Jan 20 08:05:56 2016	(r294389)
@@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$");
 static efx_mcdi_ops_t	__efx_mcdi_siena_ops = {
 	siena_mcdi_init,		/* emco_init */
 	siena_mcdi_send_request,	/* emco_send_request */
-	siena_mcdi_request_copyout,	/* emco_request_copyout */
 	siena_mcdi_poll_reboot,		/* emco_poll_reboot */
 	siena_mcdi_poll_response,	/* emco_poll_response */
 	siena_mcdi_read_response,	/* emco_read_response */
@@ -77,7 +76,6 @@ static efx_mcdi_ops_t	__efx_mcdi_siena_o
 static efx_mcdi_ops_t	__efx_mcdi_ef10_ops = {
 	ef10_mcdi_init,			/* emco_init */
 	ef10_mcdi_send_request,		/* emco_send_request */
-	ef10_mcdi_request_copyout,	/* emco_request_copyout */
 	ef10_mcdi_poll_reboot,		/* emco_poll_reboot */
 	ef10_mcdi_poll_response,	/* emco_poll_response */
 	ef10_mcdi_read_response,	/* emco_read_response */
@@ -211,16 +209,6 @@ efx_mcdi_send_request(
 	emcop->emco_send_request(enp, hdrp, hdr_len, sdup, sdu_len);
 }
 
-static			void
-efx_mcdi_request_copyout(
-	__in		efx_nic_t *enp,
-	__in		efx_mcdi_req_t *emrp)
-{
-	efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
-
-	emcop->emco_request_copyout(enp, emrp);
-}
-
 static			efx_rc_t
 efx_mcdi_poll_reboot(
 	__in		efx_nic_t *enp)
@@ -353,7 +341,7 @@ efx_mcdi_request_start(
 }
 
 
-			void
+static			void
 efx_mcdi_read_response_header(
 	__in		efx_nic_t *enp,
 	__inout		efx_mcdi_req_t *emrp)
@@ -468,6 +456,50 @@ fail1:
 	emrp->emr_out_length_used = 0;
 }
 
+static			void
+efx_mcdi_finish_response(
+	__in		efx_nic_t *enp,
+	__in		efx_mcdi_req_t *emrp)
+{
+#if EFSYS_OPT_MCDI_LOGGING
+	const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;
+#endif /* EFSYS_OPT_MCDI_LOGGING */
+	efx_dword_t hdr[2];
+	unsigned int hdr_len;
+	size_t bytes;
+
+	if (emrp->emr_out_buf == NULL)
+		return;
+
+	/* Read the command header to detect MCDI response format */
+	hdr_len = sizeof (hdr[0]);
+	efx_mcdi_read_response(enp, &hdr[0], 0, hdr_len);
+	if (EFX_DWORD_FIELD(hdr[0], MCDI_HEADER_CODE) == MC_CMD_V2_EXTN) {
+		/*
+		 * Read the actual payload length. The length given in the event
+		 * is only correct for responses with the V1 format.
+		 */
+		efx_mcdi_read_response(enp, &hdr[1], hdr_len, sizeof (hdr[1]));
+		hdr_len += sizeof (hdr[1]);
+
+		emrp->emr_out_length_used = EFX_DWORD_FIELD(hdr[1],
+					    MC_CMD_V2_EXTN_IN_ACTUAL_LEN);
+	}
+
+	/* Copy payload out into caller supplied buffer */
+	bytes = MIN(emrp->emr_out_length_used, emrp->emr_out_length);
+	efx_mcdi_read_response(enp, emrp->emr_out_buf, hdr_len, bytes);
+
+#if EFSYS_OPT_MCDI_LOGGING
+	if (emtp->emt_logger != NULL) {
+		emtp->emt_logger(emtp->emt_context,
+		    EFX_LOG_MCDI_RESPONSE,
+		    &hdr, hdr_len,
+		    emrp->emr_out_buf, bytes);
+	}
+#endif /* EFSYS_OPT_MCDI_LOGGING */
+}
+
 
 	__checkReturn	boolean_t
 efx_mcdi_request_poll(
@@ -515,7 +547,7 @@ efx_mcdi_request_poll(
 	if ((rc = emrp->emr_rc) != 0)
 		goto fail2;
 
-	efx_mcdi_request_copyout(enp, emrp);
+	efx_mcdi_finish_response(enp, emrp);
 	return (B_TRUE);
 
 fail2:
@@ -709,7 +741,6 @@ efx_mcdi_ev_cpl(
 {
 	efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
 	const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;
-	efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop;
 	efx_mcdi_req_t *emrp;
 	int state;
 
@@ -751,7 +782,7 @@ efx_mcdi_ev_cpl(
 		}
 	}
 	if (errcode == 0) {
-		emcop->emco_request_copyout(enp, emrp);
+		efx_mcdi_finish_response(enp, emrp);
 	}
 
 	emtp->emt_ev_cpl(emtp->emt_context);

Modified: stable/10/sys/dev/sfxge/common/efx_mcdi.h
==============================================================================
--- stable/10/sys/dev/sfxge/common/efx_mcdi.h	Wed Jan 20 08:03:30 2016	(r294388)
+++ stable/10/sys/dev/sfxge/common/efx_mcdi.h	Wed Jan 20 08:05:56 2016	(r294389)
@@ -88,11 +88,6 @@ efx_mcdi_execute_quiet(
 	__in		efx_nic_t *enp,
 	__inout		efx_mcdi_req_t *emrp);
 
- extern			void
-efx_mcdi_read_response_header(
-	__in		efx_nic_t *enp,
-	__inout		efx_mcdi_req_t *emrp);
-
 extern			void
 efx_mcdi_ev_cpl(
 	__in		efx_nic_t *enp,

Modified: stable/10/sys/dev/sfxge/common/hunt_impl.h
==============================================================================
--- stable/10/sys/dev/sfxge/common/hunt_impl.h	Wed Jan 20 08:03:30 2016	(r294388)
+++ stable/10/sys/dev/sfxge/common/hunt_impl.h	Wed Jan 20 08:05:56 2016	(r294389)
@@ -305,11 +305,6 @@ ef10_mcdi_read_response(
 	__in			size_t offset,
 	__in			size_t length);
 
-extern			void
-ef10_mcdi_request_copyout(
-	__in		efx_nic_t *enp,
-	__in		efx_mcdi_req_t *emrp);
-
 extern			efx_rc_t
 ef10_mcdi_poll_reboot(
 	__in		efx_nic_t *enp);

Modified: stable/10/sys/dev/sfxge/common/hunt_mcdi.c
==============================================================================
--- stable/10/sys/dev/sfxge/common/hunt_mcdi.c	Wed Jan 20 08:03:30 2016	(r294388)
+++ stable/10/sys/dev/sfxge/common/hunt_mcdi.c	Wed Jan 20 08:05:56 2016	(r294389)
@@ -150,50 +150,6 @@ ef10_mcdi_send_request(
 	EFX_BAR_WRITED(enp, ER_DZ_MC_DB_HWRD_REG, &dword, B_FALSE);
 }
 
-			void
-ef10_mcdi_request_copyout(
-	__in		efx_nic_t *enp,
-	__in		efx_mcdi_req_t *emrp)
-{
-#if EFSYS_OPT_MCDI_LOGGING
-	const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;
-#endif /* EFSYS_OPT_MCDI_LOGGING */
-	efx_dword_t hdr[2];
-	unsigned int hdr_len;
-	size_t bytes;
-
-	if (emrp->emr_out_buf == NULL)
-		return;
-
-	/* Read the command header to detect MCDI response format */
-	hdr_len = sizeof (hdr[0]);
-	ef10_mcdi_read_response(enp, &hdr[0], 0, hdr_len);
-	if (EFX_DWORD_FIELD(hdr[0], MCDI_HEADER_CODE) == MC_CMD_V2_EXTN) {
-		/*
-		 * Read the actual payload length. The length given in the event
-		 * is only correct for responses with the V1 format.
-		 */
-		ef10_mcdi_read_response(enp, &hdr[1], hdr_len, sizeof (hdr[1]));
-		hdr_len += sizeof (hdr[1]);
-
-		emrp->emr_out_length_used = EFX_DWORD_FIELD(hdr[1],
-					    MC_CMD_V2_EXTN_IN_ACTUAL_LEN);
-	}
-
-	/* Copy payload out into caller supplied buffer */
-	bytes = MIN(emrp->emr_out_length_used, emrp->emr_out_length);
-	ef10_mcdi_read_response(enp, emrp->emr_out_buf, hdr_len, bytes);
-
-#if EFSYS_OPT_MCDI_LOGGING
-	if (emtp->emt_logger != NULL) {
-		emtp->emt_logger(emtp->emt_context,
-		    EFX_LOG_MCDI_RESPONSE,
-		    &hdr, hdr_len,
-		    emrp->emr_out_buf, bytes);
-	}
-#endif /* EFSYS_OPT_MCDI_LOGGING */
-}
-
 	__checkReturn	boolean_t
 ef10_mcdi_poll_response(
 	__in		efx_nic_t *enp)

Modified: stable/10/sys/dev/sfxge/common/siena_impl.h
==============================================================================
--- stable/10/sys/dev/sfxge/common/siena_impl.h	Wed Jan 20 08:03:30 2016	(r294388)
+++ stable/10/sys/dev/sfxge/common/siena_impl.h	Wed Jan 20 08:05:56 2016	(r294389)
@@ -132,11 +132,6 @@ siena_mcdi_read_response(
 	__in			size_t offset,
 	__in			size_t length);
 
-extern			void
-siena_mcdi_request_copyout(
-	__in		efx_nic_t *enp,
-	__in		efx_mcdi_req_t *emrp);
-
 extern			efx_rc_t
 siena_mcdi_poll_reboot(
 	__in		efx_nic_t *enp);

Modified: stable/10/sys/dev/sfxge/common/siena_mcdi.c
==============================================================================
--- stable/10/sys/dev/sfxge/common/siena_mcdi.c	Wed Jan 20 08:03:30 2016	(r294388)
+++ stable/10/sys/dev/sfxge/common/siena_mcdi.c	Wed Jan 20 08:05:56 2016	(r294389)
@@ -89,35 +89,6 @@ siena_mcdi_send_request(
 	EFX_BAR_TBL_WRITED(enp, FR_CZ_MC_TREG_SMEM, dbr, &dword, B_FALSE);
 }
 
-			void
-siena_mcdi_request_copyout(
-	__in		efx_nic_t *enp,
-	__in		efx_mcdi_req_t *emrp)
-{
-#if EFSYS_OPT_MCDI_LOGGING
-	const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;
-	efx_dword_t hdr;
-#endif
-	size_t bytes = MIN(emrp->emr_out_length_used, emrp->emr_out_length);
-
-	/* Copy payload out if caller supplied buffer */
-	if (emrp->emr_out_buf != NULL) {
-		siena_mcdi_read_response(enp, emrp->emr_out_buf,
-		    sizeof (efx_dword_t), bytes);
-	}
-
-#if EFSYS_OPT_MCDI_LOGGING
-	if (emtp->emt_logger != NULL) {
-		siena_mcdi_read_response(enp, &hdr, 0, sizeof (hdr));
-
-		emtp->emt_logger(emtp->emt_context,
-		    EFX_LOG_MCDI_RESPONSE,
-		    &hdr, sizeof (hdr),
-		    emrp->emr_out_buf, bytes);
-	}
-#endif /* EFSYS_OPT_MCDI_LOGGING */
-}
-
 			efx_rc_t
 siena_mcdi_poll_reboot(
 	__in		efx_nic_t *enp)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601200805.u0K85uKd030556>