[7/7] net/dpaa2: add support to configure dpdmux max Rx frame len

Message ID 20210120142723.14090-8-hemant.agrawal@nxp.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series NXP DPAAx ethernet PMD changes |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing fail Testing issues

Commit Message

Hemant Agrawal Jan. 20, 2021, 2:27 p.m. UTC
  This patch introduce a new pmd api, which can help the applications
to configure the max framelen for a given dpdmux interface

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/net/dpaa2/dpaa2_mux.c     | 28 +++++++++++++++++++++++++++-
 drivers/net/dpaa2/rte_pmd_dpaa2.h | 18 +++++++++++++++++-
 drivers/net/dpaa2/version.map     |  1 +
 3 files changed, 45 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit Feb. 2, 2021, 11:38 a.m. UTC | #1
On 1/20/2021 2:27 PM, Hemant Agrawal wrote:
> This patch introduce a new pmd api, which can help the applications
> to configure the max framelen for a given dpdmux interface
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

<...>

> +/**
> + * @warning
> + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
> + *
> + * demultiplex interface max rx frame length configure
> + *
> + * @param dpdmux_id
> + *    ID of the DPDMUX MC object.
> + * @param max_rx_frame_len
> + *    maximum receive frame length (will be checked to be minimux of all dpnis)
> + *
> + */
> +__rte_experimental
> +int
> +rte_pmd_dpaa2_mux_rx_frame_len(uint32_t dpdmux_id, uint16_t max_rx_frame_len);
> +

PMD specific APIs are not good for portability, and I think better to reduce 
them as much as possible.

Can't this new parameter provided as devarg, instead of a new PMD API?
  
Hemant Agrawal Feb. 4, 2021, 10:46 a.m. UTC | #2
HI Ferruh,

On 2/2/2021 5:08 PM, Ferruh Yigit wrote:
> On 1/20/2021 2:27 PM, Hemant Agrawal wrote:
>> This patch introduce a new pmd api, which can help the applications
>> to configure the max framelen for a given dpdmux interface
>>
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>
> <...>
>
>> +/**
>> + * @warning
>> + * @b EXPERIMENTAL: this API may change, or be removed, without 
>> prior notice
>> + *
>> + * demultiplex interface max rx frame length configure
>> + *
>> + * @param dpdmux_id
>> + *    ID of the DPDMUX MC object.
>> + * @param max_rx_frame_len
>> + *    maximum receive frame length (will be checked to be minimux of 
>> all dpnis)
>> + *
>> + */
>> +__rte_experimental
>> +int
>> +rte_pmd_dpaa2_mux_rx_frame_len(uint32_t dpdmux_id, uint16_t 
>> max_rx_frame_len);
>> +
>
> PMD specific APIs are not good for portability, and I think better to 
> reduce them as much as possible.
>
> Can't this new parameter provided as devarg, instead of a new PMD API?

Applications controls it w.r.t jumbo buffers for the dpdmux attached 
interfaces. So, devargs will not work in this case.
  

Patch

diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c
index f8366e839e..b397d333d6 100644
--- a/drivers/net/dpaa2/dpaa2_mux.c
+++ b/drivers/net/dpaa2/dpaa2_mux.c
@@ -1,5 +1,5 @@ 
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2020 NXP
+ * Copyright 2018-2021 NXP
  */
 
 #include <sys/queue.h>
@@ -205,6 +205,32 @@  rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id,
 	return NULL;
 }
 
+int
+rte_pmd_dpaa2_mux_rx_frame_len(uint32_t dpdmux_id, uint16_t max_rx_frame_len)
+{
+	struct dpaa2_dpdmux_dev *dpdmux_dev;
+	int ret;
+
+	/* Find the DPDMUX from dpdmux_id in our list */
+	dpdmux_dev = get_dpdmux_from_id(dpdmux_id);
+	if (!dpdmux_dev) {
+		DPAA2_PMD_ERR("Invalid dpdmux_id: %d", dpdmux_id);
+		return -1;
+	}
+
+	ret = dpdmux_set_max_frame_length(&dpdmux_dev->dpdmux,
+			CMD_PRI_LOW, dpdmux_dev->token, max_rx_frame_len);
+	if (ret) {
+		DPAA2_PMD_ERR("DPDMUX:Unable to set mtu. check config %d", ret);
+		return ret;
+	}
+
+	DPAA2_PMD_INFO("dpdmux mtu set as %u",
+			DPAA2_MAX_RX_PKT_LEN - RTE_ETHER_CRC_LEN);
+
+	return ret;
+}
+
 static int
 dpaa2_create_dpdmux_device(int vdev_fd __rte_unused,
 			   struct vfio_device_info *obj_info __rte_unused,
diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2.h b/drivers/net/dpaa2/rte_pmd_dpaa2.h
index ec8df75af9..7204a8f951 100644
--- a/drivers/net/dpaa2/rte_pmd_dpaa2.h
+++ b/drivers/net/dpaa2/rte_pmd_dpaa2.h
@@ -1,5 +1,5 @@ 
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018-2020 NXP
+ * Copyright 2018-2021 NXP
  */
 
 #ifndef _RTE_PMD_DPAA2_H
@@ -40,6 +40,22 @@  rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id,
 			      struct rte_flow_item *pattern[],
 			      struct rte_flow_action *actions[]);
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * demultiplex interface max rx frame length configure
+ *
+ * @param dpdmux_id
+ *    ID of the DPDMUX MC object.
+ * @param max_rx_frame_len
+ *    maximum receive frame length (will be checked to be minimux of all dpnis)
+ *
+ */
+__rte_experimental
+int
+rte_pmd_dpaa2_mux_rx_frame_len(uint32_t dpdmux_id, uint16_t max_rx_frame_len);
+
 /**
  * @warning
  * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
diff --git a/drivers/net/dpaa2/version.map b/drivers/net/dpaa2/version.map
index 72d1b2b1c8..3c087c2423 100644
--- a/drivers/net/dpaa2/version.map
+++ b/drivers/net/dpaa2/version.map
@@ -2,6 +2,7 @@  EXPERIMENTAL {
 	global:
 
 	rte_pmd_dpaa2_mux_flow_create;
+	rte_pmd_dpaa2_mux_rx_frame_len;
 	rte_pmd_dpaa2_set_custom_hash;
 };