Page MenuHomeFreeBSD

D32004.id95286.diff
No OneTemporary

D32004.id95286.diff

Index: sys/dev/ixgbe/if_ixv.c
===================================================================
--- sys/dev/ixgbe/if_ixv.c
+++ sys/dev/ixgbe/if_ixv.c
@@ -463,6 +463,13 @@
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 (!ixv_check_ether_addr(hw->mac.addr)) {
ether_gen_addr(iflib_get_ifp(ctx),
@@ -648,6 +655,13 @@
ixv_init_stats(adapter);
/* 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,
false);
@@ -805,7 +819,8 @@
ixv_negotiate_api(struct adapter *adapter)
{
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_unknown };
int i = 0;
@@ -914,7 +929,7 @@
iflib_get_ifp(ctx)->if_init(ctx);
}
- if (adapter->link_up) {
+ if (adapter->link_up && adapter->link_enabled) {
if (adapter->link_active == false) {
if (bootverbose)
device_printf(dev, "Link is up %d Gbps %s \n",
Index: sys/dev/ixgbe/ixgbe.h
===================================================================
--- sys/dev/ixgbe/ixgbe.h
+++ sys/dev/ixgbe/ixgbe.h
@@ -413,6 +413,7 @@
u16 num_segs;
u32 link_speed;
bool link_up;
+ bool link_enabled;
u32 vector;
u16 dmac;
u32 phy_layer;
Index: sys/dev/ixgbe/ixgbe_mbx.h
===================================================================
--- sys/dev/ixgbe/ixgbe_mbx.h
+++ sys/dev/ixgbe/ixgbe_mbx.h
@@ -115,6 +115,7 @@
#define IXGBE_VF_GET_RETA 0x0a /* VF request for RETA */
#define IXGBE_VF_GET_RSS_KEY 0x0b /* get RSS key */
#define IXGBE_VF_UPDATE_XCAST_MODE 0x0c
+#define IXGBE_VF_GET_LINK_STATE 0x10
/* mode choices for IXGBE_VF_UPDATE_XCAST_MODE */
enum ixgbevf_xcast_modes {
Index: sys/dev/ixgbe/ixgbe_type.h
===================================================================
--- sys/dev/ixgbe/ixgbe_type.h
+++ sys/dev/ixgbe/ixgbe_type.h
@@ -3981,6 +3981,7 @@
s32 (*update_mc_addr_list)(struct ixgbe_hw *, u8 *, u32,
ixgbe_mc_addr_itr, bool clear);
s32 (*update_xcast_mode)(struct ixgbe_hw *, int);
+ s32 (*get_link_state)(struct ixgbe_hw *hw, bool *link_state);
s32 (*enable_mc)(struct ixgbe_hw *);
s32 (*disable_mc)(struct ixgbe_hw *);
s32 (*clear_vfta)(struct ixgbe_hw *);
Index: sys/dev/ixgbe/ixgbe_vf.h
===================================================================
--- sys/dev/ixgbe/ixgbe_vf.h
+++ sys/dev/ixgbe/ixgbe_vf.h
@@ -135,6 +135,7 @@
u32 mc_addr_count, ixgbe_mc_addr_itr,
bool clear);
s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode);
+s32 ixgbe_get_link_state_vf(struct ixgbe_hw *hw, bool *link_state);
s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
bool vlan_on, bool vlvf_bypass);
s32 ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
Index: sys/dev/ixgbe/ixgbe_vf.c
===================================================================
--- sys/dev/ixgbe/ixgbe_vf.c
+++ sys/dev/ixgbe/ixgbe_vf.c
@@ -77,6 +77,7 @@
hw->mac.ops.init_rx_addrs = NULL;
hw->mac.ops.update_mc_addr_list = ixgbe_update_mc_addr_list_vf;
hw->mac.ops.update_xcast_mode = ixgbevf_update_xcast_mode;
+ hw->mac.ops.get_link_state = ixgbe_get_link_state_vf;
hw->mac.ops.enable_mc = NULL;
hw->mac.ops.disable_mc = NULL;
hw->mac.ops.clear_vfta = NULL;
@@ -456,6 +457,34 @@
return IXGBE_SUCCESS;
}
+/**
+ * ixgbe_get_link_state_vf - Get VF link state from PF
+ * @hw: pointer to the HW structure
+ * @link_state: link state storage
+ *
+ * Returns state of the operation error or success.
+ **/
+s32 ixgbe_get_link_state_vf(struct ixgbe_hw *hw, bool *link_state)
+{
+ u32 msgbuf[2];
+ s32 err;
+ s32 ret_val;
+
+ msgbuf[0] = IXGBE_VF_GET_LINK_STATE;
+ msgbuf[1] = 0x0;
+
+ err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
+
+ if (err || (msgbuf[0] & IXGBE_VT_MSGTYPE_NACK)) {
+ ret_val = IXGBE_ERR_MBX;
+ } else {
+ ret_val = IXGBE_SUCCESS;
+ *link_state = msgbuf[1];
+ }
+
+ return ret_val;
+}
+
/**
* ixgbe_set_vfta_vf - Set/Unset vlan filter table address
* @hw: pointer to the HW structure

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 18, 9:33 AM (15 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15483959
Default Alt Text
D32004.id95286.diff (4 KB)

Event Timeline