forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
....@@ -7,8 +7,6 @@
77 #include <linux/mutex.h>
88 #include <linux/types.h>
99
10
-#define HCLGE_MBX_VF_MSG_DATA_NUM 16
11
-
1210 enum HCLGE_MBX_OPCODE {
1311 HCLGE_MBX_RESET = 0x01, /* (VF -> PF) assert reset */
1412 HCLGE_MBX_ASSERTING_RESET, /* (PF -> VF) PF is asserting reset*/
....@@ -21,11 +19,12 @@
2119 HCLGE_MBX_SET_MACVLAN, /* (VF -> PF) set unicast filter */
2220 HCLGE_MBX_API_NEGOTIATE, /* (VF -> PF) negotiate API version */
2321 HCLGE_MBX_GET_QINFO, /* (VF -> PF) get queue config */
22
+ HCLGE_MBX_GET_QDEPTH, /* (VF -> PF) get queue depth */
2423 HCLGE_MBX_GET_TCINFO, /* (VF -> PF) get TC config */
2524 HCLGE_MBX_GET_RETA, /* (VF -> PF) get RETA */
2625 HCLGE_MBX_GET_RSS_KEY, /* (VF -> PF) get RSS key */
2726 HCLGE_MBX_GET_MAC_ADDR, /* (VF -> PF) get MAC addr */
28
- HCLGE_MBX_PF_VF_RESP, /* (PF -> VF) generate respone to VF */
27
+ HCLGE_MBX_PF_VF_RESP, /* (PF -> VF) generate response to VF */
2928 HCLGE_MBX_GET_BDNUM, /* (VF -> PF) get BD num */
3029 HCLGE_MBX_GET_BUFSIZE, /* (VF -> PF) get buffer size */
3130 HCLGE_MBX_GET_STREAMID, /* (VF -> PF) get stream id */
....@@ -36,6 +35,21 @@
3635 HCLGE_MBX_BIND_FUNC_QUEUE, /* (VF -> PF) bind function and queue */
3736 HCLGE_MBX_GET_LINK_STATUS, /* (VF -> PF) get link status */
3837 HCLGE_MBX_QUEUE_RESET, /* (VF -> PF) reset queue */
38
+ HCLGE_MBX_KEEP_ALIVE, /* (VF -> PF) send keep alive cmd */
39
+ HCLGE_MBX_SET_ALIVE, /* (VF -> PF) set alive state */
40
+ HCLGE_MBX_SET_MTU, /* (VF -> PF) set mtu */
41
+ HCLGE_MBX_GET_QID_IN_PF, /* (VF -> PF) get queue id in pf */
42
+ HCLGE_MBX_LINK_STAT_MODE, /* (PF -> VF) link mode has changed */
43
+ HCLGE_MBX_GET_LINK_MODE, /* (VF -> PF) get the link mode of pf */
44
+ HCLGE_MBX_PUSH_VLAN_INFO, /* (PF -> VF) push port base vlan */
45
+ HCLGE_MBX_GET_MEDIA_TYPE, /* (VF -> PF) get media type */
46
+ HCLGE_MBX_PUSH_PROMISC_INFO, /* (PF -> VF) push vf promisc info */
47
+ HCLGE_MBX_VF_UNINIT, /* (VF -> PF) vf is unintializing */
48
+ HCLGE_MBX_HANDLE_VF_TBL, /* (VF -> PF) store/clear hw table */
49
+
50
+ HCLGE_MBX_GET_VF_FLR_STATUS = 200, /* (M7 -> PF) get vf flr status */
51
+ HCLGE_MBX_PUSH_LINK_STATUS, /* (M7 -> PF) get port link status */
52
+ HCLGE_MBX_NCSI_ERROR, /* (M7 -> PF) receive a NCSI error */
3953 };
4054
4155 /* below are per-VF mac-vlan subcodes */
....@@ -46,9 +60,6 @@
4660 HCLGE_MBX_MAC_VLAN_MC_MODIFY, /* modify MC mac addr */
4761 HCLGE_MBX_MAC_VLAN_MC_ADD, /* add new MC mac addr */
4862 HCLGE_MBX_MAC_VLAN_MC_REMOVE, /* remove MC mac addr */
49
- HCLGE_MBX_MAC_VLAN_MC_FUNC_MTA_ENABLE, /* config func MTA enable */
50
- HCLGE_MBX_MAC_VLAN_MTA_TYPE_READ, /* read func MTA type */
51
- HCLGE_MBX_MAC_VLAN_MTA_STATUS_UPDATE, /* update MTA status */
5263 };
5364
5465 /* below are per-VF vlan cfg subcodes */
....@@ -56,12 +67,23 @@
5667 HCLGE_MBX_VLAN_FILTER = 0, /* set vlan filter */
5768 HCLGE_MBX_VLAN_TX_OFF_CFG, /* set tx side vlan offload */
5869 HCLGE_MBX_VLAN_RX_OFF_CFG, /* set rx side vlan offload */
70
+ HCLGE_MBX_PORT_BASE_VLAN_CFG, /* set port based vlan configuration */
71
+ HCLGE_MBX_GET_PORT_BASE_VLAN_STATE, /* get port based vlan state */
5972 };
6073
61
-#define HCLGE_MBX_MAX_MSG_SIZE 16
62
-#define HCLGE_MBX_MAX_RESP_DATA_SIZE 8
63
-#define HCLGE_MBX_RING_MAP_BASIC_MSG_NUM 3
64
-#define HCLGE_MBX_RING_NODE_VARIABLE_NUM 3
74
+enum hclge_mbx_tbl_cfg_subcode {
75
+ HCLGE_MBX_VPORT_LIST_CLEAR,
76
+};
77
+
78
+#define HCLGE_MBX_MAX_MSG_SIZE 14
79
+#define HCLGE_MBX_MAX_RESP_DATA_SIZE 8U
80
+#define HCLGE_MBX_MAX_RING_CHAIN_PARAM_NUM 4
81
+
82
+struct hclge_ring_chain_param {
83
+ u8 ring_type;
84
+ u8 tqp_index;
85
+ u8 int_gl_index;
86
+};
6587
6688 struct hclgevf_mbx_resp_status {
6789 struct mutex mbx_mutex; /* protects against contending sync cmd resp */
....@@ -71,21 +93,67 @@
7193 u8 additional_info[HCLGE_MBX_MAX_RESP_DATA_SIZE];
7294 };
7395
96
+struct hclge_respond_to_vf_msg {
97
+ int status;
98
+ u8 data[HCLGE_MBX_MAX_RESP_DATA_SIZE];
99
+ u16 len;
100
+};
101
+
102
+struct hclge_vf_to_pf_msg {
103
+ u8 code;
104
+ union {
105
+ struct {
106
+ u8 subcode;
107
+ u8 data[HCLGE_MBX_MAX_MSG_SIZE];
108
+ };
109
+ struct {
110
+ u8 en_bc;
111
+ u8 en_uc;
112
+ u8 en_mc;
113
+ };
114
+ struct {
115
+ u8 vector_id;
116
+ u8 ring_num;
117
+ struct hclge_ring_chain_param
118
+ param[HCLGE_MBX_MAX_RING_CHAIN_PARAM_NUM];
119
+ };
120
+ };
121
+};
122
+
123
+struct hclge_pf_to_vf_msg {
124
+ u16 code;
125
+ u16 vf_mbx_msg_code;
126
+ u16 vf_mbx_msg_subcode;
127
+ u16 resp_status;
128
+ u8 resp_data[HCLGE_MBX_MAX_RESP_DATA_SIZE];
129
+};
130
+
74131 struct hclge_mbx_vf_to_pf_cmd {
75132 u8 rsv;
76133 u8 mbx_src_vfid; /* Auto filled by IMP */
77
- u8 rsv1[2];
134
+ u8 mbx_need_resp;
135
+ u8 rsv1[1];
78136 u8 msg_len;
79
- u8 rsv2[3];
80
- u8 msg[HCLGE_MBX_MAX_MSG_SIZE];
137
+ u8 rsv2;
138
+ u16 match_id;
139
+ struct hclge_vf_to_pf_msg msg;
81140 };
141
+
142
+#define HCLGE_MBX_NEED_RESP_B 0
82143
83144 struct hclge_mbx_pf_to_vf_cmd {
84145 u8 dest_vfid;
85146 u8 rsv[3];
86147 u8 msg_len;
87
- u8 rsv1[3];
88
- u16 msg[8];
148
+ u8 rsv1;
149
+ u16 match_id;
150
+ struct hclge_pf_to_vf_msg msg;
151
+};
152
+
153
+struct hclge_vf_rst_cmd {
154
+ u8 dest_vfid;
155
+ u8 vf_rst;
156
+ u8 rsv[22];
89157 };
90158
91159 /* used by VF to store the received Async responses from PF */
....@@ -95,7 +163,7 @@
95163 struct hclgevf_dev *hdev;
96164 u32 head;
97165 u32 tail;
98
- u32 count;
166
+ atomic_t count;
99167 u16 msg_q[HCLGE_MBX_MAX_ARQ_MSG_NUM][HCLGE_MBX_MAX_ARQ_MSG_SIZE];
100168 };
101169