2021-08-27 09:34:35

by Guangbin Huang

[permalink] [raw]
Subject: [PATCH net-next 0/8] net: hns3: add some cleanups

This series includes some cleanups for the HNS3 ethernet driver.

Guangbin Huang (1):
net: hns3: add macros for mac speeds of firmware command

Hao Chen (1):
net: hns3: uniform type of function parameter cmd

Huazhong Tan (1):
net: hns3: add hns3_state_init() to do state initialization

Peng Li (5):
net: hns3: remove redundant param mbx_event_pending
net: hns3: use memcpy to simplify code
net: hns3: remove redundant param to simplify code
net: hns3: package new functions to simplify hclgevf_mbx_handler code
net: hns3: merge some repetitive macros

drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 5 +-
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 29 +++--
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 23 ++--
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 58 +++++-----
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 22 ++--
.../ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.h | 10 --
.../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 22 ++--
.../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h | 22 ++--
.../ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c | 122 ++++++++++-----------
9 files changed, 151 insertions(+), 162 deletions(-)

--
2.8.1


2021-08-27 09:34:35

by Guangbin Huang

[permalink] [raw]
Subject: [PATCH net-next 2/8] net: hns3: add hns3_state_init() to do state initialization

From: Huazhong Tan <[email protected]>

To improve the readability and maintainability, add hns3_state_init() to
initialize the state, and this new function will be used to add more state
initialization in the future.

Signed-off-by: Huazhong Tan <[email protected]>
Signed-off-by: Guangbin Huang <[email protected]>
---
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 29 ++++++++++++++++---------
1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 39d01ca026da..ab14beb65aaf 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -5063,6 +5063,24 @@ void hns3_cq_period_mode_init(struct hns3_nic_priv *priv,
hns3_set_cq_period_mode(priv, rx_mode, false);
}

+static void hns3_state_init(struct hnae3_handle *handle)
+{
+ struct hnae3_ae_dev *ae_dev = pci_get_drvdata(handle->pdev);
+ struct net_device *netdev = handle->kinfo.netdev;
+ struct hns3_nic_priv *priv = netdev_priv(netdev);
+
+ set_bit(HNS3_NIC_STATE_INITED, &priv->state);
+
+ if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3)
+ set_bit(HNAE3_PFLAG_LIMIT_PROMISC, &handle->supported_pflags);
+
+ if (test_bit(HNAE3_DEV_SUPPORT_HW_TX_CSUM_B, ae_dev->caps))
+ set_bit(HNS3_NIC_STATE_HW_TX_CSUM_ENABLE, &priv->state);
+
+ if (hnae3_ae_dev_rxd_adv_layout_supported(ae_dev))
+ set_bit(HNS3_NIC_STATE_RXD_ADV_LAYOUT_ENABLE, &priv->state);
+}
+
static int hns3_client_init(struct hnae3_handle *handle)
{
struct pci_dev *pdev = handle->pdev;
@@ -5166,16 +5184,7 @@ static int hns3_client_init(struct hnae3_handle *handle)

netdev->max_mtu = HNS3_MAX_MTU(ae_dev->dev_specs.max_frm_size);

- if (test_bit(HNAE3_DEV_SUPPORT_HW_TX_CSUM_B, ae_dev->caps))
- set_bit(HNS3_NIC_STATE_HW_TX_CSUM_ENABLE, &priv->state);
-
- if (hnae3_ae_dev_rxd_adv_layout_supported(ae_dev))
- set_bit(HNS3_NIC_STATE_RXD_ADV_LAYOUT_ENABLE, &priv->state);
-
- set_bit(HNS3_NIC_STATE_INITED, &priv->state);
-
- if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3)
- set_bit(HNAE3_PFLAG_LIMIT_PROMISC, &handle->supported_pflags);
+ hns3_state_init(handle);

ret = register_netdev(netdev);
if (ret) {
--
2.8.1

2021-08-27 09:35:10

by Guangbin Huang

[permalink] [raw]
Subject: [PATCH net-next 8/8] net: hns3: uniform type of function parameter cmd

From: Hao Chen <[email protected]>

The parameter cmd in function definition of hns3_dbg_bd_file_init and
hns3_dbg_common_file_init is used type u32, this patch uniforms them
in function declaration to type u32 too.

Signed-off-by: Hao Chen <[email protected]>
Signed-off-by: Guangbin Huang <[email protected]>
---
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
index 80461ab0ce9e..3e8ba7b62d1d 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
@@ -38,9 +38,8 @@ static struct hns3_dbg_dentry_info hns3_dbg_dentry[] = {
},
};

-static int hns3_dbg_bd_file_init(struct hnae3_handle *handle, unsigned int cmd);
-static int hns3_dbg_common_file_init(struct hnae3_handle *handle,
- unsigned int cmd);
+static int hns3_dbg_bd_file_init(struct hnae3_handle *handle, u32 cmd);
+static int hns3_dbg_common_file_init(struct hnae3_handle *handle, u32 cmd);

static struct hns3_dbg_cmd_info hns3_dbg_cmd[] = {
{
--
2.8.1

2021-08-27 09:35:23

by Guangbin Huang

[permalink] [raw]
Subject: [PATCH net-next 5/8] net: hns3: remove redundant param to simplify code

From: Peng Li <[email protected]>

The param msg_q is redundant, copy &req->msg to
hdev->arq.msg_q[hdev->arq.tail] directly makes code clean.
So removes the redundant param msg_q.

Signed-off-by: Peng Li <[email protected]>
Signed-off-by: Guangbin Huang <[email protected]>
---
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
index d42e2715ab6c..46d06e1d04f9 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
@@ -161,7 +161,6 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev)
struct hclge_mbx_pf_to_vf_cmd *req;
struct hclgevf_cmq_ring *crq;
struct hclgevf_desc *desc;
- u16 *msg_q;
u16 flag;

resp = &hdev->mbx_resp;
@@ -243,8 +242,7 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev)
}

/* tail the async message in arq */
- msg_q = hdev->arq.msg_q[hdev->arq.tail];
- memcpy(&msg_q[0], &req->msg,
+ memcpy(hdev->arq.msg_q[hdev->arq.tail], &req->msg,
HCLGE_MBX_MAX_ARQ_MSG_SIZE * sizeof(u16));
hclge_mbx_tail_ptr_move_arq(hdev->arq);
atomic_inc(&hdev->arq.count);
--
2.8.1

2021-08-27 11:21:57

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net-next 0/8] net: hns3: add some cleanups

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Fri, 27 Aug 2021 17:28:16 +0800 you wrote:
> This series includes some cleanups for the HNS3 ethernet driver.
>
> Guangbin Huang (1):
> net: hns3: add macros for mac speeds of firmware command
>
> Hao Chen (1):
> net: hns3: uniform type of function parameter cmd
>
> [...]

Here is the summary with links:
- [net-next,1/8] net: hns3: add macros for mac speeds of firmware command
https://git.kernel.org/netdev/net-next/c/4c116f85ecf8
- [net-next,2/8] net: hns3: add hns3_state_init() to do state initialization
https://git.kernel.org/netdev/net-next/c/c511dfff4b65
- [net-next,3/8] net: hns3: remove redundant param mbx_event_pending
https://git.kernel.org/netdev/net-next/c/67821a0cf5c9
- [net-next,4/8] net: hns3: use memcpy to simplify code
https://git.kernel.org/netdev/net-next/c/304cd8e776dd
- [net-next,5/8] net: hns3: remove redundant param to simplify code
https://git.kernel.org/netdev/net-next/c/5f22a80f32de
- [net-next,6/8] net: hns3: package new functions to simplify hclgevf_mbx_handler code
https://git.kernel.org/netdev/net-next/c/d7517f8f6b3b
- [net-next,7/8] net: hns3: merge some repetitive macros
https://git.kernel.org/netdev/net-next/c/5a24b1fd301e
- [net-next,8/8] net: hns3: uniform type of function parameter cmd
https://git.kernel.org/netdev/net-next/c/0c5c135cdbda

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html