[dpdk-dev,v3,26/40] net/dpaa: add support for MTU update

Message ID 20170823141213.25476-27-shreyansh.jain@nxp.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Shreyansh Jain Aug. 23, 2017, 2:11 p.m. UTC
  Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 doc/guides/nics/features/dpaa.ini |  1 +
 drivers/net/dpaa/dpaa_ethdev.c    | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
  

Comments

Thomas Monjalon Sept. 21, 2017, 10:07 p.m. UTC | #1
23/08/2017 16:11, Shreyansh Jain:
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
>  doc/guides/nics/features/dpaa.ini |  1 +
>  drivers/net/dpaa/dpaa_ethdev.c    | 21 +++++++++++++++++++++

It is very good to update features matrix and code in the same patch.
History tracking will be easy, thanks.

About the title, every patches start with "add support for".
It is wasting 7 characters :) You could just say "support".
Example:
	net/dpaa: support MTU update
  
Shreyansh Jain Sept. 22, 2017, 6:48 a.m. UTC | #2
On Friday 22 September 2017 03:37 AM, Thomas Monjalon wrote:
> 23/08/2017 16:11, Shreyansh Jain:
>> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
>> ---
>>   doc/guides/nics/features/dpaa.ini |  1 +
>>   drivers/net/dpaa/dpaa_ethdev.c    | 21 +++++++++++++++++++++
> 
> It is very good to update features matrix and code in the same patch.
> History tracking will be easy, thanks.
> 
> About the title, every patches start with "add support for".
> It is wasting 7 characters :) You could just say "support".
> Example:
> 	net/dpaa: support MTU update
> 

Ok. I will do that.
  

Patch

diff --git a/doc/guides/nics/features/dpaa.ini b/doc/guides/nics/features/dpaa.ini
index 9e8befc..59ef23d 100644
--- a/doc/guides/nics/features/dpaa.ini
+++ b/doc/guides/nics/features/dpaa.ini
@@ -4,5 +4,6 @@ 
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+MTU update           = Y
 ARMv8                = Y
 Usage doc            = Y
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index ab19b2e..ad3eaac 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -76,6 +76,26 @@ 
 static int is_global_init;
 
 static int
+dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (mtu < ETHER_MIN_MTU)
+		return -EINVAL;
+	if (mtu > ETHER_MAX_LEN)
+		return -1;
+
+	dev->data->dev_conf.rxmode.jumbo_frame = 0;
+	dev->data->dev_conf.rxmode.max_rx_pkt_len = mtu;
+
+	fman_if_set_maxfrm(dpaa_intf->fif, mtu);
+
+	return 0;
+}
+
+static int
 dpaa_eth_dev_configure(struct rte_eth_dev *dev __rte_unused)
 {
 	PMD_INIT_FUNC_TRACE();
@@ -197,6 +217,7 @@  static struct eth_dev_ops dpaa_devops = {
 	.tx_queue_setup		  = dpaa_eth_tx_queue_setup,
 	.rx_queue_release	  = dpaa_eth_rx_queue_release,
 	.tx_queue_release	  = dpaa_eth_tx_queue_release,
+	.mtu_set		  = dpaa_mtu_set,
 };
 
 /* Initialise an Rx FQ */