DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] i40evf: add set maximum frame size support
@ 2016-11-25 20:47 Michael Bieniek
  2016-11-27  9:10 ` Wu, Jingjing
  2016-11-29 16:24 ` Ferruh Yigit
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Bieniek @ 2016-11-25 20:47 UTC (permalink / raw)
  To: helin.zhang, jingjing.wu; +Cc: dev, Michael Bieniek

This adds the ability to set maximum frame size for an i40e virtual
interface. This patch is based on the i40e physical function maximum
frame size implementation. This was tested on an system configured with
multiple i40e virtual functions. Verified that the MTU was configurable
and that sending packets greater than the configured MTU resulted in a
drop.

Signed-off-by: Michael Bieniek <michaelbieniekdpdk@gmail.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index aa306d6..8477c98 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -158,6 +158,7 @@ i40evf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
 static void i40evf_handle_pf_event(__rte_unused struct rte_eth_dev *dev,
 				   uint8_t *msg,
 				   uint16_t msglen);
+static int i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t);
 
 /* Default hash key buffer for RSS */
 static uint32_t rss_key_default[I40E_VFQF_HKEY_MAX_INDEX + 1];
@@ -225,6 +226,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = {
 	.reta_query           = i40evf_dev_rss_reta_query,
 	.rss_hash_update      = i40evf_dev_rss_hash_update,
 	.rss_hash_conf_get    = i40evf_dev_rss_hash_conf_get,
+	.mtu_set              = i40evf_dev_mtu_set,
 };
 
 /*
@@ -2635,3 +2637,34 @@ i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 
 	return 0;
 }
+
+static int
+i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct rte_eth_dev_data *dev_data = 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 started */
+	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;
+}
-- 
2.4.11

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] i40evf: add set maximum frame size support
  2016-11-25 20:47 [dpdk-dev] [PATCH] i40evf: add set maximum frame size support Michael Bieniek
@ 2016-11-27  9:10 ` Wu, Jingjing
  2016-11-29 16:24 ` Ferruh Yigit
  1 sibling, 0 replies; 3+ messages in thread
From: Wu, Jingjing @ 2016-11-27  9:10 UTC (permalink / raw)
  To: Michael Bieniek, Zhang, Helin; +Cc: dev



-----Original Message-----
From: Michael Bieniek [mailto:michaelbieniekdpdk@gmail.com] 
Sent: Saturday, November 26, 2016 4:48 AM
To: Zhang, Helin <helin.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>
Cc: dev@dpdk.org; Michael Bieniek <michaelbieniekdpdk@gmail.com>
Subject: [PATCH] i40evf: add set maximum frame size support

This adds the ability to set maximum frame size for an i40e virtual interface. This patch is based on the i40e physical function maximum frame size implementation. This was tested on an system configured with multiple i40e virtual functions. Verified that the MTU was configurable and that sending packets greater than the configured MTU resulted in a drop.

Signed-off-by: Michael Bieniek <michaelbieniekdpdk@gmail.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] i40evf: add set maximum frame size support
  2016-11-25 20:47 [dpdk-dev] [PATCH] i40evf: add set maximum frame size support Michael Bieniek
  2016-11-27  9:10 ` Wu, Jingjing
@ 2016-11-29 16:24 ` Ferruh Yigit
  1 sibling, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2016-11-29 16:24 UTC (permalink / raw)
  To: Michael Bieniek, helin.zhang, jingjing.wu; +Cc: dev

On 11/25/2016 8:47 PM, Michael Bieniek wrote:
> This adds the ability to set maximum frame size for an i40e virtual
> interface. This patch is based on the i40e physical function maximum
> frame size implementation. This was tested on an system configured with
> multiple i40e virtual functions. Verified that the MTU was configurable
> and that sending packets greater than the configured MTU resulted in a
> drop.
> 
> Signed-off-by: Michael Bieniek <michaelbieniekdpdk@gmail.com>

Hi Michael,

I guess this is the first patch, welcome to the DPDK community.

> ---
>  drivers/net/i40e/i40e_ethdev_vf.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
> index aa306d6..8477c98 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -158,6 +158,7 @@ i40evf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
>  static void i40evf_handle_pf_event(__rte_unused struct rte_eth_dev *dev,
>  				   uint8_t *msg,
>  				   uint16_t msglen);
> +static int i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t);

This is not something functional but, in declaration, if you used
parameter name for first argument, let's use parameter name for second too.

>  
>  /* Default hash key buffer for RSS */
>  static uint32_t rss_key_default[I40E_VFQF_HKEY_MAX_INDEX + 1];
> @@ -225,6 +226,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = {
>  	.reta_query           = i40evf_dev_rss_reta_query,
>  	.rss_hash_update      = i40evf_dev_rss_hash_update,
>  	.rss_hash_conf_get    = i40evf_dev_rss_hash_conf_get,
> +	.mtu_set              = i40evf_dev_mtu_set,
>  };
>  
>  /*
> @@ -2635,3 +2637,34 @@ i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
>  
>  	return 0;
>  }
> +
> +static int
> +i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
> +{
> +	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);

hw is not used, and causing a build error.

> +	struct rte_eth_dev_data *dev_data = 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 started */
> +	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;
> +}
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-29 16:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-25 20:47 [dpdk-dev] [PATCH] i40evf: add set maximum frame size support Michael Bieniek
2016-11-27  9:10 ` Wu, Jingjing
2016-11-29 16:24 ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).