Skip to content

Commit

Permalink
net: hns3: Cleanup for endian issue in hns3 driver
Browse files Browse the repository at this point in the history
This patch fixes a lot of endian issues detected by sparse.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yunsheng Lin authored and David S. Miller committed Oct 9, 2017
1 parent d44f9b6 commit a90bb9a
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 109 deletions.
8 changes: 4 additions & 4 deletions drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num)
* which will be use for hardware to write back
*/
ntc = hw->cmq.csq.next_to_use;
opcode = desc[0].opcode;
opcode = le16_to_cpu(desc[0].opcode);
while (handle < num) {
desc_to_use = &hw->cmq.csq.desc[hw->cmq.csq.next_to_use];
*desc_to_use = desc[handle];
Expand All @@ -225,7 +225,7 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num)
* If the command is sync, wait for the firmware to write back,
* if multi descriptors to be sent, use the first one to check
*/
if (HCLGE_SEND_SYNC(desc->flag)) {
if (HCLGE_SEND_SYNC(le16_to_cpu(desc->flag))) {
do {
if (hclge_cmd_csq_done(hw))
break;
Expand All @@ -244,9 +244,9 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num)
pr_debug("Get cmd desc:\n");

if (likely(!hclge_is_special_opcode(opcode)))
desc_ret = desc[handle].retval;
desc_ret = le16_to_cpu(desc[handle].retval);
else
desc_ret = desc[0].retval;
desc_ret = le16_to_cpu(desc[0].retval);

if ((enum hclge_cmd_return_status)desc_ret ==
HCLGE_CMD_EXEC_SUCCESS)
Expand Down
10 changes: 5 additions & 5 deletions drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ struct hclge_rss_input_tuple_cmd {
#define HCLGE_RSS_CFG_TBL_SIZE 16

struct hclge_rss_indirection_table_cmd {
u16 start_table_index;
u16 rss_set_bitmap;
__le16 start_table_index;
__le16 rss_set_bitmap;
u8 rsv[4];
u8 rss_result[HCLGE_RSS_CFG_TBL_SIZE];
};
Expand All @@ -446,7 +446,7 @@ struct hclge_rss_indirection_table_cmd {
#define HCLGE_RSS_TC_SIZE_M GENMASK(14, 12)
#define HCLGE_RSS_TC_VALID_B 15
struct hclge_rss_tc_mode_cmd {
u16 rss_tc_mode[HCLGE_MAX_TC_NUM];
__le16 rss_tc_mode[HCLGE_MAX_TC_NUM];
u8 rsv[8];
};

Expand Down Expand Up @@ -601,7 +601,7 @@ struct hclge_cfg_func_mta_filter_cmd {
#define HCLGE_CFG_MTA_ITEM_IDX_S 0x0
#define HCLGE_CFG_MTA_ITEM_IDX_M GENMASK(11, 0)
struct hclge_cfg_func_mta_item_cmd {
u16 item_idx; /* Only used lowest 12 bit */
__le16 item_idx; /* Only used lowest 12 bit */
u8 accept; /* Only used lowest 1 bit */
u8 rsv[21];
};
Expand Down Expand Up @@ -645,7 +645,7 @@ struct hclge_vlan_filter_pf_cfg_cmd {
};

struct hclge_vlan_filter_vf_cfg_cmd {
u16 vlan_id;
__le16 vlan_id;
u8 resp_code;
u8 rsv;
u8 vlan_cfg;
Expand Down
Loading

0 comments on commit a90bb9a

Please sign in to comment.