Lines Matching refs:adapter

43 static int i40evf_send_pf_msg(struct i40evf_adapter *adapter,  in i40evf_send_pf_msg()  argument
46 struct i40e_hw *hw = &adapter->hw; in i40evf_send_pf_msg()
49 if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED) in i40evf_send_pf_msg()
54 dev_err(&adapter->pdev->dev, "Unable to send opcode %d to PF, error %d, aq status %d\n", in i40evf_send_pf_msg()
67 int i40evf_send_api_ver(struct i40evf_adapter *adapter) in i40evf_send_api_ver() argument
74 return i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_VERSION, (u8 *)&vvi, in i40evf_send_api_ver()
87 int i40evf_verify_api_ver(struct i40evf_adapter *adapter) in i40evf_verify_api_ver() argument
90 struct i40e_hw *hw = &adapter->hw; in i40evf_verify_api_ver()
121 dev_info(&adapter->pdev->dev, "Invalid reply type %d from PF\n", in i40evf_verify_api_ver()
146 int i40evf_send_vf_config_msg(struct i40evf_adapter *adapter) in i40evf_send_vf_config_msg() argument
148 return i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_GET_VF_RESOURCES, in i40evf_send_vf_config_msg()
162 int i40evf_get_vf_config(struct i40evf_adapter *adapter) in i40evf_get_vf_config() argument
164 struct i40e_hw *hw = &adapter->hw; in i40evf_get_vf_config()
193 memcpy(adapter->vf_res, event.msg_buf, min(event.msg_len, len)); in i40evf_get_vf_config()
195 i40e_vf_parse_hw_config(hw, adapter->vf_res); in i40evf_get_vf_config()
208 void i40evf_configure_queues(struct i40evf_adapter *adapter) in i40evf_configure_queues() argument
212 int pairs = adapter->num_active_queues; in i40evf_configure_queues()
215 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_configure_queues()
217 dev_err(&adapter->pdev->dev, "%s: command %d pending\n", in i40evf_configure_queues()
218 __func__, adapter->current_op); in i40evf_configure_queues()
221 adapter->current_op = I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES; in i40evf_configure_queues()
228 vqci->vsi_id = adapter->vsi_res->vsi_id; in i40evf_configure_queues()
237 vqpi->txq.ring_len = adapter->tx_rings[i]->count; in i40evf_configure_queues()
238 vqpi->txq.dma_ring_addr = adapter->tx_rings[i]->dma; in i40evf_configure_queues()
245 vqpi->rxq.ring_len = adapter->rx_rings[i]->count; in i40evf_configure_queues()
246 vqpi->rxq.dma_ring_addr = adapter->rx_rings[i]->dma; in i40evf_configure_queues()
247 vqpi->rxq.max_pkt_size = adapter->netdev->mtu in i40evf_configure_queues()
249 vqpi->rxq.databuffer_size = adapter->rx_rings[i]->rx_buf_len; in i40evf_configure_queues()
253 adapter->aq_required &= ~I40EVF_FLAG_AQ_CONFIGURE_QUEUES; in i40evf_configure_queues()
254 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES, in i40evf_configure_queues()
265 void i40evf_enable_queues(struct i40evf_adapter *adapter) in i40evf_enable_queues() argument
269 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_enable_queues()
271 dev_err(&adapter->pdev->dev, "%s: command %d pending\n", in i40evf_enable_queues()
272 __func__, adapter->current_op); in i40evf_enable_queues()
275 adapter->current_op = I40E_VIRTCHNL_OP_ENABLE_QUEUES; in i40evf_enable_queues()
276 vqs.vsi_id = adapter->vsi_res->vsi_id; in i40evf_enable_queues()
277 vqs.tx_queues = (1 << adapter->num_active_queues) - 1; in i40evf_enable_queues()
279 adapter->aq_required &= ~I40EVF_FLAG_AQ_ENABLE_QUEUES; in i40evf_enable_queues()
280 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ENABLE_QUEUES, in i40evf_enable_queues()
290 void i40evf_disable_queues(struct i40evf_adapter *adapter) in i40evf_disable_queues() argument
294 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_disable_queues()
296 dev_err(&adapter->pdev->dev, "%s: command %d pending\n", in i40evf_disable_queues()
297 __func__, adapter->current_op); in i40evf_disable_queues()
300 adapter->current_op = I40E_VIRTCHNL_OP_DISABLE_QUEUES; in i40evf_disable_queues()
301 vqs.vsi_id = adapter->vsi_res->vsi_id; in i40evf_disable_queues()
302 vqs.tx_queues = (1 << adapter->num_active_queues) - 1; in i40evf_disable_queues()
304 adapter->aq_required &= ~I40EVF_FLAG_AQ_DISABLE_QUEUES; in i40evf_disable_queues()
305 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DISABLE_QUEUES, in i40evf_disable_queues()
316 void i40evf_map_queues(struct i40evf_adapter *adapter) in i40evf_map_queues() argument
322 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_map_queues()
324 dev_err(&adapter->pdev->dev, "%s: command %d pending\n", in i40evf_map_queues()
325 __func__, adapter->current_op); in i40evf_map_queues()
328 adapter->current_op = I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP; in i40evf_map_queues()
330 q_vectors = adapter->num_msix_vectors - NONQ_VECS; in i40evf_map_queues()
333 (adapter->num_msix_vectors * in i40evf_map_queues()
339 vimi->num_vectors = adapter->num_msix_vectors; in i40evf_map_queues()
342 q_vector = adapter->q_vector[v_idx]; in i40evf_map_queues()
343 vimi->vecmap[v_idx].vsi_id = adapter->vsi_res->vsi_id; in i40evf_map_queues()
349 vimi->vecmap[v_idx].vsi_id = adapter->vsi_res->vsi_id; in i40evf_map_queues()
354 adapter->aq_required &= ~I40EVF_FLAG_AQ_MAP_VECTORS; in i40evf_map_queues()
355 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP, in i40evf_map_queues()
368 void i40evf_add_ether_addrs(struct i40evf_adapter *adapter) in i40evf_add_ether_addrs() argument
374 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_add_ether_addrs()
376 dev_err(&adapter->pdev->dev, "%s: command %d pending\n", in i40evf_add_ether_addrs()
377 __func__, adapter->current_op); in i40evf_add_ether_addrs()
380 list_for_each_entry(f, &adapter->mac_filter_list, list) { in i40evf_add_ether_addrs()
385 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER; in i40evf_add_ether_addrs()
388 adapter->current_op = I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS; in i40evf_add_ether_addrs()
393 dev_warn(&adapter->pdev->dev, "%s: Too many MAC address changes in one request\n", in i40evf_add_ether_addrs()
405 veal->vsi_id = adapter->vsi_res->vsi_id; in i40evf_add_ether_addrs()
407 list_for_each_entry(f, &adapter->mac_filter_list, list) { in i40evf_add_ether_addrs()
414 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER; in i40evf_add_ether_addrs()
415 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS, in i40evf_add_ether_addrs()
428 void i40evf_del_ether_addrs(struct i40evf_adapter *adapter) in i40evf_del_ether_addrs() argument
434 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_del_ether_addrs()
436 dev_err(&adapter->pdev->dev, "%s: command %d pending\n", in i40evf_del_ether_addrs()
437 __func__, adapter->current_op); in i40evf_del_ether_addrs()
440 list_for_each_entry(f, &adapter->mac_filter_list, list) { in i40evf_del_ether_addrs()
445 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER; in i40evf_del_ether_addrs()
448 adapter->current_op = I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS; in i40evf_del_ether_addrs()
453 dev_warn(&adapter->pdev->dev, "%s: Too many MAC address changes in one request\n", in i40evf_del_ether_addrs()
464 veal->vsi_id = adapter->vsi_res->vsi_id; in i40evf_del_ether_addrs()
466 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { in i40evf_del_ether_addrs()
474 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER; in i40evf_del_ether_addrs()
475 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS, in i40evf_del_ether_addrs()
488 void i40evf_add_vlans(struct i40evf_adapter *adapter) in i40evf_add_vlans() argument
494 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_add_vlans()
496 dev_err(&adapter->pdev->dev, "%s: command %d pending\n", in i40evf_add_vlans()
497 __func__, adapter->current_op); in i40evf_add_vlans()
501 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in i40evf_add_vlans()
506 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER; in i40evf_add_vlans()
509 adapter->current_op = I40E_VIRTCHNL_OP_ADD_VLAN; in i40evf_add_vlans()
514 dev_warn(&adapter->pdev->dev, "%s: Too many VLAN changes in one request\n", in i40evf_add_vlans()
525 vvfl->vsi_id = adapter->vsi_res->vsi_id; in i40evf_add_vlans()
527 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in i40evf_add_vlans()
534 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER; in i40evf_add_vlans()
535 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len); in i40evf_add_vlans()
547 void i40evf_del_vlans(struct i40evf_adapter *adapter) in i40evf_del_vlans() argument
553 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_del_vlans()
555 dev_err(&adapter->pdev->dev, "%s: command %d pending\n", in i40evf_del_vlans()
556 __func__, adapter->current_op); in i40evf_del_vlans()
560 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in i40evf_del_vlans()
565 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER; in i40evf_del_vlans()
568 adapter->current_op = I40E_VIRTCHNL_OP_DEL_VLAN; in i40evf_del_vlans()
573 dev_warn(&adapter->pdev->dev, "%s: Too many VLAN changes in one request\n", in i40evf_del_vlans()
584 vvfl->vsi_id = adapter->vsi_res->vsi_id; in i40evf_del_vlans()
586 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in i40evf_del_vlans()
594 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER; in i40evf_del_vlans()
595 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len); in i40evf_del_vlans()
606 void i40evf_set_promiscuous(struct i40evf_adapter *adapter, int flags) in i40evf_set_promiscuous() argument
610 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_set_promiscuous()
612 dev_err(&adapter->pdev->dev, "%s: command %d pending\n", in i40evf_set_promiscuous()
613 __func__, adapter->current_op); in i40evf_set_promiscuous()
616 adapter->current_op = I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE; in i40evf_set_promiscuous()
617 vpi.vsi_id = adapter->vsi_res->vsi_id; in i40evf_set_promiscuous()
619 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE, in i40evf_set_promiscuous()
629 void i40evf_request_stats(struct i40evf_adapter *adapter) in i40evf_request_stats() argument
633 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_request_stats()
637 adapter->current_op = I40E_VIRTCHNL_OP_GET_STATS; in i40evf_request_stats()
638 vqs.vsi_id = adapter->vsi_res->vsi_id; in i40evf_request_stats()
640 if (i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_GET_STATS, in i40evf_request_stats()
643 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; in i40evf_request_stats()
651 void i40evf_request_reset(struct i40evf_adapter *adapter) in i40evf_request_reset() argument
654 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_RESET_VF, NULL, 0); in i40evf_request_reset()
655 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; in i40evf_request_reset()
670 void i40evf_virtchnl_completion(struct i40evf_adapter *adapter, in i40evf_virtchnl_completion() argument
675 struct net_device *netdev = adapter->netdev; in i40evf_virtchnl_completion()
682 adapter->link_up = in i40evf_virtchnl_completion()
684 if (adapter->link_up && !netif_carrier_ok(netdev)) { in i40evf_virtchnl_completion()
685 dev_info(&adapter->pdev->dev, "NIC Link is Up\n"); in i40evf_virtchnl_completion()
688 } else if (!adapter->link_up) { in i40evf_virtchnl_completion()
689 dev_info(&adapter->pdev->dev, "NIC Link is Down\n"); in i40evf_virtchnl_completion()
695 dev_info(&adapter->pdev->dev, "PF reset warning received\n"); in i40evf_virtchnl_completion()
696 if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING)) { in i40evf_virtchnl_completion()
697 adapter->flags |= I40EVF_FLAG_RESET_PENDING; in i40evf_virtchnl_completion()
698 dev_info(&adapter->pdev->dev, "Scheduling reset task\n"); in i40evf_virtchnl_completion()
699 schedule_work(&adapter->reset_task); in i40evf_virtchnl_completion()
703 dev_err(&adapter->pdev->dev, in i40evf_virtchnl_completion()
711 dev_err(&adapter->pdev->dev, "%s: PF returned error %d to our request %d\n", in i40evf_virtchnl_completion()
718 adapter->net_stats.rx_packets = stats->rx_unicast + in i40evf_virtchnl_completion()
721 adapter->net_stats.tx_packets = stats->tx_unicast + in i40evf_virtchnl_completion()
724 adapter->net_stats.rx_bytes = stats->rx_bytes; in i40evf_virtchnl_completion()
725 adapter->net_stats.tx_bytes = stats->tx_bytes; in i40evf_virtchnl_completion()
726 adapter->net_stats.tx_errors = stats->tx_errors; in i40evf_virtchnl_completion()
727 adapter->net_stats.rx_dropped = stats->rx_discards; in i40evf_virtchnl_completion()
728 adapter->net_stats.tx_dropped = stats->tx_discards; in i40evf_virtchnl_completion()
729 adapter->current_stats = *stats; in i40evf_virtchnl_completion()
734 i40evf_irq_enable(adapter, true); in i40evf_virtchnl_completion()
735 netif_tx_start_all_queues(adapter->netdev); in i40evf_virtchnl_completion()
736 netif_carrier_on(adapter->netdev); in i40evf_virtchnl_completion()
739 i40evf_free_all_tx_resources(adapter); in i40evf_virtchnl_completion()
740 i40evf_free_all_rx_resources(adapter); in i40evf_virtchnl_completion()
749 if (v_opcode != adapter->current_op) in i40evf_virtchnl_completion()
753 if (v_opcode != adapter->current_op) in i40evf_virtchnl_completion()
754 dev_warn(&adapter->pdev->dev, "Expected response %d from PF, received %d\n", in i40evf_virtchnl_completion()
755 adapter->current_op, v_opcode); in i40evf_virtchnl_completion()
758 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; in i40evf_virtchnl_completion()