summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/intel/ixgbevf/mbx.c
diff options
context:
space:
mode:
authorRadoslaw Tyl <radoslawx.tyl@intel.com>2021-06-30 11:15:29 +0300
committerTony Nguyen <anthony.l.nguyen@intel.com>2021-11-17 19:07:42 +0300
commit887a32031a8ae5d9ad805973f28744ebe685c4e5 (patch)
tree618d5020e94a709718cf5d3074443678134b3119 /drivers/net/ethernet/intel/ixgbevf/mbx.c
parent0edbecd5705728e803a56d646194f4ccdef5845f (diff)
downloadlinux-887a32031a8ae5d9ad805973f28744ebe685c4e5.tar.xz
ixgbevf: Improve error handling in mailbox
Add new handling for error codes: IXGBE_ERR_CONFIG - ixgbe_mbx_operations is not correctly set IXGBE_ERR_TIMEOUT - mailbox operation, e.g. poll for message, timeout 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>
Diffstat (limited to 'drivers/net/ethernet/intel/ixgbevf/mbx.c')
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/mbx.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.c b/drivers/net/ethernet/intel/ixgbevf/mbx.c
index 6bc1953263b9..2c3762cb467d 100644
--- a/drivers/net/ethernet/intel/ixgbevf/mbx.c
+++ b/drivers/net/ethernet/intel/ixgbevf/mbx.c
@@ -15,6 +15,9 @@ static s32 ixgbevf_poll_for_msg(struct ixgbe_hw *hw)
struct ixgbe_mbx_info *mbx = &hw->mbx;
int countdown = mbx->timeout;
+ if (!countdown || !mbx->ops.check_for_msg)
+ return IXGBE_ERR_CONFIG;
+
while (countdown && mbx->ops.check_for_msg(hw)) {
countdown--;
udelay(mbx->udelay);
@@ -24,7 +27,7 @@ static s32 ixgbevf_poll_for_msg(struct ixgbe_hw *hw)
if (!countdown)
mbx->timeout = 0;
- return countdown ? 0 : IXGBE_ERR_MBX;
+ return countdown ? 0 : IXGBE_ERR_TIMEOUT;
}
/**
@@ -38,6 +41,9 @@ static s32 ixgbevf_poll_for_ack(struct ixgbe_hw *hw)
struct ixgbe_mbx_info *mbx = &hw->mbx;
int countdown = mbx->timeout;
+ if (!countdown || !mbx->ops.check_for_ack)
+ return IXGBE_ERR_CONFIG;
+
while (countdown && mbx->ops.check_for_ack(hw)) {
countdown--;
udelay(mbx->udelay);
@@ -47,7 +53,7 @@ static s32 ixgbevf_poll_for_ack(struct ixgbe_hw *hw)
if (!countdown)
mbx->timeout = 0;
- return countdown ? 0 : IXGBE_ERR_MBX;
+ return countdown ? 0 : IXGBE_ERR_TIMEOUT;
}
/**
@@ -62,7 +68,7 @@ static s32 ixgbevf_poll_for_ack(struct ixgbe_hw *hw)
static s32 ixgbevf_read_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size)
{
struct ixgbe_mbx_info *mbx = &hw->mbx;
- s32 ret_val = IXGBE_ERR_MBX;
+ s32 ret_val = IXGBE_ERR_CONFIG;
if (!mbx->ops.read)
goto out;
@@ -88,7 +94,7 @@ out:
static s32 ixgbevf_write_posted_mbx(struct ixgbe_hw *hw, u32 *msg, u16 size)
{
struct ixgbe_mbx_info *mbx = &hw->mbx;
- s32 ret_val = IXGBE_ERR_MBX;
+ s32 ret_val = IXGBE_ERR_CONFIG;
/* exit if either we can't write or there isn't a defined timeout */
if (!mbx->ops.write || !mbx->timeout)