Skip to content

Commit c642697

Browse files
etantilovJeff Kirsher
authored andcommitted
ixgbevf: fix incorrect MAC address on load
The PF driver was only receiving the first 4 bytes of the MAC due to an incorrect size parameter for ixgbevf_write_msg_read_ack() in ixgbevf_set_rar_vf(). Correct the size by calculating it on a fly for all instances where we call ixgbevf_write_msg_read_ack() Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 27b23f9 commit c642697

File tree

1 file changed

+14
-7
lines changed
  • drivers/net/ethernet/intel/ixgbevf

1 file changed

+14
-7
lines changed

drivers/net/ethernet/intel/ixgbevf/vf.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ static s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
284284
if (addr)
285285
ether_addr_copy(msg_addr, addr);
286286

287-
ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 3);
287+
ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf,
288+
sizeof(msgbuf) / sizeof(u32));
288289
if (!ret_val) {
289290
msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
290291

@@ -441,7 +442,8 @@ static s32 ixgbevf_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr,
441442
msgbuf[0] = IXGBE_VF_SET_MAC_ADDR;
442443
ether_addr_copy(msg_addr, addr);
443444

444-
ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
445+
ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf,
446+
sizeof(msgbuf) / sizeof(u32));
445447

446448
msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
447449

@@ -551,7 +553,8 @@ static s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
551553
msgbuf[0] = IXGBE_VF_UPDATE_XCAST_MODE;
552554
msgbuf[1] = xcast_mode;
553555

554-
err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
556+
err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf,
557+
sizeof(msgbuf) / sizeof(u32));
555558
if (err)
556559
return err;
557560

@@ -588,7 +591,8 @@ static s32 ixgbevf_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
588591
/* Setting the 8 bit field MSG INFO to TRUE indicates "add" */
589592
msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT;
590593

591-
err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
594+
err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf,
595+
sizeof(msgbuf) / sizeof(u32));
592596
if (err)
593597
goto mbx_err;
594598

@@ -791,7 +795,8 @@ static s32 ixgbevf_set_rlpml_vf(struct ixgbe_hw *hw, u16 max_size)
791795
msgbuf[0] = IXGBE_VF_SET_LPE;
792796
msgbuf[1] = max_size;
793797

794-
ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
798+
ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf,
799+
sizeof(msgbuf) / sizeof(u32));
795800
if (ret_val)
796801
return ret_val;
797802
if ((msgbuf[0] & IXGBE_VF_SET_LPE) &&
@@ -837,7 +842,8 @@ static int ixgbevf_negotiate_api_version_vf(struct ixgbe_hw *hw, int api)
837842
msg[1] = api;
838843
msg[2] = 0;
839844

840-
err = ixgbevf_write_msg_read_ack(hw, msg, msg, 3);
845+
err = ixgbevf_write_msg_read_ack(hw, msg, msg,
846+
sizeof(msg) / sizeof(u32));
841847
if (!err) {
842848
msg[0] &= ~IXGBE_VT_MSGTYPE_CTS;
843849

@@ -887,7 +893,8 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
887893
msg[0] = IXGBE_VF_GET_QUEUE;
888894
msg[1] = msg[2] = msg[3] = msg[4] = 0;
889895

890-
err = ixgbevf_write_msg_read_ack(hw, msg, msg, 5);
896+
err = ixgbevf_write_msg_read_ack(hw, msg, msg,
897+
sizeof(msg) / sizeof(u32));
891898
if (!err) {
892899
msg[0] &= ~IXGBE_VT_MSGTYPE_CTS;
893900

0 commit comments

Comments
 (0)