Skip to contentSkip to conversation

net: hinic: Convert the cmd code from decimal to hex to be more readable

PATCH Superseded Cai Huoqing 3 participants 15 messages Oct 26, 2022 – Nov 1, 2022

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Cai Huoqing

author maintainer
#0 lore raw

PATCH 1/2 net: hinic: Convert the cmd code from decimal to hex to be more readable

The print cmd code is in hex, so using hex cmd code intead of decimal is easy to check the value with print info.

---
 .../net/ethernet/huawei/hinic/hinic_hw_dev.h  | 108 +++++++++---------
 1 file changed, 52 insertions(+), 56 deletions(-)
drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h +52 -56
index d2d89b0a5ef0..abffd967a791 100644
@@ -46,104 +46,100 @@ enum hinic_port_cmd {
 	HINIC_PORT_CMD_VF_REGISTER = 0x0,
 	HINIC_PORT_CMD_VF_UNREGISTER = 0x1,
 
-	HINIC_PORT_CMD_CHANGE_MTU       = 2,
+	HINIC_PORT_CMD_CHANGE_MTU = 0x2,
 
-	HINIC_PORT_CMD_ADD_VLAN         = 3,
-	HINIC_PORT_CMD_DEL_VLAN         = 4,
+	HINIC_PORT_CMD_ADD_VLAN = 0x3,
+	HINIC_PORT_CMD_DEL_VLAN = 0x4,
 
-	HINIC_PORT_CMD_SET_PFC		= 5,
+	HINIC_PORT_CMD_SET_PFC = 0x5,
 
-	HINIC_PORT_CMD_SET_MAC          = 9,
-	HINIC_PORT_CMD_GET_MAC          = 10,
-	HINIC_PORT_CMD_DEL_MAC          = 11,
+	HINIC_PORT_CMD_SET_MAC = 0x9,
+	HINIC_PORT_CMD_GET_MAC = 0xA,
+	HINIC_PORT_CMD_DEL_MAC = 0xB,
 
-	HINIC_PORT_CMD_SET_RX_MODE      = 12,
+	HINIC_PORT_CMD_SET_RX_MODE = 0xC,
 
-	HINIC_PORT_CMD_GET_PAUSE_INFO	= 20,
-	HINIC_PORT_CMD_SET_PAUSE_INFO	= 21,
+	HINIC_PORT_CMD_GET_PAUSE_INFO = 0x14,
+	HINIC_PORT_CMD_SET_PAUSE_INFO = 0x15,
 
-	HINIC_PORT_CMD_GET_LINK_STATE   = 24,
+	HINIC_PORT_CMD_GET_LINK_STATE = 0x18,
 
-	HINIC_PORT_CMD_SET_LRO		= 25,
+	HINIC_PORT_CMD_SET_LRO = 0x19,
 
-	HINIC_PORT_CMD_SET_RX_CSUM	= 26,
+	HINIC_PORT_CMD_SET_RX_CSUM = 0x1A,
 
-	HINIC_PORT_CMD_SET_RX_VLAN_OFFLOAD = 27,
+	HINIC_PORT_CMD_SET_RX_VLAN_OFFLOAD = 0x1B,
 
-	HINIC_PORT_CMD_GET_PORT_STATISTICS = 28,
+	HINIC_PORT_CMD_GET_PORT_STATISTICS = 0x1C,
 
-	HINIC_PORT_CMD_CLEAR_PORT_STATISTICS = 29,
+	HINIC_PORT_CMD_CLEAR_PORT_STATISTICS = 0x1D,
 
-	HINIC_PORT_CMD_GET_VPORT_STAT	= 30,
+	HINIC_PORT_CMD_GET_VPORT_STAT = 0x1E,
 
-	HINIC_PORT_CMD_CLEAN_VPORT_STAT	= 31,
+	HINIC_PORT_CMD_CLEAN_VPORT_STAT	= 0x1F,
 
-	HINIC_PORT_CMD_GET_RSS_TEMPLATE_INDIR_TBL = 37,
+	HINIC_PORT_CMD_GET_RSS_TEMPLATE_INDIR_TBL = 0x25,
 
-	HINIC_PORT_CMD_SET_PORT_STATE   = 41,
+	HINIC_PORT_CMD_SET_PORT_STATE = 0x29,
 
-	HINIC_PORT_CMD_SET_RSS_TEMPLATE_TBL = 43,
+	HINIC_PORT_CMD_SET_RSS_TEMPLATE_TBL = 0x2B,
+	HINIC_PORT_CMD_GET_RSS_TEMPLATE_TBL = 0x2C,
 
-	HINIC_PORT_CMD_GET_RSS_TEMPLATE_TBL = 44,
+	HINIC_PORT_CMD_SET_RSS_HASH_ENGINE = 0x2D,
+	HINIC_PORT_CMD_GET_RSS_HASH_ENGINE = 0x2E,
 
-	HINIC_PORT_CMD_SET_RSS_HASH_ENGINE = 45,
+	HINIC_PORT_CMD_GET_RSS_CTX_TBL = 0x2F,
+	HINIC_PORT_CMD_SET_RSS_CTX_TBL = 0x30,
 
-	HINIC_PORT_CMD_GET_RSS_HASH_ENGINE = 46,
+	HINIC_PORT_CMD_RSS_TEMP_MGR	= 0x31,
 
-	HINIC_PORT_CMD_GET_RSS_CTX_TBL  = 47,
+	HINIC_PORT_CMD_RD_LINE_TBL = 0x39,
 
-	HINIC_PORT_CMD_SET_RSS_CTX_TBL  = 48,
+	HINIC_PORT_CMD_RSS_CFG = 0x42,
 
-	HINIC_PORT_CMD_RSS_TEMP_MGR	= 49,
+	HINIC_PORT_CMD_FWCTXT_INIT = 0x45,
 
-	HINIC_PORT_CMD_RD_LINE_TBL	= 57,
+	HINIC_PORT_CMD_GET_LOOPBACK_MODE = 0x48,
+	HINIC_PORT_CMD_SET_LOOPBACK_MODE = 0x49,
 
-	HINIC_PORT_CMD_RSS_CFG		= 66,
+	HINIC_PORT_CMD_ENABLE_SPOOFCHK = 0x4E,
 
-	HINIC_PORT_CMD_FWCTXT_INIT      = 69,
+	HINIC_PORT_CMD_GET_MGMT_VERSION = 0x58,
 
-	HINIC_PORT_CMD_GET_LOOPBACK_MODE = 72,
-	HINIC_PORT_CMD_SET_LOOPBACK_MODE,
+	HINIC_PORT_CMD_SET_FUNC_STATE = 0x5D,
 
-	HINIC_PORT_CMD_ENABLE_SPOOFCHK = 78,
+	HINIC_PORT_CMD_GET_GLOBAL_QPN = 0x66,
 
-	HINIC_PORT_CMD_GET_MGMT_VERSION = 88,
+	HINIC_PORT_CMD_SET_VF_RATE = 0x69,
 
-	HINIC_PORT_CMD_SET_FUNC_STATE   = 93,
+	HINIC_PORT_CMD_SET_VF_VLAN = 0x6A,
+	HINIC_PORT_CMD_CLR_VF_VLAN = 0x6B,
 
-	HINIC_PORT_CMD_GET_GLOBAL_QPN   = 102,
+	HINIC_PORT_CMD_SET_TSO = 0x70,
 
-	HINIC_PORT_CMD_SET_VF_RATE = 105,
+	HINIC_PORT_CMD_UPDATE_FW = 0x72,
 
-	HINIC_PORT_CMD_SET_VF_VLAN	= 106,
+	HINIC_PORT_CMD_SET_RQ_IQ_MAP = 0x73,
 
-	HINIC_PORT_CMD_CLR_VF_VLAN,
+	HINIC_PORT_CMD_LINK_STATUS_REPORT = 0xA0,
 
-	HINIC_PORT_CMD_SET_TSO          = 112,
+	HINIC_PORT_CMD_UPDATE_MAC = 0xA4,
 
-	HINIC_PORT_CMD_UPDATE_FW	= 114,
+	HINIC_PORT_CMD_GET_CAP = 0xAA,
 
-	HINIC_PORT_CMD_SET_RQ_IQ_MAP	= 115,
+	HINIC_PORT_CMD_GET_LINK_MODE = 0xD9,
 
-	HINIC_PORT_CMD_LINK_STATUS_REPORT = 160,
+	HINIC_PORT_CMD_SET_SPEED = 0xDA,
 
-	HINIC_PORT_CMD_UPDATE_MAC = 164,
+	HINIC_PORT_CMD_SET_AUTONEG = 0xDB,
 
-	HINIC_PORT_CMD_GET_CAP          = 170,
+	HINIC_PORT_CMD_GET_STD_SFP_INFO = 0xF0,
 
-	HINIC_PORT_CMD_GET_LINK_MODE	= 217,
+	HINIC_PORT_CMD_SET_LRO_TIMER = 0xF4,
 
-	HINIC_PORT_CMD_SET_SPEED	= 218,
+	HINIC_PORT_CMD_SET_VF_MAX_MIN_RATE = 0xF9,
 
-	HINIC_PORT_CMD_SET_AUTONEG	= 219,
-
-	HINIC_PORT_CMD_GET_STD_SFP_INFO = 240,
-
-	HINIC_PORT_CMD_SET_LRO_TIMER	= 244,
-
-	HINIC_PORT_CMD_SET_VF_MAX_MIN_RATE = 249,
-
-	HINIC_PORT_CMD_GET_SFP_ABS	= 251,
+	HINIC_PORT_CMD_GET_SFP_ABS = 0xFB,
 };
 
 /* cmd of mgmt CPU message for HILINK module */
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH 2/2 net: hinic: Add control command support for VF PMD driver in DPDK

HINIC has a mailbox for PF-VF communication and the VF driver could send port control command to PF driver via mailbox.

The control command only can be set to register in PF, so add support in PF driver for VF PMD driver control command when VF PMD driver work with linux PF driver.

---
 .../net/ethernet/huawei/hinic/hinic_hw_dev.h  | 64 +++++++++++++++++++
 .../net/ethernet/huawei/hinic/hinic_sriov.c   | 18 ++++++
 2 files changed, 82 insertions(+)
drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h +64 -0
index abffd967a791..4f561e4e849a 100644
@@ -53,11 +53,15 @@ enum hinic_port_cmd {
 
 	HINIC_PORT_CMD_SET_PFC = 0x5,
 
+	HINIC_PORT_CMD_SET_ETS = 0x7,
+	HINIC_PORT_CMD_GET_ETS = 0x8,
+
 	HINIC_PORT_CMD_SET_MAC = 0x9,
 	HINIC_PORT_CMD_GET_MAC = 0xA,
 	HINIC_PORT_CMD_DEL_MAC = 0xB,
 
 	HINIC_PORT_CMD_SET_RX_MODE = 0xC,
+	HINIC_PORT_CMD_SET_ANTI_ATTACK_RATE = 0xD,
 
 	HINIC_PORT_CMD_GET_PAUSE_INFO = 0x14,
 	HINIC_PORT_CMD_SET_PAUSE_INFO = 0x15,
@@ -81,6 +85,7 @@ enum hinic_port_cmd {
 	HINIC_PORT_CMD_GET_RSS_TEMPLATE_INDIR_TBL = 0x25,
 
 	HINIC_PORT_CMD_SET_PORT_STATE = 0x29,
+	HINIC_PORT_CMD_GET_PORT_STATE = 0x30,
 
 	HINIC_PORT_CMD_SET_RSS_TEMPLATE_TBL = 0x2B,
 	HINIC_PORT_CMD_GET_RSS_TEMPLATE_TBL = 0x2C,
@@ -97,17 +102,29 @@ enum hinic_port_cmd {
 
 	HINIC_PORT_CMD_RSS_CFG = 0x42,
 
+	HINIC_PORT_CMD_GET_PHY_TYPE = 0x44,
+
 	HINIC_PORT_CMD_FWCTXT_INIT = 0x45,
 
 	HINIC_PORT_CMD_GET_LOOPBACK_MODE = 0x48,
 	HINIC_PORT_CMD_SET_LOOPBACK_MODE = 0x49,
 
+	HINIC_PORT_CMD_GET_JUMBO_FRAME_SIZE = 0x4A,
+	HINIC_PORT_CMD_SET_JUMBO_FRAME_SIZE = 0x4B,
+
 	HINIC_PORT_CMD_ENABLE_SPOOFCHK = 0x4E,
 
 	HINIC_PORT_CMD_GET_MGMT_VERSION = 0x58,
 
+	HINIC_PORT_CMD_GET_PORT_TYPE = 0x5B,
+
 	HINIC_PORT_CMD_SET_FUNC_STATE = 0x5D,
 
+	HINIC_PORT_CMD_GET_PORT_ID_BY_FUNC_ID = 0x5E,
+
+	HINIC_PORT_CMD_GET_DMA_CS = 0x64,
+	HINIC_PORT_CMD_SET_DMA_CS = 0x65,
+
 	HINIC_PORT_CMD_GET_GLOBAL_QPN = 0x66,
 
 	HINIC_PORT_CMD_SET_VF_RATE = 0x69,
@@ -121,25 +138,72 @@ enum hinic_port_cmd {
 
 	HINIC_PORT_CMD_SET_RQ_IQ_MAP = 0x73,
 
+	HINIC_PORT_CMD_SET_PFC_THD = 0x75,
+
 	HINIC_PORT_CMD_LINK_STATUS_REPORT = 0xA0,
 
+	HINIC_PORT_CMD_SET_LOSSLESS_ETH	= 0xA3,
+
 	HINIC_PORT_CMD_UPDATE_MAC = 0xA4,
 
 	HINIC_PORT_CMD_GET_CAP = 0xAA,
 
+	HINIC_PORT_CMD_UP_TC_ADD_FLOW = 0xAF,
+	HINIC_PORT_CMD_UP_TC_DEL_FLOW = 0xB0,
+	HINIC_PORT_CMD_UP_TC_GET_FLOW = 0xB1,
+
+	HINIC_PORT_CMD_UP_TC_FLUSH_TCAM = 0xB2,
+
+	HINIC_PORT_CMD_UP_TC_CTRL_TCAM_BLOCK = 0xB3,
+
+	HINIC_PORT_CMD_UP_TC_ENABLE = 0xB4,
+
+	HINIC_PORT_CMD_UP_TC_GET_TCAM_BLOCK = 0xB5,
+
+	HINIC_PORT_CMD_SET_IPSU_MAC = 0xCB,
+	HINIC_PORT_CMD_GET_IPSU_MAC = 0xCC,
+
+	HINIC_PORT_CMD_SET_XSFP_STATUS = 0xD4,
 	HINIC_PORT_CMD_GET_LINK_MODE = 0xD9,
 
 	HINIC_PORT_CMD_SET_SPEED = 0xDA,
 
 	HINIC_PORT_CMD_SET_AUTONEG = 0xDB,
 
+	HINIC_PORT_CMD_CLEAR_QP_RES = 0xDD,
+
+	HINIC_PORT_CMD_SET_SUPER_CQE = 0xDE,
+
+	HINIC_PORT_CMD_SET_VF_COS = 0xDF,
+	HINIC_PORT_CMD_GET_VF_COS = 0xE1,
+
+	HINIC_PORT_CMD_CABLE_PLUG_EVENT	= 0xE5,
+
+	HINIC_PORT_CMD_LINK_ERR_EVENT = 0xE6,
+
+	HINIC_PORT_CMD_SET_COS_UP_MAP = 0xE8,
+
+	HINIC_PORT_CMD_RESET_LINK_CFG = 0xEB,
+
 	HINIC_PORT_CMD_GET_STD_SFP_INFO = 0xF0,
 
+	HINIC_PORT_CMD_FORCE_PKT_DROP = 0xF3,
+
 	HINIC_PORT_CMD_SET_LRO_TIMER = 0xF4,
 
+	HINIC_PORT_CMD_SET_VHD_CFG = 0xF7,
+
+	HINIC_PORT_CMD_SET_LINK_FOLLOW = 0xF8,
+
 	HINIC_PORT_CMD_SET_VF_MAX_MIN_RATE = 0xF9,
 
 	HINIC_PORT_CMD_GET_SFP_ABS = 0xFB,
+
+	HINIC_PORT_CMD_Q_FILTER	= 0xFC,
+
+	HINIC_PORT_CMD_TCAM_FILTER = 0xFE,
+
+	HINIC_PORT_CMD_SET_VLAN_FILTER = 0xFF
 };
 
 /* cmd of mgmt CPU message for HILINK module */
drivers/net/ethernet/huawei/hinic/hinic_sriov.c +18 -0
index a5f08b969e3f..bba41994dee6 100644
@@ -489,6 +489,24 @@ static struct vf_cmd_check_handle nic_cmd_support_vf[] = {
 	{HINIC_PORT_CMD_UPDATE_MAC, hinic_mbox_check_func_id_8B},
 	{HINIC_PORT_CMD_GET_CAP, hinic_mbox_check_func_id_8B},
 	{HINIC_PORT_CMD_GET_LINK_MODE, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_GET_VF_COS, NULL},
+	{HINIC_PORT_CMD_SET_VHD_CFG, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_SET_VLAN_FILTER, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_Q_FILTER, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_TCAM_FILTER, NULL},
+	{HINIC_PORT_CMD_UP_TC_ADD_FLOW, NULL},
+	{HINIC_PORT_CMD_UP_TC_DEL_FLOW, NULL},
+	{HINIC_PORT_CMD_UP_TC_FLUSH_TCAM, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_UP_TC_CTRL_TCAM_BLOCK, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_UP_TC_ENABLE, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_CABLE_PLUG_EVENT, NULL},
+	{HINIC_PORT_CMD_LINK_ERR_EVENT, NULL},
+	{HINIC_PORT_CMD_SET_PORT_STATE, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_SET_ETS, NULL},
+	{HINIC_PORT_CMD_SET_ANTI_ATTACK_RATE, NULL},
+	{HINIC_PORT_CMD_RESET_LINK_CFG, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_SET_LINK_FOLLOW, NULL},
+	{HINIC_PORT_CMD_CLEAR_QP_RES, NULL},
 };
 
 #define CHECK_IPSU_15BIT	0X8000
Signature · 1 line
2.25.1
maintainer
#11 lore raw
In reply to Cai Huoqing
Quoted 1 line · On Wed, 26 Oct 2022 20:59:10 +0800 Cai Huoqing wrote:

Subject: [PATCH 1/2] net: hinic: Convert the cmd code from decimal to hex to be more readable

Please put [PATCH net-next] or [PATCH -next] in the subject, to make the patch sorting easier for maintainers.

drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h enum hinic_port_cmd { · line 142

Quoted 13 lines

The print cmd code is in hex, so using hex cmd code intead of decimal is easy to check the value with print info.

drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h +1 -9
-	HINIC_PORT_CMD_SET_AUTONEG	= 219,
-
-	HINIC_PORT_CMD_GET_STD_SFP_INFO = 240,
-
-	HINIC_PORT_CMD_SET_LRO_TIMER	= 244,
-
-	HINIC_PORT_CMD_SET_VF_MAX_MIN_RATE = 249,
-
-	HINIC_PORT_CMD_GET_SFP_ABS	= 251,
+	HINIC_PORT_CMD_GET_SFP_ABS = 0xFB,

This deletes some entries. Please don't mix changes with mechanical conversions.

maintainer
#2 lore raw

Re: [PATCH 2/2] net: hinic: Add control command support for VF PMD driver in DPDK

In reply to Cai Huoqing
Quoted 3 lines · On Wed, 26 Oct 2022 20:59:11 +0800 Cai Huoqing wrote:

The control command only can be set to register in PF, so add support in PF driver for VF PMD driver control command when VF PMD driver work with linux PF driver.

For what definition of "work"?

The commands are actually supported or you're just ignoring them silently?

#9 lore raw

Re: [PATCH 2/2] net: hinic: Add control command support for VF PMD driver in DPDK

In reply to Cai Huoqing
Quoted 163 lines · Cai Huoqing

HINIC has a mailbox for PF-VF communication and the VF driver could send port control command to PF driver via mailbox.

The control command only can be set to register in PF, so add support in PF driver for VF PMD driver control command when VF PMD driver work with linux PF driver.

---
  .../net/ethernet/huawei/hinic/hinic_hw_dev.h  | 64 +++++++++++++++++++
  .../net/ethernet/huawei/hinic/hinic_sriov.c   | 18 ++++++
  2 files changed, 82 insertions(+)
drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h +64 -0
index abffd967a791..4f561e4e849a 100644
@@ -53,11 +53,15 @@ enum hinic_port_cmd {
 
  	HINIC_PORT_CMD_SET_PFC = 0x5,
 
+	HINIC_PORT_CMD_SET_ETS = 0x7,
+	HINIC_PORT_CMD_GET_ETS = 0x8,
+
  	HINIC_PORT_CMD_SET_MAC = 0x9,
  	HINIC_PORT_CMD_GET_MAC = 0xA,
  	HINIC_PORT_CMD_DEL_MAC = 0xB,
 
  	HINIC_PORT_CMD_SET_RX_MODE = 0xC,
+	HINIC_PORT_CMD_SET_ANTI_ATTACK_RATE = 0xD,
 
  	HINIC_PORT_CMD_GET_PAUSE_INFO = 0x14,
  	HINIC_PORT_CMD_SET_PAUSE_INFO = 0x15,
@@ -81,6 +85,7 @@ enum hinic_port_cmd {
  	HINIC_PORT_CMD_GET_RSS_TEMPLATE_INDIR_TBL = 0x25,
 
  	HINIC_PORT_CMD_SET_PORT_STATE = 0x29,
+	HINIC_PORT_CMD_GET_PORT_STATE = 0x30,
 
  	HINIC_PORT_CMD_SET_RSS_TEMPLATE_TBL = 0x2B,
  	HINIC_PORT_CMD_GET_RSS_TEMPLATE_TBL = 0x2C,
@@ -97,17 +102,29 @@ enum hinic_port_cmd {
 
  	HINIC_PORT_CMD_RSS_CFG = 0x42,
 
+	HINIC_PORT_CMD_GET_PHY_TYPE = 0x44,
+
  	HINIC_PORT_CMD_FWCTXT_INIT = 0x45,
 
  	HINIC_PORT_CMD_GET_LOOPBACK_MODE = 0x48,
  	HINIC_PORT_CMD_SET_LOOPBACK_MODE = 0x49,
 
+	HINIC_PORT_CMD_GET_JUMBO_FRAME_SIZE = 0x4A,
+	HINIC_PORT_CMD_SET_JUMBO_FRAME_SIZE = 0x4B,
+
  	HINIC_PORT_CMD_ENABLE_SPOOFCHK = 0x4E,
 
  	HINIC_PORT_CMD_GET_MGMT_VERSION = 0x58,
 
+	HINIC_PORT_CMD_GET_PORT_TYPE = 0x5B,
+
  	HINIC_PORT_CMD_SET_FUNC_STATE = 0x5D,
 
+	HINIC_PORT_CMD_GET_PORT_ID_BY_FUNC_ID = 0x5E,
+
+	HINIC_PORT_CMD_GET_DMA_CS = 0x64,
+	HINIC_PORT_CMD_SET_DMA_CS = 0x65,
+
  	HINIC_PORT_CMD_GET_GLOBAL_QPN = 0x66,
 
  	HINIC_PORT_CMD_SET_VF_RATE = 0x69,
@@ -121,25 +138,72 @@ enum hinic_port_cmd {
 
  	HINIC_PORT_CMD_SET_RQ_IQ_MAP = 0x73,
 
+	HINIC_PORT_CMD_SET_PFC_THD = 0x75,
+
  	HINIC_PORT_CMD_LINK_STATUS_REPORT = 0xA0,
 
+	HINIC_PORT_CMD_SET_LOSSLESS_ETH	= 0xA3,
+
  	HINIC_PORT_CMD_UPDATE_MAC = 0xA4,
 
  	HINIC_PORT_CMD_GET_CAP = 0xAA,
 
+	HINIC_PORT_CMD_UP_TC_ADD_FLOW = 0xAF,
+	HINIC_PORT_CMD_UP_TC_DEL_FLOW = 0xB0,
+	HINIC_PORT_CMD_UP_TC_GET_FLOW = 0xB1,
+
+	HINIC_PORT_CMD_UP_TC_FLUSH_TCAM = 0xB2,
+
+	HINIC_PORT_CMD_UP_TC_CTRL_TCAM_BLOCK = 0xB3,
+
+	HINIC_PORT_CMD_UP_TC_ENABLE = 0xB4,
+
+	HINIC_PORT_CMD_UP_TC_GET_TCAM_BLOCK = 0xB5,
+
+	HINIC_PORT_CMD_SET_IPSU_MAC = 0xCB,
+	HINIC_PORT_CMD_GET_IPSU_MAC = 0xCC,
+
+	HINIC_PORT_CMD_SET_XSFP_STATUS = 0xD4,
  	HINIC_PORT_CMD_GET_LINK_MODE = 0xD9,
 
  	HINIC_PORT_CMD_SET_SPEED = 0xDA,
 
  	HINIC_PORT_CMD_SET_AUTONEG = 0xDB,
 
+	HINIC_PORT_CMD_CLEAR_QP_RES = 0xDD,
+
+	HINIC_PORT_CMD_SET_SUPER_CQE = 0xDE,
+
+	HINIC_PORT_CMD_SET_VF_COS = 0xDF,
+	HINIC_PORT_CMD_GET_VF_COS = 0xE1,
+
+	HINIC_PORT_CMD_CABLE_PLUG_EVENT	= 0xE5,
+
+	HINIC_PORT_CMD_LINK_ERR_EVENT = 0xE6,
+
+	HINIC_PORT_CMD_SET_COS_UP_MAP = 0xE8,
+
+	HINIC_PORT_CMD_RESET_LINK_CFG = 0xEB,
+
  	HINIC_PORT_CMD_GET_STD_SFP_INFO = 0xF0,
 
+	HINIC_PORT_CMD_FORCE_PKT_DROP = 0xF3,
+
  	HINIC_PORT_CMD_SET_LRO_TIMER = 0xF4,
 
+	HINIC_PORT_CMD_SET_VHD_CFG = 0xF7,
+
+	HINIC_PORT_CMD_SET_LINK_FOLLOW = 0xF8,
+
  	HINIC_PORT_CMD_SET_VF_MAX_MIN_RATE = 0xF9,
 
  	HINIC_PORT_CMD_GET_SFP_ABS = 0xFB,
+
+	HINIC_PORT_CMD_Q_FILTER	= 0xFC,
+
+	HINIC_PORT_CMD_TCAM_FILTER = 0xFE,
+
+	HINIC_PORT_CMD_SET_VLAN_FILTER = 0xFF
  };
 
  /* cmd of mgmt CPU message for HILINK module */
drivers/net/ethernet/huawei/hinic/hinic_sriov.c +11 -0
index a5f08b969e3f..bba41994dee6 100644
@@ -489,6 +489,24 @@ static struct vf_cmd_check_handle nic_cmd_support_vf[] = {
  	{HINIC_PORT_CMD_UPDATE_MAC, hinic_mbox_check_func_id_8B},
  	{HINIC_PORT_CMD_GET_CAP, hinic_mbox_check_func_id_8B},
  	{HINIC_PORT_CMD_GET_LINK_MODE, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_GET_VF_COS, NULL},
+	{HINIC_PORT_CMD_SET_VHD_CFG, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_SET_VLAN_FILTER, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_Q_FILTER, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_TCAM_FILTER, NULL},
+	{HINIC_PORT_CMD_UP_TC_ADD_FLOW, NULL},
+	{HINIC_PORT_CMD_UP_TC_DEL_FLOW, NULL},
+	{HINIC_PORT_CMD_UP_TC_FLUSH_TCAM, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_UP_TC_CTRL_TCAM_BLOCK, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_UP_TC_ENABLE, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_CABLE_PLUG_EVENT, NULL},

drivers/net/ethernet/huawei/hinic/hinic_sriov.c static struct vf_cmd_check_handle nic_cmd_support_vf[] = { · line 512

Quoted 10 lines
drivers/net/ethernet/huawei/hinic/hinic_sriov.c +7 -0
+	{HINIC_PORT_CMD_LINK_ERR_EVENT, NULL},
+	{HINIC_PORT_CMD_SET_PORT_STATE, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_SET_ETS, NULL},
+	{HINIC_PORT_CMD_SET_ANTI_ATTACK_RATE, NULL},
+	{HINIC_PORT_CMD_RESET_LINK_CFG, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_SET_LINK_FOLLOW, NULL},
+	{HINIC_PORT_CMD_CLEAR_QP_RES, NULL},
  };
 
  #define CHECK_IPSU_15BIT	0X8000

Hi Cai:
I guess how do you get the opcodes of these commands? Have they
all been tested? Is the test result consistent with the driver released on the Huawei support website?

Zhengchao Shao

author maintainer
#12 lore raw
In reply to Jakub Kicinski
Quoted 9 lines · Jakub Kicinski
Quoted 1 line · On Wed, 26 Oct 2022 20:59:10 +0800 Cai Huoqing wrote:

Subject: [PATCH 1/2] net: hinic: Convert the cmd code from decimal to hex to be more readable

Please put [PATCH net-next] or [PATCH -next] in the subject, to make the patch sorting easier for maintainers.

Quoted 2 lines

The print cmd code is in hex, so using hex cmd code intead of decimal is easy to check the value with print info.

Quoted 13 lines

drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h enum hinic_port_cmd { · line 142

Quoted 10 lines
drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h +1 -9
-	HINIC_PORT_CMD_SET_AUTONEG	= 219,
-
-	HINIC_PORT_CMD_GET_STD_SFP_INFO = 240,
-
-	HINIC_PORT_CMD_SET_LRO_TIMER	= 244,
-
-	HINIC_PORT_CMD_SET_VF_MAX_MIN_RATE = 249,
-
-	HINIC_PORT_CMD_GET_SFP_ABS	= 251,
+	HINIC_PORT_CMD_GET_SFP_ABS = 0xFB,

This deletes some entries. Please don't mix changes with mechanical conversions.

will revert these lines and resend

thanks,
Cai

author maintainer
#3 lore raw

Re: [PATCH 2/2] net: hinic: Add control command support for VF PMD driver in DPDK

In reply to Jakub Kicinski
Quoted 6 lines · Jakub Kicinski
Quoted 3 lines · On Wed, 26 Oct 2022 20:59:11 +0800 Cai Huoqing wrote:

The control command only can be set to register in PF, so add support in PF driver for VF PMD driver control command when VF PMD driver work with linux PF driver.

For what definition of "work"?

Hi Jakub,
The work means that when the VF NIC driver in guest OS do some configuration (VF L2NIC config),
firstly, VF send cmd to PF viamailbox,
then, PF deside what cmd is valid as a command filter.

see these,
./hinic_sriov.c:1031:static int nic_pf_mbox_handler(..
./hinic_sriov.c:1045: if (!hinic_mbox_check_cmd_valid(hwdev, nic_cmd_support_vf, vf_id, cmd,

Quoted 3 lines

The commands are actually supported or you're just ignoring them silently?

No, if the cmd is not added to 'nic_cmd_support_vf', the PF will return false, and the error messsage "PF Receive VFx unsupported cmd x" in the function 'hinic_mbox_check_cmd_valid', then, the configuration will not be set to hardware.

./hinic_hw_mbox.c:1238:bool hinic_mbox_check_cmd_valid(struct hinic_hwdev *hwdev,

Thanks,
Cai

author maintainer
#10 lore raw

Re: [PATCH 2/2] net: hinic: Add control command support for VF PMD driver in DPDK

In reply to shaozhengchao
Quoted 145 lines · shaozhengchao
Quoted 142 lines · Cai Huoqing

HINIC has a mailbox for PF-VF communication and the VF driver could send port control command to PF driver via mailbox.

The control command only can be set to register in PF, so add support in PF driver for VF PMD driver control command when VF PMD driver work with linux PF driver.

---
  .../net/ethernet/huawei/hinic/hinic_hw_dev.h  | 64 +++++++++++++++++++
  .../net/ethernet/huawei/hinic/hinic_sriov.c   | 18 ++++++
  2 files changed, 82 insertions(+)
drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h +64 -0
index abffd967a791..4f561e4e849a 100644
@@ -53,11 +53,15 @@ enum hinic_port_cmd {
  	HINIC_PORT_CMD_SET_PFC = 0x5,
+	HINIC_PORT_CMD_SET_ETS = 0x7,
+	HINIC_PORT_CMD_GET_ETS = 0x8,
+
  	HINIC_PORT_CMD_SET_MAC = 0x9,
  	HINIC_PORT_CMD_GET_MAC = 0xA,
  	HINIC_PORT_CMD_DEL_MAC = 0xB,
  	HINIC_PORT_CMD_SET_RX_MODE = 0xC,
+	HINIC_PORT_CMD_SET_ANTI_ATTACK_RATE = 0xD,
  	HINIC_PORT_CMD_GET_PAUSE_INFO = 0x14,
  	HINIC_PORT_CMD_SET_PAUSE_INFO = 0x15,
@@ -81,6 +85,7 @@ enum hinic_port_cmd {
  	HINIC_PORT_CMD_GET_RSS_TEMPLATE_INDIR_TBL = 0x25,
  	HINIC_PORT_CMD_SET_PORT_STATE = 0x29,
+	HINIC_PORT_CMD_GET_PORT_STATE = 0x30,
  	HINIC_PORT_CMD_SET_RSS_TEMPLATE_TBL = 0x2B,
  	HINIC_PORT_CMD_GET_RSS_TEMPLATE_TBL = 0x2C,
@@ -97,17 +102,29 @@ enum hinic_port_cmd {
  	HINIC_PORT_CMD_RSS_CFG = 0x42,
+	HINIC_PORT_CMD_GET_PHY_TYPE = 0x44,
+
  	HINIC_PORT_CMD_FWCTXT_INIT = 0x45,
  	HINIC_PORT_CMD_GET_LOOPBACK_MODE = 0x48,
  	HINIC_PORT_CMD_SET_LOOPBACK_MODE = 0x49,
+	HINIC_PORT_CMD_GET_JUMBO_FRAME_SIZE = 0x4A,
+	HINIC_PORT_CMD_SET_JUMBO_FRAME_SIZE = 0x4B,
+
  	HINIC_PORT_CMD_ENABLE_SPOOFCHK = 0x4E,
  	HINIC_PORT_CMD_GET_MGMT_VERSION = 0x58,
+	HINIC_PORT_CMD_GET_PORT_TYPE = 0x5B,
+
  	HINIC_PORT_CMD_SET_FUNC_STATE = 0x5D,
+	HINIC_PORT_CMD_GET_PORT_ID_BY_FUNC_ID = 0x5E,
+
+	HINIC_PORT_CMD_GET_DMA_CS = 0x64,
+	HINIC_PORT_CMD_SET_DMA_CS = 0x65,
+
  	HINIC_PORT_CMD_GET_GLOBAL_QPN = 0x66,
  	HINIC_PORT_CMD_SET_VF_RATE = 0x69,
@@ -121,25 +138,72 @@ enum hinic_port_cmd {
  	HINIC_PORT_CMD_SET_RQ_IQ_MAP = 0x73,
+	HINIC_PORT_CMD_SET_PFC_THD = 0x75,
+
  	HINIC_PORT_CMD_LINK_STATUS_REPORT = 0xA0,
+	HINIC_PORT_CMD_SET_LOSSLESS_ETH	= 0xA3,
+
  	HINIC_PORT_CMD_UPDATE_MAC = 0xA4,
  	HINIC_PORT_CMD_GET_CAP = 0xAA,
+	HINIC_PORT_CMD_UP_TC_ADD_FLOW = 0xAF,
+	HINIC_PORT_CMD_UP_TC_DEL_FLOW = 0xB0,
+	HINIC_PORT_CMD_UP_TC_GET_FLOW = 0xB1,
+
+	HINIC_PORT_CMD_UP_TC_FLUSH_TCAM = 0xB2,
+
+	HINIC_PORT_CMD_UP_TC_CTRL_TCAM_BLOCK = 0xB3,
+
+	HINIC_PORT_CMD_UP_TC_ENABLE = 0xB4,
+
+	HINIC_PORT_CMD_UP_TC_GET_TCAM_BLOCK = 0xB5,
+
+	HINIC_PORT_CMD_SET_IPSU_MAC = 0xCB,
+	HINIC_PORT_CMD_GET_IPSU_MAC = 0xCC,
+
+	HINIC_PORT_CMD_SET_XSFP_STATUS = 0xD4,
  	HINIC_PORT_CMD_GET_LINK_MODE = 0xD9,
  	HINIC_PORT_CMD_SET_SPEED = 0xDA,
  	HINIC_PORT_CMD_SET_AUTONEG = 0xDB,
+	HINIC_PORT_CMD_CLEAR_QP_RES = 0xDD,
+
+	HINIC_PORT_CMD_SET_SUPER_CQE = 0xDE,
+
+	HINIC_PORT_CMD_SET_VF_COS = 0xDF,
+	HINIC_PORT_CMD_GET_VF_COS = 0xE1,
+
+	HINIC_PORT_CMD_CABLE_PLUG_EVENT	= 0xE5,
+
+	HINIC_PORT_CMD_LINK_ERR_EVENT = 0xE6,
+
+	HINIC_PORT_CMD_SET_COS_UP_MAP = 0xE8,
+
+	HINIC_PORT_CMD_RESET_LINK_CFG = 0xEB,
+
  	HINIC_PORT_CMD_GET_STD_SFP_INFO = 0xF0,
+	HINIC_PORT_CMD_FORCE_PKT_DROP = 0xF3,
+
  	HINIC_PORT_CMD_SET_LRO_TIMER = 0xF4,
+	HINIC_PORT_CMD_SET_VHD_CFG = 0xF7,
+
+	HINIC_PORT_CMD_SET_LINK_FOLLOW = 0xF8,
+
  	HINIC_PORT_CMD_SET_VF_MAX_MIN_RATE = 0xF9,
  	HINIC_PORT_CMD_GET_SFP_ABS = 0xFB,
+
+	HINIC_PORT_CMD_Q_FILTER	= 0xFC,
+
+	HINIC_PORT_CMD_TCAM_FILTER = 0xFE,
+
+	HINIC_PORT_CMD_SET_VLAN_FILTER = 0xFF
  };
  /* cmd of mgmt CPU message for HILINK module */
drivers/net/ethernet/huawei/hinic/hinic_sriov.c +16 -0
index a5f08b969e3f..bba41994dee6 100644
@@ -489,6 +489,24 @@ static struct vf_cmd_check_handle nic_cmd_support_vf[] = {
  	{HINIC_PORT_CMD_UPDATE_MAC, hinic_mbox_check_func_id_8B},
  	{HINIC_PORT_CMD_GET_CAP, hinic_mbox_check_func_id_8B},
  	{HINIC_PORT_CMD_GET_LINK_MODE, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_GET_VF_COS, NULL},
+	{HINIC_PORT_CMD_SET_VHD_CFG, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_SET_VLAN_FILTER, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_Q_FILTER, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_TCAM_FILTER, NULL},
+	{HINIC_PORT_CMD_UP_TC_ADD_FLOW, NULL},
+	{HINIC_PORT_CMD_UP_TC_DEL_FLOW, NULL},
+	{HINIC_PORT_CMD_UP_TC_FLUSH_TCAM, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_UP_TC_CTRL_TCAM_BLOCK, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_UP_TC_ENABLE, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_CABLE_PLUG_EVENT, NULL},
+	{HINIC_PORT_CMD_LINK_ERR_EVENT, NULL},
+	{HINIC_PORT_CMD_SET_PORT_STATE, hinic_mbox_check_func_id_8B},
+	{HINIC_PORT_CMD_SET_ETS, NULL},
+	{HINIC_PORT_CMD_SET_ANTI_ATTACK_RATE, NULL},
+	{HINIC_PORT_CMD_RESET_LINK_CFG, hinic_mbox_check_func_id_8B},
Quoted 8 lines

drivers/net/ethernet/huawei/hinic/hinic_sriov.c static struct vf_cmd_check_handle nic_cmd_support_vf[] = { · line 512

Quoted 4 lines
drivers/net/ethernet/huawei/hinic/hinic_sriov.c +2 -0
+	{HINIC_PORT_CMD_SET_LINK_FOLLOW, NULL},
+	{HINIC_PORT_CMD_CLEAR_QP_RES, NULL},
  };
  #define CHECK_IPSU_15BIT	0X8000

Hi Cai:
I guess how do you get the opcodes of these commands? Have they
all been tested? Is the test result consistent with the driver released on the Huawei support website?

Hi Shao,
Thanks for your reply.

I try to keep this PF part support to recv hinic VF PMD driver in DPDK upstream.
the command comes from here,
https://github.com/DPDK/dpdk/blob/main/drivers/net/hinic/base/hinic_pmd_niccfg.c

send by the DPDK-hinic function 'l2nic_msg_to_mgmt_sync' when 'hinic_func_type(hwdev) == TYPE_VF'.

for the test, the DPDK part is tested, I also test this part in SP582 NIC

Thanks.
Cai

Quoted 2 lines

Zhengchao Shao

maintainer
#4 lore raw

Re: [PATCH 2/2] net: hinic: Add control command support for VF PMD driver in DPDK

In reply to Cai Huoqing
Quoted 3 lines · On Fri, 28 Oct 2022 12:56:55 +0800 Cai Huoqing wrote:
Quoted 2 lines

The commands are actually supported or you're just ignoring them silently?

No,

Do you mean "neither"?

Quoted 4 lines

if the cmd is not added to 'nic_cmd_support_vf',
the PF will return false, and the error messsage "PF Receive VFx unsupported cmd x" in the function 'hinic_mbox_check_cmd_valid', then, the configuration will not be set to hardware.

You're describing the behavior before the patch?

After the patch the command is ignored silently, like I said, right? Because there is no handler added to nic_vf_cmd_msg_handler[]. Why is that okay? Or is there handler somewhere else?

author maintainer
#5 lore raw

Re: [PATCH 2/2] net: hinic: Add control command support for VF PMD driver in DPDK

Quoted 12 lines · Jakub Kicinski
Quoted 3 lines · On Fri, 28 Oct 2022 12:56:55 +0800 Cai Huoqing wrote:
Quoted 2 lines

The commands are actually supported or you're just ignoring them silently?

No,

Do you mean "neither"?

Quoted 4 lines

if the cmd is not added to 'nic_cmd_support_vf',
the PF will return false, and the error messsage "PF Receive VFx unsupported cmd x" in the function 'hinic_mbox_check_cmd_valid', then, the configuration will not be set to hardware.

Quoted 5 lines

You're describing the behavior before the patch?

After the patch the command is ignored silently, like I said, right? Because there is no handler added to nic_vf_cmd_msg_handler[]. Why is that okay? Or is there handler somewhere else?

No need to add handlers to nic_vf_cmd_msg_handler[]. It will run the path,
if (i == ARRAY_SIZE(nic_vf_cmd_msg_handler))

	err = hinic_msg_to_mgmt(&pfhwdev->pf_to_mgmt, HINIC_MOD_L2NIC,
				cmd, buf_in, in_size, buf_out,
				out_size, HINIC_MGMT_MSG_SYNC);

right? or if not please show the related code.

author maintainer
#13 lore raw
In reply to Jakub Kicinski
Quoted 9 lines · Jakub Kicinski
Quoted 1 line · On Wed, 26 Oct 2022 20:59:10 +0800 Cai Huoqing wrote:

Subject: [PATCH 1/2] net: hinic: Convert the cmd code from decimal to hex to be more readable

Please put [PATCH net-next] or [PATCH -next] in the subject, to make the patch sorting easier for maintainers.

Quoted 2 lines

The print cmd code is in hex, so using hex cmd code intead of decimal is easy to check the value with print info.

Quoted 13 lines

drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h enum hinic_port_cmd { · line 142

Quoted 10 lines
drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h +1 -9
-	HINIC_PORT_CMD_SET_AUTONEG	= 219,
-
-	HINIC_PORT_CMD_GET_STD_SFP_INFO = 240,
-
-	HINIC_PORT_CMD_SET_LRO_TIMER	= 244,
-
-	HINIC_PORT_CMD_SET_VF_MAX_MIN_RATE = 249,
-
-	HINIC_PORT_CMD_GET_SFP_ABS	= 251,
+	HINIC_PORT_CMD_GET_SFP_ABS = 0xFB,

This deletes some entries. Please don't mix changes with mechanical conversions.

After checking my patch again, these can be find,

+ HINIC_PORT_CMD_SET_AUTONEG = 0xDB,
+ HINIC_PORT_CMD_GET_STD_SFP_INFO = 0xF0,
+ HINIC_PORT_CMD_SET_LRO_TIMER = 0xF4,
+ HINIC_PORT_CMD_SET_VF_MAX_MIN_RATE = 0xF9,

maintainer
#6 lore raw

Re: [PATCH 2/2] net: hinic: Add control command support for VF PMD driver in DPDK

In reply to Cai Huoqing
Quoted 12 lines · On Sat, 29 Oct 2022 15:53:35 +0800 Cai Huoqing wrote:
Quoted 10 lines · Jakub Kicinski
Quoted 4 lines

if the cmd is not added to 'nic_cmd_support_vf',
the PF will return false, and the error messsage "PF Receive VFx unsupported cmd x" in the function 'hinic_mbox_check_cmd_valid', then, the configuration will not be set to hardware.

You're describing the behavior before the patch?

After the patch the command is ignored silently, like I said, right? Because there is no handler added to nic_vf_cmd_msg_handler[]. Why is that okay? Or is there handler somewhere else?

Quoted 6 lines

No need to add handlers to nic_vf_cmd_msg_handler[]. It will run the path,
if (i == ARRAY_SIZE(nic_vf_cmd_msg_handler))

	err = hinic_msg_to_mgmt(&pfhwdev->pf_to_mgmt, HINIC_MOD_L2NIC,
				cmd, buf_in, in_size, buf_out,
				out_size, HINIC_MGMT_MSG_SYNC);

Meaning it just forwards it to the firmware?

Quoted 1 line

right? or if not please show the related code.

I don't know, I don't know this random driver. I'm just asking you questions because as the author of the patch _you_ are supposed to know.

author maintainer
#7 lore raw

Re: [PATCH 2/2] net: hinic: Add control command support for VF PMD driver in DPDK

Quoted 13 lines · Jakub Kicinski
Quoted 12 lines · On Sat, 29 Oct 2022 15:53:35 +0800 Cai Huoqing wrote:
Quoted 10 lines · Jakub Kicinski
Quoted 4 lines

if the cmd is not added to 'nic_cmd_support_vf',
the PF will return false, and the error messsage "PF Receive VFx unsupported cmd x" in the function 'hinic_mbox_check_cmd_valid', then, the configuration will not be set to hardware.

You're describing the behavior before the patch?

After the patch the command is ignored silently, like I said, right? Because there is no handler added to nic_vf_cmd_msg_handler[]. Why is that okay? Or is there handler somewhere else?

Quoted 8 lines
Quoted 6 lines

No need to add handlers to nic_vf_cmd_msg_handler[]. It will run the path,
if (i == ARRAY_SIZE(nic_vf_cmd_msg_handler))

	err = hinic_msg_to_mgmt(&pfhwdev->pf_to_mgmt, HINIC_MOD_L2NIC,
				cmd, buf_in, in_size, buf_out,
				out_size, HINIC_MGMT_MSG_SYNC);

Meaning it just forwards it to the firmware?

Yes, host driver just forwards it to the firmware. Actually the firmware works on a coprocessor MGMT_CPU(inside the NIC) which will recv and deal with these commands.

Thanks,
Cai

Quoted 5 lines
Quoted 2 lines

right? or if not please show the related code.

I don't know, I don't know this random driver. I'm just asking you questions because as the author of the patch _you_ are supposed to know.

author maintainer
#14 lore raw
In reply to Jakub Kicinski
Quoted 5 lines · Jakub Kicinski
Quoted 1 line · On Wed, 26 Oct 2022 20:59:10 +0800 Cai Huoqing wrote:

Subject: [PATCH 1/2] net: hinic: Convert the cmd code from decimal to hex to be more readable

Please put [PATCH net-next] or [PATCH -next] in the subject, to make the patch sorting easier for maintainers.

This series is based on net-next, if need to resend, I will add net-next prefix.

Thanks,
Cai

Quoted 17 lines
Quoted 4 lines

The print cmd code is in hex, so using hex cmd code intead of decimal is easy to check the value with print info.

drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h enum hinic_port_cmd { · line 142

Quoted 10 lines
drivers/net/ethernet/huawei/hinic/hinic_hw_dev.h +1 -9
-	HINIC_PORT_CMD_SET_AUTONEG	= 219,
-
-	HINIC_PORT_CMD_GET_STD_SFP_INFO = 240,
-
-	HINIC_PORT_CMD_SET_LRO_TIMER	= 244,
-
-	HINIC_PORT_CMD_SET_VF_MAX_MIN_RATE = 249,
-
-	HINIC_PORT_CMD_GET_SFP_ABS	= 251,
+	HINIC_PORT_CMD_GET_SFP_ABS = 0xFB,

This deletes some entries. Please don't mix changes with mechanical conversions.

maintainer
#8 lore raw

Re: [PATCH 2/2] net: hinic: Add control command support for VF PMD driver in DPDK

In reply to Cai Huoqing
Quoted 4 lines · On Tue, 1 Nov 2022 09:49:17 +0800 Cai Huoqing wrote:
Quoted 1 line

Meaning it just forwards it to the firmware?

Yes, host driver just forwards it to the firmware. Actually the firmware works on a coprocessor MGMT_CPU(inside the NIC) which will recv and deal with these commands.

I see, please include this info in the commit message for v2.