• Home
  • Raw
  • Download

Lines Matching refs:adapter

29 static int i40evf_setup_all_tx_resources(struct i40evf_adapter *adapter);
30 static int i40evf_setup_all_rx_resources(struct i40evf_adapter *adapter);
87 struct i40evf_adapter *adapter = (struct i40evf_adapter *)hw->back; in i40evf_allocate_dma_mem_d() local
93 mem->va = dma_alloc_coherent(&adapter->pdev->dev, mem->size, in i40evf_allocate_dma_mem_d()
108 struct i40evf_adapter *adapter = (struct i40evf_adapter *)hw->back; in i40evf_free_dma_mem_d() local
112 dma_free_coherent(&adapter->pdev->dev, mem->size, in i40evf_free_dma_mem_d()
181 void i40evf_schedule_reset(struct i40evf_adapter *adapter) in i40evf_schedule_reset() argument
183 if (!(adapter->flags & in i40evf_schedule_reset()
185 adapter->flags |= I40EVF_FLAG_RESET_NEEDED; in i40evf_schedule_reset()
186 schedule_work(&adapter->reset_task); in i40evf_schedule_reset()
196 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_tx_timeout() local
198 adapter->tx_timeout_count++; in i40evf_tx_timeout()
199 i40evf_schedule_reset(adapter); in i40evf_tx_timeout()
206 static void i40evf_misc_irq_disable(struct i40evf_adapter *adapter) in i40evf_misc_irq_disable() argument
208 struct i40e_hw *hw = &adapter->hw; in i40evf_misc_irq_disable()
215 synchronize_irq(adapter->msix_entries[0].vector); in i40evf_misc_irq_disable()
222 static void i40evf_misc_irq_enable(struct i40evf_adapter *adapter) in i40evf_misc_irq_enable() argument
224 struct i40e_hw *hw = &adapter->hw; in i40evf_misc_irq_enable()
238 static void i40evf_irq_disable(struct i40evf_adapter *adapter) in i40evf_irq_disable() argument
241 struct i40e_hw *hw = &adapter->hw; in i40evf_irq_disable()
243 if (!adapter->msix_entries) in i40evf_irq_disable()
246 for (i = 1; i < adapter->num_msix_vectors; i++) { in i40evf_irq_disable()
248 synchronize_irq(adapter->msix_entries[i].vector); in i40evf_irq_disable()
259 void i40evf_irq_enable_queues(struct i40evf_adapter *adapter, u32 mask) in i40evf_irq_enable_queues() argument
261 struct i40e_hw *hw = &adapter->hw; in i40evf_irq_enable_queues()
264 for (i = 1; i < adapter->num_msix_vectors; i++) { in i40evf_irq_enable_queues()
279 static void i40evf_fire_sw_int(struct i40evf_adapter *adapter, u32 mask) in i40evf_fire_sw_int() argument
281 struct i40e_hw *hw = &adapter->hw; in i40evf_fire_sw_int()
292 for (i = 1; i < adapter->num_msix_vectors; i++) { in i40evf_fire_sw_int()
308 void i40evf_irq_enable(struct i40evf_adapter *adapter, bool flush) in i40evf_irq_enable() argument
310 struct i40e_hw *hw = &adapter->hw; in i40evf_irq_enable()
312 i40evf_misc_irq_enable(adapter); in i40evf_irq_enable()
313 i40evf_irq_enable_queues(adapter, ~0); in i40evf_irq_enable()
327 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_msix_aq() local
328 struct i40e_hw *hw = &adapter->hw; in i40evf_msix_aq()
340 schedule_work(&adapter->adminq_task); in i40evf_msix_aq()
369 i40evf_map_vector_to_rxq(struct i40evf_adapter *adapter, int v_idx, int r_idx) in i40evf_map_vector_to_rxq() argument
371 struct i40e_q_vector *q_vector = &adapter->q_vectors[v_idx]; in i40evf_map_vector_to_rxq()
372 struct i40e_ring *rx_ring = &adapter->rx_rings[r_idx]; in i40evf_map_vector_to_rxq()
373 struct i40e_hw *hw = &adapter->hw; in i40evf_map_vector_to_rxq()
377 rx_ring->vsi = &adapter->vsi; in i40evf_map_vector_to_rxq()
394 i40evf_map_vector_to_txq(struct i40evf_adapter *adapter, int v_idx, int t_idx) in i40evf_map_vector_to_txq() argument
396 struct i40e_q_vector *q_vector = &adapter->q_vectors[v_idx]; in i40evf_map_vector_to_txq()
397 struct i40e_ring *tx_ring = &adapter->tx_rings[t_idx]; in i40evf_map_vector_to_txq()
398 struct i40e_hw *hw = &adapter->hw; in i40evf_map_vector_to_txq()
402 tx_ring->vsi = &adapter->vsi; in i40evf_map_vector_to_txq()
422 static int i40evf_map_rings_to_vectors(struct i40evf_adapter *adapter) in i40evf_map_rings_to_vectors() argument
427 int rxr_remaining = adapter->num_active_queues; in i40evf_map_rings_to_vectors()
428 int txr_remaining = adapter->num_active_queues; in i40evf_map_rings_to_vectors()
433 q_vectors = adapter->num_msix_vectors - NONQ_VECS; in i40evf_map_rings_to_vectors()
440 i40evf_map_vector_to_rxq(adapter, v_start, rxr_idx); in i40evf_map_rings_to_vectors()
443 i40evf_map_vector_to_txq(adapter, v_start, txr_idx); in i40evf_map_rings_to_vectors()
455 i40evf_map_vector_to_rxq(adapter, i, rxr_idx); in i40evf_map_rings_to_vectors()
463 i40evf_map_vector_to_txq(adapter, i, txr_idx); in i40evf_map_rings_to_vectors()
470 adapter->aq_required |= I40EVF_FLAG_AQ_MAP_VECTORS; in i40evf_map_rings_to_vectors()
485 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_netpoll() local
486 int q_vectors = adapter->num_msix_vectors - NONQ_VECS; in i40evf_netpoll()
490 if (test_bit(__I40E_DOWN, &adapter->vsi.state)) in i40evf_netpoll()
494 i40evf_msix_clean_rings(0, &adapter->q_vectors[i]); in i40evf_netpoll()
506 i40evf_request_traffic_irqs(struct i40evf_adapter *adapter, char *basename) in i40evf_request_traffic_irqs() argument
511 i40evf_irq_disable(adapter); in i40evf_request_traffic_irqs()
513 q_vectors = adapter->num_msix_vectors - NONQ_VECS; in i40evf_request_traffic_irqs()
516 struct i40e_q_vector *q_vector = &adapter->q_vectors[vector]; in i40evf_request_traffic_irqs()
536 adapter->msix_entries[vector + NONQ_VECS].vector, in i40evf_request_traffic_irqs()
542 dev_info(&adapter->pdev->dev, in i40evf_request_traffic_irqs()
548 adapter->msix_entries[vector + NONQ_VECS].vector, in i40evf_request_traffic_irqs()
558 adapter->msix_entries[vector + NONQ_VECS].vector, in i40evf_request_traffic_irqs()
560 free_irq(adapter->msix_entries[vector + NONQ_VECS].vector, in i40evf_request_traffic_irqs()
561 &adapter->q_vectors[vector]); in i40evf_request_traffic_irqs()
574 static int i40evf_request_misc_irq(struct i40evf_adapter *adapter) in i40evf_request_misc_irq() argument
576 struct net_device *netdev = adapter->netdev; in i40evf_request_misc_irq()
579 snprintf(adapter->misc_vector_name, in i40evf_request_misc_irq()
580 sizeof(adapter->misc_vector_name) - 1, "i40evf-%s:mbx", in i40evf_request_misc_irq()
581 dev_name(&adapter->pdev->dev)); in i40evf_request_misc_irq()
582 err = request_irq(adapter->msix_entries[0].vector, in i40evf_request_misc_irq()
584 adapter->misc_vector_name, netdev); in i40evf_request_misc_irq()
586 dev_err(&adapter->pdev->dev, in i40evf_request_misc_irq()
588 adapter->misc_vector_name, err); in i40evf_request_misc_irq()
589 free_irq(adapter->msix_entries[0].vector, netdev); in i40evf_request_misc_irq()
600 static void i40evf_free_traffic_irqs(struct i40evf_adapter *adapter) in i40evf_free_traffic_irqs() argument
605 q_vectors = adapter->num_msix_vectors - NONQ_VECS; in i40evf_free_traffic_irqs()
608 irq_set_affinity_hint(adapter->msix_entries[i+1].vector, in i40evf_free_traffic_irqs()
610 free_irq(adapter->msix_entries[i+1].vector, in i40evf_free_traffic_irqs()
611 &adapter->q_vectors[i]); in i40evf_free_traffic_irqs()
621 static void i40evf_free_misc_irq(struct i40evf_adapter *adapter) in i40evf_free_misc_irq() argument
623 struct net_device *netdev = adapter->netdev; in i40evf_free_misc_irq()
625 free_irq(adapter->msix_entries[0].vector, netdev); in i40evf_free_misc_irq()
634 static void i40evf_configure_tx(struct i40evf_adapter *adapter) in i40evf_configure_tx() argument
636 struct i40e_hw *hw = &adapter->hw; in i40evf_configure_tx()
639 for (i = 0; i < adapter->num_active_queues; i++) in i40evf_configure_tx()
640 adapter->tx_rings[i].tail = hw->hw_addr + I40E_QTX_TAIL1(i); in i40evf_configure_tx()
649 static void i40evf_configure_rx(struct i40evf_adapter *adapter) in i40evf_configure_rx() argument
651 struct i40e_hw *hw = &adapter->hw; in i40evf_configure_rx()
654 for (i = 0; i < adapter->num_active_queues; i++) { in i40evf_configure_rx()
655 adapter->rx_rings[i].tail = hw->hw_addr + I40E_QRX_TAIL1(i); in i40evf_configure_rx()
656 adapter->rx_rings[i].rx_buf_len = I40EVF_RXBUFFER_2048; in i40evf_configure_rx()
668 i40evf_vlan_filter *i40evf_find_vlan(struct i40evf_adapter *adapter, u16 vlan) in i40evf_find_vlan() argument
672 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in i40evf_find_vlan()
687 i40evf_vlan_filter *i40evf_add_vlan(struct i40evf_adapter *adapter, u16 vlan) in i40evf_add_vlan() argument
693 &adapter->crit_section)) { in i40evf_add_vlan()
699 f = i40evf_find_vlan(adapter, vlan); in i40evf_add_vlan()
708 list_add(&f->list, &adapter->vlan_filter_list); in i40evf_add_vlan()
710 adapter->aq_required |= I40EVF_FLAG_AQ_ADD_VLAN_FILTER; in i40evf_add_vlan()
714 clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); in i40evf_add_vlan()
724 static void i40evf_del_vlan(struct i40evf_adapter *adapter, u16 vlan) in i40evf_del_vlan() argument
730 &adapter->crit_section)) { in i40evf_del_vlan()
736 f = i40evf_find_vlan(adapter, vlan); in i40evf_del_vlan()
739 adapter->aq_required |= I40EVF_FLAG_AQ_DEL_VLAN_FILTER; in i40evf_del_vlan()
741 clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); in i40evf_del_vlan()
752 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_vlan_rx_add_vid() local
754 if (!VLAN_ALLOWED(adapter)) in i40evf_vlan_rx_add_vid()
756 if (i40evf_add_vlan(adapter, vid) == NULL) in i40evf_vlan_rx_add_vid()
769 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_vlan_rx_kill_vid() local
771 if (VLAN_ALLOWED(adapter)) { in i40evf_vlan_rx_kill_vid()
772 i40evf_del_vlan(adapter, vid); in i40evf_vlan_rx_kill_vid()
786 i40evf_mac_filter *i40evf_find_filter(struct i40evf_adapter *adapter, in i40evf_find_filter() argument
794 list_for_each_entry(f, &adapter->mac_filter_list, list) { in i40evf_find_filter()
809 i40evf_mac_filter *i40evf_add_filter(struct i40evf_adapter *adapter, in i40evf_add_filter() argument
819 &adapter->crit_section)) { in i40evf_add_filter()
825 f = i40evf_find_filter(adapter, macaddr); in i40evf_add_filter()
830 &adapter->crit_section); in i40evf_add_filter()
836 list_add_tail(&f->list, &adapter->mac_filter_list); in i40evf_add_filter()
838 adapter->aq_required |= I40EVF_FLAG_AQ_ADD_MAC_FILTER; in i40evf_add_filter()
841 clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); in i40evf_add_filter()
854 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_set_mac() local
855 struct i40e_hw *hw = &adapter->hw; in i40evf_set_mac()
865 if (adapter->flags & I40EVF_FLAG_ADDR_SET_BY_PF) in i40evf_set_mac()
868 f = i40evf_find_filter(adapter, hw->mac.addr); in i40evf_set_mac()
871 adapter->aq_required |= I40EVF_FLAG_AQ_DEL_MAC_FILTER; in i40evf_set_mac()
874 f = i40evf_add_filter(adapter, addr->sa_data); in i40evf_set_mac()
877 ether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr); in i40evf_set_mac()
889 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_set_rx_mode() local
898 i40evf_add_filter(adapter, uca->addr); in i40evf_set_rx_mode()
901 i40evf_add_filter(adapter, mca->addr); in i40evf_set_rx_mode()
905 &adapter->crit_section)) { in i40evf_set_rx_mode()
908 dev_err(&adapter->pdev->dev, in i40evf_set_rx_mode()
914 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { in i40evf_set_rx_mode()
927 if (ether_addr_equal(f->macaddr, adapter->hw.mac.addr)) in i40evf_set_rx_mode()
932 adapter->aq_required |= I40EVF_FLAG_AQ_DEL_MAC_FILTER; in i40evf_set_rx_mode()
939 !(adapter->flags & I40EVF_FLAG_PROMISC_ON)) in i40evf_set_rx_mode()
940 adapter->aq_required |= I40EVF_FLAG_AQ_REQUEST_PROMISC; in i40evf_set_rx_mode()
942 adapter->flags & I40EVF_FLAG_PROMISC_ON) in i40evf_set_rx_mode()
943 adapter->aq_required |= I40EVF_FLAG_AQ_RELEASE_PROMISC; in i40evf_set_rx_mode()
946 !(adapter->flags & I40EVF_FLAG_ALLMULTI_ON)) in i40evf_set_rx_mode()
947 adapter->aq_required |= I40EVF_FLAG_AQ_REQUEST_ALLMULTI; in i40evf_set_rx_mode()
949 adapter->flags & I40EVF_FLAG_ALLMULTI_ON) in i40evf_set_rx_mode()
950 adapter->aq_required |= I40EVF_FLAG_AQ_RELEASE_ALLMULTI; in i40evf_set_rx_mode()
952 clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); in i40evf_set_rx_mode()
959 static void i40evf_napi_enable_all(struct i40evf_adapter *adapter) in i40evf_napi_enable_all() argument
963 int q_vectors = adapter->num_msix_vectors - NONQ_VECS; in i40evf_napi_enable_all()
968 q_vector = &adapter->q_vectors[q_idx]; in i40evf_napi_enable_all()
978 static void i40evf_napi_disable_all(struct i40evf_adapter *adapter) in i40evf_napi_disable_all() argument
982 int q_vectors = adapter->num_msix_vectors - NONQ_VECS; in i40evf_napi_disable_all()
985 q_vector = &adapter->q_vectors[q_idx]; in i40evf_napi_disable_all()
994 static void i40evf_configure(struct i40evf_adapter *adapter) in i40evf_configure() argument
996 struct net_device *netdev = adapter->netdev; in i40evf_configure()
1001 i40evf_configure_tx(adapter); in i40evf_configure()
1002 i40evf_configure_rx(adapter); in i40evf_configure()
1003 adapter->aq_required |= I40EVF_FLAG_AQ_CONFIGURE_QUEUES; in i40evf_configure()
1005 for (i = 0; i < adapter->num_active_queues; i++) { in i40evf_configure()
1006 struct i40e_ring *ring = &adapter->rx_rings[i]; in i40evf_configure()
1016 static void i40evf_up_complete(struct i40evf_adapter *adapter) in i40evf_up_complete() argument
1018 adapter->state = __I40EVF_RUNNING; in i40evf_up_complete()
1019 clear_bit(__I40E_DOWN, &adapter->vsi.state); in i40evf_up_complete()
1021 i40evf_napi_enable_all(adapter); in i40evf_up_complete()
1023 adapter->aq_required |= I40EVF_FLAG_AQ_ENABLE_QUEUES; in i40evf_up_complete()
1024 mod_timer_pending(&adapter->watchdog_timer, jiffies + 1); in i40evf_up_complete()
1031 void i40evf_down(struct i40evf_adapter *adapter) in i40evf_down() argument
1033 struct net_device *netdev = adapter->netdev; in i40evf_down()
1036 if (adapter->state <= __I40EVF_DOWN_PENDING) in i40evf_down()
1040 &adapter->crit_section)) in i40evf_down()
1045 adapter->link_up = false; in i40evf_down()
1046 i40evf_napi_disable_all(adapter); in i40evf_down()
1047 i40evf_irq_disable(adapter); in i40evf_down()
1050 list_for_each_entry(f, &adapter->mac_filter_list, list) { in i40evf_down()
1054 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in i40evf_down()
1057 if (!(adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED) && in i40evf_down()
1058 adapter->state != __I40EVF_RESETTING) { in i40evf_down()
1060 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; in i40evf_down()
1065 adapter->aq_required = I40EVF_FLAG_AQ_DEL_MAC_FILTER; in i40evf_down()
1066 adapter->aq_required |= I40EVF_FLAG_AQ_DEL_VLAN_FILTER; in i40evf_down()
1067 adapter->aq_required |= I40EVF_FLAG_AQ_DISABLE_QUEUES; in i40evf_down()
1070 clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); in i40evf_down()
1083 i40evf_acquire_msix_vectors(struct i40evf_adapter *adapter, int vectors) in i40evf_acquire_msix_vectors() argument
1099 err = pci_enable_msix_range(adapter->pdev, adapter->msix_entries, in i40evf_acquire_msix_vectors()
1102 dev_err(&adapter->pdev->dev, "Unable to allocate MSI-X interrupts\n"); in i40evf_acquire_msix_vectors()
1103 kfree(adapter->msix_entries); in i40evf_acquire_msix_vectors()
1104 adapter->msix_entries = NULL; in i40evf_acquire_msix_vectors()
1112 adapter->num_msix_vectors = err; in i40evf_acquire_msix_vectors()
1122 static void i40evf_free_queues(struct i40evf_adapter *adapter) in i40evf_free_queues() argument
1124 if (!adapter->vsi_res) in i40evf_free_queues()
1126 kfree(adapter->tx_rings); in i40evf_free_queues()
1127 adapter->tx_rings = NULL; in i40evf_free_queues()
1128 kfree(adapter->rx_rings); in i40evf_free_queues()
1129 adapter->rx_rings = NULL; in i40evf_free_queues()
1140 static int i40evf_alloc_queues(struct i40evf_adapter *adapter) in i40evf_alloc_queues() argument
1144 adapter->tx_rings = kcalloc(adapter->num_active_queues, in i40evf_alloc_queues()
1146 if (!adapter->tx_rings) in i40evf_alloc_queues()
1148 adapter->rx_rings = kcalloc(adapter->num_active_queues, in i40evf_alloc_queues()
1150 if (!adapter->rx_rings) in i40evf_alloc_queues()
1153 for (i = 0; i < adapter->num_active_queues; i++) { in i40evf_alloc_queues()
1157 tx_ring = &adapter->tx_rings[i]; in i40evf_alloc_queues()
1160 tx_ring->netdev = adapter->netdev; in i40evf_alloc_queues()
1161 tx_ring->dev = &adapter->pdev->dev; in i40evf_alloc_queues()
1162 tx_ring->count = adapter->tx_desc_count; in i40evf_alloc_queues()
1164 if (adapter->flags & I40E_FLAG_WB_ON_ITR_CAPABLE) in i40evf_alloc_queues()
1167 rx_ring = &adapter->rx_rings[i]; in i40evf_alloc_queues()
1169 rx_ring->netdev = adapter->netdev; in i40evf_alloc_queues()
1170 rx_ring->dev = &adapter->pdev->dev; in i40evf_alloc_queues()
1171 rx_ring->count = adapter->rx_desc_count; in i40evf_alloc_queues()
1178 i40evf_free_queues(adapter); in i40evf_alloc_queues()
1189 static int i40evf_set_interrupt_capability(struct i40evf_adapter *adapter) in i40evf_set_interrupt_capability() argument
1195 if (!adapter->vsi_res) { in i40evf_set_interrupt_capability()
1199 pairs = adapter->num_active_queues; in i40evf_set_interrupt_capability()
1207 v_budget = min_t(int, v_budget, (int)adapter->vf_res->max_vectors); in i40evf_set_interrupt_capability()
1209 adapter->msix_entries = kcalloc(v_budget, in i40evf_set_interrupt_capability()
1211 if (!adapter->msix_entries) { in i40evf_set_interrupt_capability()
1217 adapter->msix_entries[vector].entry = vector; in i40evf_set_interrupt_capability()
1219 err = i40evf_acquire_msix_vectors(adapter, v_budget); in i40evf_set_interrupt_capability()
1222 netif_set_real_num_rx_queues(adapter->netdev, pairs); in i40evf_set_interrupt_capability()
1223 netif_set_real_num_tx_queues(adapter->netdev, pairs); in i40evf_set_interrupt_capability()
1233 static int i40evf_config_rss_aq(struct i40evf_adapter *adapter) in i40evf_config_rss_aq() argument
1236 (struct i40e_aqc_get_set_rss_key_data *)adapter->rss_key; in i40evf_config_rss_aq()
1237 struct i40e_hw *hw = &adapter->hw; in i40evf_config_rss_aq()
1240 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_config_rss_aq()
1242 dev_err(&adapter->pdev->dev, "Cannot configure RSS, command %d pending\n", in i40evf_config_rss_aq()
1243 adapter->current_op); in i40evf_config_rss_aq()
1247 ret = i40evf_aq_set_rss_key(hw, adapter->vsi.id, rss_key); in i40evf_config_rss_aq()
1249 dev_err(&adapter->pdev->dev, "Cannot set RSS key, err %s aq_err %s\n", in i40evf_config_rss_aq()
1256 ret = i40evf_aq_set_rss_lut(hw, adapter->vsi.id, false, in i40evf_config_rss_aq()
1257 adapter->rss_lut, adapter->rss_lut_size); in i40evf_config_rss_aq()
1259 dev_err(&adapter->pdev->dev, "Cannot set RSS lut, err %s aq_err %s\n", in i40evf_config_rss_aq()
1274 static int i40evf_config_rss_reg(struct i40evf_adapter *adapter) in i40evf_config_rss_reg() argument
1276 struct i40e_hw *hw = &adapter->hw; in i40evf_config_rss_reg()
1280 dw = (u32 *)adapter->rss_key; in i40evf_config_rss_reg()
1281 for (i = 0; i <= adapter->rss_key_size / 4; i++) in i40evf_config_rss_reg()
1284 dw = (u32 *)adapter->rss_lut; in i40evf_config_rss_reg()
1285 for (i = 0; i <= adapter->rss_lut_size / 4; i++) in i40evf_config_rss_reg()
1299 int i40evf_config_rss(struct i40evf_adapter *adapter) in i40evf_config_rss() argument
1302 if (RSS_PF(adapter)) { in i40evf_config_rss()
1303 adapter->aq_required |= I40EVF_FLAG_AQ_SET_RSS_LUT | in i40evf_config_rss()
1306 } else if (RSS_AQ(adapter)) { in i40evf_config_rss()
1307 return i40evf_config_rss_aq(adapter); in i40evf_config_rss()
1309 return i40evf_config_rss_reg(adapter); in i40evf_config_rss()
1317 static void i40evf_fill_rss_lut(struct i40evf_adapter *adapter) in i40evf_fill_rss_lut() argument
1321 for (i = 0; i < adapter->rss_lut_size; i++) in i40evf_fill_rss_lut()
1322 adapter->rss_lut[i] = i % adapter->num_active_queues; in i40evf_fill_rss_lut()
1331 static int i40evf_init_rss(struct i40evf_adapter *adapter) in i40evf_init_rss() argument
1333 struct i40e_hw *hw = &adapter->hw; in i40evf_init_rss()
1336 if (!RSS_PF(adapter)) { in i40evf_init_rss()
1338 if (adapter->vf_res->vf_offload_flags & in i40evf_init_rss()
1340 adapter->hena = I40E_DEFAULT_RSS_HENA_EXPANDED; in i40evf_init_rss()
1342 adapter->hena = I40E_DEFAULT_RSS_HENA; in i40evf_init_rss()
1344 wr32(hw, I40E_VFQF_HENA(0), (u32)adapter->hena); in i40evf_init_rss()
1345 wr32(hw, I40E_VFQF_HENA(1), (u32)(adapter->hena >> 32)); in i40evf_init_rss()
1348 i40evf_fill_rss_lut(adapter); in i40evf_init_rss()
1350 netdev_rss_key_fill((void *)adapter->rss_key, adapter->rss_key_size); in i40evf_init_rss()
1351 ret = i40evf_config_rss(adapter); in i40evf_init_rss()
1363 static int i40evf_alloc_q_vectors(struct i40evf_adapter *adapter) in i40evf_alloc_q_vectors() argument
1368 num_q_vectors = adapter->num_msix_vectors - NONQ_VECS; in i40evf_alloc_q_vectors()
1369 adapter->q_vectors = kcalloc(num_q_vectors, sizeof(*q_vector), in i40evf_alloc_q_vectors()
1371 if (!adapter->q_vectors) in i40evf_alloc_q_vectors()
1375 q_vector = &adapter->q_vectors[q_idx]; in i40evf_alloc_q_vectors()
1376 q_vector->adapter = adapter; in i40evf_alloc_q_vectors()
1377 q_vector->vsi = &adapter->vsi; in i40evf_alloc_q_vectors()
1379 netif_napi_add(adapter->netdev, &q_vector->napi, in i40evf_alloc_q_vectors()
1394 static void i40evf_free_q_vectors(struct i40evf_adapter *adapter) in i40evf_free_q_vectors() argument
1399 num_q_vectors = adapter->num_msix_vectors - NONQ_VECS; in i40evf_free_q_vectors()
1400 napi_vectors = adapter->num_active_queues; in i40evf_free_q_vectors()
1403 struct i40e_q_vector *q_vector = &adapter->q_vectors[q_idx]; in i40evf_free_q_vectors()
1407 kfree(adapter->q_vectors); in i40evf_free_q_vectors()
1415 void i40evf_reset_interrupt_capability(struct i40evf_adapter *adapter) in i40evf_reset_interrupt_capability() argument
1417 pci_disable_msix(adapter->pdev); in i40evf_reset_interrupt_capability()
1418 kfree(adapter->msix_entries); in i40evf_reset_interrupt_capability()
1419 adapter->msix_entries = NULL; in i40evf_reset_interrupt_capability()
1427 int i40evf_init_interrupt_scheme(struct i40evf_adapter *adapter) in i40evf_init_interrupt_scheme() argument
1432 err = i40evf_set_interrupt_capability(adapter); in i40evf_init_interrupt_scheme()
1435 dev_err(&adapter->pdev->dev, in i40evf_init_interrupt_scheme()
1440 err = i40evf_alloc_q_vectors(adapter); in i40evf_init_interrupt_scheme()
1442 dev_err(&adapter->pdev->dev, in i40evf_init_interrupt_scheme()
1447 err = i40evf_alloc_queues(adapter); in i40evf_init_interrupt_scheme()
1449 dev_err(&adapter->pdev->dev, in i40evf_init_interrupt_scheme()
1454 dev_info(&adapter->pdev->dev, "Multiqueue %s: Queue pair count = %u", in i40evf_init_interrupt_scheme()
1455 (adapter->num_active_queues > 1) ? "Enabled" : "Disabled", in i40evf_init_interrupt_scheme()
1456 adapter->num_active_queues); in i40evf_init_interrupt_scheme()
1460 i40evf_free_q_vectors(adapter); in i40evf_init_interrupt_scheme()
1462 i40evf_reset_interrupt_capability(adapter); in i40evf_init_interrupt_scheme()
1471 static void i40evf_free_rss(struct i40evf_adapter *adapter) in i40evf_free_rss() argument
1473 kfree(adapter->rss_key); in i40evf_free_rss()
1474 adapter->rss_key = NULL; in i40evf_free_rss()
1476 kfree(adapter->rss_lut); in i40evf_free_rss()
1477 adapter->rss_lut = NULL; in i40evf_free_rss()
1486 struct i40evf_adapter *adapter = (struct i40evf_adapter *)data; in i40evf_watchdog_timer() local
1488 schedule_work(&adapter->watchdog_task); in i40evf_watchdog_timer()
1498 struct i40evf_adapter *adapter = container_of(work, in i40evf_watchdog_task() local
1501 struct i40e_hw *hw = &adapter->hw; in i40evf_watchdog_task()
1504 if (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section)) in i40evf_watchdog_task()
1507 if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED) { in i40evf_watchdog_task()
1513 dev_err(&adapter->pdev->dev, "Hardware came out of reset. Attempting reinit.\n"); in i40evf_watchdog_task()
1514 adapter->state = __I40EVF_STARTUP; in i40evf_watchdog_task()
1515 adapter->flags &= ~I40EVF_FLAG_PF_COMMS_FAILED; in i40evf_watchdog_task()
1516 schedule_delayed_work(&adapter->init_task, 10); in i40evf_watchdog_task()
1518 &adapter->crit_section); in i40evf_watchdog_task()
1526 adapter->aq_required = 0; in i40evf_watchdog_task()
1527 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; in i40evf_watchdog_task()
1531 if ((adapter->state < __I40EVF_DOWN) || in i40evf_watchdog_task()
1532 (adapter->flags & I40EVF_FLAG_RESET_PENDING)) in i40evf_watchdog_task()
1537 if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING) && !reg_val) { in i40evf_watchdog_task()
1538 adapter->state = __I40EVF_RESETTING; in i40evf_watchdog_task()
1539 adapter->flags |= I40EVF_FLAG_RESET_PENDING; in i40evf_watchdog_task()
1540 dev_err(&adapter->pdev->dev, "Hardware reset detected\n"); in i40evf_watchdog_task()
1541 schedule_work(&adapter->reset_task); in i40evf_watchdog_task()
1542 adapter->aq_required = 0; in i40evf_watchdog_task()
1543 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; in i40evf_watchdog_task()
1550 if (adapter->current_op) { in i40evf_watchdog_task()
1552 dev_dbg(&adapter->pdev->dev, "Admin queue timeout\n"); in i40evf_watchdog_task()
1553 i40evf_send_api_ver(adapter); in i40evf_watchdog_task()
1557 if (adapter->aq_required & I40EVF_FLAG_AQ_GET_CONFIG) { in i40evf_watchdog_task()
1558 i40evf_send_vf_config_msg(adapter); in i40evf_watchdog_task()
1562 if (adapter->aq_required & I40EVF_FLAG_AQ_DISABLE_QUEUES) { in i40evf_watchdog_task()
1563 i40evf_disable_queues(adapter); in i40evf_watchdog_task()
1567 if (adapter->aq_required & I40EVF_FLAG_AQ_MAP_VECTORS) { in i40evf_watchdog_task()
1568 i40evf_map_queues(adapter); in i40evf_watchdog_task()
1572 if (adapter->aq_required & I40EVF_FLAG_AQ_ADD_MAC_FILTER) { in i40evf_watchdog_task()
1573 i40evf_add_ether_addrs(adapter); in i40evf_watchdog_task()
1577 if (adapter->aq_required & I40EVF_FLAG_AQ_ADD_VLAN_FILTER) { in i40evf_watchdog_task()
1578 i40evf_add_vlans(adapter); in i40evf_watchdog_task()
1582 if (adapter->aq_required & I40EVF_FLAG_AQ_DEL_MAC_FILTER) { in i40evf_watchdog_task()
1583 i40evf_del_ether_addrs(adapter); in i40evf_watchdog_task()
1587 if (adapter->aq_required & I40EVF_FLAG_AQ_DEL_VLAN_FILTER) { in i40evf_watchdog_task()
1588 i40evf_del_vlans(adapter); in i40evf_watchdog_task()
1592 if (adapter->aq_required & I40EVF_FLAG_AQ_CONFIGURE_QUEUES) { in i40evf_watchdog_task()
1593 i40evf_configure_queues(adapter); in i40evf_watchdog_task()
1597 if (adapter->aq_required & I40EVF_FLAG_AQ_ENABLE_QUEUES) { in i40evf_watchdog_task()
1598 i40evf_enable_queues(adapter); in i40evf_watchdog_task()
1602 if (adapter->aq_required & I40EVF_FLAG_AQ_CONFIGURE_RSS) { in i40evf_watchdog_task()
1607 i40evf_init_rss(adapter); in i40evf_watchdog_task()
1608 adapter->aq_required &= ~I40EVF_FLAG_AQ_CONFIGURE_RSS; in i40evf_watchdog_task()
1611 if (adapter->aq_required & I40EVF_FLAG_AQ_GET_HENA) { in i40evf_watchdog_task()
1612 i40evf_get_hena(adapter); in i40evf_watchdog_task()
1615 if (adapter->aq_required & I40EVF_FLAG_AQ_SET_HENA) { in i40evf_watchdog_task()
1616 i40evf_set_hena(adapter); in i40evf_watchdog_task()
1619 if (adapter->aq_required & I40EVF_FLAG_AQ_SET_RSS_KEY) { in i40evf_watchdog_task()
1620 i40evf_set_rss_key(adapter); in i40evf_watchdog_task()
1623 if (adapter->aq_required & I40EVF_FLAG_AQ_SET_RSS_LUT) { in i40evf_watchdog_task()
1624 i40evf_set_rss_lut(adapter); in i40evf_watchdog_task()
1628 if (adapter->aq_required & I40EVF_FLAG_AQ_REQUEST_PROMISC) { in i40evf_watchdog_task()
1629 i40evf_set_promiscuous(adapter, I40E_FLAG_VF_UNICAST_PROMISC | in i40evf_watchdog_task()
1634 if (adapter->aq_required & I40EVF_FLAG_AQ_REQUEST_ALLMULTI) { in i40evf_watchdog_task()
1635 i40evf_set_promiscuous(adapter, I40E_FLAG_VF_MULTICAST_PROMISC); in i40evf_watchdog_task()
1639 if ((adapter->aq_required & I40EVF_FLAG_AQ_RELEASE_PROMISC) && in i40evf_watchdog_task()
1640 (adapter->aq_required & I40EVF_FLAG_AQ_RELEASE_ALLMULTI)) { in i40evf_watchdog_task()
1641 i40evf_set_promiscuous(adapter, 0); in i40evf_watchdog_task()
1645 if (adapter->state == __I40EVF_RUNNING) in i40evf_watchdog_task()
1646 i40evf_request_stats(adapter); in i40evf_watchdog_task()
1648 if (adapter->state == __I40EVF_RUNNING) { in i40evf_watchdog_task()
1649 i40evf_irq_enable_queues(adapter, ~0); in i40evf_watchdog_task()
1650 i40evf_fire_sw_int(adapter, 0xFF); in i40evf_watchdog_task()
1652 i40evf_fire_sw_int(adapter, 0x1); in i40evf_watchdog_task()
1655 clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); in i40evf_watchdog_task()
1657 if (adapter->state == __I40EVF_REMOVE) in i40evf_watchdog_task()
1659 if (adapter->aq_required) in i40evf_watchdog_task()
1660 mod_timer(&adapter->watchdog_timer, in i40evf_watchdog_task()
1663 mod_timer(&adapter->watchdog_timer, jiffies + (HZ * 2)); in i40evf_watchdog_task()
1664 schedule_work(&adapter->adminq_task); in i40evf_watchdog_task()
1679 struct i40evf_adapter *adapter = container_of(work, in i40evf_reset_task() local
1682 struct net_device *netdev = adapter->netdev; in i40evf_reset_task()
1683 struct i40e_hw *hw = &adapter->hw; in i40evf_reset_task()
1690 &adapter->crit_section)) in i40evf_reset_task()
1693 i40evf_misc_irq_disable(adapter); in i40evf_reset_task()
1694 if (adapter->flags & I40EVF_FLAG_RESET_NEEDED) { in i40evf_reset_task()
1695 adapter->flags &= ~I40EVF_FLAG_RESET_NEEDED; in i40evf_reset_task()
1701 i40evf_request_reset(adapter); in i40evf_reset_task()
1703 adapter->flags |= I40EVF_FLAG_RESET_PENDING; in i40evf_reset_task()
1714 dev_info(&adapter->pdev->dev, "Never saw reset\n"); in i40evf_reset_task()
1726 pci_set_master(adapter->pdev); in i40evf_reset_task()
1734 dev_err(&adapter->pdev->dev, "Reset never finished (%x)\n", in i40evf_reset_task()
1736 adapter->flags |= I40EVF_FLAG_PF_COMMS_FAILED; in i40evf_reset_task()
1738 if (netif_running(adapter->netdev)) { in i40evf_reset_task()
1739 set_bit(__I40E_DOWN, &adapter->vsi.state); in i40evf_reset_task()
1742 adapter->link_up = false; in i40evf_reset_task()
1743 i40evf_napi_disable_all(adapter); in i40evf_reset_task()
1744 i40evf_irq_disable(adapter); in i40evf_reset_task()
1745 i40evf_free_traffic_irqs(adapter); in i40evf_reset_task()
1746 i40evf_free_all_tx_resources(adapter); in i40evf_reset_task()
1747 i40evf_free_all_rx_resources(adapter); in i40evf_reset_task()
1751 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, in i40evf_reset_task()
1757 list_for_each_entry_safe(fv, fvtmp, &adapter->vlan_filter_list, in i40evf_reset_task()
1763 i40evf_free_misc_irq(adapter); in i40evf_reset_task()
1764 i40evf_reset_interrupt_capability(adapter); in i40evf_reset_task()
1765 i40evf_free_queues(adapter); in i40evf_reset_task()
1766 i40evf_free_q_vectors(adapter); in i40evf_reset_task()
1767 kfree(adapter->vf_res); in i40evf_reset_task()
1769 adapter->netdev->flags &= ~IFF_UP; in i40evf_reset_task()
1770 clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); in i40evf_reset_task()
1771 adapter->flags &= ~I40EVF_FLAG_RESET_PENDING; in i40evf_reset_task()
1772 adapter->state = __I40EVF_DOWN; in i40evf_reset_task()
1773 dev_info(&adapter->pdev->dev, "Reset task did not complete, VF disabled\n"); in i40evf_reset_task()
1778 if (netif_running(adapter->netdev)) { in i40evf_reset_task()
1781 adapter->link_up = false; in i40evf_reset_task()
1782 i40evf_napi_disable_all(adapter); in i40evf_reset_task()
1784 i40evf_irq_disable(adapter); in i40evf_reset_task()
1786 adapter->state = __I40EVF_RESETTING; in i40evf_reset_task()
1787 adapter->flags &= ~I40EVF_FLAG_RESET_PENDING; in i40evf_reset_task()
1792 i40evf_free_all_rx_resources(adapter); in i40evf_reset_task()
1793 i40evf_free_all_tx_resources(adapter); in i40evf_reset_task()
1797 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; in i40evf_reset_task()
1800 dev_info(&adapter->pdev->dev, "Failed to init adminq: %d\n", in i40evf_reset_task()
1803 adapter->aq_required = I40EVF_FLAG_AQ_GET_CONFIG; in i40evf_reset_task()
1804 adapter->aq_required |= I40EVF_FLAG_AQ_MAP_VECTORS; in i40evf_reset_task()
1807 list_for_each_entry(f, &adapter->mac_filter_list, list) { in i40evf_reset_task()
1811 list_for_each_entry(vlf, &adapter->vlan_filter_list, list) { in i40evf_reset_task()
1814 adapter->aq_required |= I40EVF_FLAG_AQ_ADD_MAC_FILTER; in i40evf_reset_task()
1815 adapter->aq_required |= I40EVF_FLAG_AQ_ADD_VLAN_FILTER; in i40evf_reset_task()
1817 adapter->aq_required |= I40EVF_FLAG_SERVICE_CLIENT_REQUESTED; in i40evf_reset_task()
1818 clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); in i40evf_reset_task()
1819 i40evf_misc_irq_enable(adapter); in i40evf_reset_task()
1821 mod_timer(&adapter->watchdog_timer, jiffies + 2); in i40evf_reset_task()
1823 if (netif_running(adapter->netdev)) { in i40evf_reset_task()
1825 err = i40evf_setup_all_tx_resources(adapter); in i40evf_reset_task()
1830 err = i40evf_setup_all_rx_resources(adapter); in i40evf_reset_task()
1834 i40evf_configure(adapter); in i40evf_reset_task()
1836 i40evf_up_complete(adapter); in i40evf_reset_task()
1838 i40evf_irq_enable(adapter, true); in i40evf_reset_task()
1840 adapter->state = __I40EVF_DOWN; in i40evf_reset_task()
1845 dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n"); in i40evf_reset_task()
1846 i40evf_close(adapter->netdev); in i40evf_reset_task()
1855 struct i40evf_adapter *adapter = in i40evf_adminq_task() local
1857 struct i40e_hw *hw = &adapter->hw; in i40evf_adminq_task()
1864 if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED) in i40evf_adminq_task()
1878 i40evf_virtchnl_completion(adapter, v_msg->v_opcode, in i40evf_adminq_task()
1885 if ((adapter->flags & in i40evf_adminq_task()
1887 adapter->state == __I40EVF_RESETTING) in i40evf_adminq_task()
1896 dev_info(&adapter->pdev->dev, "ARQ VF Error detected\n"); in i40evf_adminq_task()
1900 dev_info(&adapter->pdev->dev, "ARQ Overflow Error detected\n"); in i40evf_adminq_task()
1904 dev_info(&adapter->pdev->dev, "ARQ Critical Error detected\n"); in i40evf_adminq_task()
1913 dev_info(&adapter->pdev->dev, "ASQ VF Error detected\n"); in i40evf_adminq_task()
1917 dev_info(&adapter->pdev->dev, "ASQ Overflow Error detected\n"); in i40evf_adminq_task()
1921 dev_info(&adapter->pdev->dev, "ASQ Critical Error detected\n"); in i40evf_adminq_task()
1931 i40evf_misc_irq_enable(adapter); in i40evf_adminq_task()
1940 void i40evf_free_all_tx_resources(struct i40evf_adapter *adapter) in i40evf_free_all_tx_resources() argument
1944 if (!adapter->tx_rings) in i40evf_free_all_tx_resources()
1947 for (i = 0; i < adapter->num_active_queues; i++) in i40evf_free_all_tx_resources()
1948 if (adapter->tx_rings[i].desc) in i40evf_free_all_tx_resources()
1949 i40evf_free_tx_resources(&adapter->tx_rings[i]); in i40evf_free_all_tx_resources()
1962 static int i40evf_setup_all_tx_resources(struct i40evf_adapter *adapter) in i40evf_setup_all_tx_resources() argument
1966 for (i = 0; i < adapter->num_active_queues; i++) { in i40evf_setup_all_tx_resources()
1967 adapter->tx_rings[i].count = adapter->tx_desc_count; in i40evf_setup_all_tx_resources()
1968 err = i40evf_setup_tx_descriptors(&adapter->tx_rings[i]); in i40evf_setup_all_tx_resources()
1971 dev_err(&adapter->pdev->dev, in i40evf_setup_all_tx_resources()
1989 static int i40evf_setup_all_rx_resources(struct i40evf_adapter *adapter) in i40evf_setup_all_rx_resources() argument
1993 for (i = 0; i < adapter->num_active_queues; i++) { in i40evf_setup_all_rx_resources()
1994 adapter->rx_rings[i].count = adapter->rx_desc_count; in i40evf_setup_all_rx_resources()
1995 err = i40evf_setup_rx_descriptors(&adapter->rx_rings[i]); in i40evf_setup_all_rx_resources()
1998 dev_err(&adapter->pdev->dev, in i40evf_setup_all_rx_resources()
2011 void i40evf_free_all_rx_resources(struct i40evf_adapter *adapter) in i40evf_free_all_rx_resources() argument
2015 if (!adapter->rx_rings) in i40evf_free_all_rx_resources()
2018 for (i = 0; i < adapter->num_active_queues; i++) in i40evf_free_all_rx_resources()
2019 if (adapter->rx_rings[i].desc) in i40evf_free_all_rx_resources()
2020 i40evf_free_rx_resources(&adapter->rx_rings[i]); in i40evf_free_all_rx_resources()
2037 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_open() local
2040 if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED) { in i40evf_open()
2041 dev_err(&adapter->pdev->dev, "Unable to open device due to PF driver failure.\n"); in i40evf_open()
2045 if (adapter->state != __I40EVF_DOWN) in i40evf_open()
2049 err = i40evf_setup_all_tx_resources(adapter); in i40evf_open()
2054 err = i40evf_setup_all_rx_resources(adapter); in i40evf_open()
2059 err = i40evf_request_traffic_irqs(adapter, netdev->name); in i40evf_open()
2063 i40evf_add_filter(adapter, adapter->hw.mac.addr); in i40evf_open()
2064 i40evf_configure(adapter); in i40evf_open()
2066 i40evf_up_complete(adapter); in i40evf_open()
2068 i40evf_irq_enable(adapter, true); in i40evf_open()
2073 i40evf_down(adapter); in i40evf_open()
2074 i40evf_free_traffic_irqs(adapter); in i40evf_open()
2076 i40evf_free_all_rx_resources(adapter); in i40evf_open()
2078 i40evf_free_all_tx_resources(adapter); in i40evf_open()
2096 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_close() local
2098 if (adapter->state <= __I40EVF_DOWN_PENDING) in i40evf_close()
2102 set_bit(__I40E_DOWN, &adapter->vsi.state); in i40evf_close()
2104 i40evf_down(adapter); in i40evf_close()
2105 adapter->state = __I40EVF_DOWN_PENDING; in i40evf_close()
2106 i40evf_free_traffic_irqs(adapter); in i40evf_close()
2120 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_get_stats() local
2123 return &adapter->net_stats; in i40evf_get_stats()
2135 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_change_mtu() local
2142 adapter->flags |= I40EVF_FLAG_RESET_NEEDED; in i40evf_change_mtu()
2143 schedule_work(&adapter->reset_task); in i40evf_change_mtu()
2162 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_fix_features() local
2165 if (adapter->vf_res->vf_offload_flags & I40E_VIRTCHNL_VF_OFFLOAD_VLAN) in i40evf_fix_features()
2217 int i40evf_process_config(struct i40evf_adapter *adapter) in i40evf_process_config() argument
2219 struct i40e_virtchnl_vf_resource *vfres = adapter->vf_res; in i40evf_process_config()
2220 struct net_device *netdev = adapter->netdev; in i40evf_process_config()
2221 struct i40e_vsi *vsi = &adapter->vsi; in i40evf_process_config()
2227 adapter->vsi_res = &vfres->vsi_res[i]; in i40evf_process_config()
2229 if (!adapter->vsi_res) { in i40evf_process_config()
2230 dev_err(&adapter->pdev->dev, "No LAN VSI found\n"); in i40evf_process_config()
2254 if (!(adapter->flags & I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE)) in i40evf_process_config()
2275 adapter->vsi.id = adapter->vsi_res->vsi_id; in i40evf_process_config()
2277 adapter->vsi.back = adapter; in i40evf_process_config()
2278 adapter->vsi.base_vector = 1; in i40evf_process_config()
2279 adapter->vsi.work_limit = I40E_DEFAULT_IRQ_WORK; in i40evf_process_config()
2280 vsi->netdev = adapter->netdev; in i40evf_process_config()
2281 vsi->qs_handle = adapter->vsi_res->qset_handle; in i40evf_process_config()
2283 adapter->rss_key_size = vfres->rss_key_size; in i40evf_process_config()
2284 adapter->rss_lut_size = vfres->rss_lut_size; in i40evf_process_config()
2286 adapter->rss_key_size = I40EVF_HKEY_ARRAY_SIZE; in i40evf_process_config()
2287 adapter->rss_lut_size = I40EVF_HLUT_ARRAY_SIZE; in i40evf_process_config()
2307 struct i40evf_adapter *adapter = container_of(work, in i40evf_init_task() local
2310 struct net_device *netdev = adapter->netdev; in i40evf_init_task()
2311 struct i40e_hw *hw = &adapter->hw; in i40evf_init_task()
2312 struct pci_dev *pdev = adapter->pdev; in i40evf_init_task()
2315 switch (adapter->state) { in i40evf_init_task()
2318 adapter->flags &= ~I40EVF_FLAG_PF_COMMS_FAILED; in i40evf_init_task()
2319 adapter->flags &= ~I40EVF_FLAG_RESET_PENDING; in i40evf_init_task()
2343 err = i40evf_send_api_ver(adapter); in i40evf_init_task()
2349 adapter->state = __I40EVF_INIT_VERSION_CHECK; in i40evf_init_task()
2355 adapter->state = __I40EVF_STARTUP; in i40evf_init_task()
2360 err = i40evf_verify_api_ver(adapter); in i40evf_init_task()
2363 err = i40evf_send_api_ver(adapter); in i40evf_init_task()
2366 adapter->pf_version.major, in i40evf_init_task()
2367 adapter->pf_version.minor, in i40evf_init_task()
2372 err = i40evf_send_vf_config_msg(adapter); in i40evf_init_task()
2378 adapter->state = __I40EVF_INIT_GET_RESOURCES; in i40evf_init_task()
2382 if (!adapter->vf_res) { in i40evf_init_task()
2386 adapter->vf_res = kzalloc(bufsz, GFP_KERNEL); in i40evf_init_task()
2387 if (!adapter->vf_res) in i40evf_init_task()
2390 err = i40evf_get_vf_config(adapter); in i40evf_init_task()
2392 err = i40evf_send_vf_config_msg(adapter); in i40evf_init_task()
2408 adapter->state = __I40EVF_INIT_SW; in i40evf_init_task()
2415 adapter->flags |= I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE; in i40evf_init_task()
2417 if (i40evf_process_config(adapter)) in i40evf_init_task()
2419 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; in i40evf_init_task()
2421 adapter->flags |= I40EVF_FLAG_RX_CSUM_ENABLED; in i40evf_init_task()
2427 if (!is_valid_ether_addr(adapter->hw.mac.addr)) { in i40evf_init_task()
2429 adapter->hw.mac.addr); in i40evf_init_task()
2431 ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr); in i40evf_init_task()
2433 adapter->flags |= I40EVF_FLAG_ADDR_SET_BY_PF; in i40evf_init_task()
2434 ether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr); in i40evf_init_task()
2435 ether_addr_copy(netdev->perm_addr, adapter->hw.mac.addr); in i40evf_init_task()
2438 init_timer(&adapter->watchdog_timer); in i40evf_init_task()
2439 adapter->watchdog_timer.function = &i40evf_watchdog_timer; in i40evf_init_task()
2440 adapter->watchdog_timer.data = (unsigned long)adapter; in i40evf_init_task()
2441 mod_timer(&adapter->watchdog_timer, jiffies + 1); in i40evf_init_task()
2443 adapter->num_active_queues = min_t(int, in i40evf_init_task()
2444 adapter->vsi_res->num_queue_pairs, in i40evf_init_task()
2446 adapter->tx_desc_count = I40EVF_DEFAULT_TXD; in i40evf_init_task()
2447 adapter->rx_desc_count = I40EVF_DEFAULT_RXD; in i40evf_init_task()
2448 err = i40evf_init_interrupt_scheme(adapter); in i40evf_init_task()
2451 i40evf_map_rings_to_vectors(adapter); in i40evf_init_task()
2452 if (adapter->vf_res->vf_offload_flags & in i40evf_init_task()
2454 adapter->flags |= I40EVF_FLAG_WB_ON_ITR_CAPABLE; in i40evf_init_task()
2456 err = i40evf_request_misc_irq(adapter); in i40evf_init_task()
2461 adapter->link_up = false; in i40evf_init_task()
2463 if (!adapter->netdev_registered) { in i40evf_init_task()
2469 adapter->netdev_registered = true; in i40evf_init_task()
2473 dev_info(&pdev->dev, "MAC address: %pM\n", adapter->hw.mac.addr); in i40evf_init_task()
2477 adapter->state = __I40EVF_DOWN; in i40evf_init_task()
2478 set_bit(__I40E_DOWN, &adapter->vsi.state); in i40evf_init_task()
2479 i40evf_misc_irq_enable(adapter); in i40evf_init_task()
2481 adapter->rss_key = kzalloc(adapter->rss_key_size, GFP_KERNEL); in i40evf_init_task()
2482 adapter->rss_lut = kzalloc(adapter->rss_lut_size, GFP_KERNEL); in i40evf_init_task()
2483 if (!adapter->rss_key || !adapter->rss_lut) in i40evf_init_task()
2486 if (RSS_AQ(adapter)) { in i40evf_init_task()
2487 adapter->aq_required |= I40EVF_FLAG_AQ_CONFIGURE_RSS; in i40evf_init_task()
2488 mod_timer_pending(&adapter->watchdog_timer, jiffies + 1); in i40evf_init_task()
2490 i40evf_init_rss(adapter); in i40evf_init_task()
2494 schedule_delayed_work(&adapter->init_task, msecs_to_jiffies(30)); in i40evf_init_task()
2497 i40evf_free_rss(adapter); in i40evf_init_task()
2499 i40evf_free_misc_irq(adapter); in i40evf_init_task()
2501 i40evf_reset_interrupt_capability(adapter); in i40evf_init_task()
2503 kfree(adapter->vf_res); in i40evf_init_task()
2504 adapter->vf_res = NULL; in i40evf_init_task()
2507 if (++adapter->aq_wait_count > I40EVF_AQ_MAX_ERR) { in i40evf_init_task()
2509 adapter->flags |= I40EVF_FLAG_PF_COMMS_FAILED; in i40evf_init_task()
2511 adapter->state = __I40EVF_STARTUP; in i40evf_init_task()
2512 schedule_delayed_work(&adapter->init_task, HZ * 5); in i40evf_init_task()
2515 schedule_delayed_work(&adapter->init_task, HZ); in i40evf_init_task()
2525 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_shutdown() local
2533 adapter->state = __I40EVF_REMOVE; in i40evf_shutdown()
2534 adapter->aq_required = 0; in i40evf_shutdown()
2557 struct i40evf_adapter *adapter = NULL; in i40evf_probe() local
2595 adapter = netdev_priv(netdev); in i40evf_probe()
2597 adapter->netdev = netdev; in i40evf_probe()
2598 adapter->pdev = pdev; in i40evf_probe()
2600 hw = &adapter->hw; in i40evf_probe()
2601 hw->back = adapter; in i40evf_probe()
2603 adapter->msg_enable = BIT(DEFAULT_DEBUG_LEVEL_SHIFT) - 1; in i40evf_probe()
2604 adapter->state = __I40EVF_STARTUP; in i40evf_probe()
2629 INIT_LIST_HEAD(&adapter->mac_filter_list); in i40evf_probe()
2630 INIT_LIST_HEAD(&adapter->vlan_filter_list); in i40evf_probe()
2632 INIT_WORK(&adapter->reset_task, i40evf_reset_task); in i40evf_probe()
2633 INIT_WORK(&adapter->adminq_task, i40evf_adminq_task); in i40evf_probe()
2634 INIT_WORK(&adapter->watchdog_task, i40evf_watchdog_task); in i40evf_probe()
2635 INIT_DELAYED_WORK(&adapter->init_task, i40evf_init_task); in i40evf_probe()
2636 schedule_delayed_work(&adapter->init_task, in i40evf_probe()
2662 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_suspend() local
2669 i40evf_down(adapter); in i40evf_suspend()
2672 i40evf_free_misc_irq(adapter); in i40evf_suspend()
2673 i40evf_reset_interrupt_capability(adapter); in i40evf_suspend()
2692 struct i40evf_adapter *adapter = pci_get_drvdata(pdev); in i40evf_resume() local
2693 struct net_device *netdev = adapter->netdev; in i40evf_resume()
2711 err = i40evf_set_interrupt_capability(adapter); in i40evf_resume()
2717 err = i40evf_request_misc_irq(adapter); in i40evf_resume()
2724 schedule_work(&adapter->reset_task); in i40evf_resume()
2744 struct i40evf_adapter *adapter = netdev_priv(netdev); in i40evf_remove() local
2746 struct i40e_hw *hw = &adapter->hw; in i40evf_remove()
2748 cancel_delayed_work_sync(&adapter->init_task); in i40evf_remove()
2749 cancel_work_sync(&adapter->reset_task); in i40evf_remove()
2751 if (adapter->netdev_registered) { in i40evf_remove()
2753 adapter->netdev_registered = false; in i40evf_remove()
2757 adapter->state = __I40EVF_REMOVE; in i40evf_remove()
2758 adapter->aq_required = 0; in i40evf_remove()
2759 i40evf_request_reset(adapter); in i40evf_remove()
2763 i40evf_request_reset(adapter); in i40evf_remove()
2767 if (adapter->msix_entries) { in i40evf_remove()
2768 i40evf_misc_irq_disable(adapter); in i40evf_remove()
2769 i40evf_free_misc_irq(adapter); in i40evf_remove()
2770 i40evf_reset_interrupt_capability(adapter); in i40evf_remove()
2771 i40evf_free_q_vectors(adapter); in i40evf_remove()
2774 if (adapter->watchdog_timer.function) in i40evf_remove()
2775 del_timer_sync(&adapter->watchdog_timer); in i40evf_remove()
2779 i40evf_free_rss(adapter); in i40evf_remove()
2790 i40evf_free_all_tx_resources(adapter); in i40evf_remove()
2791 i40evf_free_all_rx_resources(adapter); in i40evf_remove()
2792 i40evf_free_queues(adapter); in i40evf_remove()
2793 kfree(adapter->vf_res); in i40evf_remove()
2797 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { in i40evf_remove()
2801 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in i40evf_remove()