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, err %s, aq_err %s\n", in i40evf_send_pf_msg()
68 int i40evf_send_api_ver(struct i40evf_adapter *adapter) in i40evf_send_api_ver() argument
75 return i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_VERSION, (u8 *)&vvi, in i40evf_send_api_ver()
88 int i40evf_verify_api_ver(struct i40evf_adapter *adapter) in i40evf_verify_api_ver() argument
91 struct i40e_hw *hw = &adapter->hw; in i40evf_verify_api_ver()
122 dev_info(&adapter->pdev->dev, "Invalid reply type %d from PF\n", in i40evf_verify_api_ver()
129 adapter->pf_version = *pf_vvi; in i40evf_verify_api_ver()
150 int i40evf_send_vf_config_msg(struct i40evf_adapter *adapter) in i40evf_send_vf_config_msg() argument
154 adapter->current_op = I40E_VIRTCHNL_OP_GET_VF_RESOURCES; in i40evf_send_vf_config_msg()
155 adapter->aq_required &= ~I40EVF_FLAG_AQ_GET_CONFIG; in i40evf_send_vf_config_msg()
161 adapter->current_op = I40E_VIRTCHNL_OP_GET_VF_RESOURCES; in i40evf_send_vf_config_msg()
162 adapter->aq_required &= ~I40EVF_FLAG_AQ_GET_CONFIG; in i40evf_send_vf_config_msg()
163 if (PF_IS_V11(adapter)) in i40evf_send_vf_config_msg()
164 return i40evf_send_pf_msg(adapter, in i40evf_send_vf_config_msg()
168 return i40evf_send_pf_msg(adapter, in i40evf_send_vf_config_msg()
183 int i40evf_get_vf_config(struct i40evf_adapter *adapter) in i40evf_get_vf_config() argument
185 struct i40e_hw *hw = &adapter->hw; in i40evf_get_vf_config()
214 memcpy(adapter->vf_res, event.msg_buf, min(event.msg_len, len)); in i40evf_get_vf_config()
216 i40e_vf_parse_hw_config(hw, adapter->vf_res); in i40evf_get_vf_config()
229 void i40evf_configure_queues(struct i40evf_adapter *adapter) in i40evf_configure_queues() argument
233 int pairs = adapter->num_active_queues; in i40evf_configure_queues()
236 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_configure_queues()
238 dev_err(&adapter->pdev->dev, "Cannot configure queues, command %d pending\n", in i40evf_configure_queues()
239 adapter->current_op); in i40evf_configure_queues()
242 adapter->current_op = I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES; in i40evf_configure_queues()
249 vqci->vsi_id = adapter->vsi_res->vsi_id; in i40evf_configure_queues()
258 vqpi->txq.ring_len = adapter->tx_rings[i]->count; in i40evf_configure_queues()
259 vqpi->txq.dma_ring_addr = adapter->tx_rings[i]->dma; in i40evf_configure_queues()
266 vqpi->rxq.ring_len = adapter->rx_rings[i]->count; in i40evf_configure_queues()
267 vqpi->rxq.dma_ring_addr = adapter->rx_rings[i]->dma; in i40evf_configure_queues()
268 vqpi->rxq.max_pkt_size = adapter->netdev->mtu in i40evf_configure_queues()
270 vqpi->rxq.databuffer_size = adapter->rx_rings[i]->rx_buf_len; in i40evf_configure_queues()
274 adapter->aq_required &= ~I40EVF_FLAG_AQ_CONFIGURE_QUEUES; in i40evf_configure_queues()
275 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES, in i40evf_configure_queues()
286 void i40evf_enable_queues(struct i40evf_adapter *adapter) in i40evf_enable_queues() argument
290 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_enable_queues()
292 dev_err(&adapter->pdev->dev, "Cannot enable queues, command %d pending\n", in i40evf_enable_queues()
293 adapter->current_op); in i40evf_enable_queues()
296 adapter->current_op = I40E_VIRTCHNL_OP_ENABLE_QUEUES; in i40evf_enable_queues()
297 vqs.vsi_id = adapter->vsi_res->vsi_id; in i40evf_enable_queues()
298 vqs.tx_queues = BIT(adapter->num_active_queues) - 1; in i40evf_enable_queues()
300 adapter->aq_required &= ~I40EVF_FLAG_AQ_ENABLE_QUEUES; in i40evf_enable_queues()
301 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ENABLE_QUEUES, in i40evf_enable_queues()
311 void i40evf_disable_queues(struct i40evf_adapter *adapter) in i40evf_disable_queues() argument
315 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_disable_queues()
317 dev_err(&adapter->pdev->dev, "Cannot disable queues, command %d pending\n", in i40evf_disable_queues()
318 adapter->current_op); in i40evf_disable_queues()
321 adapter->current_op = I40E_VIRTCHNL_OP_DISABLE_QUEUES; in i40evf_disable_queues()
322 vqs.vsi_id = adapter->vsi_res->vsi_id; in i40evf_disable_queues()
323 vqs.tx_queues = BIT(adapter->num_active_queues) - 1; in i40evf_disable_queues()
325 adapter->aq_required &= ~I40EVF_FLAG_AQ_DISABLE_QUEUES; in i40evf_disable_queues()
326 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DISABLE_QUEUES, in i40evf_disable_queues()
337 void i40evf_map_queues(struct i40evf_adapter *adapter) in i40evf_map_queues() argument
343 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_map_queues()
345 dev_err(&adapter->pdev->dev, "Cannot map queues to vectors, command %d pending\n", in i40evf_map_queues()
346 adapter->current_op); in i40evf_map_queues()
349 adapter->current_op = I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP; in i40evf_map_queues()
351 q_vectors = adapter->num_msix_vectors - NONQ_VECS; in i40evf_map_queues()
354 (adapter->num_msix_vectors * in i40evf_map_queues()
360 vimi->num_vectors = adapter->num_msix_vectors; in i40evf_map_queues()
363 q_vector = adapter->q_vector[v_idx]; in i40evf_map_queues()
364 vimi->vecmap[v_idx].vsi_id = adapter->vsi_res->vsi_id; in i40evf_map_queues()
370 vimi->vecmap[v_idx].vsi_id = adapter->vsi_res->vsi_id; in i40evf_map_queues()
375 adapter->aq_required &= ~I40EVF_FLAG_AQ_MAP_VECTORS; in i40evf_map_queues()
376 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP, in i40evf_map_queues()
389 void i40evf_add_ether_addrs(struct i40evf_adapter *adapter) in i40evf_add_ether_addrs() argument
395 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_add_ether_addrs()
397 dev_err(&adapter->pdev->dev, "Cannot add filters, command %d pending\n", in i40evf_add_ether_addrs()
398 adapter->current_op); in i40evf_add_ether_addrs()
401 list_for_each_entry(f, &adapter->mac_filter_list, list) { in i40evf_add_ether_addrs()
406 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER; in i40evf_add_ether_addrs()
409 adapter->current_op = I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS; in i40evf_add_ether_addrs()
414 dev_warn(&adapter->pdev->dev, "Too many add MAC changes in one request\n"); in i40evf_add_ether_addrs()
425 veal->vsi_id = adapter->vsi_res->vsi_id; in i40evf_add_ether_addrs()
427 list_for_each_entry(f, &adapter->mac_filter_list, list) { in i40evf_add_ether_addrs()
434 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER; in i40evf_add_ether_addrs()
435 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS, in i40evf_add_ether_addrs()
448 void i40evf_del_ether_addrs(struct i40evf_adapter *adapter) in i40evf_del_ether_addrs() argument
454 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_del_ether_addrs()
456 dev_err(&adapter->pdev->dev, "Cannot remove filters, command %d pending\n", in i40evf_del_ether_addrs()
457 adapter->current_op); in i40evf_del_ether_addrs()
460 list_for_each_entry(f, &adapter->mac_filter_list, list) { in i40evf_del_ether_addrs()
465 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER; in i40evf_del_ether_addrs()
468 adapter->current_op = I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS; in i40evf_del_ether_addrs()
473 dev_warn(&adapter->pdev->dev, "Too many delete MAC changes in one request\n"); in i40evf_del_ether_addrs()
483 veal->vsi_id = adapter->vsi_res->vsi_id; in i40evf_del_ether_addrs()
485 list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) { in i40evf_del_ether_addrs()
493 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER; in i40evf_del_ether_addrs()
494 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS, in i40evf_del_ether_addrs()
507 void i40evf_add_vlans(struct i40evf_adapter *adapter) in i40evf_add_vlans() argument
513 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_add_vlans()
515 dev_err(&adapter->pdev->dev, "Cannot add VLANs, command %d pending\n", in i40evf_add_vlans()
516 adapter->current_op); in i40evf_add_vlans()
520 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in i40evf_add_vlans()
525 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER; in i40evf_add_vlans()
528 adapter->current_op = I40E_VIRTCHNL_OP_ADD_VLAN; in i40evf_add_vlans()
533 dev_warn(&adapter->pdev->dev, "Too many add VLAN changes in one request\n"); in i40evf_add_vlans()
543 vvfl->vsi_id = adapter->vsi_res->vsi_id; in i40evf_add_vlans()
545 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in i40evf_add_vlans()
552 adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER; in i40evf_add_vlans()
553 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len); in i40evf_add_vlans()
565 void i40evf_del_vlans(struct i40evf_adapter *adapter) in i40evf_del_vlans() argument
571 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_del_vlans()
573 dev_err(&adapter->pdev->dev, "Cannot remove VLANs, command %d pending\n", in i40evf_del_vlans()
574 adapter->current_op); in i40evf_del_vlans()
578 list_for_each_entry(f, &adapter->vlan_filter_list, list) { in i40evf_del_vlans()
583 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER; in i40evf_del_vlans()
586 adapter->current_op = I40E_VIRTCHNL_OP_DEL_VLAN; in i40evf_del_vlans()
591 dev_warn(&adapter->pdev->dev, "Too many delete VLAN changes in one request\n"); in i40evf_del_vlans()
601 vvfl->vsi_id = adapter->vsi_res->vsi_id; in i40evf_del_vlans()
603 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { in i40evf_del_vlans()
611 adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER; in i40evf_del_vlans()
612 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len); in i40evf_del_vlans()
623 void i40evf_set_promiscuous(struct i40evf_adapter *adapter, int flags) in i40evf_set_promiscuous() argument
627 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_set_promiscuous()
629 dev_err(&adapter->pdev->dev, "Cannot set promiscuous mode, command %d pending\n", in i40evf_set_promiscuous()
630 adapter->current_op); in i40evf_set_promiscuous()
633 adapter->current_op = I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE; in i40evf_set_promiscuous()
634 vpi.vsi_id = adapter->vsi_res->vsi_id; in i40evf_set_promiscuous()
636 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE, in i40evf_set_promiscuous()
646 void i40evf_request_stats(struct i40evf_adapter *adapter) in i40evf_request_stats() argument
650 if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) { in i40evf_request_stats()
654 adapter->current_op = I40E_VIRTCHNL_OP_GET_STATS; in i40evf_request_stats()
655 vqs.vsi_id = adapter->vsi_res->vsi_id; in i40evf_request_stats()
657 if (i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_GET_STATS, in i40evf_request_stats()
660 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; in i40evf_request_stats()
668 void i40evf_request_reset(struct i40evf_adapter *adapter) in i40evf_request_reset() argument
671 i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_RESET_VF, NULL, 0); in i40evf_request_reset()
672 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; in i40evf_request_reset()
687 void i40evf_virtchnl_completion(struct i40evf_adapter *adapter, in i40evf_virtchnl_completion() argument
692 struct net_device *netdev = adapter->netdev; in i40evf_virtchnl_completion()
699 adapter->link_up = in i40evf_virtchnl_completion()
701 if (adapter->link_up && !netif_carrier_ok(netdev)) { in i40evf_virtchnl_completion()
702 dev_info(&adapter->pdev->dev, "NIC Link is Up\n"); in i40evf_virtchnl_completion()
705 } else if (!adapter->link_up) { in i40evf_virtchnl_completion()
706 dev_info(&adapter->pdev->dev, "NIC Link is Down\n"); in i40evf_virtchnl_completion()
712 dev_info(&adapter->pdev->dev, "PF reset warning received\n"); in i40evf_virtchnl_completion()
713 if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING)) { in i40evf_virtchnl_completion()
714 adapter->flags |= I40EVF_FLAG_RESET_PENDING; in i40evf_virtchnl_completion()
715 dev_info(&adapter->pdev->dev, "Scheduling reset task\n"); in i40evf_virtchnl_completion()
716 schedule_work(&adapter->reset_task); in i40evf_virtchnl_completion()
720 dev_err(&adapter->pdev->dev, "Unknown event %d from PF\n", in i40evf_virtchnl_completion()
727 dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n", in i40evf_virtchnl_completion()
728 v_retval, i40evf_stat_str(&adapter->hw, v_retval), in i40evf_virtchnl_completion()
735 adapter->net_stats.rx_packets = stats->rx_unicast + in i40evf_virtchnl_completion()
738 adapter->net_stats.tx_packets = stats->tx_unicast + in i40evf_virtchnl_completion()
741 adapter->net_stats.rx_bytes = stats->rx_bytes; in i40evf_virtchnl_completion()
742 adapter->net_stats.tx_bytes = stats->tx_bytes; in i40evf_virtchnl_completion()
743 adapter->net_stats.tx_errors = stats->tx_errors; in i40evf_virtchnl_completion()
744 adapter->net_stats.rx_dropped = stats->rx_discards; in i40evf_virtchnl_completion()
745 adapter->net_stats.tx_dropped = stats->tx_discards; in i40evf_virtchnl_completion()
746 adapter->current_stats = *stats; in i40evf_virtchnl_completion()
753 memcpy(adapter->vf_res, msg, min(msglen, len)); in i40evf_virtchnl_completion()
754 i40e_vf_parse_hw_config(&adapter->hw, adapter->vf_res); in i40evf_virtchnl_completion()
756 ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr); in i40evf_virtchnl_completion()
757 i40evf_process_config(adapter); in i40evf_virtchnl_completion()
762 i40evf_irq_enable(adapter, true); in i40evf_virtchnl_completion()
763 netif_tx_start_all_queues(adapter->netdev); in i40evf_virtchnl_completion()
764 netif_carrier_on(adapter->netdev); in i40evf_virtchnl_completion()
767 i40evf_free_all_tx_resources(adapter); in i40evf_virtchnl_completion()
768 i40evf_free_all_rx_resources(adapter); in i40evf_virtchnl_completion()
776 if (v_opcode != adapter->current_op) in i40evf_virtchnl_completion()
780 if (v_opcode != adapter->current_op) in i40evf_virtchnl_completion()
781 dev_warn(&adapter->pdev->dev, "Expected response %d from PF, received %d\n", in i40evf_virtchnl_completion()
782 adapter->current_op, v_opcode); in i40evf_virtchnl_completion()
785 adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; in i40evf_virtchnl_completion()