Lines Matching full:adapter
9 * @adapter: adapter structure
16 static int iavf_send_pf_msg(struct iavf_adapter *adapter, in iavf_send_pf_msg() argument
19 struct iavf_hw *hw = &adapter->hw; in iavf_send_pf_msg()
22 if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) in iavf_send_pf_msg()
27 dev_dbg(&adapter->pdev->dev, "Unable to send opcode %d to PF, status %s, aq_err %s\n", in iavf_send_pf_msg()
35 * @adapter: adapter structure
41 int iavf_send_api_ver(struct iavf_adapter *adapter) in iavf_send_api_ver() argument
48 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_VERSION, (u8 *)&vvi, in iavf_send_api_ver()
89 * @adapter: adapter structure
96 int iavf_verify_api_ver(struct iavf_adapter *adapter) in iavf_verify_api_ver() argument
106 err = iavf_poll_virtchnl_msg(&adapter->hw, &event, VIRTCHNL_OP_VERSION); in iavf_verify_api_ver()
110 adapter->pf_version = *pf_vvi; in iavf_verify_api_ver()
125 * @adapter: adapter structure
131 int iavf_send_vf_config_msg(struct iavf_adapter *adapter) in iavf_send_vf_config_msg() argument
153 adapter->current_op = VIRTCHNL_OP_GET_VF_RESOURCES; in iavf_send_vf_config_msg()
154 adapter->aq_required &= ~IAVF_FLAG_AQ_GET_CONFIG; in iavf_send_vf_config_msg()
155 if (PF_IS_V11(adapter)) in iavf_send_vf_config_msg()
156 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_VF_RESOURCES, in iavf_send_vf_config_msg()
159 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_VF_RESOURCES, in iavf_send_vf_config_msg()
163 int iavf_send_vf_offload_vlan_v2_msg(struct iavf_adapter *adapter) in iavf_send_vf_offload_vlan_v2_msg() argument
165 adapter->aq_required &= ~IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS; in iavf_send_vf_offload_vlan_v2_msg()
167 if (!VLAN_V2_ALLOWED(adapter)) in iavf_send_vf_offload_vlan_v2_msg()
170 adapter->current_op = VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS; in iavf_send_vf_offload_vlan_v2_msg()
172 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS, in iavf_send_vf_offload_vlan_v2_msg()
178 * @adapter: adapter structure
183 static void iavf_validate_num_queues(struct iavf_adapter *adapter) in iavf_validate_num_queues() argument
185 if (adapter->vf_res->num_queue_pairs > IAVF_MAX_REQ_QUEUES) { in iavf_validate_num_queues()
189 dev_info(&adapter->pdev->dev, "Received %d queues, but can only have a max of %d\n", in iavf_validate_num_queues()
190 adapter->vf_res->num_queue_pairs, in iavf_validate_num_queues()
192 dev_info(&adapter->pdev->dev, "Fixing by reducing queues to %d\n", in iavf_validate_num_queues()
194 adapter->vf_res->num_queue_pairs = IAVF_MAX_REQ_QUEUES; in iavf_validate_num_queues()
195 for (i = 0; i < adapter->vf_res->num_vsis; i++) { in iavf_validate_num_queues()
196 vsi_res = &adapter->vf_res->vsi_res[i]; in iavf_validate_num_queues()
204 * @adapter: private adapter structure
211 int iavf_get_vf_config(struct iavf_adapter *adapter) in iavf_get_vf_config() argument
213 struct iavf_hw *hw = &adapter->hw; in iavf_get_vf_config()
225 memcpy(adapter->vf_res, event.msg_buf, min(event.msg_len, len)); in iavf_get_vf_config()
231 iavf_validate_num_queues(adapter); in iavf_get_vf_config()
232 iavf_vf_parse_hw_config(hw, adapter->vf_res); in iavf_get_vf_config()
239 int iavf_get_vf_vlan_v2_caps(struct iavf_adapter *adapter) in iavf_get_vf_vlan_v2_caps() argument
251 err = iavf_poll_virtchnl_msg(&adapter->hw, &event, in iavf_get_vf_vlan_v2_caps()
254 memcpy(&adapter->vlan_v2_caps, event.msg_buf, in iavf_get_vf_vlan_v2_caps()
264 * @adapter: adapter structure
268 void iavf_configure_queues(struct iavf_adapter *adapter) in iavf_configure_queues() argument
271 int i, max_frame = adapter->vf_res->max_mtu; in iavf_configure_queues()
272 int pairs = adapter->num_active_queues; in iavf_configure_queues()
279 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_configure_queues()
281 dev_err(&adapter->pdev->dev, "Cannot configure queues, command %d pending\n", in iavf_configure_queues()
282 adapter->current_op); in iavf_configure_queues()
285 adapter->current_op = VIRTCHNL_OP_CONFIG_VSI_QUEUES; in iavf_configure_queues()
292 if (!(adapter->flags & IAVF_FLAG_LEGACY_RX) && in iavf_configure_queues()
293 (adapter->netdev->mtu <= ETH_DATA_LEN)) in iavf_configure_queues()
296 vqci->vsi_id = adapter->vsi_res->vsi_id; in iavf_configure_queues()
305 vqpi->txq.ring_len = adapter->tx_rings[i].count; in iavf_configure_queues()
306 vqpi->txq.dma_ring_addr = adapter->tx_rings[i].dma; in iavf_configure_queues()
309 vqpi->rxq.ring_len = adapter->rx_rings[i].count; in iavf_configure_queues()
310 vqpi->rxq.dma_ring_addr = adapter->rx_rings[i].dma; in iavf_configure_queues()
313 ALIGN(adapter->rx_rings[i].rx_buf_len, in iavf_configure_queues()
315 if (CRC_OFFLOAD_ALLOWED(adapter)) in iavf_configure_queues()
316 vqpi->rxq.crc_disable = !!(adapter->netdev->features & in iavf_configure_queues()
321 adapter->aq_required &= ~IAVF_FLAG_AQ_CONFIGURE_QUEUES; in iavf_configure_queues()
322 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_VSI_QUEUES, in iavf_configure_queues()
329 * @adapter: adapter structure
333 void iavf_enable_queues(struct iavf_adapter *adapter) in iavf_enable_queues() argument
337 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_enable_queues()
339 dev_err(&adapter->pdev->dev, "Cannot enable queues, command %d pending\n", in iavf_enable_queues()
340 adapter->current_op); in iavf_enable_queues()
343 adapter->current_op = VIRTCHNL_OP_ENABLE_QUEUES; in iavf_enable_queues()
344 vqs.vsi_id = adapter->vsi_res->vsi_id; in iavf_enable_queues()
345 vqs.tx_queues = BIT(adapter->num_active_queues) - 1; in iavf_enable_queues()
347 adapter->aq_required &= ~IAVF_FLAG_AQ_ENABLE_QUEUES; in iavf_enable_queues()
348 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_QUEUES, in iavf_enable_queues()
354 * @adapter: adapter structure
358 void iavf_disable_queues(struct iavf_adapter *adapter) in iavf_disable_queues() argument
362 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_disable_queues()
364 dev_err(&adapter->pdev->dev, "Cannot disable queues, command %d pending\n", in iavf_disable_queues()
365 adapter->current_op); in iavf_disable_queues()
368 adapter->current_op = VIRTCHNL_OP_DISABLE_QUEUES; in iavf_disable_queues()
369 vqs.vsi_id = adapter->vsi_res->vsi_id; in iavf_disable_queues()
370 vqs.tx_queues = BIT(adapter->num_active_queues) - 1; in iavf_disable_queues()
372 adapter->aq_required &= ~IAVF_FLAG_AQ_DISABLE_QUEUES; in iavf_disable_queues()
373 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_QUEUES, in iavf_disable_queues()
379 * @adapter: adapter structure
384 void iavf_map_queues(struct iavf_adapter *adapter) in iavf_map_queues() argument
392 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_map_queues()
394 dev_err(&adapter->pdev->dev, "Cannot map queues to vectors, command %d pending\n", in iavf_map_queues()
395 adapter->current_op); in iavf_map_queues()
398 adapter->current_op = VIRTCHNL_OP_CONFIG_IRQ_MAP; in iavf_map_queues()
400 q_vectors = adapter->num_msix_vectors - NONQ_VECS; in iavf_map_queues()
402 len = virtchnl_struct_size(vimi, vecmap, adapter->num_msix_vectors); in iavf_map_queues()
407 vimi->num_vectors = adapter->num_msix_vectors; in iavf_map_queues()
410 q_vector = &adapter->q_vectors[v_idx]; in iavf_map_queues()
413 vecmap->vsi_id = adapter->vsi_res->vsi_id; in iavf_map_queues()
422 vecmap->vsi_id = adapter->vsi_res->vsi_id; in iavf_map_queues()
427 adapter->aq_required &= ~IAVF_FLAG_AQ_MAP_VECTORS; in iavf_map_queues()
428 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_IRQ_MAP, in iavf_map_queues()
449 * @adapter: adapter structure
453 void iavf_add_ether_addrs(struct iavf_adapter *adapter) in iavf_add_ether_addrs() argument
461 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_ether_addrs()
463 dev_err(&adapter->pdev->dev, "Cannot add filters, command %d pending\n", in iavf_add_ether_addrs()
464 adapter->current_op); in iavf_add_ether_addrs()
468 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
470 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_add_ether_addrs()
475 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_MAC_FILTER; in iavf_add_ether_addrs()
476 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
479 adapter->current_op = VIRTCHNL_OP_ADD_ETH_ADDR; in iavf_add_ether_addrs()
483 dev_warn(&adapter->pdev->dev, "Too many add MAC changes in one request\n"); in iavf_add_ether_addrs()
491 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
495 veal->vsi_id = adapter->vsi_res->vsi_id; in iavf_add_ether_addrs()
497 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_add_ether_addrs()
508 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_MAC_FILTER; in iavf_add_ether_addrs()
510 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
512 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_ETH_ADDR, (u8 *)veal, len); in iavf_add_ether_addrs()
518 * @adapter: adapter structure
522 void iavf_del_ether_addrs(struct iavf_adapter *adapter) in iavf_del_ether_addrs() argument
530 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_ether_addrs()
532 dev_err(&adapter->pdev->dev, "Cannot remove filters, command %d pending\n", in iavf_del_ether_addrs()
533 adapter->current_op); in iavf_del_ether_addrs()
537 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
539 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_del_ether_addrs()
544 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_MAC_FILTER; in iavf_del_ether_addrs()
545 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
548 adapter->current_op = VIRTCHNL_OP_DEL_ETH_ADDR; in iavf_del_ether_addrs()
552 dev_warn(&adapter->pdev->dev, "Too many delete MAC changes in one request\n"); in iavf_del_ether_addrs()
559 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
563 veal->vsi_id = adapter->vsi_res->vsi_id; in iavf_del_ether_addrs()
565 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { in iavf_del_ether_addrs()
577 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_MAC_FILTER; in iavf_del_ether_addrs()
579 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
581 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_ETH_ADDR, (u8 *)veal, len); in iavf_del_ether_addrs()
587 * @adapter: adapter structure
591 static void iavf_mac_add_ok(struct iavf_adapter *adapter) in iavf_mac_add_ok() argument
595 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_mac_add_ok()
596 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { in iavf_mac_add_ok()
601 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_mac_add_ok()
606 * @adapter: adapter structure
610 static void iavf_mac_add_reject(struct iavf_adapter *adapter) in iavf_mac_add_reject() argument
612 struct net_device *netdev = adapter->netdev; in iavf_mac_add_reject()
615 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_mac_add_reject()
616 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { in iavf_mac_add_reject()
628 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_mac_add_reject()
633 * @adapter: adapter structure
637 static void iavf_vlan_add_reject(struct iavf_adapter *adapter) in iavf_vlan_add_reject() argument
641 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_vlan_add_reject()
642 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in iavf_vlan_add_reject()
646 adapter->num_vlan_filters--; in iavf_vlan_add_reject()
649 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_vlan_add_reject()
654 * @adapter: adapter structure
658 void iavf_add_vlans(struct iavf_adapter *adapter) in iavf_add_vlans() argument
664 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_vlans()
666 dev_err(&adapter->pdev->dev, "Cannot add VLANs, command %d pending\n", in iavf_add_vlans()
667 adapter->current_op); in iavf_add_vlans()
671 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
673 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_add_vlans()
677 if (!count || !VLAN_FILTERING_ALLOWED(adapter)) { in iavf_add_vlans()
678 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_VLAN_FILTER; in iavf_add_vlans()
679 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
683 if (VLAN_ALLOWED(adapter)) { in iavf_add_vlans()
686 adapter->current_op = VIRTCHNL_OP_ADD_VLAN; in iavf_add_vlans()
690 dev_warn(&adapter->pdev->dev, "Too many add VLAN changes in one request\n"); in iavf_add_vlans()
698 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
702 vvfl->vsi_id = adapter->vsi_res->vsi_id; in iavf_add_vlans()
704 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_add_vlans()
714 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_VLAN_FILTER; in iavf_add_vlans()
716 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
718 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len); in iavf_add_vlans()
721 u16 max_vlans = adapter->vlan_v2_caps.filtering.max_filters; in iavf_add_vlans()
722 u16 current_vlans = iavf_get_num_vlans_added(adapter); in iavf_add_vlans()
725 adapter->current_op = VIRTCHNL_OP_ADD_VLAN_V2; in iavf_add_vlans()
729 count = max_vlans - iavf_get_num_vlans_added(adapter); in iavf_add_vlans()
735 dev_warn(&adapter->pdev->dev, "Too many add VLAN changes in one request\n"); in iavf_add_vlans()
744 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
748 vvfl_v2->vport_id = adapter->vsi_res->vsi_id; in iavf_add_vlans()
750 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_add_vlans()
753 &adapter->vlan_v2_caps.filtering.filtering_support; in iavf_add_vlans()
774 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_VLAN_FILTER; in iavf_add_vlans()
776 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
778 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_VLAN_V2, in iavf_add_vlans()
786 * @adapter: adapter structure
790 void iavf_del_vlans(struct iavf_adapter *adapter) in iavf_del_vlans() argument
796 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_vlans()
798 dev_err(&adapter->pdev->dev, "Cannot remove VLANs, command %d pending\n", in iavf_del_vlans()
799 adapter->current_op); in iavf_del_vlans()
803 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
805 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in iavf_del_vlans()
813 !VLAN_FILTERING_ALLOWED(adapter)) { in iavf_del_vlans()
816 adapter->num_vlan_filters--; in iavf_del_vlans()
818 !VLAN_FILTERING_ALLOWED(adapter)) { in iavf_del_vlans()
825 if (!count || !VLAN_FILTERING_ALLOWED(adapter)) { in iavf_del_vlans()
826 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_VLAN_FILTER; in iavf_del_vlans()
827 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
831 if (VLAN_ALLOWED(adapter)) { in iavf_del_vlans()
834 adapter->current_op = VIRTCHNL_OP_DEL_VLAN; in iavf_del_vlans()
838 dev_warn(&adapter->pdev->dev, "Too many delete VLAN changes in one request\n"); in iavf_del_vlans()
846 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
850 vvfl->vsi_id = adapter->vsi_res->vsi_id; in iavf_del_vlans()
852 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in iavf_del_vlans()
863 adapter->num_vlan_filters--; in iavf_del_vlans()
871 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_VLAN_FILTER; in iavf_del_vlans()
873 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
875 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len); in iavf_del_vlans()
880 adapter->current_op = VIRTCHNL_OP_DEL_VLAN_V2; in iavf_del_vlans()
884 dev_warn(&adapter->pdev->dev, "Too many add VLAN changes in one request\n"); in iavf_del_vlans()
893 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
897 vvfl_v2->vport_id = adapter->vsi_res->vsi_id; in iavf_del_vlans()
899 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in iavf_del_vlans()
903 &adapter->vlan_v2_caps.filtering.filtering_support; in iavf_del_vlans()
920 adapter->num_vlan_filters--; in iavf_del_vlans()
929 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_VLAN_FILTER; in iavf_del_vlans()
931 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
933 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_VLAN_V2, in iavf_del_vlans()
941 * @adapter: adapter structure
945 void iavf_set_promiscuous(struct iavf_adapter *adapter) in iavf_set_promiscuous() argument
947 struct net_device *netdev = adapter->netdev; in iavf_set_promiscuous()
951 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_promiscuous()
953 dev_err(&adapter->pdev->dev, "Cannot set promiscuous mode, command %d pending\n", in iavf_set_promiscuous()
954 adapter->current_op); in iavf_set_promiscuous()
959 spin_lock_bh(&adapter->current_netdev_promisc_flags_lock); in iavf_set_promiscuous()
962 if (!iavf_promiscuous_mode_changed(adapter)) { in iavf_set_promiscuous()
963 adapter->aq_required &= ~IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODE; in iavf_set_promiscuous()
964 dev_dbg(&adapter->pdev->dev, "No change in promiscuous mode\n"); in iavf_set_promiscuous()
966 spin_unlock_bh(&adapter->current_netdev_promisc_flags_lock); in iavf_set_promiscuous()
977 adapter->current_netdev_promisc_flags |= IFF_ALLMULTI; in iavf_set_promiscuous()
978 adapter->current_netdev_promisc_flags &= ~IFF_PROMISC; in iavf_set_promiscuous()
979 dev_info(&adapter->pdev->dev, "Entering multicast promiscuous mode\n"); in iavf_set_promiscuous()
986 adapter->current_netdev_promisc_flags &= in iavf_set_promiscuous()
988 dev_info(&adapter->pdev->dev, "Leaving promiscuous mode\n"); in iavf_set_promiscuous()
995 adapter->current_netdev_promisc_flags |= IFF_PROMISC; in iavf_set_promiscuous()
997 adapter->current_netdev_promisc_flags |= IFF_ALLMULTI; in iavf_set_promiscuous()
999 adapter->current_netdev_promisc_flags &= ~IFF_ALLMULTI; in iavf_set_promiscuous()
1001 dev_info(&adapter->pdev->dev, "Entering promiscuous mode\n"); in iavf_set_promiscuous()
1004 adapter->aq_required &= ~IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODE; in iavf_set_promiscuous()
1007 spin_unlock_bh(&adapter->current_netdev_promisc_flags_lock); in iavf_set_promiscuous()
1009 adapter->current_op = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE; in iavf_set_promiscuous()
1010 vpi.vsi_id = adapter->vsi_res->vsi_id; in iavf_set_promiscuous()
1012 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE, in iavf_set_promiscuous()
1018 * @adapter: adapter structure
1022 void iavf_request_stats(struct iavf_adapter *adapter) in iavf_request_stats() argument
1026 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_request_stats()
1031 adapter->aq_required &= ~IAVF_FLAG_AQ_REQUEST_STATS; in iavf_request_stats()
1032 adapter->current_op = VIRTCHNL_OP_GET_STATS; in iavf_request_stats()
1033 vqs.vsi_id = adapter->vsi_res->vsi_id; in iavf_request_stats()
1035 if (iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_STATS, (u8 *)&vqs, in iavf_request_stats()
1038 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_request_stats()
1043 * @adapter: adapter structure
1047 void iavf_get_hena(struct iavf_adapter *adapter) in iavf_get_hena() argument
1049 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_get_hena()
1051 dev_err(&adapter->pdev->dev, "Cannot get RSS hash capabilities, command %d pending\n", in iavf_get_hena()
1052 adapter->current_op); in iavf_get_hena()
1055 adapter->current_op = VIRTCHNL_OP_GET_RSS_HENA_CAPS; in iavf_get_hena()
1056 adapter->aq_required &= ~IAVF_FLAG_AQ_GET_HENA; in iavf_get_hena()
1057 iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_RSS_HENA_CAPS, NULL, 0); in iavf_get_hena()
1062 * @adapter: adapter structure
1066 void iavf_set_hena(struct iavf_adapter *adapter) in iavf_set_hena() argument
1070 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_hena()
1072 dev_err(&adapter->pdev->dev, "Cannot set RSS hash enable, command %d pending\n", in iavf_set_hena()
1073 adapter->current_op); in iavf_set_hena()
1076 vrh.hena = adapter->hena; in iavf_set_hena()
1077 adapter->current_op = VIRTCHNL_OP_SET_RSS_HENA; in iavf_set_hena()
1078 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_HENA; in iavf_set_hena()
1079 iavf_send_pf_msg(adapter, VIRTCHNL_OP_SET_RSS_HENA, (u8 *)&vrh, in iavf_set_hena()
1085 * @adapter: adapter structure
1089 void iavf_set_rss_key(struct iavf_adapter *adapter) in iavf_set_rss_key() argument
1094 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_rss_key()
1096 dev_err(&adapter->pdev->dev, "Cannot set RSS key, command %d pending\n", in iavf_set_rss_key()
1097 adapter->current_op); in iavf_set_rss_key()
1100 len = virtchnl_struct_size(vrk, key, adapter->rss_key_size); in iavf_set_rss_key()
1104 vrk->vsi_id = adapter->vsi.id; in iavf_set_rss_key()
1105 vrk->key_len = adapter->rss_key_size; in iavf_set_rss_key()
1106 memcpy(vrk->key, adapter->rss_key, adapter->rss_key_size); in iavf_set_rss_key()
1108 adapter->current_op = VIRTCHNL_OP_CONFIG_RSS_KEY; in iavf_set_rss_key()
1109 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_RSS_KEY; in iavf_set_rss_key()
1110 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_RSS_KEY, (u8 *)vrk, len); in iavf_set_rss_key()
1116 * @adapter: adapter structure
1120 void iavf_set_rss_lut(struct iavf_adapter *adapter) in iavf_set_rss_lut() argument
1125 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_rss_lut()
1127 dev_err(&adapter->pdev->dev, "Cannot set RSS LUT, command %d pending\n", in iavf_set_rss_lut()
1128 adapter->current_op); in iavf_set_rss_lut()
1131 len = virtchnl_struct_size(vrl, lut, adapter->rss_lut_size); in iavf_set_rss_lut()
1135 vrl->vsi_id = adapter->vsi.id; in iavf_set_rss_lut()
1136 vrl->lut_entries = adapter->rss_lut_size; in iavf_set_rss_lut()
1137 memcpy(vrl->lut, adapter->rss_lut, adapter->rss_lut_size); in iavf_set_rss_lut()
1138 adapter->current_op = VIRTCHNL_OP_CONFIG_RSS_LUT; in iavf_set_rss_lut()
1139 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_RSS_LUT; in iavf_set_rss_lut()
1140 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_RSS_LUT, (u8 *)vrl, len); in iavf_set_rss_lut()
1146 * @adapter: adapter structure
1150 void iavf_set_rss_hfunc(struct iavf_adapter *adapter) in iavf_set_rss_hfunc() argument
1155 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_rss_hfunc()
1157 dev_err(&adapter->pdev->dev, "Cannot set RSS Hash function, command %d pending\n", in iavf_set_rss_hfunc()
1158 adapter->current_op); in iavf_set_rss_hfunc()
1164 vrh->vsi_id = adapter->vsi.id; in iavf_set_rss_hfunc()
1165 vrh->rss_algorithm = adapter->hfunc; in iavf_set_rss_hfunc()
1166 adapter->current_op = VIRTCHNL_OP_CONFIG_RSS_HFUNC; in iavf_set_rss_hfunc()
1167 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_RSS_HFUNC; in iavf_set_rss_hfunc()
1168 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_RSS_HFUNC, (u8 *)vrh, len); in iavf_set_rss_hfunc()
1174 * @adapter: adapter structure
1178 void iavf_enable_vlan_stripping(struct iavf_adapter *adapter) in iavf_enable_vlan_stripping() argument
1180 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_enable_vlan_stripping()
1182 dev_err(&adapter->pdev->dev, "Cannot enable stripping, command %d pending\n", in iavf_enable_vlan_stripping()
1183 adapter->current_op); in iavf_enable_vlan_stripping()
1186 adapter->current_op = VIRTCHNL_OP_ENABLE_VLAN_STRIPPING; in iavf_enable_vlan_stripping()
1187 adapter->aq_required &= ~IAVF_FLAG_AQ_ENABLE_VLAN_STRIPPING; in iavf_enable_vlan_stripping()
1188 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_VLAN_STRIPPING, NULL, 0); in iavf_enable_vlan_stripping()
1193 * @adapter: adapter structure
1197 void iavf_disable_vlan_stripping(struct iavf_adapter *adapter) in iavf_disable_vlan_stripping() argument
1199 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_disable_vlan_stripping()
1201 dev_err(&adapter->pdev->dev, "Cannot disable stripping, command %d pending\n", in iavf_disable_vlan_stripping()
1202 adapter->current_op); in iavf_disable_vlan_stripping()
1205 adapter->current_op = VIRTCHNL_OP_DISABLE_VLAN_STRIPPING; in iavf_disable_vlan_stripping()
1206 adapter->aq_required &= ~IAVF_FLAG_AQ_DISABLE_VLAN_STRIPPING; in iavf_disable_vlan_stripping()
1207 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING, NULL, 0); in iavf_disable_vlan_stripping()
1228 * @adapter: adapter structure
1234 iavf_set_vc_offload_ethertype(struct iavf_adapter *adapter, in iavf_set_vc_offload_ethertype() argument
1246 &adapter->vlan_v2_caps.offloads.stripping_support; in iavf_set_vc_offload_ethertype()
1251 &adapter->vlan_v2_caps.offloads.insertion_support; in iavf_set_vc_offload_ethertype()
1254 …dev_err(&adapter->pdev->dev, "Invalid opcode %d for setting virtchnl ethertype to enable/disable V… in iavf_set_vc_offload_ethertype()
1267 dev_dbg(&adapter->pdev->dev, "opcode %d unsupported for VLAN TPID 0x%04x\n", in iavf_set_vc_offload_ethertype()
1277 * @adapter: adapter structure
1282 iavf_clear_offload_v2_aq_required(struct iavf_adapter *adapter, u16 tpid, in iavf_clear_offload_v2_aq_required() argument
1288 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1291 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1296 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1299 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1304 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1307 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1312 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1315 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1319 …dev_err(&adapter->pdev->dev, "Unsupported opcode %d specified for clearing aq_required bits for VI… in iavf_clear_offload_v2_aq_required()
1326 * @adapter: adapter structure
1331 iavf_send_vlan_offload_v2(struct iavf_adapter *adapter, u16 tpid, in iavf_send_vlan_offload_v2() argument
1337 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_send_vlan_offload_v2()
1339 dev_err(&adapter->pdev->dev, "Cannot send %d, command %d pending\n", in iavf_send_vlan_offload_v2()
1340 offload_op, adapter->current_op); in iavf_send_vlan_offload_v2()
1344 adapter->current_op = offload_op; in iavf_send_vlan_offload_v2()
1350 msg->vport_id = adapter->vsi_res->vsi_id; in iavf_send_vlan_offload_v2()
1353 iavf_clear_offload_v2_aq_required(adapter, tpid, offload_op); in iavf_send_vlan_offload_v2()
1356 if (!iavf_set_vc_offload_ethertype(adapter, msg, tpid, offload_op)) in iavf_send_vlan_offload_v2()
1357 iavf_send_pf_msg(adapter, offload_op, (u8 *)msg, len); in iavf_send_vlan_offload_v2()
1359 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_send_vlan_offload_v2()
1366 * @adapter: adapter structure
1369 void iavf_enable_vlan_stripping_v2(struct iavf_adapter *adapter, u16 tpid) in iavf_enable_vlan_stripping_v2() argument
1371 iavf_send_vlan_offload_v2(adapter, tpid, in iavf_enable_vlan_stripping_v2()
1377 * @adapter: adapter structure
1380 void iavf_disable_vlan_stripping_v2(struct iavf_adapter *adapter, u16 tpid) in iavf_disable_vlan_stripping_v2() argument
1382 iavf_send_vlan_offload_v2(adapter, tpid, in iavf_disable_vlan_stripping_v2()
1388 * @adapter: adapter structure
1391 void iavf_enable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid) in iavf_enable_vlan_insertion_v2() argument
1393 iavf_send_vlan_offload_v2(adapter, tpid, in iavf_enable_vlan_insertion_v2()
1399 * @adapter: adapter structure
1402 void iavf_disable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid) in iavf_disable_vlan_insertion_v2() argument
1404 iavf_send_vlan_offload_v2(adapter, tpid, in iavf_disable_vlan_insertion_v2()
1410 * @adapter: adapter structure
1414 static void iavf_print_link_message(struct iavf_adapter *adapter) in iavf_print_link_message() argument
1416 struct net_device *netdev = adapter->netdev; in iavf_print_link_message()
1420 if (!adapter->link_up) { in iavf_print_link_message()
1425 if (ADV_LINK_SUPPORT(adapter)) { in iavf_print_link_message()
1426 link_speed_mbps = adapter->link_speed_mbps; in iavf_print_link_message()
1430 switch (adapter->link_speed) { in iavf_print_link_message()
1481 * @adapter: adapter structure
1487 iavf_get_vpe_link_status(struct iavf_adapter *adapter, in iavf_get_vpe_link_status() argument
1490 if (ADV_LINK_SUPPORT(adapter)) in iavf_get_vpe_link_status()
1498 * @adapter: adapter structure for which we are setting the link speed
1504 iavf_set_adapter_link_speed_from_vpe(struct iavf_adapter *adapter, in iavf_set_adapter_link_speed_from_vpe() argument
1507 if (ADV_LINK_SUPPORT(adapter)) in iavf_set_adapter_link_speed_from_vpe()
1508 adapter->link_speed_mbps = in iavf_set_adapter_link_speed_from_vpe()
1511 adapter->link_speed = vpe->event_data.link_event.link_speed; in iavf_set_adapter_link_speed_from_vpe()
1516 * @adapter: adapter structure
1521 void iavf_enable_channels(struct iavf_adapter *adapter) in iavf_enable_channels() argument
1527 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_enable_channels()
1529 dev_err(&adapter->pdev->dev, "Cannot configure mqprio, command %d pending\n", in iavf_enable_channels()
1530 adapter->current_op); in iavf_enable_channels()
1534 len = virtchnl_struct_size(vti, list, adapter->num_tc); in iavf_enable_channels()
1538 vti->num_tc = adapter->num_tc; in iavf_enable_channels()
1540 vti->list[i].count = adapter->ch_config.ch_info[i].count; in iavf_enable_channels()
1541 vti->list[i].offset = adapter->ch_config.ch_info[i].offset; in iavf_enable_channels()
1544 adapter->ch_config.ch_info[i].max_tx_rate; in iavf_enable_channels()
1547 adapter->ch_config.state = __IAVF_TC_RUNNING; in iavf_enable_channels()
1548 adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_enable_channels()
1549 adapter->current_op = VIRTCHNL_OP_ENABLE_CHANNELS; in iavf_enable_channels()
1550 adapter->aq_required &= ~IAVF_FLAG_AQ_ENABLE_CHANNELS; in iavf_enable_channels()
1551 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_CHANNELS, (u8 *)vti, len); in iavf_enable_channels()
1557 * @adapter: adapter structure
1561 void iavf_disable_channels(struct iavf_adapter *adapter) in iavf_disable_channels() argument
1563 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_disable_channels()
1565 dev_err(&adapter->pdev->dev, "Cannot configure mqprio, command %d pending\n", in iavf_disable_channels()
1566 adapter->current_op); in iavf_disable_channels()
1570 adapter->ch_config.state = __IAVF_TC_INVALID; in iavf_disable_channels()
1571 adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_disable_channels()
1572 adapter->current_op = VIRTCHNL_OP_DISABLE_CHANNELS; in iavf_disable_channels()
1573 adapter->aq_required &= ~IAVF_FLAG_AQ_DISABLE_CHANNELS; in iavf_disable_channels()
1574 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_CHANNELS, NULL, 0); in iavf_disable_channels()
1579 * @adapter: adapter structure
1584 static void iavf_print_cloud_filter(struct iavf_adapter *adapter, in iavf_print_cloud_filter() argument
1589 …dev_info(&adapter->pdev->dev, "dst_mac: %pM src_mac: %pM vlan_id: %hu dst_ip: %pI4 src_ip %pI4 dst… in iavf_print_cloud_filter()
1599 …dev_info(&adapter->pdev->dev, "dst_mac: %pM src_mac: %pM vlan_id: %hu dst_ip: %pI6 src_ip %pI6 dst… in iavf_print_cloud_filter()
1613 * @adapter: adapter structure
1618 void iavf_add_cloud_filter(struct iavf_adapter *adapter) in iavf_add_cloud_filter() argument
1624 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_cloud_filter()
1626 dev_err(&adapter->pdev->dev, "Cannot add cloud filter, command %d pending\n", in iavf_add_cloud_filter()
1627 adapter->current_op); in iavf_add_cloud_filter()
1630 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_add_cloud_filter()
1637 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_CLOUD_FILTER; in iavf_add_cloud_filter()
1640 adapter->current_op = VIRTCHNL_OP_ADD_CLOUD_FILTER; in iavf_add_cloud_filter()
1647 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_add_cloud_filter()
1652 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_CLOUD_FILTER, in iavf_add_cloud_filter()
1661 * @adapter: adapter structure
1666 void iavf_del_cloud_filter(struct iavf_adapter *adapter) in iavf_del_cloud_filter() argument
1672 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_cloud_filter()
1674 dev_err(&adapter->pdev->dev, "Cannot remove cloud filter, command %d pending\n", in iavf_del_cloud_filter()
1675 adapter->current_op); in iavf_del_cloud_filter()
1678 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_del_cloud_filter()
1685 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_CLOUD_FILTER; in iavf_del_cloud_filter()
1688 adapter->current_op = VIRTCHNL_OP_DEL_CLOUD_FILTER; in iavf_del_cloud_filter()
1695 list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, list) { in iavf_del_cloud_filter()
1700 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_CLOUD_FILTER, in iavf_del_cloud_filter()
1709 * @adapter: the VF adapter structure
1714 void iavf_add_fdir_filter(struct iavf_adapter *adapter) in iavf_add_fdir_filter() argument
1721 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_fdir_filter()
1723 dev_err(&adapter->pdev->dev, "Cannot add Flow Director filter, command %d pending\n", in iavf_add_fdir_filter()
1724 adapter->current_op); in iavf_add_fdir_filter()
1733 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_add_fdir_filter()
1734 list_for_each_entry(fdir, &adapter->fdir_list_head, list) { in iavf_add_fdir_filter()
1742 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_add_fdir_filter()
1748 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_FDIR_FILTER; in iavf_add_fdir_filter()
1752 adapter->current_op = VIRTCHNL_OP_ADD_FDIR_FILTER; in iavf_add_fdir_filter()
1753 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_FDIR_FILTER, (u8 *)f, len); in iavf_add_fdir_filter()
1759 * @adapter: the VF adapter structure
1764 void iavf_del_fdir_filter(struct iavf_adapter *adapter) in iavf_del_fdir_filter() argument
1771 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_fdir_filter()
1773 dev_err(&adapter->pdev->dev, "Cannot remove Flow Director filter, command %d pending\n", in iavf_del_fdir_filter()
1774 adapter->current_op); in iavf_del_fdir_filter()
1780 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_del_fdir_filter()
1781 list_for_each_entry(fdir, &adapter->fdir_list_head, list) { in iavf_del_fdir_filter()
1796 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_del_fdir_filter()
1799 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_FDIR_FILTER; in iavf_del_fdir_filter()
1803 adapter->current_op = VIRTCHNL_OP_DEL_FDIR_FILTER; in iavf_del_fdir_filter()
1804 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_FDIR_FILTER, (u8 *)&f, len); in iavf_del_fdir_filter()
1809 * @adapter: the VF adapter structure
1814 void iavf_add_adv_rss_cfg(struct iavf_adapter *adapter) in iavf_add_adv_rss_cfg() argument
1821 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_adv_rss_cfg()
1823 dev_err(&adapter->pdev->dev, "Cannot add RSS configuration, command %d pending\n", in iavf_add_adv_rss_cfg()
1824 adapter->current_op); in iavf_add_adv_rss_cfg()
1833 spin_lock_bh(&adapter->adv_rss_lock); in iavf_add_adv_rss_cfg()
1834 list_for_each_entry(rss, &adapter->adv_rss_list_head, list) { in iavf_add_adv_rss_cfg()
1839 iavf_print_adv_rss_cfg(adapter, rss, in iavf_add_adv_rss_cfg()
1845 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_add_adv_rss_cfg()
1848 adapter->current_op = VIRTCHNL_OP_ADD_RSS_CFG; in iavf_add_adv_rss_cfg()
1849 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_RSS_CFG, in iavf_add_adv_rss_cfg()
1852 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_ADV_RSS_CFG; in iavf_add_adv_rss_cfg()
1860 * @adapter: the VF adapter structure
1865 void iavf_del_adv_rss_cfg(struct iavf_adapter *adapter) in iavf_del_adv_rss_cfg() argument
1872 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_adv_rss_cfg()
1874 dev_err(&adapter->pdev->dev, "Cannot remove RSS configuration, command %d pending\n", in iavf_del_adv_rss_cfg()
1875 adapter->current_op); in iavf_del_adv_rss_cfg()
1884 spin_lock_bh(&adapter->adv_rss_lock); in iavf_del_adv_rss_cfg()
1885 list_for_each_entry(rss, &adapter->adv_rss_list_head, list) { in iavf_del_adv_rss_cfg()
1893 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_del_adv_rss_cfg()
1896 adapter->current_op = VIRTCHNL_OP_DEL_RSS_CFG; in iavf_del_adv_rss_cfg()
1897 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_RSS_CFG, in iavf_del_adv_rss_cfg()
1900 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_ADV_RSS_CFG; in iavf_del_adv_rss_cfg()
1908 * @adapter: adapter structure
1912 int iavf_request_reset(struct iavf_adapter *adapter) in iavf_request_reset() argument
1916 err = iavf_send_pf_msg(adapter, VIRTCHNL_OP_RESET_VF, NULL, 0); in iavf_request_reset()
1917 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_request_reset()
1939 * @adapter: private adapter structure
1944 static void iavf_activate_fdir_filters(struct iavf_adapter *adapter) in iavf_activate_fdir_filters() argument
1949 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_activate_fdir_filters()
1950 list_for_each_entry_safe(f, ftmp, &adapter->fdir_list_head, list) { in iavf_activate_fdir_filters()
1970 adapter->fdir_active_fltr--; in iavf_activate_fdir_filters()
1973 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_activate_fdir_filters()
1976 adapter->aq_required |= IAVF_FLAG_AQ_ADD_FDIR_FILTER; in iavf_activate_fdir_filters()
1981 * @adapter: adapter structure
1991 void iavf_virtchnl_completion(struct iavf_adapter *adapter, in iavf_virtchnl_completion() argument
1995 struct net_device *netdev = adapter->netdev; in iavf_virtchnl_completion()
2000 bool link_up = iavf_get_vpe_link_status(adapter, vpe); in iavf_virtchnl_completion()
2004 iavf_set_adapter_link_speed_from_vpe(adapter, vpe); in iavf_virtchnl_completion()
2007 if (adapter->link_up == link_up) in iavf_virtchnl_completion()
2018 if (adapter->state != __IAVF_RUNNING) in iavf_virtchnl_completion()
2025 if (adapter->flags & in iavf_virtchnl_completion()
2030 adapter->link_up = link_up; in iavf_virtchnl_completion()
2038 iavf_print_link_message(adapter); in iavf_virtchnl_completion()
2041 dev_info(&adapter->pdev->dev, "Reset indication received from the PF\n"); in iavf_virtchnl_completion()
2042 if (!(adapter->flags & IAVF_FLAG_RESET_PENDING)) { in iavf_virtchnl_completion()
2043 dev_info(&adapter->pdev->dev, "Scheduling reset task\n"); in iavf_virtchnl_completion()
2044 iavf_schedule_reset(adapter, IAVF_FLAG_RESET_PENDING); in iavf_virtchnl_completion()
2048 dev_err(&adapter->pdev->dev, "Unknown event %d from PF\n", in iavf_virtchnl_completion()
2057 dev_err(&adapter->pdev->dev, "Failed to add VLAN filter, error %s\n", in iavf_virtchnl_completion()
2058 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2061 dev_err(&adapter->pdev->dev, "Failed to add MAC filter, error %s\n", in iavf_virtchnl_completion()
2062 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2063 iavf_mac_add_reject(adapter); in iavf_virtchnl_completion()
2065 ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr); in iavf_virtchnl_completion()
2066 wake_up(&adapter->vc_waitqueue); in iavf_virtchnl_completion()
2069 dev_err(&adapter->pdev->dev, "Failed to delete VLAN filter, error %s\n", in iavf_virtchnl_completion()
2070 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2073 dev_err(&adapter->pdev->dev, "Failed to delete MAC filter, error %s\n", in iavf_virtchnl_completion()
2074 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2077 dev_err(&adapter->pdev->dev, "Failed to configure queue channels, error %s\n", in iavf_virtchnl_completion()
2078 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2079 adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_virtchnl_completion()
2080 adapter->ch_config.state = __IAVF_TC_INVALID; in iavf_virtchnl_completion()
2085 dev_err(&adapter->pdev->dev, "Failed to disable queue channels, error %s\n", in iavf_virtchnl_completion()
2086 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2087 adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_virtchnl_completion()
2088 adapter->ch_config.state = __IAVF_TC_RUNNING; in iavf_virtchnl_completion()
2095 &adapter->cloud_filter_list, in iavf_virtchnl_completion()
2099 dev_info(&adapter->pdev->dev, "Failed to add cloud filter, error %s\n", in iavf_virtchnl_completion()
2100 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2102 iavf_print_cloud_filter(adapter, in iavf_virtchnl_completion()
2106 adapter->num_cloud_filters--; in iavf_virtchnl_completion()
2114 list_for_each_entry(cf, &adapter->cloud_filter_list, in iavf_virtchnl_completion()
2118 dev_info(&adapter->pdev->dev, "Failed to del cloud filter, error %s\n", in iavf_virtchnl_completion()
2119 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2121 iavf_print_cloud_filter(adapter, in iavf_virtchnl_completion()
2130 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2132 &adapter->fdir_list_head, in iavf_virtchnl_completion()
2135 dev_info(&adapter->pdev->dev, "Failed to add Flow Director filter, error %s\n", in iavf_virtchnl_completion()
2136 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2138 iavf_print_fdir_fltr(adapter, fdir); in iavf_virtchnl_completion()
2140 dev_err(&adapter->pdev->dev, in iavf_virtchnl_completion()
2144 adapter->fdir_active_fltr--; in iavf_virtchnl_completion()
2147 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2153 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2154 list_for_each_entry(fdir, &adapter->fdir_list_head, in iavf_virtchnl_completion()
2159 dev_info(&adapter->pdev->dev, "Failed to del Flow Director filter, error %s\n", in iavf_virtchnl_completion()
2160 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2162 iavf_print_fdir_fltr(adapter, fdir); in iavf_virtchnl_completion()
2165 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2171 spin_lock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2173 &adapter->adv_rss_list_head, in iavf_virtchnl_completion()
2176 iavf_print_adv_rss_cfg(adapter, rss, in iavf_virtchnl_completion()
2183 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2189 spin_lock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2190 list_for_each_entry(rss, &adapter->adv_rss_list_head, in iavf_virtchnl_completion()
2194 dev_err(&adapter->pdev->dev, "Failed to delete RSS configuration, error %s\n", in iavf_virtchnl_completion()
2195 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2199 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2203 …dev_warn(&adapter->pdev->dev, "Changing VLAN Stripping is not allowed when Port VLAN is configured… in iavf_virtchnl_completion()
2210 …dev_warn(&adapter->pdev->dev, "Changing VLAN Stripping is not allowed when Port VLAN is configured… in iavf_virtchnl_completion()
2217 iavf_vlan_add_reject(adapter); in iavf_virtchnl_completion()
2218 dev_warn(&adapter->pdev->dev, "Failed to add VLAN filter, error %s\n", in iavf_virtchnl_completion()
2219 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2222 dev_warn(&adapter->pdev->dev, "Failed to configure hash function, error %s\n", in iavf_virtchnl_completion()
2223 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2225 if (adapter->hfunc == in iavf_virtchnl_completion()
2227 adapter->hfunc = in iavf_virtchnl_completion()
2230 adapter->hfunc = in iavf_virtchnl_completion()
2235 dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n", in iavf_virtchnl_completion()
2236 v_retval, iavf_stat_str(&adapter->hw, v_retval), in iavf_virtchnl_completion()
2243 iavf_mac_add_ok(adapter); in iavf_virtchnl_completion()
2244 if (!ether_addr_equal(netdev->dev_addr, adapter->hw.mac.addr)) in iavf_virtchnl_completion()
2246 adapter->hw.mac.addr)) { in iavf_virtchnl_completion()
2248 eth_hw_addr_set(netdev, adapter->hw.mac.addr); in iavf_virtchnl_completion()
2251 wake_up(&adapter->vc_waitqueue); in iavf_virtchnl_completion()
2267 adapter->current_stats = *stats; in iavf_virtchnl_completion()
2273 memcpy(adapter->vf_res, msg, min(msglen, len)); in iavf_virtchnl_completion()
2274 iavf_validate_num_queues(adapter); in iavf_virtchnl_completion()
2275 iavf_vf_parse_hw_config(&adapter->hw, adapter->vf_res); in iavf_virtchnl_completion()
2276 if (is_zero_ether_addr(adapter->hw.mac.addr)) { in iavf_virtchnl_completion()
2278 ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr); in iavf_virtchnl_completion()
2283 adapter->hw.mac.addr); in iavf_virtchnl_completion()
2286 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2287 iavf_add_filter(adapter, adapter->hw.mac.addr); in iavf_virtchnl_completion()
2289 if (VLAN_ALLOWED(adapter)) { in iavf_virtchnl_completion()
2290 if (!list_empty(&adapter->vlan_filter_list)) { in iavf_virtchnl_completion()
2295 &adapter->vlan_filter_list, in iavf_virtchnl_completion()
2299 adapter->aq_required |= in iavf_virtchnl_completion()
2304 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2306 iavf_activate_fdir_filters(adapter); in iavf_virtchnl_completion()
2308 iavf_parse_vf_resource_msg(adapter); in iavf_virtchnl_completion()
2314 if (VLAN_V2_ALLOWED(adapter)) in iavf_virtchnl_completion()
2327 memcpy(&adapter->vlan_v2_caps, msg, in iavf_virtchnl_completion()
2329 sizeof(adapter->vlan_v2_caps))); in iavf_virtchnl_completion()
2331 iavf_process_config(adapter); in iavf_virtchnl_completion()
2332 adapter->flags |= IAVF_FLAG_SETUP_NETDEV_FEATURES; in iavf_virtchnl_completion()
2333 iavf_schedule_finish_config(adapter); in iavf_virtchnl_completion()
2335 iavf_set_queue_vlan_tag_loc(adapter); in iavf_virtchnl_completion()
2338 adapter->hw.mac.addr); in iavf_virtchnl_completion()
2340 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2343 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_virtchnl_completion()
2347 adapter->hw.mac.addr); in iavf_virtchnl_completion()
2356 if (VLAN_FILTERING_ALLOWED(adapter)) { in iavf_virtchnl_completion()
2359 if (!list_empty(&adapter->vlan_filter_list)) { in iavf_virtchnl_completion()
2361 &adapter->vlan_filter_list, in iavf_virtchnl_completion()
2369 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2372 eth_hw_addr_set(netdev, adapter->hw.mac.addr); in iavf_virtchnl_completion()
2375 adapter->aq_required |= IAVF_FLAG_AQ_ADD_MAC_FILTER | in iavf_virtchnl_completion()
2381 iavf_irq_enable(adapter, true); in iavf_virtchnl_completion()
2382 wake_up(&adapter->reset_waitqueue); in iavf_virtchnl_completion()
2383 adapter->flags &= ~IAVF_FLAG_QUEUES_DISABLED; in iavf_virtchnl_completion()
2386 iavf_free_all_tx_resources(adapter); in iavf_virtchnl_completion()
2387 iavf_free_all_rx_resources(adapter); in iavf_virtchnl_completion()
2388 if (adapter->state == __IAVF_DOWN_PENDING) { in iavf_virtchnl_completion()
2389 iavf_change_state(adapter, __IAVF_DOWN); in iavf_virtchnl_completion()
2390 wake_up(&adapter->down_waitqueue); in iavf_virtchnl_completion()
2399 if (v_opcode != adapter->current_op) in iavf_virtchnl_completion()
2406 adapter->hena = vrh->hena; in iavf_virtchnl_completion()
2408 dev_warn(&adapter->pdev->dev, in iavf_virtchnl_completion()
2416 if (vfres->num_queue_pairs != adapter->num_req_queues) { in iavf_virtchnl_completion()
2417 dev_info(&adapter->pdev->dev, in iavf_virtchnl_completion()
2419 adapter->num_req_queues, in iavf_virtchnl_completion()
2421 adapter->num_req_queues = 0; in iavf_virtchnl_completion()
2422 adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_virtchnl_completion()
2429 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_virtchnl_completion()
2438 list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, in iavf_virtchnl_completion()
2444 adapter->num_cloud_filters--; in iavf_virtchnl_completion()
2453 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2455 &adapter->fdir_list_head, in iavf_virtchnl_completion()
2459 dev_info(&adapter->pdev->dev, "Flow Director filter with location %u is added\n", in iavf_virtchnl_completion()
2464 dev_info(&adapter->pdev->dev, "Failed to add Flow Director filter with status: %d\n", in iavf_virtchnl_completion()
2466 iavf_print_fdir_fltr(adapter, fdir); in iavf_virtchnl_completion()
2469 adapter->fdir_active_fltr--; in iavf_virtchnl_completion()
2473 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2480 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2481 list_for_each_entry_safe(fdir, fdir_tmp, &adapter->fdir_list_head, in iavf_virtchnl_completion()
2487 dev_info(&adapter->pdev->dev, "Flow Director filter with location %u is deleted\n", in iavf_virtchnl_completion()
2491 adapter->fdir_active_fltr--; in iavf_virtchnl_completion()
2494 dev_info(&adapter->pdev->dev, "Failed to delete Flow Director filter with status: %d\n", in iavf_virtchnl_completion()
2496 iavf_print_fdir_fltr(adapter, fdir); in iavf_virtchnl_completion()
2505 dev_info(&adapter->pdev->dev, "Failed to disable Flow Director filter with status: %d\n", in iavf_virtchnl_completion()
2507 iavf_print_fdir_fltr(adapter, fdir); in iavf_virtchnl_completion()
2511 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2517 spin_lock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2518 list_for_each_entry(rss, &adapter->adv_rss_list_head, list) { in iavf_virtchnl_completion()
2520 iavf_print_adv_rss_cfg(adapter, rss, in iavf_virtchnl_completion()
2526 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2532 spin_lock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2534 &adapter->adv_rss_list_head, list) { in iavf_virtchnl_completion()
2540 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2546 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2547 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_virtchnl_completion()
2551 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2569 if (adapter->current_op && (v_opcode != adapter->current_op)) in iavf_virtchnl_completion()
2570 dev_warn(&adapter->pdev->dev, "Expected response %d from PF, received %d\n", in iavf_virtchnl_completion()
2571 adapter->current_op, v_opcode); in iavf_virtchnl_completion()
2574 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_virtchnl_completion()