MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ixgbe_set_vf_lpe

Function ixgbe_set_vf_lpe

dpdk/drivers/net/ixgbe/ixgbe_pf.c:551–611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

549}
550
551static int
552ixgbe_set_vf_lpe(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
553{
554 struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
555 uint32_t max_frame = msgbuf[1];
556 uint32_t max_frs;
557 uint32_t hlreg0;
558
559 /* X540 and X550 support jumbo frames in IOV mode */
560 if (hw->mac.type != ixgbe_mac_X540 &&
561 hw->mac.type != ixgbe_mac_X550 &&
562 hw->mac.type != ixgbe_mac_X550EM_x &&
563 hw->mac.type != ixgbe_mac_X550EM_a) {
564 struct ixgbe_vf_info *vfinfo =
565 *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
566
567 switch (vfinfo[vf].api_version) {
568 case ixgbe_mbox_api_11:
569 case ixgbe_mbox_api_12:
570 case ixgbe_mbox_api_13:
571 /**
572 * Version 1.1&1.2&1.3 supports jumbo frames on VFs
573 * if PF has jumbo frames enabled which means legacy
574 * VFs are disabled.
575 */
576 if (dev->data->mtu > RTE_ETHER_MTU)
577 break;
578 /* fall through */
579 default:
580 /**
581 * If the PF or VF are running w/ jumbo frames enabled,
582 * we return -1 as we cannot support jumbo frames on
583 * legacy VFs.
584 */
585 if (max_frame > IXGBE_ETH_MAX_LEN ||
586 dev->data->mtu > RTE_ETHER_MTU)
587 return -1;
588 break;
589 }
590 }
591
592 if (max_frame < RTE_ETHER_MIN_LEN ||
593 max_frame > RTE_ETHER_MAX_JUMBO_FRAME_LEN)
594 return -1;
595
596 max_frs = (IXGBE_READ_REG(hw, IXGBE_MAXFRS) &
597 IXGBE_MHADD_MFS_MASK) >> IXGBE_MHADD_MFS_SHIFT;
598 if (max_frs < max_frame) {
599 hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
600 if (max_frame > IXGBE_ETH_MAX_LEN)
601 hlreg0 |= IXGBE_HLREG0_JUMBOEN;
602 else
603 hlreg0 &= ~IXGBE_HLREG0_JUMBOEN;
604 IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0);
605
606 max_frs = max_frame << IXGBE_MHADD_MFS_SHIFT;
607 IXGBE_WRITE_REG(hw, IXGBE_MAXFRS, max_frs);
608 }

Callers 1

ixgbe_rcv_msg_from_vfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected