Lines Matching refs:vf
37 static void ixl_vf_map_vsi_queue(struct i40e_hw *hw, struct ixl_vf *vf, int qnum, uint32_t val);
43 static int ixl_vf_mac_valid(struct ixl_vf *vf, const uint8_t *addr);
45 static int ixl_vf_alloc_vsi(struct ixl_pf *pf, struct ixl_vf *vf);
46 static int ixl_vf_setup_vsi(struct ixl_pf *pf, struct ixl_vf *vf);
47 static void ixl_vf_map_queues(struct ixl_pf *pf, struct ixl_vf *vf);
49 static void ixl_vf_release_resources(struct ixl_pf *pf, struct ixl_vf *vf);
50 static int ixl_flush_pcie(struct ixl_pf *pf, struct ixl_vf *vf);
51 static void ixl_reset_vf(struct ixl_pf *pf, struct ixl_vf *vf);
52 static void ixl_reinit_vf(struct ixl_pf *pf, struct ixl_vf *vf);
53 static void ixl_send_vf_msg(struct ixl_pf *pf, struct ixl_vf *vf, uint16_t op, enum i40e_status_cod…
54 static void ixl_send_vf_ack(struct ixl_pf *pf, struct ixl_vf *vf, uint16_t op);
55 static void ixl_send_vf_nack_msg(struct ixl_pf *pf, struct ixl_vf *vf, uint16_t op, enum i40e_statu…
56 static void ixl_vf_version_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, uint16_t msg_size);
57 static void ixl_vf_reset_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, uint16_t msg_size);
58 static void ixl_vf_get_resources_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, uint16_t msg_…
59 static int ixl_vf_config_tx_queue(struct ixl_pf *pf, struct ixl_vf *vf, struct virtchnl_txq_info *i…
60 static int ixl_vf_config_rx_queue(struct ixl_pf *pf, struct ixl_vf *vf, struct virtchnl_rxq_info *i…
61 static void ixl_vf_config_vsi_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, uint16_t msg_siz…
64 static void ixl_vf_config_vector(struct ixl_pf *pf, struct ixl_vf *vf, const struct virtchnl_vector…
65 static void ixl_vf_config_irq_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, uint16_t msg_siz…
66 static void ixl_vf_enable_queues_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, uint16_t msg_…
67 static void ixl_vf_disable_queues_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, uint16_t msg…
68 static void ixl_vf_add_mac_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, uint16_t msg_size);
69 static void ixl_vf_del_mac_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, uint16_t msg_size);
70 static enum i40e_status_code ixl_vf_enable_vlan_strip(struct ixl_pf *pf, struct ixl_vf *vf);
71 static void ixl_vf_add_vlan_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, uint16_t msg_size);
72 static void ixl_vf_del_vlan_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, uint16_t msg_size);
73 static void ixl_vf_config_promisc_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, uint16_t msg…
74 static void ixl_vf_get_stats_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, uint16_t msg_size…
75 static int ixl_vf_reserve_queues(struct ixl_pf *pf, struct ixl_vf *vf, int num_queues);
124 ixl_vf_alloc_vsi(struct ixl_pf *pf, struct ixl_vf *vf) in ixl_vf_alloc_vsi() argument
138 vsi_ctx.vf_num = hw->func_caps.vf_base_id + vf->vf_num; in ixl_vf_alloc_vsi()
150 if (vf->vf_flags & VF_FLAG_MAC_ANTI_SPOOF) in ixl_vf_alloc_vsi()
162 for (i = 0; i < vf->qtag.num_active; i++) in ixl_vf_alloc_vsi()
163 vsi_ctx.info.queue_mapping[i] = vf->qtag.qidx[i]; in ixl_vf_alloc_vsi()
169 ((fls(vf->qtag.num_allocated) - 1) << I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT)); in ixl_vf_alloc_vsi()
174 vf->vsi.seid = vsi_ctx.seid; in ixl_vf_alloc_vsi()
175 vf->vsi.vsi_num = vsi_ctx.vsi_number; in ixl_vf_alloc_vsi()
176 vf->vsi.num_rx_queues = vf->qtag.num_active; in ixl_vf_alloc_vsi()
177 vf->vsi.num_tx_queues = vf->qtag.num_active; in ixl_vf_alloc_vsi()
183 code = i40e_aq_config_vsi_bw_limit(hw, vf->vsi.seid, 0, 0, NULL); in ixl_vf_alloc_vsi()
190 memcpy(&vf->vsi.info, &vsi_ctx.info, sizeof(vf->vsi.info)); in ixl_vf_alloc_vsi()
195 ixl_vf_setup_vsi(struct ixl_pf *pf, struct ixl_vf *vf) in ixl_vf_setup_vsi() argument
201 vf->vsi.flags |= IXL_FLAGS_IS_VF; in ixl_vf_setup_vsi()
203 error = ixl_vf_alloc_vsi(pf, vf); in ixl_vf_setup_vsi()
207 vf->vsi.dev = pf->dev; in ixl_vf_setup_vsi()
209 ixl_init_filters(&vf->vsi); in ixl_vf_setup_vsi()
211 error = i40e_aq_set_vsi_broadcast(hw, vf->vsi.seid, TRUE, NULL); in ixl_vf_setup_vsi()
215 ixl_reconfigure_filters(&vf->vsi); in ixl_vf_setup_vsi()
221 ixl_vf_map_vsi_queue(struct i40e_hw *hw, struct ixl_vf *vf, int qnum, in ixl_vf_map_vsi_queue() argument
235 qtable = i40e_read_rx_ctl(hw, I40E_VSILAN_QTABLE(index, vf->vsi.vsi_num)); in ixl_vf_map_vsi_queue()
238 i40e_write_rx_ctl(hw, I40E_VSILAN_QTABLE(index, vf->vsi.vsi_num), qtable); in ixl_vf_map_vsi_queue()
242 ixl_vf_map_queues(struct ixl_pf *pf, struct ixl_vf *vf) in ixl_vf_map_queues() argument
254 i40e_write_rx_ctl(hw, I40E_VSILAN_QBASE(vf->vsi.vsi_num), in ixl_vf_map_queues()
258 wr32(hw, I40E_VPLAN_MAPENA(vf->vf_num), in ixl_vf_map_queues()
263 for (i = 0; i < vf->vsi.num_tx_queues; i++) { in ixl_vf_map_queues()
264 qtable = ixl_pf_qidx_from_vsi_qidx(&vf->qtag, i) << in ixl_vf_map_queues()
267 wr32(hw, I40E_VPLAN_QTABLE(i, vf->vf_num), qtable); in ixl_vf_map_queues()
270 wr32(hw, I40E_VPLAN_QTABLE(i, vf->vf_num), in ixl_vf_map_queues()
276 for (i = 0; i < vf->vsi.num_tx_queues; i++) in ixl_vf_map_queues()
277 ixl_vf_map_vsi_queue(hw, vf, i, in ixl_vf_map_queues()
278 ixl_pf_qidx_from_vsi_qidx(&vf->qtag, i)); in ixl_vf_map_queues()
282 ixl_vf_map_vsi_queue(hw, vf, i, in ixl_vf_map_queues()
319 ixl_vf_release_resources(struct ixl_pf *pf, struct ixl_vf *vf) in ixl_vf_release_resources() argument
327 ixl_vf_vsi_release(pf, &vf->vsi); in ixl_vf_release_resources()
330 ixl_vf_disable_queue_intr(hw, I40E_VFINT_DYN_CTL0(vf->vf_num)); in ixl_vf_release_resources()
333 vfint_reg = IXL_VFINT_DYN_CTLN_REG(hw, i , vf->vf_num); in ixl_vf_release_resources()
338 ixl_vf_unregister_intr(hw, I40E_VPINT_LNKLST0(vf->vf_num)); in ixl_vf_release_resources()
341 vpint_reg = IXL_VPINT_LNKLSTN_REG(hw, i, vf->vf_num); in ixl_vf_release_resources()
345 vf->vsi.num_tx_queues = 0; in ixl_vf_release_resources()
346 vf->vsi.num_rx_queues = 0; in ixl_vf_release_resources()
350 ixl_flush_pcie(struct ixl_pf *pf, struct ixl_vf *vf) in ixl_flush_pcie() argument
358 global_vf_num = hw->func_caps.vf_base_id + vf->vf_num; in ixl_flush_pcie()
373 ixl_reset_vf(struct ixl_pf *pf, struct ixl_vf *vf) in ixl_reset_vf() argument
380 ixl_dbg_iov(pf, "Resetting VF-%d\n", vf->vf_num); in ixl_reset_vf()
382 vfrtrig = rd32(hw, I40E_VPGEN_VFRTRIG(vf->vf_num)); in ixl_reset_vf()
384 wr32(hw, I40E_VPGEN_VFRTRIG(vf->vf_num), vfrtrig); in ixl_reset_vf()
387 ixl_reinit_vf(pf, vf); in ixl_reset_vf()
389 ixl_dbg_iov(pf, "Resetting VF-%d done.\n", vf->vf_num); in ixl_reset_vf()
393 ixl_reinit_vf(struct ixl_pf *pf, struct ixl_vf *vf) in ixl_reinit_vf() argument
401 error = ixl_flush_pcie(pf, vf); in ixl_reinit_vf()
405 vf->vf_num); in ixl_reinit_vf()
410 vfrstat = rd32(hw, I40E_VPGEN_VFRSTAT(vf->vf_num)); in ixl_reinit_vf()
416 device_printf(pf->dev, "VF %d failed to reset\n", vf->vf_num); in ixl_reinit_vf()
418 wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_num), VIRTCHNL_VFR_COMPLETED); in ixl_reinit_vf()
420 vfrtrig = rd32(hw, I40E_VPGEN_VFRTRIG(vf->vf_num)); in ixl_reinit_vf()
422 wr32(hw, I40E_VPGEN_VFRTRIG(vf->vf_num), vfrtrig); in ixl_reinit_vf()
424 if (vf->vsi.seid != 0) in ixl_reinit_vf()
425 ixl_disable_rings(pf, &vf->vsi, &vf->qtag); in ixl_reinit_vf()
426 ixl_pf_qmgr_clear_queue_flags(&vf->qtag); in ixl_reinit_vf()
428 ixl_vf_release_resources(pf, vf); in ixl_reinit_vf()
429 ixl_vf_setup_vsi(pf, vf); in ixl_reinit_vf()
430 ixl_vf_map_queues(pf, vf); in ixl_reinit_vf()
432 wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_num), VIRTCHNL_VFR_VFACTIVE); in ixl_reinit_vf()
448 ixl_send_vf_msg(struct ixl_pf *pf, struct ixl_vf *vf, uint16_t op, in ixl_send_vf_msg() argument
455 global_vf_id = hw->func_caps.vf_base_id + vf->vf_num; in ixl_send_vf_msg()
459 ixl_vc_opcode_str(op), op, status, vf->vf_num); in ixl_send_vf_msg()
465 ixl_send_vf_ack(struct ixl_pf *pf, struct ixl_vf *vf, uint16_t op) in ixl_send_vf_ack() argument
468 ixl_send_vf_msg(pf, vf, op, I40E_SUCCESS, NULL, 0); in ixl_send_vf_ack()
472 ixl_send_vf_nack_msg(struct ixl_pf *pf, struct ixl_vf *vf, uint16_t op, in ixl_send_vf_nack_msg() argument
479 status, vf->vf_num, file, line); in ixl_send_vf_nack_msg()
480 ixl_send_vf_msg(pf, vf, op, status, NULL, 0); in ixl_send_vf_nack_msg()
484 ixl_vf_version_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, in ixl_vf_version_msg() argument
494 vf->version.major = 1; in ixl_vf_version_msg()
495 vf->version.minor = VIRTCHNL_VERSION_MINOR_NO_VF_CAPS; in ixl_vf_version_msg()
497 vf->version.major = VIRTCHNL_VERSION_MAJOR; in ixl_vf_version_msg()
498 vf->version.minor = VIRTCHNL_VERSION_MINOR; in ixl_vf_version_msg()
504 __func__, vf->vf_num, in ixl_vf_version_msg()
509 ixl_send_vf_msg(pf, vf, VIRTCHNL_OP_VERSION, I40E_SUCCESS, in ixl_vf_version_msg()
510 &vf->version, sizeof(vf->version)); in ixl_vf_version_msg()
514 ixl_vf_reset_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, in ixl_vf_reset_msg() argument
517 ixl_reset_vf(pf, vf); in ixl_vf_reset_msg()
523 ixl_vf_get_resources_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, in ixl_vf_get_resources_msg() argument
530 if (vf->version.minor == VIRTCHNL_VERSION_MINOR_NO_VF_CAPS) in ixl_vf_get_resources_msg()
542 reply.num_queue_pairs = vf->vsi.num_tx_queues; in ixl_vf_get_resources_msg()
546 reply.vsi_res[0].vsi_id = vf->vsi.vsi_num; in ixl_vf_get_resources_msg()
548 reply.vsi_res[0].num_queue_pairs = vf->vsi.num_tx_queues; in ixl_vf_get_resources_msg()
549 memcpy(reply.vsi_res[0].default_mac_addr, vf->mac, ETHER_ADDR_LEN); in ixl_vf_get_resources_msg()
551 ixl_send_vf_msg(pf, vf, VIRTCHNL_OP_GET_VF_RESOURCES, in ixl_vf_get_resources_msg()
556 ixl_vf_config_tx_queue(struct ixl_pf *pf, struct ixl_vf *vf, in ixl_vf_config_tx_queue() argument
566 global_queue_num = ixl_pf_qidx_from_vsi_qidx(&vf->qtag, info->queue_id); in ixl_vf_config_tx_queue()
567 global_vf_num = hw->func_caps.vf_base_id + vf->vf_num; in ixl_vf_config_tx_queue()
571 vf->vf_num, global_queue_num, info->queue_id, global_vf_num); in ixl_vf_config_tx_queue()
582 txq.rdylist = le16_to_cpu(vf->vsi.info.qs_handle[0]); in ixl_vf_config_tx_queue()
595 ixl_pf_qmgr_mark_queue_configured(&vf->qtag, info->queue_id, true); in ixl_vf_config_tx_queue()
601 ixl_vf_config_rx_queue(struct ixl_pf *pf, struct ixl_vf *vf, in ixl_vf_config_rx_queue() argument
610 global_queue_num = ixl_pf_qidx_from_vsi_qidx(&vf->qtag, info->queue_id); in ixl_vf_config_rx_queue()
614 vf->vf_num, global_queue_num, info->queue_id); in ixl_vf_config_rx_queue()
662 ixl_pf_qmgr_mark_queue_configured(&vf->qtag, info->queue_id, false); in ixl_vf_config_rx_queue()
668 ixl_vf_config_vsi_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, in ixl_vf_config_vsi_msg() argument
676 if (info->num_queue_pairs == 0 || info->num_queue_pairs > vf->vsi.num_tx_queues) { in ixl_vf_config_vsi_msg()
678 vf->vf_num, info->num_queue_pairs, vf->vsi.num_tx_queues); in ixl_vf_config_vsi_msg()
679 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_CONFIG_VSI_QUEUES, in ixl_vf_config_vsi_msg()
684 if (info->vsi_id != vf->vsi.vsi_num) { in ixl_vf_config_vsi_msg()
686 vf->vf_num, info->vsi_id, vf->vsi.vsi_num); in ixl_vf_config_vsi_msg()
687 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_CONFIG_VSI_QUEUES, in ixl_vf_config_vsi_msg()
695 if (pair->txq.vsi_id != vf->vsi.vsi_num || in ixl_vf_config_vsi_msg()
696 pair->rxq.vsi_id != vf->vsi.vsi_num || in ixl_vf_config_vsi_msg()
698 pair->txq.queue_id >= vf->vsi.num_tx_queues) { in ixl_vf_config_vsi_msg()
700 i40e_send_vf_nack(pf, vf, in ixl_vf_config_vsi_msg()
705 if (ixl_vf_config_tx_queue(pf, vf, &pair->txq) != 0) { in ixl_vf_config_vsi_msg()
706 i40e_send_vf_nack(pf, vf, in ixl_vf_config_vsi_msg()
711 if (ixl_vf_config_rx_queue(pf, vf, &pair->rxq) != 0) { in ixl_vf_config_vsi_msg()
712 i40e_send_vf_nack(pf, vf, in ixl_vf_config_vsi_msg()
718 ixl_send_vf_ack(pf, vf, VIRTCHNL_OP_CONFIG_VSI_QUEUES); in ixl_vf_config_vsi_msg()
751 ixl_vf_config_vector(struct ixl_pf *pf, struct ixl_vf *vf, in ixl_vf_config_vector() argument
777 cur_queue = ixl_pf_qidx_from_vsi_qidx(&vf->qtag, qindex); in ixl_vf_config_vector()
786 cur_queue = ixl_pf_qidx_from_vsi_qidx(&vf->qtag, qindex); in ixl_vf_config_vector()
794 lnklst_reg = I40E_VPINT_LNKLST0(vf->vf_num); in ixl_vf_config_vector()
797 vf->vf_num); in ixl_vf_config_vector()
806 ixl_vf_config_irq_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, in ixl_vf_config_irq_msg() argument
821 vector->vsi_id != vf->vsi.vsi_num) { in ixl_vf_config_irq_msg()
822 i40e_send_vf_nack(pf, vf, in ixl_vf_config_irq_msg()
829 if (largest_rxq >= vf->vsi.num_rx_queues) { in ixl_vf_config_irq_msg()
830 i40e_send_vf_nack(pf, vf, in ixl_vf_config_irq_msg()
839 if (largest_txq >= vf->vsi.num_tx_queues) { in ixl_vf_config_irq_msg()
840 i40e_send_vf_nack(pf, vf, in ixl_vf_config_irq_msg()
849 i40e_send_vf_nack(pf, vf, in ixl_vf_config_irq_msg()
855 ixl_vf_config_vector(pf, vf, vector); in ixl_vf_config_irq_msg()
858 ixl_send_vf_ack(pf, vf, VIRTCHNL_OP_CONFIG_IRQ_MAP); in ixl_vf_config_irq_msg()
862 ixl_vf_enable_queues_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, in ixl_vf_enable_queues_msg() argument
870 if (select->vsi_id != vf->vsi.vsi_num || in ixl_vf_enable_queues_msg()
872 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_ENABLE_QUEUES, in ixl_vf_enable_queues_msg()
881 if (i >= vf->vsi.num_tx_queues) { in ixl_vf_enable_queues_msg()
883 vf->vf_num, i); in ixl_vf_enable_queues_msg()
887 if (!ixl_pf_qmgr_is_queue_configured(&vf->qtag, i, true)) in ixl_vf_enable_queues_msg()
890 if (ixl_pf_qmgr_is_queue_enabled(&vf->qtag, i, true)) in ixl_vf_enable_queues_msg()
892 vf->vf_num, i); in ixl_vf_enable_queues_msg()
894 error = ixl_enable_tx_ring(pf, &vf->qtag, i); in ixl_vf_enable_queues_msg()
898 ixl_pf_qmgr_mark_queue_enabled(&vf->qtag, i, true); in ixl_vf_enable_queues_msg()
906 if (i >= vf->vsi.num_rx_queues) { in ixl_vf_enable_queues_msg()
908 vf->vf_num, i); in ixl_vf_enable_queues_msg()
912 if (!ixl_pf_qmgr_is_queue_configured(&vf->qtag, i, false)) in ixl_vf_enable_queues_msg()
915 if (ixl_pf_qmgr_is_queue_enabled(&vf->qtag, i, false)) in ixl_vf_enable_queues_msg()
917 vf->vf_num, i); in ixl_vf_enable_queues_msg()
918 error = ixl_enable_rx_ring(pf, &vf->qtag, i); in ixl_vf_enable_queues_msg()
922 ixl_pf_qmgr_mark_queue_enabled(&vf->qtag, i, false); in ixl_vf_enable_queues_msg()
927 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_ENABLE_QUEUES, in ixl_vf_enable_queues_msg()
932 ixl_send_vf_ack(pf, vf, VIRTCHNL_OP_ENABLE_QUEUES); in ixl_vf_enable_queues_msg()
936 ixl_vf_disable_queues_msg(struct ixl_pf *pf, struct ixl_vf *vf, in ixl_vf_disable_queues_msg() argument
944 if (select->vsi_id != vf->vsi.vsi_num || in ixl_vf_disable_queues_msg()
946 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_DISABLE_QUEUES, in ixl_vf_disable_queues_msg()
955 if (i >= vf->vsi.num_tx_queues) { in ixl_vf_disable_queues_msg()
957 vf->vf_num, i); in ixl_vf_disable_queues_msg()
961 if (!ixl_pf_qmgr_is_queue_configured(&vf->qtag, i, true)) in ixl_vf_disable_queues_msg()
964 if (!ixl_pf_qmgr_is_queue_enabled(&vf->qtag, i, true)) { in ixl_vf_disable_queues_msg()
966 vf->vf_num, i); in ixl_vf_disable_queues_msg()
969 error = ixl_disable_tx_ring(pf, &vf->qtag, i); in ixl_vf_disable_queues_msg()
973 ixl_pf_qmgr_mark_queue_disabled(&vf->qtag, i, true); in ixl_vf_disable_queues_msg()
981 if (i >= vf->vsi.num_rx_queues) { in ixl_vf_disable_queues_msg()
983 vf->vf_num, i); in ixl_vf_disable_queues_msg()
987 if (!ixl_pf_qmgr_is_queue_configured(&vf->qtag, i, false)) in ixl_vf_disable_queues_msg()
990 if (!ixl_pf_qmgr_is_queue_enabled(&vf->qtag, i, false)) { in ixl_vf_disable_queues_msg()
992 vf->vf_num, i); in ixl_vf_disable_queues_msg()
995 error = ixl_disable_rx_ring(pf, &vf->qtag, i); in ixl_vf_disable_queues_msg()
999 ixl_pf_qmgr_mark_queue_disabled(&vf->qtag, i, false); in ixl_vf_disable_queues_msg()
1004 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_DISABLE_QUEUES, in ixl_vf_disable_queues_msg()
1009 ixl_send_vf_ack(pf, vf, VIRTCHNL_OP_DISABLE_QUEUES); in ixl_vf_disable_queues_msg()
1013 ixl_vf_mac_valid(struct ixl_vf *vf, const uint8_t *addr) in ixl_vf_mac_valid() argument
1024 if (!(vf->vf_flags & VF_FLAG_SET_MAC_CAP) && in ixl_vf_mac_valid()
1025 !(ETHER_IS_MULTICAST(addr) || !ixl_ether_is_equal(addr, vf->mac))) in ixl_vf_mac_valid()
1032 ixl_vf_add_mac_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, in ixl_vf_add_mac_msg() argument
1040 vsi = &vf->vsi; in ixl_vf_add_mac_msg()
1044 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_ADD_ETH_ADDR, in ixl_vf_add_mac_msg()
1050 if (ixl_vf_mac_valid(vf, addr_list->list[i].addr) != 0) { in ixl_vf_add_mac_msg()
1051 i40e_send_vf_nack(pf, vf, in ixl_vf_add_mac_msg()
1062 ixl_send_vf_ack(pf, vf, VIRTCHNL_OP_ADD_ETH_ADDR); in ixl_vf_add_mac_msg()
1066 ixl_vf_del_mac_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, in ixl_vf_del_mac_msg() argument
1074 vsi = &vf->vsi; in ixl_vf_del_mac_msg()
1078 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_DEL_ETH_ADDR, in ixl_vf_del_mac_msg()
1086 i40e_send_vf_nack(pf, vf, in ixl_vf_del_mac_msg()
1094 ixl_del_filter(&vf->vsi, addr->addr, IXL_VLAN_ANY); in ixl_vf_del_mac_msg()
1097 ixl_send_vf_ack(pf, vf, VIRTCHNL_OP_DEL_ETH_ADDR); in ixl_vf_del_mac_msg()
1101 ixl_vf_enable_vlan_strip(struct ixl_pf *pf, struct ixl_vf *vf) in ixl_vf_enable_vlan_strip() argument
1105 vsi_ctx.seid = vf->vsi.seid; in ixl_vf_enable_vlan_strip()
1115 ixl_vf_add_vlan_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, in ixl_vf_add_vlan_msg() argument
1124 if (filter_list->vsi_id != vf->vsi.vsi_num) { in ixl_vf_add_vlan_msg()
1125 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_ADD_VLAN, in ixl_vf_add_vlan_msg()
1130 if (!(vf->vf_flags & VF_FLAG_VLAN_CAP)) { in ixl_vf_add_vlan_msg()
1131 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_ADD_VLAN, in ixl_vf_add_vlan_msg()
1138 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_ADD_VLAN, in ixl_vf_add_vlan_msg()
1144 code = ixl_vf_enable_vlan_strip(pf, vf); in ixl_vf_add_vlan_msg()
1146 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_ADD_VLAN, in ixl_vf_add_vlan_msg()
1151 ixl_add_filter(&vf->vsi, vf->mac, filter_list->vlan_id[i]); in ixl_vf_add_vlan_msg()
1153 ixl_send_vf_ack(pf, vf, VIRTCHNL_OP_ADD_VLAN); in ixl_vf_add_vlan_msg()
1157 ixl_vf_del_vlan_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, in ixl_vf_del_vlan_msg() argument
1165 if (filter_list->vsi_id != vf->vsi.vsi_num) { in ixl_vf_del_vlan_msg()
1166 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_DEL_VLAN, in ixl_vf_del_vlan_msg()
1173 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_ADD_VLAN, in ixl_vf_del_vlan_msg()
1179 if (!(vf->vf_flags & VF_FLAG_VLAN_CAP)) { in ixl_vf_del_vlan_msg()
1180 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_ADD_VLAN, in ixl_vf_del_vlan_msg()
1186 ixl_del_filter(&vf->vsi, vf->mac, filter_list->vlan_id[i]); in ixl_vf_del_vlan_msg()
1188 ixl_send_vf_ack(pf, vf, VIRTCHNL_OP_DEL_VLAN); in ixl_vf_del_vlan_msg()
1192 ixl_vf_config_promisc_msg(struct ixl_pf *pf, struct ixl_vf *vf, in ixl_vf_config_promisc_msg() argument
1199 if (!(vf->vf_flags & VF_FLAG_PROMISC_CAP)) { in ixl_vf_config_promisc_msg()
1203 ixl_send_vf_ack(pf, vf, in ixl_vf_config_promisc_msg()
1209 if (info->vsi_id != vf->vsi.vsi_num) { in ixl_vf_config_promisc_msg()
1210 i40e_send_vf_nack(pf, vf, in ixl_vf_config_promisc_msg()
1215 code = i40e_aq_set_vsi_unicast_promiscuous(hw, vf->vsi.seid, in ixl_vf_config_promisc_msg()
1219 " error %s\n", vf->vsi.seid, i40e_stat_str(hw, code), in ixl_vf_config_promisc_msg()
1221 i40e_send_vf_nack(pf, vf, in ixl_vf_config_promisc_msg()
1226 code = i40e_aq_set_vsi_multicast_promiscuous(hw, vf->vsi.seid, in ixl_vf_config_promisc_msg()
1230 " error %s\n", vf->vsi.seid, i40e_stat_str(hw, code), in ixl_vf_config_promisc_msg()
1232 i40e_send_vf_nack(pf, vf, in ixl_vf_config_promisc_msg()
1237 ixl_send_vf_ack(pf, vf, VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE); in ixl_vf_config_promisc_msg()
1241 ixl_vf_get_stats_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, in ixl_vf_get_stats_msg() argument
1247 if (queue->vsi_id != vf->vsi.vsi_num) { in ixl_vf_get_stats_msg()
1248 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_GET_STATS, in ixl_vf_get_stats_msg()
1253 ixl_update_eth_stats(&vf->vsi); in ixl_vf_get_stats_msg()
1255 ixl_send_vf_msg(pf, vf, VIRTCHNL_OP_GET_STATS, in ixl_vf_get_stats_msg()
1256 I40E_SUCCESS, &vf->vsi.eth_stats, sizeof(vf->vsi.eth_stats)); in ixl_vf_get_stats_msg()
1260 ixl_vf_config_rss_key_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, in ixl_vf_config_rss_key_msg() argument
1274 vf->vf_num, key->key_len, 52); in ixl_vf_config_rss_key_msg()
1275 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_CONFIG_RSS_KEY, in ixl_vf_config_rss_key_msg()
1280 if (key->vsi_id != vf->vsi.vsi_num) { in ixl_vf_config_rss_key_msg()
1282 vf->vf_num, key->vsi_id, vf->vsi.vsi_num); in ixl_vf_config_rss_key_msg()
1283 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_CONFIG_RSS_KEY, in ixl_vf_config_rss_key_msg()
1297 status = i40e_aq_set_rss_key(hw, vf->vsi.vsi_num, &key_data); in ixl_vf_config_rss_key_msg()
1301 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_CONFIG_RSS_KEY, in ixl_vf_config_rss_key_msg()
1307 i40e_write_rx_ctl(hw, I40E_VFQF_HKEY1(i, vf->vf_num), ((u32 *)key->key)[i]); in ixl_vf_config_rss_key_msg()
1311 vf->vf_num, key->key[0]); in ixl_vf_config_rss_key_msg()
1313 ixl_send_vf_ack(pf, vf, VIRTCHNL_OP_CONFIG_RSS_KEY); in ixl_vf_config_rss_key_msg()
1317 ixl_vf_config_rss_lut_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, in ixl_vf_config_rss_lut_msg() argument
1330 vf->vf_num, lut->lut_entries, 64); in ixl_vf_config_rss_lut_msg()
1331 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_CONFIG_RSS_LUT, in ixl_vf_config_rss_lut_msg()
1336 if (lut->vsi_id != vf->vsi.vsi_num) { in ixl_vf_config_rss_lut_msg()
1338 vf->vf_num, lut->vsi_id, vf->vsi.vsi_num); in ixl_vf_config_rss_lut_msg()
1339 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_CONFIG_RSS_LUT, in ixl_vf_config_rss_lut_msg()
1346 status = i40e_aq_set_rss_lut(hw, vf->vsi.vsi_num, false, lut->lut, lut->lut_entries); in ixl_vf_config_rss_lut_msg()
1350 i40e_send_vf_nack(pf, vf, VIRTCHNL_OP_CONFIG_RSS_LUT, in ixl_vf_config_rss_lut_msg()
1356 i40e_write_rx_ctl(hw, I40E_VFQF_HLUT1(i, vf->vf_num), ((u32 *)lut->lut)[i]); in ixl_vf_config_rss_lut_msg()
1360 vf->vf_num, lut->lut[0], lut->lut_entries); in ixl_vf_config_rss_lut_msg()
1362 ixl_send_vf_ack(pf, vf, VIRTCHNL_OP_CONFIG_RSS_LUT); in ixl_vf_config_rss_lut_msg()
1366 ixl_vf_set_rss_hena_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, in ixl_vf_set_rss_hena_msg() argument
1376 i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(0, vf->vf_num), (u32)hena->hena); in ixl_vf_set_rss_hena_msg()
1377 i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(1, vf->vf_num), (u32)(hena->hena >> 32)); in ixl_vf_set_rss_hena_msg()
1380 vf->vf_num, hena->hena); in ixl_vf_set_rss_hena_msg()
1382 ixl_send_vf_ack(pf, vf, VIRTCHNL_OP_SET_RSS_HENA); in ixl_vf_set_rss_hena_msg()
1386 ixl_notify_vf_link_state(struct ixl_pf *pf, struct ixl_vf *vf) in ixl_notify_vf_link_state() argument
1398 ixl_send_vf_msg(pf, vf, VIRTCHNL_OP_EVENT, I40E_SUCCESS, &event, in ixl_notify_vf_link_state()
1415 struct ixl_vf *vf; in ixl_handle_vf_msg() local
1429 vf = &pf->vfs[vf_num]; in ixl_handle_vf_msg()
1436 (vf->vf_flags & VF_FLAG_ENABLED) ? " " : " disabled ", in ixl_handle_vf_msg()
1440 err = virtchnl_vc_validate_vf_msg(&vf->version, opcode, msg, msg_size); in ixl_handle_vf_msg()
1443 __func__, vf->vf_num, opcode, msg_size, err); in ixl_handle_vf_msg()
1444 i40e_send_vf_nack(pf, vf, opcode, I40E_ERR_PARAM); in ixl_handle_vf_msg()
1449 if (!(vf->vf_flags & VF_FLAG_ENABLED)) in ixl_handle_vf_msg()
1454 ixl_vf_version_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1457 ixl_vf_reset_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1460 ixl_vf_get_resources_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1464 ixl_notify_vf_link_state(pf, vf); in ixl_handle_vf_msg()
1467 ixl_vf_config_vsi_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1470 ixl_vf_config_irq_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1473 ixl_vf_enable_queues_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1477 ixl_notify_vf_link_state(pf, vf); in ixl_handle_vf_msg()
1480 ixl_vf_disable_queues_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1483 ixl_vf_add_mac_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1486 ixl_vf_del_mac_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1489 ixl_vf_add_vlan_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1492 ixl_vf_del_vlan_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1495 ixl_vf_config_promisc_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1498 ixl_vf_get_stats_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1501 ixl_vf_config_rss_key_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1504 ixl_vf_config_rss_lut_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1507 ixl_vf_set_rss_hena_msg(pf, vf, msg, msg_size); in ixl_handle_vf_msg()
1514 i40e_send_vf_nack(pf, vf, opcode, I40E_ERR_NOT_IMPLEMENTED); in ixl_handle_vf_msg()
1523 struct ixl_vf *vf; in ixl_handle_vflr() local
1543 vf = &pf->vfs[i]; in ixl_handle_vflr()
1544 if (!(vf->vf_flags & VF_FLAG_ENABLED)) in ixl_handle_vflr()
1555 ixl_reinit_vf(pf, vf); in ixl_handle_vflr()
1740 ixl_vf_reserve_queues(struct ixl_pf *pf, struct ixl_vf *vf, int num_queues) in ixl_vf_reserve_queues() argument
1748 num_queues, vf->vf_num); in ixl_vf_reserve_queues()
1750 device_printf(dev, "Setting VF %d num-queues to 1\n", vf->vf_num); in ixl_vf_reserve_queues()
1753 device_printf(dev, "Setting VF %d num-queues to %d\n", vf->vf_num, IAVF_MAX_QUEUES); in ixl_vf_reserve_queues()
1756 error = ixl_pf_qmgr_alloc_scattered(&pf->qmgr, num_queues, &vf->qtag); in ixl_vf_reserve_queues()
1759 num_queues, vf->vf_num); in ixl_vf_reserve_queues()
1764 vf->vf_num, vf->qtag.num_allocated, vf->qtag.num_active); in ixl_vf_reserve_queues()
1775 struct ixl_vf *vf; in ixl_if_iov_vf_add() local
1781 vf = &pf->vfs[vfnum]; in ixl_if_iov_vf_add()
1782 vf->vf_num = vfnum; in ixl_if_iov_vf_add()
1783 vf->vsi.back = pf; in ixl_if_iov_vf_add()
1784 vf->vf_flags = VF_FLAG_ENABLED; in ixl_if_iov_vf_add()
1788 error = ixl_vf_reserve_queues(pf, vf, vf_num_queues); in ixl_if_iov_vf_add()
1792 error = ixl_vf_setup_vsi(pf, vf); in ixl_if_iov_vf_add()
1798 bcopy(mac, vf->mac, ETHER_ADDR_LEN); in ixl_if_iov_vf_add()
1801 vf->vf_flags |= VF_FLAG_SET_MAC_CAP; in ixl_if_iov_vf_add()
1807 vf->vf_flags |= VF_FLAG_SET_MAC_CAP; in ixl_if_iov_vf_add()
1810 vf->vf_flags |= VF_FLAG_MAC_ANTI_SPOOF; in ixl_if_iov_vf_add()
1813 vf->vf_flags |= VF_FLAG_PROMISC_CAP; in ixl_if_iov_vf_add()
1815 vf->vf_flags |= VF_FLAG_VLAN_CAP; in ixl_if_iov_vf_add()
1818 ixl_reset_vf(pf, vf); in ixl_if_iov_vf_add()
1822 ixl_vsi_add_sysctls(&vf->vsi, sysctl_name, false); in ixl_if_iov_vf_add()