All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Meunier <julien.meunier@6wind.com>
To: "Zhang, Helin" <helin.zhang@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: i40e: cannot change mtu to enable jumbo frame
Date: Fri, 12 Feb 2016 15:08:09 +0100	[thread overview]
Message-ID: <56BDE749.1000409@6wind.com> (raw)
In-Reply-To: <F35DEAC7BCE34641BA9FAC6BCA4A12E70A997682@SHSMSX104.ccr.corp.intel.com>

On 02/10/2016 04:20 PM, Zhang, Helin wrote:
>
>
>> -----Original Message-----
>> From: Julien Meunier [mailto:julien.meunier@6wind.com]
>> Sent: Wednesday, February 10, 2016 12:36 AM
>> To: Zhang, Helin <helin.zhang@intel.com>; dev@dpdk.org
>> Subject: i40e: cannot change mtu to enable jumbo frame
>> [...]
>> Does a mtu_set function will be developed soon in order to support jumbo
>> frame ?
> Yes, we will implement soon later.
> Could you help to try with max_pkt_len in port config for now?
>
> Regards,
> Helin
>

Hi,

When I stop ports, change max_pkt_len and restart ports, jumbo frame are 
accepted. I was able to forward 9k frames on a i40e card.

I wrote a quick and dirty patch in order to add minimal support of MTU 
for my test. I did not carefully study the impacts... Please advice.

---
i40e: add support of mtu configuration

Add support of MTU configuration.
Ports are stopped and then started in order to force
re-initialization of RX queues.

NOTE: This patch is still experimental.

Signed-off-by: Julien Meunier <julien.meunier@6wind.com>
---
  drivers/net/i40e/i40e_ethdev.c | 33 +++++++++++++++++++++++++++++++++
  1 file changed, 33 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 750206b..b4d6912 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -296,6 +296,7 @@ static int i40e_dev_queue_stats_mapping_set(struct 
rte_eth_dev *dev,
  					    uint8_t is_rx);
  static void i40e_dev_info_get(struct rte_eth_dev *dev,
  			      struct rte_eth_dev_info *dev_info);
+static int i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
  static int i40e_vlan_filter_set(struct rte_eth_dev *dev,
  				uint16_t vlan_id,
  				int on);
@@ -439,6 +440,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
  	.xstats_reset                 = i40e_dev_stats_reset,
  	.queue_stats_mapping_set      = i40e_dev_queue_stats_mapping_set,
  	.dev_infos_get                = i40e_dev_info_get,
+	.mtu_set                      = i40e_dev_mtu_set,
  	.vlan_filter_set              = i40e_vlan_filter_set,
  	.vlan_tpid_set                = i40e_vlan_tpid_set,
  	.vlan_offload_set             = i40e_vlan_offload_set,
@@ -4681,6 +4683,37 @@ i40e_dev_rxtx_init(struct i40e_pf *pf)
  }

  static int
+i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+	struct rte_eth_dev_info dev_info;
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+
+	i40e_dev_info_get(dev, &dev_info);
+
+	if ((frame_size < ETHER_MIN_MTU) || (frame_size > 
dev_info.max_rx_pktlen)) {
+		PMD_DRV_LOG(ERR, "Invalid MTU\n");
+		return I40E_ERR_PARAM;
+	}
+
+	i40e_dev_stop(dev);
+	hw->adapter_stopped = 1;
+
+	/* switch to jumbo mode if needed */
+	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;
+
+	i40e_dev_start(dev);
+	hw->adapter_stopped = 0;
+
+	return 0;
+}
+
+static int
  i40e_vmdq_setup(struct rte_eth_dev *dev)
  {
  	struct rte_eth_conf *conf = &dev->data->dev_conf;
-- 

Regards,
-- 
Julien MEUNIER
6WIND

      reply	other threads:[~2016-02-12 14:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-09 16:35 i40e: cannot change mtu to enable jumbo frame Julien Meunier
2016-02-09 19:05 ` Zhu, Heqing
2016-02-10 10:53   ` Julien Meunier
2016-02-10 13:54     ` Ananyev, Konstantin
2016-02-10 15:20 ` Zhang, Helin
2016-02-12 14:08   ` Julien Meunier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56BDE749.1000409@6wind.com \
    --to=julien.meunier@6wind.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.