Patchwork [dpdk-dev,33/38] net/sfc/base: pass Rx buffer size to RxQ init if supported

login
register
mail settings
Submitter Andrew Rybchenko
Date Feb. 7, 2019, 4:29 p.m.
Message ID <1549556983-10896-34-git-send-email-arybchenko@solarflare.com>
Download mbox | patch
Permalink /patch/720881/
State New
Headers show

Comments

Andrew Rybchenko - Feb. 7, 2019, 4:29 p.m.
Riverhead requires Rx buffer size to be specified in INIT_RXQ.
If the parameter is not supported (e.g. on EF10 family adapters),
zero must be used on INIT_RXQ.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/ef10_nic.c | 10 ++++++++++
 drivers/net/sfc/base/ef10_rx.c  | 15 ++++++++++-----
 drivers/net/sfc/base/efx.h      |  1 +
 3 files changed, 21 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/net/sfc/base/ef10_nic.c b/drivers/net/sfc/base/ef10_nic.c
index 39ca53f03..6ba2fe3b9 100644
--- a/drivers/net/sfc/base/ef10_nic.c
+++ b/drivers/net/sfc/base/ef10_nic.c
@@ -1205,6 +1205,16 @@  ef10_get_datapath_caps(
 	else
 		encp->enc_no_cont_ev_mode_supported = B_FALSE;
 
+	/*
+	 * Check if buffer size may and must be specified on INIT_RXQ.
+	 * It may be always specified to efx_rx_qcreate(), but will be
+	 * just kept libefx internal if MCDI does not support it.
+	 */
+	if (CAP_FLAGS2(req, INIT_RXQ_WITH_BUFFER_SIZE))
+		encp->enc_init_rxq_with_buffer_size = B_TRUE;
+	else
+		encp->enc_init_rxq_with_buffer_size = B_FALSE;
+
 	/*
 	 * Check if firmware-verified NVRAM updates must be used.
 	 *
diff --git a/drivers/net/sfc/base/ef10_rx.c b/drivers/net/sfc/base/ef10_rx.c
index 5cb7da99b..c060d2e4d 100644
--- a/drivers/net/sfc/base/ef10_rx.c
+++ b/drivers/net/sfc/base/ef10_rx.c
@@ -21,6 +21,7 @@  efx_mcdi_init_rxq(
 	__in		efsys_mem_t *esmp,
 	__in		boolean_t disable_scatter,
 	__in		boolean_t want_inner_classes,
+	__in		uint32_t buf_size,
 	__in		uint32_t ps_bufsize,
 	__in		uint32_t es_bufs_per_desc,
 	__in		uint32_t es_max_dma_len,
@@ -29,8 +30,8 @@  efx_mcdi_init_rxq(
 {
 	efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
 	efx_mcdi_req_t req;
-	EFX_MCDI_DECLARE_BUF(payload, MC_CMD_INIT_RXQ_V3_IN_LEN,
-		MC_CMD_INIT_RXQ_V3_OUT_LEN);
+	EFX_MCDI_DECLARE_BUF(payload, MC_CMD_INIT_RXQ_V4_IN_LEN,
+		MC_CMD_INIT_RXQ_V4_OUT_LEN);
 	int npages = efx_rxq_nbufs(enp, ndescs);
 	int i;
 	efx_qword_t *dma_addr;
@@ -84,9 +85,9 @@  efx_mcdi_init_rxq(
 
 	req.emr_cmd = MC_CMD_INIT_RXQ;
 	req.emr_in_buf = payload;
-	req.emr_in_length = MC_CMD_INIT_RXQ_V3_IN_LEN;
+	req.emr_in_length = MC_CMD_INIT_RXQ_V4_IN_LEN;
 	req.emr_out_buf = payload;
-	req.emr_out_length = MC_CMD_INIT_RXQ_V3_OUT_LEN;
+	req.emr_out_length = MC_CMD_INIT_RXQ_V4_OUT_LEN;
 
 	MCDI_IN_SET_DWORD(req, INIT_RXQ_EXT_IN_SIZE, ndescs);
 	MCDI_IN_SET_DWORD(req, INIT_RXQ_EXT_IN_TARGET_EVQ, eep->ee_index);
@@ -120,6 +121,10 @@  efx_mcdi_init_rxq(
 		    hol_block_timeout);
 	}
 
+	if (encp->enc_init_rxq_with_buffer_size)
+		MCDI_IN_SET_DWORD(req, INIT_RXQ_V4_IN_BUFFER_SIZE_BYTES,
+		    buf_size);
+
 	dma_addr = MCDI_IN2(req, efx_qword_t, INIT_RXQ_IN_DMA_ADDR);
 	addr = EFSYS_MEM_ADDR(esmp);
 
@@ -1140,7 +1145,7 @@  ef10_rx_qcreate(
 		want_inner_classes = B_FALSE;
 
 	if ((rc = efx_mcdi_init_rxq(enp, ndescs, eep, label, index,
-		    esmp, disable_scatter, want_inner_classes,
+		    esmp, disable_scatter, want_inner_classes, erp->er_buf_size,
 		    ps_buf_size, es_bufs_per_desc, es_max_dma_len,
 		    es_buf_stride, hol_block_timeout)) != 0)
 		goto fail12;
diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h
index 35f896750..2cd2c36c3 100644
--- a/drivers/net/sfc/base/efx.h
+++ b/drivers/net/sfc/base/efx.h
@@ -1371,6 +1371,7 @@  typedef struct efx_nic_cfg_s {
 	boolean_t		enc_enhanced_set_mac_supported;
 	boolean_t		enc_init_evq_v2_supported;
 	boolean_t		enc_no_cont_ev_mode_supported;
+	boolean_t		enc_init_rxq_with_buffer_size;
 	boolean_t		enc_rx_packed_stream_supported;
 	boolean_t		enc_rx_var_packed_stream_supported;
 	boolean_t		enc_rx_es_super_buffer_supported;