mirror of
https://github.com/opnsense/src.git
synced 2026-06-03 13:58:30 -04:00
ixgbe: update if_sriov with ix-3.3.38 changes
There are some critical fixes here. The PF must communicate with each VF slot (vf->pool), only VFs shall use 0 for everything. IXGBE_FEATURE_SRIOV needs to be set before calling ixgbe_if_init(). With these changes, ixv(4) now attaches to VFs, but after bringing up VFs, the PF and VF still are not correctly passing traffic. (cherry picked from commit b6cd053e6da9bb8f77d2c6069260e52bbd53fa4a)
This commit is contained in:
parent
b8c2ff930b
commit
e9e57ee70b
1 changed files with 28 additions and 12 deletions
|
|
@ -95,26 +95,26 @@ ixgbe_align_all_queue_indices(struct ixgbe_softc *sc)
|
|||
|
||||
/* Support functions for SR-IOV/VF management */
|
||||
static inline void
|
||||
ixgbe_send_vf_msg(struct ixgbe_softc *sc, struct ixgbe_vf *vf, u32 msg)
|
||||
ixgbe_send_vf_msg(struct ixgbe_hw *hw, struct ixgbe_vf *vf, u32 msg)
|
||||
{
|
||||
if (vf->flags & IXGBE_VF_CTS)
|
||||
msg |= IXGBE_VT_MSGTYPE_CTS;
|
||||
|
||||
ixgbe_write_mbx(&sc->hw, &msg, 1, vf->pool);
|
||||
hw->mbx.ops[vf->pool].write(hw, &msg, 1, vf->pool);
|
||||
}
|
||||
|
||||
static inline void
|
||||
ixgbe_send_vf_success(struct ixgbe_softc *sc, struct ixgbe_vf *vf, u32 msg)
|
||||
{
|
||||
msg &= IXGBE_VT_MSG_MASK;
|
||||
ixgbe_send_vf_msg(sc, vf, msg | IXGBE_VT_MSGTYPE_SUCCESS);
|
||||
ixgbe_send_vf_msg(&sc->hw, vf, msg | IXGBE_VT_MSGTYPE_SUCCESS);
|
||||
}
|
||||
|
||||
static inline void
|
||||
ixgbe_send_vf_failure(struct ixgbe_softc *sc, struct ixgbe_vf *vf, u32 msg)
|
||||
{
|
||||
msg &= IXGBE_VT_MSG_MASK;
|
||||
ixgbe_send_vf_msg(sc, vf, msg | IXGBE_VT_MSGTYPE_FAILURE);
|
||||
ixgbe_send_vf_msg(&sc->hw, vf, msg | IXGBE_VT_MSGTYPE_FAILURE);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
@ -210,7 +210,7 @@ ixgbe_ping_all_vfs(struct ixgbe_softc *sc)
|
|||
for (int i = 0; i < sc->num_vfs; i++) {
|
||||
vf = &sc->vfs[i];
|
||||
if (vf->flags & IXGBE_VF_ACTIVE)
|
||||
ixgbe_send_vf_msg(sc, vf, IXGBE_PF_CONTROL_MSG);
|
||||
ixgbe_send_vf_msg(&sc->hw, vf, IXGBE_PF_CONTROL_MSG);
|
||||
}
|
||||
} /* ixgbe_ping_all_vfs */
|
||||
|
||||
|
|
@ -254,6 +254,17 @@ ixgbe_vf_set_default_vlan(struct ixgbe_softc *sc, struct ixgbe_vf *vf,
|
|||
IXGBE_WRITE_REG(hw, IXGBE_VMVIR(vf->pool), vmvir);
|
||||
} /* ixgbe_vf_set_default_vlan */
|
||||
|
||||
static void
|
||||
ixgbe_clear_vfmbmem(struct ixgbe_softc *sc, struct ixgbe_vf *vf)
|
||||
{
|
||||
struct ixgbe_hw *hw = &sc->hw;
|
||||
uint32_t vf_index = IXGBE_VF_INDEX(vf->pool);
|
||||
uint16_t mbx_size = hw->mbx.size;
|
||||
uint16_t i;
|
||||
|
||||
for (i = 0; i < mbx_size; ++i)
|
||||
IXGBE_WRITE_REG_ARRAY(hw, IXGBE_PFMBMEM(vf_index), i, 0x0);
|
||||
} /* ixgbe_clear_vfmbmem */
|
||||
|
||||
static boolean_t
|
||||
ixgbe_vf_frame_size_compatible(struct ixgbe_softc *sc, struct ixgbe_vf *vf)
|
||||
|
|
@ -310,6 +321,8 @@ ixgbe_process_vf_reset(struct ixgbe_softc *sc, struct ixgbe_vf *vf)
|
|||
// XXX clear multicast addresses
|
||||
|
||||
ixgbe_clear_rar(&sc->hw, vf->rar_index);
|
||||
ixgbe_clear_vfmbmem(sc, vf);
|
||||
ixgbe_toggle_txdctl(&sc->hw, IXGBE_VF_INDEX(vf->pool));
|
||||
|
||||
vf->api_ver = IXGBE_API_VER_UNKNOWN;
|
||||
} /* ixgbe_process_vf_reset */
|
||||
|
|
@ -371,7 +384,7 @@ ixgbe_vf_reset_msg(struct ixgbe_softc *sc, struct ixgbe_vf *vf, uint32_t *msg)
|
|||
|
||||
vf->flags |= IXGBE_VF_CTS;
|
||||
|
||||
resp[0] = IXGBE_VF_RESET | ack | IXGBE_VT_MSGTYPE_CTS;
|
||||
resp[0] = IXGBE_VF_RESET | ack;
|
||||
bcopy(vf->ether_addr, &resp[1], ETHER_ADDR_LEN);
|
||||
resp[3] = hw->mac.mc_filter_type;
|
||||
ixgbe_write_mbx(hw, resp, IXGBE_VF_PERMADDR_MSG_LEN, vf->pool);
|
||||
|
|
@ -582,7 +595,8 @@ ixgbe_process_vf_msg(if_ctx_t ctx, struct ixgbe_vf *vf)
|
|||
|
||||
hw = &sc->hw;
|
||||
|
||||
error = ixgbe_read_mbx(hw, msg, IXGBE_VFMAILBOX_SIZE, vf->pool);
|
||||
error = hw->mbx.ops[vf->pool].read(hw, msg, IXGBE_VFMAILBOX_SIZE,
|
||||
vf->pool);
|
||||
|
||||
if (error != 0)
|
||||
return;
|
||||
|
|
@ -643,13 +657,13 @@ ixgbe_handle_mbx(void *context)
|
|||
vf = &sc->vfs[i];
|
||||
|
||||
if (vf->flags & IXGBE_VF_ACTIVE) {
|
||||
if (hw->mbx.ops[0].check_for_rst(hw, vf->pool) == 0)
|
||||
if (hw->mbx.ops[vf->pool].check_for_rst(hw, vf->pool) == 0)
|
||||
ixgbe_process_vf_reset(sc, vf);
|
||||
|
||||
if (hw->mbx.ops[0].check_for_msg(hw, vf->pool) == 0)
|
||||
if (hw->mbx.ops[vf->pool].check_for_msg(hw, vf->pool) == 0)
|
||||
ixgbe_process_vf_msg(ctx, vf);
|
||||
|
||||
if (hw->mbx.ops[0].check_for_ack(hw, vf->pool) == 0)
|
||||
if (hw->mbx.ops[vf->pool].check_for_ack(hw, vf->pool) == 0)
|
||||
ixgbe_process_vf_ack(sc, vf);
|
||||
}
|
||||
}
|
||||
|
|
@ -698,8 +712,10 @@ ixgbe_if_iov_init(if_ctx_t ctx, u16 num_vfs, const nvlist_t *config)
|
|||
}
|
||||
|
||||
sc->num_vfs = num_vfs;
|
||||
ixgbe_if_init(sc->ctx);
|
||||
ixgbe_init_mbx_params_pf(&sc->hw);
|
||||
|
||||
sc->feat_en |= IXGBE_FEATURE_SRIOV;
|
||||
ixgbe_if_init(sc->ctx);
|
||||
|
||||
return (retval);
|
||||
|
||||
|
|
@ -769,7 +785,7 @@ ixgbe_init_vf(struct ixgbe_softc *sc, struct ixgbe_vf *vf)
|
|||
ixgbe_vf_enable_transmit(sc, vf);
|
||||
ixgbe_vf_enable_receive(sc, vf);
|
||||
|
||||
ixgbe_send_vf_msg(sc, vf, IXGBE_PF_CONTROL_MSG);
|
||||
ixgbe_send_vf_msg(&sc->hw, vf, IXGBE_PF_CONTROL_MSG);
|
||||
} /* ixgbe_init_vf */
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Reference in a new issue