Lines Matching refs:vf

26 	struct i40e_vf *vf = pf->vf;
29 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) {
30 int abs_vf_id = vf->vf_id + (int)hw->func_caps.vf_base_id;
32 if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states) &&
33 !test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states))
79 * @vf: pointer to the VF structure
83 * set a link state on a single vf
85 static void i40e_set_vf_link_state(struct i40e_vf *vf,
90 if (vf->link_forced)
91 link_status = vf->link_up;
93 if (vf->driver_caps & VIRTCHNL_VF_CAP_ADV_LINK_SPEED) {
106 * @vf: pointer to the VF structure
110 static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf)
113 struct i40e_pf *pf = vf->pf;
116 int abs_vf_id = vf->vf_id + (int)hw->func_caps.vf_base_id;
121 i40e_set_vf_link_state(vf, &pfe, ls);
138 i40e_vc_notify_vf_link_state(&pf->vf[i]);
185 * @vf: pointer to the VF structure
189 void i40e_vc_notify_vf_reset(struct i40e_vf *vf)
195 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs)
199 if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states) &&
200 !test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states))
203 abs_vf_id = vf->vf_id + (int)vf->pf->hw.func_caps.vf_base_id;
207 i40e_aq_send_msg_to_vf(&vf->pf->hw, abs_vf_id, VIRTCHNL_OP_EVENT,
215 * @vf: pointer to the VF info
216 * @notify_vf: notify vf about reset or not
219 static void i40e_vc_reset_vf(struct i40e_vf *vf, bool notify_vf)
221 struct i40e_pf *pf = vf->pf;
225 i40e_vc_notify_vf_reset(vf);
238 if (i40e_reset_vf(vf, false))
244 dev_warn(&vf->pf->pdev->dev,
246 vf->vf_id);
248 dev_dbg(&vf->pf->pdev->dev,
250 vf->vf_id);
255 * @vf: pointer to the VF info
260 static inline bool i40e_vc_isvalid_vsi_id(struct i40e_vf *vf, u16 vsi_id)
262 struct i40e_pf *pf = vf->pf;
265 return (vsi && (vsi->vf_id == vf->vf_id));
270 * @vf: pointer to the VF info
276 static inline bool i40e_vc_isvalid_queue_id(struct i40e_vf *vf, u16 vsi_id,
279 struct i40e_pf *pf = vf->pf;
287 * @vf: pointer to the VF info
292 static inline bool i40e_vc_isvalid_vector_id(struct i40e_vf *vf, u32 vector_id)
294 struct i40e_pf *pf = vf->pf;
299 /***********************vf resource mgmt routines*****************/
303 * @vf: pointer to the VF info
309 static u16 i40e_vc_get_pf_queue_id(struct i40e_vf *vf, u16 vsi_id,
312 struct i40e_pf *pf = vf->pf;
332 * @vf: pointer to the VF info
338 static u16 i40e_get_real_pf_qid(struct i40e_vf *vf, u16 vsi_id, u16 queue_id)
342 if (vf->adq_enabled) {
347 for (i = 0; i < vf->num_tc; i++) {
348 if (queue_id < vf->ch[i].num_qps) {
349 vsi_id = vf->ch[i].vsi_id;
355 queue_id -= vf->ch[i].num_qps;
359 return i40e_vc_get_pf_queue_id(vf, vsi_id, queue_id);
364 * @vf: pointer to the VF info
370 static void i40e_config_irq_link_list(struct i40e_vf *vf, u16 vsi_id,
374 struct i40e_pf *pf = vf->pf;
385 reg_idx = I40E_VPINT_LNKLST0(vf->vf_id);
388 ((pf->hw.func_caps.num_msix_vectors_vf - 1) * vf->vf_id) +
415 pf_queue_id = i40e_get_real_pf_qid(vf, vsi_id, vsi_queue_id);
438 pf_queue_id = i40e_get_real_pf_qid(vf,
455 /* if the vf is running in polling mode and using interrupt zero,
458 if ((vf->driver_caps & VIRTCHNL_VF_OFFLOAD_RX_POLLING) &&
473 * @vf: pointer to the VF.
476 static void i40e_release_rdma_qvlist(struct i40e_vf *vf)
478 struct i40e_pf *pf = vf->pf;
479 struct virtchnl_rdma_qvlist_info *qvlist_info = vf->qvlist_info;
483 if (!vf->qvlist_info)
499 reg_idx = (msix_vf - 1) * vf->vf_id + qv_info->ceq_idx;
506 reg_idx = ((msix_vf - 1) * vf->vf_id) + (v_idx - 1);
515 kfree(vf->qvlist_info);
516 vf->qvlist_info = NULL;
521 * @vf: pointer to the VF info
527 i40e_config_rdma_qvlist(struct i40e_vf *vf,
530 struct i40e_pf *pf = vf->pf;
550 kfree(vf->qvlist_info);
551 size = virtchnl_struct_size(vf->qvlist_info, qv_info,
553 vf->qvlist_info = kzalloc(size, GFP_KERNEL);
554 if (!vf->qvlist_info) {
558 vf->qvlist_info->num_vectors = qvlist_info->num_vectors;
564 /* Validate vector id belongs to this vf */
565 if (!i40e_vc_isvalid_vector_id(vf, qv_info->v_idx)) {
572 vf->qvlist_info->qv_info[i] = *qv_info;
574 reg_idx = ((msix_vf - 1) * vf->vf_id) + (v_idx - 1);
586 reg_idx = (msix_vf - 1) * vf->vf_id + qv_info->ceq_idx;
594 reg_idx = ((msix_vf - 1) * vf->vf_id) + (v_idx - 1);
607 wr32(hw, I40E_VPINT_AEQCTL(vf->vf_id), reg);
613 kfree(vf->qvlist_info);
614 vf->qvlist_info = NULL;
621 * @vf: pointer to the VF info
628 static int i40e_config_vsi_tx_queue(struct i40e_vf *vf, u16 vsi_id,
632 struct i40e_pf *pf = vf->pf;
640 if (!i40e_vc_isvalid_vsi_id(vf, info->vsi_id)) {
644 pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, vsi_queue_id);
686 vf->vf_id + hw->func_caps.vf_base_id);
696 * @vf: pointer to the VF info
703 static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id,
707 u16 pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, vsi_queue_id);
708 struct i40e_pf *pf = vf->pf;
709 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx];
790 * @vf: pointer to the VF info
795 static int i40e_alloc_vsi_res(struct i40e_vf *vf, u8 idx)
798 struct i40e_pf *pf = vf->pf;
804 vf->vf_id);
809 vf->vf_id, pf->hw.aq.asq_last_status);
818 vf->lan_vsi_idx = vsi->idx;
819 vf->lan_vsi_id = vsi->id;
826 if (vf->port_vlan_id)
827 i40e_vsi_add_pvid(vsi, vf->port_vlan_id);
830 if (is_valid_ether_addr(vf->default_lan_addr.addr)) {
832 vf->default_lan_addr.addr);
836 vf->default_lan_addr.addr, vf->vf_id);
844 wr32(&pf->hw, I40E_VFQF_HENA1(0, vf->vf_id), (u32)hena);
845 wr32(&pf->hw, I40E_VFQF_HENA1(1, vf->vf_id), (u32)(hena >> 32));
853 if (vf->adq_enabled) {
854 vf->ch[idx].vsi_idx = vsi->idx;
855 vf->ch[idx].vsi_id = vsi->id;
859 if (vf->tx_rate) {
860 max_tx_rate = vf->tx_rate;
861 } else if (vf->ch[idx].max_tx_rate) {
862 max_tx_rate = vf->ch[idx].max_tx_rate;
871 vf->vf_id, ret);
880 * @vf: pointer to the VF info
885 static void i40e_map_pf_queues_to_vsi(struct i40e_vf *vf)
887 struct i40e_pf *pf = vf->pf;
893 if (vf->adq_enabled)
894 num_tc = vf->num_tc;
897 if (vf->adq_enabled) {
898 qps = vf->ch[i].num_qps;
899 vsi_id = vf->ch[i].vsi_id;
901 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs;
902 vsi_id = vf->lan_vsi_id;
910 u16 qid = i40e_vc_get_pf_queue_id(vf,
914 qid = i40e_vc_get_pf_queue_id(vf, vsi_id,
927 * @vf: pointer to the VF info
932 static void i40e_map_pf_to_vf_queues(struct i40e_vf *vf)
934 struct i40e_pf *pf = vf->pf;
941 if (vf->adq_enabled)
942 num_tc = vf->num_tc;
945 if (vf->adq_enabled) {
946 qps = vf->ch[i].num_qps;
947 vsi_id = vf->ch[i].vsi_id;
949 qps = pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs;
950 vsi_id = vf->lan_vsi_id;
954 qid = i40e_vc_get_pf_queue_id(vf, vsi_id, j);
957 wr32(hw, I40E_VPLAN_QTABLE(total_qps, vf->vf_id),
966 * @vf: pointer to the VF info
970 static void i40e_enable_vf_mappings(struct i40e_vf *vf)
972 struct i40e_pf *pf = vf->pf;
980 i40e_write_rx_ctl(hw, I40E_VSILAN_QBASE(vf->lan_vsi_id),
985 wr32(hw, I40E_VPLAN_MAPENA(vf->vf_id), reg);
987 i40e_map_pf_to_vf_queues(vf);
988 i40e_map_pf_queues_to_vsi(vf);
995 * @vf: pointer to the VF info
999 static void i40e_disable_vf_mappings(struct i40e_vf *vf)
1001 struct i40e_pf *pf = vf->pf;
1006 wr32(hw, I40E_VPLAN_MAPENA(vf->vf_id), 0);
1008 wr32(hw, I40E_VPLAN_QTABLE(i, vf->vf_id),
1015 * @vf: pointer to the VF info
1019 static void i40e_free_vf_res(struct i40e_vf *vf)
1021 struct i40e_pf *pf = vf->pf;
1029 clear_bit(I40E_VF_STATE_INIT, &vf->vf_states);
1034 if (vf->num_queue_pairs > I40E_DEFAULT_QUEUES_PER_VF) {
1035 pf->queues_left += vf->num_queue_pairs -
1040 if (vf->lan_vsi_idx) {
1041 i40e_vsi_release(pf->vsi[vf->lan_vsi_idx]);
1042 vf->lan_vsi_idx = 0;
1043 vf->lan_vsi_id = 0;
1047 if (vf->adq_enabled && vf->ch[0].vsi_idx) {
1048 for (j = 0; j < vf->num_tc; j++) {
1054 i40e_vsi_release(pf->vsi[vf->ch[j].vsi_idx]);
1055 vf->ch[j].vsi_idx = 0;
1056 vf->ch[j].vsi_id = 0;
1065 reg_idx = I40E_VFINT_DYN_CTL0(vf->vf_id);
1068 (vf->vf_id))
1078 reg_idx = I40E_VPINT_LNKLST0(vf->vf_id);
1081 (vf->vf_id))
1089 vf->num_queue_pairs = 0;
1090 clear_bit(I40E_VF_STATE_MC_PROMISC, &vf->vf_states);
1091 clear_bit(I40E_VF_STATE_UC_PROMISC, &vf->vf_states);
1096 * @vf: pointer to the VF info
1100 static int i40e_alloc_vf_res(struct i40e_vf *vf)
1102 struct i40e_pf *pf = vf->pf;
1106 if (vf->num_req_queues &&
1107 vf->num_req_queues <= pf->queues_left + I40E_DEFAULT_QUEUES_PER_VF)
1108 pf->num_vf_qps = vf->num_req_queues;
1113 ret = i40e_alloc_vsi_res(vf, 0);
1116 total_queue_pairs += pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs;
1119 if (vf->adq_enabled) {
1123 for (idx = 1; idx < vf->num_tc; idx++) {
1124 ret = i40e_alloc_vsi_res(vf, idx);
1132 vf->vf_id);
1133 vf->adq_enabled = false;
1146 if (vf->trusted)
1147 set_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps);
1149 clear_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps);
1154 vf->num_queue_pairs = total_queue_pairs;
1157 set_bit(I40E_VF_STATE_INIT, &vf->vf_states);
1161 i40e_free_vf_res(vf);
1170 * @vf: pointer to the VF structure
1175 static int i40e_quiesce_vf_pci(struct i40e_vf *vf)
1177 struct i40e_pf *pf = vf->pf;
1182 vf_abs_id = vf->vf_id + hw->func_caps.vf_base_id;
1264 * @vf: pointer to the VF struct
1274 i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
1277 struct i40e_pf *pf = vf->pf;
1292 vf->vf_id,
1308 vf->vf_id,
1325 vf->vf_id,
1341 vf->vf_id,
1358 * @vf: pointer to the VF info
1366 static int i40e_config_vf_promiscuous_mode(struct i40e_vf *vf,
1371 struct i40e_pf *pf = vf->pf;
1378 if (!i40e_vc_isvalid_vsi_id(vf, vsi_id) || !vsi)
1381 if (vf->port_vlan_id) {
1382 aq_ret = i40e_set_vsi_promisc(vf, vsi->seid, allmulti,
1383 alluni, &vf->port_vlan_id, 1);
1391 aq_ret = i40e_set_vsi_promisc(vf, vsi->seid, allmulti, alluni,
1398 aq_ret = i40e_set_vsi_promisc(vf, vsi->seid, allmulti, alluni,
1431 * @vf: pointer to the VF structure
1438 static void i40e_trigger_vf_reset(struct i40e_vf *vf, bool flr)
1440 struct i40e_pf *pf = vf->pf;
1447 vf_active = test_and_clear_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states);
1455 clear_bit(I40E_VF_STATE_INIT, &vf->vf_states);
1462 radq = rd32(hw, I40E_VFINT_ICR0_ENA(vf->vf_id)) &
1466 if (i40e_sync_vfr_reset(hw, vf->vf_id))
1469 vf->vf_id);
1474 reg = rd32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id));
1476 wr32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id), reg);
1480 reg_idx = (hw->func_caps.vf_base_id + vf->vf_id) / 32;
1481 bit_idx = (hw->func_caps.vf_base_id + vf->vf_id) % 32;
1485 if (i40e_quiesce_vf_pci(vf))
1487 vf->vf_id);
1492 * @vf: pointer to the VF structure
1498 static void i40e_cleanup_reset_vf(struct i40e_vf *vf)
1500 struct i40e_pf *pf = vf->pf;
1505 i40e_config_vf_promiscuous_mode(vf, vf->lan_vsi_id, false, false);
1508 i40e_free_vf_res(vf);
1520 reg = rd32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id));
1522 wr32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id), reg);
1525 if (!i40e_alloc_vf_res(vf)) {
1526 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1527 i40e_enable_vf_mappings(vf);
1528 set_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states);
1529 clear_bit(I40E_VF_STATE_DISABLED, &vf->vf_states);
1532 &vf->vf_states))
1534 vf->num_vlan = 0;
1541 wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_id), VIRTCHNL_VFR_VFACTIVE);
1546 * @vf: pointer to the VF structure
1552 bool i40e_reset_vf(struct i40e_vf *vf, bool flr)
1554 struct i40e_pf *pf = vf->pf;
1568 if (test_and_set_bit(I40E_VF_STATE_RESETTING, &vf->vf_states))
1571 i40e_trigger_vf_reset(vf, flr);
1583 reg = rd32(hw, I40E_VPGEN_VFRSTAT(vf->vf_id));
1595 vf->vf_id);
1599 if (vf->lan_vsi_idx != 0)
1600 i40e_vsi_stop_rings(pf->vsi[vf->lan_vsi_idx]);
1602 i40e_cleanup_reset_vf(vf);
1606 clear_bit(I40E_VF_STATE_RESETTING, &vf->vf_states);
1626 struct i40e_vf *vf;
1639 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) {
1641 if (!test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states))
1642 i40e_trigger_vf_reset(vf, flr);
1651 for (i = 0, vf = &pf->vf[0]; i < 10 && vf < &pf->vf[pf->num_alloc_vfs]; ++i) {
1657 while (vf < &pf->vf[pf->num_alloc_vfs]) {
1658 if (!test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states)) {
1659 reg = rd32(hw, I40E_VPGEN_VFRSTAT(vf->vf_id));
1667 ++vf;
1677 if (vf < &pf->vf[pf->num_alloc_vfs])
1679 vf->vf_id);
1685 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) {
1687 if (vf->lan_vsi_idx == 0)
1691 if (test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states))
1694 i40e_vsi_stop_rings_no_wait(pf->vsi[vf->lan_vsi_idx]);
1700 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) {
1702 if (vf->lan_vsi_idx == 0)
1706 if (test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states))
1709 i40e_vsi_wait_queues_disabled(pf->vsi[vf->lan_vsi_idx]);
1718 for (vf = &pf->vf[0]; vf < &pf->vf[pf->num_alloc_vfs]; ++vf) {
1720 if (test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states))
1723 i40e_cleanup_reset_vf(vf);
1745 if (!pf->vf)
1765 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states))
1768 i40e_vsi_stop_rings_no_wait(pf->vsi[pf->vf[i].lan_vsi_idx]);
1772 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states))
1775 i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[i].lan_vsi_idx]);
1782 if (test_bit(I40E_VF_STATE_INIT, &pf->vf[i].vf_states))
1783 i40e_free_vf_res(&pf->vf[i]);
1785 i40e_disable_vf_mappings(&pf->vf[i]);
1788 kfree(pf->vf);
1789 pf->vf = NULL;
1840 pf->vf = vfs;
1966 * @vf: pointer to the VF info
1974 static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode,
1983 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs)
1986 pf = vf->pf;
1988 abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
1995 vf->vf_id, pf->hw.aq.asq_last_status);
2004 * @vf: pointer to the VF info
2010 static int i40e_vc_send_resp_to_vf(struct i40e_vf *vf,
2014 return i40e_vc_send_msg_to_vf(vf, opcode, retval, NULL, 0);
2019 * @vf: pointer to the VF info
2025 static bool i40e_sync_vf_state(struct i40e_vf *vf, enum i40e_vf_states state)
2035 if (test_bit(state, &vf->vf_states))
2040 return test_bit(state, &vf->vf_states);
2045 * @vf: pointer to the VF info
2050 static int i40e_vc_get_version_msg(struct i40e_vf *vf, u8 *msg)
2056 vf->vf_ver = *(struct virtchnl_version_info *)msg;
2058 if (VF_IS_V10(&vf->vf_ver))
2060 return i40e_vc_send_msg_to_vf(vf, VIRTCHNL_OP_VERSION,
2067 * @vf: pointer to VF structure
2069 static void i40e_del_qch(struct i40e_vf *vf)
2071 struct i40e_pf *pf = vf->pf;
2077 for (i = 1; i < vf->num_tc; i++) {
2078 if (vf->ch[i].vsi_idx) {
2079 i40e_vsi_release(pf->vsi[vf->ch[i].vsi_idx]);
2080 vf->ch[i].vsi_idx = 0;
2081 vf->ch[i].vsi_id = 0;
2088 * @vf: pointer to the VF
2095 static u16 i40e_vc_get_max_frame_size(struct i40e_vf *vf)
2097 u16 max_frame_size = vf->pf->hw.phy.link_info.max_frame_size;
2099 if (vf->port_vlan_id)
2107 * @vf: pointer to the VF info
2112 static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
2115 struct i40e_pf *pf = vf->pf;
2122 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_INIT)) {
2134 if (VF_IS_V11(&vf->vf_ver))
2135 vf->driver_caps = *(u32 *)msg;
2137 vf->driver_caps = VIRTCHNL_VF_OFFLOAD_L2 |
2143 vsi = pf->vsi[vf->lan_vsi_idx];
2147 if (i40e_vf_client_capable(pf, vf->vf_id) &&
2148 (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_RDMA)) {
2150 set_bit(I40E_VF_STATE_RDMAENA, &vf->vf_states);
2152 clear_bit(I40E_VF_STATE_RDMAENA, &vf->vf_states);
2155 if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
2159 (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_RSS_AQ))
2166 if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2)
2171 if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_ENCAP)
2175 (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM))
2178 if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_RX_POLLING) {
2182 vf->vf_id);
2190 if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR)
2195 if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_REQ_QUEUES)
2198 if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_ADQ)
2202 vfres->num_queue_pairs = vf->num_queue_pairs;
2206 vfres->max_mtu = i40e_vc_get_max_frame_size(vf);
2208 if (vf->lan_vsi_idx) {
2209 vfres->vsi_res[0].vsi_id = vf->lan_vsi_id;
2215 if (!(vf->driver_caps & VIRTCHNL_VF_OFFLOAD_USO) && !vf->pf_set_mac) {
2216 i40e_del_mac_filter(vsi, vf->default_lan_addr.addr);
2217 eth_zero_addr(vf->default_lan_addr.addr);
2220 vf->default_lan_addr.addr);
2222 set_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states);
2226 ret = i40e_vc_send_msg_to_vf(vf, VIRTCHNL_OP_GET_VF_RESOURCES,
2235 * @vf: pointer to the VF info
2241 static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf, u8 *msg)
2245 struct i40e_pf *pf = vf->pf;
2250 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
2254 if (!test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps)) {
2257 vf->vf_id);
2271 if (!i40e_vc_isvalid_vsi_id(vf, info->vsi_id)) {
2282 aq_ret = i40e_config_vf_promiscuous_mode(vf, info->vsi_id, allmulti,
2289 &vf->vf_states))
2292 vf->vf_id);
2294 &vf->vf_states))
2297 vf->vf_id);
2301 &vf->vf_states))
2304 vf->vf_id);
2306 &vf->vf_states))
2309 vf->vf_id);
2313 return i40e_vc_send_resp_to_vf(vf,
2320 * @vf: pointer to the VF info
2326 static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg)
2332 struct i40e_pf *pf = vf->pf;
2338 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
2343 if (!i40e_vc_isvalid_vsi_id(vf, qci->vsi_id)) {
2353 if (vf->adq_enabled) {
2354 for (i = 0; i < vf->num_tc; i++)
2355 num_qps_all += vf->ch[i].num_qps;
2367 if (!vf->adq_enabled) {
2368 if (!i40e_vc_isvalid_queue_id(vf, vsi_id,
2384 if (vf->adq_enabled) {
2385 if (idx >= ARRAY_SIZE(vf->ch)) {
2389 vsi_id = vf->ch[idx].vsi_id;
2392 if (i40e_config_vsi_rx_queue(vf, vsi_id, vsi_queue_id,
2394 i40e_config_vsi_tx_queue(vf, vsi_id, vsi_queue_id,
2405 if (vf->adq_enabled) {
2406 if (idx >= ARRAY_SIZE(vf->ch)) {
2410 if (j == (vf->ch[idx].num_qps - 1)) {
2421 if (!vf->adq_enabled) {
2422 pf->vsi[vf->lan_vsi_idx]->num_queue_pairs =
2425 for (i = 0; i < vf->num_tc; i++) {
2426 vsi = pf->vsi[vf->ch[i].vsi_idx];
2427 vsi->num_queue_pairs = vf->ch[i].num_qps;
2438 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_CONFIG_VSI_QUEUES,
2444 * @vf: the VF structure pointer
2450 static int i40e_validate_queue_map(struct i40e_vf *vf, u16 vsi_id,
2456 if (vf->adq_enabled) {
2457 vsi_id = vf->ch[vsi_queue_id / I40E_MAX_VF_VSI].vsi_id;
2463 if (!i40e_vc_isvalid_queue_id(vf, vsi_id, queue_id))
2472 * @vf: pointer to the VF info
2478 static int i40e_vc_config_irq_map_msg(struct i40e_vf *vf, u8 *msg)
2487 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
2493 vf->pf->hw.func_caps.num_msix_vectors_vf) {
2501 if (!i40e_vc_isvalid_vector_id(vf, map->vector_id) ||
2502 !i40e_vc_isvalid_vsi_id(vf, map->vsi_id)) {
2508 if (i40e_validate_queue_map(vf, vsi_id, map->rxq_map)) {
2513 if (i40e_validate_queue_map(vf, vsi_id, map->txq_map)) {
2518 i40e_config_irq_link_list(vf, vsi_id, map);
2522 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_CONFIG_IRQ_MAP,
2589 * @vf: pointer to the VF info
2594 static int i40e_vc_enable_queues_msg(struct i40e_vf *vf, u8 *msg)
2598 struct i40e_pf *pf = vf->pf;
2602 if (vf->is_disabled_from_host) {
2606 vf->vf_id);
2610 if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states)) {
2615 if (!i40e_vc_isvalid_vsi_id(vf, vqs->vsi_id)) {
2626 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues,
2631 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues,
2638 if (vf->adq_enabled) {
2640 for (i = 1; i < vf->num_tc; i++) {
2641 if (i40e_vsi_start_rings(pf->vsi[vf->ch[i].vsi_idx]))
2648 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ENABLE_QUEUES,
2654 * @vf: pointer to the VF info
2660 static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg)
2664 struct i40e_pf *pf = vf->pf;
2667 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
2672 if (!i40e_vc_isvalid_vsi_id(vf, vqs->vsi_id)) {
2683 if (i40e_ctrl_vf_tx_rings(pf->vsi[vf->lan_vsi_idx], vqs->tx_queues,
2688 if (i40e_ctrl_vf_rx_rings(pf->vsi[vf->lan_vsi_idx], vqs->rx_queues,
2695 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DISABLE_QUEUES,
2701 * @vf: pointer to the VF info
2706 static int i40e_check_enough_queue(struct i40e_vf *vf, u16 needed)
2710 struct i40e_pf *pf = vf->pf;
2713 vsi = pf->vsi[vf->lan_vsi_idx];
2754 * @vf: pointer to the VF info
2762 static int i40e_vc_request_queues_msg(struct i40e_vf *vf, u8 *msg)
2767 u8 cur_pairs = vf->num_queue_pairs;
2768 struct i40e_pf *pf = vf->pf;
2770 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE))
2776 vf->vf_id,
2782 vf->vf_id,
2786 } else if (i40e_check_enough_queue(vf, req_pairs) < 0) {
2789 vf->vf_id,
2794 vf->num_req_queues = req_pairs;
2795 i40e_vc_reset_vf(vf, true);
2799 return i40e_vc_send_msg_to_vf(vf, VIRTCHNL_OP_REQUEST_QUEUES, 0,
2805 * @vf: pointer to the VF info
2810 static int i40e_vc_get_stats_msg(struct i40e_vf *vf, u8 *msg)
2814 struct i40e_pf *pf = vf->pf;
2821 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
2826 if (!i40e_vc_isvalid_vsi_id(vf, vqs->vsi_id)) {
2831 vsi = pf->vsi[vf->lan_vsi_idx];
2841 return i40e_vc_send_msg_to_vf(vf, VIRTCHNL_OP_GET_STATS, aq_ret,
2847 * @vf: pointer to the VF info
2851 static bool i40e_can_vf_change_mac(struct i40e_vf *vf)
2857 if (vf->pf_set_mac && !vf->trusted)
2880 * @vf: pointer to the VF info
2895 static inline int i40e_check_vf_permission(struct i40e_vf *vf,
2898 struct i40e_pf *pf = vf->pf;
2899 struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx];
2922 if (!i40e_can_vf_change_mac(vf) &&
2924 !ether_addr_equal(addr, vf->default_lan_addr.addr)) {
2940 if (!test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps)) {
3004 * @vf: VF to update
3010 i40e_update_vf_mac_addr(struct i40e_vf *vf,
3023 ether_addr_copy(vf->default_lan_addr.addr, mac_addr);
3025 if (is_zero_ether_addr(vf->default_lan_addr.addr))
3026 ether_addr_copy(vf->default_lan_addr.addr, mac_addr);
3032 * @vf: pointer to the VF info
3037 static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
3041 struct i40e_pf *pf = vf->pf;
3046 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) ||
3047 !i40e_vc_isvalid_vsi_id(vf, al->vsi_id)) {
3052 vsi = pf->vsi[vf->lan_vsi_idx];
3059 ret = i40e_check_vf_permission(vf, al);
3076 al->list[i].addr, vf->vf_id);
3082 i40e_update_vf_mac_addr(vf, &al->list[i]);
3090 vf->vf_id, ret);
3094 return i40e_vc_send_msg_to_vf(vf, VIRTCHNL_OP_ADD_ETH_ADDR,
3100 * @vf: pointer to the VF info
3105 static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
3110 struct i40e_pf *pf = vf->pf;
3115 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) ||
3116 !i40e_vc_isvalid_vsi_id(vf, al->vsi_id)) {
3125 al->list[i].addr, vf->vf_id);
3130 vsi = pf->vsi[vf->lan_vsi_idx];
3140 if (ether_addr_equal(addr, vf->default_lan_addr.addr)) {
3141 if (i40e_can_vf_change_mac(vf))
3157 eth_zero_addr(vf->default_lan_addr.addr);
3163 vf->vf_id, ret);
3165 if (vf->trusted && was_unimac_deleted) {
3178 ether_addr_copy(vf->default_lan_addr.addr, macaddr);
3183 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DEL_ETH_ADDR, ret);
3188 * @vf: pointer to the VF info
3193 static int i40e_vc_add_vlan_msg(struct i40e_vf *vf, u8 *msg)
3197 struct i40e_pf *pf = vf->pf;
3202 if ((vf->num_vlan >= I40E_VC_MAX_VLAN_PER_VF) &&
3203 !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps)) {
3208 if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states) ||
3209 !i40e_vc_isvalid_vsi_id(vf, vfl->vsi_id)) {
3222 vsi = pf->vsi[vf->lan_vsi_idx];
3233 vf->num_vlan++;
3235 if (test_bit(I40E_VF_STATE_UC_PROMISC, &vf->vf_states))
3240 if (test_bit(I40E_VF_STATE_MC_PROMISC, &vf->vf_states))
3249 vfl->vlan_id[i], vf->vf_id, ret);
3254 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ADD_VLAN, aq_ret);
3259 * @vf: pointer to the VF info
3264 static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg)
3268 struct i40e_pf *pf = vf->pf;
3273 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) ||
3274 !i40e_vc_isvalid_vsi_id(vf, vfl->vsi_id)) {
3286 vsi = pf->vsi[vf->lan_vsi_idx];
3295 vf->num_vlan--;
3297 if (test_bit(I40E_VF_STATE_UC_PROMISC, &vf->vf_states))
3302 if (test_bit(I40E_VF_STATE_MC_PROMISC, &vf->vf_states))
3311 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DEL_VLAN, aq_ret);
3316 * @vf: pointer to the VF info
3322 static int i40e_vc_rdma_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
3324 struct i40e_pf *pf = vf->pf;
3325 int abs_vf_id = vf->vf_id + pf->hw.func_caps.vf_base_id;
3328 if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states) ||
3329 !test_bit(I40E_VF_STATE_RDMAENA, &vf->vf_states)) {
3339 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_RDMA,
3345 * @vf: pointer to the VF info
3351 static int i40e_vc_rdma_qvmap_msg(struct i40e_vf *vf, u8 *msg, bool config)
3357 if (!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states) ||
3358 !test_bit(I40E_VF_STATE_RDMAENA, &vf->vf_states)) {
3364 if (i40e_config_rdma_qvlist(vf, qvlist_info))
3367 i40e_release_rdma_qvlist(vf);
3372 return i40e_vc_send_resp_to_vf(vf,
3380 * @vf: pointer to the VF info
3385 static int i40e_vc_config_rss_key(struct i40e_vf *vf, u8 *msg)
3389 struct i40e_pf *pf = vf->pf;
3393 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) ||
3394 !i40e_vc_isvalid_vsi_id(vf, vrk->vsi_id) ||
3400 vsi = pf->vsi[vf->lan_vsi_idx];
3404 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_CONFIG_RSS_KEY,
3410 * @vf: pointer to the VF info
3415 static int i40e_vc_config_rss_lut(struct i40e_vf *vf, u8 *msg)
3419 struct i40e_pf *pf = vf->pf;
3424 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE) ||
3425 !i40e_vc_isvalid_vsi_id(vf, vrl->vsi_id) ||
3432 if (vrl->lut[i] >= vf->num_queue_pairs) {
3437 vsi = pf->vsi[vf->lan_vsi_idx];
3441 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_CONFIG_RSS_LUT,
3447 * @vf: pointer to the VF info
3452 static int i40e_vc_get_rss_hena(struct i40e_vf *vf, u8 *msg)
3455 struct i40e_pf *pf = vf->pf;
3459 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
3474 aq_ret = i40e_vc_send_msg_to_vf(vf, VIRTCHNL_OP_GET_RSS_HENA_CAPS,
3482 * @vf: pointer to the VF info
3487 static int i40e_vc_set_rss_hena(struct i40e_vf *vf, u8 *msg)
3491 struct i40e_pf *pf = vf->pf;
3495 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
3499 i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(0, vf->vf_id), (u32)vrh->hena);
3500 i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(1, vf->vf_id),
3505 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_SET_RSS_HENA, aq_ret);
3510 * @vf: pointer to the VF info
3515 static int i40e_vc_enable_vlan_stripping(struct i40e_vf *vf, u8 *msg)
3520 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
3525 vsi = vf->pf->vsi[vf->lan_vsi_idx];
3530 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ENABLE_VLAN_STRIPPING,
3536 * @vf: pointer to the VF info
3541 static int i40e_vc_disable_vlan_stripping(struct i40e_vf *vf, u8 *msg)
3546 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
3551 vsi = vf->pf->vsi[vf->lan_vsi_idx];
3556 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING,
3562 * @vf: pointer to VF structure
3567 static int i40e_validate_cloud_filter(struct i40e_vf *vf,
3572 struct i40e_pf *pf = vf->pf;
3582 vf->vf_id, tc_filter->action);
3588 tc_filter->action_meta > vf->num_tc) {
3590 vf->vf_id, tc_filter->action_meta);
3604 vsi = pf->vsi[vf->lan_vsi_idx];
3610 data.dst_mac, vf->vf_id);
3625 vf->vf_id, ntohs(data.vlan_id));
3631 if (!test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps)) {
3634 vf->vf_id);
3643 vf->vf_id, data.dst_mac);
3652 vf->vf_id, data.src_mac);
3660 vf->vf_id);
3668 vf->vf_id);
3676 vf->vf_id);
3683 vf->vf_id);
3695 * @vf: pointer to the VF info
3698 static struct i40e_vsi *i40e_find_vsi_from_seid(struct i40e_vf *vf, u16 seid)
3700 struct i40e_pf *pf = vf->pf;
3704 for (i = 0; i < vf->num_tc ; i++) {
3705 vsi = i40e_find_vsi_from_id(pf, vf->ch[i].vsi_id);
3714 * @vf: pointer to the VF info
3718 static void i40e_del_all_cloud_filters(struct i40e_vf *vf)
3721 struct i40e_pf *pf = vf->pf;
3727 &vf->cloud_filter_list, cloud_node) {
3728 vsi = i40e_find_vsi_from_seid(vf, cfilter->seid);
3732 vf->vf_id, cfilter->seid);
3744 vf->vf_id, ERR_PTR(ret),
3750 vf->num_cloud_filters--;
3756 * @vf: pointer to the VF info
3761 static int i40e_vc_del_cloud_filter(struct i40e_vf *vf, u8 *msg)
3767 struct i40e_pf *pf = vf->pf;
3773 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
3778 if (!vf->adq_enabled) {
3781 vf->vf_id);
3786 if (i40e_validate_cloud_filter(vf, vcf)) {
3789 vf->vf_id);
3831 vf->vf_id);
3835 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx];
3847 vf->vf_id, ERR_PTR(ret),
3853 &vf->cloud_filter_list, cloud_node) {
3878 vf->num_cloud_filters--;
3882 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DEL_CLOUD_FILTER,
3888 * @vf: pointer to the VF info
3893 static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg)
3899 struct i40e_pf *pf = vf->pf;
3904 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
3909 if (!vf->adq_enabled) {
3912 vf->vf_id);
3917 if (i40e_validate_cloud_filter(vf, vcf)) {
3920 vf->vf_id);
3967 vf->vf_id);
3971 vsi = pf->vsi[vf->ch[vcf->action_meta].vsi_idx];
3983 vf->vf_id, ERR_PTR(aq_ret),
3989 hlist_add_head(&cfilter->cloud_node, &vf->cloud_filter_list);
3992 vf->num_cloud_filters++;
3996 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ADD_CLOUD_FILTER,
4002 * @vf: pointer to the VF info
4005 static int i40e_vc_add_qch_msg(struct i40e_vf *vf, u8 *msg)
4009 struct i40e_pf *pf = vf->pf;
4015 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
4021 if (vf->spoofchk) {
4028 if (!(vf->driver_caps & VIRTCHNL_VF_OFFLOAD_ADQ)) {
4031 vf->vf_id);
4040 vf->vf_id, tci->num_tc, I40E_MAX_VF_VSI);
4051 vf->vf_id, i, tci->list[i].count,
4063 vf->vf_id);
4071 vf->num_queue_pairs = I40E_MAX_VF_QUEUES;
4084 vf->num_tc = tci->num_tc;
4085 for (i = 0; i < vf->num_tc; i++) {
4091 vf->vf_id);
4095 vf->ch[i].max_tx_rate =
4099 vf->ch[i].num_qps = tci->list[i].count;
4103 vf->adq_enabled = true;
4106 i40e_vc_reset_vf(vf, true);
4112 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ENABLE_CHANNELS,
4118 * @vf: pointer to the VF info
4121 static int i40e_vc_del_qch_msg(struct i40e_vf *vf, u8 *msg)
4123 struct i40e_pf *pf = vf->pf;
4126 if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
4131 if (vf->adq_enabled) {
4132 i40e_del_all_cloud_filters(vf);
4133 i40e_del_qch(vf);
4134 vf->adq_enabled = false;
4135 vf->num_tc = 0;
4138 vf->vf_id);
4141 vf->vf_id);
4146 i40e_vc_reset_vf(vf, true);
4151 return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_DISABLE_CHANNELS,
4172 struct i40e_vf *vf;
4178 vf = &(pf->vf[local_vf_id]);
4181 if (test_bit(I40E_VF_STATE_DISABLED, &vf->vf_states))
4185 ret = virtchnl_vc_validate_vf_msg(&vf->vf_ver, v_opcode, msg, msglen);
4188 i40e_vc_send_resp_to_vf(vf, v_opcode, -EINVAL);
4196 ret = i40e_vc_get_version_msg(vf, msg);
4199 ret = i40e_vc_get_vf_resources_msg(vf, msg);
4200 i40e_vc_notify_vf_link_state(vf);
4203 i40e_vc_reset_vf(vf, false);
4207 ret = i40e_vc_config_promiscuous_mode_msg(vf, msg);
4210 ret = i40e_vc_config_queues_msg(vf, msg);
4213 ret = i40e_vc_config_irq_map_msg(vf, msg);
4216 ret = i40e_vc_enable_queues_msg(vf, msg);
4217 i40e_vc_notify_vf_link_state(vf);
4220 ret = i40e_vc_disable_queues_msg(vf, msg);
4223 ret = i40e_vc_add_mac_addr_msg(vf, msg);
4226 ret = i40e_vc_del_mac_addr_msg(vf, msg);
4229 ret = i40e_vc_add_vlan_msg(vf, msg);
4232 ret = i40e_vc_remove_vlan_msg(vf, msg);
4235 ret = i40e_vc_get_stats_msg(vf, msg);
4238 ret = i40e_vc_rdma_msg(vf, msg, msglen);
4241 ret = i40e_vc_rdma_qvmap_msg(vf, msg, true);
4244 ret = i40e_vc_rdma_qvmap_msg(vf, msg, false);
4247 ret = i40e_vc_config_rss_key(vf, msg);
4250 ret = i40e_vc_config_rss_lut(vf, msg);
4253 ret = i40e_vc_get_rss_hena(vf, msg);
4256 ret = i40e_vc_set_rss_hena(vf, msg);
4259 ret = i40e_vc_enable_vlan_stripping(vf, msg);
4262 ret = i40e_vc_disable_vlan_stripping(vf, msg);
4265 ret = i40e_vc_request_queues_msg(vf, msg);
4268 ret = i40e_vc_add_qch_msg(vf, msg);
4271 ret = i40e_vc_del_qch_msg(vf, msg);
4274 ret = i40e_vc_add_cloud_filter(vf, msg);
4277 ret = i40e_vc_del_cloud_filter(vf, msg);
4283 ret = i40e_vc_send_resp_to_vf(vf, v_opcode,
4302 struct i40e_vf *vf;
4323 vf = &pf->vf[vf_id];
4327 i40e_reset_vf(vf, true);
4345 struct i40e_vf *vf;
4354 vf = &pf->vf[vf_id];
4355 vsi = i40e_find_vsi_from_id(pf, vf->lan_vsi_id);
4364 * @vf: the virtual function
4371 static bool i40e_check_vf_init_timeout(struct i40e_vf *vf)
4380 if (test_bit(I40E_VF_STATE_INIT, &vf->vf_states))
4385 if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states)) {
4386 dev_err(&vf->pf->pdev->dev,
4387 "VF %d still in reset. Try again.\n", vf->vf_id);
4408 struct i40e_vf *vf;
4423 vf = &pf->vf[vf_id];
4424 if (!i40e_check_vf_init_timeout(vf)) {
4428 vsi = pf->vsi[vf->lan_vsi_idx];
4443 if (!is_zero_ether_addr(vf->default_lan_addr.addr))
4444 i40e_del_mac_filter(vsi, vf->default_lan_addr.addr);
4460 ether_addr_copy(vf->default_lan_addr.addr, mac);
4463 vf->pf_set_mac = false;
4466 vf->pf_set_mac = true;
4474 i40e_vc_reset_vf(vf, true);
4500 struct i40e_vf *vf;
4525 vf = &pf->vf[vf_id];
4526 if (!i40e_check_vf_init_timeout(vf)) {
4530 vsi = pf->vsi[vf->lan_vsi_idx];
4571 ret = i40e_config_vf_promiscuous_mode(vf, vf->lan_vsi_id,
4604 if (test_bit(I40E_VF_STATE_UC_PROMISC, &vf->vf_states))
4607 if (test_bit(I40E_VF_STATE_MC_PROMISC, &vf->vf_states))
4621 vf->port_vlan_id = le16_to_cpu(vsi->info.pvid);
4623 i40e_vc_reset_vf(vf, true);
4625 vsi = pf->vsi[vf->lan_vsi_idx];
4627 ret = i40e_config_vf_promiscuous_mode(vf, vsi->id, allmulti, alluni);
4629 dev_err(&pf->pdev->dev, "Unable to config vf promiscuous mode\n");
4655 struct i40e_vf *vf;
4675 vf = &pf->vf[vf_id];
4676 if (!i40e_check_vf_init_timeout(vf)) {
4680 vsi = pf->vsi[vf->lan_vsi_idx];
4686 vf->tx_rate = max_tx_rate;
4706 struct i40e_vf *vf;
4719 vf = &pf->vf[vf_id];
4721 vsi = pf->vsi[vf->lan_vsi_idx];
4727 ivi->vf = vf_id;
4729 ether_addr_copy(ivi->mac, vf->default_lan_addr.addr);
4731 ivi->max_tx_rate = vf->tx_rate;
4735 if (vf->link_forced == false)
4737 else if (vf->link_up == true)
4741 ivi->spoofchk = vf->spoofchk;
4742 ivi->trusted = vf->trusted;
4767 struct i40e_vf *vf;
4784 vf = &pf->vf[vf_id];
4785 abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
4792 vf->link_forced = false;
4793 vf->is_disabled_from_host = false;
4795 i40e_vc_reset_vf(vf, true);
4796 i40e_set_vf_link_state(vf, &pfe, ls);
4799 vf->link_forced = true;
4800 vf->link_up = true;
4801 vf->is_disabled_from_host = false;
4803 i40e_vc_reset_vf(vf, true);
4804 i40e_set_vf_link_state(vf, &pfe, ls);
4807 vf->link_forced = true;
4808 vf->link_up = false;
4809 i40e_set_vf_link_state(vf, &pfe, ls);
4811 vsi = pf->vsi[vf->lan_vsi_idx];
4814 vf->is_disabled_from_host = true;
4854 struct i40e_vf *vf;
4869 vf = &(pf->vf[vf_id]);
4870 if (!i40e_check_vf_init_timeout(vf)) {
4875 if (enable == vf->spoofchk)
4878 vf->spoofchk = enable;
4880 ctxt.seid = pf->vsi[vf->lan_vsi_idx]->seid;
4909 struct i40e_vf *vf;
4930 vf = &pf->vf[vf_id];
4932 if (setting == vf->trusted)
4935 vf->trusted = setting;
4939 pf->vsi[vf->lan_vsi_idx]->flags |= I40E_VSI_FLAG_FILTER_CHANGED;
4941 i40e_vc_reset_vf(vf, true);
4945 if (vf->adq_enabled) {
4946 if (!vf->trusted) {
4950 i40e_del_all_cloud_filters(vf);
4972 struct i40e_vf *vf;
4978 vf = &pf->vf[vf_id];
4979 if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states)) {
4984 vsi = pf->vsi[vf->lan_vsi_idx];