Commit fef45f4c authored by Alexander Duyck's avatar Alexander Duyck Committed by David S. Miller

igb: fix handling of mailbox collisions between PF/VF

This patch changes the handling of collisions between the use of the
PF/VF sides of the mailbox.
Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ceb0c77e
...@@ -4608,8 +4608,14 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf) ...@@ -4608,8 +4608,14 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)
retval = igb_read_mbx(hw, msgbuf, E1000_VFMAILBOX_SIZE, vf); retval = igb_read_mbx(hw, msgbuf, E1000_VFMAILBOX_SIZE, vf);
if (retval) if (retval) {
/* if receive failed revoke VF CTS stats and restart init */
dev_err(&pdev->dev, "Error receiving message from VF\n"); dev_err(&pdev->dev, "Error receiving message from VF\n");
vf_data->flags &= ~IGB_VF_FLAG_CTS;
if (!time_after(jiffies, vf_data->last_nack + (2 * HZ)))
return;
goto out;
}
/* this is a message we already processed, do nothing */ /* this is a message we already processed, do nothing */
if (msgbuf[0] & (E1000_VT_MSGTYPE_ACK | E1000_VT_MSGTYPE_NACK)) if (msgbuf[0] & (E1000_VT_MSGTYPE_ACK | E1000_VT_MSGTYPE_NACK))
...@@ -4626,12 +4632,10 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf) ...@@ -4626,12 +4632,10 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)
} }
if (!(vf_data->flags & IGB_VF_FLAG_CTS)) { if (!(vf_data->flags & IGB_VF_FLAG_CTS)) {
msgbuf[0] = E1000_VT_MSGTYPE_NACK; if (!time_after(jiffies, vf_data->last_nack + (2 * HZ)))
if (time_after(jiffies, vf_data->last_nack + (2 * HZ))) { return;
igb_write_mbx(hw, msgbuf, 1, vf); retval = -1;
vf_data->last_nack = jiffies; goto out;
}
return;
} }
switch ((msgbuf[0] & 0xFFFF)) { switch ((msgbuf[0] & 0xFFFF)) {
...@@ -4656,14 +4660,14 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf) ...@@ -4656,14 +4660,14 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)
break; break;
} }
msgbuf[0] |= E1000_VT_MSGTYPE_CTS;
out:
/* notify the VF of the results of what it sent us */ /* notify the VF of the results of what it sent us */
if (retval) if (retval)
msgbuf[0] |= E1000_VT_MSGTYPE_NACK; msgbuf[0] |= E1000_VT_MSGTYPE_NACK;
else else
msgbuf[0] |= E1000_VT_MSGTYPE_ACK; msgbuf[0] |= E1000_VT_MSGTYPE_ACK;
msgbuf[0] |= E1000_VT_MSGTYPE_CTS;
igb_write_mbx(hw, msgbuf, 1, vf); igb_write_mbx(hw, msgbuf, 1, vf);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment