2022-04-16 15:41:21

by Guangbin Huang

[permalink] [raw]
Subject: [PATCH net-next 0/9] net: hns3: updates for -next

This series includes some updates for the HNS3 ethernet driver.

Hao Chen (3):
net: hns3: refactor hns3_set_ringparam()
net: hns3: add log for setting tx spare buf size
net: hns3: remove unnecessary line wrap for hns3_set_tunable

Jian Shen (1):
net: hns3: refine the definition for struct hclge_pf_to_vf_msg

Jie Wang (1):
net: hns3: add failure logs in hclge_set_vport_mtu

Peng Li (3):
net: hns3: update the comment of function hclgevf_get_mbx_resp
net: hns3: fix the wrong words in comments
net: hns3: replace magic value by HCLGE_RING_REG_OFFSET

Yufeng Mo (1):
net: hns3: add ethtool parameter check for CQE/EQE mode

.../net/ethernet/hisilicon/hns3/hclge_mbx.h | 17 ++-
drivers/net/ethernet/hisilicon/hns3/hnae3.h | 4 +
.../hns3/hns3_common/hclge_comm_cmd.c | 2 +
.../hns3/hns3_common/hclge_comm_cmd.h | 1 +
.../net/ethernet/hisilicon/hns3/hns3_enet.c | 5 +-
.../ethernet/hisilicon/hns3/hns3_ethtool.c | 108 +++++++++++++-----
.../ethernet/hisilicon/hns3/hns3_ethtool.h | 6 +
.../hisilicon/hns3/hns3pf/hclge_err.c | 2 +-
.../hisilicon/hns3/hns3pf/hclge_main.c | 3 +
.../hisilicon/hns3/hns3pf/hclge_mbx.c | 2 +-
.../hisilicon/hns3/hns3vf/hclgevf_main.c | 4 +-
.../hisilicon/hns3/hns3vf/hclgevf_mbx.c | 8 +-
12 files changed, 116 insertions(+), 46 deletions(-)

--
2.33.0


2022-04-17 00:13:16

by Guangbin Huang

[permalink] [raw]
Subject: [PATCH net-next 6/9] net: hns3: update the comment of function hclgevf_get_mbx_resp

From: Peng Li <[email protected]>

The param of function hclgevf_get_mbx_resp has been changed but the
comments not upodated. This patch updates it.

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

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
index d5e0a3f762f7..4761dceccea5 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
@@ -32,8 +32,10 @@ static void hclgevf_reset_mbx_resp_status(struct hclgevf_dev *hdev)
/* hclgevf_get_mbx_resp: used to get a response from PF after VF sends a mailbox
* message to PF.
* @hdev: pointer to struct hclgevf_dev
- * @resp_msg: pointer to store the original message type and response status
- * @len: the resp_msg data array length.
+ * @code0: the message opcode VF send to PF.
+ * @code1: the message sub-opcode VF send to PF.
+ * @resp_data: pointer to store response data from PF to VF.
+ * @resp_len: the length of resp_data from PF to VF.
*/
static int hclgevf_get_mbx_resp(struct hclgevf_dev *hdev, u16 code0, u16 code1,
u8 *resp_data, u16 resp_len)
--
2.33.0

2022-04-17 02:17:10

by Guangbin Huang

[permalink] [raw]
Subject: [PATCH net-next 9/9] net: hns3: remove unnecessary line wrap for hns3_set_tunable

From: Hao Chen <[email protected]>

Remove unnecessary line wrap for hns3_set_tunable to improve
function readability.

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

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 51ee8adab6a3..1e641083bd60 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -1172,8 +1172,7 @@ static int hns3_set_ringparam(struct net_device *ndev,

tmp_rings = hns3_backup_ringparam(priv);
if (!tmp_rings) {
- netdev_err(ndev,
- "backup ring param failed by allocating memory fail\n");
+ netdev_err(ndev, "backup ring param failed by allocating memory fail\n");
return -ENOMEM;
}

@@ -1875,13 +1874,11 @@ static int hns3_set_tunable(struct net_device *netdev,
(!priv->ring->tx_spare && new_tx_spare_buf_size != 0)) {
int ret1;

- netdev_warn(netdev,
- "change tx spare buf size fail, revert to old value\n");
+ netdev_warn(netdev, "change tx spare buf size fail, revert to old value\n");
ret1 = hns3_set_tx_spare_buf_size(netdev,
old_tx_spare_buf_size);
if (ret1) {
- netdev_err(netdev,
- "revert to old tx spare buf size fail\n");
+ netdev_err(netdev, "revert to old tx spare buf size fail\n");
return ret1;
}

--
2.33.0

2022-04-17 07:52:56

by Guangbin Huang

[permalink] [raw]
Subject: [PATCH net-next 3/9] net: hns3: refine the definition for struct hclge_pf_to_vf_msg

From: Jian Shen <[email protected]>

The struct hclge_pf_to_vf_msg is used for mailbox message from
PF to VF, including both response and request. But its definition
can only indicate respone, which makes the message data copy in
function hclge_send_mbx_msg() unreadable. So refine it by edding
a general message definition into it.

Signed-off-by: Jian Shen <[email protected]>
Signed-off-by: Guangbin Huang <[email protected]>
---
drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h | 17 +++++++++++++----
.../ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 2 +-
2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
index b668df6193be..8c7fadf2b734 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
@@ -135,10 +135,19 @@ struct hclge_vf_to_pf_msg {

struct hclge_pf_to_vf_msg {
u16 code;
- u16 vf_mbx_msg_code;
- u16 vf_mbx_msg_subcode;
- u16 resp_status;
- u8 resp_data[HCLGE_MBX_MAX_RESP_DATA_SIZE];
+ union {
+ /* used for mbx response */
+ struct {
+ u16 vf_mbx_msg_code;
+ u16 vf_mbx_msg_subcode;
+ u16 resp_status;
+ u8 resp_data[HCLGE_MBX_MAX_RESP_DATA_SIZE];
+ };
+ /* used for general mbx */
+ struct {
+ u8 msg_data[HCLGE_MBX_MAX_MSG_SIZE];
+ };
+ };
};

struct hclge_mbx_vf_to_pf_cmd {
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
index 6799d16de34b..76d0f17d6be3 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
@@ -102,7 +102,7 @@ static int hclge_send_mbx_msg(struct hclge_vport *vport, u8 *msg, u16 msg_len,
resp_pf_to_vf->msg_len = msg_len;
resp_pf_to_vf->msg.code = mbx_opcode;

- memcpy(&resp_pf_to_vf->msg.vf_mbx_msg_code, msg, msg_len);
+ memcpy(resp_pf_to_vf->msg.msg_data, msg, msg_len);

trace_hclge_pf_mbx_send(hdev, resp_pf_to_vf);

--
2.33.0

2022-04-18 10:13:43

by Guangbin Huang

[permalink] [raw]
Subject: [PATCH net-next 4/9] net: hns3: add failure logs in hclge_set_vport_mtu

From: Jie Wang <[email protected]>

Currently, There is a low probability that pf mtu configuration fails, but
the information in logs is insufficient for problem locating when the VF
mtu value is illegally modified.

So record the vf index and vf mtu value at the failure scenario.

Signed-off-by: Jie Wang <[email protected]>
Signed-off-by: Guangbin Huang <[email protected]>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 8cebb180c812..a5dd2c8c244a 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -10449,6 +10449,9 @@ int hclge_set_vport_mtu(struct hclge_vport *vport, int new_mtu)
/* PF's mps must be greater then VF's mps */
for (i = 1; i < hdev->num_alloc_vport; i++)
if (max_frm_size < hdev->vport[i].mps) {
+ dev_err(&hdev->pdev->dev,
+ "failed to set pf mtu for less than vport %d, mps = %u.\n",
+ i, hdev->vport[i].mps);
mutex_unlock(&hdev->vport_lock);
return -EINVAL;
}
--
2.33.0