Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixgbe/if_ixv.c
Show First 20 Lines • Show All 457 Lines • ▼ Show 20 Lines | ixv_if_attach_pre(if_ctx_t ctx) | ||||
/* Negotiate mailbox API version */ | /* Negotiate mailbox API version */ | ||||
error = ixv_negotiate_api(adapter); | error = ixv_negotiate_api(adapter); | ||||
if (error) { | if (error) { | ||||
device_printf(dev, | device_printf(dev, | ||||
"Mailbox API negotiation failed during attach!\n"); | "Mailbox API negotiation failed during attach!\n"); | ||||
goto err_out; | goto err_out; | ||||
} | } | ||||
/* Check if VF was disabled by PF */ | |||||
error = hw->mac.ops.get_link_state(hw, &adapter->link_enabled); | |||||
if (error) { | |||||
/* PF is not capable of controlling VF state. Enable the link. */ | |||||
adapter->link_enabled = true; | |||||
} | |||||
/* If no mac address was assigned, make a random one */ | /* If no mac address was assigned, make a random one */ | ||||
if (!ixv_check_ether_addr(hw->mac.addr)) { | if (!ixv_check_ether_addr(hw->mac.addr)) { | ||||
ether_gen_addr(iflib_get_ifp(ctx), | ether_gen_addr(iflib_get_ifp(ctx), | ||||
(struct ether_addr *)hw->mac.addr); | (struct ether_addr *)hw->mac.addr); | ||||
bcopy(hw->mac.addr, hw->mac.perm_addr, | bcopy(hw->mac.addr, hw->mac.perm_addr, | ||||
sizeof(hw->mac.perm_addr)); | sizeof(hw->mac.perm_addr)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | ixv_if_init(if_ctx_t ctx) | ||||
/* Set moderation on the Link interrupt */ | /* Set moderation on the Link interrupt */ | ||||
IXGBE_WRITE_REG(hw, IXGBE_VTEITR(adapter->vector), IXGBE_LINK_ITR); | IXGBE_WRITE_REG(hw, IXGBE_VTEITR(adapter->vector), IXGBE_LINK_ITR); | ||||
/* Stats init */ | /* Stats init */ | ||||
ixv_init_stats(adapter); | ixv_init_stats(adapter); | ||||
/* Config/Enable Link */ | /* Config/Enable Link */ | ||||
error = hw->mac.ops.get_link_state(hw, &adapter->link_enabled); | |||||
if (error) { | |||||
/* PF is not capable of controlling VF state. Enable the link. */ | |||||
adapter->link_enabled = true; | |||||
} else if (adapter->link_enabled == false) | |||||
device_printf(dev, "VF is disabled by PF\n"); | |||||
hw->mac.ops.check_link(hw, &adapter->link_speed, &adapter->link_up, | hw->mac.ops.check_link(hw, &adapter->link_speed, &adapter->link_up, | ||||
false); | false); | ||||
/* And now turn on interrupts */ | /* And now turn on interrupts */ | ||||
ixv_if_enable_intr(ctx); | ixv_if_enable_intr(ctx); | ||||
return; | return; | ||||
} /* ixv_if_init */ | } /* ixv_if_init */ | ||||
▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* Negotiate the Mailbox API with the PF; | * Negotiate the Mailbox API with the PF; | ||||
* start with the most featured API first. | * start with the most featured API first. | ||||
************************************************************************/ | ************************************************************************/ | ||||
static int | static int | ||||
ixv_negotiate_api(struct adapter *adapter) | ixv_negotiate_api(struct adapter *adapter) | ||||
{ | { | ||||
struct ixgbe_hw *hw = &adapter->hw; | struct ixgbe_hw *hw = &adapter->hw; | ||||
int mbx_api[] = { ixgbe_mbox_api_11, | int mbx_api[] = { ixgbe_mbox_api_12, | ||||
ixgbe_mbox_api_11, | |||||
ixgbe_mbox_api_10, | ixgbe_mbox_api_10, | ||||
ixgbe_mbox_api_unknown }; | ixgbe_mbox_api_unknown }; | ||||
int i = 0; | int i = 0; | ||||
while (mbx_api[i] != ixgbe_mbox_api_unknown) { | while (mbx_api[i] != ixgbe_mbox_api_unknown) { | ||||
if (ixgbevf_negotiate_api_version(hw, mbx_api[i]) == 0) | if (ixgbevf_negotiate_api_version(hw, mbx_api[i]) == 0) | ||||
return (0); | return (0); | ||||
i++; | i++; | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | status = ixgbe_check_link(&adapter->hw, &adapter->link_speed, | ||||
&adapter->link_up, false); | &adapter->link_up, false); | ||||
if (status != IXGBE_SUCCESS && adapter->hw.adapter_stopped == false) { | if (status != IXGBE_SUCCESS && adapter->hw.adapter_stopped == false) { | ||||
/* Mailbox's Clear To Send status is lost or timeout occurred. | /* Mailbox's Clear To Send status is lost or timeout occurred. | ||||
* We need reinitialization. */ | * We need reinitialization. */ | ||||
iflib_get_ifp(ctx)->if_init(ctx); | iflib_get_ifp(ctx)->if_init(ctx); | ||||
} | } | ||||
if (adapter->link_up) { | if (adapter->link_up && adapter->link_enabled) { | ||||
if (adapter->link_active == false) { | if (adapter->link_active == false) { | ||||
if (bootverbose) | if (bootverbose) | ||||
device_printf(dev, "Link is up %d Gbps %s \n", | device_printf(dev, "Link is up %d Gbps %s \n", | ||||
((adapter->link_speed == 128) ? 10 : 1), | ((adapter->link_speed == 128) ? 10 : 1), | ||||
"Full Duplex"); | "Full Duplex"); | ||||
adapter->link_active = true; | adapter->link_active = true; | ||||
iflib_link_state_change(ctx, LINK_STATE_UP, | iflib_link_state_change(ctx, LINK_STATE_UP, | ||||
IF_Gbps(10)); | IF_Gbps(10)); | ||||
▲ Show 20 Lines • Show All 1,023 Lines • Show Last 20 Lines |