net/ice/base: fix MAC write command
authorQi Zhang <qi.z.zhang@intel.com>
Mon, 23 Mar 2020 07:17:55 +0000 (15:17 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 21 Apr 2020 11:57:05 +0000 (13:57 +0200)
The manage MAC write command was implemented in an overly complex way
that actually didn't work, as it wasn't symmetric to the manage MAC
read command, and was feeding bytes out of order to the firmware. Fix
the implementation by just using a simple array to represent the MAC
address when it is being written via firmware command.

Fixes: a90fae1d0755 ("net/ice/base: add admin queue structures and commands")
Cc: stable@dpdk.org
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
drivers/net/ice/base/ice_adminq_cmd.h
drivers/net/ice/base/ice_common.c

index d4c899d..3344481 100644 (file)
@@ -158,13 +158,11 @@ struct ice_aqc_manage_mac_write {
 #define ICE_AQC_MAN_MAC_WR_MC_MAG_EN           BIT(0)
 #define ICE_AQC_MAN_MAC_WR_WOL_LAA_PFR_KEEP    BIT(1)
 #define ICE_AQC_MAN_MAC_WR_S           6
-#define ICE_AQC_MAN_MAC_WR_M           (3 << ICE_AQC_MAN_MAC_WR_S)
+#define ICE_AQC_MAN_MAC_WR_M           MAKEMASK(3, ICE_AQC_MAN_MAC_WR_S)
 #define ICE_AQC_MAN_MAC_UPDATE_LAA     0
-#define ICE_AQC_MAN_MAC_UPDATE_LAA_WOL (BIT(0) << ICE_AQC_MAN_MAC_WR_S)
-       /* High 16 bits of MAC address in big endian order */
-       __be16 sah;
-       /* Low 32 bits of MAC address in big endian order */
-       __be32 sal;
+#define ICE_AQC_MAN_MAC_UPDATE_LAA_WOL BIT(ICE_AQC_MAN_MAC_WR_S)
+       /* byte stream in network order */
+       u8 mac_addr[ETH_ALEN];
        __le32 addr_high;
        __le32 addr_low;
 };
index ed4dfb3..3fdc93c 100644 (file)
@@ -2077,10 +2077,7 @@ ice_aq_manage_mac_write(struct ice_hw *hw, const u8 *mac_addr, u8 flags,
        ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_manage_mac_write);
 
        cmd->flags = flags;
-
-       /* Prep values for flags, sah, sal */
-       cmd->sah = HTONS(*((const u16 *)mac_addr));
-       cmd->sal = HTONL(*((const u32 *)(mac_addr + 2)));
+       ice_memcpy(cmd->mac_addr, mac_addr, ETH_ALEN, ICE_NONDMA_TO_DMA);
 
        return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
 }