Lines Matching refs:vf
47 struct i40e_vf *vf = pf->vf; in i40e_vc_vf_broadcast() local
50 for (i = 0; i < pf->num_alloc_vfs; i++, vf++) { in i40e_vc_vf_broadcast()
51 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; in i40e_vc_vf_broadcast()
53 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) && in i40e_vc_vf_broadcast()
54 !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) in i40e_vc_vf_broadcast()
71 static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf) in i40e_vc_notify_vf_link_state() argument
74 struct i40e_pf *pf = vf->pf; in i40e_vc_notify_vf_link_state()
77 int abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; in i40e_vc_notify_vf_link_state()
81 if (vf->link_forced) { in i40e_vc_notify_vf_link_state()
82 pfe.event_data.link_event.link_status = vf->link_up; in i40e_vc_notify_vf_link_state()
84 (vf->link_up ? I40E_LINK_SPEED_40GB : 0); in i40e_vc_notify_vf_link_state()
105 i40e_vc_notify_vf_link_state(&pf->vf[i]); in i40e_vc_notify_link_state()
130 void i40e_vc_notify_vf_reset(struct i40e_vf *vf) in i40e_vc_notify_vf_reset() argument
136 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_notify_vf_reset()
140 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states) && in i40e_vc_notify_vf_reset()
141 !test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) in i40e_vc_notify_vf_reset()
144 abs_vf_id = vf->vf_id + vf->pf->hw.func_caps.vf_base_id; in i40e_vc_notify_vf_reset()
148 i40e_aq_send_msg_to_vf(&vf->pf->hw, abs_vf_id, I40E_VIRTCHNL_OP_EVENT, in i40e_vc_notify_vf_reset()
161 static inline void i40e_vc_disable_vf(struct i40e_pf *pf, struct i40e_vf *vf) in i40e_vc_disable_vf() argument
166 reg = rd32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id)); in i40e_vc_disable_vf()
168 wr32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id), reg); in i40e_vc_disable_vf()
179 static inline bool i40e_vc_isvalid_vsi_id(struct i40e_vf *vf, u16 vsi_id) in i40e_vc_isvalid_vsi_id() argument
181 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vsi_id()
184 return (vsi && (vsi->vf_id == vf->vf_id)); in i40e_vc_isvalid_vsi_id()
195 static inline bool i40e_vc_isvalid_queue_id(struct i40e_vf *vf, u16 vsi_id, in i40e_vc_isvalid_queue_id() argument
198 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_queue_id()
211 static inline bool i40e_vc_isvalid_vector_id(struct i40e_vf *vf, u8 vector_id) in i40e_vc_isvalid_vector_id() argument
213 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vector_id()
228 static u16 i40e_vc_get_pf_queue_id(struct i40e_vf *vf, u16 vsi_id, in i40e_vc_get_pf_queue_id() argument
231 struct i40e_pf *pf = vf->pf; in i40e_vc_get_pf_queue_id()
257 static void i40e_config_irq_link_list(struct i40e_vf *vf, u16 vsi_id, in i40e_config_irq_link_list() argument
261 struct i40e_pf *pf = vf->pf; in i40e_config_irq_link_list()
272 reg_idx = I40E_VPINT_LNKLST0(vf->vf_id); in i40e_config_irq_link_list()
275 ((pf->hw.func_caps.num_msix_vectors_vf - 1) * vf->vf_id) + in i40e_config_irq_link_list()
302 pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, vsi_queue_id); in i40e_config_irq_link_list()
329 pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, in i40e_config_irq_link_list()
358 static int i40e_config_vsi_tx_queue(struct i40e_vf *vf, u16 vsi_id, in i40e_config_vsi_tx_queue() argument
362 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_tx_queue()
370 pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, vsi_queue_id); in i40e_config_vsi_tx_queue()
408 qtx_ctl |= (((vf->vf_id + hw->func_caps.vf_base_id) in i40e_config_vsi_tx_queue()
427 static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id, in i40e_config_vsi_rx_queue() argument
431 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_rx_queue()
437 pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, vsi_queue_id); in i40e_config_vsi_rx_queue()
516 static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type) in i40e_alloc_vsi_res() argument
519 struct i40e_pf *pf = vf->pf; in i40e_alloc_vsi_res()
523 vsi = i40e_vsi_setup(pf, type, pf->vsi[pf->lan_vsi]->seid, vf->vf_id); in i40e_alloc_vsi_res()
528 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_alloc_vsi_res()
534 vf->lan_vsi_idx = vsi->idx; in i40e_alloc_vsi_res()
535 vf->lan_vsi_id = vsi->id; in i40e_alloc_vsi_res()
542 if (vf->port_vlan_id) in i40e_alloc_vsi_res()
543 i40e_vsi_add_pvid(vsi, vf->port_vlan_id); in i40e_alloc_vsi_res()
544 f = i40e_add_filter(vsi, vf->default_lan_addr.addr, in i40e_alloc_vsi_res()
545 vf->port_vlan_id, true, false); in i40e_alloc_vsi_res()
549 f = i40e_add_filter(vsi, brdcast, vf->port_vlan_id, in i40e_alloc_vsi_res()
562 if (vf->tx_rate) { in i40e_alloc_vsi_res()
564 vf->tx_rate / 50, 0, NULL); in i40e_alloc_vsi_res()
567 vf->vf_id, ret); in i40e_alloc_vsi_res()
580 static void i40e_enable_vf_mappings(struct i40e_vf *vf) in i40e_enable_vf_mappings() argument
582 struct i40e_pf *pf = vf->pf; in i40e_enable_vf_mappings()
591 wr32(hw, I40E_VSILAN_QBASE(vf->lan_vsi_id), in i40e_enable_vf_mappings()
596 wr32(hw, I40E_VPLAN_MAPENA(vf->vf_id), reg); in i40e_enable_vf_mappings()
599 for (j = 0; j < pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; j++) { in i40e_enable_vf_mappings()
600 u16 qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_id, j); in i40e_enable_vf_mappings()
602 wr32(hw, I40E_VPLAN_QTABLE(total_queue_pairs, vf->vf_id), reg); in i40e_enable_vf_mappings()
608 if (j * 2 >= pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs) { in i40e_enable_vf_mappings()
611 u16 qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_id, in i40e_enable_vf_mappings()
614 qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_id, in i40e_enable_vf_mappings()
618 wr32(hw, I40E_VSILAN_QTABLE(j, vf->lan_vsi_id), reg); in i40e_enable_vf_mappings()
630 static void i40e_disable_vf_mappings(struct i40e_vf *vf) in i40e_disable_vf_mappings() argument
632 struct i40e_pf *pf = vf->pf; in i40e_disable_vf_mappings()
637 wr32(hw, I40E_VPLAN_MAPENA(vf->vf_id), 0); in i40e_disable_vf_mappings()
639 wr32(hw, I40E_VPLAN_QTABLE(i, vf->vf_id), in i40e_disable_vf_mappings()
650 static void i40e_free_vf_res(struct i40e_vf *vf) in i40e_free_vf_res() argument
652 struct i40e_pf *pf = vf->pf; in i40e_free_vf_res()
658 if (vf->lan_vsi_idx) { in i40e_free_vf_res()
659 i40e_vsi_release(pf->vsi[vf->lan_vsi_idx]); in i40e_free_vf_res()
660 vf->lan_vsi_idx = 0; in i40e_free_vf_res()
661 vf->lan_vsi_id = 0; in i40e_free_vf_res()
669 reg_idx = I40E_VFINT_DYN_CTL0(vf->vf_id); in i40e_free_vf_res()
672 (vf->vf_id)) in i40e_free_vf_res()
682 reg_idx = I40E_VPINT_LNKLST0(vf->vf_id); in i40e_free_vf_res()
685 (vf->vf_id)) in i40e_free_vf_res()
695 vf->num_queue_pairs = 0; in i40e_free_vf_res()
696 vf->vf_states = 0; in i40e_free_vf_res()
705 static int i40e_alloc_vf_res(struct i40e_vf *vf) in i40e_alloc_vf_res() argument
707 struct i40e_pf *pf = vf->pf; in i40e_alloc_vf_res()
712 ret = i40e_alloc_vsi_res(vf, I40E_VSI_SRIOV); in i40e_alloc_vf_res()
715 total_queue_pairs += pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_alloc_vf_res()
716 set_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps); in i40e_alloc_vf_res()
721 vf->num_queue_pairs = total_queue_pairs; in i40e_alloc_vf_res()
724 set_bit(I40E_VF_STAT_INIT, &vf->vf_states); in i40e_alloc_vf_res()
728 i40e_free_vf_res(vf); in i40e_alloc_vf_res()
742 static int i40e_quiesce_vf_pci(struct i40e_vf *vf) in i40e_quiesce_vf_pci() argument
744 struct i40e_pf *pf = vf->pf; in i40e_quiesce_vf_pci()
749 vf_abs_id = vf->vf_id + hw->func_caps.vf_base_id; in i40e_quiesce_vf_pci()
769 void i40e_reset_vf(struct i40e_vf *vf, bool flr) in i40e_reset_vf() argument
771 struct i40e_pf *pf = vf->pf; in i40e_reset_vf()
781 clear_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states); in i40e_reset_vf()
788 reg = rd32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id)); in i40e_reset_vf()
790 wr32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id), reg); in i40e_reset_vf()
794 if (i40e_quiesce_vf_pci(vf)) in i40e_reset_vf()
796 vf->vf_id); in i40e_reset_vf()
808 reg = rd32(hw, I40E_VPGEN_VFRSTAT(vf->vf_id)); in i40e_reset_vf()
820 vf->vf_id); in i40e_reset_vf()
821 wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_id), I40E_VFR_COMPLETED); in i40e_reset_vf()
823 reg = rd32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id)); in i40e_reset_vf()
825 wr32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id), reg); in i40e_reset_vf()
828 if (vf->lan_vsi_idx == 0) in i40e_reset_vf()
831 i40e_vsi_control_rings(pf->vsi[vf->lan_vsi_idx], false); in i40e_reset_vf()
834 i40e_free_vf_res(vf); in i40e_reset_vf()
835 i40e_alloc_vf_res(vf); in i40e_reset_vf()
836 i40e_enable_vf_mappings(vf); in i40e_reset_vf()
837 set_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states); in i40e_reset_vf()
840 wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_id), I40E_VFR_VFACTIVE); in i40e_reset_vf()
857 if (!pf->vf) in i40e_free_vfs()
863 if (test_bit(I40E_VF_STAT_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
864 i40e_vsi_control_rings(pf->vsi[pf->vf[i].lan_vsi_idx], in i40e_free_vfs()
882 if (test_bit(I40E_VF_STAT_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
883 i40e_free_vf_res(&pf->vf[i]); in i40e_free_vfs()
885 i40e_disable_vf_mappings(&pf->vf[i]); in i40e_free_vfs()
888 kfree(pf->vf); in i40e_free_vfs()
889 pf->vf = NULL; in i40e_free_vfs()
940 pf->vf = vfs; in i40e_alloc_vfs()
1053 static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode, in i40e_vc_send_msg_to_vf() argument
1062 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_send_msg_to_vf()
1065 pf = vf->pf; in i40e_vc_send_msg_to_vf()
1067 abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; in i40e_vc_send_msg_to_vf()
1071 vf->num_invalid_msgs++; in i40e_vc_send_msg_to_vf()
1074 if (vf->num_invalid_msgs > in i40e_vc_send_msg_to_vf()
1078 vf->vf_id); in i40e_vc_send_msg_to_vf()
1080 set_bit(I40E_VF_STAT_DISABLED, &vf->vf_states); in i40e_vc_send_msg_to_vf()
1083 vf->num_valid_msgs++; in i40e_vc_send_msg_to_vf()
1091 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_vc_send_msg_to_vf()
1106 static int i40e_vc_send_resp_to_vf(struct i40e_vf *vf, in i40e_vc_send_resp_to_vf() argument
1110 return i40e_vc_send_msg_to_vf(vf, opcode, retval, NULL, 0); in i40e_vc_send_resp_to_vf()
1119 static int i40e_vc_get_version_msg(struct i40e_vf *vf) in i40e_vc_get_version_msg() argument
1125 return i40e_vc_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION, in i40e_vc_get_version_msg()
1139 static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf) in i40e_vc_get_vf_resources_msg() argument
1142 struct i40e_pf *pf = vf->pf; in i40e_vc_get_vf_resources_msg()
1149 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) { in i40e_vc_get_vf_resources_msg()
1165 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_vf_resources_msg()
1170 vfres->num_queue_pairs = vf->num_queue_pairs; in i40e_vc_get_vf_resources_msg()
1172 if (vf->lan_vsi_idx) { in i40e_vc_get_vf_resources_msg()
1173 vfres->vsi_res[i].vsi_id = vf->lan_vsi_id; in i40e_vc_get_vf_resources_msg()
1176 pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_vc_get_vf_resources_msg()
1178 vf->default_lan_addr.addr, ETH_ALEN); in i40e_vc_get_vf_resources_msg()
1181 set_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states); in i40e_vc_get_vf_resources_msg()
1185 ret = i40e_vc_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_VF_RESOURCES, in i40e_vc_get_vf_resources_msg()
1202 static void i40e_vc_reset_vf_msg(struct i40e_vf *vf) in i40e_vc_reset_vf_msg() argument
1204 if (test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) in i40e_vc_reset_vf_msg()
1205 i40e_reset_vf(vf, false); in i40e_vc_reset_vf_msg()
1217 static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf, in i40e_vc_config_promiscuous_mode_msg() argument
1222 struct i40e_pf *pf = vf->pf; in i40e_vc_config_promiscuous_mode_msg()
1229 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states) || in i40e_vc_config_promiscuous_mode_msg()
1230 !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) || in i40e_vc_config_promiscuous_mode_msg()
1231 !i40e_vc_isvalid_vsi_id(vf, info->vsi_id) || in i40e_vc_config_promiscuous_mode_msg()
1243 return i40e_vc_send_resp_to_vf(vf, in i40e_vc_config_promiscuous_mode_msg()
1257 static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_config_queues_msg() argument
1262 struct i40e_pf *pf = vf->pf; in i40e_vc_config_queues_msg()
1267 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) { in i40e_vc_config_queues_msg()
1273 if (!i40e_vc_isvalid_vsi_id(vf, vsi_id)) { in i40e_vc_config_queues_msg()
1283 !i40e_vc_isvalid_queue_id(vf, vsi_id, vsi_queue_id)) { in i40e_vc_config_queues_msg()
1288 if (i40e_config_vsi_rx_queue(vf, vsi_id, vsi_queue_id, in i40e_vc_config_queues_msg()
1290 i40e_config_vsi_tx_queue(vf, vsi_id, vsi_queue_id, in i40e_vc_config_queues_msg()
1297 pf->vsi[vf->lan_vsi_idx]->num_queue_pairs = qci->num_queue_pairs; in i40e_vc_config_queues_msg()
1301 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES, in i40e_vc_config_queues_msg()
1314 static int i40e_vc_config_irq_map_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_config_irq_map_msg() argument
1324 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) { in i40e_vc_config_irq_map_msg()
1335 if (!i40e_vc_isvalid_vector_id(vf, vector_id) || in i40e_vc_config_irq_map_msg()
1336 !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { in i40e_vc_config_irq_map_msg()
1344 if (!i40e_vc_isvalid_queue_id(vf, vsi_id, in i40e_vc_config_irq_map_msg()
1353 if (!i40e_vc_isvalid_queue_id(vf, vsi_id, in i40e_vc_config_irq_map_msg()
1360 i40e_config_irq_link_list(vf, vsi_id, map); in i40e_vc_config_irq_map_msg()
1364 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP, in i40e_vc_config_irq_map_msg()
1376 static int i40e_vc_enable_queues_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_enable_queues_msg() argument
1380 struct i40e_pf *pf = vf->pf; in i40e_vc_enable_queues_msg()
1384 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) { in i40e_vc_enable_queues_msg()
1389 if (!i40e_vc_isvalid_vsi_id(vf, vsi_id)) { in i40e_vc_enable_queues_msg()
1399 if (i40e_vsi_control_rings(pf->vsi[vf->lan_vsi_idx], true)) in i40e_vc_enable_queues_msg()
1403 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_ENABLE_QUEUES, in i40e_vc_enable_queues_msg()
1416 static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_disable_queues_msg() argument
1420 struct i40e_pf *pf = vf->pf; in i40e_vc_disable_queues_msg()
1423 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) { in i40e_vc_disable_queues_msg()
1428 if (!i40e_vc_isvalid_vsi_id(vf, vqs->vsi_id)) { in i40e_vc_disable_queues_msg()
1438 if (i40e_vsi_control_rings(pf->vsi[vf->lan_vsi_idx], false)) in i40e_vc_disable_queues_msg()
1443 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_DISABLE_QUEUES, in i40e_vc_disable_queues_msg()
1455 static int i40e_vc_get_stats_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_get_stats_msg() argument
1459 struct i40e_pf *pf = vf->pf; in i40e_vc_get_stats_msg()
1466 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) { in i40e_vc_get_stats_msg()
1471 if (!i40e_vc_isvalid_vsi_id(vf, vqs->vsi_id)) { in i40e_vc_get_stats_msg()
1476 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_stats_msg()
1486 return i40e_vc_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_STATS, aq_ret, in i40e_vc_get_stats_msg()
1500 static inline int i40e_check_vf_permission(struct i40e_vf *vf, u8 *macaddr) in i40e_check_vf_permission() argument
1502 struct i40e_pf *pf = vf->pf; in i40e_check_vf_permission()
1509 } else if (vf->pf_set_mac && !is_multicast_ether_addr(macaddr) && in i40e_check_vf_permission()
1510 !ether_addr_equal(macaddr, vf->default_lan_addr.addr)) { in i40e_check_vf_permission()
1532 static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_add_mac_addr_msg() argument
1536 struct i40e_pf *pf = vf->pf; in i40e_vc_add_mac_addr_msg()
1542 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states) || in i40e_vc_add_mac_addr_msg()
1543 !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) || in i40e_vc_add_mac_addr_msg()
1544 !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { in i40e_vc_add_mac_addr_msg()
1550 ret = i40e_check_vf_permission(vf, al->list[i].addr); in i40e_vc_add_mac_addr_msg()
1554 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_mac_addr_msg()
1584 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS, in i40e_vc_add_mac_addr_msg()
1596 static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_del_mac_addr_msg() argument
1600 struct i40e_pf *pf = vf->pf; in i40e_vc_del_mac_addr_msg()
1606 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states) || in i40e_vc_del_mac_addr_msg()
1607 !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) || in i40e_vc_del_mac_addr_msg()
1608 !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { in i40e_vc_del_mac_addr_msg()
1622 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_del_mac_addr_msg()
1635 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS, in i40e_vc_del_mac_addr_msg()
1647 static int i40e_vc_add_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_add_vlan_msg() argument
1651 struct i40e_pf *pf = vf->pf; in i40e_vc_add_vlan_msg()
1657 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states) || in i40e_vc_add_vlan_msg()
1658 !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) || in i40e_vc_add_vlan_msg()
1659 !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { in i40e_vc_add_vlan_msg()
1672 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_vlan_msg()
1690 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_ADD_VLAN, aq_ret); in i40e_vc_add_vlan_msg()
1701 static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_remove_vlan_msg() argument
1705 struct i40e_pf *pf = vf->pf; in i40e_vc_remove_vlan_msg()
1711 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states) || in i40e_vc_remove_vlan_msg()
1712 !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) || in i40e_vc_remove_vlan_msg()
1713 !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { in i40e_vc_remove_vlan_msg()
1725 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_remove_vlan_msg()
1741 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_DEL_VLAN, aq_ret); in i40e_vc_remove_vlan_msg()
1753 static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode, in i40e_vc_validate_vf_msg() argument
1760 if (test_bit(I40E_VF_STAT_DISABLED, &vf->vf_states)) in i40e_vc_validate_vf_msg()
1843 i40e_vc_send_resp_to_vf(vf, v_opcode, I40E_ERR_PARAM); in i40e_vc_validate_vf_msg()
1866 struct i40e_vf *vf; in i40e_vc_process_vf_msg() local
1872 vf = &(pf->vf[local_vf_id]); in i40e_vc_process_vf_msg()
1874 ret = i40e_vc_validate_vf_msg(vf, v_opcode, v_retval, msg, msglen); in i40e_vc_process_vf_msg()
1884 ret = i40e_vc_get_version_msg(vf); in i40e_vc_process_vf_msg()
1887 ret = i40e_vc_get_vf_resources_msg(vf); in i40e_vc_process_vf_msg()
1890 i40e_vc_reset_vf_msg(vf); in i40e_vc_process_vf_msg()
1894 ret = i40e_vc_config_promiscuous_mode_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1897 ret = i40e_vc_config_queues_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1900 ret = i40e_vc_config_irq_map_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1903 ret = i40e_vc_enable_queues_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1904 i40e_vc_notify_vf_link_state(vf); in i40e_vc_process_vf_msg()
1907 ret = i40e_vc_disable_queues_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1910 ret = i40e_vc_add_mac_addr_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1913 ret = i40e_vc_del_mac_addr_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1916 ret = i40e_vc_add_vlan_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1919 ret = i40e_vc_remove_vlan_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1922 ret = i40e_vc_get_stats_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1928 ret = i40e_vc_send_resp_to_vf(vf, v_opcode, in i40e_vc_process_vf_msg()
1947 struct i40e_vf *vf; in i40e_vc_process_vflr_event() local
1963 vf = &pf->vf[vf_id]; in i40e_vc_process_vflr_event()
1970 i40e_reset_vf(vf, true); in i40e_vc_process_vflr_event()
1991 struct i40e_vf *vf; in i40e_ndo_set_vf_mac() local
2002 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_mac()
2003 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_mac()
2004 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) { in i40e_ndo_set_vf_mac()
2019 i40e_del_filter(vsi, vf->default_lan_addr.addr, vf->port_vlan_id, in i40e_ndo_set_vf_mac()
2035 ether_addr_copy(vf->default_lan_addr.addr, mac); in i40e_ndo_set_vf_mac()
2036 vf->pf_set_mac = true; in i40e_ndo_set_vf_mac()
2038 i40e_vc_disable_vf(pf, vf); in i40e_ndo_set_vf_mac()
2060 struct i40e_vf *vf; in i40e_ndo_set_vf_port_vlan() local
2076 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_port_vlan()
2077 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
2078 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) { in i40e_ndo_set_vf_port_vlan()
2092 i40e_vc_disable_vf(pf, vf); in i40e_ndo_set_vf_port_vlan()
2149 vf->port_vlan_id = le16_to_cpu(vsi->info.pvid); in i40e_ndo_set_vf_port_vlan()
2172 struct i40e_vf *vf; in i40e_ndo_set_vf_bw() local
2189 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_bw()
2190 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_bw()
2191 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) { in i40e_ndo_set_vf_bw()
2213 max_tx_rate, vf->vf_id); in i40e_ndo_set_vf_bw()
2233 vf->tx_rate = max_tx_rate; in i40e_ndo_set_vf_bw()
2252 struct i40e_vf *vf; in i40e_ndo_get_vf_config() local
2262 vf = &(pf->vf[vf_id]); in i40e_ndo_get_vf_config()
2264 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_get_vf_config()
2265 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) { in i40e_ndo_get_vf_config()
2271 ivi->vf = vf_id; in i40e_ndo_get_vf_config()
2273 memcpy(&ivi->mac, vf->default_lan_addr.addr, ETH_ALEN); in i40e_ndo_get_vf_config()
2275 ivi->max_tx_rate = vf->tx_rate; in i40e_ndo_get_vf_config()
2280 if (vf->link_forced == false) in i40e_ndo_get_vf_config()
2282 else if (vf->link_up == true) in i40e_ndo_get_vf_config()
2286 ivi->spoofchk = vf->spoofchk; in i40e_ndo_get_vf_config()
2307 struct i40e_vf *vf; in i40e_ndo_set_vf_link_state() local
2318 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_link_state()
2319 abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; in i40e_ndo_set_vf_link_state()
2326 vf->link_forced = false; in i40e_ndo_set_vf_link_state()
2333 vf->link_forced = true; in i40e_ndo_set_vf_link_state()
2334 vf->link_up = true; in i40e_ndo_set_vf_link_state()
2339 vf->link_forced = true; in i40e_ndo_set_vf_link_state()
2340 vf->link_up = false; in i40e_ndo_set_vf_link_state()
2371 struct i40e_vf *vf; in i40e_ndo_set_vf_spoofchk() local
2381 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_spoofchk()
2383 if (enable == vf->spoofchk) in i40e_ndo_set_vf_spoofchk()
2386 vf->spoofchk = enable; in i40e_ndo_set_vf_spoofchk()
2388 ctxt.seid = pf->vsi[vf->lan_vsi_idx]->seid; in i40e_ndo_set_vf_spoofchk()