}
static int
-ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *msgbuf)
+ixgbe_set_vf_lpe(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
{
struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- uint32_t new_mtu = msgbuf[1];
+ uint32_t max_frame = msgbuf[1];
uint32_t max_frs;
uint32_t hlreg0;
- int max_frame = new_mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
/* X540 and X550 support jumbo frames in IOV mode */
if (hw->mac.type != ixgbe_mac_X540 &&
hw->mac.type != ixgbe_mac_X550 &&
hw->mac.type != ixgbe_mac_X550EM_x &&
- hw->mac.type != ixgbe_mac_X550EM_a)
- return -1;
+ hw->mac.type != ixgbe_mac_X550EM_a) {
+ struct ixgbe_vf_info *vfinfo =
+ *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
+
+ switch (vfinfo[vf].api_version) {
+ case ixgbe_mbox_api_11:
+ case ixgbe_mbox_api_12:
+ case ixgbe_mbox_api_13:
+ /**
+ * Version 1.1&1.2&1.3 supports jumbo frames on VFs
+ * if PF has jumbo frames enabled which means legacy
+ * VFs are disabled.
+ */
+ if (dev->data->dev_conf.rxmode.max_rx_pkt_len >
+ IXGBE_ETH_MAX_LEN)
+ break;
+ /* fall through */
+ default:
+ /**
+ * If the PF or VF are running w/ jumbo frames enabled,
+ * we return -1 as we cannot support jumbo frames on
+ * legacy VFs.
+ */
+ if (max_frame > IXGBE_ETH_MAX_LEN ||
+ dev->data->dev_conf.rxmode.max_rx_pkt_len >
+ IXGBE_ETH_MAX_LEN)
+ return -1;
+ break;
+ }
+ }
if (max_frame < RTE_ETHER_MIN_LEN ||
max_frame > RTE_ETHER_MAX_JUMBO_FRAME_LEN)
max_frs = (IXGBE_READ_REG(hw, IXGBE_MAXFRS) &
IXGBE_MHADD_MFS_MASK) >> IXGBE_MHADD_MFS_SHIFT;
- if (max_frs < new_mtu) {
+ if (max_frs < max_frame) {
hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
- if (new_mtu > IXGBE_ETH_MAX_LEN) {
+ if (max_frame > IXGBE_ETH_MAX_LEN) {
dev->data->dev_conf.rxmode.offloads |=
DEV_RX_OFFLOAD_JUMBO_FRAME;
hlreg0 |= IXGBE_HLREG0_JUMBOEN;
}
IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0);
- max_frs = new_mtu << IXGBE_MHADD_MFS_SHIFT;
+ max_frs = max_frame << IXGBE_MHADD_MFS_SHIFT;
IXGBE_WRITE_REG(hw, IXGBE_MAXFRS, max_frs);
}