1 // SPDX-License-Identifier: GPL-2.0+
2 // Copyright (c) 2016-2017 Hisilicon Limited.
3
4 #include "hclge_main.h"
5 #include "hclge_mbx.h"
6 #include "hnae3.h"
7
8 /* hclge_gen_resp_to_vf: used to generate a synchronous response to VF when PF
9 * receives a mailbox message from VF.
10 * @vport: pointer to struct hclge_vport
11 * @vf_to_pf_req: pointer to hclge_mbx_vf_to_pf_cmd of the original mailbox
12 * message
13 * @resp_status: indicate to VF whether its request success(0) or failed.
14 */
hclge_gen_resp_to_vf(struct hclge_vport * vport,struct hclge_mbx_vf_to_pf_cmd * vf_to_pf_req,int resp_status,u8 * resp_data,u16 resp_data_len)15 static int hclge_gen_resp_to_vf(struct hclge_vport *vport,
16 struct hclge_mbx_vf_to_pf_cmd *vf_to_pf_req,
17 int resp_status,
18 u8 *resp_data, u16 resp_data_len)
19 {
20 struct hclge_mbx_pf_to_vf_cmd *resp_pf_to_vf;
21 struct hclge_dev *hdev = vport->back;
22 enum hclge_cmd_status status;
23 struct hclge_desc desc;
24
25 resp_pf_to_vf = (struct hclge_mbx_pf_to_vf_cmd *)desc.data;
26
27 if (resp_data_len > HCLGE_MBX_MAX_RESP_DATA_SIZE) {
28 dev_err(&hdev->pdev->dev,
29 "PF fail to gen resp to VF len %d exceeds max len %d\n",
30 resp_data_len,
31 HCLGE_MBX_MAX_RESP_DATA_SIZE);
32 }
33
34 hclge_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_MBX_PF_TO_VF, false);
35
36 resp_pf_to_vf->dest_vfid = vf_to_pf_req->mbx_src_vfid;
37 resp_pf_to_vf->msg_len = vf_to_pf_req->msg_len;
38
39 resp_pf_to_vf->msg[0] = HCLGE_MBX_PF_VF_RESP;
40 resp_pf_to_vf->msg[1] = vf_to_pf_req->msg[0];
41 resp_pf_to_vf->msg[2] = vf_to_pf_req->msg[1];
42 resp_pf_to_vf->msg[3] = (resp_status == 0) ? 0 : 1;
43
44 if (resp_data && resp_data_len > 0)
45 memcpy(&resp_pf_to_vf->msg[4], resp_data, resp_data_len);
46
47 status = hclge_cmd_send(&hdev->hw, &desc, 1);
48 if (status)
49 dev_err(&hdev->pdev->dev,
50 "PF failed(=%d) to send response to VF\n", status);
51
52 return status;
53 }
54
hclge_send_mbx_msg(struct hclge_vport * vport,u8 * msg,u16 msg_len,u16 mbx_opcode,u8 dest_vfid)55 static int hclge_send_mbx_msg(struct hclge_vport *vport, u8 *msg, u16 msg_len,
56 u16 mbx_opcode, u8 dest_vfid)
57 {
58 struct hclge_mbx_pf_to_vf_cmd *resp_pf_to_vf;
59 struct hclge_dev *hdev = vport->back;
60 enum hclge_cmd_status status;
61 struct hclge_desc desc;
62
63 resp_pf_to_vf = (struct hclge_mbx_pf_to_vf_cmd *)desc.data;
64
65 hclge_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_MBX_PF_TO_VF, false);
66
67 resp_pf_to_vf->dest_vfid = dest_vfid;
68 resp_pf_to_vf->msg_len = msg_len;
69 resp_pf_to_vf->msg[0] = mbx_opcode;
70
71 memcpy(&resp_pf_to_vf->msg[1], msg, msg_len);
72
73 status = hclge_cmd_send(&hdev->hw, &desc, 1);
74 if (status)
75 dev_err(&hdev->pdev->dev,
76 "PF failed(=%d) to send mailbox message to VF\n",
77 status);
78
79 return status;
80 }
81
hclge_inform_reset_assert_to_vf(struct hclge_vport * vport)82 static int hclge_inform_reset_assert_to_vf(struct hclge_vport *vport)
83 {
84 u8 msg_data[2];
85 u8 dest_vfid;
86
87 dest_vfid = (u8)vport->vport_id;
88
89 /* send this requested info to VF */
90 return hclge_send_mbx_msg(vport, msg_data, sizeof(u8),
91 HCLGE_MBX_ASSERTING_RESET, dest_vfid);
92 }
93
hclge_free_vector_ring_chain(struct hnae3_ring_chain_node * head)94 static void hclge_free_vector_ring_chain(struct hnae3_ring_chain_node *head)
95 {
96 struct hnae3_ring_chain_node *chain_tmp, *chain;
97
98 chain = head->next;
99
100 while (chain) {
101 chain_tmp = chain->next;
102 kzfree(chain);
103 chain = chain_tmp;
104 }
105 }
106
107 /* hclge_get_ring_chain_from_mbx: get ring type & tqp id & int_gl idx
108 * from mailbox message
109 * msg[0]: opcode
110 * msg[1]: <not relevant to this function>
111 * msg[2]: ring_num
112 * msg[3]: first ring type (TX|RX)
113 * msg[4]: first tqp id
114 * msg[5]: first int_gl idx
115 * msg[6] ~ msg[14]: other ring type, tqp id and int_gl idx
116 */
hclge_get_ring_chain_from_mbx(struct hclge_mbx_vf_to_pf_cmd * req,struct hnae3_ring_chain_node * ring_chain,struct hclge_vport * vport)117 static int hclge_get_ring_chain_from_mbx(
118 struct hclge_mbx_vf_to_pf_cmd *req,
119 struct hnae3_ring_chain_node *ring_chain,
120 struct hclge_vport *vport)
121 {
122 struct hnae3_ring_chain_node *cur_chain, *new_chain;
123 int ring_num;
124 int i;
125
126 ring_num = req->msg[2];
127
128 if (ring_num > ((HCLGE_MBX_VF_MSG_DATA_NUM -
129 HCLGE_MBX_RING_MAP_BASIC_MSG_NUM) /
130 HCLGE_MBX_RING_NODE_VARIABLE_NUM))
131 return -ENOMEM;
132
133 hnae3_set_bit(ring_chain->flag, HNAE3_RING_TYPE_B, req->msg[3]);
134 ring_chain->tqp_index =
135 hclge_get_queue_id(vport->nic.kinfo.tqp[req->msg[4]]);
136 hnae3_set_field(ring_chain->int_gl_idx, HNAE3_RING_GL_IDX_M,
137 HNAE3_RING_GL_IDX_S,
138 req->msg[5]);
139
140 cur_chain = ring_chain;
141
142 for (i = 1; i < ring_num; i++) {
143 new_chain = kzalloc(sizeof(*new_chain), GFP_KERNEL);
144 if (!new_chain)
145 goto err;
146
147 hnae3_set_bit(new_chain->flag, HNAE3_RING_TYPE_B,
148 req->msg[HCLGE_MBX_RING_NODE_VARIABLE_NUM * i +
149 HCLGE_MBX_RING_MAP_BASIC_MSG_NUM]);
150
151 new_chain->tqp_index =
152 hclge_get_queue_id(vport->nic.kinfo.tqp
153 [req->msg[HCLGE_MBX_RING_NODE_VARIABLE_NUM * i +
154 HCLGE_MBX_RING_MAP_BASIC_MSG_NUM + 1]]);
155
156 hnae3_set_field(new_chain->int_gl_idx, HNAE3_RING_GL_IDX_M,
157 HNAE3_RING_GL_IDX_S,
158 req->msg[HCLGE_MBX_RING_NODE_VARIABLE_NUM * i +
159 HCLGE_MBX_RING_MAP_BASIC_MSG_NUM + 2]);
160
161 cur_chain->next = new_chain;
162 cur_chain = new_chain;
163 }
164
165 return 0;
166 err:
167 hclge_free_vector_ring_chain(ring_chain);
168 return -ENOMEM;
169 }
170
hclge_map_unmap_ring_to_vf_vector(struct hclge_vport * vport,bool en,struct hclge_mbx_vf_to_pf_cmd * req)171 static int hclge_map_unmap_ring_to_vf_vector(struct hclge_vport *vport, bool en,
172 struct hclge_mbx_vf_to_pf_cmd *req)
173 {
174 struct hnae3_ring_chain_node ring_chain;
175 int vector_id = req->msg[1];
176 int ret;
177
178 memset(&ring_chain, 0, sizeof(ring_chain));
179 ret = hclge_get_ring_chain_from_mbx(req, &ring_chain, vport);
180 if (ret)
181 return ret;
182
183 ret = hclge_bind_ring_with_vector(vport, vector_id, en, &ring_chain);
184
185 hclge_free_vector_ring_chain(&ring_chain);
186
187 return ret;
188 }
189
hclge_set_vf_promisc_mode(struct hclge_vport * vport,struct hclge_mbx_vf_to_pf_cmd * req)190 static int hclge_set_vf_promisc_mode(struct hclge_vport *vport,
191 struct hclge_mbx_vf_to_pf_cmd *req)
192 {
193 bool en_uc = req->msg[1] ? true : false;
194 bool en_mc = req->msg[2] ? true : false;
195 struct hclge_promisc_param param;
196
197 /* always enable broadcast promisc bit */
198 hclge_promisc_param_init(¶m, en_uc, en_mc, true, vport->vport_id);
199 return hclge_cmd_set_promisc_mode(vport->back, ¶m);
200 }
201
hclge_set_vf_uc_mac_addr(struct hclge_vport * vport,struct hclge_mbx_vf_to_pf_cmd * mbx_req,bool gen_resp)202 static int hclge_set_vf_uc_mac_addr(struct hclge_vport *vport,
203 struct hclge_mbx_vf_to_pf_cmd *mbx_req,
204 bool gen_resp)
205 {
206 const u8 *mac_addr = (const u8 *)(&mbx_req->msg[2]);
207 struct hclge_dev *hdev = vport->back;
208 int status;
209
210 if (mbx_req->msg[1] == HCLGE_MBX_MAC_VLAN_UC_MODIFY) {
211 const u8 *old_addr = (const u8 *)(&mbx_req->msg[8]);
212
213 hclge_rm_uc_addr_common(vport, old_addr);
214 status = hclge_add_uc_addr_common(vport, mac_addr);
215 if (status)
216 hclge_add_uc_addr_common(vport, old_addr);
217 } else if (mbx_req->msg[1] == HCLGE_MBX_MAC_VLAN_UC_ADD) {
218 status = hclge_add_uc_addr_common(vport, mac_addr);
219 } else if (mbx_req->msg[1] == HCLGE_MBX_MAC_VLAN_UC_REMOVE) {
220 status = hclge_rm_uc_addr_common(vport, mac_addr);
221 } else {
222 dev_err(&hdev->pdev->dev,
223 "failed to set unicast mac addr, unknown subcode %d\n",
224 mbx_req->msg[1]);
225 return -EIO;
226 }
227
228 if (gen_resp)
229 hclge_gen_resp_to_vf(vport, mbx_req, status, NULL, 0);
230
231 return 0;
232 }
233
hclge_set_vf_mc_mta_status(struct hclge_vport * vport,u8 * msg,u8 idx,bool is_end)234 static int hclge_set_vf_mc_mta_status(struct hclge_vport *vport,
235 u8 *msg, u8 idx, bool is_end)
236 {
237 #define HCLGE_MTA_STATUS_MSG_SIZE 13
238 #define HCLGE_MTA_STATUS_MSG_BITS \
239 (HCLGE_MTA_STATUS_MSG_SIZE * BITS_PER_BYTE)
240 #define HCLGE_MTA_STATUS_MSG_END_BITS \
241 (HCLGE_MTA_TBL_SIZE % HCLGE_MTA_STATUS_MSG_BITS)
242 unsigned long status[BITS_TO_LONGS(HCLGE_MTA_STATUS_MSG_BITS)];
243 u16 tbl_cnt;
244 u16 tbl_idx;
245 u8 msg_ofs;
246 u8 msg_bit;
247
248 tbl_cnt = is_end ? HCLGE_MTA_STATUS_MSG_END_BITS :
249 HCLGE_MTA_STATUS_MSG_BITS;
250
251 /* set msg field */
252 msg_ofs = 0;
253 msg_bit = 0;
254 memset(status, 0, sizeof(status));
255 for (tbl_idx = 0; tbl_idx < tbl_cnt; tbl_idx++) {
256 if (msg[msg_ofs] & BIT(msg_bit))
257 set_bit(tbl_idx, status);
258
259 msg_bit++;
260 if (msg_bit == BITS_PER_BYTE) {
261 msg_bit = 0;
262 msg_ofs++;
263 }
264 }
265
266 return hclge_update_mta_status_common(vport,
267 status, idx * HCLGE_MTA_STATUS_MSG_BITS,
268 tbl_cnt, is_end);
269 }
270
hclge_set_vf_mc_mac_addr(struct hclge_vport * vport,struct hclge_mbx_vf_to_pf_cmd * mbx_req,bool gen_resp)271 static int hclge_set_vf_mc_mac_addr(struct hclge_vport *vport,
272 struct hclge_mbx_vf_to_pf_cmd *mbx_req,
273 bool gen_resp)
274 {
275 const u8 *mac_addr = (const u8 *)(&mbx_req->msg[2]);
276 struct hclge_dev *hdev = vport->back;
277 u8 resp_len = 0;
278 u8 resp_data;
279 int status;
280
281 if (mbx_req->msg[1] == HCLGE_MBX_MAC_VLAN_MC_ADD) {
282 status = hclge_add_mc_addr_common(vport, mac_addr);
283 } else if (mbx_req->msg[1] == HCLGE_MBX_MAC_VLAN_MC_REMOVE) {
284 status = hclge_rm_mc_addr_common(vport, mac_addr);
285 } else if (mbx_req->msg[1] == HCLGE_MBX_MAC_VLAN_MC_FUNC_MTA_ENABLE) {
286 u8 func_id = vport->vport_id;
287 bool enable = mbx_req->msg[2];
288
289 status = hclge_cfg_func_mta_filter(hdev, func_id, enable);
290 } else if (mbx_req->msg[1] == HCLGE_MBX_MAC_VLAN_MTA_TYPE_READ) {
291 resp_data = hdev->mta_mac_sel_type;
292 resp_len = sizeof(u8);
293 gen_resp = true;
294 status = 0;
295 } else if (mbx_req->msg[1] == HCLGE_MBX_MAC_VLAN_MTA_STATUS_UPDATE) {
296 /* mta status update msg format
297 * msg[2.6 : 2.0] msg index
298 * msg[2.7] msg is end
299 * msg[15 : 3] mta status bits[103 : 0]
300 */
301 bool is_end = (mbx_req->msg[2] & 0x80) ? true : false;
302
303 status = hclge_set_vf_mc_mta_status(vport, &mbx_req->msg[3],
304 mbx_req->msg[2] & 0x7F,
305 is_end);
306 } else {
307 dev_err(&hdev->pdev->dev,
308 "failed to set mcast mac addr, unknown subcode %d\n",
309 mbx_req->msg[1]);
310 return -EIO;
311 }
312
313 if (gen_resp)
314 hclge_gen_resp_to_vf(vport, mbx_req, status,
315 &resp_data, resp_len);
316
317 return 0;
318 }
319
hclge_set_vf_vlan_cfg(struct hclge_vport * vport,struct hclge_mbx_vf_to_pf_cmd * mbx_req,bool gen_resp)320 static int hclge_set_vf_vlan_cfg(struct hclge_vport *vport,
321 struct hclge_mbx_vf_to_pf_cmd *mbx_req,
322 bool gen_resp)
323 {
324 int status = 0;
325
326 if (mbx_req->msg[1] == HCLGE_MBX_VLAN_FILTER) {
327 struct hnae3_handle *handle = &vport->nic;
328 u16 vlan, proto;
329 bool is_kill;
330
331 is_kill = !!mbx_req->msg[2];
332 memcpy(&vlan, &mbx_req->msg[3], sizeof(vlan));
333 memcpy(&proto, &mbx_req->msg[5], sizeof(proto));
334 status = hclge_set_vlan_filter(handle, cpu_to_be16(proto),
335 vlan, is_kill);
336 } else if (mbx_req->msg[1] == HCLGE_MBX_VLAN_RX_OFF_CFG) {
337 struct hnae3_handle *handle = &vport->nic;
338 bool en = mbx_req->msg[2] ? true : false;
339
340 status = hclge_en_hw_strip_rxvtag(handle, en);
341 }
342
343 if (gen_resp)
344 status = hclge_gen_resp_to_vf(vport, mbx_req, status, NULL, 0);
345
346 return status;
347 }
348
hclge_get_vf_tcinfo(struct hclge_vport * vport,struct hclge_mbx_vf_to_pf_cmd * mbx_req,bool gen_resp)349 static int hclge_get_vf_tcinfo(struct hclge_vport *vport,
350 struct hclge_mbx_vf_to_pf_cmd *mbx_req,
351 bool gen_resp)
352 {
353 struct hclge_dev *hdev = vport->back;
354 int ret;
355
356 ret = hclge_gen_resp_to_vf(vport, mbx_req, 0, &hdev->hw_tc_map,
357 sizeof(u8));
358
359 return ret;
360 }
361
hclge_get_vf_queue_info(struct hclge_vport * vport,struct hclge_mbx_vf_to_pf_cmd * mbx_req,bool gen_resp)362 static int hclge_get_vf_queue_info(struct hclge_vport *vport,
363 struct hclge_mbx_vf_to_pf_cmd *mbx_req,
364 bool gen_resp)
365 {
366 #define HCLGE_TQPS_RSS_INFO_LEN 8
367 u8 resp_data[HCLGE_TQPS_RSS_INFO_LEN];
368 struct hclge_dev *hdev = vport->back;
369
370 /* get the queue related info */
371 memcpy(&resp_data[0], &vport->alloc_tqps, sizeof(u16));
372 memcpy(&resp_data[2], &vport->nic.kinfo.rss_size, sizeof(u16));
373 memcpy(&resp_data[4], &hdev->num_desc, sizeof(u16));
374 memcpy(&resp_data[6], &hdev->rx_buf_len, sizeof(u16));
375
376 return hclge_gen_resp_to_vf(vport, mbx_req, 0, resp_data,
377 HCLGE_TQPS_RSS_INFO_LEN);
378 }
379
hclge_get_link_info(struct hclge_vport * vport,struct hclge_mbx_vf_to_pf_cmd * mbx_req)380 static int hclge_get_link_info(struct hclge_vport *vport,
381 struct hclge_mbx_vf_to_pf_cmd *mbx_req)
382 {
383 struct hclge_dev *hdev = vport->back;
384 u16 link_status;
385 u8 msg_data[8];
386 u8 dest_vfid;
387 u16 duplex;
388
389 /* mac.link can only be 0 or 1 */
390 link_status = (u16)hdev->hw.mac.link;
391 duplex = hdev->hw.mac.duplex;
392 memcpy(&msg_data[0], &link_status, sizeof(u16));
393 memcpy(&msg_data[2], &hdev->hw.mac.speed, sizeof(u32));
394 memcpy(&msg_data[6], &duplex, sizeof(u16));
395 dest_vfid = mbx_req->mbx_src_vfid;
396
397 /* send this requested info to VF */
398 return hclge_send_mbx_msg(vport, msg_data, sizeof(msg_data),
399 HCLGE_MBX_LINK_STAT_CHANGE, dest_vfid);
400 }
401
hclge_mbx_reset_vf_queue(struct hclge_vport * vport,struct hclge_mbx_vf_to_pf_cmd * mbx_req)402 static void hclge_mbx_reset_vf_queue(struct hclge_vport *vport,
403 struct hclge_mbx_vf_to_pf_cmd *mbx_req)
404 {
405 u16 queue_id;
406
407 memcpy(&queue_id, &mbx_req->msg[2], sizeof(queue_id));
408
409 hclge_reset_vf_queue(vport, queue_id);
410
411 /* send response msg to VF after queue reset complete*/
412 hclge_gen_resp_to_vf(vport, mbx_req, 0, NULL, 0);
413 }
414
hclge_reset_vf(struct hclge_vport * vport,struct hclge_mbx_vf_to_pf_cmd * mbx_req)415 static void hclge_reset_vf(struct hclge_vport *vport,
416 struct hclge_mbx_vf_to_pf_cmd *mbx_req)
417 {
418 struct hclge_dev *hdev = vport->back;
419 int ret;
420
421 dev_warn(&hdev->pdev->dev, "PF received VF reset request from VF %d!",
422 mbx_req->mbx_src_vfid);
423
424 /* Acknowledge VF that PF is now about to assert the reset for the VF.
425 * On receiving this message VF will get into pending state and will
426 * start polling for the hardware reset completion status.
427 */
428 ret = hclge_inform_reset_assert_to_vf(vport);
429 if (ret) {
430 dev_err(&hdev->pdev->dev,
431 "PF fail(%d) to inform VF(%d)of reset, reset failed!\n",
432 ret, vport->vport_id);
433 return;
434 }
435
436 dev_warn(&hdev->pdev->dev, "PF is now resetting VF %d.\n",
437 mbx_req->mbx_src_vfid);
438 /* reset this virtual function */
439 hclge_func_reset_cmd(hdev, mbx_req->mbx_src_vfid);
440 }
441
hclge_cmd_crq_empty(struct hclge_hw * hw)442 static bool hclge_cmd_crq_empty(struct hclge_hw *hw)
443 {
444 u32 tail = hclge_read_dev(hw, HCLGE_NIC_CRQ_TAIL_REG);
445
446 return tail == hw->cmq.crq.next_to_use;
447 }
448
hclge_mbx_handler(struct hclge_dev * hdev)449 void hclge_mbx_handler(struct hclge_dev *hdev)
450 {
451 struct hclge_cmq_ring *crq = &hdev->hw.cmq.crq;
452 struct hclge_mbx_vf_to_pf_cmd *req;
453 struct hclge_vport *vport;
454 struct hclge_desc *desc;
455 int ret, flag;
456
457 /* handle all the mailbox requests in the queue */
458 while (!hclge_cmd_crq_empty(&hdev->hw)) {
459 if (test_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state)) {
460 dev_warn(&hdev->pdev->dev,
461 "command queue needs re-initializing\n");
462 return;
463 }
464
465 desc = &crq->desc[crq->next_to_use];
466 req = (struct hclge_mbx_vf_to_pf_cmd *)desc->data;
467
468 flag = le16_to_cpu(crq->desc[crq->next_to_use].flag);
469 if (unlikely(!hnae3_get_bit(flag, HCLGE_CMDQ_RX_OUTVLD_B))) {
470 dev_warn(&hdev->pdev->dev,
471 "dropped invalid mailbox message, code = %d\n",
472 req->msg[0]);
473
474 /* dropping/not processing this invalid message */
475 crq->desc[crq->next_to_use].flag = 0;
476 hclge_mbx_ring_ptr_move_crq(crq);
477 continue;
478 }
479
480 vport = &hdev->vport[req->mbx_src_vfid];
481
482 switch (req->msg[0]) {
483 case HCLGE_MBX_MAP_RING_TO_VECTOR:
484 ret = hclge_map_unmap_ring_to_vf_vector(vport, true,
485 req);
486 break;
487 case HCLGE_MBX_UNMAP_RING_TO_VECTOR:
488 ret = hclge_map_unmap_ring_to_vf_vector(vport, false,
489 req);
490 break;
491 case HCLGE_MBX_SET_PROMISC_MODE:
492 ret = hclge_set_vf_promisc_mode(vport, req);
493 if (ret)
494 dev_err(&hdev->pdev->dev,
495 "PF fail(%d) to set VF promisc mode\n",
496 ret);
497 break;
498 case HCLGE_MBX_SET_UNICAST:
499 ret = hclge_set_vf_uc_mac_addr(vport, req, true);
500 if (ret)
501 dev_err(&hdev->pdev->dev,
502 "PF fail(%d) to set VF UC MAC Addr\n",
503 ret);
504 break;
505 case HCLGE_MBX_SET_MULTICAST:
506 ret = hclge_set_vf_mc_mac_addr(vport, req, false);
507 if (ret)
508 dev_err(&hdev->pdev->dev,
509 "PF fail(%d) to set VF MC MAC Addr\n",
510 ret);
511 break;
512 case HCLGE_MBX_SET_VLAN:
513 ret = hclge_set_vf_vlan_cfg(vport, req, false);
514 if (ret)
515 dev_err(&hdev->pdev->dev,
516 "PF failed(%d) to config VF's VLAN\n",
517 ret);
518 break;
519 case HCLGE_MBX_GET_QINFO:
520 ret = hclge_get_vf_queue_info(vport, req, true);
521 if (ret)
522 dev_err(&hdev->pdev->dev,
523 "PF failed(%d) to get Q info for VF\n",
524 ret);
525 break;
526 case HCLGE_MBX_GET_TCINFO:
527 ret = hclge_get_vf_tcinfo(vport, req, true);
528 if (ret)
529 dev_err(&hdev->pdev->dev,
530 "PF failed(%d) to get TC info for VF\n",
531 ret);
532 break;
533 case HCLGE_MBX_GET_LINK_STATUS:
534 ret = hclge_get_link_info(vport, req);
535 if (ret)
536 dev_err(&hdev->pdev->dev,
537 "PF fail(%d) to get link stat for VF\n",
538 ret);
539 break;
540 case HCLGE_MBX_QUEUE_RESET:
541 hclge_mbx_reset_vf_queue(vport, req);
542 break;
543 case HCLGE_MBX_RESET:
544 hclge_reset_vf(vport, req);
545 break;
546 default:
547 dev_err(&hdev->pdev->dev,
548 "un-supported mailbox message, code = %d\n",
549 req->msg[0]);
550 break;
551 }
552 crq->desc[crq->next_to_use].flag = 0;
553 hclge_mbx_ring_ptr_move_crq(crq);
554 }
555
556 /* Write back CMDQ_RQ header pointer, M7 need this pointer */
557 hclge_write_dev(&hdev->hw, HCLGE_NIC_CRQ_HEAD_REG, crq->next_to_use);
558 }
559