Propagate return value when trying to set the maximum packet length. A
PF driver could return a NACK for this request, and the VF driver will
need to know this.

Signed-off-by: Xiao Wang <xiao.w.wang at intel.com>
---
 drivers/net/ixgbe/base/ixgbe_vf.c | 24 +++++++++++++++++-------
 drivers/net/ixgbe/base/ixgbe_vf.h |  2 +-
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c 
b/drivers/net/ixgbe/base/ixgbe_vf.c
index 20a739c..69805f7 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_vf.c
@@ -323,15 +323,16 @@ STATIC s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 
*mc_addr)
        return vector;
 }

-STATIC void ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw,
-                                       u32 *msg, u16 size)
+STATIC s32 ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw, u32 *msg,
+                                     u32 *retmsg, u16 size)
 {
        struct ixgbe_mbx_info *mbx = &hw->mbx;
-       u32 retmsg[IXGBE_VFMAILBOX_SIZE];
        s32 retval = mbx->ops.write_posted(hw, msg, size, 0);

-       if (!retval)
-               mbx->ops.read_posted(hw, retmsg, size, 0);
+       if (retval)
+               return retval;
+
+       return mbx->ops.read_posted(hw, retmsg, size, 0);
 }

 /**
@@ -665,13 +666,22 @@ out:
  *  @hw: pointer to the HW structure
  *  @max_size: value to assign to max frame size
  **/
-void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size)
+s32 ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size)
 {
        u32 msgbuf[2];
+       s32 retval;

        msgbuf[0] = IXGBE_VF_SET_LPE;
        msgbuf[1] = max_size;
-       ixgbevf_write_msg_read_ack(hw, msgbuf, 2);
+
+       retval = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
+       if (retval)
+               return retval;
+       if ((msgbuf[0] & IXGBE_VF_SET_LPE) &&
+           (msgbuf[0] & IXGBE_VT_MSGTYPE_NACK))
+               return IXGBE_ERR_MBX;
+
+       return 0;
 }

 /**
diff --git a/drivers/net/ixgbe/base/ixgbe_vf.h 
b/drivers/net/ixgbe/base/ixgbe_vf.h
index 624a97d..d288f31 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.h
+++ b/drivers/net/ixgbe/base/ixgbe_vf.h
@@ -134,7 +134,7 @@ s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 
*mc_addr_list,
 s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode);
 s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
                      bool vlan_on, bool vlvf_bypass);
-void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
+s32 ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
 int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
 int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
                       unsigned int *default_tc);
-- 
1.9.3

Reply via email to