Commit c79301d8 authored by Jian Shen's avatar Jian Shen Committed by David S. Miller

net: hns3: Modify inconsistent bit mask macros

Use BIT() and GENMASK() to convert the bit mask, modify
the inconsistent ones, and remove useless ones.
Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f8a91784
...@@ -75,19 +75,12 @@ struct hclge_cmq { ...@@ -75,19 +75,12 @@ struct hclge_cmq {
enum hclge_cmd_status last_status; enum hclge_cmd_status last_status;
}; };
#define HCLGE_CMD_FLAG_IN_VALID_SHIFT 0 #define HCLGE_CMD_FLAG_IN BIT(0)
#define HCLGE_CMD_FLAG_OUT_VALID_SHIFT 1 #define HCLGE_CMD_FLAG_OUT BIT(1)
#define HCLGE_CMD_FLAG_NEXT_SHIFT 2 #define HCLGE_CMD_FLAG_NEXT BIT(2)
#define HCLGE_CMD_FLAG_WR_OR_RD_SHIFT 3 #define HCLGE_CMD_FLAG_WR BIT(3)
#define HCLGE_CMD_FLAG_NO_INTR_SHIFT 4 #define HCLGE_CMD_FLAG_NO_INTR BIT(4)
#define HCLGE_CMD_FLAG_ERR_INTR_SHIFT 5 #define HCLGE_CMD_FLAG_ERR_INTR BIT(5)
#define HCLGE_CMD_FLAG_IN BIT(HCLGE_CMD_FLAG_IN_VALID_SHIFT)
#define HCLGE_CMD_FLAG_OUT BIT(HCLGE_CMD_FLAG_OUT_VALID_SHIFT)
#define HCLGE_CMD_FLAG_NEXT BIT(HCLGE_CMD_FLAG_NEXT_SHIFT)
#define HCLGE_CMD_FLAG_WR BIT(HCLGE_CMD_FLAG_WR_OR_RD_SHIFT)
#define HCLGE_CMD_FLAG_NO_INTR BIT(HCLGE_CMD_FLAG_NO_INTR_SHIFT)
#define HCLGE_CMD_FLAG_ERR_INTR BIT(HCLGE_CMD_FLAG_ERR_INTR_SHIFT)
enum hclge_opcode_type { enum hclge_opcode_type {
/* Generic commands */ /* Generic commands */
...@@ -379,7 +372,7 @@ struct hclge_pf_res_cmd { ...@@ -379,7 +372,7 @@ struct hclge_pf_res_cmd {
__le16 msixcap_localid_ba_nic; __le16 msixcap_localid_ba_nic;
__le16 msixcap_localid_ba_rocee; __le16 msixcap_localid_ba_rocee;
#define HCLGE_PF_VEC_NUM_S 0 #define HCLGE_PF_VEC_NUM_S 0
#define HCLGE_PF_VEC_NUM_M (0xff << HCLGE_PF_VEC_NUM_S) #define HCLGE_PF_VEC_NUM_M GENMASK(7, 0)
__le16 pf_intr_vector_number; __le16 pf_intr_vector_number;
__le16 pf_own_fun_number; __le16 pf_own_fun_number;
__le32 rsv[3]; __le32 rsv[3];
...@@ -468,8 +461,8 @@ struct hclge_rss_tc_mode_cmd { ...@@ -468,8 +461,8 @@ struct hclge_rss_tc_mode_cmd {
u8 rsv[8]; u8 rsv[8];
}; };
#define HCLGE_LINK_STS_B 0 #define HCLGE_LINK_STATUS_UP_B 0
#define HCLGE_LINK_STATUS BIT(HCLGE_LINK_STS_B) #define HCLGE_LINK_STATUS_UP_M BIT(HCLGE_LINK_STATUS_UP_B)
struct hclge_link_status_cmd { struct hclge_link_status_cmd {
u8 status; u8 status;
u8 rsv[23]; u8 rsv[23];
......
...@@ -2349,7 +2349,7 @@ static int hclge_get_mac_link_status(struct hclge_dev *hdev) ...@@ -2349,7 +2349,7 @@ static int hclge_get_mac_link_status(struct hclge_dev *hdev)
} }
req = (struct hclge_link_status_cmd *)desc.data; req = (struct hclge_link_status_cmd *)desc.data;
link_status = req->status & HCLGE_LINK_STATUS; link_status = req->status & HCLGE_LINK_STATUS_UP_M;
return !!link_status; return !!link_status;
} }
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#define HCLGE_RSS_HASH_ALGO_TOEPLITZ 0 #define HCLGE_RSS_HASH_ALGO_TOEPLITZ 0
#define HCLGE_RSS_HASH_ALGO_SIMPLE 1 #define HCLGE_RSS_HASH_ALGO_SIMPLE 1
#define HCLGE_RSS_HASH_ALGO_SYMMETRIC 2 #define HCLGE_RSS_HASH_ALGO_SYMMETRIC 2
#define HCLGE_RSS_HASH_ALGO_MASK 0xf #define HCLGE_RSS_HASH_ALGO_MASK GENMASK(3, 0)
#define HCLGE_RSS_CFG_TBL_NUM \ #define HCLGE_RSS_CFG_TBL_NUM \
(HCLGE_RSS_IND_TBL_SIZE / HCLGE_RSS_CFG_TBL_SIZE) (HCLGE_RSS_IND_TBL_SIZE / HCLGE_RSS_CFG_TBL_SIZE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment