Skip to content

Commit

Permalink
ixgbevf: Mailbox improvements
Browse files Browse the repository at this point in the history
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: Radoslaw Tyl <radoslawx.tyl@intel.com>
Tested-by: Tony Brelinski <tony.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
  • Loading branch information
Radoslaw Tyl authored and Tony Nguyen committed Nov 17, 2021
1 parent 9c9463c commit c869259
Show file tree
Hide file tree
Showing 6 changed files with 265 additions and 84 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/intel/ixgbevf/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ struct ixgbe_adv_tx_context_desc {
#define IXGBE_ERR_CONFIG -4
#define IXGBE_ERR_MBX -5
#define IXGBE_ERR_TIMEOUT -6
#define IXGBE_ERR_PARAM -7

/* Transmit Config masks */
#define IXGBE_TXDCTL_ENABLE 0x02000000 /* Ena specific Tx Queue */
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/ethernet/intel/ixgbevf/ipsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ static int ixgbevf_ipsec_set_pf_sa(struct ixgbevf_adapter *adapter,

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)
goto out;

ret = hw->mbx.ops.read_posted(hw, msgbuf, 2);
ret = ixgbevf_poll_mbx(hw, msgbuf, 2);
if (ret)
goto out;

Expand Down Expand Up @@ -77,11 +77,11 @@ static int ixgbevf_ipsec_del_pf_sa(struct ixgbevf_adapter *adapter, int pfsa)

spin_lock_bh(&adapter->mbx_lock);

err = hw->mbx.ops.write_posted(hw, msgbuf, 2);
err = ixgbevf_write_mbx(hw, msgbuf, 2);
if (err)
goto out;

err = hw->mbx.ops.read_posted(hw, msgbuf, 2);
err = ixgbevf_poll_mbx(hw, msgbuf, 2);
if (err)
goto out;

Expand Down
5 changes: 5 additions & 0 deletions drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_X550_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 ixgbevf_info ixgbevf_x550em_a_vf_info;

Expand Down Expand Up @@ -491,4 +492,8 @@ void ixgbe_napi_del_all(struct ixgbevf_adapter *adapter);

#define hw_dbg(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_ */
Loading

0 comments on commit c869259

Please sign in to comment.