diff mbox series

[v2,15/16] bus/dpaa: add support for SG config

Message ID 1530697431-1244-15-git-send-email-hemant.agrawal@nxp.com
State Superseded
Headers show
Series [v2,01/16] bus/dpaa: fix phandle support for kernel 4.16 | expand

Commit Message

Hemant Agrawal July 4, 2018, 9:43 a.m. UTC
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

---
 drivers/bus/dpaa/base/fman/fman_hw.c      | 42 +++++++++++++++++++++++++++++++
 drivers/bus/dpaa/include/fsl_fman.h       |  6 +++++
 drivers/bus/dpaa/rte_bus_dpaa_version.map |  2 ++
 3 files changed, 50 insertions(+)

-- 
2.7.4

Comments

Shreyansh Jain July 6, 2018, 4:38 a.m. UTC | #1
On Wednesday 04 July 2018 03:13 PM, Hemant Agrawal wrote:
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

> ---

>   drivers/bus/dpaa/base/fman/fman_hw.c      | 42 +++++++++++++++++++++++++++++++

>   drivers/bus/dpaa/include/fsl_fman.h       |  6 +++++

>   drivers/bus/dpaa/rte_bus_dpaa_version.map |  2 ++

>   3 files changed, 50 insertions(+)

> 


[...]

>   

> diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map

> index e00c911..fcfbb47 100644

> --- a/drivers/bus/dpaa/rte_bus_dpaa_version.map

> +++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map

> @@ -70,6 +70,8 @@ DPDK_18.02 {

>   

>   	dpaa_logtype_eventdev;

>   	dpaa_svr_family;

> +	fman_if_get_sg_enable;

> +	fman_if_set_sg;


These should be added to a new version block for 18.08

>   	per_lcore_dpaa_io;

>   	per_lcore_held_bufs;

>   	qm_channel_pool1;

>
diff mbox series

Patch

diff --git a/drivers/bus/dpaa/base/fman/fman_hw.c b/drivers/bus/dpaa/base/fman/fman_hw.c
index 7ada7fa..4ebbc3d 100644
--- a/drivers/bus/dpaa/base/fman/fman_hw.c
+++ b/drivers/bus/dpaa/base/fman/fman_hw.c
@@ -16,6 +16,7 @@ 
 #include <fsl_fman_crc64.h>
 #include <fsl_bman.h>
 
+#define FMAN_SP_SG_DISABLE                          0x80000000
 #define FMAN_SP_EXT_BUF_MARG_START_SHIFT            16
 
 /* Instantiate the global variable that the inline CRC64 implementation (in
@@ -538,6 +539,47 @@  fman_if_get_maxfrm(struct fman_if *fm_if)
 	return (in_be32(reg_maxfrm) | 0x0000FFFF);
 }
 
+/* MSB in fmbm_rebm register
+ * 0 - If BMI cannot store the frame in a single buffer it may select a buffer
+ *     of smaller size and store the frame in scatter gather (S/G) buffers
+ * 1 - Scatter gather format is not enabled for frame storage. If BMI cannot
+ *     store the frame in a single buffer, the frame is discarded.
+ */
+
+int
+fman_if_get_sg_enable(struct fman_if *fm_if)
+{
+	u32 fmbm_rebm;
+
+	struct __fman_if *__if = container_of(fm_if, struct __fman_if, __if);
+
+	assert(fman_ccsr_map_fd != -1);
+
+	fmbm_rebm = in_be32(&((struct rx_bmi_regs *)__if->bmi_map)->fmbm_rebm);
+
+	return (fmbm_rebm & FMAN_SP_SG_DISABLE) ? 0 : 1;
+}
+
+void
+fman_if_set_sg(struct fman_if *fm_if, int enable)
+{
+	struct __fman_if *__if = container_of(fm_if, struct __fman_if, __if);
+	unsigned int *fmbm_rebm;
+	int val;
+	int fmbm_mask = FMAN_SP_SG_DISABLE;
+
+	if (enable)
+		val = 0;
+	else
+		val = FMAN_SP_SG_DISABLE;
+
+	assert(fman_ccsr_map_fd != -1);
+
+	fmbm_rebm = &((struct rx_bmi_regs *)__if->bmi_map)->fmbm_rebm;
+
+	out_be32(fmbm_rebm, (in_be32(fmbm_rebm) & ~fmbm_mask) | val);
+}
+
 void
 fman_if_set_dnia(struct fman_if *fm_if, uint32_t nia)
 {
diff --git a/drivers/bus/dpaa/include/fsl_fman.h b/drivers/bus/dpaa/include/fsl_fman.h
index c0ef1bf..1d1ce86 100644
--- a/drivers/bus/dpaa/include/fsl_fman.h
+++ b/drivers/bus/dpaa/include/fsl_fman.h
@@ -108,6 +108,12 @@  int fman_if_get_fdoff(struct fman_if *fm_if);
 /* Set interface fd->offset value */
 void fman_if_set_fdoff(struct fman_if *fm_if, uint32_t fd_offset);
 
+/* Get interface SG enable status value */
+int fman_if_get_sg_enable(struct fman_if *fm_if);
+
+/* Set interface SG support mode */
+void fman_if_set_sg(struct fman_if *fm_if, int enable);
+
 /* Get interface Max Frame length (MTU) */
 uint16_t fman_if_get_maxfrm(struct fman_if *fm_if);
 
diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map
index e00c911..fcfbb47 100644
--- a/drivers/bus/dpaa/rte_bus_dpaa_version.map
+++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map
@@ -70,6 +70,8 @@  DPDK_18.02 {
 
 	dpaa_logtype_eventdev;
 	dpaa_svr_family;
+	fman_if_get_sg_enable;
+	fman_if_set_sg;
 	per_lcore_dpaa_io;
 	per_lcore_held_bufs;
 	qm_channel_pool1;