From nobody Thu Oct 9 06:07:54 2025 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEE9517A305; Thu, 19 Jun 2025 14:48:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344496; cv=none; b=tLguDJwvRwNsGVP1btf29MPsVo1r7Ea/iECcOfGBVfQ7ms/TkyDEnTNwqgjt6uiEghGYLAmH596hFfRTirGupEkjVgrBYLA5q37tDtRG6IUc4qUuNTwWYP4lFoeff9yQHJxa1ZuANXkDjgryTWC0rTlyH44y7PfvmugXPj6EA9A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344496; c=relaxed/simple; bh=Fes2A/ORnekr5nBCW52fV6M/20Ly4jSsrXiQGz/y1LY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V5gYgiEdVBvoa3jxRsUddnF9GvHhqwfFgrylEQWURy1/pffmSFGCVOtjqw/RzsYrGOzyvb9q66EWr0HWmL82BT4JObE9HcbFMRKTFIU4/y+QxGQ2+TyZopEJH+jSaBO9r22O9aR/ADulo+8RjTsN7xU7ZfnRlgd3TsXGELasAMA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4bNNh80kkDz28fRW; Thu, 19 Jun 2025 22:45:44 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id 5E7A21A016C; Thu, 19 Jun 2025 22:48:09 +0800 (CST) Received: from localhost.localdomain (10.90.31.46) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 19 Jun 2025 22:48:08 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , , , , Subject: [PATCH V3 net-next 1/8] net: hns3: fix spelling mistake "reg_um" -> "reg_num" Date: Thu, 19 Jun 2025 22:40:50 +0800 Message-ID: <20250619144057.2587576-2-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20250619144057.2587576-1-shaojijie@huawei.com> References: <20250619144057.2587576-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" There are spelling mistakes in hclgevf_get_regs. Fix them. Signed-off-by: Jijie Shao Reviewed-by: Simon Horman --- .../hisilicon/hns3/hns3vf/hclgevf_regs.c | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_regs.c b/dr= ivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_regs.c index 7d9d9dbc7560..9de01e344e27 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_regs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_regs.c @@ -127,37 +127,38 @@ void hclgevf_get_regs(struct hnae3_handle *handle, u3= 2 *version, =20 struct hclgevf_dev *hdev =3D hclgevf_ae_get_hdev(handle); struct hnae3_queue *tqp; - int i, j, reg_um; + int i, j, reg_num; u32 *reg =3D data; =20 *version =3D hdev->fw_version; reg +=3D hclgevf_reg_get_header(reg); =20 /* fetching per-VF registers values from VF PCIe register space */ - reg_um =3D ARRAY_SIZE(cmdq_reg_addr_list); - reg +=3D hclgevf_reg_get_tlv(HCLGEVF_REG_TAG_CMDQ, reg_um, reg); - for (i =3D 0; i < reg_um; i++) + reg_num =3D ARRAY_SIZE(cmdq_reg_addr_list); + reg +=3D hclgevf_reg_get_tlv(HCLGEVF_REG_TAG_CMDQ, reg_num, reg); + for (i =3D 0; i < reg_num; i++) *reg++ =3D hclgevf_read_dev(&hdev->hw, cmdq_reg_addr_list[i]); =20 - reg_um =3D ARRAY_SIZE(common_reg_addr_list); - reg +=3D hclgevf_reg_get_tlv(HCLGEVF_REG_TAG_COMMON, reg_um, reg); - for (i =3D 0; i < reg_um; i++) + reg_num =3D ARRAY_SIZE(common_reg_addr_list); + reg +=3D hclgevf_reg_get_tlv(HCLGEVF_REG_TAG_COMMON, reg_num, reg); + for (i =3D 0; i < reg_num; i++) *reg++ =3D hclgevf_read_dev(&hdev->hw, common_reg_addr_list[i]); =20 - reg_um =3D ARRAY_SIZE(ring_reg_addr_list); + reg_num =3D ARRAY_SIZE(ring_reg_addr_list); for (j =3D 0; j < hdev->num_tqps; j++) { - reg +=3D hclgevf_reg_get_tlv(HCLGEVF_REG_TAG_RING, reg_um, reg); + reg +=3D hclgevf_reg_get_tlv(HCLGEVF_REG_TAG_RING, reg_num, reg); tqp =3D &hdev->htqp[j].q; - for (i =3D 0; i < reg_um; i++) + for (i =3D 0; i < reg_num; i++) *reg++ =3D readl_relaxed(tqp->io_base - HCLGEVF_TQP_REG_OFFSET + ring_reg_addr_list[i]); } =20 - reg_um =3D ARRAY_SIZE(tqp_intr_reg_addr_list); + reg_num =3D ARRAY_SIZE(tqp_intr_reg_addr_list); for (j =3D 0; j < hdev->num_msi_used - 1; j++) { - reg +=3D hclgevf_reg_get_tlv(HCLGEVF_REG_TAG_TQP_INTR, reg_um, reg); - for (i =3D 0; i < reg_um; i++) + reg +=3D hclgevf_reg_get_tlv(HCLGEVF_REG_TAG_TQP_INTR, + reg_num, reg); + for (i =3D 0; i < reg_num; i++) *reg++ =3D hclgevf_read_dev(&hdev->hw, tqp_intr_reg_addr_list[i] + HCLGEVF_RING_INT_REG_OFFSET * j); --=20 2.33.0 From nobody Thu Oct 9 06:07:54 2025 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F7BDF9DA; Thu, 19 Jun 2025 14:48:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.255 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344496; cv=none; b=YQh0RPLOCNeikTtfxRTJQMc8gd+9U20jrKm59TQIlQIw9I+p5s+2v5lJ5OriYoQgNBa5Qlz8uzp9VK+KwenA4JgEHx1gDlLNJUD+TbY/MquZbpAw0VP6glMoiZXvkO1wmpxZR9kTt1rSxKgBBqXm8IsLuMkA6uN+0CRS2az2Is4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344496; c=relaxed/simple; bh=VafI/ydjM/CDkBzbSpdkdFySgh5uRoRljLxJgY8oPp4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iEEhzbAkigfhs1wOkCfg0beUR96jD4dhTWS+1n0I08M8LnPo5pfOJjr4PBcaatY7ANBb34iX7nZJjmxbXRejXsB6AOQHDnxZZNDFCNB+ETa/U3gHOGnwledI9O9PItzZdZfLpHtYJUVBQVJ2ALJppUlCIw7RJ+mLSk7IppvbXSk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.255 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4bNNhN6mMbz1d1lC; Thu, 19 Jun 2025 22:45:56 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id F0D01180B6A; Thu, 19 Jun 2025 22:48:09 +0800 (CST) Received: from localhost.localdomain (10.90.31.46) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 19 Jun 2025 22:48:09 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , , , , Subject: [PATCH V3 net-next 2/8] net: hns3: use hns3_get_ae_dev() helper to reduce the unnecessary middle layer conversion Date: Thu, 19 Jun 2025 22:40:51 +0800 Message-ID: <20250619144057.2587576-3-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20250619144057.2587576-1-shaojijie@huawei.com> References: <20250619144057.2587576-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" There are too many indirection layers in the HNS3 driver code. This issue was previously discussed with the maintainer, who suggested adding a helper function to fix the issue. In fact, the hns3_get_ae_dev() helper is already defined and can fix this issue. This patch uses hns3_get_ae_dev() helper to reduce the unnecessary middle layer conversion. Apply it to the whole HNS3 driver. The former discusstion can be checked from the link. Link: https://patchwork.kernel.org/project/netdevbpf/patch/20230310081404.9= 47-1-lanhao@huawei.com/ Signed-off-by: Jijie Shao Reviewed-by: Michal Swiatkowski --- ChangeLog: v1 -> v2: - Change commit message and title, suggested by Michal Swiatkowski. v1: https://lore.kernel.org/all/20250612021317.1487943-1-shaojijie@huawei= .com/ --- .../ethernet/hisilicon/hns3/hns3_debugfs.c | 8 ++--- .../net/ethernet/hisilicon/hns3/hns3_enet.c | 12 +++---- .../ethernet/hisilicon/hns3/hns3_ethtool.c | 36 +++++++++---------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/n= et/ethernet/hisilicon/hns3/hns3_debugfs.c index 4e5d8bc39a1b..4f6ed7c7ee68 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c @@ -684,7 +684,7 @@ static int hns3_dbg_rx_queue_info(struct hnae3_handle *= h, char *buf, int len) { char data_str[ARRAY_SIZE(rx_queue_info_items)][HNS3_DBG_DATA_STR_LEN]; - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(h->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(h); char *result[ARRAY_SIZE(rx_queue_info_items)]; struct hns3_nic_priv *priv =3D h->priv; char content[HNS3_DBG_INFO_LEN]; @@ -789,7 +789,7 @@ static int hns3_dbg_tx_queue_info(struct hnae3_handle *= h, char *buf, int len) { char data_str[ARRAY_SIZE(tx_queue_info_items)][HNS3_DBG_DATA_STR_LEN]; - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(h->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(h); char *result[ARRAY_SIZE(tx_queue_info_items)]; struct hns3_nic_priv *priv =3D h->priv; char content[HNS3_DBG_INFO_LEN]; @@ -1034,7 +1034,7 @@ static int hns3_dbg_tx_bd_info(struct hns3_dbg_data *= d, char *buf, int len) static void hns3_dbg_dev_caps(struct hnae3_handle *h, char *buf, int len, int *pos) { - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(h->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(h); unsigned long *caps =3D ae_dev->caps; u32 i, state; =20 @@ -1364,7 +1364,7 @@ hns3_dbg_common_file_init(struct hnae3_handle *handle= , u32 cmd) =20 int hns3_dbg_init(struct hnae3_handle *handle) { - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(handle->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); const char *name =3D pci_name(handle->pdev); int ret; u32 i; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/= ethernet/hisilicon/hns3/hns3_enet.c index 5c8c62ea6ac0..6babc636145b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -547,9 +547,9 @@ void hns3_set_vector_coalesce_rx_ql(struct hns3_enet_tq= p_vector *tqp_vector, static void hns3_vector_coalesce_init(struct hns3_enet_tqp_vector *tqp_vec= tor, struct hns3_nic_priv *priv) { - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(priv->ae_handle->pdev); struct hns3_enet_coalesce *tx_coal =3D &tqp_vector->tx_group.coal; struct hns3_enet_coalesce *rx_coal =3D &tqp_vector->rx_group.coal; + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(priv->ae_handle); struct hns3_enet_coalesce *ptx_coal =3D &priv->tx_coal; struct hns3_enet_coalesce *prx_coal =3D &priv->rx_coal; =20 @@ -1304,7 +1304,7 @@ static int hns3_get_l4_protocol(struct sk_buff *skb, = u8 *ol4_proto, static bool hns3_tunnel_csum_bug(struct sk_buff *skb) { struct hns3_nic_priv *priv =3D netdev_priv(skb->dev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(priv->ae_handle->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(priv->ae_handle); union l4_hdr_info l4; =20 /* device version above V3(include V3), the hardware can @@ -1504,7 +1504,7 @@ static int hns3_handle_vtags(struct hns3_enet_ring *t= x_ring, * VLAN enabled, only one VLAN header is allowed in skb, otherwise it * will cause RAS error. */ - ae_dev =3D pci_get_drvdata(handle->pdev); + ae_dev =3D hns3_get_ae_dev(handle); if (unlikely(skb_vlan_tagged_multi(skb) && ae_dev->dev_version <=3D HNAE3_DEVICE_VERSION_V2 && handle->port_base_vlan_state =3D=3D @@ -4747,7 +4747,7 @@ static int hns3_nic_init_vector_data(struct hns3_nic_= priv *priv) =20 static void hns3_nic_init_coal_cfg(struct hns3_nic_priv *priv) { - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(priv->ae_handle->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(priv->ae_handle); struct hns3_enet_coalesce *tx_coal =3D &priv->tx_coal; struct hns3_enet_coalesce *rx_coal =3D &priv->rx_coal; =20 @@ -5226,7 +5226,7 @@ static void hns3_info_show(struct hns3_nic_priv *priv) static void hns3_set_cq_period_mode(struct hns3_nic_priv *priv, enum dim_cq_period_mode mode, bool is_tx) { - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(priv->ae_handle->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(priv->ae_handle); struct hnae3_handle *handle =3D priv->ae_handle; int i; =20 @@ -5264,7 +5264,7 @@ void hns3_cq_period_mode_init(struct hns3_nic_priv *p= riv, =20 static void hns3_state_init(struct hnae3_handle *handle) { - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(handle->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); struct net_device *netdev =3D handle->kinfo.netdev; struct hns3_nic_priv *priv =3D netdev_priv(netdev); =20 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/n= et/ethernet/hisilicon/hns3/hns3_ethtool.c index 6715222aeb66..ae220f49df64 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -86,7 +86,7 @@ static int hns3_get_sset_count(struct net_device *netdev,= int stringset); static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bo= ol en) { struct hnae3_handle *h =3D hns3_get_handle(ndev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(h->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(h); int ret; =20 if (!h->ae_algo->ops->set_loopback || @@ -171,7 +171,7 @@ static void hns3_lp_setup_skb(struct sk_buff *skb) * the purpose of mac or serdes selftest. */ handle =3D hns3_get_handle(ndev); - ae_dev =3D pci_get_drvdata(handle->pdev); + ae_dev =3D hns3_get_ae_dev(handle); if (ae_dev->dev_version < HNAE3_DEVICE_VERSION_V2) ethh->h_dest[5] +=3D HNS3_NIC_LB_DST_MAC_ADDR; eth_zero_addr(ethh->h_source); @@ -692,7 +692,7 @@ static void hns3_get_pauseparam(struct net_device *netd= ev, struct ethtool_pauseparam *param) { struct hnae3_handle *h =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(h->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(h); =20 if (!test_bit(HNAE3_DEV_SUPPORT_PAUSE_B, ae_dev->caps)) return; @@ -706,7 +706,7 @@ static int hns3_set_pauseparam(struct net_device *netde= v, struct ethtool_pauseparam *param) { struct hnae3_handle *h =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(h->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(h); =20 if (!test_bit(HNAE3_DEV_SUPPORT_PAUSE_B, ae_dev->caps)) return -EOPNOTSUPP; @@ -751,7 +751,7 @@ static int hns3_get_link_ksettings(struct net_device *n= etdev, struct ethtool_link_ksettings *cmd) { struct hnae3_handle *h =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(h->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(h); const struct hnae3_ae_ops *ops; u8 module_type; u8 media_type; @@ -861,7 +861,7 @@ static int hns3_set_link_ksettings(struct net_device *n= etdev, const struct ethtool_link_ksettings *cmd) { struct hnae3_handle *handle =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(handle->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; int ret; =20 @@ -932,7 +932,7 @@ static u32 hns3_get_rss_key_size(struct net_device *net= dev) static u32 hns3_get_rss_indir_size(struct net_device *netdev) { struct hnae3_handle *h =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(h->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(h); =20 return ae_dev->dev_specs.rss_ind_tbl_size; } @@ -954,7 +954,7 @@ static int hns3_set_rss(struct net_device *netdev, struct netlink_ext_ack *extack) { struct hnae3_handle *h =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(h->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(h); =20 if (!h->ae_algo->ops->set_rss) return -EOPNOTSUPP; @@ -1024,7 +1024,7 @@ static int hns3_set_reset(struct net_device *netdev, = u32 *flags) { enum hnae3_reset_type rst_type =3D HNAE3_NONE_RESET; struct hnae3_handle *h =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(h->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(h); const struct hnae3_ae_ops *ops =3D h->ae_algo->ops; const struct hns3_reset_type_map *rst_type_map; enum ethtool_reset_flags rst_flags; @@ -1189,7 +1189,7 @@ static int hns3_set_tx_push(struct net_device *netdev= , u32 tx_push) { struct hns3_nic_priv *priv =3D netdev_priv(netdev); struct hnae3_handle *h =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(h->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(h); u32 old_state =3D test_bit(HNS3_NIC_STATE_TX_PUSH_ENABLE, &priv->state); =20 if (!test_bit(HNAE3_DEV_SUPPORT_TX_PUSH_B, ae_dev->caps) && tx_push) @@ -1377,7 +1377,7 @@ static int hns3_check_gl_coalesce_para(struct net_dev= ice *netdev, struct ethtool_coalesce *cmd) { struct hnae3_handle *handle =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(handle->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); u32 rx_gl, tx_gl; =20 if (cmd->rx_coalesce_usecs > ae_dev->dev_specs.max_int_gl) { @@ -1449,7 +1449,7 @@ static int hns3_check_ql_coalesce_param(struct net_de= vice *netdev, struct ethtool_coalesce *cmd) { struct hnae3_handle *handle =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(handle->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); =20 if ((cmd->tx_max_coalesced_frames || cmd->rx_max_coalesced_frames) && !ae_dev->dev_specs.int_ql_max) { @@ -1473,7 +1473,7 @@ hns3_check_cqe_coalesce_param(struct net_device *netd= ev, struct kernel_ethtool_coalesce *kernel_coal) { struct hnae3_handle *handle =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(handle->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); =20 if ((kernel_coal->use_cqe_mode_tx || kernel_coal->use_cqe_mode_rx) && !hnae3_ae_dev_cq_supported(ae_dev)) { @@ -1649,7 +1649,7 @@ static void hns3_get_fec_stats(struct net_device *net= dev, struct ethtool_fec_stats *fec_stats) { struct hnae3_handle *handle =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(handle->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; =20 if (!hnae3_ae_dev_fec_stats_supported(ae_dev) || !ops->get_fec_stats) @@ -1700,7 +1700,7 @@ static int hns3_get_fecparam(struct net_device *netde= v, struct ethtool_fecparam *fec) { struct hnae3_handle *handle =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(handle->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; u8 fec_ability; u8 fec_mode; @@ -1725,7 +1725,7 @@ static int hns3_set_fecparam(struct net_device *netde= v, struct ethtool_fecparam *fec) { struct hnae3_handle *handle =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(handle->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; u32 fec_mode; =20 @@ -1747,7 +1747,7 @@ static int hns3_get_module_info(struct net_device *ne= tdev, #define HNS3_SFF_8636_V1_3 0x03 =20 struct hnae3_handle *handle =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(handle->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; struct hns3_sfp_type sfp_type; int ret; @@ -1797,7 +1797,7 @@ static int hns3_get_module_eeprom(struct net_device *= netdev, struct ethtool_eeprom *ee, u8 *data) { struct hnae3_handle *handle =3D hns3_get_handle(netdev); - struct hnae3_ae_dev *ae_dev =3D pci_get_drvdata(handle->pdev); + struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; =20 if (ae_dev->dev_version < HNAE3_DEVICE_VERSION_V2 || --=20 2.33.0 From nobody Thu Oct 9 06:07:54 2025 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F1101C8611; Thu, 19 Jun 2025 14:48:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344496; cv=none; b=YihapO4DhVoVRzf0PDaN7fNsY/FzH7e8KVZxmp81NkFS+3avXhbjVmhDKNs28meJFGdNiv3cpyrEK6lgywd5fHVkENWGyNc0OqKQr2a0E4r3SnaaZ0IEo3S8XYoCVFQuk4e3xO3+JcWHPNzqZbUmaiNBX38W9uizZkp3LEvXzY8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344496; c=relaxed/simple; bh=BC8wGo84x6qU0PooSwIavmRLz/LXKJ+pP6E7c6jV0lo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PSoXffhkuxLKhmyspPYQ9fjjiiQz3No7EHCGphMNlqd+Ezabgxe8yQIhGgaJkHhSi3AKmc1CJxayd6cr/mTXKTfi7ORIdPH/28N6X8Pt1AWPFzQMr6xSwPGXPWybKcqakHUl2uzdS6uyjRt3x/NxeGkJI5kagut/ghIUrYLcQHY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4bNNdg6vfBz10XT1; Thu, 19 Jun 2025 22:43:35 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id A9B46180087; Thu, 19 Jun 2025 22:48:10 +0800 (CST) Received: from localhost.localdomain (10.90.31.46) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 19 Jun 2025 22:48:09 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , , , , Subject: [PATCH V3 net-next 3/8] net: hns3: use hns3_get_ops() helper to reduce the unnecessary middle layer conversion Date: Thu, 19 Jun 2025 22:40:52 +0800 Message-ID: <20250619144057.2587576-4-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20250619144057.2587576-1-shaojijie@huawei.com> References: <20250619144057.2587576-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" There are too many indirection layers in the HNS3 driver code, This issue was previously discussed with the maintainer, who suggested adding a helper function to fix the issue. In fact, the hns3_get_ops() helper is already defined and can fix this issue. This patch uses hns3_get_ops() helper to reduce the unnecessary middle layer conversion. Apply it to the whole HNS3 driver. The former discusstion can be checked from the link. Link: https://patchwork.kernel.org/project/netdevbpf/patch/20230310081404.9= 47-1-lanhao@huawei.com/ Signed-off-by: Jijie Shao Reviewed-by: Michal Swiatkowski --- ChangeLog: v1 -> v2: - Change commit message and title, suggested by Michal Swiatkowski. v1: https://lore.kernel.org/all/20250612021317.1487943-1-shaojijie@huawei= .com/ --- .../ethernet/hisilicon/hns3/hns3_debugfs.c | 2 +- .../net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- .../ethernet/hisilicon/hns3/hns3_ethtool.c | 24 +++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/n= et/ethernet/hisilicon/hns3/hns3_debugfs.c index 4f6ed7c7ee68..35e57eebcf57 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c @@ -1239,7 +1239,7 @@ static const struct hns3_dbg_func hns3_dbg_cmd_func[]= =3D { static int hns3_dbg_read_cmd(struct hns3_dbg_data *dbg_data, enum hnae3_dbg_cmd cmd, char *buf, int len) { - const struct hnae3_ae_ops *ops =3D dbg_data->handle->ae_algo->ops; + const struct hnae3_ae_ops *ops =3D hns3_get_ops(dbg_data->handle); const struct hns3_dbg_func *cmd_func; u32 i; =20 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/= ethernet/hisilicon/hns3/hns3_enet.c index 6babc636145b..208a2dfc07ec 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -960,7 +960,7 @@ static void hns3_nic_set_rx_mode(struct net_device *net= dev) =20 void hns3_request_update_promisc_mode(struct hnae3_handle *handle) { - const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; + const struct hnae3_ae_ops *ops =3D hns3_get_ops(handle); =20 if (ops->request_update_promisc_mode) ops->request_update_promisc_mode(handle); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/n= et/ethernet/hisilicon/hns3/hns3_ethtool.c index ae220f49df64..5e01dd55d660 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -489,7 +489,7 @@ static const struct hns3_pflag_desc hns3_priv_flags[HNA= E3_PFLAG_MAX] =3D { static int hns3_get_sset_count(struct net_device *netdev, int stringset) { struct hnae3_handle *h =3D hns3_get_handle(netdev); - const struct hnae3_ae_ops *ops =3D h->ae_algo->ops; + const struct hnae3_ae_ops *ops =3D hns3_get_ops(h); =20 if (!ops->get_sset_count) return -EOPNOTSUPP; @@ -540,7 +540,7 @@ static void hns3_get_strings_tqps(struct hnae3_handle *= handle, u8 **data) static void hns3_get_strings(struct net_device *netdev, u32 stringset, u8 = *data) { struct hnae3_handle *h =3D hns3_get_handle(netdev); - const struct hnae3_ae_ops *ops =3D h->ae_algo->ops; + const struct hnae3_ae_ops *ops =3D hns3_get_ops(h); int i; =20 if (!ops->get_strings) @@ -725,7 +725,7 @@ static int hns3_set_pauseparam(struct net_device *netde= v, static void hns3_get_ksettings(struct hnae3_handle *h, struct ethtool_link_ksettings *cmd) { - const struct hnae3_ae_ops *ops =3D h->ae_algo->ops; + const struct hnae3_ae_ops *ops =3D hns3_get_ops(h); =20 /* 1.auto_neg & speed & duplex from cmd */ if (ops->get_ksettings_an_result) @@ -814,7 +814,7 @@ static int hns3_check_ksettings_param(const struct net_= device *netdev, const struct ethtool_link_ksettings *cmd) { struct hnae3_handle *handle =3D hns3_get_handle(netdev); - const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; + const struct hnae3_ae_ops *ops =3D hns3_get_ops(handle); u8 module_type =3D HNAE3_MODULE_TYPE_UNKNOWN; u8 media_type =3D HNAE3_MEDIA_TYPE_UNKNOWN; u32 lane_num; @@ -862,7 +862,7 @@ static int hns3_set_link_ksettings(struct net_device *n= etdev, { struct hnae3_handle *handle =3D hns3_get_handle(netdev); struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); - const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; + const struct hnae3_ae_ops *ops =3D hns3_get_ops(handle); int ret; =20 /* Chip don't support this mode. */ @@ -1025,7 +1025,7 @@ static int hns3_set_reset(struct net_device *netdev, = u32 *flags) enum hnae3_reset_type rst_type =3D HNAE3_NONE_RESET; struct hnae3_handle *h =3D hns3_get_handle(netdev); struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(h); - const struct hnae3_ae_ops *ops =3D h->ae_algo->ops; + const struct hnae3_ae_ops *ops =3D hns3_get_ops(h); const struct hns3_reset_type_map *rst_type_map; enum ethtool_reset_flags rst_flags; u32 i, size; @@ -1300,7 +1300,7 @@ static int hns3_set_rxnfc(struct net_device *netdev, = struct ethtool_rxnfc *cmd) static int hns3_nway_reset(struct net_device *netdev) { struct hnae3_handle *handle =3D hns3_get_handle(netdev); - const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; + const struct hnae3_ae_ops *ops =3D hns3_get_ops(handle); struct phy_device *phy =3D netdev->phydev; int autoneg; =20 @@ -1650,7 +1650,7 @@ static void hns3_get_fec_stats(struct net_device *net= dev, { struct hnae3_handle *handle =3D hns3_get_handle(netdev); struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); - const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; + const struct hnae3_ae_ops *ops =3D hns3_get_ops(handle); =20 if (!hnae3_ae_dev_fec_stats_supported(ae_dev) || !ops->get_fec_stats) return; @@ -1701,7 +1701,7 @@ static int hns3_get_fecparam(struct net_device *netde= v, { struct hnae3_handle *handle =3D hns3_get_handle(netdev); struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); - const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; + const struct hnae3_ae_ops *ops =3D hns3_get_ops(handle); u8 fec_ability; u8 fec_mode; =20 @@ -1726,7 +1726,7 @@ static int hns3_set_fecparam(struct net_device *netde= v, { struct hnae3_handle *handle =3D hns3_get_handle(netdev); struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); - const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; + const struct hnae3_ae_ops *ops =3D hns3_get_ops(handle); u32 fec_mode; =20 if (!test_bit(HNAE3_DEV_SUPPORT_FEC_B, ae_dev->caps)) @@ -1748,7 +1748,7 @@ static int hns3_get_module_info(struct net_device *ne= tdev, =20 struct hnae3_handle *handle =3D hns3_get_handle(netdev); struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); - const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; + const struct hnae3_ae_ops *ops =3D hns3_get_ops(handle); struct hns3_sfp_type sfp_type; int ret; =20 @@ -1798,7 +1798,7 @@ static int hns3_get_module_eeprom(struct net_device *= netdev, { struct hnae3_handle *handle =3D hns3_get_handle(netdev); struct hnae3_ae_dev *ae_dev =3D hns3_get_ae_dev(handle); - const struct hnae3_ae_ops *ops =3D handle->ae_algo->ops; + const struct hnae3_ae_ops *ops =3D hns3_get_ops(handle); =20 if (ae_dev->dev_version < HNAE3_DEVICE_VERSION_V2 || !ops->get_module_eeprom) --=20 2.33.0 From nobody Thu Oct 9 06:07:54 2025 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1241528B7F9; Thu, 19 Jun 2025 14:48:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344500; cv=none; b=tNsMeW/yOQdULK+N59qOm6raG+j+bEyMUcY/9IQumI1Qyn0vt1Q/PziMdwr+37MXTdmI9uK/+whgFVbWUYVNZjl9qGdukImjVx1PG4IS9hyZoO8qKjV4lnMttSpAiKMm7ThcUQfUfRE0wo9DJXaibiEsr3dIYcyWejkLT9DPk2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344500; c=relaxed/simple; bh=kVruVcA5wFuH5z7mGRjD8pNKxzUI9Cxi4Xx9WGJ2ARQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pZ9XoaMqvFdTSmxykmtp/r7iUJ+dRj1PItUnftH1Dq1cDL1iU2/P/yuREe8+P/NqnLNMUH8OSdlid4nb9Z4pAuGbU3DcTANOPWUvKo/3e5heLLI2kz8iAAOXMzQjIfjw51cZPi5XOaa5hwtYKf1gQ3hsjfAYooAQElg4zTMZWOY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4bNNfS2fssz2Cfl8; Thu, 19 Jun 2025 22:44:16 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id 4A0CD1402CE; Thu, 19 Jun 2025 22:48:11 +0800 (CST) Received: from localhost.localdomain (10.90.31.46) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 19 Jun 2025 22:48:10 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , , , , Subject: [PATCH V3 net-next 4/8] net: hns3: add \n at the end when print msg Date: Thu, 19 Jun 2025 22:40:53 +0800 Message-ID: <20250619144057.2587576-5-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20250619144057.2587576-1-shaojijie@huawei.com> References: <20250619144057.2587576-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" From: Peiyang Wang To make the print message more clearly, add \n at the and of message if it is missing currently. Signed-off-by: Peiyang Wang Signed-off-by: Jijie Shao Reviewed-by: Simon Horman --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 10 +++++----- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- .../net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/= ethernet/hisilicon/hns3/hns3_enet.c index 208a2dfc07ec..dc1e15926482 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2447,7 +2447,7 @@ static int hns3_nic_set_features(struct net_device *n= etdev, if ((netdev->features & NETIF_F_HW_TC) > (features & NETIF_F_HW_TC) && h->ae_algo->ops->cls_flower_active(h)) { netdev_err(netdev, - "there are offloaded TC filters active, cannot disable HW TC offload= "); + "there are offloaded TC filters active, cannot disable HW TC offload= \n"); return -EINVAL; } =20 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/n= et/ethernet/hisilicon/hns3/hns3_ethtool.c index 5e01dd55d660..6a244ba5e051 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -436,7 +436,7 @@ static void hns3_self_test(struct net_device *ndev, data[i] =3D HNS3_NIC_LB_TEST_UNEXECUTED; =20 if (hns3_nic_resetting(ndev)) { - netdev_err(ndev, "dev resetting!"); + netdev_err(ndev, "dev resetting!\n"); goto failure; } =20 @@ -794,7 +794,7 @@ static int hns3_get_link_ksettings(struct net_device *n= etdev, break; default: =20 - netdev_warn(netdev, "Unknown media type"); + netdev_warn(netdev, "Unknown media type\n"); return 0; } =20 @@ -842,7 +842,7 @@ static int hns3_check_ksettings_param(const struct net_= device *netdev, if (cmd->base.duplex =3D=3D DUPLEX_HALF && media_type !=3D HNAE3_MEDIA_TYPE_COPPER) { netdev_err(netdev, - "only copper port supports half duplex!"); + "only copper port supports half duplex!\n"); return -EINVAL; } =20 @@ -1308,7 +1308,7 @@ static int hns3_nway_reset(struct net_device *netdev) return 0; =20 if (hns3_nic_resetting(netdev)) { - netdev_err(netdev, "dev resetting!"); + netdev_err(netdev, "dev resetting!\n"); return -EBUSY; } =20 @@ -1924,7 +1924,7 @@ static int hns3_set_tunable(struct net_device *netdev, int i, ret =3D 0; =20 if (hns3_nic_resetting(netdev) || !priv->ring) { - netdev_err(netdev, "failed to set tunable value, dev resetting!"); + netdev_err(netdev, "failed to set tunable value, dev resetting!\n"); return -EBUSY; } =20 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/driv= ers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index a5b480d59fbf..e0a2ca21ee46 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -11423,7 +11423,7 @@ static int hclge_pci_init(struct hclge_dev *hdev) ret =3D dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); if (ret) { dev_err(&pdev->dev, - "can't set consistent PCI DMA"); + "can't set consistent PCI DMA\n"); goto err_disable_device; } dev_warn(&pdev->dev, "set DMA mask to 32 bits\n"); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/dr= ivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index c4f35e8e2177..e3f86638540b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -2625,7 +2625,7 @@ static int hclgevf_pci_init(struct hclgevf_dev *hdev) =20 ret =3D dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); if (ret) { - dev_err(&pdev->dev, "can't set consistent PCI DMA, exiting"); + dev_err(&pdev->dev, "can't set consistent PCI DMA, exiting\n"); goto err_disable_device; } =20 --=20 2.33.0 From nobody Thu Oct 9 06:07:54 2025 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B44141AF0B5; Thu, 19 Jun 2025 14:48:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344497; cv=none; b=Iob3goA6rAbm0gV0rsFidQ7aqPckz5gSuLxvyHiccMkYc5iNMBy1P1PhSIaS/JZY95vYPna2IL4uyLoKGyfU75UW9QtahMJE+L55dteKWp+0XVnOHAP+eELJ7NyvcBqwxf3eRQGd6dpLfWVE0jWKbEJmjmEk7I2xf/rqdarx98g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344497; c=relaxed/simple; bh=YjMS2CcpuzRSbboHGnLRakfRmitcWwOqCbDpXu5+n/c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Dnc7OqXLD97nvkfLxtBHtbf8vGSE+HeiqMNRDY9t/OODpTL9Oh+CO1Kx16udywBGSZPG5oBUFAPRuT3vIb15JFCJNbF2XHieYj1BB7us9VP6eVJRnkNcTtCZQbBPF0nYpG8ip1veiPb6mIot8C4fMePFVJlhl8xV+6zWi0b18+o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4bNNf26wL3zRk5T; Thu, 19 Jun 2025 22:43:54 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id D6A8B180B6A; Thu, 19 Jun 2025 22:48:11 +0800 (CST) Received: from localhost.localdomain (10.90.31.46) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 19 Jun 2025 22:48:11 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , , , , Subject: [PATCH V3 net-next 5/8] net: hns3: set the freed pointers to NULL when lifetime is not end Date: Thu, 19 Jun 2025 22:40:54 +0800 Message-ID: <20250619144057.2587576-6-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20250619144057.2587576-1-shaojijie@huawei.com> References: <20250619144057.2587576-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" From: Jian Shen There are several pointers are freed but not set to NULL, and their lifetime is not end immediately. To avoid misusing there wild pointers, set them to NULL. Signed-off-by: Jian Shen Signed-off-by: Jijie Shao --- ChangeLog: v2 -> v3: - Remove unnecessary pointer set to NULL operation, suggested by Simon Ho= rman. v2: https://lore.kernel.org/all/20250617010255.1183069-1-shaojijie@huawei= .com/ --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 ++++ drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/driv= ers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index e0a2ca21ee46..9d7c9523c9e1 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -5208,6 +5208,7 @@ static void hclge_fd_free_node(struct hclge_dev *hdev, { hlist_del(&rule->rule_node); kfree(rule); + rule =3D NULL; hclge_sync_fd_state(hdev); } =20 @@ -5232,6 +5233,7 @@ static void hclge_update_fd_rule_node(struct hclge_de= v *hdev, new_rule->rule_node.pprev =3D old_rule->rule_node.pprev; memcpy(old_rule, new_rule, sizeof(*old_rule)); kfree(new_rule); + new_rule =3D NULL; break; case HCLGE_FD_DELETED: hclge_fd_dec_rule_cnt(hdev, old_rule->location); @@ -8521,6 +8523,7 @@ static void hclge_update_mac_node(struct hclge_mac_no= de *mac_node, if (mac_node->state =3D=3D HCLGE_MAC_TO_ADD) { list_del(&mac_node->node); kfree(mac_node); + mac_node =3D NULL; } else { mac_node->state =3D HCLGE_MAC_TO_DEL; } @@ -9151,6 +9154,7 @@ static void hclge_uninit_vport_mac_list(struct hclge_= vport *vport, case HCLGE_MAC_TO_ADD: list_del(&mac_node->node); kfree(mac_node); + mac_node =3D NULL; break; } } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/dr= ivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index e3f86638540b..3ffd47b30ad3 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -933,6 +933,7 @@ static void hclgevf_update_mac_node(struct hclgevf_mac_= addr_node *mac_node, if (mac_node->state =3D=3D HCLGEVF_MAC_TO_ADD) { list_del(&mac_node->node); kfree(mac_node); + mac_node =3D NULL; } else { mac_node->state =3D HCLGEVF_MAC_TO_DEL; } @@ -2395,6 +2396,7 @@ static int hclgevf_init_msi(struct hclgevf_dev *hdev) sizeof(int), GFP_KERNEL); if (!hdev->vector_irq) { devm_kfree(&pdev->dev, hdev->vector_status); + hdev->vector_status =3D NULL; pci_free_irq_vectors(pdev); return -ENOMEM; } @@ -2408,6 +2410,8 @@ static void hclgevf_uninit_msi(struct hclgevf_dev *hd= ev) =20 devm_kfree(&pdev->dev, hdev->vector_status); devm_kfree(&pdev->dev, hdev->vector_irq); + hdev->vector_status =3D NULL; + hdev->vector_irq =3D NULL; pci_free_irq_vectors(pdev); } =20 --=20 2.33.0 From nobody Thu Oct 9 06:07:54 2025 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D309228C2B1; Thu, 19 Jun 2025 14:48:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344502; cv=none; b=ealvyboKH30F//RHFO5jyxnCzHjIiJu0Kj2kXbGr1Rw5lt5Jjv+I8FirRL0Lei2KKjAJKHrryxqPvKJxMJT9N6k7wQeGp7FiSbya+cNuEO27ZV5plwNHJmHfGjAbbzEB41ZWjU9BifkVQYtWL8OB6ug+uzHLD+JDIFqViywUVgc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344502; c=relaxed/simple; bh=XtkVEnZS27jg8zCWbOQkKtNR51Oj+RO23paMwxywlSg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KX3FHiw6diwtrb7fitJ/5gBnCnv4M7JH/Kqb8DoMfdtjzA09TDROQYW/eyQ+gdc6BgCSZDKLNue/nfJ7xQNLp9vNCF6WKzGq82avxZOsZtc8HWoyYd4bAEHAmgo66yFD+bwzHBbYMSS2gyPMguNSEf2F1PdavXOMGyc6ZFW03n4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4bNNfT47xPz2Cfll; Thu, 19 Jun 2025 22:44:17 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id 7DDC01A0188; Thu, 19 Jun 2025 22:48:12 +0800 (CST) Received: from localhost.localdomain (10.90.31.46) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 19 Jun 2025 22:48:11 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , , , , Subject: [PATCH V3 net-next 6/8] net: hns3: delete redundant address before the array Date: Thu, 19 Jun 2025 22:40:55 +0800 Message-ID: <20250619144057.2587576-7-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20250619144057.2587576-1-shaojijie@huawei.com> References: <20250619144057.2587576-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" From: Yonglong Liu Address before the array is redundant, this patch delete it. Signed-off-by: Yonglong Liu Signed-off-by: Jijie Shao Reviewed-by: Simon Horman --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c b/d= rivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c index c46490693594..21deec217668 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c @@ -2110,7 +2110,7 @@ static int hclge_dbg_dump_mng_table(struct hclge_dev = *hdev, char *buf, int len) for (i =3D 0; i < HCLGE_DBG_MNG_TBL_MAX; i++) { hclge_cmd_setup_basic_desc(&desc, HCLGE_MAC_ETHERTYPE_IDX_RD, true); - req0 =3D (struct hclge_mac_ethertype_idx_rd_cmd *)&desc.data; + req0 =3D (struct hclge_mac_ethertype_idx_rd_cmd *)desc.data; req0->index =3D cpu_to_le16(i); =20 ret =3D hclge_cmd_send(&hdev->hw, &desc, 1); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/driv= ers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 9d7c9523c9e1..b76400e67a23 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -2358,7 +2358,7 @@ static int hclge_common_thrd_config(struct hclge_dev = *hdev, for (i =3D 0; i < 2; i++) { hclge_cmd_setup_basic_desc(&desc[i], HCLGE_OPC_RX_COM_THRD_ALLOC, false); - req =3D (struct hclge_rx_com_thrd *)&desc[i].data; + req =3D (struct hclge_rx_com_thrd *)desc[i].data; =20 /* The first descriptor set the NEXT bit to 1 */ if (i =3D=3D 0) --=20 2.33.0 From nobody Thu Oct 9 06:07:54 2025 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8641322A4F3; Thu, 19 Jun 2025 14:48:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344498; cv=none; b=NDqZgjHLHHuILF6DpTHCOV09HUlCneAOzOWYnuOfJa+CDPOmen+TrdBEmicQ+pPeNwAsxR/fUwoPTlz5TzNBsG7AW+u7/n5lfcQRLxPUCxRqk8hmVMszVP2eViQ9vPxkh/h9mwwld9eF9MWA5e7Kme7BjEgVnMtb3CvZFrJF2lc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344498; c=relaxed/simple; bh=i7rcD1P8laXbZBfNdu4DupjBlFmEKluMaA6OTeWwlqA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OS5mpFPeQdN9UPO4b8uYen2bePL3iqZwfkA4mTeAXtkKBoE+JxI0oj0uQlidX7r7rW46dVbm7MlIaPNESUNMV4PZIrXCQH/XL4CRgHyMU0GkPhvScqdjNWCWaSbN3Bmxsf5nUXE1mp68A47cFpxw2iU/BCtLt4598Tlmdek1MWs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4bNNf41WPzzRkdD; Thu, 19 Jun 2025 22:43:56 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id 1F5711400D9; Thu, 19 Jun 2025 22:48:13 +0800 (CST) Received: from localhost.localdomain (10.90.31.46) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 19 Jun 2025 22:48:12 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , , , , Subject: [PATCH V3 net-next 7/8] net: hns3: add complete parentheses for some macros Date: Thu, 19 Jun 2025 22:40:56 +0800 Message-ID: <20250619144057.2587576-8-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20250619144057.2587576-1-shaojijie@huawei.com> References: <20250619144057.2587576-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" Add complete parentheses for some macros to fix static check warning. Signed-off-by: Jijie Shao Reviewed-by: Simon Horman --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/= ethernet/hisilicon/hns3/hns3_enet.h index d36c4ed16d8d..dd61ddd8f904 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h @@ -692,7 +692,7 @@ static inline unsigned int hns3_page_order(struct hns3_= enet_ring *ring) =20 /* iterator for handling rings in ring group */ #define hns3_for_each_ring(pos, head) \ - for (pos =3D (head).ring; (pos); pos =3D (pos)->next) + for ((pos) =3D (head).ring; (pos); (pos) =3D (pos)->next) =20 #define hns3_get_handle(ndev) \ (((struct hns3_nic_priv *)netdev_priv(ndev))->ae_handle) --=20 2.33.0 From nobody Thu Oct 9 06:07:54 2025 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44E6C2264BB; Thu, 19 Jun 2025 14:48:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344498; cv=none; b=UR76/gDOhYiTAIJVnyQdN9fZmHDoy8/NlA4y1RdRFSKPqP+Tp0kb06+nJSG57XmzWH8ddgWOESRuoNRv9qOzi1bJVxj6EjJ8D46gaQMlkqapJRmGLArWt+6PaCLrpo3cMTMOrwo0wI3KX9jtKIAzk1o4nO2f7DFrZKjHP+sxwEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750344498; c=relaxed/simple; bh=NXpHgPsCGDrGSx7NxIYdMtYvGRs2DkHXsplJh2i91Ss=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dLFwvFI9fRHsufaM1MQBsBDunsRBZuJxgbO4EZu/wZ9ufDqHYiIenbZ+LM9UHjTDkkJ9X6OZShH1iVGH+Pu0cvILd7PPLZgCnzKdAglwRxb3/cETcyZMml19RSqgWpAQZXr7TMDRGeE3PDRphZHe7yUcPG9vkMrs91S7sLd3FIo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4bNNjJ2ptFz2BdTp; Thu, 19 Jun 2025 22:46:44 +0800 (CST) Received: from kwepemk100013.china.huawei.com (unknown [7.202.194.61]) by mail.maildlp.com (Postfix) with ESMTPS id C6607140275; Thu, 19 Jun 2025 22:48:13 +0800 (CST) Received: from localhost.localdomain (10.90.31.46) by kwepemk100013.china.huawei.com (7.202.194.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 19 Jun 2025 22:48:12 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , , , , Subject: [PATCH V3 net-next 8/8] net: hns3: clear hns alarm: comparison of integer expressions of different signedness Date: Thu, 19 Jun 2025 22:40:57 +0800 Message-ID: <20250619144057.2587576-9-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20250619144057.2587576-1-shaojijie@huawei.com> References: <20250619144057.2587576-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To kwepemk100013.china.huawei.com (7.202.194.61) Content-Type: text/plain; charset="utf-8" From: Peiyang Wang A static alarm exists in the hns and needs to be cleared. The alarm is comparison of integer expressions of different signedness including 's64' and 'long unsigned int', 'int' and 'long unsigned int', 'u32' and 'int', 'int' and 'unsigned int'. Signed-off-by: Peiyang Wang Signed-off-by: Jijie Shao --- .../hns3/hns3_common/hclge_comm_cmd.c | 2 +- .../net/ethernet/hisilicon/hns3/hns3_enet.c | 22 +++++++------- .../net/ethernet/hisilicon/hns3/hns3_enet.h | 2 +- .../ethernet/hisilicon/hns3/hns3_ethtool.c | 4 +-- .../hisilicon/hns3/hns3pf/hclge_debugfs.c | 13 ++++---- .../hisilicon/hns3/hns3pf/hclge_main.c | 30 +++++++++---------- .../hisilicon/hns3/hns3pf/hclge_mbx.c | 7 +++-- .../hisilicon/hns3/hns3pf/hclge_mdio.c | 2 +- .../hisilicon/hns3/hns3pf/hclge_ptp.h | 2 +- .../hisilicon/hns3/hns3vf/hclgevf_main.c | 2 +- .../hisilicon/hns3/hns3vf/hclgevf_mbx.c | 2 +- 11 files changed, 44 insertions(+), 44 deletions(-) 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 4ad4e8ab2f1f..37396ca4ecfc 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 @@ -348,7 +348,7 @@ static int hclge_comm_cmd_csq_clean(struct hclge_comm_h= w *hw) static int hclge_comm_cmd_csq_done(struct hclge_comm_hw *hw) { u32 head =3D hclge_comm_read_dev(hw, HCLGE_COMM_NIC_CSQ_HEAD_REG); - return head =3D=3D hw->cmq.csq.next_to_use; + return head =3D=3D (u32)hw->cmq.csq.next_to_use; } =20 static u32 hclge_get_cmdq_tx_timeout(u16 opcode, u32 tx_timeout) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/= ethernet/hisilicon/hns3/hns3_enet.c index dc1e15926482..49fcee7a6d0f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1690,8 +1690,8 @@ static int hns3_fill_desc(struct hns3_enet_ring *ring= , dma_addr_t dma, #define HNS3_LIKELY_BD_NUM 1 =20 struct hns3_desc *desc =3D &ring->desc[ring->next_to_use]; - unsigned int frag_buf_num; - int k, sizeoflast; + unsigned int frag_buf_num, k; + int sizeoflast; =20 if (likely(size <=3D HNS3_MAX_BD_SIZE)) { desc->addr =3D cpu_to_le64(dma); @@ -1863,7 +1863,7 @@ static bool hns3_skb_need_linearized(struct sk_buff *= skb, unsigned int *bd_size, unsigned int bd_num, u8 max_non_tso_bd_num) { unsigned int tot_len =3D 0; - int i; + unsigned int i; =20 for (i =3D 0; i < max_non_tso_bd_num - 1U; i++) tot_len +=3D bd_size[i]; @@ -1891,7 +1891,7 @@ static bool hns3_skb_need_linearized(struct sk_buff *= skb, unsigned int *bd_size, =20 void hns3_shinfo_pack(struct skb_shared_info *shinfo, __u32 *size) { - int i; + u32 i; =20 for (i =3D 0; i < MAX_SKB_FRAGS; i++) size[i] =3D skb_frag_size(&shinfo->frags[i]); @@ -2207,9 +2207,9 @@ static int hns3_handle_tx_sgl(struct hns3_enet_ring *= ring, struct hns3_desc_cb *desc_cb =3D &ring->desc_cb[ring->next_to_use]; u32 nfrag =3D skb_shinfo(skb)->nr_frags + 1; struct sg_table *sgt; - int i, bd_num =3D 0; + int bd_num =3D 0; dma_addr_t dma; - u32 cb_len; + u32 cb_len, i; int nents; =20 if (skb_has_frag_list(skb)) @@ -2544,7 +2544,7 @@ static void hns3_nic_get_stats64(struct net_device *n= etdev, struct hnae3_handle *handle =3D priv->ae_handle; struct rtnl_link_stats64 ring_total_stats; struct hns3_enet_ring *ring; - unsigned int idx; + int idx; =20 if (test_bit(HNS3_NIC_STATE_DOWN, &priv->state)) return; @@ -2770,7 +2770,7 @@ static int hns3_nic_change_mtu(struct net_device *net= dev, int new_mtu) =20 static int hns3_get_timeout_queue(struct net_device *ndev) { - int i; + unsigned int i; =20 /* Find the stopped queue the same way the stack does */ for (i =3D 0; i < ndev->num_tx_queues; i++) { @@ -2851,7 +2851,7 @@ static bool hns3_get_tx_timeo_queue_info(struct net_d= evice *ndev) struct hns3_nic_priv *priv =3D netdev_priv(ndev); struct hnae3_handle *h =3D hns3_get_handle(ndev); struct hns3_enet_ring *tx_ring; - int timeout_queue; + u32 timeout_queue; =20 timeout_queue =3D hns3_get_timeout_queue(ndev); if (timeout_queue >=3D ndev->num_tx_queues) { @@ -3821,7 +3821,7 @@ static int hns3_gro_complete(struct sk_buff *skb, u32= l234info) { __be16 type =3D skb->protocol; struct tcphdr *th; - int depth =3D 0; + u32 depth =3D 0; =20 while (eth_type_vlan(type)) { struct vlan_hdr *vh; @@ -5934,7 +5934,7 @@ static const struct hns3_hw_error_info hns3_hw_err[] = =3D { static void hns3_process_hw_error(struct hnae3_handle *handle, enum hnae3_hw_error_type type) { - int i; + u32 i; =20 for (i =3D 0; i < ARRAY_SIZE(hns3_hw_err); i++) { if (hns3_hw_err[i].type =3D=3D type) { diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/= ethernet/hisilicon/hns3/hns3_enet.h index dd61ddd8f904..d3bad5d1b888 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h @@ -621,7 +621,7 @@ struct hns3_reset_type_map { enum hnae3_reset_type rst_type; }; =20 -static inline int ring_space(struct hns3_enet_ring *ring) +static inline u32 ring_space(struct hns3_enet_ring *ring) { /* This smp_load_acquire() pairs with smp_store_release() in * hns3_nic_reclaim_one_desc called by hns3_clean_tx_ring. diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/n= et/ethernet/hisilicon/hns3/hns3_ethtool.c index 6a244ba5e051..276d5c191123 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -541,7 +541,7 @@ static void hns3_get_strings(struct net_device *netdev,= u32 stringset, u8 *data) { struct hnae3_handle *h =3D hns3_get_handle(netdev); const struct hnae3_ae_ops *ops =3D hns3_get_ops(h); - int i; + u32 i; =20 if (!ops->get_strings) return; @@ -569,7 +569,7 @@ static u64 *hns3_get_stats_tqps(struct hnae3_handle *ha= ndle, u64 *data) struct hns3_nic_priv *nic_priv =3D handle->priv; struct hns3_enet_ring *ring; u8 *stat; - int i, j; + u32 i, j; =20 /* get stats for Tx */ for (i =3D 0; i < kinfo->num_tqps; i++) { diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c b/d= rivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c index 21deec217668..f130020a1227 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c @@ -830,10 +830,10 @@ hclge_dbg_dump_reg_tqp(struct hclge_dev *hdev, { const struct hclge_dbg_dfx_message *dfx_message =3D reg_info->dfx_msg; const struct hclge_dbg_reg_common_msg *reg_msg =3D ®_info->reg_msg; + u32 index, entry, i, cnt, min_num; struct hclge_desc *desc_src; - u32 index, entry, i, cnt; - int bd_num, min_num, ret; struct hclge_desc *desc; + int bd_num, ret; =20 ret =3D hclge_dbg_get_dfx_bd_num(hdev, reg_msg->offset, &bd_num); if (ret) @@ -885,9 +885,9 @@ hclge_dbg_dump_reg_common(struct hclge_dev *hdev, const struct hclge_dbg_reg_common_msg *reg_msg =3D ®_info->reg_msg; const struct hclge_dbg_dfx_message *dfx_message =3D reg_info->dfx_msg; struct hclge_desc *desc_src; - int bd_num, min_num, ret; + int bd_num, min_num, ret, i; struct hclge_desc *desc; - u32 entry, i; + u32 entry; =20 ret =3D hclge_dbg_get_dfx_bd_num(hdev, reg_msg->offset, &bd_num); if (ret) @@ -1279,7 +1279,7 @@ static int hclge_dbg_dump_reg_cmd(struct hclge_dev *h= dev, { const struct hclge_dbg_reg_type_info *reg_info; int pos =3D 0, ret =3D 0; - int i; + u32 i; =20 for (i =3D 0; i < ARRAY_SIZE(hclge_dbg_reg_info); i++) { reg_info =3D &hclge_dbg_reg_info[i]; @@ -2648,9 +2648,8 @@ static void hclge_dbg_dump_mac_list(struct hclge_dev = *hdev, char *buf, int len, struct hclge_mac_node *mac_node, *tmp; struct hclge_vport *vport; struct list_head *list; - u32 func_id; + u32 func_id, i; int pos =3D 0; - int i; =20 for (i =3D 0; i < ARRAY_SIZE(mac_list_items); i++) result[i] =3D &data_str[i][0]; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/driv= ers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index b76400e67a23..d886b04ad92c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -582,7 +582,7 @@ static u64 *hclge_comm_get_stats(struct hclge_dev *hdev, int size, u64 *data) { u64 *buf =3D data; - u32 i; + int i; =20 for (i =3D 0; i < size; i++) { if (strs[i].stats_num > hdev->ae_dev->dev_specs.mac_stats_num) @@ -599,7 +599,7 @@ static void hclge_comm_get_strings(struct hclge_dev *hd= ev, u32 stringset, const struct hclge_comm_stats_str strs[], int size, u8 **data) { - u32 i; + int i; =20 if (stringset !=3D ETH_SS_STATS) return; @@ -2624,7 +2624,7 @@ int hclge_cfg_mac_speed_dup(struct hclge_dev *hdev, i= nt speed, u8 duplex, u8 lan int ret; =20 duplex =3D hclge_check_speed_dup(duplex, speed); - if (!mac->support_autoneg && mac->speed =3D=3D speed && + if (!mac->support_autoneg && mac->speed =3D=3D (u32)speed && mac->duplex =3D=3D duplex && (mac->lane_num =3D=3D lane_num || lane_n= um =3D=3D 0)) return 0; =20 @@ -2652,7 +2652,7 @@ static int hclge_cfg_mac_speed_dup_h(struct hnae3_han= dle *handle, int speed, if (ret) return ret; =20 - hdev->hw.mac.req_speed =3D speed; + hdev->hw.mac.req_speed =3D (u32)speed; hdev->hw.mac.req_duplex =3D duplex; =20 return 0; @@ -3446,7 +3446,7 @@ static int hclge_tp_port_init(struct hclge_dev *hdev) static int hclge_update_port_info(struct hclge_dev *hdev) { struct hclge_mac *mac =3D &hdev->hw.mac; - int speed; + u32 speed; int ret; =20 /* get the port info from SFP cmd if not copper port */ @@ -6991,7 +6991,7 @@ static int hclge_get_all_rules(struct hnae3_handle *h= andle, struct hclge_dev *hdev =3D vport->back; struct hclge_fd_rule *rule; struct hlist_node *node2; - int cnt =3D 0; + u32 cnt =3D 0; =20 if (!hnae3_ae_dev_fd_supported(hdev->ae_dev)) return -EOPNOTSUPP; @@ -8225,14 +8225,14 @@ static int hclge_update_desc_vfid(struct hclge_desc= *desc, int vfid, bool clr) word_num =3D vfid / 32; bit_num =3D vfid % 32; if (clr) - desc[1].data[word_num] &=3D cpu_to_le32(~(1 << bit_num)); + desc[1].data[word_num] &=3D cpu_to_le32(~(1U << bit_num)); else desc[1].data[word_num] |=3D cpu_to_le32(1 << bit_num); } else { word_num =3D (vfid - HCLGE_VF_NUM_IN_FIRST_DESC) / 32; bit_num =3D vfid % 32; if (clr) - desc[2].data[word_num] &=3D cpu_to_le32(~(1 << bit_num)); + desc[2].data[word_num] &=3D cpu_to_le32(~(1U << bit_num)); else desc[2].data[word_num] |=3D cpu_to_le32(1 << bit_num); } @@ -9296,7 +9296,7 @@ static int hclge_add_mgr_tbl(struct hclge_dev *hdev, static int init_mgr_tbl(struct hclge_dev *hdev) { int ret; - int i; + u32 i; =20 for (i =3D 0; i < ARRAY_SIZE(hclge_mgr_table); i++) { ret =3D hclge_add_mgr_tbl(hdev, &hclge_mgr_table[i]); @@ -10717,7 +10717,7 @@ int hclge_set_vport_mtu(struct hclge_vport *vport, = int new_mtu) max_frm_size =3D max(max_frm_size, HCLGE_MAC_DEFAULT_FRAME); mutex_lock(&hdev->vport_lock); /* VF's mps must fit within hdev->mps */ - if (vport->vport_id && max_frm_size > hdev->mps) { + if (vport->vport_id && (u32)max_frm_size > hdev->mps) { mutex_unlock(&hdev->vport_lock); return -EINVAL; } else if (vport->vport_id) { @@ -10728,7 +10728,7 @@ int hclge_set_vport_mtu(struct hclge_vport *vport, = int new_mtu) =20 /* PF's mps must be greater then VF's mps */ for (i =3D 1; i < hdev->num_alloc_vport; i++) - if (max_frm_size < hdev->vport[i].mps) { + if ((u32)max_frm_size < hdev->vport[i].mps) { dev_err(&hdev->pdev->dev, "failed to set pf mtu for less than vport %d, mps =3D %u.\n", i, hdev->vport[i].mps); @@ -11218,7 +11218,7 @@ static int hclge_init_nic_client_instance(struct hn= ae3_ae_dev *ae_dev, { struct hnae3_client *client =3D vport->nic.client; struct hclge_dev *hdev =3D ae_dev->priv; - int rst_cnt =3D hdev->rst_stats.reset_cnt; + u32 rst_cnt =3D hdev->rst_stats.reset_cnt; int ret; =20 ret =3D client->ops->init_instance(&vport->nic); @@ -11262,7 +11262,7 @@ static int hclge_init_roce_client_instance(struct h= nae3_ae_dev *ae_dev, { struct hclge_dev *hdev =3D ae_dev->priv; struct hnae3_client *client; - int rst_cnt; + u32 rst_cnt; int ret; =20 if (!hnae3_dev_roce_supported(hdev) || !hdev->roce_client || @@ -12092,7 +12092,7 @@ static int hclge_vf_rate_param_check(struct hclge_d= ev *hdev, int min_tx_rate, int max_tx_rate) { if (min_tx_rate !=3D 0 || - max_tx_rate < 0 || max_tx_rate > hdev->hw.mac.max_speed) { + max_tx_rate < 0 || (u32)max_tx_rate > hdev->hw.mac.max_speed) { dev_err(&hdev->pdev->dev, "min_tx_rate:%d [0], max_tx_rate:%d [0, %u]\n", min_tx_rate, max_tx_rate, hdev->hw.mac.max_speed); @@ -12117,7 +12117,7 @@ static int hclge_set_vf_rate(struct hnae3_handle *h= andle, int vf, if (!vport) return -EINVAL; =20 - if (!force && max_tx_rate =3D=3D vport->vf_info.max_tx_rate) + if (!force && (u32)max_tx_rate =3D=3D vport->vf_info.max_tx_rate) return 0; =20 ret =3D hclge_tm_qs_shaper_cfg(vport, max_tx_rate); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drive= rs/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c index 59c863306657..c7ff12a6c076 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c @@ -749,16 +749,17 @@ static int hclge_get_rss_key(struct hclge_vport *vpor= t, #define HCLGE_RSS_MBX_RESP_LEN 8 struct hclge_dev *hdev =3D vport->back; struct hclge_comm_rss_cfg *rss_cfg; + int rss_hash_key_size; u8 index; =20 index =3D mbx_req->msg.data[0]; rss_cfg =3D &hdev->rss_cfg; + rss_hash_key_size =3D sizeof(rss_cfg->rss_hash_key); =20 /* Check the query index of rss_hash_key from VF, make sure no * more than the size of rss_hash_key. */ - if (((index + 1) * HCLGE_RSS_MBX_RESP_LEN) > - sizeof(rss_cfg->rss_hash_key)) { + if (((index + 1) * HCLGE_RSS_MBX_RESP_LEN) > rss_hash_key_size) { dev_warn(&hdev->pdev->dev, "failed to get the rss hash key, the index(%u) invalid !\n", index); @@ -800,7 +801,7 @@ static void hclge_handle_link_change_event(struct hclge= _dev *hdev, =20 static bool hclge_cmd_crq_empty(struct hclge_hw *hw) { - u32 tail =3D hclge_read_dev(hw, HCLGE_COMM_NIC_CRQ_TAIL_REG); + int tail =3D hclge_read_dev(hw, HCLGE_COMM_NIC_CRQ_TAIL_REG); =20 return tail =3D=3D hw->hw.cmq.crq.next_to_use; } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c b/driv= ers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c index 9a456ebf9b7c..96553109f44c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c @@ -151,7 +151,7 @@ int hclge_mac_mdio_config(struct hclge_dev *hdev) =20 mdio_bus->parent =3D &hdev->pdev->dev; mdio_bus->priv =3D hdev; - mdio_bus->phy_mask =3D ~(1 << mac->phy_addr); + mdio_bus->phy_mask =3D ~(1U << mac->phy_addr); ret =3D mdiobus_register(mdio_bus); if (ret) { dev_err(mdio_bus->parent, diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.h b/drive= rs/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.h index 63483636c074..61faddcc3dd0 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_ptp.h @@ -25,7 +25,7 @@ struct ifreq; #define HCLGE_PTP_TIME_SEC_H_MASK GENMASK(15, 0) #define HCLGE_PTP_TIME_SEC_L_REG 0x54 #define HCLGE_PTP_TIME_NSEC_REG 0x58 -#define HCLGE_PTP_TIME_NSEC_MASK GENMASK(29, 0) +#define HCLGE_PTP_TIME_NSEC_MASK 0x3fffffffLL #define HCLGE_PTP_TIME_NSEC_NEG BIT(31) #define HCLGE_PTP_TIME_SYNC_REG 0x5C #define HCLGE_PTP_TIME_SYNC_EN BIT(0) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/dr= ivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 3ffd47b30ad3..ca2f43985a4a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -2469,7 +2469,7 @@ static int hclgevf_init_nic_client_instance(struct hn= ae3_ae_dev *ae_dev, struct hnae3_client *client) { struct hclgevf_dev *hdev =3D ae_dev->priv; - int rst_cnt =3D hdev->rst_stats.rst_cnt; + u32 rst_cnt =3D hdev->rst_stats.rst_cnt; int ret; =20 ret =3D client->ops->init_instance(&hdev->nic); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c b/dri= vers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c index 85c2a634c8f9..f5c99ca54369 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c @@ -159,7 +159,7 @@ static bool hclgevf_cmd_crq_empty(struct hclgevf_hw *hw) { u32 tail =3D hclgevf_read_dev(hw, HCLGE_COMM_NIC_CRQ_TAIL_REG); =20 - return tail =3D=3D hw->hw.cmq.crq.next_to_use; + return tail =3D=3D (u32)hw->hw.cmq.crq.next_to_use; } =20 static void hclgevf_handle_mbx_response(struct hclgevf_dev *hdev, --=20 2.33.0