From e429da2a856c8a16de1b766276d787fd794e5249 Mon Sep 17 00:00:00 2001 From: Jiantao Xiao Date: Mon, 7 Aug 2023 09:06:08 +0800 Subject: [PATCH] Revert "net: hns3: fix the imp capability bit cannot exceed 32 bits issue" driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I7ON9Y CVE: NA ---------------------------------------------------------------------- This reverts commit 702c687cf9c1a8da10769f2dd4adb4b97e7b868b. Signed-off-by: Jiantao Xiao --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 3 +-- .../hns3/hns3_common/hclge_comm_cmd.c | 21 +++---------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index 4192e2ff8f88..d24b72da6775 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -30,7 +30,6 @@ #include #include #include -#include #include #define HNAE3_MOD_VERSION "1.0" @@ -422,7 +421,7 @@ struct hnae3_ae_dev { unsigned long hw_err_reset_req; struct hnae3_dev_specs dev_specs; u32 dev_version; - DECLARE_BITMAP(caps, HNAE3_DEV_CAPS_MAX_NUM); + unsigned long caps[BITS_TO_LONGS(HNAE3_DEV_CAPS_MAX_NUM)]; void *priv; }; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.c index eb8506f481dc..bd7077fdcd30 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.c @@ -172,20 +172,6 @@ static const struct hclge_comm_caps_bit_map hclge_vf_cmd_caps[] = { {HCLGE_COMM_CAP_GRO_B, HNAE3_DEV_SUPPORT_GRO_B}, }; -static void -hclge_comm_capability_to_bitmap(unsigned long *bitmap, __le32 *caps) -{ - const unsigned int words = HCLGE_COMM_QUERY_CAP_LENGTH; - u32 val[HCLGE_COMM_QUERY_CAP_LENGTH]; - unsigned int i; - - for (i = 0; i < words; i++) - val[i] = __le32_to_cpu(caps[i]); - - bitmap_from_arr32(bitmap, val, - HCLGE_COMM_QUERY_CAP_LENGTH * BITS_PER_TYPE(u32)); -} - static void hclge_comm_parse_capability(struct hnae3_ae_dev *ae_dev, bool is_pf, struct hclge_comm_query_version_cmd *cmd) @@ -194,12 +180,11 @@ hclge_comm_parse_capability(struct hnae3_ae_dev *ae_dev, bool is_pf, is_pf ? hclge_pf_cmd_caps : hclge_vf_cmd_caps; u32 size = is_pf ? ARRAY_SIZE(hclge_pf_cmd_caps) : ARRAY_SIZE(hclge_vf_cmd_caps); - DECLARE_BITMAP(caps, HCLGE_COMM_QUERY_CAP_LENGTH * BITS_PER_TYPE(u32)); - u32 i; + u32 caps, i; - hclge_comm_capability_to_bitmap(caps, cmd->caps); + caps = __le32_to_cpu(cmd->caps[0]); for (i = 0; i < size; i++) - if (test_bit(caps_map[i].imp_bit, caps)) + if (hnae3_get_bit(caps, caps_map[i].imp_bit)) set_bit(caps_map[i].local_bit, ae_dev->caps); } -- GitLab