net/ixgbe: enable jumbo frame for VF
authorJunyu Jiang <junyux.jiang@intel.com>
Mon, 2 Dec 2019 20:03:27 +0000 (20:03 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 17 Jan 2020 18:46:01 +0000 (19:46 +0100)
Enable jumbo frame for VF by configuring DPDK PF.

Signed-off-by: Junyu Jiang <junyux.jiang@intel.com>
Acked-by: Wei Zhao <wei.zhao1@intel.com>
drivers/net/ixgbe/ixgbe_pf.c

index d0d85e1..66b856e 100644 (file)
@@ -544,6 +544,7 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *ms
        struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        uint32_t new_mtu = 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 */
@@ -560,6 +561,18 @@ ixgbe_set_vf_lpe(struct rte_eth_dev *dev, __rte_unused uint32_t vf, uint32_t *ms
        max_frs = (IXGBE_READ_REG(hw, IXGBE_MAXFRS) &
                   IXGBE_MHADD_MFS_MASK) >> IXGBE_MHADD_MFS_SHIFT;
        if (max_frs < new_mtu) {
+               hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
+               if (new_mtu > RTE_ETHER_MAX_LEN) {
+                       dev->data->dev_conf.rxmode.offloads |=
+                               DEV_RX_OFFLOAD_JUMBO_FRAME;
+                       hlreg0 |= IXGBE_HLREG0_JUMBOEN;
+               } else {
+                       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;
                IXGBE_WRITE_REG(hw, IXGBE_MAXFRS, max_frs);
        }