--- a/sys/dev/netif/ix/ixgbe_x550.c +++ b/sys/dev/netif/ix/ixgbe_x550.c @@ -1075,12 +1075,17 @@ void ixgbe_set_ethertype_anti_spoofing_X550(struct ixgbe_hw *hw, bool enable, int vf) { - int vf_target_reg = vf >> 3; - int vf_target_shift = vf % 8 + IXGBE_SPOOF_ETHERTYPEAS_SHIFT; + int vf_target_reg; + int vf_target_shift; u32 pfvfspoof; DEBUGFUNC("ixgbe_set_ethertype_anti_spoofing_X550"); + if (vf < 0 || vf >= IXGBE_PFVFSPOOF_REG_COUNT * 8) + return; + vf_target_reg = vf >> 3; + vf_target_shift = vf % 8 + IXGBE_SPOOF_ETHERTYPEAS_SHIFT; + pfvfspoof = IXGBE_READ_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg)); if (enable) pfvfspoof |= (1 << vf_target_shift); @@ -1409,6 +1414,10 @@ DEBUGFUNC("ixgbe_restore_mdd_vf_X550"); + /* Max 64 VFs / pools on this MAC */ + if (vf >= 64) + return; + /* Map VF to queues */ reg = IXGBE_READ_REG(hw, IXGBE_MRQC); switch (reg & IXGBE_MRQC_MRQE_MASK) {