All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 net-next 0/9] net: hns3: updates for -next
@ 2022-04-19  3:27 Guangbin Huang
  2022-04-19  3:27 ` [PATCH V2 net-next 1/9] net: hns3: add ethtool parameter check for CQE/EQE mode Guangbin Huang
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Guangbin Huang @ 2022-04-19  3:27 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

This series includes some updates for the HNS3 ethernet driver.

Change logs:
V1 -> V2:
 - Fix failed to apply to net-next problem.

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH V2 net-next 1/9] net: hns3: add ethtool parameter check for CQE/EQE mode
  2022-04-19  3:27 [PATCH V2 net-next 0/9] net: hns3: updates for -next Guangbin Huang
@ 2022-04-19  3:27 ` Guangbin Huang
  2022-04-19  3:27 ` [PATCH V2 net-next 2/9] net: hns3: refactor hns3_set_ringparam() Guangbin Huang
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Guangbin Huang @ 2022-04-19  3:27 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

From: Yufeng Mo <moyufeng@huawei.com>

For DEVICE_VERSION_V2, the hardware does not support the CQE mode.
So add capability bit for coalesce CQE mode and add parameter check
for it in ethtool.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 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    | 28 +++++++++++++++++--
 5 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
index 79c64f4e67d2..8a3a446219f7 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -96,6 +96,7 @@ enum HNAE3_DEV_CAP_BITS {
 	HNAE3_DEV_SUPPORT_PORT_VLAN_BYPASS_B,
 	HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B,
 	HNAE3_DEV_SUPPORT_MC_MAC_MNG_B,
+	HNAE3_DEV_SUPPORT_CQ_B,
 };
 
 #define hnae3_dev_fd_supported(hdev) \
@@ -155,6 +156,9 @@ enum HNAE3_DEV_CAP_BITS {
 #define hnae3_ae_dev_mc_mac_mng_supported(ae_dev) \
 	test_bit(HNAE3_DEV_SUPPORT_MC_MAC_MNG_B, (ae_dev)->caps)
 
+#define hnae3_ae_dev_cq_supported(ae_dev) \
+	test_bit(HNAE3_DEV_SUPPORT_CQ_B, (ae_dev)->caps)
+
 enum HNAE3_PF_CAP_BITS {
 	HNAE3_PF_SUPPORT_VLAN_FLTR_MDF_B = 0,
 };
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 c15ca710dabb..c8b151d29f53 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
@@ -149,6 +149,7 @@ static const struct hclge_comm_caps_bit_map hclge_pf_cmd_caps[] = {
 	{HCLGE_COMM_CAP_PORT_VLAN_BYPASS_B,
 	 HNAE3_DEV_SUPPORT_PORT_VLAN_BYPASS_B},
 	{HCLGE_COMM_CAP_PORT_VLAN_BYPASS_B, HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B},
+	{HCLGE_COMM_CAP_CQ_B, HNAE3_DEV_SUPPORT_CQ_B},
 };
 
 static const struct hclge_comm_caps_bit_map hclge_vf_cmd_caps[] = {
@@ -160,6 +161,7 @@ static const struct hclge_comm_caps_bit_map hclge_vf_cmd_caps[] = {
 	{HCLGE_COMM_CAP_QB_B, HNAE3_DEV_SUPPORT_QB_B},
 	{HCLGE_COMM_CAP_TX_PUSH_B, HNAE3_DEV_SUPPORT_TX_PUSH_B},
 	{HCLGE_COMM_CAP_RXD_ADV_LAYOUT_B, HNAE3_DEV_SUPPORT_RXD_ADV_LAYOUT_B},
+	{HCLGE_COMM_CAP_CQ_B, HNAE3_DEV_SUPPORT_CQ_B},
 };
 
 static void
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.h b/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.h
index 876650eddac4..7a7d4cf9bf35 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_cmd.h
@@ -338,6 +338,7 @@ enum HCLGE_COMM_CAP_BITS {
 	HCLGE_COMM_CAP_PAUSE_B = 14,
 	HCLGE_COMM_CAP_RXD_ADV_LAYOUT_B = 15,
 	HCLGE_COMM_CAP_PORT_VLAN_BYPASS_B = 17,
+	HCLGE_COMM_CAP_CQ_B = 18,
 };
 
 enum HCLGE_COMM_API_CAP_BITS {
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 14dc12c2155d..7e9f9da2f392 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -5159,10 +5159,7 @@ static void hns3_set_cq_period_mode(struct hns3_nic_priv *priv,
 			priv->tqp_vector[i].rx_group.dim.mode = mode;
 	}
 
-	/* only device version above V3(include V3), GL can switch CQ/EQ
-	 * period mode.
-	 */
-	if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3) {
+	if (hnae3_ae_dev_cq_supported(ae_dev)) {
 		u32 new_mode;
 		u64 reg;
 
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 9f4111fd2986..8663ba5d41d8 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -1415,11 +1415,33 @@ static int hns3_check_ql_coalesce_param(struct net_device *netdev,
 	return 0;
 }
 
-static int hns3_check_coalesce_para(struct net_device *netdev,
-				    struct ethtool_coalesce *cmd)
+static int
+hns3_check_cqe_coalesce_param(struct net_device *netdev,
+			      struct kernel_ethtool_coalesce *kernel_coal)
+{
+	struct hnae3_handle *handle = hns3_get_handle(netdev);
+	struct hnae3_ae_dev *ae_dev = pci_get_drvdata(handle->pdev);
+
+	if ((kernel_coal->use_cqe_mode_tx || kernel_coal->use_cqe_mode_rx) &&
+	    !hnae3_ae_dev_cq_supported(ae_dev)) {
+		netdev_err(netdev, "coalesced cqe mode is not supported\n");
+		return -EOPNOTSUPP;
+	}
+
+	return 0;
+}
+
+static int
+hns3_check_coalesce_para(struct net_device *netdev,
+			 struct ethtool_coalesce *cmd,
+			 struct kernel_ethtool_coalesce *kernel_coal)
 {
 	int ret;
 
+	ret = hns3_check_cqe_coalesce_param(netdev, kernel_coal);
+	if (ret)
+		return ret;
+
 	ret = hns3_check_gl_coalesce_para(netdev, cmd);
 	if (ret) {
 		netdev_err(netdev,
@@ -1494,7 +1516,7 @@ static int hns3_set_coalesce(struct net_device *netdev,
 	if (hns3_nic_resetting(netdev))
 		return -EBUSY;
 
-	ret = hns3_check_coalesce_para(netdev, cmd);
+	ret = hns3_check_coalesce_para(netdev, cmd, kernel_coal);
 	if (ret)
 		return ret;
 
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V2 net-next 2/9] net: hns3: refactor hns3_set_ringparam()
  2022-04-19  3:27 [PATCH V2 net-next 0/9] net: hns3: updates for -next Guangbin Huang
  2022-04-19  3:27 ` [PATCH V2 net-next 1/9] net: hns3: add ethtool parameter check for CQE/EQE mode Guangbin Huang
@ 2022-04-19  3:27 ` Guangbin Huang
  2022-04-19  3:27 ` [PATCH V2 net-next 3/9] net: hns3: refine the definition for struct hclge_pf_to_vf_msg Guangbin Huang
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Guangbin Huang @ 2022-04-19  3:27 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

From: Hao Chen <chenhao288@hisilicon.com>

Use struct hns3_ring_param to replace variable new/old_xxx and
add hns3_is_ringparam_changed() to judge them if is changed to
improve code readability.

Signed-off-by: Hao Chen <chenhao288@hisilicon.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 .../ethernet/hisilicon/hns3/hns3_ethtool.c    | 65 ++++++++++++-------
 .../ethernet/hisilicon/hns3/hns3_ethtool.h    |  6 ++
 2 files changed, 49 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 8663ba5d41d8..e647751e9054 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -1106,6 +1106,36 @@ static int hns3_check_ringparam(struct net_device *ndev,
 	return 0;
 }
 
+static bool
+hns3_is_ringparam_changed(struct net_device *ndev,
+			  struct ethtool_ringparam *param,
+			  struct kernel_ethtool_ringparam *kernel_param,
+			  struct hns3_ring_param *old_ringparam,
+			  struct hns3_ring_param *new_ringparam)
+{
+	struct hns3_nic_priv *priv = netdev_priv(ndev);
+	struct hnae3_handle *h = priv->ae_handle;
+	u16 queue_num = h->kinfo.num_tqps;
+
+	new_ringparam->tx_desc_num = ALIGN(param->tx_pending,
+					   HNS3_RING_BD_MULTIPLE);
+	new_ringparam->rx_desc_num = ALIGN(param->rx_pending,
+					   HNS3_RING_BD_MULTIPLE);
+	old_ringparam->tx_desc_num = priv->ring[0].desc_num;
+	old_ringparam->rx_desc_num = priv->ring[queue_num].desc_num;
+	old_ringparam->rx_buf_len = priv->ring[queue_num].buf_size;
+	new_ringparam->rx_buf_len = kernel_param->rx_buf_len;
+
+	if (old_ringparam->tx_desc_num == new_ringparam->tx_desc_num &&
+	    old_ringparam->rx_desc_num == new_ringparam->rx_desc_num &&
+	    old_ringparam->rx_buf_len == new_ringparam->rx_buf_len) {
+		netdev_info(ndev, "ringparam not changed\n");
+		return false;
+	}
+
+	return true;
+}
+
 static int hns3_change_rx_buf_len(struct net_device *ndev, u32 rx_buf_len)
 {
 	struct hns3_nic_priv *priv = netdev_priv(ndev);
@@ -1151,14 +1181,11 @@ static int hns3_set_ringparam(struct net_device *ndev,
 			      struct kernel_ethtool_ringparam *kernel_param,
 			      struct netlink_ext_ack *extack)
 {
+	struct hns3_ring_param old_ringparam, new_ringparam;
 	struct hns3_nic_priv *priv = netdev_priv(ndev);
 	struct hnae3_handle *h = priv->ae_handle;
 	struct hns3_enet_ring *tmp_rings;
 	bool if_running = netif_running(ndev);
-	u32 old_tx_desc_num, new_tx_desc_num;
-	u32 old_rx_desc_num, new_rx_desc_num;
-	u16 queue_num = h->kinfo.num_tqps;
-	u32 old_rx_buf_len;
 	int ret, i;
 
 	ret = hns3_check_ringparam(ndev, param, kernel_param);
@@ -1169,15 +1196,8 @@ static int hns3_set_ringparam(struct net_device *ndev,
 	if (ret)
 		return ret;
 
-	/* Hardware requires that its descriptors must be multiple of eight */
-	new_tx_desc_num = ALIGN(param->tx_pending, HNS3_RING_BD_MULTIPLE);
-	new_rx_desc_num = ALIGN(param->rx_pending, HNS3_RING_BD_MULTIPLE);
-	old_tx_desc_num = priv->ring[0].desc_num;
-	old_rx_desc_num = priv->ring[queue_num].desc_num;
-	old_rx_buf_len = priv->ring[queue_num].buf_size;
-	if (old_tx_desc_num == new_tx_desc_num &&
-	    old_rx_desc_num == new_rx_desc_num &&
-	    kernel_param->rx_buf_len == old_rx_buf_len)
+	if (!hns3_is_ringparam_changed(ndev, param, kernel_param,
+				       &old_ringparam, &new_ringparam))
 		return 0;
 
 	tmp_rings = hns3_backup_ringparam(priv);
@@ -1188,24 +1208,25 @@ static int hns3_set_ringparam(struct net_device *ndev,
 	}
 
 	netdev_info(ndev,
-		    "Changing Tx/Rx ring depth from %u/%u to %u/%u, Changing rx buffer len from %d to %d\n",
-		    old_tx_desc_num, old_rx_desc_num,
-		    new_tx_desc_num, new_rx_desc_num,
-		    old_rx_buf_len, kernel_param->rx_buf_len);
+		    "Changing Tx/Rx ring depth from %u/%u to %u/%u, Changing rx buffer len from %u to %u\n",
+		    old_ringparam.tx_desc_num, old_ringparam.rx_desc_num,
+		    new_ringparam.tx_desc_num, new_ringparam.rx_desc_num,
+		    old_ringparam.rx_buf_len, new_ringparam.rx_buf_len);
 
 	if (if_running)
 		ndev->netdev_ops->ndo_stop(ndev);
 
-	hns3_change_all_ring_bd_num(priv, new_tx_desc_num, new_rx_desc_num);
-	hns3_change_rx_buf_len(ndev, kernel_param->rx_buf_len);
+	hns3_change_all_ring_bd_num(priv, new_ringparam.tx_desc_num,
+				    new_ringparam.rx_desc_num);
+	hns3_change_rx_buf_len(ndev, new_ringparam.rx_buf_len);
 	ret = hns3_init_all_ring(priv);
 	if (ret) {
 		netdev_err(ndev, "set ringparam fail, revert to old value(%d)\n",
 			   ret);
 
-		hns3_change_rx_buf_len(ndev, old_rx_buf_len);
-		hns3_change_all_ring_bd_num(priv, old_tx_desc_num,
-					    old_rx_desc_num);
+		hns3_change_rx_buf_len(ndev, old_ringparam.rx_buf_len);
+		hns3_change_all_ring_bd_num(priv, old_ringparam.tx_desc_num,
+					    old_ringparam.rx_desc_num);
 		for (i = 0; i < h->kinfo.num_tqps * 2; i++)
 			memcpy(&priv->ring[i], &tmp_rings[i],
 			       sizeof(struct hns3_enet_ring));
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.h b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.h
index 822d6fcbc73b..da207d1d9aa9 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.h
@@ -28,4 +28,10 @@ struct hns3_ethtool_link_ext_state_mapping {
 	u8 link_ext_substate;
 };
 
+struct hns3_ring_param {
+	u32 tx_desc_num;
+	u32 rx_desc_num;
+	u32 rx_buf_len;
+};
+
 #endif
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V2 net-next 3/9] net: hns3: refine the definition for struct hclge_pf_to_vf_msg
  2022-04-19  3:27 [PATCH V2 net-next 0/9] net: hns3: updates for -next Guangbin Huang
  2022-04-19  3:27 ` [PATCH V2 net-next 1/9] net: hns3: add ethtool parameter check for CQE/EQE mode Guangbin Huang
  2022-04-19  3:27 ` [PATCH V2 net-next 2/9] net: hns3: refactor hns3_set_ringparam() Guangbin Huang
@ 2022-04-19  3:27 ` Guangbin Huang
  2022-04-19  3:27 ` [PATCH V2 net-next 4/9] net: hns3: add failure logs in hclge_set_vport_mtu Guangbin Huang
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Guangbin Huang @ 2022-04-19  3:27 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

From: Jian Shen <shenjian15@huawei.com>

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 <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V2 net-next 4/9] net: hns3: add failure logs in hclge_set_vport_mtu
  2022-04-19  3:27 [PATCH V2 net-next 0/9] net: hns3: updates for -next Guangbin Huang
                   ` (2 preceding siblings ...)
  2022-04-19  3:27 ` [PATCH V2 net-next 3/9] net: hns3: refine the definition for struct hclge_pf_to_vf_msg Guangbin Huang
@ 2022-04-19  3:27 ` Guangbin Huang
  2022-04-19  3:27 ` [PATCH V2 net-next 5/9] net: hns3: add log for setting tx spare buf size Guangbin Huang
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Guangbin Huang @ 2022-04-19  3:27 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

From: Jie Wang <wangjie125@huawei.com>

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 <wangjie125@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V2 net-next 5/9] net: hns3: add log for setting tx spare buf size
  2022-04-19  3:27 [PATCH V2 net-next 0/9] net: hns3: updates for -next Guangbin Huang
                   ` (3 preceding siblings ...)
  2022-04-19  3:27 ` [PATCH V2 net-next 4/9] net: hns3: add failure logs in hclge_set_vport_mtu Guangbin Huang
@ 2022-04-19  3:27 ` Guangbin Huang
  2022-04-19  3:27 ` [PATCH V2 net-next 6/9] net: hns3: update the comment of function hclgevf_get_mbx_resp Guangbin Huang
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Guangbin Huang @ 2022-04-19  3:27 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

From: Hao Chen <chenhao288@hisilicon.com>

For the active tx spare buffer size maybe changed according
to the page size, so add log to notice it.

Signed-off-by: Hao Chen <chenhao288@hisilicon.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index e647751e9054..73498e125492 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -1898,6 +1898,8 @@ static int hns3_set_tunable(struct net_device *netdev,
 	case ETHTOOL_TX_COPYBREAK_BUF_SIZE:
 		old_tx_spare_buf_size = h->kinfo.tx_spare_buf_size;
 		new_tx_spare_buf_size = *(u32 *)data;
+		netdev_info(netdev, "request to set tx spare buf size from %u to %u\n",
+			    old_tx_spare_buf_size, new_tx_spare_buf_size);
 		ret = hns3_set_tx_spare_buf_size(netdev, new_tx_spare_buf_size);
 		if (ret ||
 		    (!priv->ring->tx_spare && new_tx_spare_buf_size != 0)) {
@@ -1915,6 +1917,10 @@ static int hns3_set_tunable(struct net_device *netdev,
 
 			return ret;
 		}
+
+		netdev_info(netdev, "the actvie tx spare buf size is %u, due to page order\n",
+			    priv->ring->tx_spare->len);
+
 		break;
 	default:
 		ret = -EOPNOTSUPP;
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V2 net-next 6/9] net: hns3: update the comment of function hclgevf_get_mbx_resp
  2022-04-19  3:27 [PATCH V2 net-next 0/9] net: hns3: updates for -next Guangbin Huang
                   ` (4 preceding siblings ...)
  2022-04-19  3:27 ` [PATCH V2 net-next 5/9] net: hns3: add log for setting tx spare buf size Guangbin Huang
@ 2022-04-19  3:27 ` Guangbin Huang
  2022-04-19  3:27 ` [PATCH V2 net-next 7/9] net: hns3: fix the wrong words in comments Guangbin Huang
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Guangbin Huang @ 2022-04-19  3:27 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

From: Peng Li <lipeng321@huawei.com>

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<lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V2 net-next 7/9] net: hns3: fix the wrong words in comments
  2022-04-19  3:27 [PATCH V2 net-next 0/9] net: hns3: updates for -next Guangbin Huang
                   ` (5 preceding siblings ...)
  2022-04-19  3:27 ` [PATCH V2 net-next 6/9] net: hns3: update the comment of function hclgevf_get_mbx_resp Guangbin Huang
@ 2022-04-19  3:27 ` Guangbin Huang
  2022-04-19  3:27 ` [PATCH V2 net-next 8/9] net: hns3: replace magic value by HCLGE_RING_REG_OFFSET Guangbin Huang
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Guangbin Huang @ 2022-04-19  3:27 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

From: Peng Li <lipeng321@huawei.com>

This patch fixes wrong words in comments.

Signed-off-by: Peng Li<lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c    | 2 +-
 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 2 +-
 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
index 42a9e73d8588..6efd768cc07c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
@@ -1977,7 +1977,7 @@ static int hclge_handle_mpf_ras_error(struct hclge_dev *hdev,
  * @num:  number of extended command structures
  *
  * This function handles all the PF RAS errors in the
- * hw register/s using command.
+ * hw registers using command.
  */
 static int hclge_handle_pf_ras_error(struct hclge_dev *hdev,
 				     struct hclge_desc *desc,
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
index 342d7cdf6285..528b5a17adb0 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
@@ -2963,7 +2963,7 @@ static int hclgevf_init_hdev(struct hclgevf_dev *hdev)
 		goto err_config;
 	}
 
-	/* ensure vf tbl list as empty before init*/
+	/* ensure vf tbl list as empty before init */
 	ret = hclgevf_clear_vport_list(hdev);
 	if (ret) {
 		dev_err(&pdev->dev,
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
index 4761dceccea5..c8055d69255c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c
@@ -17,7 +17,7 @@ static int hclgevf_resp_to_errno(u16 resp_code)
 static void hclgevf_reset_mbx_resp_status(struct hclgevf_dev *hdev)
 {
 	/* this function should be called with mbx_resp.mbx_mutex held
-	 * to prtect the received_response from race condition
+	 * to protect the received_response from race condition
 	 */
 	hdev->mbx_resp.received_resp  = false;
 	hdev->mbx_resp.origin_mbx_msg = 0;
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V2 net-next 8/9] net: hns3: replace magic value by HCLGE_RING_REG_OFFSET
  2022-04-19  3:27 [PATCH V2 net-next 0/9] net: hns3: updates for -next Guangbin Huang
                   ` (6 preceding siblings ...)
  2022-04-19  3:27 ` [PATCH V2 net-next 7/9] net: hns3: fix the wrong words in comments Guangbin Huang
@ 2022-04-19  3:27 ` Guangbin Huang
  2022-04-19  3:27 ` [PATCH V2 net-next 9/9] net: hns3: remove unnecessary line wrap for hns3_set_tunable Guangbin Huang
  2022-04-20 10:00 ` [PATCH V2 net-next 0/9] net: hns3: updates for -next patchwork-bot+netdevbpf
  9 siblings, 0 replies; 11+ messages in thread
From: Guangbin Huang @ 2022-04-19  3:27 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

From: Peng Li <lipeng321@huawei.com>

Magic values are not recommended.

Signed-off-by: Peng Li<lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
index 528b5a17adb0..e13d71abd9f7 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
@@ -3315,7 +3315,7 @@ static void hclgevf_get_regs(struct hnae3_handle *handle, u32 *version,
 		for (i = 0; i < reg_um; i++)
 			*reg++ = hclgevf_read_dev(&hdev->hw,
 						  ring_reg_addr_list[i] +
-						  0x200 * j);
+						  HCLGEVF_TQP_REG_SIZE * j);
 		for (i = 0; i < separator_num; i++)
 			*reg++ = SEPARATOR_VALUE;
 	}
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH V2 net-next 9/9] net: hns3: remove unnecessary line wrap for hns3_set_tunable
  2022-04-19  3:27 [PATCH V2 net-next 0/9] net: hns3: updates for -next Guangbin Huang
                   ` (7 preceding siblings ...)
  2022-04-19  3:27 ` [PATCH V2 net-next 8/9] net: hns3: replace magic value by HCLGE_RING_REG_OFFSET Guangbin Huang
@ 2022-04-19  3:27 ` Guangbin Huang
  2022-04-20 10:00 ` [PATCH V2 net-next 0/9] net: hns3: updates for -next patchwork-bot+netdevbpf
  9 siblings, 0 replies; 11+ messages in thread
From: Guangbin Huang @ 2022-04-19  3:27 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, lipeng321, huangguangbin2, chenhao288

From: Hao Chen <chenhao288@hisilicon.com>

Remove unnecessary line wrap for hns3_set_tunable to improve
function readability.

Signed-off-by: Hao Chen <chenhao288@hisilicon.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
 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 73498e125492..bb001f597857 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -1202,8 +1202,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;
 	}
 
@@ -1905,13 +1904,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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH V2 net-next 0/9] net: hns3: updates for -next
  2022-04-19  3:27 [PATCH V2 net-next 0/9] net: hns3: updates for -next Guangbin Huang
                   ` (8 preceding siblings ...)
  2022-04-19  3:27 ` [PATCH V2 net-next 9/9] net: hns3: remove unnecessary line wrap for hns3_set_tunable Guangbin Huang
@ 2022-04-20 10:00 ` patchwork-bot+netdevbpf
  9 siblings, 0 replies; 11+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-04-20 10:00 UTC (permalink / raw)
  To: Guangbin Huang; +Cc: davem, kuba, netdev, linux-kernel, lipeng321, chenhao288

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Tue, 19 Apr 2022 11:27:00 +0800 you wrote:
> This series includes some updates for the HNS3 ethernet driver.
> 
> Change logs:
> V1 -> V2:
>  - Fix failed to apply to net-next problem.
> 
> 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
> 
> [...]

Here is the summary with links:
  - [V2,net-next,1/9] net: hns3: add ethtool parameter check for CQE/EQE mode
    https://git.kernel.org/netdev/net-next/c/286c61e72797
  - [V2,net-next,2/9] net: hns3: refactor hns3_set_ringparam()
    https://git.kernel.org/netdev/net-next/c/07fdc163ac88
  - [V2,net-next,3/9] net: hns3: refine the definition for struct hclge_pf_to_vf_msg
    https://git.kernel.org/netdev/net-next/c/6fde96df0447
  - [V2,net-next,4/9] net: hns3: add failure logs in hclge_set_vport_mtu
    https://git.kernel.org/netdev/net-next/c/bcc7a98f0d3c
  - [V2,net-next,5/9] net: hns3: add log for setting tx spare buf size
    https://git.kernel.org/netdev/net-next/c/2373b35c24ff
  - [V2,net-next,6/9] net: hns3: update the comment of function hclgevf_get_mbx_resp
    https://git.kernel.org/netdev/net-next/c/2e0f53887011
  - [V2,net-next,7/9] net: hns3: fix the wrong words in comments
    https://git.kernel.org/netdev/net-next/c/9c657cbc2c15
  - [V2,net-next,8/9] net: hns3: replace magic value by HCLGE_RING_REG_OFFSET
    https://git.kernel.org/netdev/net-next/c/350cb4409246
  - [V2,net-next,9/9] net: hns3: remove unnecessary line wrap for hns3_set_tunable
    https://git.kernel.org/netdev/net-next/c/29c17cb67271

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



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-04-20 10:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19  3:27 [PATCH V2 net-next 0/9] net: hns3: updates for -next Guangbin Huang
2022-04-19  3:27 ` [PATCH V2 net-next 1/9] net: hns3: add ethtool parameter check for CQE/EQE mode Guangbin Huang
2022-04-19  3:27 ` [PATCH V2 net-next 2/9] net: hns3: refactor hns3_set_ringparam() Guangbin Huang
2022-04-19  3:27 ` [PATCH V2 net-next 3/9] net: hns3: refine the definition for struct hclge_pf_to_vf_msg Guangbin Huang
2022-04-19  3:27 ` [PATCH V2 net-next 4/9] net: hns3: add failure logs in hclge_set_vport_mtu Guangbin Huang
2022-04-19  3:27 ` [PATCH V2 net-next 5/9] net: hns3: add log for setting tx spare buf size Guangbin Huang
2022-04-19  3:27 ` [PATCH V2 net-next 6/9] net: hns3: update the comment of function hclgevf_get_mbx_resp Guangbin Huang
2022-04-19  3:27 ` [PATCH V2 net-next 7/9] net: hns3: fix the wrong words in comments Guangbin Huang
2022-04-19  3:27 ` [PATCH V2 net-next 8/9] net: hns3: replace magic value by HCLGE_RING_REG_OFFSET Guangbin Huang
2022-04-19  3:27 ` [PATCH V2 net-next 9/9] net: hns3: remove unnecessary line wrap for hns3_set_tunable Guangbin Huang
2022-04-20 10:00 ` [PATCH V2 net-next 0/9] net: hns3: updates for -next patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.