• Home
  • Raw
  • Download

Lines Matching refs:adapter

21 static int iavf_send_pf_msg(struct iavf_adapter *adapter,  in iavf_send_pf_msg()  argument
24 struct iavf_hw *hw = &adapter->hw; in iavf_send_pf_msg()
27 if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) in iavf_send_pf_msg()
32 dev_dbg(&adapter->pdev->dev, "Unable to send opcode %d to PF, err %s, aq_err %s\n", in iavf_send_pf_msg()
46 int iavf_send_api_ver(struct iavf_adapter *adapter) in iavf_send_api_ver() argument
53 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_VERSION, (u8 *)&vvi, in iavf_send_api_ver()
66 int iavf_verify_api_ver(struct iavf_adapter *adapter) in iavf_verify_api_ver() argument
69 struct iavf_hw *hw = &adapter->hw; in iavf_verify_api_ver()
100 dev_info(&adapter->pdev->dev, "Invalid reply type %d from PF\n", in iavf_verify_api_ver()
107 adapter->pf_version = *pf_vvi; in iavf_verify_api_ver()
128 int iavf_send_vf_config_msg(struct iavf_adapter *adapter) in iavf_send_vf_config_msg() argument
144 adapter->current_op = VIRTCHNL_OP_GET_VF_RESOURCES; in iavf_send_vf_config_msg()
145 adapter->aq_required &= ~IAVF_FLAG_AQ_GET_CONFIG; in iavf_send_vf_config_msg()
146 if (PF_IS_V11(adapter)) in iavf_send_vf_config_msg()
147 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_VF_RESOURCES, in iavf_send_vf_config_msg()
150 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_VF_RESOURCES, in iavf_send_vf_config_msg()
161 static void iavf_validate_num_queues(struct iavf_adapter *adapter) in iavf_validate_num_queues() argument
163 if (adapter->vf_res->num_queue_pairs > IAVF_MAX_REQ_QUEUES) { in iavf_validate_num_queues()
167 dev_info(&adapter->pdev->dev, "Received %d queues, but can only have a max of %d\n", in iavf_validate_num_queues()
168 adapter->vf_res->num_queue_pairs, in iavf_validate_num_queues()
170 dev_info(&adapter->pdev->dev, "Fixing by reducing queues to %d\n", in iavf_validate_num_queues()
172 adapter->vf_res->num_queue_pairs = IAVF_MAX_REQ_QUEUES; in iavf_validate_num_queues()
173 for (i = 0; i < adapter->vf_res->num_vsis; i++) { in iavf_validate_num_queues()
174 vsi_res = &adapter->vf_res->vsi_res[i]; in iavf_validate_num_queues()
189 int iavf_get_vf_config(struct iavf_adapter *adapter) in iavf_get_vf_config() argument
191 struct iavf_hw *hw = &adapter->hw; in iavf_get_vf_config()
220 memcpy(adapter->vf_res, event.msg_buf, min(event.msg_len, len)); in iavf_get_vf_config()
226 iavf_validate_num_queues(adapter); in iavf_get_vf_config()
227 iavf_vf_parse_hw_config(hw, adapter->vf_res); in iavf_get_vf_config()
240 void iavf_configure_queues(struct iavf_adapter *adapter) in iavf_configure_queues() argument
244 int pairs = adapter->num_active_queues; in iavf_configure_queues()
248 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_configure_queues()
250 dev_err(&adapter->pdev->dev, "Cannot configure queues, command %d pending\n", in iavf_configure_queues()
251 adapter->current_op); in iavf_configure_queues()
254 adapter->current_op = VIRTCHNL_OP_CONFIG_VSI_QUEUES; in iavf_configure_queues()
261 if (!(adapter->flags & IAVF_FLAG_LEGACY_RX) && in iavf_configure_queues()
262 (adapter->netdev->mtu <= ETH_DATA_LEN)) in iavf_configure_queues()
265 vqci->vsi_id = adapter->vsi_res->vsi_id; in iavf_configure_queues()
274 vqpi->txq.ring_len = adapter->tx_rings[i].count; in iavf_configure_queues()
275 vqpi->txq.dma_ring_addr = adapter->tx_rings[i].dma; in iavf_configure_queues()
278 vqpi->rxq.ring_len = adapter->rx_rings[i].count; in iavf_configure_queues()
279 vqpi->rxq.dma_ring_addr = adapter->rx_rings[i].dma; in iavf_configure_queues()
282 ALIGN(adapter->rx_rings[i].rx_buf_len, in iavf_configure_queues()
287 adapter->aq_required &= ~IAVF_FLAG_AQ_CONFIGURE_QUEUES; in iavf_configure_queues()
288 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_VSI_QUEUES, in iavf_configure_queues()
299 void iavf_enable_queues(struct iavf_adapter *adapter) in iavf_enable_queues() argument
303 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_enable_queues()
305 dev_err(&adapter->pdev->dev, "Cannot enable queues, command %d pending\n", in iavf_enable_queues()
306 adapter->current_op); in iavf_enable_queues()
309 adapter->current_op = VIRTCHNL_OP_ENABLE_QUEUES; in iavf_enable_queues()
310 vqs.vsi_id = adapter->vsi_res->vsi_id; in iavf_enable_queues()
311 vqs.tx_queues = BIT(adapter->num_active_queues) - 1; in iavf_enable_queues()
313 adapter->aq_required &= ~IAVF_FLAG_AQ_ENABLE_QUEUES; in iavf_enable_queues()
314 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_QUEUES, in iavf_enable_queues()
324 void iavf_disable_queues(struct iavf_adapter *adapter) in iavf_disable_queues() argument
328 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_disable_queues()
330 dev_err(&adapter->pdev->dev, "Cannot disable queues, command %d pending\n", in iavf_disable_queues()
331 adapter->current_op); in iavf_disable_queues()
334 adapter->current_op = VIRTCHNL_OP_DISABLE_QUEUES; in iavf_disable_queues()
335 vqs.vsi_id = adapter->vsi_res->vsi_id; in iavf_disable_queues()
336 vqs.tx_queues = BIT(adapter->num_active_queues) - 1; in iavf_disable_queues()
338 adapter->aq_required &= ~IAVF_FLAG_AQ_DISABLE_QUEUES; in iavf_disable_queues()
339 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_QUEUES, in iavf_disable_queues()
350 void iavf_map_queues(struct iavf_adapter *adapter) in iavf_map_queues() argument
358 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_map_queues()
360 dev_err(&adapter->pdev->dev, "Cannot map queues to vectors, command %d pending\n", in iavf_map_queues()
361 adapter->current_op); in iavf_map_queues()
364 adapter->current_op = VIRTCHNL_OP_CONFIG_IRQ_MAP; in iavf_map_queues()
366 q_vectors = adapter->num_msix_vectors - NONQ_VECS; in iavf_map_queues()
368 len = struct_size(vimi, vecmap, adapter->num_msix_vectors); in iavf_map_queues()
373 vimi->num_vectors = adapter->num_msix_vectors; in iavf_map_queues()
376 q_vector = &adapter->q_vectors[v_idx]; in iavf_map_queues()
379 vecmap->vsi_id = adapter->vsi_res->vsi_id; in iavf_map_queues()
388 vecmap->vsi_id = adapter->vsi_res->vsi_id; in iavf_map_queues()
393 adapter->aq_required &= ~IAVF_FLAG_AQ_MAP_VECTORS; in iavf_map_queues()
394 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_IRQ_MAP, in iavf_map_queues()
407 int iavf_request_queues(struct iavf_adapter *adapter, int num) in iavf_request_queues() argument
411 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_request_queues()
413 dev_err(&adapter->pdev->dev, "Cannot request queues, command %d pending\n", in iavf_request_queues()
414 adapter->current_op); in iavf_request_queues()
420 adapter->current_op = VIRTCHNL_OP_REQUEST_QUEUES; in iavf_request_queues()
421 adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_request_queues()
422 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_REQUEST_QUEUES, in iavf_request_queues()
432 void iavf_add_ether_addrs(struct iavf_adapter *adapter) in iavf_add_ether_addrs() argument
440 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_ether_addrs()
442 dev_err(&adapter->pdev->dev, "Cannot add filters, command %d pending\n", in iavf_add_ether_addrs()
443 adapter->current_op); in iavf_add_ether_addrs()
447 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
449 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_add_ether_addrs()
454 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_MAC_FILTER; in iavf_add_ether_addrs()
455 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
458 adapter->current_op = VIRTCHNL_OP_ADD_ETH_ADDR; in iavf_add_ether_addrs()
462 dev_warn(&adapter->pdev->dev, "Too many add MAC changes in one request\n"); in iavf_add_ether_addrs()
472 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
476 veal->vsi_id = adapter->vsi_res->vsi_id; in iavf_add_ether_addrs()
478 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_add_ether_addrs()
488 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_MAC_FILTER; in iavf_add_ether_addrs()
490 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
492 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_ETH_ADDR, (u8 *)veal, len); in iavf_add_ether_addrs()
502 void iavf_del_ether_addrs(struct iavf_adapter *adapter) in iavf_del_ether_addrs() argument
510 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_ether_addrs()
512 dev_err(&adapter->pdev->dev, "Cannot remove filters, command %d pending\n", in iavf_del_ether_addrs()
513 adapter->current_op); in iavf_del_ether_addrs()
517 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
519 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_del_ether_addrs()
524 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_MAC_FILTER; in iavf_del_ether_addrs()
525 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
528 adapter->current_op = VIRTCHNL_OP_DEL_ETH_ADDR; in iavf_del_ether_addrs()
532 dev_warn(&adapter->pdev->dev, "Too many delete MAC changes in one request\n"); in iavf_del_ether_addrs()
541 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
545 veal->vsi_id = adapter->vsi_res->vsi_id; in iavf_del_ether_addrs()
547 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { in iavf_del_ether_addrs()
558 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_MAC_FILTER; in iavf_del_ether_addrs()
560 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
562 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_ETH_ADDR, (u8 *)veal, len); in iavf_del_ether_addrs()
572 void iavf_add_vlans(struct iavf_adapter *adapter) in iavf_add_vlans() argument
579 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_vlans()
581 dev_err(&adapter->pdev->dev, "Cannot add VLANs, command %d pending\n", in iavf_add_vlans()
582 adapter->current_op); in iavf_add_vlans()
586 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
588 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_add_vlans()
593 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_VLAN_FILTER; in iavf_add_vlans()
594 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
597 adapter->current_op = VIRTCHNL_OP_ADD_VLAN; in iavf_add_vlans()
602 dev_warn(&adapter->pdev->dev, "Too many add VLAN changes in one request\n"); in iavf_add_vlans()
612 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
616 vvfl->vsi_id = adapter->vsi_res->vsi_id; in iavf_add_vlans()
618 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_add_vlans()
628 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_VLAN_FILTER; in iavf_add_vlans()
630 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
632 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len); in iavf_add_vlans()
642 void iavf_del_vlans(struct iavf_adapter *adapter) in iavf_del_vlans() argument
649 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_vlans()
651 dev_err(&adapter->pdev->dev, "Cannot remove VLANs, command %d pending\n", in iavf_del_vlans()
652 adapter->current_op); in iavf_del_vlans()
656 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
658 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_del_vlans()
663 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_VLAN_FILTER; in iavf_del_vlans()
664 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
667 adapter->current_op = VIRTCHNL_OP_DEL_VLAN; in iavf_del_vlans()
672 dev_warn(&adapter->pdev->dev, "Too many delete VLAN changes in one request\n"); in iavf_del_vlans()
682 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
686 vvfl->vsi_id = adapter->vsi_res->vsi_id; in iavf_del_vlans()
688 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in iavf_del_vlans()
699 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_VLAN_FILTER; in iavf_del_vlans()
701 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
703 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len); in iavf_del_vlans()
714 void iavf_set_promiscuous(struct iavf_adapter *adapter, int flags) in iavf_set_promiscuous() argument
719 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_promiscuous()
721 dev_err(&adapter->pdev->dev, "Cannot set promiscuous mode, command %d pending\n", in iavf_set_promiscuous()
722 adapter->current_op); in iavf_set_promiscuous()
729 adapter->flags |= IAVF_FLAG_PROMISC_ON; in iavf_set_promiscuous()
730 adapter->aq_required &= ~IAVF_FLAG_AQ_REQUEST_PROMISC; in iavf_set_promiscuous()
731 dev_info(&adapter->pdev->dev, "Entering promiscuous mode\n"); in iavf_set_promiscuous()
735 adapter->flags |= IAVF_FLAG_ALLMULTI_ON; in iavf_set_promiscuous()
736 adapter->aq_required &= ~IAVF_FLAG_AQ_REQUEST_ALLMULTI; in iavf_set_promiscuous()
737 dev_info(&adapter->pdev->dev, "Entering multicast promiscuous mode\n"); in iavf_set_promiscuous()
741 adapter->flags &= ~(IAVF_FLAG_PROMISC_ON | in iavf_set_promiscuous()
743 adapter->aq_required &= ~(IAVF_FLAG_AQ_RELEASE_PROMISC | in iavf_set_promiscuous()
745 dev_info(&adapter->pdev->dev, "Leaving promiscuous mode\n"); in iavf_set_promiscuous()
748 adapter->current_op = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE; in iavf_set_promiscuous()
749 vpi.vsi_id = adapter->vsi_res->vsi_id; in iavf_set_promiscuous()
751 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE, in iavf_set_promiscuous()
761 void iavf_request_stats(struct iavf_adapter *adapter) in iavf_request_stats() argument
765 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_request_stats()
769 adapter->current_op = VIRTCHNL_OP_GET_STATS; in iavf_request_stats()
770 vqs.vsi_id = adapter->vsi_res->vsi_id; in iavf_request_stats()
772 if (iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_STATS, (u8 *)&vqs, in iavf_request_stats()
775 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_request_stats()
784 void iavf_get_hena(struct iavf_adapter *adapter) in iavf_get_hena() argument
786 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_get_hena()
788 dev_err(&adapter->pdev->dev, "Cannot get RSS hash capabilities, command %d pending\n", in iavf_get_hena()
789 adapter->current_op); in iavf_get_hena()
792 adapter->current_op = VIRTCHNL_OP_GET_RSS_HENA_CAPS; in iavf_get_hena()
793 adapter->aq_required &= ~IAVF_FLAG_AQ_GET_HENA; in iavf_get_hena()
794 iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_RSS_HENA_CAPS, NULL, 0); in iavf_get_hena()
803 void iavf_set_hena(struct iavf_adapter *adapter) in iavf_set_hena() argument
807 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_hena()
809 dev_err(&adapter->pdev->dev, "Cannot set RSS hash enable, command %d pending\n", in iavf_set_hena()
810 adapter->current_op); in iavf_set_hena()
813 vrh.hena = adapter->hena; in iavf_set_hena()
814 adapter->current_op = VIRTCHNL_OP_SET_RSS_HENA; in iavf_set_hena()
815 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_HENA; in iavf_set_hena()
816 iavf_send_pf_msg(adapter, VIRTCHNL_OP_SET_RSS_HENA, (u8 *)&vrh, in iavf_set_hena()
826 void iavf_set_rss_key(struct iavf_adapter *adapter) in iavf_set_rss_key() argument
831 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_rss_key()
833 dev_err(&adapter->pdev->dev, "Cannot set RSS key, command %d pending\n", in iavf_set_rss_key()
834 adapter->current_op); in iavf_set_rss_key()
838 (adapter->rss_key_size * sizeof(u8)) - 1; in iavf_set_rss_key()
842 vrk->vsi_id = adapter->vsi.id; in iavf_set_rss_key()
843 vrk->key_len = adapter->rss_key_size; in iavf_set_rss_key()
844 memcpy(vrk->key, adapter->rss_key, adapter->rss_key_size); in iavf_set_rss_key()
846 adapter->current_op = VIRTCHNL_OP_CONFIG_RSS_KEY; in iavf_set_rss_key()
847 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_RSS_KEY; in iavf_set_rss_key()
848 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_RSS_KEY, (u8 *)vrk, len); in iavf_set_rss_key()
858 void iavf_set_rss_lut(struct iavf_adapter *adapter) in iavf_set_rss_lut() argument
863 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_rss_lut()
865 dev_err(&adapter->pdev->dev, "Cannot set RSS LUT, command %d pending\n", in iavf_set_rss_lut()
866 adapter->current_op); in iavf_set_rss_lut()
870 (adapter->rss_lut_size * sizeof(u8)) - 1; in iavf_set_rss_lut()
874 vrl->vsi_id = adapter->vsi.id; in iavf_set_rss_lut()
875 vrl->lut_entries = adapter->rss_lut_size; in iavf_set_rss_lut()
876 memcpy(vrl->lut, adapter->rss_lut, adapter->rss_lut_size); in iavf_set_rss_lut()
877 adapter->current_op = VIRTCHNL_OP_CONFIG_RSS_LUT; in iavf_set_rss_lut()
878 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_RSS_LUT; in iavf_set_rss_lut()
879 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_RSS_LUT, (u8 *)vrl, len); in iavf_set_rss_lut()
889 void iavf_enable_vlan_stripping(struct iavf_adapter *adapter) in iavf_enable_vlan_stripping() argument
891 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_enable_vlan_stripping()
893 dev_err(&adapter->pdev->dev, "Cannot enable stripping, command %d pending\n", in iavf_enable_vlan_stripping()
894 adapter->current_op); in iavf_enable_vlan_stripping()
897 adapter->current_op = VIRTCHNL_OP_ENABLE_VLAN_STRIPPING; in iavf_enable_vlan_stripping()
898 adapter->aq_required &= ~IAVF_FLAG_AQ_ENABLE_VLAN_STRIPPING; in iavf_enable_vlan_stripping()
899 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_VLAN_STRIPPING, NULL, 0); in iavf_enable_vlan_stripping()
908 void iavf_disable_vlan_stripping(struct iavf_adapter *adapter) in iavf_disable_vlan_stripping() argument
910 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_disable_vlan_stripping()
912 dev_err(&adapter->pdev->dev, "Cannot disable stripping, command %d pending\n", in iavf_disable_vlan_stripping()
913 adapter->current_op); in iavf_disable_vlan_stripping()
916 adapter->current_op = VIRTCHNL_OP_DISABLE_VLAN_STRIPPING; in iavf_disable_vlan_stripping()
917 adapter->aq_required &= ~IAVF_FLAG_AQ_DISABLE_VLAN_STRIPPING; in iavf_disable_vlan_stripping()
918 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING, NULL, 0); in iavf_disable_vlan_stripping()
927 static void iavf_print_link_message(struct iavf_adapter *adapter) in iavf_print_link_message() argument
929 struct net_device *netdev = adapter->netdev; in iavf_print_link_message()
932 if (!adapter->link_up) { in iavf_print_link_message()
937 switch (adapter->link_speed) { in iavf_print_link_message()
970 void iavf_enable_channels(struct iavf_adapter *adapter) in iavf_enable_channels() argument
976 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_enable_channels()
978 dev_err(&adapter->pdev->dev, "Cannot configure mqprio, command %d pending\n", in iavf_enable_channels()
979 adapter->current_op); in iavf_enable_channels()
983 len = struct_size(vti, list, adapter->num_tc - 1); in iavf_enable_channels()
987 vti->num_tc = adapter->num_tc; in iavf_enable_channels()
989 vti->list[i].count = adapter->ch_config.ch_info[i].count; in iavf_enable_channels()
990 vti->list[i].offset = adapter->ch_config.ch_info[i].offset; in iavf_enable_channels()
993 adapter->ch_config.ch_info[i].max_tx_rate; in iavf_enable_channels()
996 adapter->ch_config.state = __IAVF_TC_RUNNING; in iavf_enable_channels()
997 adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_enable_channels()
998 adapter->current_op = VIRTCHNL_OP_ENABLE_CHANNELS; in iavf_enable_channels()
999 adapter->aq_required &= ~IAVF_FLAG_AQ_ENABLE_CHANNELS; in iavf_enable_channels()
1000 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_CHANNELS, (u8 *)vti, len); in iavf_enable_channels()
1010 void iavf_disable_channels(struct iavf_adapter *adapter) in iavf_disable_channels() argument
1012 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_disable_channels()
1014 dev_err(&adapter->pdev->dev, "Cannot configure mqprio, command %d pending\n", in iavf_disable_channels()
1015 adapter->current_op); in iavf_disable_channels()
1019 adapter->ch_config.state = __IAVF_TC_INVALID; in iavf_disable_channels()
1020 adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_disable_channels()
1021 adapter->current_op = VIRTCHNL_OP_DISABLE_CHANNELS; in iavf_disable_channels()
1022 adapter->aq_required &= ~IAVF_FLAG_AQ_DISABLE_CHANNELS; in iavf_disable_channels()
1023 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_CHANNELS, NULL, 0); in iavf_disable_channels()
1033 static void iavf_print_cloud_filter(struct iavf_adapter *adapter, in iavf_print_cloud_filter() argument
1038 …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()
1048 …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()
1067 void iavf_add_cloud_filter(struct iavf_adapter *adapter) in iavf_add_cloud_filter() argument
1073 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_cloud_filter()
1075 dev_err(&adapter->pdev->dev, "Cannot add cloud filter, command %d pending\n", in iavf_add_cloud_filter()
1076 adapter->current_op); in iavf_add_cloud_filter()
1079 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_add_cloud_filter()
1086 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_CLOUD_FILTER; in iavf_add_cloud_filter()
1089 adapter->current_op = VIRTCHNL_OP_ADD_CLOUD_FILTER; in iavf_add_cloud_filter()
1096 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_add_cloud_filter()
1101 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_CLOUD_FILTER, in iavf_add_cloud_filter()
1115 void iavf_del_cloud_filter(struct iavf_adapter *adapter) in iavf_del_cloud_filter() argument
1121 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_cloud_filter()
1123 dev_err(&adapter->pdev->dev, "Cannot remove cloud filter, command %d pending\n", in iavf_del_cloud_filter()
1124 adapter->current_op); in iavf_del_cloud_filter()
1127 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_del_cloud_filter()
1134 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_CLOUD_FILTER; in iavf_del_cloud_filter()
1137 adapter->current_op = VIRTCHNL_OP_DEL_CLOUD_FILTER; in iavf_del_cloud_filter()
1144 list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, list) { in iavf_del_cloud_filter()
1149 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_CLOUD_FILTER, in iavf_del_cloud_filter()
1162 void iavf_request_reset(struct iavf_adapter *adapter) in iavf_request_reset() argument
1165 iavf_send_pf_msg(adapter, VIRTCHNL_OP_RESET_VF, NULL, 0); in iavf_request_reset()
1166 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_request_reset()
1181 void iavf_virtchnl_completion(struct iavf_adapter *adapter, in iavf_virtchnl_completion() argument
1185 struct net_device *netdev = adapter->netdev; in iavf_virtchnl_completion()
1194 adapter->link_speed = in iavf_virtchnl_completion()
1198 if (adapter->link_up == link_up) in iavf_virtchnl_completion()
1209 if (adapter->state != __IAVF_RUNNING) in iavf_virtchnl_completion()
1216 if (adapter->flags & in iavf_virtchnl_completion()
1221 adapter->link_up = link_up; in iavf_virtchnl_completion()
1229 iavf_print_link_message(adapter); in iavf_virtchnl_completion()
1232 dev_info(&adapter->pdev->dev, "Reset warning received from the PF\n"); in iavf_virtchnl_completion()
1233 if (!(adapter->flags & IAVF_FLAG_RESET_PENDING)) { in iavf_virtchnl_completion()
1234 adapter->flags |= IAVF_FLAG_RESET_PENDING; in iavf_virtchnl_completion()
1235 dev_info(&adapter->pdev->dev, "Scheduling reset task\n"); in iavf_virtchnl_completion()
1236 queue_work(iavf_wq, &adapter->reset_task); in iavf_virtchnl_completion()
1240 dev_err(&adapter->pdev->dev, "Unknown event %d from PF\n", in iavf_virtchnl_completion()
1249 dev_err(&adapter->pdev->dev, "Failed to add VLAN filter, error %s\n", in iavf_virtchnl_completion()
1250 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
1253 dev_err(&adapter->pdev->dev, "Failed to add MAC filter, error %s\n", in iavf_virtchnl_completion()
1254 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
1256 ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr); in iavf_virtchnl_completion()
1259 dev_err(&adapter->pdev->dev, "Failed to delete VLAN filter, error %s\n", in iavf_virtchnl_completion()
1260 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
1263 dev_err(&adapter->pdev->dev, "Failed to delete MAC filter, error %s\n", in iavf_virtchnl_completion()
1264 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
1267 dev_err(&adapter->pdev->dev, "Failed to configure queue channels, error %s\n", in iavf_virtchnl_completion()
1268 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
1269 adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_virtchnl_completion()
1270 adapter->ch_config.state = __IAVF_TC_INVALID; in iavf_virtchnl_completion()
1275 dev_err(&adapter->pdev->dev, "Failed to disable queue channels, error %s\n", in iavf_virtchnl_completion()
1276 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
1277 adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_virtchnl_completion()
1278 adapter->ch_config.state = __IAVF_TC_RUNNING; in iavf_virtchnl_completion()
1285 &adapter->cloud_filter_list, in iavf_virtchnl_completion()
1289 dev_info(&adapter->pdev->dev, "Failed to add cloud filter, error %s\n", in iavf_virtchnl_completion()
1290 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
1292 iavf_print_cloud_filter(adapter, in iavf_virtchnl_completion()
1296 adapter->num_cloud_filters--; in iavf_virtchnl_completion()
1304 list_for_each_entry(cf, &adapter->cloud_filter_list, in iavf_virtchnl_completion()
1308 dev_info(&adapter->pdev->dev, "Failed to del cloud filter, error %s\n", in iavf_virtchnl_completion()
1309 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
1311 iavf_print_cloud_filter(adapter, in iavf_virtchnl_completion()
1318 dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n", in iavf_virtchnl_completion()
1319 v_retval, iavf_stat_str(&adapter->hw, v_retval), in iavf_virtchnl_completion()
1325 if (!ether_addr_equal(netdev->dev_addr, adapter->hw.mac.addr)) in iavf_virtchnl_completion()
1326 ether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr); in iavf_virtchnl_completion()
1343 adapter->current_stats = *stats; in iavf_virtchnl_completion()
1350 memcpy(adapter->vf_res, msg, min(msglen, len)); in iavf_virtchnl_completion()
1351 iavf_validate_num_queues(adapter); in iavf_virtchnl_completion()
1352 iavf_vf_parse_hw_config(&adapter->hw, adapter->vf_res); in iavf_virtchnl_completion()
1353 if (is_zero_ether_addr(adapter->hw.mac.addr)) { in iavf_virtchnl_completion()
1355 ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr); in iavf_virtchnl_completion()
1358 ether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr); in iavf_virtchnl_completion()
1360 adapter->hw.mac.addr); in iavf_virtchnl_completion()
1362 iavf_process_config(adapter); in iavf_virtchnl_completion()
1367 iavf_irq_enable(adapter, true); in iavf_virtchnl_completion()
1368 adapter->flags &= ~IAVF_FLAG_QUEUES_DISABLED; in iavf_virtchnl_completion()
1371 iavf_free_all_tx_resources(adapter); in iavf_virtchnl_completion()
1372 iavf_free_all_rx_resources(adapter); in iavf_virtchnl_completion()
1373 if (adapter->state == __IAVF_DOWN_PENDING) { in iavf_virtchnl_completion()
1374 adapter->state = __IAVF_DOWN; in iavf_virtchnl_completion()
1375 wake_up(&adapter->down_waitqueue); in iavf_virtchnl_completion()
1384 if (v_opcode != adapter->current_op) in iavf_virtchnl_completion()
1392 if (msglen && CLIENT_ENABLED(adapter)) in iavf_virtchnl_completion()
1393 iavf_notify_client_message(&adapter->vsi, msg, msglen); in iavf_virtchnl_completion()
1397 adapter->client_pending &= in iavf_virtchnl_completion()
1404 adapter->hena = vrh->hena; in iavf_virtchnl_completion()
1406 dev_warn(&adapter->pdev->dev, in iavf_virtchnl_completion()
1414 if (vfres->num_queue_pairs != adapter->num_req_queues) { in iavf_virtchnl_completion()
1415 dev_info(&adapter->pdev->dev, in iavf_virtchnl_completion()
1417 adapter->num_req_queues, in iavf_virtchnl_completion()
1419 adapter->num_req_queues = 0; in iavf_virtchnl_completion()
1420 adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_virtchnl_completion()
1427 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_virtchnl_completion()
1436 list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, in iavf_virtchnl_completion()
1442 adapter->num_cloud_filters--; in iavf_virtchnl_completion()
1448 if (adapter->current_op && (v_opcode != adapter->current_op)) in iavf_virtchnl_completion()
1449 dev_warn(&adapter->pdev->dev, "Expected response %d from PF, received %d\n", in iavf_virtchnl_completion()
1450 adapter->current_op, v_opcode); in iavf_virtchnl_completion()
1453 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_virtchnl_completion()