1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2013 - 2018 Intel Corporation. */
5 #include "i40e_prototype.h"
6 #include "i40evf_client.h"
8 /* busy wait delay in msec */
9 #define I40EVF_BUSY_WAIT_DELAY 10
10 #define I40EVF_BUSY_WAIT_COUNT 50
14 * @adapter: adapter structure
15 * @op: virtual channel opcode
16 * @msg: pointer to message buffer
17 * @len: message length
19 * Send message to PF and print status if failure.
21 static int i40evf_send_pf_msg(struct i40evf_adapter *adapter,
22 enum virtchnl_ops op, u8 *msg, u16 len)
24 struct i40e_hw *hw = &adapter->hw;
27 if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED)
28 return 0; /* nothing to see here, move along */
30 err = i40e_aq_send_msg_to_pf(hw, op, 0, msg, len, NULL);
32 dev_dbg(&adapter->pdev->dev, "Unable to send opcode %d to PF, err %s, aq_err %s\n",
33 op, i40evf_stat_str(hw, err),
34 i40evf_aq_str(hw, hw->aq.asq_last_status));
40 * @adapter: adapter structure
42 * Send API version admin queue message to the PF. The reply is not checked
43 * in this function. Returns 0 if the message was successfully
44 * sent, or one of the I40E_ADMIN_QUEUE_ERROR_ statuses if not.
46 int i40evf_send_api_ver(struct i40evf_adapter *adapter)
48 struct virtchnl_version_info vvi;
50 vvi.major = VIRTCHNL_VERSION_MAJOR;
51 vvi.minor = VIRTCHNL_VERSION_MINOR;
53 return i40evf_send_pf_msg(adapter, VIRTCHNL_OP_VERSION, (u8 *)&vvi,
58 * i40evf_verify_api_ver
59 * @adapter: adapter structure
61 * Compare API versions with the PF. Must be called after admin queue is
62 * initialized. Returns 0 if API versions match, -EIO if they do not,
63 * I40E_ERR_ADMIN_QUEUE_NO_WORK if the admin queue is empty, and any errors
64 * from the firmware are propagated.
66 int i40evf_verify_api_ver(struct i40evf_adapter *adapter)
68 struct virtchnl_version_info *pf_vvi;
69 struct i40e_hw *hw = &adapter->hw;
70 struct i40e_arq_event_info event;
74 event.buf_len = I40EVF_MAX_AQ_BUF_SIZE;
75 event.msg_buf = kzalloc(event.buf_len, GFP_KERNEL);
82 err = i40evf_clean_arq_element(hw, &event, NULL);
83 /* When the AQ is empty, i40evf_clean_arq_element will return
84 * nonzero and this loop will terminate.
89 (enum virtchnl_ops)le32_to_cpu(event.desc.cookie_high);
90 if (op == VIRTCHNL_OP_VERSION)
95 err = (i40e_status)le32_to_cpu(event.desc.cookie_low);
99 if (op != VIRTCHNL_OP_VERSION) {
100 dev_info(&adapter->pdev->dev, "Invalid reply type %d from PF\n",
106 pf_vvi = (struct virtchnl_version_info *)event.msg_buf;
107 adapter->pf_version = *pf_vvi;
109 if ((pf_vvi->major > VIRTCHNL_VERSION_MAJOR) ||
110 ((pf_vvi->major == VIRTCHNL_VERSION_MAJOR) &&
111 (pf_vvi->minor > VIRTCHNL_VERSION_MINOR)))
115 kfree(event.msg_buf);
121 * i40evf_send_vf_config_msg
122 * @adapter: adapter structure
124 * Send VF configuration request admin queue message to the PF. The reply
125 * is not checked in this function. Returns 0 if the message was
126 * successfully sent, or one of the I40E_ADMIN_QUEUE_ERROR_ statuses if not.
128 int i40evf_send_vf_config_msg(struct i40evf_adapter *adapter)
132 caps = VIRTCHNL_VF_OFFLOAD_L2 |
133 VIRTCHNL_VF_OFFLOAD_RSS_PF |
134 VIRTCHNL_VF_OFFLOAD_RSS_AQ |
135 VIRTCHNL_VF_OFFLOAD_RSS_REG |
136 VIRTCHNL_VF_OFFLOAD_VLAN |
137 VIRTCHNL_VF_OFFLOAD_WB_ON_ITR |
138 VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 |
139 VIRTCHNL_VF_OFFLOAD_ENCAP |
140 VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM |
141 VIRTCHNL_VF_OFFLOAD_REQ_QUEUES |
142 VIRTCHNL_VF_OFFLOAD_ADQ;
144 adapter->current_op = VIRTCHNL_OP_GET_VF_RESOURCES;
145 adapter->aq_required &= ~I40EVF_FLAG_AQ_GET_CONFIG;
146 if (PF_IS_V11(adapter))
147 return i40evf_send_pf_msg(adapter,
148 VIRTCHNL_OP_GET_VF_RESOURCES,
149 (u8 *)&caps, sizeof(caps));
151 return i40evf_send_pf_msg(adapter,
152 VIRTCHNL_OP_GET_VF_RESOURCES,
157 * i40evf_get_vf_config
158 * @adapter: private adapter structure
160 * Get VF configuration from PF and populate hw structure. Must be called after
161 * admin queue is initialized. Busy waits until response is received from PF,
162 * with maximum timeout. Response from PF is returned in the buffer for further
163 * processing by the caller.
165 int i40evf_get_vf_config(struct i40evf_adapter *adapter)
167 struct i40e_hw *hw = &adapter->hw;
168 struct i40e_arq_event_info event;
169 enum virtchnl_ops op;
173 len = sizeof(struct virtchnl_vf_resource) +
174 I40E_MAX_VF_VSI * sizeof(struct virtchnl_vsi_resource);
176 event.msg_buf = kzalloc(event.buf_len, GFP_KERNEL);
177 if (!event.msg_buf) {
183 /* When the AQ is empty, i40evf_clean_arq_element will return
184 * nonzero and this loop will terminate.
186 err = i40evf_clean_arq_element(hw, &event, NULL);
190 (enum virtchnl_ops)le32_to_cpu(event.desc.cookie_high);
191 if (op == VIRTCHNL_OP_GET_VF_RESOURCES)
195 err = (i40e_status)le32_to_cpu(event.desc.cookie_low);
196 memcpy(adapter->vf_res, event.msg_buf, min(event.msg_len, len));
198 i40e_vf_parse_hw_config(hw, adapter->vf_res);
200 kfree(event.msg_buf);
206 * i40evf_configure_queues
207 * @adapter: adapter structure
209 * Request that the PF set up our (previously allocated) queues.
211 void i40evf_configure_queues(struct i40evf_adapter *adapter)
213 struct virtchnl_vsi_queue_config_info *vqci;
214 struct virtchnl_queue_pair_info *vqpi;
215 int pairs = adapter->num_active_queues;
216 int i, len, max_frame = I40E_MAX_RXBUFFER;
218 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
219 /* bail because we already have a command pending */
220 dev_err(&adapter->pdev->dev, "Cannot configure queues, command %d pending\n",
221 adapter->current_op);
224 adapter->current_op = VIRTCHNL_OP_CONFIG_VSI_QUEUES;
225 len = sizeof(struct virtchnl_vsi_queue_config_info) +
226 (sizeof(struct virtchnl_queue_pair_info) * pairs);
227 vqci = kzalloc(len, GFP_KERNEL);
231 /* Limit maximum frame size when jumbo frames is not enabled */
232 if (!(adapter->flags & I40EVF_FLAG_LEGACY_RX) &&
233 (adapter->netdev->mtu <= ETH_DATA_LEN))
234 max_frame = I40E_RXBUFFER_1536 - NET_IP_ALIGN;
236 vqci->vsi_id = adapter->vsi_res->vsi_id;
237 vqci->num_queue_pairs = pairs;
239 /* Size check is not needed here - HW max is 16 queue pairs, and we
240 * can fit info for 31 of them into the AQ buffer before it overflows.
242 for (i = 0; i < pairs; i++) {
243 vqpi->txq.vsi_id = vqci->vsi_id;
244 vqpi->txq.queue_id = i;
245 vqpi->txq.ring_len = adapter->tx_rings[i].count;
246 vqpi->txq.dma_ring_addr = adapter->tx_rings[i].dma;
247 vqpi->rxq.vsi_id = vqci->vsi_id;
248 vqpi->rxq.queue_id = i;
249 vqpi->rxq.ring_len = adapter->rx_rings[i].count;
250 vqpi->rxq.dma_ring_addr = adapter->rx_rings[i].dma;
251 vqpi->rxq.max_pkt_size = max_frame;
252 vqpi->rxq.databuffer_size =
253 ALIGN(adapter->rx_rings[i].rx_buf_len,
254 BIT_ULL(I40E_RXQ_CTX_DBUFF_SHIFT));
258 adapter->aq_required &= ~I40EVF_FLAG_AQ_CONFIGURE_QUEUES;
259 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_VSI_QUEUES,
265 * i40evf_enable_queues
266 * @adapter: adapter structure
268 * Request that the PF enable all of our queues.
270 void i40evf_enable_queues(struct i40evf_adapter *adapter)
272 struct virtchnl_queue_select vqs;
274 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
275 /* bail because we already have a command pending */
276 dev_err(&adapter->pdev->dev, "Cannot enable queues, command %d pending\n",
277 adapter->current_op);
280 adapter->current_op = VIRTCHNL_OP_ENABLE_QUEUES;
281 vqs.vsi_id = adapter->vsi_res->vsi_id;
282 vqs.tx_queues = BIT(adapter->num_active_queues) - 1;
283 vqs.rx_queues = vqs.tx_queues;
284 adapter->aq_required &= ~I40EVF_FLAG_AQ_ENABLE_QUEUES;
285 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_QUEUES,
286 (u8 *)&vqs, sizeof(vqs));
290 * i40evf_disable_queues
291 * @adapter: adapter structure
293 * Request that the PF disable all of our queues.
295 void i40evf_disable_queues(struct i40evf_adapter *adapter)
297 struct virtchnl_queue_select vqs;
299 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
300 /* bail because we already have a command pending */
301 dev_err(&adapter->pdev->dev, "Cannot disable queues, command %d pending\n",
302 adapter->current_op);
305 adapter->current_op = VIRTCHNL_OP_DISABLE_QUEUES;
306 vqs.vsi_id = adapter->vsi_res->vsi_id;
307 vqs.tx_queues = BIT(adapter->num_active_queues) - 1;
308 vqs.rx_queues = vqs.tx_queues;
309 adapter->aq_required &= ~I40EVF_FLAG_AQ_DISABLE_QUEUES;
310 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_QUEUES,
311 (u8 *)&vqs, sizeof(vqs));
316 * @adapter: adapter structure
318 * Request that the PF map queues to interrupt vectors. Misc causes, including
319 * admin queue, are always mapped to vector 0.
321 void i40evf_map_queues(struct i40evf_adapter *adapter)
323 struct virtchnl_irq_map_info *vimi;
324 struct virtchnl_vector_map *vecmap;
325 int v_idx, q_vectors, len;
326 struct i40e_q_vector *q_vector;
328 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
329 /* bail because we already have a command pending */
330 dev_err(&adapter->pdev->dev, "Cannot map queues to vectors, command %d pending\n",
331 adapter->current_op);
334 adapter->current_op = VIRTCHNL_OP_CONFIG_IRQ_MAP;
336 q_vectors = adapter->num_msix_vectors - NONQ_VECS;
338 len = sizeof(struct virtchnl_irq_map_info) +
339 (adapter->num_msix_vectors *
340 sizeof(struct virtchnl_vector_map));
341 vimi = kzalloc(len, GFP_KERNEL);
345 vimi->num_vectors = adapter->num_msix_vectors;
346 /* Queue vectors first */
347 for (v_idx = 0; v_idx < q_vectors; v_idx++) {
348 q_vector = &adapter->q_vectors[v_idx];
349 vecmap = &vimi->vecmap[v_idx];
351 vecmap->vsi_id = adapter->vsi_res->vsi_id;
352 vecmap->vector_id = v_idx + NONQ_VECS;
353 vecmap->txq_map = q_vector->ring_mask;
354 vecmap->rxq_map = q_vector->ring_mask;
355 vecmap->rxitr_idx = I40E_RX_ITR;
356 vecmap->txitr_idx = I40E_TX_ITR;
358 /* Misc vector last - this is only for AdminQ messages */
359 vecmap = &vimi->vecmap[v_idx];
360 vecmap->vsi_id = adapter->vsi_res->vsi_id;
361 vecmap->vector_id = 0;
365 adapter->aq_required &= ~I40EVF_FLAG_AQ_MAP_VECTORS;
366 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_IRQ_MAP,
372 * i40evf_request_queues
373 * @adapter: adapter structure
374 * @num: number of requested queues
376 * We get a default number of queues from the PF. This enables us to request a
377 * different number. Returns 0 on success, negative on failure
379 int i40evf_request_queues(struct i40evf_adapter *adapter, int num)
381 struct virtchnl_vf_res_request vfres;
383 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
384 /* bail because we already have a command pending */
385 dev_err(&adapter->pdev->dev, "Cannot request queues, command %d pending\n",
386 adapter->current_op);
390 vfres.num_queue_pairs = num;
392 adapter->current_op = VIRTCHNL_OP_REQUEST_QUEUES;
393 adapter->flags |= I40EVF_FLAG_REINIT_ITR_NEEDED;
394 return i40evf_send_pf_msg(adapter, VIRTCHNL_OP_REQUEST_QUEUES,
395 (u8 *)&vfres, sizeof(vfres));
399 * i40evf_add_ether_addrs
400 * @adapter: adapter structure
402 * Request that the PF add one or more addresses to our filters.
404 void i40evf_add_ether_addrs(struct i40evf_adapter *adapter)
406 struct virtchnl_ether_addr_list *veal;
407 int len, i = 0, count = 0;
408 struct i40evf_mac_filter *f;
411 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
412 /* bail because we already have a command pending */
413 dev_err(&adapter->pdev->dev, "Cannot add filters, command %d pending\n",
414 adapter->current_op);
418 spin_lock_bh(&adapter->mac_vlan_list_lock);
420 list_for_each_entry(f, &adapter->mac_filter_list, list) {
425 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER;
426 spin_unlock_bh(&adapter->mac_vlan_list_lock);
429 adapter->current_op = VIRTCHNL_OP_ADD_ETH_ADDR;
431 len = sizeof(struct virtchnl_ether_addr_list) +
432 (count * sizeof(struct virtchnl_ether_addr));
433 if (len > I40EVF_MAX_AQ_BUF_SIZE) {
434 dev_warn(&adapter->pdev->dev, "Too many add MAC changes in one request\n");
435 count = (I40EVF_MAX_AQ_BUF_SIZE -
436 sizeof(struct virtchnl_ether_addr_list)) /
437 sizeof(struct virtchnl_ether_addr);
438 len = sizeof(struct virtchnl_ether_addr_list) +
439 (count * sizeof(struct virtchnl_ether_addr));
443 veal = kzalloc(len, GFP_ATOMIC);
445 spin_unlock_bh(&adapter->mac_vlan_list_lock);
449 veal->vsi_id = adapter->vsi_res->vsi_id;
450 veal->num_elements = count;
451 list_for_each_entry(f, &adapter->mac_filter_list, list) {
453 ether_addr_copy(veal->list[i].addr, f->macaddr);
461 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER;
463 spin_unlock_bh(&adapter->mac_vlan_list_lock);
465 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_ETH_ADDR,
471 * i40evf_del_ether_addrs
472 * @adapter: adapter structure
474 * Request that the PF remove one or more addresses from our filters.
476 void i40evf_del_ether_addrs(struct i40evf_adapter *adapter)
478 struct virtchnl_ether_addr_list *veal;
479 struct i40evf_mac_filter *f, *ftmp;
480 int len, i = 0, count = 0;
483 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
484 /* bail because we already have a command pending */
485 dev_err(&adapter->pdev->dev, "Cannot remove filters, command %d pending\n",
486 adapter->current_op);
490 spin_lock_bh(&adapter->mac_vlan_list_lock);
492 list_for_each_entry(f, &adapter->mac_filter_list, list) {
497 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER;
498 spin_unlock_bh(&adapter->mac_vlan_list_lock);
501 adapter->current_op = VIRTCHNL_OP_DEL_ETH_ADDR;
503 len = sizeof(struct virtchnl_ether_addr_list) +
504 (count * sizeof(struct virtchnl_ether_addr));
505 if (len > I40EVF_MAX_AQ_BUF_SIZE) {
506 dev_warn(&adapter->pdev->dev, "Too many delete MAC changes in one request\n");
507 count = (I40EVF_MAX_AQ_BUF_SIZE -
508 sizeof(struct virtchnl_ether_addr_list)) /
509 sizeof(struct virtchnl_ether_addr);
510 len = sizeof(struct virtchnl_ether_addr_list) +
511 (count * sizeof(struct virtchnl_ether_addr));
514 veal = kzalloc(len, GFP_ATOMIC);
516 spin_unlock_bh(&adapter->mac_vlan_list_lock);
520 veal->vsi_id = adapter->vsi_res->vsi_id;
521 veal->num_elements = count;
522 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) {
524 ether_addr_copy(veal->list[i].addr, f->macaddr);
533 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER;
535 spin_unlock_bh(&adapter->mac_vlan_list_lock);
537 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_ETH_ADDR,
544 * @adapter: adapter structure
546 * Request that the PF add one or more VLAN filters to our VSI.
548 void i40evf_add_vlans(struct i40evf_adapter *adapter)
550 struct virtchnl_vlan_filter_list *vvfl;
551 int len, i = 0, count = 0;
552 struct i40evf_vlan_filter *f;
555 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
556 /* bail because we already have a command pending */
557 dev_err(&adapter->pdev->dev, "Cannot add VLANs, command %d pending\n",
558 adapter->current_op);
562 spin_lock_bh(&adapter->mac_vlan_list_lock);
564 list_for_each_entry(f, &adapter->vlan_filter_list, list) {
569 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
570 spin_unlock_bh(&adapter->mac_vlan_list_lock);
573 adapter->current_op = VIRTCHNL_OP_ADD_VLAN;
575 len = sizeof(struct virtchnl_vlan_filter_list) +
576 (count * sizeof(u16));
577 if (len > I40EVF_MAX_AQ_BUF_SIZE) {
578 dev_warn(&adapter->pdev->dev, "Too many add VLAN changes in one request\n");
579 count = (I40EVF_MAX_AQ_BUF_SIZE -
580 sizeof(struct virtchnl_vlan_filter_list)) /
582 len = sizeof(struct virtchnl_vlan_filter_list) +
583 (count * sizeof(u16));
586 vvfl = kzalloc(len, GFP_ATOMIC);
588 spin_unlock_bh(&adapter->mac_vlan_list_lock);
592 vvfl->vsi_id = adapter->vsi_res->vsi_id;
593 vvfl->num_elements = count;
594 list_for_each_entry(f, &adapter->vlan_filter_list, list) {
596 vvfl->vlan_id[i] = f->vlan;
604 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
606 spin_unlock_bh(&adapter->mac_vlan_list_lock);
608 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len);
614 * @adapter: adapter structure
616 * Request that the PF remove one or more VLAN filters from our VSI.
618 void i40evf_del_vlans(struct i40evf_adapter *adapter)
620 struct virtchnl_vlan_filter_list *vvfl;
621 struct i40evf_vlan_filter *f, *ftmp;
622 int len, i = 0, count = 0;
625 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
626 /* bail because we already have a command pending */
627 dev_err(&adapter->pdev->dev, "Cannot remove VLANs, command %d pending\n",
628 adapter->current_op);
632 spin_lock_bh(&adapter->mac_vlan_list_lock);
634 list_for_each_entry(f, &adapter->vlan_filter_list, list) {
639 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER;
640 spin_unlock_bh(&adapter->mac_vlan_list_lock);
643 adapter->current_op = VIRTCHNL_OP_DEL_VLAN;
645 len = sizeof(struct virtchnl_vlan_filter_list) +
646 (count * sizeof(u16));
647 if (len > I40EVF_MAX_AQ_BUF_SIZE) {
648 dev_warn(&adapter->pdev->dev, "Too many delete VLAN changes in one request\n");
649 count = (I40EVF_MAX_AQ_BUF_SIZE -
650 sizeof(struct virtchnl_vlan_filter_list)) /
652 len = sizeof(struct virtchnl_vlan_filter_list) +
653 (count * sizeof(u16));
656 vvfl = kzalloc(len, GFP_ATOMIC);
658 spin_unlock_bh(&adapter->mac_vlan_list_lock);
662 vvfl->vsi_id = adapter->vsi_res->vsi_id;
663 vvfl->num_elements = count;
664 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) {
666 vvfl->vlan_id[i] = f->vlan;
675 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER;
677 spin_unlock_bh(&adapter->mac_vlan_list_lock);
679 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len);
684 * i40evf_set_promiscuous
685 * @adapter: adapter structure
686 * @flags: bitmask to control unicast/multicast promiscuous.
688 * Request that the PF enable promiscuous mode for our VSI.
690 void i40evf_set_promiscuous(struct i40evf_adapter *adapter, int flags)
692 struct virtchnl_promisc_info vpi;
695 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
696 /* bail because we already have a command pending */
697 dev_err(&adapter->pdev->dev, "Cannot set promiscuous mode, command %d pending\n",
698 adapter->current_op);
702 promisc_all = FLAG_VF_UNICAST_PROMISC |
703 FLAG_VF_MULTICAST_PROMISC;
704 if ((flags & promisc_all) == promisc_all) {
705 adapter->flags |= I40EVF_FLAG_PROMISC_ON;
706 adapter->aq_required &= ~I40EVF_FLAG_AQ_REQUEST_PROMISC;
707 dev_info(&adapter->pdev->dev, "Entering promiscuous mode\n");
710 if (flags & FLAG_VF_MULTICAST_PROMISC) {
711 adapter->flags |= I40EVF_FLAG_ALLMULTI_ON;
712 adapter->aq_required &= ~I40EVF_FLAG_AQ_REQUEST_ALLMULTI;
713 dev_info(&adapter->pdev->dev, "Entering multicast promiscuous mode\n");
717 adapter->flags &= ~(I40EVF_FLAG_PROMISC_ON |
718 I40EVF_FLAG_ALLMULTI_ON);
719 adapter->aq_required &= ~(I40EVF_FLAG_AQ_RELEASE_PROMISC |
720 I40EVF_FLAG_AQ_RELEASE_ALLMULTI);
721 dev_info(&adapter->pdev->dev, "Leaving promiscuous mode\n");
724 adapter->current_op = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE;
725 vpi.vsi_id = adapter->vsi_res->vsi_id;
727 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE,
728 (u8 *)&vpi, sizeof(vpi));
732 * i40evf_request_stats
733 * @adapter: adapter structure
735 * Request VSI statistics from PF.
737 void i40evf_request_stats(struct i40evf_adapter *adapter)
739 struct virtchnl_queue_select vqs;
741 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
742 /* no error message, this isn't crucial */
745 adapter->current_op = VIRTCHNL_OP_GET_STATS;
746 vqs.vsi_id = adapter->vsi_res->vsi_id;
747 /* queue maps are ignored for this message - only the vsi is used */
748 if (i40evf_send_pf_msg(adapter, VIRTCHNL_OP_GET_STATS,
749 (u8 *)&vqs, sizeof(vqs)))
750 /* if the request failed, don't lock out others */
751 adapter->current_op = VIRTCHNL_OP_UNKNOWN;
756 * @adapter: adapter structure
758 * Request hash enable capabilities from PF
760 void i40evf_get_hena(struct i40evf_adapter *adapter)
762 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
763 /* bail because we already have a command pending */
764 dev_err(&adapter->pdev->dev, "Cannot get RSS hash capabilities, command %d pending\n",
765 adapter->current_op);
768 adapter->current_op = VIRTCHNL_OP_GET_RSS_HENA_CAPS;
769 adapter->aq_required &= ~I40EVF_FLAG_AQ_GET_HENA;
770 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_GET_RSS_HENA_CAPS,
776 * @adapter: adapter structure
778 * Request the PF to set our RSS hash capabilities
780 void i40evf_set_hena(struct i40evf_adapter *adapter)
782 struct virtchnl_rss_hena vrh;
784 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
785 /* bail because we already have a command pending */
786 dev_err(&adapter->pdev->dev, "Cannot set RSS hash enable, command %d pending\n",
787 adapter->current_op);
790 vrh.hena = adapter->hena;
791 adapter->current_op = VIRTCHNL_OP_SET_RSS_HENA;
792 adapter->aq_required &= ~I40EVF_FLAG_AQ_SET_HENA;
793 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_SET_RSS_HENA,
794 (u8 *)&vrh, sizeof(vrh));
799 * @adapter: adapter structure
801 * Request the PF to set our RSS hash key
803 void i40evf_set_rss_key(struct i40evf_adapter *adapter)
805 struct virtchnl_rss_key *vrk;
808 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
809 /* bail because we already have a command pending */
810 dev_err(&adapter->pdev->dev, "Cannot set RSS key, command %d pending\n",
811 adapter->current_op);
814 len = sizeof(struct virtchnl_rss_key) +
815 (adapter->rss_key_size * sizeof(u8)) - 1;
816 vrk = kzalloc(len, GFP_KERNEL);
819 vrk->vsi_id = adapter->vsi.id;
820 vrk->key_len = adapter->rss_key_size;
821 memcpy(vrk->key, adapter->rss_key, adapter->rss_key_size);
823 adapter->current_op = VIRTCHNL_OP_CONFIG_RSS_KEY;
824 adapter->aq_required &= ~I40EVF_FLAG_AQ_SET_RSS_KEY;
825 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_RSS_KEY,
832 * @adapter: adapter structure
834 * Request the PF to set our RSS lookup table
836 void i40evf_set_rss_lut(struct i40evf_adapter *adapter)
838 struct virtchnl_rss_lut *vrl;
841 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
842 /* bail because we already have a command pending */
843 dev_err(&adapter->pdev->dev, "Cannot set RSS LUT, command %d pending\n",
844 adapter->current_op);
847 len = sizeof(struct virtchnl_rss_lut) +
848 (adapter->rss_lut_size * sizeof(u8)) - 1;
849 vrl = kzalloc(len, GFP_KERNEL);
852 vrl->vsi_id = adapter->vsi.id;
853 vrl->lut_entries = adapter->rss_lut_size;
854 memcpy(vrl->lut, adapter->rss_lut, adapter->rss_lut_size);
855 adapter->current_op = VIRTCHNL_OP_CONFIG_RSS_LUT;
856 adapter->aq_required &= ~I40EVF_FLAG_AQ_SET_RSS_LUT;
857 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_RSS_LUT,
863 * i40evf_enable_vlan_stripping
864 * @adapter: adapter structure
866 * Request VLAN header stripping to be enabled
868 void i40evf_enable_vlan_stripping(struct i40evf_adapter *adapter)
870 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
871 /* bail because we already have a command pending */
872 dev_err(&adapter->pdev->dev, "Cannot enable stripping, command %d pending\n",
873 adapter->current_op);
876 adapter->current_op = VIRTCHNL_OP_ENABLE_VLAN_STRIPPING;
877 adapter->aq_required &= ~I40EVF_FLAG_AQ_ENABLE_VLAN_STRIPPING;
878 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_VLAN_STRIPPING,
883 * i40evf_disable_vlan_stripping
884 * @adapter: adapter structure
886 * Request VLAN header stripping to be disabled
888 void i40evf_disable_vlan_stripping(struct i40evf_adapter *adapter)
890 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
891 /* bail because we already have a command pending */
892 dev_err(&adapter->pdev->dev, "Cannot disable stripping, command %d pending\n",
893 adapter->current_op);
896 adapter->current_op = VIRTCHNL_OP_DISABLE_VLAN_STRIPPING;
897 adapter->aq_required &= ~I40EVF_FLAG_AQ_DISABLE_VLAN_STRIPPING;
898 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING,
903 * i40evf_print_link_message - print link up or down
904 * @adapter: adapter structure
906 * Log a message telling the world of our wonderous link status
908 static void i40evf_print_link_message(struct i40evf_adapter *adapter)
910 struct net_device *netdev = adapter->netdev;
911 char *speed = "Unknown ";
913 if (!adapter->link_up) {
914 netdev_info(netdev, "NIC Link is Down\n");
918 switch (adapter->link_speed) {
919 case I40E_LINK_SPEED_40GB:
922 case I40E_LINK_SPEED_25GB:
925 case I40E_LINK_SPEED_20GB:
928 case I40E_LINK_SPEED_10GB:
931 case I40E_LINK_SPEED_1GB:
934 case I40E_LINK_SPEED_100MB:
941 netdev_info(netdev, "NIC Link is Up %sbps Full Duplex\n", speed);
945 * i40evf_enable_channel
946 * @adapter: adapter structure
948 * Request that the PF enable channels as specified by
949 * the user via tc tool.
951 void i40evf_enable_channels(struct i40evf_adapter *adapter)
953 struct virtchnl_tc_info *vti = NULL;
957 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
958 /* bail because we already have a command pending */
959 dev_err(&adapter->pdev->dev, "Cannot configure mqprio, command %d pending\n",
960 adapter->current_op);
964 len = (adapter->num_tc * sizeof(struct virtchnl_channel_info)) +
965 sizeof(struct virtchnl_tc_info);
967 vti = kzalloc(len, GFP_KERNEL);
970 vti->num_tc = adapter->num_tc;
971 for (i = 0; i < vti->num_tc; i++) {
972 vti->list[i].count = adapter->ch_config.ch_info[i].count;
973 vti->list[i].offset = adapter->ch_config.ch_info[i].offset;
974 vti->list[i].pad = 0;
975 vti->list[i].max_tx_rate =
976 adapter->ch_config.ch_info[i].max_tx_rate;
979 adapter->ch_config.state = __I40EVF_TC_RUNNING;
980 adapter->flags |= I40EVF_FLAG_REINIT_ITR_NEEDED;
981 adapter->current_op = VIRTCHNL_OP_ENABLE_CHANNELS;
982 adapter->aq_required &= ~I40EVF_FLAG_AQ_ENABLE_CHANNELS;
983 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_CHANNELS,
989 * i40evf_disable_channel
990 * @adapter: adapter structure
992 * Request that the PF disable channels that are configured
994 void i40evf_disable_channels(struct i40evf_adapter *adapter)
996 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
997 /* bail because we already have a command pending */
998 dev_err(&adapter->pdev->dev, "Cannot configure mqprio, command %d pending\n",
999 adapter->current_op);
1003 adapter->ch_config.state = __I40EVF_TC_INVALID;
1004 adapter->flags |= I40EVF_FLAG_REINIT_ITR_NEEDED;
1005 adapter->current_op = VIRTCHNL_OP_DISABLE_CHANNELS;
1006 adapter->aq_required &= ~I40EVF_FLAG_AQ_DISABLE_CHANNELS;
1007 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_CHANNELS,
1012 * i40evf_print_cloud_filter
1013 * @adapter: adapter structure
1014 * @f: cloud filter to print
1016 * Print the cloud filter
1018 static void i40evf_print_cloud_filter(struct i40evf_adapter *adapter,
1019 struct virtchnl_filter *f)
1021 switch (f->flow_type) {
1022 case VIRTCHNL_TCP_V4_FLOW:
1023 dev_info(&adapter->pdev->dev, "dst_mac: %pM src_mac: %pM vlan_id: %hu dst_ip: %pI4 src_ip %pI4 dst_port %hu src_port %hu\n",
1024 &f->data.tcp_spec.dst_mac,
1025 &f->data.tcp_spec.src_mac,
1026 ntohs(f->data.tcp_spec.vlan_id),
1027 &f->data.tcp_spec.dst_ip[0],
1028 &f->data.tcp_spec.src_ip[0],
1029 ntohs(f->data.tcp_spec.dst_port),
1030 ntohs(f->data.tcp_spec.src_port));
1032 case VIRTCHNL_TCP_V6_FLOW:
1033 dev_info(&adapter->pdev->dev, "dst_mac: %pM src_mac: %pM vlan_id: %hu dst_ip: %pI6 src_ip %pI6 dst_port %hu src_port %hu\n",
1034 &f->data.tcp_spec.dst_mac,
1035 &f->data.tcp_spec.src_mac,
1036 ntohs(f->data.tcp_spec.vlan_id),
1037 &f->data.tcp_spec.dst_ip,
1038 &f->data.tcp_spec.src_ip,
1039 ntohs(f->data.tcp_spec.dst_port),
1040 ntohs(f->data.tcp_spec.src_port));
1046 * i40evf_add_cloud_filter
1047 * @adapter: adapter structure
1049 * Request that the PF add cloud filters as specified
1050 * by the user via tc tool.
1052 void i40evf_add_cloud_filter(struct i40evf_adapter *adapter)
1054 struct i40evf_cloud_filter *cf;
1055 struct virtchnl_filter *f;
1056 int len = 0, count = 0;
1058 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
1059 /* bail because we already have a command pending */
1060 dev_err(&adapter->pdev->dev, "Cannot add cloud filter, command %d pending\n",
1061 adapter->current_op);
1064 list_for_each_entry(cf, &adapter->cloud_filter_list, list) {
1071 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_CLOUD_FILTER;
1074 adapter->current_op = VIRTCHNL_OP_ADD_CLOUD_FILTER;
1076 len = sizeof(struct virtchnl_filter);
1077 f = kzalloc(len, GFP_KERNEL);
1081 list_for_each_entry(cf, &adapter->cloud_filter_list, list) {
1083 memcpy(f, &cf->f, sizeof(struct virtchnl_filter));
1085 cf->state = __I40EVF_CF_ADD_PENDING;
1086 i40evf_send_pf_msg(adapter,
1087 VIRTCHNL_OP_ADD_CLOUD_FILTER,
1095 * i40evf_del_cloud_filter
1096 * @adapter: adapter structure
1098 * Request that the PF delete cloud filters as specified
1099 * by the user via tc tool.
1101 void i40evf_del_cloud_filter(struct i40evf_adapter *adapter)
1103 struct i40evf_cloud_filter *cf, *cftmp;
1104 struct virtchnl_filter *f;
1105 int len = 0, count = 0;
1107 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
1108 /* bail because we already have a command pending */
1109 dev_err(&adapter->pdev->dev, "Cannot remove cloud filter, command %d pending\n",
1110 adapter->current_op);
1113 list_for_each_entry(cf, &adapter->cloud_filter_list, list) {
1120 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_CLOUD_FILTER;
1123 adapter->current_op = VIRTCHNL_OP_DEL_CLOUD_FILTER;
1125 len = sizeof(struct virtchnl_filter);
1126 f = kzalloc(len, GFP_KERNEL);
1130 list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, list) {
1132 memcpy(f, &cf->f, sizeof(struct virtchnl_filter));
1134 cf->state = __I40EVF_CF_DEL_PENDING;
1135 i40evf_send_pf_msg(adapter,
1136 VIRTCHNL_OP_DEL_CLOUD_FILTER,
1144 * i40evf_request_reset
1145 * @adapter: adapter structure
1147 * Request that the PF reset this VF. No response is expected.
1149 void i40evf_request_reset(struct i40evf_adapter *adapter)
1151 /* Don't check CURRENT_OP - this is always higher priority */
1152 i40evf_send_pf_msg(adapter, VIRTCHNL_OP_RESET_VF, NULL, 0);
1153 adapter->current_op = VIRTCHNL_OP_UNKNOWN;
1157 * i40evf_virtchnl_completion
1158 * @adapter: adapter structure
1159 * @v_opcode: opcode sent by PF
1160 * @v_retval: retval sent by PF
1161 * @msg: message sent by PF
1162 * @msglen: message length
1164 * Asynchronous completion function for admin queue messages. Rather than busy
1165 * wait, we fire off our requests and assume that no errors will be returned.
1166 * This function handles the reply messages.
1168 void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
1169 enum virtchnl_ops v_opcode,
1170 i40e_status v_retval,
1171 u8 *msg, u16 msglen)
1173 struct net_device *netdev = adapter->netdev;
1175 if (v_opcode == VIRTCHNL_OP_EVENT) {
1176 struct virtchnl_pf_event *vpe =
1177 (struct virtchnl_pf_event *)msg;
1178 bool link_up = vpe->event_data.link_event.link_status;
1179 switch (vpe->event) {
1180 case VIRTCHNL_EVENT_LINK_CHANGE:
1181 adapter->link_speed =
1182 vpe->event_data.link_event.link_speed;
1184 /* we've already got the right link status, bail */
1185 if (adapter->link_up == link_up)
1189 /* If we get link up message and start queues
1190 * before our queues are configured it will
1191 * trigger a TX hang. In that case, just ignore
1192 * the link status message,we'll get another one
1193 * after we enable queues and actually prepared
1196 if (adapter->state != __I40EVF_RUNNING)
1199 /* For ADq enabled VF, we reconfigure VSIs and
1200 * re-allocate queues. Hence wait till all
1201 * queues are enabled.
1203 if (adapter->flags &
1204 I40EVF_FLAG_QUEUES_DISABLED)
1208 adapter->link_up = link_up;
1210 netif_tx_start_all_queues(netdev);
1211 netif_carrier_on(netdev);
1213 netif_tx_stop_all_queues(netdev);
1214 netif_carrier_off(netdev);
1216 i40evf_print_link_message(adapter);
1218 case VIRTCHNL_EVENT_RESET_IMPENDING:
1219 dev_info(&adapter->pdev->dev, "Reset warning received from the PF\n");
1220 if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING)) {
1221 adapter->flags |= I40EVF_FLAG_RESET_PENDING;
1222 dev_info(&adapter->pdev->dev, "Scheduling reset task\n");
1223 schedule_work(&adapter->reset_task);
1227 dev_err(&adapter->pdev->dev, "Unknown event %d from PF\n",
1235 case VIRTCHNL_OP_ADD_VLAN:
1236 dev_err(&adapter->pdev->dev, "Failed to add VLAN filter, error %s\n",
1237 i40evf_stat_str(&adapter->hw, v_retval));
1239 case VIRTCHNL_OP_ADD_ETH_ADDR:
1240 dev_err(&adapter->pdev->dev, "Failed to add MAC filter, error %s\n",
1241 i40evf_stat_str(&adapter->hw, v_retval));
1243 case VIRTCHNL_OP_DEL_VLAN:
1244 dev_err(&adapter->pdev->dev, "Failed to delete VLAN filter, error %s\n",
1245 i40evf_stat_str(&adapter->hw, v_retval));
1247 case VIRTCHNL_OP_DEL_ETH_ADDR:
1248 dev_err(&adapter->pdev->dev, "Failed to delete MAC filter, error %s\n",
1249 i40evf_stat_str(&adapter->hw, v_retval));
1251 case VIRTCHNL_OP_ENABLE_CHANNELS:
1252 dev_err(&adapter->pdev->dev, "Failed to configure queue channels, error %s\n",
1253 i40evf_stat_str(&adapter->hw, v_retval));
1254 adapter->flags &= ~I40EVF_FLAG_REINIT_ITR_NEEDED;
1255 adapter->ch_config.state = __I40EVF_TC_INVALID;
1256 netdev_reset_tc(netdev);
1257 netif_tx_start_all_queues(netdev);
1259 case VIRTCHNL_OP_DISABLE_CHANNELS:
1260 dev_err(&adapter->pdev->dev, "Failed to disable queue channels, error %s\n",
1261 i40evf_stat_str(&adapter->hw, v_retval));
1262 adapter->flags &= ~I40EVF_FLAG_REINIT_ITR_NEEDED;
1263 adapter->ch_config.state = __I40EVF_TC_RUNNING;
1264 netif_tx_start_all_queues(netdev);
1266 case VIRTCHNL_OP_ADD_CLOUD_FILTER: {
1267 struct i40evf_cloud_filter *cf, *cftmp;
1269 list_for_each_entry_safe(cf, cftmp,
1270 &adapter->cloud_filter_list,
1272 if (cf->state == __I40EVF_CF_ADD_PENDING) {
1273 cf->state = __I40EVF_CF_INVALID;
1274 dev_info(&adapter->pdev->dev, "Failed to add cloud filter, error %s\n",
1275 i40evf_stat_str(&adapter->hw,
1277 i40evf_print_cloud_filter(adapter,
1279 list_del(&cf->list);
1281 adapter->num_cloud_filters--;
1286 case VIRTCHNL_OP_DEL_CLOUD_FILTER: {
1287 struct i40evf_cloud_filter *cf;
1289 list_for_each_entry(cf, &adapter->cloud_filter_list,
1291 if (cf->state == __I40EVF_CF_DEL_PENDING) {
1292 cf->state = __I40EVF_CF_ACTIVE;
1293 dev_info(&adapter->pdev->dev, "Failed to del cloud filter, error %s\n",
1294 i40evf_stat_str(&adapter->hw,
1296 i40evf_print_cloud_filter(adapter,
1303 dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n",
1305 i40evf_stat_str(&adapter->hw, v_retval),
1310 case VIRTCHNL_OP_GET_STATS: {
1311 struct i40e_eth_stats *stats =
1312 (struct i40e_eth_stats *)msg;
1313 netdev->stats.rx_packets = stats->rx_unicast +
1314 stats->rx_multicast +
1315 stats->rx_broadcast;
1316 netdev->stats.tx_packets = stats->tx_unicast +
1317 stats->tx_multicast +
1318 stats->tx_broadcast;
1319 netdev->stats.rx_bytes = stats->rx_bytes;
1320 netdev->stats.tx_bytes = stats->tx_bytes;
1321 netdev->stats.tx_errors = stats->tx_errors;
1322 netdev->stats.rx_dropped = stats->rx_discards;
1323 netdev->stats.tx_dropped = stats->tx_discards;
1324 adapter->current_stats = *stats;
1327 case VIRTCHNL_OP_GET_VF_RESOURCES: {
1328 u16 len = sizeof(struct virtchnl_vf_resource) +
1330 sizeof(struct virtchnl_vsi_resource);
1331 memcpy(adapter->vf_res, msg, min(msglen, len));
1332 i40e_vf_parse_hw_config(&adapter->hw, adapter->vf_res);
1333 /* restore current mac address */
1334 ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr);
1335 i40evf_process_config(adapter);
1338 case VIRTCHNL_OP_ENABLE_QUEUES:
1339 /* enable transmits */
1340 i40evf_irq_enable(adapter, true);
1341 adapter->flags &= ~I40EVF_FLAG_QUEUES_DISABLED;
1343 case VIRTCHNL_OP_DISABLE_QUEUES:
1344 i40evf_free_all_tx_resources(adapter);
1345 i40evf_free_all_rx_resources(adapter);
1346 if (adapter->state == __I40EVF_DOWN_PENDING) {
1347 adapter->state = __I40EVF_DOWN;
1348 wake_up(&adapter->down_waitqueue);
1351 case VIRTCHNL_OP_VERSION:
1352 case VIRTCHNL_OP_CONFIG_IRQ_MAP:
1353 /* Don't display an error if we get these out of sequence.
1354 * If the firmware needed to get kicked, we'll get these and
1357 if (v_opcode != adapter->current_op)
1360 case VIRTCHNL_OP_IWARP:
1361 /* Gobble zero-length replies from the PF. They indicate that
1362 * a previous message was received OK, and the client doesn't
1365 if (msglen && CLIENT_ENABLED(adapter))
1366 i40evf_notify_client_message(&adapter->vsi,
1370 case VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP:
1371 adapter->client_pending &=
1372 ~(BIT(VIRTCHNL_OP_CONFIG_IWARP_IRQ_MAP));
1374 case VIRTCHNL_OP_GET_RSS_HENA_CAPS: {
1375 struct virtchnl_rss_hena *vrh = (struct virtchnl_rss_hena *)msg;
1376 if (msglen == sizeof(*vrh))
1377 adapter->hena = vrh->hena;
1379 dev_warn(&adapter->pdev->dev,
1380 "Invalid message %d from PF\n", v_opcode);
1383 case VIRTCHNL_OP_REQUEST_QUEUES: {
1384 struct virtchnl_vf_res_request *vfres =
1385 (struct virtchnl_vf_res_request *)msg;
1386 if (vfres->num_queue_pairs != adapter->num_req_queues) {
1387 dev_info(&adapter->pdev->dev,
1388 "Requested %d queues, PF can support %d\n",
1389 adapter->num_req_queues,
1390 vfres->num_queue_pairs);
1391 adapter->num_req_queues = 0;
1392 adapter->flags &= ~I40EVF_FLAG_REINIT_ITR_NEEDED;
1396 case VIRTCHNL_OP_ADD_CLOUD_FILTER: {
1397 struct i40evf_cloud_filter *cf;
1399 list_for_each_entry(cf, &adapter->cloud_filter_list, list) {
1400 if (cf->state == __I40EVF_CF_ADD_PENDING)
1401 cf->state = __I40EVF_CF_ACTIVE;
1405 case VIRTCHNL_OP_DEL_CLOUD_FILTER: {
1406 struct i40evf_cloud_filter *cf, *cftmp;
1408 list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list,
1410 if (cf->state == __I40EVF_CF_DEL_PENDING) {
1411 cf->state = __I40EVF_CF_INVALID;
1412 list_del(&cf->list);
1414 adapter->num_cloud_filters--;
1420 if (adapter->current_op && (v_opcode != adapter->current_op))
1421 dev_warn(&adapter->pdev->dev, "Expected response %d from PF, received %d\n",
1422 adapter->current_op, v_opcode);
1424 } /* switch v_opcode */
1425 adapter->current_op = VIRTCHNL_OP_UNKNOWN;