[v3,09/60] common/sfc_efx/base: move 14b prefix check out of caps get

Message ID 1600949555-28043-10-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series common/sfc_efx: support Riverhead NIC family |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrew Rybchenko Sept. 24, 2020, 12:11 p.m. UTC
  The function which gets capabilities from MC should simply fill in
NIC configuration. Caller should decide if the configuration is
supported or not.

The change is required to prepare the function to be reused on
Riverhead.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/common/sfc_efx/base/ef10_nic.c | 33 ++++++++++++++------------
 1 file changed, 18 insertions(+), 15 deletions(-)
  

Patch

diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c
index 34fa45e8c1..bb5fd50eab 100644
--- a/drivers/common/sfc_efx/base/ef10_nic.c
+++ b/drivers/common/sfc_efx/base/ef10_nic.c
@@ -1062,15 +1062,11 @@  ef10_get_datapath_caps(
 	    (MCDI_OUT_DWORD((_req), GET_CAPABILITIES_V2_OUT_FLAGS2) &	\
 	    (1u << (MC_CMD_GET_CAPABILITIES_V2_OUT_ ## _flag ## _LBN))))
 
-	/*
-	 * Huntington RXDP firmware inserts a 0 or 14 byte prefix.
-	 * We only support the 14 byte prefix here.
-	 */
-	if (CAP_FLAGS1(req, RX_PREFIX_LEN_14) == 0) {
-		rc = ENOTSUP;
-		goto fail4;
-	}
-	encp->enc_rx_prefix_size = 14;
+	/* Check if RXDP firmware inserts 14 byte prefix */
+	if (CAP_FLAGS1(req, RX_PREFIX_LEN_14))
+		encp->enc_rx_prefix_size = 14;
+	else
+		encp->enc_rx_prefix_size = 0;
 
 #if EFSYS_OPT_RX_SCALE
 	/* Check if the firmware supports additional RSS modes */
@@ -1348,7 +1344,7 @@  ef10_get_datapath_caps(
 
 		default:
 			rc = EINVAL;
-			goto fail5;
+			goto fail4;
 		}
 
 		/* Port numbers cannot contribute to the hash value */
@@ -1397,11 +1393,9 @@  ef10_get_datapath_caps(
 	return (0);
 
 #if EFSYS_OPT_RX_SCALE
-fail5:
-	EFSYS_PROBE(fail5);
-#endif /* EFSYS_OPT_RX_SCALE */
 fail4:
 	EFSYS_PROBE(fail4);
+#endif /* EFSYS_OPT_RX_SCALE */
 fail3:
 	EFSYS_PROBE(fail3);
 fail2:
@@ -1932,6 +1926,15 @@  ef10_nic_board_cfg(
 	if ((rc = ef10_get_datapath_caps(enp)) != 0)
 		goto fail8;
 
+	/*
+	 * Huntington RXDP firmware inserts a 0 or 14 byte prefix.
+	 * We only support the 14 byte prefix here.
+	 */
+	if (encp->enc_rx_prefix_size != 14) {
+		rc = ENOTSUP;
+		goto fail9;
+	}
+
 	/* Alignment for WPTR updates */
 	encp->enc_rx_push_align = EF10_RX_WPTR_ALIGN;
 
@@ -1960,7 +1963,7 @@  ef10_nic_board_cfg(
 	/* Get interrupt vector limits */
 	if ((rc = efx_mcdi_get_vector_cfg(enp, &base, &nvec, NULL)) != 0) {
 		if (EFX_PCI_FUNCTION_IS_PF(encp))
-			goto fail9;
+			goto fail10;
 
 		/* Ignore error (cannot query vector limits from a VF). */
 		base = 0;
@@ -1976,7 +1979,7 @@  ef10_nic_board_cfg(
 	 * can result in time-of-check/time-of-use bugs.
 	 */
 	if ((rc = ef10_get_privilege_mask(enp, &mask)) != 0)
-		goto fail10;
+		goto fail11;
 	encp->enc_privilege_mask = mask;
 
 	if ((rc = ef10_set_workaround_bug26807(enp)) != 0)