ixgbevf: allow to set MTU

The support of jumbo frames in the ixgbevf Poll Mode Driver of 10GbE
82599 VF functions consists in the following enhancements:

- Implement the mtu_set function in the ixgbevf PMD, using the IXGBE_VF_SET_LPE
  request of the version 1.0 of the VF/PF mailbox API for this purpose.

- Add a detailed explanation on the VF/PF rx max frame len negotiation.

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
This commit is contained in:
Ivan Boule 2014-06-17 20:09:31 +02:00 committed by Thomas Monjalon
parent 59d0ecdbf0
commit 12cd0cccc3
2 changed files with 51 additions and 1 deletions

View File

@ -220,6 +220,8 @@ static int ixgbe_remove_5tuple_filter(struct rte_eth_dev *dev,
static int ixgbe_get_5tuple_filter(struct rte_eth_dev *dev, uint16_t index, static int ixgbe_get_5tuple_filter(struct rte_eth_dev *dev, uint16_t index,
struct rte_5tuple_filter *filter, uint16_t *rx_queue); struct rte_5tuple_filter *filter, uint16_t *rx_queue);
static int ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu);
/* /*
* Define VF Stats MACRO for Non "cleared on read" register * Define VF Stats MACRO for Non "cleared on read" register
*/ */
@ -376,6 +378,7 @@ static struct eth_dev_ops ixgbevf_eth_dev_ops = {
.stats_reset = ixgbevf_dev_stats_reset, .stats_reset = ixgbevf_dev_stats_reset,
.dev_close = ixgbevf_dev_close, .dev_close = ixgbevf_dev_close,
.dev_infos_get = ixgbe_dev_info_get, .dev_infos_get = ixgbe_dev_info_get,
.mtu_set = ixgbevf_dev_set_mtu,
.vlan_filter_set = ixgbevf_vlan_filter_set, .vlan_filter_set = ixgbevf_vlan_filter_set,
.vlan_strip_queue_set = ixgbevf_vlan_strip_queue_set, .vlan_strip_queue_set = ixgbevf_vlan_strip_queue_set,
.vlan_offload_set = ixgbevf_vlan_offload_set, .vlan_offload_set = ixgbevf_vlan_offload_set,
@ -3937,6 +3940,40 @@ ixgbe_get_5tuple_filter(struct rte_eth_dev *dev, uint16_t index,
return -ENOENT; return -ENOENT;
} }
static int
ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
{
struct ixgbe_hw *hw;
uint32_t max_frame = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
if ((mtu < ETHER_MIN_MTU) || (max_frame > ETHER_MAX_JUMBO_FRAME_LEN))
return -EINVAL;
/* refuse mtu that requires the support of scattered packets when this
* feature has not been enabled before. */
if (!dev->data->scattered_rx &&
(max_frame + 2 * IXGBE_VLAN_TAG_SIZE >
dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM))
return -EINVAL;
/*
* When supported by the underlying PF driver, use the IXGBE_VF_SET_MTU
* request of the version 2.0 of the mailbox API.
* For now, use the IXGBE_VF_SET_LPE request of the version 1.0
* of the mailbox API.
* This call to IXGBE_SET_LPE action won't work with ixgbe pf drivers
* prior to 3.11.33 which contains the following change:
* "ixgbe: Enable jumbo frames support w/ SR-IOV"
*/
ixgbevf_rlpml_set_vf(hw, max_frame);
/* update max frame size */
dev->data->dev_conf.rxmode.max_rx_pkt_len = max_frame;
return 0;
}
static struct rte_driver rte_ixgbe_driver = { static struct rte_driver rte_ixgbe_driver = {
.type = PMD_PDEV, .type = PMD_PDEV,
.init = rte_ixgbe_pmd_init, .init = rte_ixgbe_pmd_init,

View File

@ -3883,7 +3883,20 @@ ixgbevf_dev_rx_init(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE(); PMD_INIT_FUNC_TRACE();
hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
/* setup MTU */ /*
* When the VF driver issues a IXGBE_VF_RESET request, the PF driver
* disables the VF receipt of packets if the PF MTU is > 1500.
* This is done to deal with 82599 limitations that imposes
* the PF and all VFs to share the same MTU.
* Then, the PF driver enables again the VF receipt of packet when
* the VF driver issues a IXGBE_VF_SET_LPE request.
* In the meantime, the VF device cannot be used, even if the VF driver
* and the Guest VM network stack are ready to accept packets with a
* size up to the PF MTU.
* As a work-around to this PF behaviour, force the call to
* ixgbevf_rlpml_set_vf even if jumbo frames are not used. This way,
* VF packets received can work in all cases.
*/
ixgbevf_rlpml_set_vf(hw, ixgbevf_rlpml_set_vf(hw,
(uint16_t)dev->data->dev_conf.rxmode.max_rx_pkt_len); (uint16_t)dev->data->dev_conf.rxmode.max_rx_pkt_len);