Commit c8692598 authored by Radoslaw Tyl's avatar Radoslaw Tyl Committed by Tony Nguyen

ixgbevf: Mailbox improvements

Improve reliability of the mailbox communication and remove
its potential flaws that may lead to the undefined or faulty behavior.

Recently some users reported issues on ESX with 10G Intel NICs which were
found to be caused by incorrect implementation of the PF-VF mailbox
communication.

Technical investigation highlighted areas to improve in the communication
between PF or VF that wants to send the message (sender) and the other
part which receives the message (receiver):

 - Locking the mailbox when the sender wants to send a message
 - Releasing the mailbox when the communication ends
 - Returning the result of the mailbox message execution
Signed-off-by: default avatarRadoslaw Tyl <radoslawx.tyl@intel.com>
Tested-by: default avatarTony Brelinski <tony.brelinski@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 9c9463c2
...@@ -284,6 +284,7 @@ struct ixgbe_adv_tx_context_desc { ...@@ -284,6 +284,7 @@ struct ixgbe_adv_tx_context_desc {
#define IXGBE_ERR_CONFIG -4 #define IXGBE_ERR_CONFIG -4
#define IXGBE_ERR_MBX -5 #define IXGBE_ERR_MBX -5
#define IXGBE_ERR_TIMEOUT -6 #define IXGBE_ERR_TIMEOUT -6
#define IXGBE_ERR_PARAM -7
/* Transmit Config masks */ /* Transmit Config masks */
#define IXGBE_TXDCTL_ENABLE 0x02000000 /* Ena specific Tx Queue */ #define IXGBE_TXDCTL_ENABLE 0x02000000 /* Ena specific Tx Queue */
......
...@@ -40,11 +40,11 @@ static int ixgbevf_ipsec_set_pf_sa(struct ixgbevf_adapter *adapter, ...@@ -40,11 +40,11 @@ static int ixgbevf_ipsec_set_pf_sa(struct ixgbevf_adapter *adapter,
spin_lock_bh(&adapter->mbx_lock); spin_lock_bh(&adapter->mbx_lock);
ret = hw->mbx.ops.write_posted(hw, msgbuf, IXGBE_VFMAILBOX_SIZE); ret = ixgbevf_write_mbx(hw, msgbuf, IXGBE_VFMAILBOX_SIZE);
if (ret) if (ret)
goto out; goto out;
ret = hw->mbx.ops.read_posted(hw, msgbuf, 2); ret = ixgbevf_poll_mbx(hw, msgbuf, 2);
if (ret) if (ret)
goto out; goto out;
...@@ -77,11 +77,11 @@ static int ixgbevf_ipsec_del_pf_sa(struct ixgbevf_adapter *adapter, int pfsa) ...@@ -77,11 +77,11 @@ static int ixgbevf_ipsec_del_pf_sa(struct ixgbevf_adapter *adapter, int pfsa)
spin_lock_bh(&adapter->mbx_lock); spin_lock_bh(&adapter->mbx_lock);
err = hw->mbx.ops.write_posted(hw, msgbuf, 2); err = ixgbevf_write_mbx(hw, msgbuf, 2);
if (err) if (err)
goto out; goto out;
err = hw->mbx.ops.read_posted(hw, msgbuf, 2); err = ixgbevf_poll_mbx(hw, msgbuf, 2);
if (err) if (err)
goto out; goto out;
......
...@@ -429,6 +429,7 @@ extern const struct ixgbevf_info ixgbevf_82599_vf_info; ...@@ -429,6 +429,7 @@ extern const struct ixgbevf_info ixgbevf_82599_vf_info;
extern const struct ixgbevf_info ixgbevf_X540_vf_info; extern const struct ixgbevf_info ixgbevf_X540_vf_info;
extern const struct ixgbevf_info ixgbevf_X550_vf_info; extern const struct ixgbevf_info ixgbevf_X550_vf_info;
extern const struct ixgbevf_info ixgbevf_X550EM_x_vf_info; extern const struct ixgbevf_info ixgbevf_X550EM_x_vf_info;
extern const struct ixgbe_mbx_operations ixgbevf_mbx_ops;
extern const struct ixgbe_mbx_operations ixgbevf_mbx_ops_legacy; extern const struct ixgbe_mbx_operations ixgbevf_mbx_ops_legacy;
extern const struct ixgbevf_info ixgbevf_x550em_a_vf_info; extern const struct ixgbevf_info ixgbevf_x550em_a_vf_info;
...@@ -491,4 +492,8 @@ void ixgbe_napi_del_all(struct ixgbevf_adapter *adapter); ...@@ -491,4 +492,8 @@ void ixgbe_napi_del_all(struct ixgbevf_adapter *adapter);
#define hw_dbg(hw, format, arg...) \ #define hw_dbg(hw, format, arg...) \
netdev_dbg(ixgbevf_hw_to_netdev(hw), format, ## arg) netdev_dbg(ixgbevf_hw_to_netdev(hw), format, ## arg)
s32 ixgbevf_poll_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size);
s32 ixgbevf_write_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size);
#endif /* _IXGBEVF_H_ */ #endif /* _IXGBEVF_H_ */
This diff is collapsed.
...@@ -13,13 +13,12 @@ ...@@ -13,13 +13,12 @@
static inline s32 ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw, u32 *msg, static inline s32 ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw, u32 *msg,
u32 *retmsg, u16 size) u32 *retmsg, u16 size)
{ {
struct ixgbe_mbx_info *mbx = &hw->mbx; s32 retval = ixgbevf_write_mbx(hw, msg, size);
s32 retval = mbx->ops.write_posted(hw, msg, size);
if (retval) if (retval)
return retval; return retval;
return mbx->ops.read_posted(hw, retmsg, size); return ixgbevf_poll_mbx(hw, retmsg, size);
} }
/** /**
...@@ -92,7 +91,7 @@ static s32 ixgbevf_reset_hw_vf(struct ixgbe_hw *hw) ...@@ -92,7 +91,7 @@ static s32 ixgbevf_reset_hw_vf(struct ixgbe_hw *hw)
mbx->timeout = IXGBE_VF_MBX_INIT_TIMEOUT; mbx->timeout = IXGBE_VF_MBX_INIT_TIMEOUT;
msgbuf[0] = IXGBE_VF_RESET; msgbuf[0] = IXGBE_VF_RESET;
mbx->ops.write_posted(hw, msgbuf, 1); ixgbevf_write_mbx(hw, msgbuf, 1);
mdelay(10); mdelay(10);
...@@ -100,7 +99,7 @@ static s32 ixgbevf_reset_hw_vf(struct ixgbe_hw *hw) ...@@ -100,7 +99,7 @@ static s32 ixgbevf_reset_hw_vf(struct ixgbe_hw *hw)
* also set up the mc_filter_type which is piggy backed * also set up the mc_filter_type which is piggy backed
* on the mac address in word 3 * on the mac address in word 3
*/ */
ret_val = mbx->ops.read_posted(hw, msgbuf, IXGBE_VF_PERMADDR_MSG_LEN); ret_val = ixgbevf_poll_mbx(hw, msgbuf, IXGBE_VF_PERMADDR_MSG_LEN);
if (ret_val) if (ret_val)
return ret_val; return ret_val;
...@@ -323,12 +322,12 @@ int ixgbevf_get_reta_locked(struct ixgbe_hw *hw, u32 *reta, int num_rx_queues) ...@@ -323,12 +322,12 @@ int ixgbevf_get_reta_locked(struct ixgbe_hw *hw, u32 *reta, int num_rx_queues)
msgbuf[0] = IXGBE_VF_GET_RETA; msgbuf[0] = IXGBE_VF_GET_RETA;
err = hw->mbx.ops.write_posted(hw, msgbuf, 1); err = ixgbevf_write_mbx(hw, msgbuf, 1);
if (err) if (err)
return err; return err;
err = hw->mbx.ops.read_posted(hw, msgbuf, dwords + 1); err = ixgbevf_poll_mbx(hw, msgbuf, dwords + 1);
if (err) if (err)
return err; return err;
...@@ -390,12 +389,12 @@ int ixgbevf_get_rss_key_locked(struct ixgbe_hw *hw, u8 *rss_key) ...@@ -390,12 +389,12 @@ int ixgbevf_get_rss_key_locked(struct ixgbe_hw *hw, u8 *rss_key)
} }
msgbuf[0] = IXGBE_VF_GET_RSS_KEY; msgbuf[0] = IXGBE_VF_GET_RSS_KEY;
err = hw->mbx.ops.write_posted(hw, msgbuf, 1); err = ixgbevf_write_mbx(hw, msgbuf, 1);
if (err) if (err)
return err; return err;
err = hw->mbx.ops.read_posted(hw, msgbuf, 11); err = ixgbevf_poll_mbx(hw, msgbuf, 11);
if (err) if (err)
return err; return err;
......
...@@ -73,10 +73,9 @@ struct ixgbe_mac_info { ...@@ -73,10 +73,9 @@ struct ixgbe_mac_info {
struct ixgbe_mbx_operations { struct ixgbe_mbx_operations {
s32 (*init_params)(struct ixgbe_hw *hw); s32 (*init_params)(struct ixgbe_hw *hw);
void (*release)(struct ixgbe_hw *hw);
s32 (*read)(struct ixgbe_hw *, u32 *, u16); s32 (*read)(struct ixgbe_hw *, u32 *, u16);
s32 (*write)(struct ixgbe_hw *, u32 *, u16); s32 (*write)(struct ixgbe_hw *, u32 *, u16);
s32 (*read_posted)(struct ixgbe_hw *, u32 *, u16);
s32 (*write_posted)(struct ixgbe_hw *, u32 *, u16);
s32 (*check_for_msg)(struct ixgbe_hw *); s32 (*check_for_msg)(struct ixgbe_hw *);
s32 (*check_for_ack)(struct ixgbe_hw *); s32 (*check_for_ack)(struct ixgbe_hw *);
s32 (*check_for_rst)(struct ixgbe_hw *); s32 (*check_for_rst)(struct ixgbe_hw *);
...@@ -96,7 +95,7 @@ struct ixgbe_mbx_info { ...@@ -96,7 +95,7 @@ struct ixgbe_mbx_info {
struct ixgbe_mbx_stats stats; struct ixgbe_mbx_stats stats;
u32 timeout; u32 timeout;
u32 udelay; u32 udelay;
u32 v2p_mailbox; u32 vf_mailbox;
u16 size; u16 size;
}; };
......
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