[dpdk-dev,v4] i40e: configure MTU
Commit Message
This patch enables configuring MTU for i40e.
Since changing MTU needs to reconfigure queue, stop port first
before configuring MTU.
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
v4 changes:
Revert v2 change, if the port is running, return -EBUSY.
doc/guides/rel_notes/release_16_07.rst | 3 +++
drivers/net/i40e/i40e_ethdev.c | 34 ++++++++++++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.h | 1 +
3 files changed, 38 insertions(+)
Comments
> -----Original Message-----
> From: Xing, Beilei
> Sent: Friday, May 20, 2016 11:17 PM
> To: Wu, Jingjing
> Cc: dev@dpdk.org; Xing, Beilei
> Subject: [PATCH v4] i40e: configure MTU
>
> This patch enables configuring MTU for i40e.
> Since changing MTU needs to reconfigure queue, stop port first before
> configuring MTU.
>
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
On Mon, May 23, 2016 at 01:33:42AM +0000, Wu, Jingjing wrote:
>
>
> > -----Original Message-----
> > From: Xing, Beilei
> > Sent: Friday, May 20, 2016 11:17 PM
> > To: Wu, Jingjing
> > Cc: dev@dpdk.org; Xing, Beilei
> > Subject: [PATCH v4] i40e: configure MTU
> >
> > This patch enables configuring MTU for i40e.
> > Since changing MTU needs to reconfigure queue, stop port first before
> > configuring MTU.
> >
> > Signed-off-by: Beilei Xing <beilei.xing@intel.com>
>
> Acked-by: Jingjing Wu <jingjing.wu@intel.com>
>
Applied to dpdk-next-net/rel_16_07
/Bruce
On Thu, Jun 09, 2016 at 03:23:43PM +0100, Bruce Richardson wrote:
> On Mon, May 23, 2016 at 01:33:42AM +0000, Wu, Jingjing wrote:
> >
> >
> > > -----Original Message-----
> > > From: Xing, Beilei
> > > Sent: Friday, May 20, 2016 11:17 PM
> > > To: Wu, Jingjing
> > > Cc: dev@dpdk.org; Xing, Beilei
> > > Subject: [PATCH v4] i40e: configure MTU
> > >
> > > This patch enables configuring MTU for i40e.
> > > Since changing MTU needs to reconfigure queue, stop port first before
> > > configuring MTU.
> > >
> > > Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> >
> > Acked-by: Jingjing Wu <jingjing.wu@intel.com>
> >
> Applied to dpdk-next-net/rel_16_07
>
> /Bruce
It has been brought to my attention that there were still outstanding comments
and issues with v3 of the patch that were never resolved, therefore this patch
may need to be reverted, as I should not have applied it
Maintainers, please do not ack patches for your components if there are still
unresolved discussion on them! Once the component maintainer acks a patch I
should not have to go back through the whole patch history to determine if it
can be applied or not.
Regards,
/Bruce
Hi Bruce,
> -----Original Message-----
> From: Richardson, Bruce
> Sent: Thursday, June 23, 2016 6:14 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: Xing, Beilei <beilei.xing@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4] i40e: configure MTU
>
> On Thu, Jun 09, 2016 at 03:23:43PM +0100, Bruce Richardson wrote:
> > On Mon, May 23, 2016 at 01:33:42AM +0000, Wu, Jingjing wrote:
> > >
> > >
> > > > -----Original Message-----
> > > > From: Xing, Beilei
> > > > Sent: Friday, May 20, 2016 11:17 PM
> > > > To: Wu, Jingjing
> > > > Cc: dev@dpdk.org; Xing, Beilei
> > > > Subject: [PATCH v4] i40e: configure MTU
> > > >
> > > > This patch enables configuring MTU for i40e.
> > > > Since changing MTU needs to reconfigure queue, stop port first
> > > > before configuring MTU.
> > > >
> > > > Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> > >
> > > Acked-by: Jingjing Wu <jingjing.wu@intel.com>
> > >
> > Applied to dpdk-next-net/rel_16_07
> >
> > /Bruce
>
> It has been brought to my attention that there were still outstanding comments
> and issues with v3 of the patch that were never resolved, therefore this patch
> may need to be reverted, as I should not have applied it
>
> Maintainers, please do not ack patches for your components if there are still
> unresolved discussion on them! Once the component maintainer acks a patch I
> should not have to go back through the whole patch history to determine if it can
> be applied or not.
>
Sorry for inconvenience. But here's one correction, this v4 patch is acked and applied on May 23, but v3 comments are added June 17, I think Jingjing always is a responsible maintainer :)
> Regards,
> /Bruce
On Thu, Jun 23, 2016 at 02:37:42PM +0100, Xing, Beilei wrote:
> Hi Bruce,
>
> > -----Original Message-----
> > From: Richardson, Bruce
> > Sent: Thursday, June 23, 2016 6:14 PM
> > To: Wu, Jingjing <jingjing.wu@intel.com>
> > Cc: Xing, Beilei <beilei.xing@intel.com>; dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v4] i40e: configure MTU
> >
> > On Thu, Jun 09, 2016 at 03:23:43PM +0100, Bruce Richardson wrote:
> > > On Mon, May 23, 2016 at 01:33:42AM +0000, Wu, Jingjing wrote:
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Xing, Beilei
> > > > > Sent: Friday, May 20, 2016 11:17 PM
> > > > > To: Wu, Jingjing
> > > > > Cc: dev@dpdk.org; Xing, Beilei
> > > > > Subject: [PATCH v4] i40e: configure MTU
> > > > >
> > > > > This patch enables configuring MTU for i40e.
> > > > > Since changing MTU needs to reconfigure queue, stop port first
> > > > > before configuring MTU.
> > > > >
> > > > > Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> > > >
> > > > Acked-by: Jingjing Wu <jingjing.wu@intel.com>
> > > >
> > > Applied to dpdk-next-net/rel_16_07
> > >
> > > /Bruce
> >
> > It has been brought to my attention that there were still outstanding comments
> > and issues with v3 of the patch that were never resolved, therefore this patch
> > may need to be reverted, as I should not have applied it
> >
> > Maintainers, please do not ack patches for your components if there are still
> > unresolved discussion on them! Once the component maintainer acks a patch I
> > should not have to go back through the whole patch history to determine if it can
> > be applied or not.
> >
>
> Sorry for inconvenience. But here's one correction, this v4 patch is acked and applied on May 23, but v3 comments are added June 17, I think Jingjing always is a responsible maintainer :)
>
You are indeed quite right. My apologies to Jingjing, I didn't notice the dates
on the emails, and she was fully within her rights to ack the patch as she did.
Thanks for pointing this out Beilei.
My bad, and apologies again.
Regards,
/Bruce
@@ -116,6 +116,9 @@ API Changes
ibadcrc, ibadlen, imcasts, fdirmatch, fdirmiss,
tx_pause_xon, rx_pause_xon, tx_pause_xoff, rx_pause_xoff.
+* The function ``rte_eth_dev_set_mtu`` adds a new return value ``-EBUSY``, which
+ indicates the operation is forbidden because the port is running.
+
ABI Changes
-----------
@@ -447,6 +447,8 @@ static int i40e_get_eeprom(struct rte_eth_dev *dev,
static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
struct ether_addr *mac_addr);
+static int i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
+
static const struct rte_pci_id pci_id_i40e_map[] = {
#define RTE_PCI_DEV_ID_DECL_I40E(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
#include "rte_pci_dev_ids.h"
@@ -520,6 +522,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
.get_eeprom_length = i40e_get_eeprom_length,
.get_eeprom = i40e_get_eeprom,
.mac_addr_set = i40e_set_default_mac_addr,
+ .mtu_set = i40e_dev_mtu_set,
};
/* store statistics names and its offset in stats structure */
@@ -9108,3 +9111,34 @@ static void i40e_set_default_mac_addr(struct rte_eth_dev *dev,
/* Flags: 0x3 updates port address */
i40e_aq_mac_address_write(hw, 0x3, mac_addr->addr_bytes, NULL);
}
+
+static int
+i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+ struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+ struct rte_eth_dev_data *dev_data = pf->dev_data;
+ uint32_t frame_size = mtu + ETHER_HDR_LEN
+ + ETHER_CRC_LEN + I40E_VLAN_TAG_SIZE;
+ int ret = 0;
+
+ /* check if mtu is within the allowed range */
+ if ((mtu < ETHER_MIN_MTU) || (frame_size > I40E_FRAME_SIZE_MAX))
+ return -EINVAL;
+
+ /* mtu setting is forbidden if port is start */
+ if (dev_data->dev_started) {
+ PMD_DRV_LOG(ERR,
+ "port %d must be stopped before configuration\n",
+ dev_data->port_id);
+ return -EBUSY;
+ }
+
+ if (frame_size > ETHER_MAX_LEN)
+ dev_data->dev_conf.rxmode.jumbo_frame = 1;
+ else
+ dev_data->dev_conf.rxmode.jumbo_frame = 0;
+
+ dev_data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
+
+ return ret;
+}
@@ -2398,6 +2398,7 @@ int rte_eth_dev_get_mtu(uint8_t port_id, uint16_t *mtu);
* - (-ENOTSUP) if operation is not supported.
* - (-ENODEV) if *port_id* invalid.
* - (-EINVAL) if *mtu* invalid.
+ * - (-EBUSY) if operation is not allowed when the port is running
*/
int rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu);