Lines Matching full:adapter

11  * @adapter: adapter structure
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()
37 * @adapter: adapter structure
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()
91 * @adapter: adapter structure
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()
127 * @adapter: adapter structure
133 int iavf_send_vf_config_msg(struct iavf_adapter *adapter) in iavf_send_vf_config_msg() argument
157 adapter->current_op = VIRTCHNL_OP_GET_VF_RESOURCES; in iavf_send_vf_config_msg()
158 adapter->aq_required &= ~IAVF_FLAG_AQ_GET_CONFIG; in iavf_send_vf_config_msg()
159 if (PF_IS_V11(adapter)) in iavf_send_vf_config_msg()
160 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_VF_RESOURCES, in iavf_send_vf_config_msg()
163 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_VF_RESOURCES, in iavf_send_vf_config_msg()
167 int iavf_send_vf_offload_vlan_v2_msg(struct iavf_adapter *adapter) in iavf_send_vf_offload_vlan_v2_msg() argument
169 adapter->aq_required &= ~IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS; in iavf_send_vf_offload_vlan_v2_msg()
171 if (!VLAN_V2_ALLOWED(adapter)) in iavf_send_vf_offload_vlan_v2_msg()
174 adapter->current_op = VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS; in iavf_send_vf_offload_vlan_v2_msg()
176 return iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS, in iavf_send_vf_offload_vlan_v2_msg()
182 * @adapter: adapter structure
187 static void iavf_validate_num_queues(struct iavf_adapter *adapter) in iavf_validate_num_queues() argument
189 if (adapter->vf_res->num_queue_pairs > IAVF_MAX_REQ_QUEUES) { in iavf_validate_num_queues()
193 dev_info(&adapter->pdev->dev, "Received %d queues, but can only have a max of %d\n", in iavf_validate_num_queues()
194 adapter->vf_res->num_queue_pairs, in iavf_validate_num_queues()
196 dev_info(&adapter->pdev->dev, "Fixing by reducing queues to %d\n", in iavf_validate_num_queues()
198 adapter->vf_res->num_queue_pairs = IAVF_MAX_REQ_QUEUES; in iavf_validate_num_queues()
199 for (i = 0; i < adapter->vf_res->num_vsis; i++) { in iavf_validate_num_queues()
200 vsi_res = &adapter->vf_res->vsi_res[i]; in iavf_validate_num_queues()
208 * @adapter: private adapter structure
215 int iavf_get_vf_config(struct iavf_adapter *adapter) in iavf_get_vf_config() argument
217 struct iavf_hw *hw = &adapter->hw; in iavf_get_vf_config()
229 memcpy(adapter->vf_res, event.msg_buf, min(event.msg_len, len)); in iavf_get_vf_config()
235 iavf_validate_num_queues(adapter); in iavf_get_vf_config()
236 iavf_vf_parse_hw_config(hw, adapter->vf_res); in iavf_get_vf_config()
243 int iavf_get_vf_vlan_v2_caps(struct iavf_adapter *adapter) in iavf_get_vf_vlan_v2_caps() argument
255 err = iavf_poll_virtchnl_msg(&adapter->hw, &event, in iavf_get_vf_vlan_v2_caps()
258 memcpy(&adapter->vlan_v2_caps, event.msg_buf, in iavf_get_vf_vlan_v2_caps()
268 * @adapter: adapter structure
272 void iavf_configure_queues(struct iavf_adapter *adapter) in iavf_configure_queues() argument
275 int pairs = adapter->num_active_queues; in iavf_configure_queues()
280 max_frame = LIBIE_MAX_RX_FRM_LEN(adapter->rx_rings->pp->p.offset); in iavf_configure_queues()
281 max_frame = min_not_zero(adapter->vf_res->max_mtu, max_frame); in iavf_configure_queues()
283 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_configure_queues()
285 dev_err(&adapter->pdev->dev, "Cannot configure queues, command %d pending\n", in iavf_configure_queues()
286 adapter->current_op); in iavf_configure_queues()
289 adapter->current_op = VIRTCHNL_OP_CONFIG_VSI_QUEUES; in iavf_configure_queues()
295 vqci->vsi_id = adapter->vsi_res->vsi_id; in iavf_configure_queues()
304 vqpi->txq.ring_len = adapter->tx_rings[i].count; in iavf_configure_queues()
305 vqpi->txq.dma_ring_addr = adapter->tx_rings[i].dma; in iavf_configure_queues()
308 vqpi->rxq.ring_len = adapter->rx_rings[i].count; in iavf_configure_queues()
309 vqpi->rxq.dma_ring_addr = adapter->rx_rings[i].dma; in iavf_configure_queues()
311 vqpi->rxq.databuffer_size = adapter->rx_rings[i].rx_buf_len; in iavf_configure_queues()
312 if (CRC_OFFLOAD_ALLOWED(adapter)) in iavf_configure_queues()
313 vqpi->rxq.crc_disable = !!(adapter->netdev->features & in iavf_configure_queues()
318 adapter->aq_required &= ~IAVF_FLAG_AQ_CONFIGURE_QUEUES; in iavf_configure_queues()
319 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_VSI_QUEUES, in iavf_configure_queues()
326 * @adapter: adapter structure
330 void iavf_enable_queues(struct iavf_adapter *adapter) in iavf_enable_queues() argument
334 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_enable_queues()
336 dev_err(&adapter->pdev->dev, "Cannot enable queues, command %d pending\n", in iavf_enable_queues()
337 adapter->current_op); in iavf_enable_queues()
340 adapter->current_op = VIRTCHNL_OP_ENABLE_QUEUES; in iavf_enable_queues()
341 vqs.vsi_id = adapter->vsi_res->vsi_id; in iavf_enable_queues()
342 vqs.tx_queues = BIT(adapter->num_active_queues) - 1; in iavf_enable_queues()
344 adapter->aq_required &= ~IAVF_FLAG_AQ_ENABLE_QUEUES; in iavf_enable_queues()
345 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_QUEUES, in iavf_enable_queues()
351 * @adapter: adapter structure
355 void iavf_disable_queues(struct iavf_adapter *adapter) in iavf_disable_queues() argument
359 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_disable_queues()
361 dev_err(&adapter->pdev->dev, "Cannot disable queues, command %d pending\n", in iavf_disable_queues()
362 adapter->current_op); in iavf_disable_queues()
365 adapter->current_op = VIRTCHNL_OP_DISABLE_QUEUES; in iavf_disable_queues()
366 vqs.vsi_id = adapter->vsi_res->vsi_id; in iavf_disable_queues()
367 vqs.tx_queues = BIT(adapter->num_active_queues) - 1; in iavf_disable_queues()
369 adapter->aq_required &= ~IAVF_FLAG_AQ_DISABLE_QUEUES; in iavf_disable_queues()
370 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_QUEUES, in iavf_disable_queues()
376 * @adapter: adapter structure
381 void iavf_map_queues(struct iavf_adapter *adapter) in iavf_map_queues() argument
389 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_map_queues()
391 dev_err(&adapter->pdev->dev, "Cannot map queues to vectors, command %d pending\n", in iavf_map_queues()
392 adapter->current_op); in iavf_map_queues()
395 adapter->current_op = VIRTCHNL_OP_CONFIG_IRQ_MAP; in iavf_map_queues()
397 q_vectors = adapter->num_msix_vectors - NONQ_VECS; in iavf_map_queues()
399 len = virtchnl_struct_size(vimi, vecmap, adapter->num_msix_vectors); in iavf_map_queues()
404 vimi->num_vectors = adapter->num_msix_vectors; in iavf_map_queues()
407 q_vector = &adapter->q_vectors[v_idx]; in iavf_map_queues()
410 vecmap->vsi_id = adapter->vsi_res->vsi_id; in iavf_map_queues()
419 vecmap->vsi_id = adapter->vsi_res->vsi_id; in iavf_map_queues()
424 adapter->aq_required &= ~IAVF_FLAG_AQ_MAP_VECTORS; in iavf_map_queues()
425 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_IRQ_MAP, in iavf_map_queues()
446 * @adapter: adapter structure
450 void iavf_add_ether_addrs(struct iavf_adapter *adapter) in iavf_add_ether_addrs() argument
458 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_ether_addrs()
460 dev_err(&adapter->pdev->dev, "Cannot add filters, command %d pending\n", in iavf_add_ether_addrs()
461 adapter->current_op); in iavf_add_ether_addrs()
465 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
467 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_add_ether_addrs()
472 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_MAC_FILTER; in iavf_add_ether_addrs()
473 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
476 adapter->current_op = VIRTCHNL_OP_ADD_ETH_ADDR; in iavf_add_ether_addrs()
480 dev_warn(&adapter->pdev->dev, "Too many add MAC changes in one request\n"); in iavf_add_ether_addrs()
488 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
492 veal->vsi_id = adapter->vsi_res->vsi_id; in iavf_add_ether_addrs()
494 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_add_ether_addrs()
505 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_MAC_FILTER; in iavf_add_ether_addrs()
507 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_ether_addrs()
509 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_ETH_ADDR, (u8 *)veal, len); in iavf_add_ether_addrs()
515 * @adapter: adapter structure
519 void iavf_del_ether_addrs(struct iavf_adapter *adapter) in iavf_del_ether_addrs() argument
527 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_ether_addrs()
529 dev_err(&adapter->pdev->dev, "Cannot remove filters, command %d pending\n", in iavf_del_ether_addrs()
530 adapter->current_op); in iavf_del_ether_addrs()
534 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
536 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_del_ether_addrs()
541 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_MAC_FILTER; in iavf_del_ether_addrs()
542 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
545 adapter->current_op = VIRTCHNL_OP_DEL_ETH_ADDR; in iavf_del_ether_addrs()
549 dev_warn(&adapter->pdev->dev, "Too many delete MAC changes in one request\n"); in iavf_del_ether_addrs()
556 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
560 veal->vsi_id = adapter->vsi_res->vsi_id; in iavf_del_ether_addrs()
562 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { in iavf_del_ether_addrs()
574 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_MAC_FILTER; in iavf_del_ether_addrs()
576 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_ether_addrs()
578 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_ETH_ADDR, (u8 *)veal, len); in iavf_del_ether_addrs()
584 * @adapter: adapter structure
588 static void iavf_mac_add_ok(struct iavf_adapter *adapter) in iavf_mac_add_ok() argument
592 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_mac_add_ok()
593 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { in iavf_mac_add_ok()
598 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_mac_add_ok()
603 * @adapter: adapter structure
607 static void iavf_mac_add_reject(struct iavf_adapter *adapter) in iavf_mac_add_reject() argument
609 struct net_device *netdev = adapter->netdev; in iavf_mac_add_reject()
612 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_mac_add_reject()
613 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { in iavf_mac_add_reject()
625 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_mac_add_reject()
630 * @adapter: adapter structure
634 static void iavf_vlan_add_reject(struct iavf_adapter *adapter) in iavf_vlan_add_reject() argument
638 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_vlan_add_reject()
639 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in iavf_vlan_add_reject()
643 adapter->num_vlan_filters--; in iavf_vlan_add_reject()
646 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_vlan_add_reject()
651 * @adapter: adapter structure
655 void iavf_add_vlans(struct iavf_adapter *adapter) in iavf_add_vlans() argument
661 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_vlans()
663 dev_err(&adapter->pdev->dev, "Cannot add VLANs, command %d pending\n", in iavf_add_vlans()
664 adapter->current_op); in iavf_add_vlans()
668 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
670 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_add_vlans()
674 if (!count || !VLAN_FILTERING_ALLOWED(adapter)) { in iavf_add_vlans()
675 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_VLAN_FILTER; in iavf_add_vlans()
676 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
680 if (VLAN_ALLOWED(adapter)) { in iavf_add_vlans()
683 adapter->current_op = VIRTCHNL_OP_ADD_VLAN; in iavf_add_vlans()
687 dev_warn(&adapter->pdev->dev, "Too many add VLAN changes in one request\n"); in iavf_add_vlans()
695 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
699 vvfl->vsi_id = adapter->vsi_res->vsi_id; in iavf_add_vlans()
701 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_add_vlans()
711 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_VLAN_FILTER; in iavf_add_vlans()
713 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
715 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len); in iavf_add_vlans()
718 u16 max_vlans = adapter->vlan_v2_caps.filtering.max_filters; in iavf_add_vlans()
719 u16 current_vlans = iavf_get_num_vlans_added(adapter); in iavf_add_vlans()
722 adapter->current_op = VIRTCHNL_OP_ADD_VLAN_V2; in iavf_add_vlans()
726 count = max_vlans - iavf_get_num_vlans_added(adapter); in iavf_add_vlans()
732 dev_warn(&adapter->pdev->dev, "Too many add VLAN changes in one request\n"); in iavf_add_vlans()
741 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
745 vvfl_v2->vport_id = adapter->vsi_res->vsi_id; in iavf_add_vlans()
747 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_add_vlans()
750 &adapter->vlan_v2_caps.filtering.filtering_support; in iavf_add_vlans()
771 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_VLAN_FILTER; in iavf_add_vlans()
773 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_add_vlans()
775 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_VLAN_V2, in iavf_add_vlans()
783 * @adapter: adapter structure
787 void iavf_del_vlans(struct iavf_adapter *adapter) in iavf_del_vlans() argument
793 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_vlans()
795 dev_err(&adapter->pdev->dev, "Cannot remove VLANs, command %d pending\n", in iavf_del_vlans()
796 adapter->current_op); in iavf_del_vlans()
800 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
802 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in iavf_del_vlans()
810 !VLAN_FILTERING_ALLOWED(adapter)) { in iavf_del_vlans()
813 adapter->num_vlan_filters--; in iavf_del_vlans()
815 !VLAN_FILTERING_ALLOWED(adapter)) { in iavf_del_vlans()
822 if (!count || !VLAN_FILTERING_ALLOWED(adapter)) { in iavf_del_vlans()
823 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_VLAN_FILTER; in iavf_del_vlans()
824 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
828 if (VLAN_ALLOWED(adapter)) { in iavf_del_vlans()
831 adapter->current_op = VIRTCHNL_OP_DEL_VLAN; in iavf_del_vlans()
835 dev_warn(&adapter->pdev->dev, "Too many delete VLAN changes in one request\n"); in iavf_del_vlans()
843 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
847 vvfl->vsi_id = adapter->vsi_res->vsi_id; in iavf_del_vlans()
849 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in iavf_del_vlans()
860 adapter->num_vlan_filters--; in iavf_del_vlans()
868 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_VLAN_FILTER; in iavf_del_vlans()
870 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
872 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len); in iavf_del_vlans()
877 adapter->current_op = VIRTCHNL_OP_DEL_VLAN_V2; in iavf_del_vlans()
881 dev_warn(&adapter->pdev->dev, "Too many add VLAN changes in one request\n"); in iavf_del_vlans()
890 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
894 vvfl_v2->vport_id = adapter->vsi_res->vsi_id; in iavf_del_vlans()
896 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in iavf_del_vlans()
900 &adapter->vlan_v2_caps.filtering.filtering_support; in iavf_del_vlans()
917 adapter->num_vlan_filters--; in iavf_del_vlans()
926 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_VLAN_FILTER; in iavf_del_vlans()
928 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_del_vlans()
930 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_VLAN_V2, in iavf_del_vlans()
938 * @adapter: adapter structure
942 void iavf_set_promiscuous(struct iavf_adapter *adapter) in iavf_set_promiscuous() argument
944 struct net_device *netdev = adapter->netdev; in iavf_set_promiscuous()
948 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_promiscuous()
950 dev_err(&adapter->pdev->dev, "Cannot set promiscuous mode, command %d pending\n", in iavf_set_promiscuous()
951 adapter->current_op); in iavf_set_promiscuous()
956 spin_lock_bh(&adapter->current_netdev_promisc_flags_lock); in iavf_set_promiscuous()
959 if (!iavf_promiscuous_mode_changed(adapter)) { in iavf_set_promiscuous()
960 adapter->aq_required &= ~IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODE; in iavf_set_promiscuous()
961 dev_dbg(&adapter->pdev->dev, "No change in promiscuous mode\n"); in iavf_set_promiscuous()
963 spin_unlock_bh(&adapter->current_netdev_promisc_flags_lock); in iavf_set_promiscuous()
974 adapter->current_netdev_promisc_flags |= IFF_ALLMULTI; in iavf_set_promiscuous()
975 adapter->current_netdev_promisc_flags &= ~IFF_PROMISC; in iavf_set_promiscuous()
976 dev_info(&adapter->pdev->dev, "Entering multicast promiscuous mode\n"); in iavf_set_promiscuous()
983 adapter->current_netdev_promisc_flags &= in iavf_set_promiscuous()
985 dev_info(&adapter->pdev->dev, "Leaving promiscuous mode\n"); in iavf_set_promiscuous()
992 adapter->current_netdev_promisc_flags |= IFF_PROMISC; in iavf_set_promiscuous()
994 adapter->current_netdev_promisc_flags |= IFF_ALLMULTI; in iavf_set_promiscuous()
996 adapter->current_netdev_promisc_flags &= ~IFF_ALLMULTI; in iavf_set_promiscuous()
998 dev_info(&adapter->pdev->dev, "Entering promiscuous mode\n"); in iavf_set_promiscuous()
1001 adapter->aq_required &= ~IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODE; in iavf_set_promiscuous()
1004 spin_unlock_bh(&adapter->current_netdev_promisc_flags_lock); in iavf_set_promiscuous()
1006 adapter->current_op = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE; in iavf_set_promiscuous()
1007 vpi.vsi_id = adapter->vsi_res->vsi_id; in iavf_set_promiscuous()
1009 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE, in iavf_set_promiscuous()
1015 * @adapter: adapter structure
1019 void iavf_request_stats(struct iavf_adapter *adapter) in iavf_request_stats() argument
1023 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_request_stats()
1028 adapter->aq_required &= ~IAVF_FLAG_AQ_REQUEST_STATS; in iavf_request_stats()
1029 adapter->current_op = VIRTCHNL_OP_GET_STATS; in iavf_request_stats()
1030 vqs.vsi_id = adapter->vsi_res->vsi_id; in iavf_request_stats()
1032 if (iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_STATS, (u8 *)&vqs, in iavf_request_stats()
1035 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_request_stats()
1040 * @adapter: adapter structure
1044 void iavf_get_hena(struct iavf_adapter *adapter) in iavf_get_hena() argument
1046 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_get_hena()
1048 dev_err(&adapter->pdev->dev, "Cannot get RSS hash capabilities, command %d pending\n", in iavf_get_hena()
1049 adapter->current_op); in iavf_get_hena()
1052 adapter->current_op = VIRTCHNL_OP_GET_RSS_HENA_CAPS; in iavf_get_hena()
1053 adapter->aq_required &= ~IAVF_FLAG_AQ_GET_HENA; in iavf_get_hena()
1054 iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_RSS_HENA_CAPS, NULL, 0); in iavf_get_hena()
1059 * @adapter: adapter structure
1063 void iavf_set_hena(struct iavf_adapter *adapter) in iavf_set_hena() argument
1067 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_hena()
1069 dev_err(&adapter->pdev->dev, "Cannot set RSS hash enable, command %d pending\n", in iavf_set_hena()
1070 adapter->current_op); in iavf_set_hena()
1073 vrh.hena = adapter->hena; in iavf_set_hena()
1074 adapter->current_op = VIRTCHNL_OP_SET_RSS_HENA; in iavf_set_hena()
1075 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_HENA; in iavf_set_hena()
1076 iavf_send_pf_msg(adapter, VIRTCHNL_OP_SET_RSS_HENA, (u8 *)&vrh, in iavf_set_hena()
1082 * @adapter: adapter structure
1086 void iavf_set_rss_key(struct iavf_adapter *adapter) in iavf_set_rss_key() argument
1091 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_rss_key()
1093 dev_err(&adapter->pdev->dev, "Cannot set RSS key, command %d pending\n", in iavf_set_rss_key()
1094 adapter->current_op); in iavf_set_rss_key()
1097 len = virtchnl_struct_size(vrk, key, adapter->rss_key_size); in iavf_set_rss_key()
1101 vrk->vsi_id = adapter->vsi.id; in iavf_set_rss_key()
1102 vrk->key_len = adapter->rss_key_size; in iavf_set_rss_key()
1103 memcpy(vrk->key, adapter->rss_key, adapter->rss_key_size); in iavf_set_rss_key()
1105 adapter->current_op = VIRTCHNL_OP_CONFIG_RSS_KEY; in iavf_set_rss_key()
1106 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_RSS_KEY; in iavf_set_rss_key()
1107 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_RSS_KEY, (u8 *)vrk, len); in iavf_set_rss_key()
1113 * @adapter: adapter structure
1117 void iavf_set_rss_lut(struct iavf_adapter *adapter) in iavf_set_rss_lut() argument
1122 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_rss_lut()
1124 dev_err(&adapter->pdev->dev, "Cannot set RSS LUT, command %d pending\n", in iavf_set_rss_lut()
1125 adapter->current_op); in iavf_set_rss_lut()
1128 len = virtchnl_struct_size(vrl, lut, adapter->rss_lut_size); in iavf_set_rss_lut()
1132 vrl->vsi_id = adapter->vsi.id; in iavf_set_rss_lut()
1133 vrl->lut_entries = adapter->rss_lut_size; in iavf_set_rss_lut()
1134 memcpy(vrl->lut, adapter->rss_lut, adapter->rss_lut_size); in iavf_set_rss_lut()
1135 adapter->current_op = VIRTCHNL_OP_CONFIG_RSS_LUT; in iavf_set_rss_lut()
1136 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_RSS_LUT; in iavf_set_rss_lut()
1137 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_RSS_LUT, (u8 *)vrl, len); in iavf_set_rss_lut()
1143 * @adapter: adapter structure
1147 void iavf_set_rss_hfunc(struct iavf_adapter *adapter) in iavf_set_rss_hfunc() argument
1152 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_rss_hfunc()
1154 dev_err(&adapter->pdev->dev, "Cannot set RSS Hash function, command %d pending\n", in iavf_set_rss_hfunc()
1155 adapter->current_op); in iavf_set_rss_hfunc()
1161 vrh->vsi_id = adapter->vsi.id; in iavf_set_rss_hfunc()
1162 vrh->rss_algorithm = adapter->hfunc; in iavf_set_rss_hfunc()
1163 adapter->current_op = VIRTCHNL_OP_CONFIG_RSS_HFUNC; in iavf_set_rss_hfunc()
1164 adapter->aq_required &= ~IAVF_FLAG_AQ_SET_RSS_HFUNC; in iavf_set_rss_hfunc()
1165 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_RSS_HFUNC, (u8 *)vrh, len); in iavf_set_rss_hfunc()
1171 * @adapter: adapter structure
1175 void iavf_enable_vlan_stripping(struct iavf_adapter *adapter) in iavf_enable_vlan_stripping() argument
1177 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_enable_vlan_stripping()
1179 dev_err(&adapter->pdev->dev, "Cannot enable stripping, command %d pending\n", in iavf_enable_vlan_stripping()
1180 adapter->current_op); in iavf_enable_vlan_stripping()
1183 adapter->current_op = VIRTCHNL_OP_ENABLE_VLAN_STRIPPING; in iavf_enable_vlan_stripping()
1184 adapter->aq_required &= ~IAVF_FLAG_AQ_ENABLE_VLAN_STRIPPING; in iavf_enable_vlan_stripping()
1185 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_VLAN_STRIPPING, NULL, 0); in iavf_enable_vlan_stripping()
1190 * @adapter: adapter structure
1194 void iavf_disable_vlan_stripping(struct iavf_adapter *adapter) in iavf_disable_vlan_stripping() argument
1196 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_disable_vlan_stripping()
1198 dev_err(&adapter->pdev->dev, "Cannot disable stripping, command %d pending\n", in iavf_disable_vlan_stripping()
1199 adapter->current_op); in iavf_disable_vlan_stripping()
1202 adapter->current_op = VIRTCHNL_OP_DISABLE_VLAN_STRIPPING; in iavf_disable_vlan_stripping()
1203 adapter->aq_required &= ~IAVF_FLAG_AQ_DISABLE_VLAN_STRIPPING; in iavf_disable_vlan_stripping()
1204 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING, NULL, 0); in iavf_disable_vlan_stripping()
1225 * @adapter: adapter structure
1231 iavf_set_vc_offload_ethertype(struct iavf_adapter *adapter, in iavf_set_vc_offload_ethertype() argument
1243 &adapter->vlan_v2_caps.offloads.stripping_support; in iavf_set_vc_offload_ethertype()
1248 &adapter->vlan_v2_caps.offloads.insertion_support; in iavf_set_vc_offload_ethertype()
1251 …dev_err(&adapter->pdev->dev, "Invalid opcode %d for setting virtchnl ethertype to enable/disable V… in iavf_set_vc_offload_ethertype()
1264 dev_dbg(&adapter->pdev->dev, "opcode %d unsupported for VLAN TPID 0x%04x\n", in iavf_set_vc_offload_ethertype()
1274 * @adapter: adapter structure
1279 iavf_clear_offload_v2_aq_required(struct iavf_adapter *adapter, u16 tpid, in iavf_clear_offload_v2_aq_required() argument
1285 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1288 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1293 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1296 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1301 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1304 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1309 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1312 adapter->aq_required &= in iavf_clear_offload_v2_aq_required()
1316 …dev_err(&adapter->pdev->dev, "Unsupported opcode %d specified for clearing aq_required bits for VI… in iavf_clear_offload_v2_aq_required()
1323 * @adapter: adapter structure
1328 iavf_send_vlan_offload_v2(struct iavf_adapter *adapter, u16 tpid, in iavf_send_vlan_offload_v2() argument
1334 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_send_vlan_offload_v2()
1336 dev_err(&adapter->pdev->dev, "Cannot send %d, command %d pending\n", in iavf_send_vlan_offload_v2()
1337 offload_op, adapter->current_op); in iavf_send_vlan_offload_v2()
1341 adapter->current_op = offload_op; in iavf_send_vlan_offload_v2()
1347 msg->vport_id = adapter->vsi_res->vsi_id; in iavf_send_vlan_offload_v2()
1350 iavf_clear_offload_v2_aq_required(adapter, tpid, offload_op); in iavf_send_vlan_offload_v2()
1353 if (!iavf_set_vc_offload_ethertype(adapter, msg, tpid, offload_op)) in iavf_send_vlan_offload_v2()
1354 iavf_send_pf_msg(adapter, offload_op, (u8 *)msg, len); in iavf_send_vlan_offload_v2()
1356 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_send_vlan_offload_v2()
1363 * @adapter: adapter structure
1366 void iavf_enable_vlan_stripping_v2(struct iavf_adapter *adapter, u16 tpid) in iavf_enable_vlan_stripping_v2() argument
1368 iavf_send_vlan_offload_v2(adapter, tpid, in iavf_enable_vlan_stripping_v2()
1374 * @adapter: adapter structure
1377 void iavf_disable_vlan_stripping_v2(struct iavf_adapter *adapter, u16 tpid) in iavf_disable_vlan_stripping_v2() argument
1379 iavf_send_vlan_offload_v2(adapter, tpid, in iavf_disable_vlan_stripping_v2()
1385 * @adapter: adapter structure
1388 void iavf_enable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid) in iavf_enable_vlan_insertion_v2() argument
1390 iavf_send_vlan_offload_v2(adapter, tpid, in iavf_enable_vlan_insertion_v2()
1396 * @adapter: adapter structure
1399 void iavf_disable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid) in iavf_disable_vlan_insertion_v2() argument
1401 iavf_send_vlan_offload_v2(adapter, tpid, in iavf_disable_vlan_insertion_v2()
1407 * @adapter: adapter structure
1411 static void iavf_print_link_message(struct iavf_adapter *adapter) in iavf_print_link_message() argument
1413 struct net_device *netdev = adapter->netdev; in iavf_print_link_message()
1417 if (!adapter->link_up) { in iavf_print_link_message()
1422 if (ADV_LINK_SUPPORT(adapter)) { in iavf_print_link_message()
1423 link_speed_mbps = adapter->link_speed_mbps; in iavf_print_link_message()
1427 switch (adapter->link_speed) { in iavf_print_link_message()
1478 * @adapter: adapter structure
1484 iavf_get_vpe_link_status(struct iavf_adapter *adapter, in iavf_get_vpe_link_status() argument
1487 if (ADV_LINK_SUPPORT(adapter)) in iavf_get_vpe_link_status()
1495 * @adapter: adapter structure for which we are setting the link speed
1501 iavf_set_adapter_link_speed_from_vpe(struct iavf_adapter *adapter, in iavf_set_adapter_link_speed_from_vpe() argument
1504 if (ADV_LINK_SUPPORT(adapter)) in iavf_set_adapter_link_speed_from_vpe()
1505 adapter->link_speed_mbps = in iavf_set_adapter_link_speed_from_vpe()
1508 adapter->link_speed = vpe->event_data.link_event.link_speed; in iavf_set_adapter_link_speed_from_vpe()
1513 * @adapter: iavf adapter struct instance
1517 void iavf_get_qos_caps(struct iavf_adapter *adapter) in iavf_get_qos_caps() argument
1519 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_get_qos_caps()
1521 dev_err(&adapter->pdev->dev, in iavf_get_qos_caps()
1523 adapter->current_op); in iavf_get_qos_caps()
1527 adapter->current_op = VIRTCHNL_OP_GET_QOS_CAPS; in iavf_get_qos_caps()
1528 adapter->aq_required &= ~IAVF_FLAG_AQ_GET_QOS_CAPS; in iavf_get_qos_caps()
1529 iavf_send_pf_msg(adapter, VIRTCHNL_OP_GET_QOS_CAPS, NULL, 0); in iavf_get_qos_caps()
1534 * @adapter: iavf adapter struct instance
1543 iavf_set_quanta_size(struct iavf_adapter *adapter, u16 quanta_size, in iavf_set_quanta_size() argument
1548 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_set_quanta_size()
1550 dev_err(&adapter->pdev->dev, in iavf_set_quanta_size()
1552 adapter->current_op); in iavf_set_quanta_size()
1556 adapter->current_op = VIRTCHNL_OP_CONFIG_QUANTA; in iavf_set_quanta_size()
1561 adapter->aq_required &= ~IAVF_FLAG_AQ_CFG_QUEUES_QUANTA_SIZE; in iavf_set_quanta_size()
1562 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_QUANTA, in iavf_set_quanta_size()
1568 * @adapter: adapter structure
1572 void iavf_cfg_queues_quanta_size(struct iavf_adapter *adapter) in iavf_cfg_queues_quanta_size() argument
1577 iavf_set_quanta_size(adapter, quanta_size, 0, in iavf_cfg_queues_quanta_size()
1578 adapter->num_active_queues); in iavf_cfg_queues_quanta_size()
1583 * @adapter: iavf adapter structure instance
1587 void iavf_cfg_queues_bw(struct iavf_adapter *adapter) in iavf_cfg_queues_bw() argument
1595 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_cfg_queues_bw()
1597 dev_err(&adapter->pdev->dev, in iavf_cfg_queues_bw()
1599 adapter->current_op); in iavf_cfg_queues_bw()
1603 for (i = 0; i < adapter->num_active_queues; i++) { in iavf_cfg_queues_bw()
1604 if (adapter->tx_rings[i].q_shaper_update) in iavf_cfg_queues_bw()
1612 qs_bw_cfg->vsi_id = adapter->vsi.id; in iavf_cfg_queues_bw()
1615 for (i = 0; i < adapter->num_active_queues; i++) { in iavf_cfg_queues_bw()
1616 struct iavf_ring *tx_ring = &adapter->tx_rings[i]; in iavf_cfg_queues_bw()
1628 adapter->current_op = VIRTCHNL_OP_CONFIG_QUEUE_BW; in iavf_cfg_queues_bw()
1629 adapter->aq_required &= ~IAVF_FLAG_AQ_CONFIGURE_QUEUES_BW; in iavf_cfg_queues_bw()
1630 iavf_send_pf_msg(adapter, VIRTCHNL_OP_CONFIG_QUEUE_BW, in iavf_cfg_queues_bw()
1637 * @adapter: adapter structure
1642 void iavf_enable_channels(struct iavf_adapter *adapter) in iavf_enable_channels() argument
1648 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_enable_channels()
1650 dev_err(&adapter->pdev->dev, "Cannot configure mqprio, command %d pending\n", in iavf_enable_channels()
1651 adapter->current_op); in iavf_enable_channels()
1655 len = virtchnl_struct_size(vti, list, adapter->num_tc); in iavf_enable_channels()
1659 vti->num_tc = adapter->num_tc; in iavf_enable_channels()
1661 vti->list[i].count = adapter->ch_config.ch_info[i].count; in iavf_enable_channels()
1662 vti->list[i].offset = adapter->ch_config.ch_info[i].offset; in iavf_enable_channels()
1665 adapter->ch_config.ch_info[i].max_tx_rate; in iavf_enable_channels()
1668 adapter->ch_config.state = __IAVF_TC_RUNNING; in iavf_enable_channels()
1669 adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_enable_channels()
1670 adapter->current_op = VIRTCHNL_OP_ENABLE_CHANNELS; in iavf_enable_channels()
1671 adapter->aq_required &= ~IAVF_FLAG_AQ_ENABLE_CHANNELS; in iavf_enable_channels()
1672 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ENABLE_CHANNELS, (u8 *)vti, len); in iavf_enable_channels()
1678 * @adapter: adapter structure
1682 void iavf_disable_channels(struct iavf_adapter *adapter) in iavf_disable_channels() argument
1684 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_disable_channels()
1686 dev_err(&adapter->pdev->dev, "Cannot configure mqprio, command %d pending\n", in iavf_disable_channels()
1687 adapter->current_op); in iavf_disable_channels()
1691 adapter->ch_config.state = __IAVF_TC_INVALID; in iavf_disable_channels()
1692 adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_disable_channels()
1693 adapter->current_op = VIRTCHNL_OP_DISABLE_CHANNELS; in iavf_disable_channels()
1694 adapter->aq_required &= ~IAVF_FLAG_AQ_DISABLE_CHANNELS; in iavf_disable_channels()
1695 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DISABLE_CHANNELS, NULL, 0); in iavf_disable_channels()
1700 * @adapter: adapter structure
1705 static void iavf_print_cloud_filter(struct iavf_adapter *adapter, in iavf_print_cloud_filter() argument
1710 …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()
1720 …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()
1734 * @adapter: adapter structure
1739 void iavf_add_cloud_filter(struct iavf_adapter *adapter) in iavf_add_cloud_filter() argument
1745 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_cloud_filter()
1747 dev_err(&adapter->pdev->dev, "Cannot add cloud filter, command %d pending\n", in iavf_add_cloud_filter()
1748 adapter->current_op); in iavf_add_cloud_filter()
1751 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_add_cloud_filter()
1758 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_CLOUD_FILTER; in iavf_add_cloud_filter()
1761 adapter->current_op = VIRTCHNL_OP_ADD_CLOUD_FILTER; in iavf_add_cloud_filter()
1768 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_add_cloud_filter()
1773 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_CLOUD_FILTER, in iavf_add_cloud_filter()
1782 * @adapter: adapter structure
1787 void iavf_del_cloud_filter(struct iavf_adapter *adapter) in iavf_del_cloud_filter() argument
1793 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_cloud_filter()
1795 dev_err(&adapter->pdev->dev, "Cannot remove cloud filter, command %d pending\n", in iavf_del_cloud_filter()
1796 adapter->current_op); in iavf_del_cloud_filter()
1799 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_del_cloud_filter()
1806 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_CLOUD_FILTER; in iavf_del_cloud_filter()
1809 adapter->current_op = VIRTCHNL_OP_DEL_CLOUD_FILTER; in iavf_del_cloud_filter()
1816 list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, list) { in iavf_del_cloud_filter()
1821 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_CLOUD_FILTER, in iavf_del_cloud_filter()
1830 * @adapter: the VF adapter structure
1835 void iavf_add_fdir_filter(struct iavf_adapter *adapter) in iavf_add_fdir_filter() argument
1842 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_fdir_filter()
1844 dev_err(&adapter->pdev->dev, "Cannot add Flow Director filter, command %d pending\n", in iavf_add_fdir_filter()
1845 adapter->current_op); in iavf_add_fdir_filter()
1854 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_add_fdir_filter()
1855 list_for_each_entry(fdir, &adapter->fdir_list_head, list) { in iavf_add_fdir_filter()
1863 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_add_fdir_filter()
1869 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_FDIR_FILTER; in iavf_add_fdir_filter()
1873 adapter->current_op = VIRTCHNL_OP_ADD_FDIR_FILTER; in iavf_add_fdir_filter()
1874 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_FDIR_FILTER, (u8 *)f, len); in iavf_add_fdir_filter()
1880 * @adapter: the VF adapter structure
1885 void iavf_del_fdir_filter(struct iavf_adapter *adapter) in iavf_del_fdir_filter() argument
1892 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_fdir_filter()
1894 dev_err(&adapter->pdev->dev, "Cannot remove Flow Director filter, command %d pending\n", in iavf_del_fdir_filter()
1895 adapter->current_op); in iavf_del_fdir_filter()
1901 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_del_fdir_filter()
1902 list_for_each_entry(fdir, &adapter->fdir_list_head, list) { in iavf_del_fdir_filter()
1917 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_del_fdir_filter()
1920 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_FDIR_FILTER; in iavf_del_fdir_filter()
1924 adapter->current_op = VIRTCHNL_OP_DEL_FDIR_FILTER; in iavf_del_fdir_filter()
1925 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_FDIR_FILTER, (u8 *)&f, len); in iavf_del_fdir_filter()
1930 * @adapter: the VF adapter structure
1935 void iavf_add_adv_rss_cfg(struct iavf_adapter *adapter) in iavf_add_adv_rss_cfg() argument
1942 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_add_adv_rss_cfg()
1944 dev_err(&adapter->pdev->dev, "Cannot add RSS configuration, command %d pending\n", in iavf_add_adv_rss_cfg()
1945 adapter->current_op); in iavf_add_adv_rss_cfg()
1954 spin_lock_bh(&adapter->adv_rss_lock); in iavf_add_adv_rss_cfg()
1955 list_for_each_entry(rss, &adapter->adv_rss_list_head, list) { in iavf_add_adv_rss_cfg()
1960 iavf_print_adv_rss_cfg(adapter, rss, in iavf_add_adv_rss_cfg()
1966 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_add_adv_rss_cfg()
1969 adapter->current_op = VIRTCHNL_OP_ADD_RSS_CFG; in iavf_add_adv_rss_cfg()
1970 iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_RSS_CFG, in iavf_add_adv_rss_cfg()
1973 adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_ADV_RSS_CFG; in iavf_add_adv_rss_cfg()
1981 * @adapter: the VF adapter structure
1986 void iavf_del_adv_rss_cfg(struct iavf_adapter *adapter) in iavf_del_adv_rss_cfg() argument
1993 if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { in iavf_del_adv_rss_cfg()
1995 dev_err(&adapter->pdev->dev, "Cannot remove RSS configuration, command %d pending\n", in iavf_del_adv_rss_cfg()
1996 adapter->current_op); in iavf_del_adv_rss_cfg()
2005 spin_lock_bh(&adapter->adv_rss_lock); in iavf_del_adv_rss_cfg()
2006 list_for_each_entry(rss, &adapter->adv_rss_list_head, list) { in iavf_del_adv_rss_cfg()
2014 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_del_adv_rss_cfg()
2017 adapter->current_op = VIRTCHNL_OP_DEL_RSS_CFG; in iavf_del_adv_rss_cfg()
2018 iavf_send_pf_msg(adapter, VIRTCHNL_OP_DEL_RSS_CFG, in iavf_del_adv_rss_cfg()
2021 adapter->aq_required &= ~IAVF_FLAG_AQ_DEL_ADV_RSS_CFG; in iavf_del_adv_rss_cfg()
2029 * @adapter: adapter structure
2033 int iavf_request_reset(struct iavf_adapter *adapter) in iavf_request_reset() argument
2037 err = iavf_send_pf_msg(adapter, VIRTCHNL_OP_RESET_VF, NULL, 0); in iavf_request_reset()
2038 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_request_reset()
2060 * @adapter: private adapter structure
2065 static void iavf_activate_fdir_filters(struct iavf_adapter *adapter) in iavf_activate_fdir_filters() argument
2070 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_activate_fdir_filters()
2071 list_for_each_entry_safe(f, ftmp, &adapter->fdir_list_head, list) { in iavf_activate_fdir_filters()
2090 iavf_dec_fdir_active_fltr(adapter, f); in iavf_activate_fdir_filters()
2094 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_activate_fdir_filters()
2097 adapter->aq_required |= IAVF_FLAG_AQ_ADD_FDIR_FILTER; in iavf_activate_fdir_filters()
2102 * @adapter: adapter structure
2112 void iavf_virtchnl_completion(struct iavf_adapter *adapter, in iavf_virtchnl_completion() argument
2116 struct net_device *netdev = adapter->netdev; in iavf_virtchnl_completion()
2121 bool link_up = iavf_get_vpe_link_status(adapter, vpe); in iavf_virtchnl_completion()
2125 iavf_set_adapter_link_speed_from_vpe(adapter, vpe); in iavf_virtchnl_completion()
2128 if (adapter->link_up == link_up) in iavf_virtchnl_completion()
2139 if (adapter->state != __IAVF_RUNNING) in iavf_virtchnl_completion()
2146 if (adapter->flags & in iavf_virtchnl_completion()
2151 adapter->link_up = link_up; in iavf_virtchnl_completion()
2159 iavf_print_link_message(adapter); in iavf_virtchnl_completion()
2162 dev_info(&adapter->pdev->dev, "Reset indication received from the PF\n"); in iavf_virtchnl_completion()
2163 if (!(adapter->flags & IAVF_FLAG_RESET_PENDING)) { in iavf_virtchnl_completion()
2164 dev_info(&adapter->pdev->dev, "Scheduling reset task\n"); in iavf_virtchnl_completion()
2165 iavf_schedule_reset(adapter, IAVF_FLAG_RESET_PENDING); in iavf_virtchnl_completion()
2169 dev_err(&adapter->pdev->dev, "Unknown event %d from PF\n", in iavf_virtchnl_completion()
2178 dev_err(&adapter->pdev->dev, "Failed to add VLAN filter, error %s\n", in iavf_virtchnl_completion()
2179 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2182 dev_err(&adapter->pdev->dev, "Failed to add MAC filter, error %s\n", in iavf_virtchnl_completion()
2183 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2184 iavf_mac_add_reject(adapter); in iavf_virtchnl_completion()
2186 ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr); in iavf_virtchnl_completion()
2187 wake_up(&adapter->vc_waitqueue); in iavf_virtchnl_completion()
2190 dev_err(&adapter->pdev->dev, "Failed to delete VLAN filter, error %s\n", in iavf_virtchnl_completion()
2191 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2194 dev_err(&adapter->pdev->dev, "Failed to delete MAC filter, error %s\n", in iavf_virtchnl_completion()
2195 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2198 dev_err(&adapter->pdev->dev, "Failed to configure queue channels, error %s\n", in iavf_virtchnl_completion()
2199 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2200 adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_virtchnl_completion()
2201 adapter->ch_config.state = __IAVF_TC_INVALID; in iavf_virtchnl_completion()
2206 dev_err(&adapter->pdev->dev, "Failed to disable queue channels, error %s\n", in iavf_virtchnl_completion()
2207 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2208 adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_virtchnl_completion()
2209 adapter->ch_config.state = __IAVF_TC_RUNNING; in iavf_virtchnl_completion()
2216 &adapter->cloud_filter_list, in iavf_virtchnl_completion()
2220 dev_info(&adapter->pdev->dev, "Failed to add cloud filter, error %s\n", in iavf_virtchnl_completion()
2221 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2223 iavf_print_cloud_filter(adapter, in iavf_virtchnl_completion()
2227 adapter->num_cloud_filters--; in iavf_virtchnl_completion()
2235 list_for_each_entry(cf, &adapter->cloud_filter_list, in iavf_virtchnl_completion()
2239 dev_info(&adapter->pdev->dev, "Failed to del cloud filter, error %s\n", in iavf_virtchnl_completion()
2240 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2242 iavf_print_cloud_filter(adapter, in iavf_virtchnl_completion()
2251 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2253 &adapter->fdir_list_head, in iavf_virtchnl_completion()
2256 dev_info(&adapter->pdev->dev, "Failed to add Flow Director filter, error %s\n", in iavf_virtchnl_completion()
2257 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2259 iavf_print_fdir_fltr(adapter, fdir); in iavf_virtchnl_completion()
2261 dev_err(&adapter->pdev->dev, in iavf_virtchnl_completion()
2264 iavf_dec_fdir_active_fltr(adapter, fdir); in iavf_virtchnl_completion()
2268 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2274 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2275 list_for_each_entry(fdir, &adapter->fdir_list_head, in iavf_virtchnl_completion()
2280 dev_info(&adapter->pdev->dev, "Failed to del Flow Director filter, error %s\n", in iavf_virtchnl_completion()
2281 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2283 iavf_print_fdir_fltr(adapter, fdir); in iavf_virtchnl_completion()
2286 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2292 spin_lock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2294 &adapter->adv_rss_list_head, in iavf_virtchnl_completion()
2297 iavf_print_adv_rss_cfg(adapter, rss, in iavf_virtchnl_completion()
2304 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2310 spin_lock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2311 list_for_each_entry(rss, &adapter->adv_rss_list_head, in iavf_virtchnl_completion()
2315 dev_err(&adapter->pdev->dev, "Failed to delete RSS configuration, error %s\n", in iavf_virtchnl_completion()
2316 iavf_stat_str(&adapter->hw, in iavf_virtchnl_completion()
2320 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2324 …dev_warn(&adapter->pdev->dev, "Changing VLAN Stripping is not allowed when Port VLAN is configured… in iavf_virtchnl_completion()
2331 …dev_warn(&adapter->pdev->dev, "Changing VLAN Stripping is not allowed when Port VLAN is configured… in iavf_virtchnl_completion()
2338 iavf_vlan_add_reject(adapter); in iavf_virtchnl_completion()
2339 dev_warn(&adapter->pdev->dev, "Failed to add VLAN filter, error %s\n", in iavf_virtchnl_completion()
2340 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2343 dev_warn(&adapter->pdev->dev, "Failed to configure hash function, error %s\n", in iavf_virtchnl_completion()
2344 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2346 if (adapter->hfunc == in iavf_virtchnl_completion()
2348 adapter->hfunc = in iavf_virtchnl_completion()
2351 adapter->hfunc = in iavf_virtchnl_completion()
2356 dev_warn(&adapter->pdev->dev, "Failed to Get Qos CAPs, error %s\n", in iavf_virtchnl_completion()
2357 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2360 dev_warn(&adapter->pdev->dev, "Failed to Config Quanta, error %s\n", in iavf_virtchnl_completion()
2361 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2364 dev_warn(&adapter->pdev->dev, "Failed to Config Queue BW, error %s\n", in iavf_virtchnl_completion()
2365 iavf_stat_str(&adapter->hw, v_retval)); in iavf_virtchnl_completion()
2368 dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n", in iavf_virtchnl_completion()
2369 v_retval, iavf_stat_str(&adapter->hw, v_retval), in iavf_virtchnl_completion()
2376 iavf_mac_add_ok(adapter); in iavf_virtchnl_completion()
2377 if (!ether_addr_equal(netdev->dev_addr, adapter->hw.mac.addr)) in iavf_virtchnl_completion()
2379 adapter->hw.mac.addr)) { in iavf_virtchnl_completion()
2381 eth_hw_addr_set(netdev, adapter->hw.mac.addr); in iavf_virtchnl_completion()
2384 wake_up(&adapter->vc_waitqueue); in iavf_virtchnl_completion()
2400 adapter->current_stats = *stats; in iavf_virtchnl_completion()
2406 memcpy(adapter->vf_res, msg, min(msglen, len)); in iavf_virtchnl_completion()
2407 iavf_validate_num_queues(adapter); in iavf_virtchnl_completion()
2408 iavf_vf_parse_hw_config(&adapter->hw, adapter->vf_res); in iavf_virtchnl_completion()
2409 if (is_zero_ether_addr(adapter->hw.mac.addr)) { in iavf_virtchnl_completion()
2411 ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr); in iavf_virtchnl_completion()
2416 adapter->hw.mac.addr); in iavf_virtchnl_completion()
2419 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2420 iavf_add_filter(adapter, adapter->hw.mac.addr); in iavf_virtchnl_completion()
2422 if (VLAN_ALLOWED(adapter)) { in iavf_virtchnl_completion()
2423 if (!list_empty(&adapter->vlan_filter_list)) { in iavf_virtchnl_completion()
2428 &adapter->vlan_filter_list, in iavf_virtchnl_completion()
2432 adapter->aq_required |= in iavf_virtchnl_completion()
2437 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2439 iavf_activate_fdir_filters(adapter); in iavf_virtchnl_completion()
2441 iavf_parse_vf_resource_msg(adapter); in iavf_virtchnl_completion()
2447 if (VLAN_V2_ALLOWED(adapter)) in iavf_virtchnl_completion()
2460 memcpy(&adapter->vlan_v2_caps, msg, in iavf_virtchnl_completion()
2462 sizeof(adapter->vlan_v2_caps))); in iavf_virtchnl_completion()
2464 iavf_process_config(adapter); in iavf_virtchnl_completion()
2465 adapter->flags |= IAVF_FLAG_SETUP_NETDEV_FEATURES; in iavf_virtchnl_completion()
2466 iavf_schedule_finish_config(adapter); in iavf_virtchnl_completion()
2468 iavf_set_queue_vlan_tag_loc(adapter); in iavf_virtchnl_completion()
2471 adapter->hw.mac.addr); in iavf_virtchnl_completion()
2473 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2476 list_for_each_entry(f, &adapter->mac_filter_list, list) { in iavf_virtchnl_completion()
2480 adapter->hw.mac.addr); in iavf_virtchnl_completion()
2489 if (VLAN_FILTERING_ALLOWED(adapter)) { in iavf_virtchnl_completion()
2492 if (!list_empty(&adapter->vlan_filter_list)) { in iavf_virtchnl_completion()
2494 &adapter->vlan_filter_list, in iavf_virtchnl_completion()
2502 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2505 eth_hw_addr_set(netdev, adapter->hw.mac.addr); in iavf_virtchnl_completion()
2508 adapter->aq_required |= IAVF_FLAG_AQ_ADD_MAC_FILTER | in iavf_virtchnl_completion()
2514 iavf_irq_enable(adapter, true); in iavf_virtchnl_completion()
2515 wake_up(&adapter->reset_waitqueue); in iavf_virtchnl_completion()
2516 adapter->flags &= ~IAVF_FLAG_QUEUES_DISABLED; in iavf_virtchnl_completion()
2519 iavf_free_all_tx_resources(adapter); in iavf_virtchnl_completion()
2520 iavf_free_all_rx_resources(adapter); in iavf_virtchnl_completion()
2521 if (adapter->state == __IAVF_DOWN_PENDING) { in iavf_virtchnl_completion()
2522 iavf_change_state(adapter, __IAVF_DOWN); in iavf_virtchnl_completion()
2523 wake_up(&adapter->down_waitqueue); in iavf_virtchnl_completion()
2532 if (v_opcode != adapter->current_op) in iavf_virtchnl_completion()
2539 adapter->hena = vrh->hena; in iavf_virtchnl_completion()
2541 dev_warn(&adapter->pdev->dev, in iavf_virtchnl_completion()
2549 if (vfres->num_queue_pairs != adapter->num_req_queues) { in iavf_virtchnl_completion()
2550 dev_info(&adapter->pdev->dev, in iavf_virtchnl_completion()
2552 adapter->num_req_queues, in iavf_virtchnl_completion()
2554 adapter->num_req_queues = 0; in iavf_virtchnl_completion()
2555 adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED; in iavf_virtchnl_completion()
2562 list_for_each_entry(cf, &adapter->cloud_filter_list, list) { in iavf_virtchnl_completion()
2571 list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, in iavf_virtchnl_completion()
2577 adapter->num_cloud_filters--; in iavf_virtchnl_completion()
2586 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2588 &adapter->fdir_list_head, in iavf_virtchnl_completion()
2593 dev_info(&adapter->pdev->dev, "Flow Director filter with location %u is added\n", in iavf_virtchnl_completion()
2596 dev_info(&adapter->pdev->dev, "Flow Director filter (raw) for TC handle %x is added\n", in iavf_virtchnl_completion()
2601 dev_info(&adapter->pdev->dev, "Failed to add Flow Director filter with status: %d\n", in iavf_virtchnl_completion()
2603 iavf_print_fdir_fltr(adapter, fdir); in iavf_virtchnl_completion()
2605 iavf_dec_fdir_active_fltr(adapter, fdir); in iavf_virtchnl_completion()
2610 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2617 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2618 list_for_each_entry_safe(fdir, fdir_tmp, &adapter->fdir_list_head, in iavf_virtchnl_completion()
2625 dev_info(&adapter->pdev->dev, "Flow Director filter with location %u is deleted\n", in iavf_virtchnl_completion()
2628 dev_info(&adapter->pdev->dev, "Flow Director filter (raw) for TC handle %x is deleted\n", in iavf_virtchnl_completion()
2631 iavf_dec_fdir_active_fltr(adapter, fdir); in iavf_virtchnl_completion()
2635 dev_info(&adapter->pdev->dev, "Failed to delete Flow Director filter with status: %d\n", in iavf_virtchnl_completion()
2637 iavf_print_fdir_fltr(adapter, fdir); in iavf_virtchnl_completion()
2646 dev_info(&adapter->pdev->dev, "Failed to disable Flow Director filter with status: %d\n", in iavf_virtchnl_completion()
2648 iavf_print_fdir_fltr(adapter, fdir); in iavf_virtchnl_completion()
2652 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_virtchnl_completion()
2658 spin_lock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2659 list_for_each_entry(rss, &adapter->adv_rss_list_head, list) { in iavf_virtchnl_completion()
2661 iavf_print_adv_rss_cfg(adapter, rss, in iavf_virtchnl_completion()
2667 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2673 spin_lock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2675 &adapter->adv_rss_list_head, list) { in iavf_virtchnl_completion()
2681 spin_unlock_bh(&adapter->adv_rss_lock); in iavf_virtchnl_completion()
2687 spin_lock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2688 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in iavf_virtchnl_completion()
2692 spin_unlock_bh(&adapter->mac_vlan_list_lock); in iavf_virtchnl_completion()
2710 u16 len = struct_size(adapter->qos_caps, cap, in iavf_virtchnl_completion()
2713 memcpy(adapter->qos_caps, msg, min(msglen, len)); in iavf_virtchnl_completion()
2715 adapter->aq_required |= IAVF_FLAG_AQ_CFG_QUEUES_QUANTA_SIZE; in iavf_virtchnl_completion()
2723 for (i = 0; i < adapter->num_active_queues; i++) in iavf_virtchnl_completion()
2724 adapter->tx_rings[i].q_shaper_update = false; in iavf_virtchnl_completion()
2728 if (adapter->current_op && (v_opcode != adapter->current_op)) in iavf_virtchnl_completion()
2729 dev_warn(&adapter->pdev->dev, "Expected response %d from PF, received %d\n", in iavf_virtchnl_completion()
2730 adapter->current_op, v_opcode); in iavf_virtchnl_completion()
2733 adapter->current_op = VIRTCHNL_OP_UNKNOWN; in iavf_virtchnl_completion()