net/ixgbe/base: fix firmware command checksum error
authorBeilei Xing <beilei.xing@intel.com>
Thu, 23 Jun 2016 07:22:13 +0000 (15:22 +0800)
committerBruce Richardson <bruce.richardson@intel.com>
Mon, 27 Jun 2016 14:17:52 +0000 (16:17 +0200)
When software sends commands to firmware using the host
slave command interface, firmware fails to receive the
command due to a checksum failed error, as the checksum is
not being correctly set by the driver software.

This patch sets command checksum to the default value of
0xFF, as per the datasheet, therefore the checksum won't
be checked by firmware.

Fixes: 86b8fb293fdf ("ixgbe/base: add sw-firmware sync for resource sharing on X550em_a")
Fixes: 0790adeb5675 ("ixgbe/base: support X550em_a device")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
drivers/net/ixgbe/base/ixgbe_x550.c

index 8a5b1dc..54aab06 100644 (file)
@@ -1041,6 +1041,7 @@ s32 ixgbe_get_phy_token(struct ixgbe_hw *hw)
        token_cmd.hdr.cmd = FW_PHY_TOKEN_REQ_CMD;
        token_cmd.hdr.buf_len = FW_PHY_TOKEN_REQ_LEN;
        token_cmd.hdr.cmd_or_resp.cmd_resv = 0;
+       token_cmd.hdr.checksum = FW_DEFAULT_CHECKSUM;
        token_cmd.port_number = hw->bus.lan_id;
        token_cmd.command_type = FW_PHY_TOKEN_REQ;
        token_cmd.pad = 0;
@@ -1071,6 +1072,7 @@ s32 ixgbe_put_phy_token(struct ixgbe_hw *hw)
        token_cmd.hdr.cmd = FW_PHY_TOKEN_REQ_CMD;
        token_cmd.hdr.buf_len = FW_PHY_TOKEN_REQ_LEN;
        token_cmd.hdr.cmd_or_resp.cmd_resv = 0;
+       token_cmd.hdr.checksum = FW_DEFAULT_CHECKSUM;
        token_cmd.port_number = hw->bus.lan_id;
        token_cmd.command_type = FW_PHY_TOKEN_REL;
        token_cmd.pad = 0;
@@ -1094,23 +1096,24 @@ s32 ixgbe_put_phy_token(struct ixgbe_hw *hw)
  *  @data: Data to write to the register
  **/
 s32 ixgbe_write_iosf_sb_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
-       u32 device_type, u32 data)
+                                 u32 device_type, u32 data)
 {
        struct ixgbe_hic_internal_phy_req write_cmd;
        s32 status;
        UNREFERENCED_1PARAMETER(device_type);
 
+       memset(&write_cmd, 0, sizeof(write_cmd));
        write_cmd.hdr.cmd = FW_INT_PHY_REQ_CMD;
        write_cmd.hdr.buf_len = FW_INT_PHY_REQ_LEN;
+       write_cmd.hdr.checksum = FW_DEFAULT_CHECKSUM;
        write_cmd.port_number = hw->bus.lan_id;
        write_cmd.command_type = FW_INT_PHY_REQ_WRITE;
        write_cmd.address = (u16)reg_addr;
-       write_cmd.rsv1 = 0;
        write_cmd.write_data = data;
-       write_cmd.pad = 0;
 
        status = ixgbe_host_interface_command(hw, (u32 *)&write_cmd,
-               sizeof(write_cmd), IXGBE_HI_COMMAND_TIMEOUT, false);
+                                             sizeof(write_cmd),
+                                             IXGBE_HI_COMMAND_TIMEOUT, false);
 
        return status;
 }
@@ -1124,23 +1127,23 @@ s32 ixgbe_write_iosf_sb_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
  *  @data: Pointer to read data from the register
  **/
 s32 ixgbe_read_iosf_sb_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
-       u32 device_type, u32 *data)
+                                u32 device_type, u32 *data)
 {
        struct ixgbe_hic_internal_phy_req read_cmd;
        s32 status;
        UNREFERENCED_1PARAMETER(device_type);
 
+       memset(&read_cmd, 0, sizeof(read_cmd));
        read_cmd.hdr.cmd = FW_INT_PHY_REQ_CMD;
        read_cmd.hdr.buf_len = FW_INT_PHY_REQ_LEN;
+       read_cmd.hdr.checksum = FW_DEFAULT_CHECKSUM;
        read_cmd.port_number = hw->bus.lan_id;
        read_cmd.command_type = FW_INT_PHY_REQ_READ;
        read_cmd.address = (u16)reg_addr;
-       read_cmd.rsv1 = 0;
-       read_cmd.write_data = 0;
-       read_cmd.pad = 0;
 
        status = ixgbe_host_interface_command(hw, (u32 *)&read_cmd,
-               sizeof(read_cmd), IXGBE_HI_COMMAND_TIMEOUT, true);
+                                             sizeof(read_cmd),
+                                             IXGBE_HI_COMMAND_TIMEOUT, true);
 
        /* Extract the register value from the response. */
        *data = ((struct ixgbe_hic_internal_phy_resp *)&read_cmd)->read_data;