Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jan 2016 15:24:16 +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: r293959 - stable/10/sys/dev/sfxge/common
Message-ID:  <201601141524.u0EFOGB2042979@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arybchik
Date: Thu Jan 14 15:24:15 2016
New Revision: 293959
URL: https://svnweb.freebsd.org/changeset/base/293959

Log:
  MFC r291928
  
  sfxge: [2/6] rework MCDI response polling
  
  Required to support MCDI proxy authorization.
  
  Submitted by:   Andy Moreton <amoreton at solarflare.com>
  Reviewed by:    gnn
  Sponsored by:   Solarflare Communications, Inc.

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

Modified: stable/10/sys/dev/sfxge/common/efx_mcdi.c
==============================================================================
--- stable/10/sys/dev/sfxge/common/efx_mcdi.c	Thu Jan 14 15:23:23 2016	(r293958)
+++ stable/10/sys/dev/sfxge/common/efx_mcdi.c	Thu Jan 14 15:24:15 2016	(r293959)
@@ -52,9 +52,9 @@ static efx_mcdi_ops_t	__efx_mcdi_siena_o
 	siena_mcdi_fini,		/* emco_fini */
 	siena_mcdi_fw_update_supported,	/* emco_fw_update_supported */
 	siena_mcdi_macaddr_change_supported,
-				/* emco_macaddr_change_supported */
+					/* emco_macaddr_change_supported */
 	siena_mcdi_link_control_supported,
-				/* emco_link_control_supported */
+					/* emco_link_control_supported */
 };
 
 #endif	/* EFSYS_OPT_SIENA */
@@ -70,9 +70,9 @@ static efx_mcdi_ops_t	__efx_mcdi_hunt_op
 	hunt_mcdi_fini,			/* emco_fini */
 	hunt_mcdi_fw_update_supported,	/* emco_fw_update_supported */
 	hunt_mcdi_macaddr_change_supported,
-				/* emco_macaddr_change_supported */
+					/* emco_macaddr_change_supported */
 	hunt_mcdi_link_control_supported,
-				/* emco_link_control_supported */
+					/* emco_link_control_supported */
 };
 
 #endif	/* EFSYS_OPT_HUNTINGTON */

Modified: stable/10/sys/dev/sfxge/common/hunt_mcdi.c
==============================================================================
--- stable/10/sys/dev/sfxge/common/hunt_mcdi.c	Thu Jan 14 15:23:23 2016	(r293958)
+++ stable/10/sys/dev/sfxge/common/hunt_mcdi.c	Thu Jan 14 15:24:15 2016	(r293959)
@@ -274,6 +274,18 @@ hunt_mcdi_request_copyout(
 #endif /* EFSYS_OPT_MCDI_LOGGING */
 }
 
+static	__checkReturn	boolean_t
+hunt_mcdi_poll_response(
+	__in		efx_nic_t *enp)
+{
+	const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;
+	efsys_mem_t *esmp = emtp->emt_dma_mem;
+	efx_dword_t hdr;
+
+	EFSYS_MEM_READD(esmp, 0, &hdr);
+	return (EFX_DWORD_FIELD(hdr, MCDI_HEADER_RESPONSE) ? B_TRUE : B_FALSE);
+}
+
 	__checkReturn	boolean_t
 hunt_mcdi_request_poll(
 	__in		efx_nic_t *enp)
@@ -301,13 +313,15 @@ hunt_mcdi_request_poll(
 
 	offset = 0;
 
-	/* Read the command header */
-	EFSYS_MEM_READD(esmp, offset, &hdr[0]);
-	offset += sizeof (efx_dword_t);
-	if (EFX_DWORD_FIELD(hdr[0], MCDI_HEADER_RESPONSE) == 0) {
+	/* Check if a response is available */
+	if (hunt_mcdi_poll_response(enp) == B_FALSE) {
 		EFSYS_UNLOCK(enp->en_eslp, state);
 		return (B_FALSE);
 	}
+
+	/* Read the response header */
+	EFSYS_MEM_READD(esmp, offset, &hdr[0]);
+	offset += sizeof (efx_dword_t);
 	if (EFX_DWORD_FIELD(hdr[0], MCDI_HEADER_CODE) == MC_CMD_V2_EXTN) {
 		EFSYS_MEM_READD(esmp, offset, &hdr[1]);
 		offset += sizeof (efx_dword_t);

Modified: stable/10/sys/dev/sfxge/common/siena_mcdi.c
==============================================================================
--- stable/10/sys/dev/sfxge/common/siena_mcdi.c	Thu Jan 14 15:23:23 2016	(r293958)
+++ stable/10/sys/dev/sfxge/common/siena_mcdi.c	Thu Jan 14 15:24:15 2016	(r293959)
@@ -191,6 +191,21 @@ siena_mcdi_poll_reboot(
 #endif
 }
 
+static	__checkReturn	boolean_t
+siena_mcdi_poll_response(
+	__in		efx_nic_t *enp)
+{
+	efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
+	efx_dword_t hdr;
+	unsigned int pdur;
+
+	EFSYS_ASSERT(emip->emi_port == 1 || emip->emi_port == 2);
+	pdur = SIENA_MCDI_PDU(emip);
+
+	EFX_BAR_TBL_READD(enp, FR_CZ_MC_TREG_SMEM, pdur, &hdr, B_FALSE);
+	return (EFX_DWORD_FIELD(hdr, MCDI_HEADER_RESPONSE) ? B_TRUE : B_FALSE);
+}
+
 	__checkReturn	boolean_t
 siena_mcdi_request_poll(
 	__in		efx_nic_t *enp)
@@ -229,13 +244,15 @@ siena_mcdi_request_poll(
 	EFSYS_ASSERT(emip->emi_port == 1 || emip->emi_port == 2);
 	pdur = SIENA_MCDI_PDU(emip);
 
-	/* Read the command header */
-	EFX_BAR_TBL_READD(enp, FR_CZ_MC_TREG_SMEM, pdur, &hdr, B_FALSE);
-	if (EFX_DWORD_FIELD(hdr, MCDI_HEADER_RESPONSE) == 0) {
+	/* Check if a response is available */
+	if (siena_mcdi_poll_response(enp) == B_FALSE) {
 		EFSYS_UNLOCK(enp->en_eslp, state);
 		return (B_FALSE);
 	}
 
+	/* Read the response header */
+	EFX_BAR_TBL_READD(enp, FR_CZ_MC_TREG_SMEM, pdur, &hdr, B_FALSE);
+
 	/* Request complete */
 	emip->emi_pending_req = NULL;
 	seq = (emip->emi_seq - 1) & EFX_MASK32(MCDI_HEADER_SEQ);



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