Lines Matching refs:adapter

18 static int iavf_send_pf_msg(struct iavf_adapter *adapter,  in iavf_send_pf_msg()  argument
21 struct iavf_hw *hw = &adapter->hw; in iavf_send_pf_msg()
24 if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) in iavf_send_pf_msg()
29 dev_dbg(&adapter->pdev->dev, "Unable to send opcode %d to PF, status %s, aq_err %s\n", in iavf_send_pf_msg()
43 int iavf_send_api_ver(struct iavf_adapter *adapter) in iavf_send_api_ver() argument
50 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_VERSION, (u8 *)&vvi, in iavf_send_api_ver()
98 int iavf_verify_api_ver(struct iavf_adapter *adapter) in iavf_verify_api_ver() argument
108 err = iavf_poll_virtchnl_msg(&adapter->hw, &event, VIRTCHNL_OP_VERSION); in iavf_verify_api_ver()
112 adapter->pf_version = *pf_vvi; in iavf_verify_api_ver()
133 int iavf_send_vf_config_msg(struct iavf_adapter *adapter) in iavf_send_vf_config_msg() argument
156 adapter->current_op = VIRTCHNL_OP_GET_VF_RESOURCES; in iavf_send_vf_config_msg()
157 adapter->aq_required &= ~IAVF_FLAG_AQ_GET_CONFIG; in iavf_send_vf_config_msg()
158 if (PF_IS_V11(adapter)) in iavf_send_vf_config_msg()
159 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_VF_RESOURCES, in iavf_send_vf_config_msg()
162 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_VF_RESOURCES, in iavf_send_vf_config_msg()
166 int iavf_send_vf_offload_vlan_v2_msg(struct iavf_adapter *adapter) in iavf_send_vf_offload_vlan_v2_msg() argument
168 adapter->aq_required &= ~IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS; in iavf_send_vf_offload_vlan_v2_msg()
170 if (!VLAN_V2_ALLOWED(adapter)) in iavf_send_vf_offload_vlan_v2_msg()
173 adapter->current_op = VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS; in iavf_send_vf_offload_vlan_v2_msg()
175 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS, in iavf_send_vf_offload_vlan_v2_msg()
186 static void iavf_validate_num_queues(struct iavf_adapter *adapter) in iavf_validate_num_queues() argument
188 if (adapter->vf_res->num_queue_pairs > IAVF_MAX_REQ_QUEUES) { in iavf_validate_num_queues()
192 dev_info(&adapter->pdev->dev, "Received %d queues, but can only have a max of %d\n", in iavf_validate_num_queues()
193 adapter->vf_res->num_queue_pairs, in iavf_validate_num_queues()
195 dev_info(&adapter->pdev->dev, "Fixing by reducing queues to %d\n", in iavf_validate_num_queues()
197 adapter->vf_res->num_queue_pairs = IAVF_MAX_REQ_QUEUES; in iavf_validate_num_queues()
198 for (i = 0; i < adapter->vf_res->num_vsis; i++) { in iavf_validate_num_queues()
199 vsi_res = &adapter->vf_res->vsi_res[i]; in iavf_validate_num_queues()
214 int iavf_get_vf_config(struct iavf_adapter *adapter) in iavf_get_vf_config() argument
216 struct iavf_hw *hw = &adapter->hw; in iavf_get_vf_config()
228 memcpy(adapter->vf_res, event.msg_buf, min(event.msg_len, len)); in iavf_get_vf_config()
234 iavf_validate_num_queues(adapter); in iavf_get_vf_config()
235 iavf_vf_parse_hw_config(hw, adapter->vf_res); in iavf_get_vf_config()
242 int iavf_get_vf_vlan_v2_caps(struct iavf_adapter *adapter) in iavf_get_vf_vlan_v2_caps() argument
254 err = iavf_poll_virtchnl_msg(&adapter->hw, &event, in iavf_get_vf_vlan_v2_caps()
257 memcpy(&adapter->vlan_v2_caps, event.msg_buf, in iavf_get_vf_vlan_v2_caps()
271 void iavf_configure_queues(struct iavf_adapter *adapter) in iavf_configure_queues() argument
274 int pairs = adapter->num_active_queues; in iavf_configure_queues()
279 max_frame = LIBIE_MAX_RX_FRM_LEN(adapter->rx_rings->pp->p.offset); in iavf_configure_queues()
280 max_frame = min_not_zero(adapter->vf_res->max_mtu, max_frame); in iavf_configure_queues()
282 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_configure_queues()
284 dev_err(&adapter->pdev->dev, "Cannot configure queues, command %d pending\n", in iavf_configure_queues()
285 adapter->current_op); in iavf_configure_queues()
288 adapter->current_op = VIRTCHNL_OP_CONFIG_VSI_QUEUES; in iavf_configure_queues()
294 vqci->vsi_id = adapter->vsi_res->vsi_id; in iavf_configure_queues()
303 vqpi->txq.ring_len = adapter->tx_rings[i].count; in iavf_configure_queues()
304 vqpi->txq.dma_ring_addr = adapter->tx_rings[i].dma; in iavf_configure_queues()
307 vqpi->rxq.ring_len = adapter->rx_rings[i].count; in iavf_configure_queues()
308 vqpi->rxq.dma_ring_addr = adapter->rx_rings[i].dma; in iavf_configure_queues()
310 vqpi->rxq.databuffer_size = adapter->rx_rings[i].rx_buf_len; in iavf_configure_queues()
311 if (CRC_OFFLOAD_ALLOWED(adapter)) in iavf_configure_queues()
312 vqpi->rxq.crc_disable = !!(adapter->netdev->features & in iavf_configure_queues()
317 adapter->aq_required &= ~IAVF_FLAG_AQ_CONFIGURE_QUEUES; in iavf_configure_queues()
318 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_VSI_QUEUES, in iavf_configure_queues()
329 void iavf_enable_queues(struct iavf_adapter *adapter) in iavf_enable_queues() argument
333 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_enable_queues()
335 dev_err(&adapter->pdev->dev, "Cannot enable queues, command %d pending\n", in iavf_enable_queues()
336 adapter->current_op); in iavf_enable_queues()
339 adapter->current_op = VIRTCHNL_OP_ENABLE_QUEUES; in iavf_enable_queues()
340 vqs.vsi_id = adapter->vsi_res->vsi_id; in iavf_enable_queues()
341 vqs.tx_queues = BIT(adapter->num_active_queues) - 1; in iavf_enable_queues()
343 adapter->aq_required &= ~IAVF_FLAG_AQ_ENABLE_QUEUES; in iavf_enable_queues()
344 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_QUEUES, in iavf_enable_queues()
354 void iavf_disable_queues(struct iavf_adapter *adapter) in iavf_disable_queues() argument
358 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_disable_queues()
360 dev_err(&adapter->pdev->dev, "Cannot disable queues, command %d pending\n", in iavf_disable_queues()
361 adapter->current_op); in iavf_disable_queues()
364 adapter->current_op = VIRTCHNL_OP_DISABLE_QUEUES; in iavf_disable_queues()
365 vqs.vsi_id = adapter->vsi_res->vsi_id; in iavf_disable_queues()
366 vqs.tx_queues = BIT(adapter->num_active_queues) - 1; in iavf_disable_queues()
368 adapter->aq_required &= ~IAVF_FLAG_AQ_DISABLE_QUEUES; in iavf_disable_queues()
369 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_QUEUES, in iavf_disable_queues()
380 void iavf_map_queues(struct iavf_adapter *adapter) in iavf_map_queues() argument
388 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_map_queues()
390 dev_err(&adapter->pdev->dev, "Cannot map queues to vectors, command %d pending\n", in iavf_map_queues()
391 adapter->current_op); in iavf_map_queues()
394 adapter->current_op = VIRTCHNL_OP_CONFIG_IRQ_MAP; in iavf_map_queues()
396 q_vectors = adapter->num_msix_vectors - NONQ_VECS; in iavf_map_queues()
398 len = virtchnl_struct_size(vimi, vecmap, adapter->num_msix_vectors); in iavf_map_queues()
403 vimi->num_vectors = adapter->num_msix_vectors; in iavf_map_queues()
406 q_vector = &adapter->q_vectors[v_idx]; in iavf_map_queues()
409 vecmap->vsi_id = adapter->vsi_res->vsi_id; in iavf_map_queues()
418 vecmap->vsi_id = adapter->vsi_res->vsi_id; in iavf_map_queues()
423 adapter->aq_required &= ~IAVF_FLAG_AQ_MAP_VECTORS; in iavf_map_queues()
424 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_IRQ_MAP, in iavf_map_queues()
449 void iavf_add_ether_addrs(struct iavf_adapter *adapter) in iavf_add_ether_addrs() argument
457 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_ether_addrs()
459 dev_err(&adapter->pdev->dev, "Cannot add filters, command %d pending\n", in iavf_add_ether_addrs()
460 adapter->current_op); in iavf_add_ether_addrs()
464 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
466 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_add_ether_addrs()
471 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_MAC_FILTER; in iavf_add_ether_addrs()
472 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
475 adapter->current_op = VIRTCHNL_OP_ADD_ETH_ADDR; in iavf_add_ether_addrs()
479 dev_warn(&adapter->pdev->dev, "Too many add MAC changes in one request\n"); in iavf_add_ether_addrs()
487 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
491 veal->vsi_id = adapter->vsi_res->vsi_id; in iavf_add_ether_addrs()
493 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_add_ether_addrs()
504 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_MAC_FILTER; in iavf_add_ether_addrs()
506 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
508 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_ETH_ADDR, (u8 *)veal, len); in iavf_add_ether_addrs()
518 void iavf_del_ether_addrs(struct iavf_adapter *adapter) in iavf_del_ether_addrs() argument
526 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_ether_addrs()
528 dev_err(&adapter->pdev->dev, "Cannot remove filters, command %d pending\n", in iavf_del_ether_addrs()
529 adapter->current_op); in iavf_del_ether_addrs()
533 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
535 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_del_ether_addrs()
540 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_MAC_FILTER; in iavf_del_ether_addrs()
541 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
544 adapter->current_op = VIRTCHNL_OP_DEL_ETH_ADDR; in iavf_del_ether_addrs()
548 dev_warn(&adapter->pdev->dev, "Too many delete MAC changes in one request\n"); in iavf_del_ether_addrs()
555 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
559 veal->vsi_id = adapter->vsi_res->vsi_id; in iavf_del_ether_addrs()
561 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { in iavf_del_ether_addrs()
573 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_MAC_FILTER; in iavf_del_ether_addrs()
575 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
577 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_ETH_ADDR, (u8 *)veal, len); in iavf_del_ether_addrs()
587 static void iavf_mac_add_ok(struct iavf_adapter *adapter) in iavf_mac_add_ok() argument
591 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_mac_add_ok()
592 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { in iavf_mac_add_ok()
597 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_mac_add_ok()
606 static void iavf_mac_add_reject(struct iavf_adapter *adapter) in iavf_mac_add_reject() argument
608 struct net_device *netdev = adapter->netdev; in iavf_mac_add_reject()
611 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_mac_add_reject()
612 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { in iavf_mac_add_reject()
624 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_mac_add_reject()
633 static void iavf_vlan_add_reject(struct iavf_adapter *adapter) in iavf_vlan_add_reject() argument
637 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_vlan_add_reject()
638 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in iavf_vlan_add_reject()
642 adapter->num_vlan_filters--; in iavf_vlan_add_reject()
645 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_vlan_add_reject()
654 void iavf_add_vlans(struct iavf_adapter *adapter) in iavf_add_vlans() argument
660 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_vlans()
662 dev_err(&adapter->pdev->dev, "Cannot add VLANs, command %d pending\n", in iavf_add_vlans()
663 adapter->current_op); in iavf_add_vlans()
667 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
669 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_add_vlans()
673 if (!count || !VLAN_FILTERING_ALLOWED(adapter)) { in iavf_add_vlans()
674 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_VLAN_FILTER; in iavf_add_vlans()
675 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
679 if (VLAN_ALLOWED(adapter)) { in iavf_add_vlans()
682 adapter->current_op = VIRTCHNL_OP_ADD_VLAN; in iavf_add_vlans()
686 dev_warn(&adapter->pdev->dev, "Too many add VLAN changes in one request\n"); in iavf_add_vlans()
694 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
698 vvfl->vsi_id = adapter->vsi_res->vsi_id; in iavf_add_vlans()
700 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_add_vlans()
710 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_VLAN_FILTER; in iavf_add_vlans()
712 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
714 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len); in iavf_add_vlans()
717 u16 max_vlans = adapter->vlan_v2_caps.filtering.max_filters; in iavf_add_vlans()
718 u16 current_vlans = iavf_get_num_vlans_added(adapter); in iavf_add_vlans()
721 adapter->current_op = VIRTCHNL_OP_ADD_VLAN_V2; in iavf_add_vlans()
725 count = max_vlans - iavf_get_num_vlans_added(adapter); in iavf_add_vlans()
731 dev_warn(&adapter->pdev->dev, "Too many add VLAN changes in one request\n"); in iavf_add_vlans()
740 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
744 vvfl_v2->vport_id = adapter->vsi_res->vsi_id; in iavf_add_vlans()
746 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_add_vlans()
749 &adapter->vlan_v2_caps.filtering.filtering_support; in iavf_add_vlans()
770 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_VLAN_FILTER; in iavf_add_vlans()
772 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
774 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_VLAN_V2, in iavf_add_vlans()
786 void iavf_del_vlans(struct iavf_adapter *adapter) in iavf_del_vlans() argument
792 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_vlans()
794 dev_err(&adapter->pdev->dev, "Cannot remove VLANs, command %d pending\n", in iavf_del_vlans()
795 adapter->current_op); in iavf_del_vlans()
799 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
801 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in iavf_del_vlans()
809 !VLAN_FILTERING_ALLOWED(adapter)) { in iavf_del_vlans()
812 adapter->num_vlan_filters--; in iavf_del_vlans()
814 !VLAN_FILTERING_ALLOWED(adapter)) { in iavf_del_vlans()
821 if (!count || !VLAN_FILTERING_ALLOWED(adapter)) { in iavf_del_vlans()
822 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_VLAN_FILTER; in iavf_del_vlans()
823 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
827 if (VLAN_ALLOWED(adapter)) { in iavf_del_vlans()
830 adapter->current_op = VIRTCHNL_OP_DEL_VLAN; in iavf_del_vlans()
834 dev_warn(&adapter->pdev->dev, "Too many delete VLAN changes in one request\n"); in iavf_del_vlans()
842 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
846 vvfl->vsi_id = adapter->vsi_res->vsi_id; in iavf_del_vlans()
848 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in iavf_del_vlans()
859 adapter->num_vlan_filters--; in iavf_del_vlans()
867 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_VLAN_FILTER; in iavf_del_vlans()
869 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
871 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len); in iavf_del_vlans()
876 adapter->current_op = VIRTCHNL_OP_DEL_VLAN_V2; in iavf_del_vlans()
880 dev_warn(&adapter->pdev->dev, "Too many add VLAN changes in one request\n"); in iavf_del_vlans()
889 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
893 vvfl_v2->vport_id = adapter->vsi_res->vsi_id; in iavf_del_vlans()
895 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in iavf_del_vlans()
899 &adapter->vlan_v2_caps.filtering.filtering_support; in iavf_del_vlans()
916 adapter->num_vlan_filters--; in iavf_del_vlans()
925 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_VLAN_FILTER; in iavf_del_vlans()
927 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
929 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_VLAN_V2, in iavf_del_vlans()
941 void iavf_set_promiscuous(struct iavf_adapter *adapter) in iavf_set_promiscuous() argument
943 struct net_device *netdev = adapter->netdev; in iavf_set_promiscuous()
947 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_promiscuous()
949 dev_err(&adapter->pdev->dev, "Cannot set promiscuous mode, command %d pending\n", in iavf_set_promiscuous()
950 adapter->current_op); in iavf_set_promiscuous()
955 spin_lock_bh(&adapter->current_netdev_promisc_flags_lock); in iavf_set_promiscuous()
958 if (!iavf_promiscuous_mode_changed(adapter)) { in iavf_set_promiscuous()
959 adapter->aq_required &= ~IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODE; in iavf_set_promiscuous()
960 dev_dbg(&adapter->pdev->dev, "No change in promiscuous mode\n"); in iavf_set_promiscuous()
962 spin_unlock_bh(&adapter->current_netdev_promisc_flags_lock); in iavf_set_promiscuous()
973 adapter->current_netdev_promisc_flags |= IFF_ALLMULTI; in iavf_set_promiscuous()
974 adapter->current_netdev_promisc_flags &= ~IFF_PROMISC; in iavf_set_promiscuous()
975 dev_info(&adapter->pdev->dev, "Entering multicast promiscuous mode\n"); in iavf_set_promiscuous()
982 adapter->current_netdev_promisc_flags &= in iavf_set_promiscuous()
984 dev_info(&adapter->pdev->dev, "Leaving promiscuous mode\n"); in iavf_set_promiscuous()
991 adapter->current_netdev_promisc_flags |= IFF_PROMISC; in iavf_set_promiscuous()
993 adapter->current_netdev_promisc_flags |= IFF_ALLMULTI; in iavf_set_promiscuous()
995 adapter->current_netdev_promisc_flags &= ~IFF_ALLMULTI; in iavf_set_promiscuous()
997 dev_info(&adapter->pdev->dev, "Entering promiscuous mode\n"); in iavf_set_promiscuous()
1000 adapter->aq_required &= ~IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODE; in iavf_set_promiscuous()
1003 spin_unlock_bh(&adapter->current_netdev_promisc_flags_lock); in iavf_set_promiscuous()
1005 adapter->current_op = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE; in iavf_set_promiscuous()
1006 vpi.vsi_id = adapter->vsi_res->vsi_id; in iavf_set_promiscuous()
1008 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE, in iavf_set_promiscuous()
1018 void iavf_request_stats(struct iavf_adapter *adapter) in iavf_request_stats() argument
1022 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_request_stats()
1027 adapter->aq_required &= ~IAVF_FLAG_AQ_REQUEST_STATS; in iavf_request_stats()
1028 adapter->current_op = VIRTCHNL_OP_GET_STATS; in iavf_request_stats()
1029 vqs.vsi_id = adapter->vsi_res->vsi_id; in iavf_request_stats()
1031 if (iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_STATS, (u8 *)&vqs, in iavf_request_stats()
1034 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_request_stats()
1043 void iavf_get_hena(struct iavf_adapter *adapter) in iavf_get_hena() argument
1045 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_get_hena()
1047 dev_err(&adapter->pdev->dev, "Cannot get RSS hash capabilities, command %d pending\n", in iavf_get_hena()
1048 adapter->current_op); in iavf_get_hena()
1051 adapter->current_op = VIRTCHNL_OP_GET_RSS_HENA_CAPS; in iavf_get_hena()
1052 adapter->aq_required &= ~IAVF_FLAG_AQ_GET_HENA; in iavf_get_hena()
1053 iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_RSS_HENA_CAPS, NULL, 0); in iavf_get_hena()
1062 void iavf_set_hena(struct iavf_adapter *adapter) in iavf_set_hena() argument
1066 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_hena()
1068 dev_err(&adapter->pdev->dev, "Cannot set RSS hash enable, command %d pending\n", in iavf_set_hena()
1069 adapter->current_op); in iavf_set_hena()
1072 vrh.hena = adapter->hena; in iavf_set_hena()
1073 adapter->current_op = VIRTCHNL_OP_SET_RSS_HENA; in iavf_set_hena()
1074 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_HENA; in iavf_set_hena()
1075 iavf_send_pf_msg(adapter, VIRTCHNL_OP_SET_RSS_HENA, (u8 *)&vrh, in iavf_set_hena()
1085 void iavf_set_rss_key(struct iavf_adapter *adapter) in iavf_set_rss_key() argument
1090 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_rss_key()
1092 dev_err(&adapter->pdev->dev, "Cannot set RSS key, command %d pending\n", in iavf_set_rss_key()
1093 adapter->current_op); in iavf_set_rss_key()
1096 len = virtchnl_struct_size(vrk, key, adapter->rss_key_size); in iavf_set_rss_key()
1100 vrk->vsi_id = adapter->vsi.id; in iavf_set_rss_key()
1101 vrk->key_len = adapter->rss_key_size; in iavf_set_rss_key()
1102 memcpy(vrk->key, adapter->rss_key, adapter->rss_key_size); in iavf_set_rss_key()
1104 adapter->current_op = VIRTCHNL_OP_CONFIG_RSS_KEY; in iavf_set_rss_key()
1105 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_RSS_KEY; in iavf_set_rss_key()
1106 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_RSS_KEY, (u8 *)vrk, len); in iavf_set_rss_key()
1116 void iavf_set_rss_lut(struct iavf_adapter *adapter) in iavf_set_rss_lut() argument
1121 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_rss_lut()
1123 dev_err(&adapter->pdev->dev, "Cannot set RSS LUT, command %d pending\n", in iavf_set_rss_lut()
1124 adapter->current_op); in iavf_set_rss_lut()
1127 len = virtchnl_struct_size(vrl, lut, adapter->rss_lut_size); in iavf_set_rss_lut()
1131 vrl->vsi_id = adapter->vsi.id; in iavf_set_rss_lut()
1132 vrl->lut_entries = adapter->rss_lut_size; in iavf_set_rss_lut()
1133 memcpy(vrl->lut, adapter->rss_lut, adapter->rss_lut_size); in iavf_set_rss_lut()
1134 adapter->current_op = VIRTCHNL_OP_CONFIG_RSS_LUT; in iavf_set_rss_lut()
1135 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_RSS_LUT; in iavf_set_rss_lut()
1136 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_RSS_LUT, (u8 *)vrl, len); in iavf_set_rss_lut()
1146 void iavf_set_rss_hfunc(struct iavf_adapter *adapter) in iavf_set_rss_hfunc() argument
1151 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_rss_hfunc()
1153 dev_err(&adapter->pdev->dev, "Cannot set RSS Hash function, command %d pending\n", in iavf_set_rss_hfunc()
1154 adapter->current_op); in iavf_set_rss_hfunc()
1160 vrh->vsi_id = adapter->vsi.id; in iavf_set_rss_hfunc()
1161 vrh->rss_algorithm = adapter->hfunc; in iavf_set_rss_hfunc()
1162 adapter->current_op = VIRTCHNL_OP_CONFIG_RSS_HFUNC; in iavf_set_rss_hfunc()
1163 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_RSS_HFUNC; in iavf_set_rss_hfunc()
1164 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_RSS_HFUNC, (u8 *)vrh, len); in iavf_set_rss_hfunc()
1174 void iavf_enable_vlan_stripping(struct iavf_adapter *adapter) in iavf_enable_vlan_stripping() argument
1176 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_enable_vlan_stripping()
1178 dev_err(&adapter->pdev->dev, "Cannot enable stripping, command %d pending\n", in iavf_enable_vlan_stripping()
1179 adapter->current_op); in iavf_enable_vlan_stripping()
1182 adapter->current_op = VIRTCHNL_OP_ENABLE_VLAN_STRIPPING; in iavf_enable_vlan_stripping()
1183 adapter->aq_required &= ~IAVF_FLAG_AQ_ENABLE_VLAN_STRIPPING; in iavf_enable_vlan_stripping()
1184 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_VLAN_STRIPPING, NULL, 0); in iavf_enable_vlan_stripping()
1193 void iavf_disable_vlan_stripping(struct iavf_adapter *adapter) in iavf_disable_vlan_stripping() argument
1195 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_disable_vlan_stripping()
1197 dev_err(&adapter->pdev->dev, "Cannot disable stripping, command %d pending\n", in iavf_disable_vlan_stripping()
1198 adapter->current_op); in iavf_disable_vlan_stripping()
1201 adapter->current_op = VIRTCHNL_OP_DISABLE_VLAN_STRIPPING; in iavf_disable_vlan_stripping()
1202 adapter->aq_required &= ~IAVF_FLAG_AQ_DISABLE_VLAN_STRIPPING; in iavf_disable_vlan_stripping()
1203 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING, NULL, 0); in iavf_disable_vlan_stripping()
1230 iavf_set_vc_offload_ethertype(struct iavf_adapter *adapter, in iavf_set_vc_offload_ethertype() argument
1242 &adapter->vlan_v2_caps.offloads.stripping_support; in iavf_set_vc_offload_ethertype()
1247 &adapter->vlan_v2_caps.offloads.insertion_support; in iavf_set_vc_offload_ethertype()
1250 …dev_err(&adapter->pdev->dev, "Invalid opcode %d for setting virtchnl ethertype to enable/disable V… in iavf_set_vc_offload_ethertype()
1263 dev_dbg(&adapter->pdev->dev, "opcode %d unsupported for VLAN TPID 0x%04x\n", in iavf_set_vc_offload_ethertype()
1278 iavf_clear_offload_v2_aq_required(struct iavf_adapter *adapter, u16 tpid, in iavf_clear_offload_v2_aq_required() argument
1284 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1287 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1292 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1295 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1300 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1303 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1308 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1311 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1315 …dev_err(&adapter->pdev->dev, "Unsupported opcode %d specified for clearing aq_required bits for VI… in iavf_clear_offload_v2_aq_required()
1327 iavf_send_vlan_offload_v2(struct iavf_adapter *adapter, u16 tpid, in iavf_send_vlan_offload_v2() argument
1333 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_send_vlan_offload_v2()
1335 dev_err(&adapter->pdev->dev, "Cannot send %d, command %d pending\n", in iavf_send_vlan_offload_v2()
1336 offload_op, adapter->current_op); in iavf_send_vlan_offload_v2()
1340 adapter->current_op = offload_op; in iavf_send_vlan_offload_v2()
1346 msg->vport_id = adapter->vsi_res->vsi_id; in iavf_send_vlan_offload_v2()
1349 iavf_clear_offload_v2_aq_required(adapter, tpid, offload_op); in iavf_send_vlan_offload_v2()
1352 if (!iavf_set_vc_offload_ethertype(adapter, msg, tpid, offload_op)) in iavf_send_vlan_offload_v2()
1353 iavf_send_pf_msg(adapter, offload_op, (u8 *)msg, len); in iavf_send_vlan_offload_v2()
1355 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_send_vlan_offload_v2()
1365 void iavf_enable_vlan_stripping_v2(struct iavf_adapter *adapter, u16 tpid) in iavf_enable_vlan_stripping_v2() argument
1367 iavf_send_vlan_offload_v2(adapter, tpid, in iavf_enable_vlan_stripping_v2()
1376 void iavf_disable_vlan_stripping_v2(struct iavf_adapter *adapter, u16 tpid) in iavf_disable_vlan_stripping_v2() argument
1378 iavf_send_vlan_offload_v2(adapter, tpid, in iavf_disable_vlan_stripping_v2()
1387 void iavf_enable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid) in iavf_enable_vlan_insertion_v2() argument
1389 iavf_send_vlan_offload_v2(adapter, tpid, in iavf_enable_vlan_insertion_v2()
1398 void iavf_disable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid) in iavf_disable_vlan_insertion_v2() argument
1400 iavf_send_vlan_offload_v2(adapter, tpid, in iavf_disable_vlan_insertion_v2()
1410 static void iavf_print_link_message(struct iavf_adapter *adapter) in iavf_print_link_message() argument
1412 struct net_device *netdev = adapter->netdev; in iavf_print_link_message()
1416 if (!adapter->link_up) { in iavf_print_link_message()
1421 if (ADV_LINK_SUPPORT(adapter)) { in iavf_print_link_message()
1422 link_speed_mbps = adapter->link_speed_mbps; in iavf_print_link_message()
1426 switch (adapter->link_speed) { in iavf_print_link_message()
1483 iavf_get_vpe_link_status(struct iavf_adapter *adapter, in iavf_get_vpe_link_status() argument
1486 if (ADV_LINK_SUPPORT(adapter)) in iavf_get_vpe_link_status()
1500 iavf_set_adapter_link_speed_from_vpe(struct iavf_adapter *adapter, in iavf_set_adapter_link_speed_from_vpe() argument
1503 if (ADV_LINK_SUPPORT(adapter)) in iavf_set_adapter_link_speed_from_vpe()
1504 adapter->link_speed_mbps = in iavf_set_adapter_link_speed_from_vpe()
1507 adapter->link_speed = vpe->event_data.link_event.link_speed; in iavf_set_adapter_link_speed_from_vpe()
1517 void iavf_enable_channels(struct iavf_adapter *adapter) in iavf_enable_channels() argument
1523 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_enable_channels()
1525 dev_err(&adapter->pdev->dev, "Cannot configure mqprio, command %d pending\n", in iavf_enable_channels()
1526 adapter->current_op); in iavf_enable_channels()
1530 len = virtchnl_struct_size(vti, list, adapter->num_tc); in iavf_enable_channels()
1534 vti->num_tc = adapter->num_tc; in iavf_enable_channels()
1536 vti->list[i].count = adapter->ch_config.ch_info[i].count; in iavf_enable_channels()
1537 vti->list[i].offset = adapter->ch_config.ch_info[i].offset; in iavf_enable_channels()
1540 adapter->ch_config.ch_info[i].max_tx_rate; in iavf_enable_channels()
1543 adapter->ch_config.state = __IAVF_TC_RUNNING; in iavf_enable_channels()
1544 adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_enable_channels()
1545 adapter->current_op = VIRTCHNL_OP_ENABLE_CHANNELS; in iavf_enable_channels()
1546 adapter->aq_required &= ~IAVF_FLAG_AQ_ENABLE_CHANNELS; in iavf_enable_channels()
1547 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_CHANNELS, (u8 *)vti, len); in iavf_enable_channels()
1557 void iavf_disable_channels(struct iavf_adapter *adapter) in iavf_disable_channels() argument
1559 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_disable_channels()
1561 dev_err(&adapter->pdev->dev, "Cannot configure mqprio, command %d pending\n", in iavf_disable_channels()
1562 adapter->current_op); in iavf_disable_channels()
1566 adapter->ch_config.state = __IAVF_TC_INVALID; in iavf_disable_channels()
1567 adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_disable_channels()
1568 adapter->current_op = VIRTCHNL_OP_DISABLE_CHANNELS; in iavf_disable_channels()
1569 adapter->aq_required &= ~IAVF_FLAG_AQ_DISABLE_CHANNELS; in iavf_disable_channels()
1570 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_CHANNELS, NULL, 0); in iavf_disable_channels()
1580 static void iavf_print_cloud_filter(struct iavf_adapter *adapter, in iavf_print_cloud_filter() argument
1585 …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()
1595 …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()
1614 void iavf_add_cloud_filter(struct iavf_adapter *adapter) in iavf_add_cloud_filter() argument
1620 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_cloud_filter()
1622 dev_err(&adapter->pdev->dev, "Cannot add cloud filter, command %d pending\n", in iavf_add_cloud_filter()
1623 adapter->current_op); in iavf_add_cloud_filter()
1626 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_add_cloud_filter()
1633 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_CLOUD_FILTER; in iavf_add_cloud_filter()
1636 adapter->current_op = VIRTCHNL_OP_ADD_CLOUD_FILTER; in iavf_add_cloud_filter()
1643 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_add_cloud_filter()
1648 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_CLOUD_FILTER, in iavf_add_cloud_filter()
1662 void iavf_del_cloud_filter(struct iavf_adapter *adapter) in iavf_del_cloud_filter() argument
1668 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_cloud_filter()
1670 dev_err(&adapter->pdev->dev, "Cannot remove cloud filter, command %d pending\n", in iavf_del_cloud_filter()
1671 adapter->current_op); in iavf_del_cloud_filter()
1674 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_del_cloud_filter()
1681 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_CLOUD_FILTER; in iavf_del_cloud_filter()
1684 adapter->current_op = VIRTCHNL_OP_DEL_CLOUD_FILTER; in iavf_del_cloud_filter()
1691 list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, list) { in iavf_del_cloud_filter()
1696 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_CLOUD_FILTER, in iavf_del_cloud_filter()
1710 void iavf_add_fdir_filter(struct iavf_adapter *adapter) in iavf_add_fdir_filter() argument
1717 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_fdir_filter()
1719 dev_err(&adapter->pdev->dev, "Cannot add Flow Director filter, command %d pending\n", in iavf_add_fdir_filter()
1720 adapter->current_op); in iavf_add_fdir_filter()
1729 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_add_fdir_filter()
1730 list_for_each_entry(fdir, &adapter->fdir_list_head, list) { in iavf_add_fdir_filter()
1738 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_add_fdir_filter()
1744 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_FDIR_FILTER; in iavf_add_fdir_filter()
1748 adapter->current_op = VIRTCHNL_OP_ADD_FDIR_FILTER; in iavf_add_fdir_filter()
1749 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_FDIR_FILTER, (u8 *)f, len); in iavf_add_fdir_filter()
1760 void iavf_del_fdir_filter(struct iavf_adapter *adapter) in iavf_del_fdir_filter() argument
1767 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_fdir_filter()
1769 dev_err(&adapter->pdev->dev, "Cannot remove Flow Director filter, command %d pending\n", in iavf_del_fdir_filter()
1770 adapter->current_op); in iavf_del_fdir_filter()
1776 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_del_fdir_filter()
1777 list_for_each_entry(fdir, &adapter->fdir_list_head, list) { in iavf_del_fdir_filter()
1792 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_del_fdir_filter()
1795 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_FDIR_FILTER; in iavf_del_fdir_filter()
1799 adapter->current_op = VIRTCHNL_OP_DEL_FDIR_FILTER; in iavf_del_fdir_filter()
1800 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_FDIR_FILTER, (u8 *)&f, len); in iavf_del_fdir_filter()
1810 void iavf_add_adv_rss_cfg(struct iavf_adapter *adapter) in iavf_add_adv_rss_cfg() argument
1817 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_adv_rss_cfg()
1819 dev_err(&adapter->pdev->dev, "Cannot add RSS configuration, command %d pending\n", in iavf_add_adv_rss_cfg()
1820 adapter->current_op); in iavf_add_adv_rss_cfg()
1829 spin_lock_bh(&adapter->adv_rss_lock); in iavf_add_adv_rss_cfg()
1830 list_for_each_entry(rss, &adapter->adv_rss_list_head, list) { in iavf_add_adv_rss_cfg()
1835 iavf_print_adv_rss_cfg(adapter, rss, in iavf_add_adv_rss_cfg()
1841 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_add_adv_rss_cfg()
1844 adapter->current_op = VIRTCHNL_OP_ADD_RSS_CFG; in iavf_add_adv_rss_cfg()
1845 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_RSS_CFG, in iavf_add_adv_rss_cfg()
1848 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_ADV_RSS_CFG; in iavf_add_adv_rss_cfg()
1861 void iavf_del_adv_rss_cfg(struct iavf_adapter *adapter) in iavf_del_adv_rss_cfg() argument
1868 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_adv_rss_cfg()
1870 dev_err(&adapter->pdev->dev, "Cannot remove RSS configuration, command %d pending\n", in iavf_del_adv_rss_cfg()
1871 adapter->current_op); in iavf_del_adv_rss_cfg()
1880 spin_lock_bh(&adapter->adv_rss_lock); in iavf_del_adv_rss_cfg()
1881 list_for_each_entry(rss, &adapter->adv_rss_list_head, list) { in iavf_del_adv_rss_cfg()
1889 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_del_adv_rss_cfg()
1892 adapter->current_op = VIRTCHNL_OP_DEL_RSS_CFG; in iavf_del_adv_rss_cfg()
1893 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_RSS_CFG, in iavf_del_adv_rss_cfg()
1896 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_ADV_RSS_CFG; in iavf_del_adv_rss_cfg()
1908 int iavf_request_reset(struct iavf_adapter *adapter) in iavf_request_reset() argument
1912 err = iavf_send_pf_msg(adapter, VIRTCHNL_OP_RESET_VF, NULL, 0); in iavf_request_reset()
1913 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_request_reset()
1940 static void iavf_activate_fdir_filters(struct iavf_adapter *adapter) in iavf_activate_fdir_filters() argument
1945 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_activate_fdir_filters()
1946 list_for_each_entry_safe(f, ftmp, &adapter->fdir_list_head, list) { in iavf_activate_fdir_filters()
1965 iavf_dec_fdir_active_fltr(adapter, f); in iavf_activate_fdir_filters()
1969 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_activate_fdir_filters()
1972 adapter->aq_required |= IAVF_FLAG_AQ_ADD_FDIR_FILTER; in iavf_activate_fdir_filters()
1987 void iavf_virtchnl_completion(struct iavf_adapter *adapter, in iavf_virtchnl_completion() argument
1991 struct net_device *netdev = adapter->netdev; in iavf_virtchnl_completion()
1996 bool link_up = iavf_get_vpe_link_status(adapter, vpe); in iavf_virtchnl_completion()
2000 iavf_set_adapter_link_speed_from_vpe(adapter, vpe); in iavf_virtchnl_completion()
2003 if (adapter->link_up == link_up) in iavf_virtchnl_completion()
2014 if (adapter->state != __IAVF_RUNNING) in iavf_virtchnl_completion()
2021 if (adapter->flags & in iavf_virtchnl_completion()
2026 adapter->link_up = link_up; in iavf_virtchnl_completion()
2034 iavf_print_link_message(adapter); in iavf_virtchnl_completion()
2037 dev_info(&adapter->pdev->dev, "Reset indication received from the PF\n"); in iavf_virtchnl_completion()
2038 if (!(adapter->flags & IAVF_FLAG_RESET_PENDING)) { in iavf_virtchnl_completion()
2039 dev_info(&adapter->pdev->dev, "Scheduling reset task\n"); in iavf_virtchnl_completion()
2040 iavf_schedule_reset(adapter, IAVF_FLAG_RESET_PENDING); in iavf_virtchnl_completion()
2044 dev_err(&adapter->pdev->dev, "Unknown event %d from PF\n", in iavf_virtchnl_completion()
2053 dev_err(&adapter->pdev->dev, "Failed to add VLAN filter, error %s\n", in iavf_virtchnl_completion()
2054 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2057 dev_err(&adapter->pdev->dev, "Failed to add MAC filter, error %s\n", in iavf_virtchnl_completion()
2058 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2059 iavf_mac_add_reject(adapter); in iavf_virtchnl_completion()
2061 ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr); in iavf_virtchnl_completion()
2062 wake_up(&adapter->vc_waitqueue); in iavf_virtchnl_completion()
2065 dev_err(&adapter->pdev->dev, "Failed to delete VLAN filter, error %s\n", in iavf_virtchnl_completion()
2066 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2069 dev_err(&adapter->pdev->dev, "Failed to delete MAC 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 configure queue channels, error %s\n", in iavf_virtchnl_completion()
2074 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2075 adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_virtchnl_completion()
2076 adapter->ch_config.state = __IAVF_TC_INVALID; in iavf_virtchnl_completion()
2081 dev_err(&adapter->pdev->dev, "Failed to disable queue channels, error %s\n", in iavf_virtchnl_completion()
2082 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2083 adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_virtchnl_completion()
2084 adapter->ch_config.state = __IAVF_TC_RUNNING; in iavf_virtchnl_completion()
2091 &adapter->cloud_filter_list, in iavf_virtchnl_completion()
2095 dev_info(&adapter->pdev->dev, "Failed to add cloud filter, error %s\n", in iavf_virtchnl_completion()
2096 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2098 iavf_print_cloud_filter(adapter, in iavf_virtchnl_completion()
2102 adapter->num_cloud_filters--; in iavf_virtchnl_completion()
2110 list_for_each_entry(cf, &adapter->cloud_filter_list, in iavf_virtchnl_completion()
2114 dev_info(&adapter->pdev->dev, "Failed to del cloud filter, error %s\n", in iavf_virtchnl_completion()
2115 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2117 iavf_print_cloud_filter(adapter, in iavf_virtchnl_completion()
2126 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2128 &adapter->fdir_list_head, in iavf_virtchnl_completion()
2131 dev_info(&adapter->pdev->dev, "Failed to add Flow Director filter, error %s\n", in iavf_virtchnl_completion()
2132 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2134 iavf_print_fdir_fltr(adapter, fdir); in iavf_virtchnl_completion()
2136 dev_err(&adapter->pdev->dev, in iavf_virtchnl_completion()
2139 iavf_dec_fdir_active_fltr(adapter, fdir); in iavf_virtchnl_completion()
2143 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2149 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2150 list_for_each_entry(fdir, &adapter->fdir_list_head, in iavf_virtchnl_completion()
2155 dev_info(&adapter->pdev->dev, "Failed to del Flow Director filter, error %s\n", in iavf_virtchnl_completion()
2156 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2158 iavf_print_fdir_fltr(adapter, fdir); in iavf_virtchnl_completion()
2161 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2167 spin_lock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2169 &adapter->adv_rss_list_head, in iavf_virtchnl_completion()
2172 iavf_print_adv_rss_cfg(adapter, rss, in iavf_virtchnl_completion()
2179 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2185 spin_lock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2186 list_for_each_entry(rss, &adapter->adv_rss_list_head, in iavf_virtchnl_completion()
2190 dev_err(&adapter->pdev->dev, "Failed to delete RSS configuration, error %s\n", in iavf_virtchnl_completion()
2191 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2195 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2199 …dev_warn(&adapter->pdev->dev, "Changing VLAN Stripping is not allowed when Port VLAN is configured… in iavf_virtchnl_completion()
2206 …dev_warn(&adapter->pdev->dev, "Changing VLAN Stripping is not allowed when Port VLAN is configured… in iavf_virtchnl_completion()
2213 iavf_vlan_add_reject(adapter); in iavf_virtchnl_completion()
2214 dev_warn(&adapter->pdev->dev, "Failed to add VLAN filter, error %s\n", in iavf_virtchnl_completion()
2215 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2218 dev_warn(&adapter->pdev->dev, "Failed to configure hash function, error %s\n", in iavf_virtchnl_completion()
2219 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2221 if (adapter->hfunc == in iavf_virtchnl_completion()
2223 adapter->hfunc = in iavf_virtchnl_completion()
2226 adapter->hfunc = in iavf_virtchnl_completion()
2231 dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n", in iavf_virtchnl_completion()
2232 v_retval, iavf_stat_str(&adapter->hw, v_retval), in iavf_virtchnl_completion()
2239 iavf_mac_add_ok(adapter); in iavf_virtchnl_completion()
2240 if (!ether_addr_equal(netdev->dev_addr, adapter->hw.mac.addr)) in iavf_virtchnl_completion()
2242 adapter->hw.mac.addr)) { in iavf_virtchnl_completion()
2244 eth_hw_addr_set(netdev, adapter->hw.mac.addr); in iavf_virtchnl_completion()
2247 wake_up(&adapter->vc_waitqueue); in iavf_virtchnl_completion()
2263 adapter->current_stats = *stats; in iavf_virtchnl_completion()
2269 memcpy(adapter->vf_res, msg, min(msglen, len)); in iavf_virtchnl_completion()
2270 iavf_validate_num_queues(adapter); in iavf_virtchnl_completion()
2271 iavf_vf_parse_hw_config(&adapter->hw, adapter->vf_res); in iavf_virtchnl_completion()
2272 if (is_zero_ether_addr(adapter->hw.mac.addr)) { in iavf_virtchnl_completion()
2274 ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr); in iavf_virtchnl_completion()
2279 adapter->hw.mac.addr); in iavf_virtchnl_completion()
2282 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2283 iavf_add_filter(adapter, adapter->hw.mac.addr); in iavf_virtchnl_completion()
2285 if (VLAN_ALLOWED(adapter)) { in iavf_virtchnl_completion()
2286 if (!list_empty(&adapter->vlan_filter_list)) { in iavf_virtchnl_completion()
2291 &adapter->vlan_filter_list, in iavf_virtchnl_completion()
2295 adapter->aq_required |= in iavf_virtchnl_completion()
2300 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2302 iavf_activate_fdir_filters(adapter); in iavf_virtchnl_completion()
2304 iavf_parse_vf_resource_msg(adapter); in iavf_virtchnl_completion()
2310 if (VLAN_V2_ALLOWED(adapter)) in iavf_virtchnl_completion()
2323 memcpy(&adapter->vlan_v2_caps, msg, in iavf_virtchnl_completion()
2325 sizeof(adapter->vlan_v2_caps))); in iavf_virtchnl_completion()
2327 iavf_process_config(adapter); in iavf_virtchnl_completion()
2328 adapter->flags |= IAVF_FLAG_SETUP_NETDEV_FEATURES; in iavf_virtchnl_completion()
2329 iavf_schedule_finish_config(adapter); in iavf_virtchnl_completion()
2331 iavf_set_queue_vlan_tag_loc(adapter); in iavf_virtchnl_completion()
2334 adapter->hw.mac.addr); in iavf_virtchnl_completion()
2336 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2339 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_virtchnl_completion()
2343 adapter->hw.mac.addr); in iavf_virtchnl_completion()
2352 if (VLAN_FILTERING_ALLOWED(adapter)) { in iavf_virtchnl_completion()
2355 if (!list_empty(&adapter->vlan_filter_list)) { in iavf_virtchnl_completion()
2357 &adapter->vlan_filter_list, in iavf_virtchnl_completion()
2365 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2368 eth_hw_addr_set(netdev, adapter->hw.mac.addr); in iavf_virtchnl_completion()
2371 adapter->aq_required |= IAVF_FLAG_AQ_ADD_MAC_FILTER | in iavf_virtchnl_completion()
2377 iavf_irq_enable(adapter, true); in iavf_virtchnl_completion()
2378 wake_up(&adapter->reset_waitqueue); in iavf_virtchnl_completion()
2379 adapter->flags &= ~IAVF_FLAG_QUEUES_DISABLED; in iavf_virtchnl_completion()
2382 iavf_free_all_tx_resources(adapter); in iavf_virtchnl_completion()
2383 iavf_free_all_rx_resources(adapter); in iavf_virtchnl_completion()
2384 if (adapter->state == __IAVF_DOWN_PENDING) { in iavf_virtchnl_completion()
2385 iavf_change_state(adapter, __IAVF_DOWN); in iavf_virtchnl_completion()
2386 wake_up(&adapter->down_waitqueue); in iavf_virtchnl_completion()
2395 if (v_opcode != adapter->current_op) in iavf_virtchnl_completion()
2402 adapter->hena = vrh->hena; in iavf_virtchnl_completion()
2404 dev_warn(&adapter->pdev->dev, in iavf_virtchnl_completion()
2412 if (vfres->num_queue_pairs != adapter->num_req_queues) { in iavf_virtchnl_completion()
2413 dev_info(&adapter->pdev->dev, in iavf_virtchnl_completion()
2415 adapter->num_req_queues, in iavf_virtchnl_completion()
2417 adapter->num_req_queues = 0; in iavf_virtchnl_completion()
2418 adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_virtchnl_completion()
2425 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_virtchnl_completion()
2434 list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, in iavf_virtchnl_completion()
2440 adapter->num_cloud_filters--; in iavf_virtchnl_completion()
2449 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2451 &adapter->fdir_list_head, in iavf_virtchnl_completion()
2456 dev_info(&adapter->pdev->dev, "Flow Director filter with location %u is added\n", in iavf_virtchnl_completion()
2459 dev_info(&adapter->pdev->dev, "Flow Director filter (raw) for TC handle %x 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()
2468 iavf_dec_fdir_active_fltr(adapter, fdir); 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()
2488 dev_info(&adapter->pdev->dev, "Flow Director filter with location %u is deleted\n", in iavf_virtchnl_completion()
2491 dev_info(&adapter->pdev->dev, "Flow Director filter (raw) for TC handle %x is deleted\n", in iavf_virtchnl_completion()
2494 iavf_dec_fdir_active_fltr(adapter, fdir); in iavf_virtchnl_completion()
2498 dev_info(&adapter->pdev->dev, "Failed to delete Flow Director filter with status: %d\n", in iavf_virtchnl_completion()
2500 iavf_print_fdir_fltr(adapter, fdir); in iavf_virtchnl_completion()
2509 dev_info(&adapter->pdev->dev, "Failed to disable Flow Director filter with status: %d\n", in iavf_virtchnl_completion()
2511 iavf_print_fdir_fltr(adapter, fdir); in iavf_virtchnl_completion()
2515 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2521 spin_lock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2522 list_for_each_entry(rss, &adapter->adv_rss_list_head, list) { in iavf_virtchnl_completion()
2524 iavf_print_adv_rss_cfg(adapter, rss, in iavf_virtchnl_completion()
2530 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2536 spin_lock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2538 &adapter->adv_rss_list_head, list) { in iavf_virtchnl_completion()
2544 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2550 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2551 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_virtchnl_completion()
2555 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2573 if (adapter->current_op && (v_opcode != adapter->current_op)) in iavf_virtchnl_completion()
2574 dev_warn(&adapter->pdev->dev, "Expected response %d from PF, received %d\n", in iavf_virtchnl_completion()
2575 adapter->current_op, v_opcode); in iavf_virtchnl_completion()
2578 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_virtchnl_completion()