net: hns3: Modify inconsistent bit mask macros
authorJian Shen <shenjian15@huawei.com>
Thu, 19 Jul 2018 14:47:03 +0000 (15:47 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 21 Jul 2018 15:44:23 +0000 (08:44 -0700)
Use BIT() and GENMASK() to convert the bit mask, modify
the inconsistent ones, and remove useless ones.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h

index 219ffc746260fe5d8011dfa6c237337167302d33..ec7b8d74b941f144cb223f8497b268a9bb9d955c 100644 (file)
@@ -75,19 +75,12 @@ struct hclge_cmq {
        enum hclge_cmd_status last_status;
 };
 
-#define HCLGE_CMD_FLAG_IN_VALID_SHIFT  0
-#define HCLGE_CMD_FLAG_OUT_VALID_SHIFT 1
-#define HCLGE_CMD_FLAG_NEXT_SHIFT      2
-#define HCLGE_CMD_FLAG_WR_OR_RD_SHIFT  3
-#define HCLGE_CMD_FLAG_NO_INTR_SHIFT   4
-#define HCLGE_CMD_FLAG_ERR_INTR_SHIFT  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)
+#define HCLGE_CMD_FLAG_IN      BIT(0)
+#define HCLGE_CMD_FLAG_OUT     BIT(1)
+#define HCLGE_CMD_FLAG_NEXT    BIT(2)
+#define HCLGE_CMD_FLAG_WR      BIT(3)
+#define HCLGE_CMD_FLAG_NO_INTR BIT(4)
+#define HCLGE_CMD_FLAG_ERR_INTR        BIT(5)
 
 enum hclge_opcode_type {
        /* Generic commands */
@@ -379,7 +372,7 @@ struct hclge_pf_res_cmd {
        __le16 msixcap_localid_ba_nic;
        __le16 msixcap_localid_ba_rocee;
 #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_own_fun_number;
        __le32 rsv[3];
@@ -468,8 +461,8 @@ struct hclge_rss_tc_mode_cmd {
        u8 rsv[8];
 };
 
-#define HCLGE_LINK_STS_B       0
-#define HCLGE_LINK_STATUS      BIT(HCLGE_LINK_STS_B)
+#define HCLGE_LINK_STATUS_UP_B 0
+#define HCLGE_LINK_STATUS_UP_M BIT(HCLGE_LINK_STATUS_UP_B)
 struct hclge_link_status_cmd {
        u8 status;
        u8 rsv[23];
index de36dfb75feede843ebd1f6c75e450ddf156cd25..e0b617c8628f7436a900fc54a5c2dba6aff42d21 100644 (file)
@@ -2349,7 +2349,7 @@ static int hclge_get_mac_link_status(struct hclge_dev *hdev)
        }
 
        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;
 }
index aeae1baa4e6f00522ad34115418c5f09d42923ed..a1ed6df444f9b9c5895c43291d4396930dbb187a 100644 (file)
@@ -40,7 +40,7 @@
 #define HCLGE_RSS_HASH_ALGO_TOEPLITZ   0
 #define HCLGE_RSS_HASH_ALGO_SIMPLE     1
 #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 \
        (HCLGE_RSS_IND_TBL_SIZE / HCLGE_RSS_CFG_TBL_SIZE)