From: "Wu, Jingjing" <jingjing.wu@intel.com>
To: "Xing, Beilei" <beilei.xing@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [PATCH] i40e: configure MTU
Date: Tue, 26 Apr 2016 10:00:03 +0800 [thread overview]
Message-ID: <571ECBA3.6010409@intel.com> (raw)
In-Reply-To: <1461410769-16942-1-git-send-email-beilei.xing@intel.com>
On 4/23/2016 7:26 PM, Xing, Beilei wrote:
> 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>
> ---
> drivers/net/i40e/i40e_ethdev.c | 49 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 49 insertions(+)
>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index bc28d3c..29259b9 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -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 */
> @@ -9104,3 +9107,49 @@ 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)
According to the coding style, at function definition, "The function
type should be on a line by itself preceding the function."
> +{
> + struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
> + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> + struct rte_eth_dev_data *dev_data = pf->dev_data;
> + struct rte_eth_dev_info dev_info;
> + struct i40e_rx_queue *rxq;
> + int i;
> + uint16_t len;
> + uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
> + int ret = 0;
> +
> + i40e_dev_info_get(dev, &dev_info);
> +
> + /* check if mtu is within the allowed range */
> + if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen))
> + return -EINVAL;
> +
The dev_info.max_rx_pktlen queried by i40e_dev_info_get is
"I40E_FRAME_SIZE_MAX".
No need to call the API to get dev info in driver.
next prev parent reply other threads:[~2016-04-26 2:00 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-23 11:26 [PATCH] i40e: configure MTU Beilei Xing
2016-04-26 2:00 ` Wu, Jingjing [this message]
2016-04-27 11:43 ` Julien Meunier
2016-04-27 15:01 ` Xing, Beilei
2016-04-28 3:19 ` [PATCH V2] " Beilei Xing
2016-05-13 8:15 ` [PATCH v3] " Beilei Xing
2016-05-16 12:27 ` Olivier Matz
2016-06-16 17:40 ` Yong Wang
2016-06-16 17:51 ` Yong Wang
2016-06-17 0:03 ` Ananyev, Konstantin
2016-06-20 4:49 ` Xing, Beilei
2016-06-20 4:59 ` Xing, Beilei
2016-06-20 8:05 ` Ananyev, Konstantin
2016-06-20 12:04 ` Xing, Beilei
2016-06-20 12:15 ` Ananyev, Konstantin
2016-06-20 12:46 ` Xing, Beilei
2016-05-20 15:17 ` [PATCH v4] " Beilei Xing
2016-05-23 1:33 ` Wu, Jingjing
2016-06-09 14:23 ` Bruce Richardson
2016-06-23 10:13 ` Bruce Richardson
2016-06-23 13:37 ` Xing, Beilei
2016-06-23 13:44 ` Bruce Richardson
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=571ECBA3.6010409@intel.com \
--to=jingjing.wu@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
/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.