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
163 i40e_vc_notify_vf_reset(vf); in i40e_vc_disable_vf()
164 i40e_reset_vf(vf, false); in i40e_vc_disable_vf()
174 static inline bool i40e_vc_isvalid_vsi_id(struct i40e_vf *vf, u16 vsi_id) in i40e_vc_isvalid_vsi_id() argument
176 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vsi_id()
179 return (vsi && (vsi->vf_id == vf->vf_id)); in i40e_vc_isvalid_vsi_id()
190 static inline bool i40e_vc_isvalid_queue_id(struct i40e_vf *vf, u16 vsi_id, in i40e_vc_isvalid_queue_id() argument
193 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_queue_id()
206 static inline bool i40e_vc_isvalid_vector_id(struct i40e_vf *vf, u8 vector_id) in i40e_vc_isvalid_vector_id() argument
208 struct i40e_pf *pf = vf->pf; in i40e_vc_isvalid_vector_id()
223 static u16 i40e_vc_get_pf_queue_id(struct i40e_vf *vf, u16 vsi_id, in i40e_vc_get_pf_queue_id() argument
226 struct i40e_pf *pf = vf->pf; in i40e_vc_get_pf_queue_id()
252 static void i40e_config_irq_link_list(struct i40e_vf *vf, u16 vsi_id, in i40e_config_irq_link_list() argument
256 struct i40e_pf *pf = vf->pf; in i40e_config_irq_link_list()
267 reg_idx = I40E_VPINT_LNKLST0(vf->vf_id); in i40e_config_irq_link_list()
270 ((pf->hw.func_caps.num_msix_vectors_vf - 1) * vf->vf_id) + in i40e_config_irq_link_list()
295 pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, vsi_queue_id); in i40e_config_irq_link_list()
322 pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, in i40e_config_irq_link_list()
341 if ((vf->driver_caps & I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING) && in i40e_config_irq_link_list()
363 static int i40e_config_vsi_tx_queue(struct i40e_vf *vf, u16 vsi_id, in i40e_config_vsi_tx_queue() argument
367 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_tx_queue()
375 pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, vsi_queue_id); in i40e_config_vsi_tx_queue()
413 qtx_ctl |= (((vf->vf_id + hw->func_caps.vf_base_id) in i40e_config_vsi_tx_queue()
432 static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id, in i40e_config_vsi_rx_queue() argument
436 struct i40e_pf *pf = vf->pf; in i40e_config_vsi_rx_queue()
442 pf_queue_id = i40e_vc_get_pf_queue_id(vf, vsi_id, vsi_queue_id); in i40e_config_vsi_rx_queue()
521 static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type) in i40e_alloc_vsi_res() argument
524 struct i40e_pf *pf = vf->pf; in i40e_alloc_vsi_res()
528 vsi = i40e_vsi_setup(pf, type, pf->vsi[pf->lan_vsi]->seid, vf->vf_id); in i40e_alloc_vsi_res()
533 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_alloc_vsi_res()
540 vf->lan_vsi_idx = vsi->idx; in i40e_alloc_vsi_res()
541 vf->lan_vsi_id = vsi->id; in i40e_alloc_vsi_res()
548 if (vf->port_vlan_id) in i40e_alloc_vsi_res()
549 i40e_vsi_add_pvid(vsi, vf->port_vlan_id); in i40e_alloc_vsi_res()
552 f = i40e_add_filter(vsi, vf->default_lan_addr.addr, in i40e_alloc_vsi_res()
553 vf->port_vlan_id ? vf->port_vlan_id : -1, in i40e_alloc_vsi_res()
559 vf->port_vlan_id ? vf->port_vlan_id : -1, in i40e_alloc_vsi_res()
573 if (vf->tx_rate) { in i40e_alloc_vsi_res()
575 vf->tx_rate / 50, 0, NULL); in i40e_alloc_vsi_res()
578 vf->vf_id, ret); in i40e_alloc_vsi_res()
591 static void i40e_enable_vf_mappings(struct i40e_vf *vf) in i40e_enable_vf_mappings() argument
593 struct i40e_pf *pf = vf->pf; in i40e_enable_vf_mappings()
602 wr32(hw, I40E_VSILAN_QBASE(vf->lan_vsi_id), in i40e_enable_vf_mappings()
607 wr32(hw, I40E_VPLAN_MAPENA(vf->vf_id), reg); in i40e_enable_vf_mappings()
610 for (j = 0; j < pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; j++) { in i40e_enable_vf_mappings()
611 u16 qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_id, j); in i40e_enable_vf_mappings()
614 wr32(hw, I40E_VPLAN_QTABLE(total_queue_pairs, vf->vf_id), reg); in i40e_enable_vf_mappings()
620 if (j * 2 >= pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs) { in i40e_enable_vf_mappings()
623 u16 qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_id, in i40e_enable_vf_mappings()
626 qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_id, in i40e_enable_vf_mappings()
630 wr32(hw, I40E_VSILAN_QTABLE(j, vf->lan_vsi_id), reg); in i40e_enable_vf_mappings()
642 static void i40e_disable_vf_mappings(struct i40e_vf *vf) in i40e_disable_vf_mappings() argument
644 struct i40e_pf *pf = vf->pf; in i40e_disable_vf_mappings()
649 wr32(hw, I40E_VPLAN_MAPENA(vf->vf_id), 0); in i40e_disable_vf_mappings()
651 wr32(hw, I40E_VPLAN_QTABLE(i, vf->vf_id), in i40e_disable_vf_mappings()
662 static void i40e_free_vf_res(struct i40e_vf *vf) in i40e_free_vf_res() argument
664 struct i40e_pf *pf = vf->pf; in i40e_free_vf_res()
670 if (vf->lan_vsi_idx) { in i40e_free_vf_res()
671 i40e_vsi_release(pf->vsi[vf->lan_vsi_idx]); in i40e_free_vf_res()
672 vf->lan_vsi_idx = 0; in i40e_free_vf_res()
673 vf->lan_vsi_id = 0; in i40e_free_vf_res()
681 reg_idx = I40E_VFINT_DYN_CTL0(vf->vf_id); in i40e_free_vf_res()
684 (vf->vf_id)) in i40e_free_vf_res()
694 reg_idx = I40E_VPINT_LNKLST0(vf->vf_id); in i40e_free_vf_res()
697 (vf->vf_id)) in i40e_free_vf_res()
707 vf->num_queue_pairs = 0; in i40e_free_vf_res()
708 vf->vf_states = 0; in i40e_free_vf_res()
709 clear_bit(I40E_VF_STAT_INIT, &vf->vf_states); in i40e_free_vf_res()
718 static int i40e_alloc_vf_res(struct i40e_vf *vf) in i40e_alloc_vf_res() argument
720 struct i40e_pf *pf = vf->pf; in i40e_alloc_vf_res()
725 ret = i40e_alloc_vsi_res(vf, I40E_VSI_SRIOV); in i40e_alloc_vf_res()
728 total_queue_pairs += pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; in i40e_alloc_vf_res()
729 set_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps); in i40e_alloc_vf_res()
734 vf->num_queue_pairs = total_queue_pairs; in i40e_alloc_vf_res()
737 set_bit(I40E_VF_STAT_INIT, &vf->vf_states); in i40e_alloc_vf_res()
741 i40e_free_vf_res(vf); in i40e_alloc_vf_res()
755 static int i40e_quiesce_vf_pci(struct i40e_vf *vf) in i40e_quiesce_vf_pci() argument
757 struct i40e_pf *pf = vf->pf; in i40e_quiesce_vf_pci()
762 vf_abs_id = vf->vf_id + hw->func_caps.vf_base_id; in i40e_quiesce_vf_pci()
782 void i40e_reset_vf(struct i40e_vf *vf, bool flr) in i40e_reset_vf() argument
784 struct i40e_pf *pf = vf->pf; in i40e_reset_vf()
794 clear_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states); in i40e_reset_vf()
801 reg = rd32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id)); in i40e_reset_vf()
803 wr32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id), reg); in i40e_reset_vf()
807 if (i40e_quiesce_vf_pci(vf)) in i40e_reset_vf()
809 vf->vf_id); in i40e_reset_vf()
821 reg = rd32(hw, I40E_VPGEN_VFRSTAT(vf->vf_id)); in i40e_reset_vf()
833 vf->vf_id); in i40e_reset_vf()
834 wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_id), I40E_VFR_COMPLETED); in i40e_reset_vf()
836 reg = rd32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id)); in i40e_reset_vf()
838 wr32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id), reg); in i40e_reset_vf()
841 if (vf->lan_vsi_idx == 0) in i40e_reset_vf()
844 i40e_vsi_control_rings(pf->vsi[vf->lan_vsi_idx], false); in i40e_reset_vf()
847 i40e_free_vf_res(vf); in i40e_reset_vf()
848 if (!i40e_alloc_vf_res(vf)) { in i40e_reset_vf()
849 i40e_enable_vf_mappings(vf); in i40e_reset_vf()
850 set_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states); in i40e_reset_vf()
851 clear_bit(I40E_VF_STAT_DISABLED, &vf->vf_states); in i40e_reset_vf()
854 wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_id), I40E_VFR_VFACTIVE); in i40e_reset_vf()
871 if (!pf->vf) in i40e_free_vfs()
877 if (test_bit(I40E_VF_STAT_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
878 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_vsi_control_rings(pf->vsi[pf->vf[i].lan_vsi_idx], in i40e_free_vfs()
901 if (test_bit(I40E_VF_STAT_INIT, &pf->vf[i].vf_states)) in i40e_free_vfs()
902 i40e_free_vf_res(&pf->vf[i]); in i40e_free_vfs()
904 i40e_disable_vf_mappings(&pf->vf[i]); in i40e_free_vfs()
907 kfree(pf->vf); in i40e_free_vfs()
908 pf->vf = NULL; in i40e_free_vfs()
958 pf->vf = vfs; in i40e_alloc_vfs()
1078 static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode, in i40e_vc_send_msg_to_vf() argument
1087 if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs) in i40e_vc_send_msg_to_vf()
1090 pf = vf->pf; in i40e_vc_send_msg_to_vf()
1092 abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; in i40e_vc_send_msg_to_vf()
1096 vf->num_invalid_msgs++; in i40e_vc_send_msg_to_vf()
1099 if (vf->num_invalid_msgs > in i40e_vc_send_msg_to_vf()
1103 vf->vf_id); in i40e_vc_send_msg_to_vf()
1105 set_bit(I40E_VF_STAT_DISABLED, &vf->vf_states); in i40e_vc_send_msg_to_vf()
1108 vf->num_valid_msgs++; in i40e_vc_send_msg_to_vf()
1110 vf->num_invalid_msgs = 0; in i40e_vc_send_msg_to_vf()
1118 vf->vf_id, pf->hw.aq.asq_last_status); in i40e_vc_send_msg_to_vf()
1133 static int i40e_vc_send_resp_to_vf(struct i40e_vf *vf, in i40e_vc_send_resp_to_vf() argument
1137 return i40e_vc_send_msg_to_vf(vf, opcode, retval, NULL, 0); in i40e_vc_send_resp_to_vf()
1146 static int i40e_vc_get_version_msg(struct i40e_vf *vf, u8 *msg) in i40e_vc_get_version_msg() argument
1152 vf->vf_ver = *(struct i40e_virtchnl_version_info *)msg; in i40e_vc_get_version_msg()
1154 if (VF_IS_V10(vf)) in i40e_vc_get_version_msg()
1156 return i40e_vc_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION, in i40e_vc_get_version_msg()
1170 static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg) in i40e_vc_get_vf_resources_msg() argument
1173 struct i40e_pf *pf = vf->pf; in i40e_vc_get_vf_resources_msg()
1180 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) { in i40e_vc_get_vf_resources_msg()
1194 if (VF_IS_V11(vf)) in i40e_vc_get_vf_resources_msg()
1195 vf->driver_caps = *(u32 *)msg; in i40e_vc_get_vf_resources_msg()
1197 vf->driver_caps = I40E_VIRTCHNL_VF_OFFLOAD_L2 | in i40e_vc_get_vf_resources_msg()
1202 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_vf_resources_msg()
1206 if (vf->driver_caps & I40E_VIRTCHNL_VF_OFFLOAD_RSS_AQ) in i40e_vc_get_vf_resources_msg()
1213 if (vf->driver_caps & I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING) in i40e_vc_get_vf_resources_msg()
1217 vfres->num_queue_pairs = vf->num_queue_pairs; in i40e_vc_get_vf_resources_msg()
1219 if (vf->lan_vsi_idx) { in i40e_vc_get_vf_resources_msg()
1220 vfres->vsi_res[i].vsi_id = vf->lan_vsi_id; in i40e_vc_get_vf_resources_msg()
1227 vf->default_lan_addr.addr); in i40e_vc_get_vf_resources_msg()
1230 set_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states); in i40e_vc_get_vf_resources_msg()
1234 ret = i40e_vc_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_VF_RESOURCES, in i40e_vc_get_vf_resources_msg()
1251 static void i40e_vc_reset_vf_msg(struct i40e_vf *vf) in i40e_vc_reset_vf_msg() argument
1253 if (test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) in i40e_vc_reset_vf_msg()
1254 i40e_reset_vf(vf, false); in i40e_vc_reset_vf_msg()
1266 static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf, in i40e_vc_config_promiscuous_mode_msg() argument
1271 struct i40e_pf *pf = vf->pf; in i40e_vc_config_promiscuous_mode_msg()
1278 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states) || in i40e_vc_config_promiscuous_mode_msg()
1279 !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) || in i40e_vc_config_promiscuous_mode_msg()
1280 !i40e_vc_isvalid_vsi_id(vf, info->vsi_id) || in i40e_vc_config_promiscuous_mode_msg()
1292 return i40e_vc_send_resp_to_vf(vf, in i40e_vc_config_promiscuous_mode_msg()
1306 static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_config_queues_msg() argument
1311 struct i40e_pf *pf = vf->pf; in i40e_vc_config_queues_msg()
1316 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) { in i40e_vc_config_queues_msg()
1322 if (!i40e_vc_isvalid_vsi_id(vf, vsi_id)) { in i40e_vc_config_queues_msg()
1332 !i40e_vc_isvalid_queue_id(vf, vsi_id, vsi_queue_id)) { in i40e_vc_config_queues_msg()
1337 if (i40e_config_vsi_rx_queue(vf, vsi_id, vsi_queue_id, in i40e_vc_config_queues_msg()
1339 i40e_config_vsi_tx_queue(vf, vsi_id, vsi_queue_id, in i40e_vc_config_queues_msg()
1346 pf->vsi[vf->lan_vsi_idx]->num_queue_pairs = qci->num_queue_pairs; in i40e_vc_config_queues_msg()
1350 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES, in i40e_vc_config_queues_msg()
1363 static int i40e_vc_config_irq_map_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_config_irq_map_msg() argument
1373 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) { in i40e_vc_config_irq_map_msg()
1384 if (!i40e_vc_isvalid_vector_id(vf, vector_id) || in i40e_vc_config_irq_map_msg()
1385 !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { in i40e_vc_config_irq_map_msg()
1393 if (!i40e_vc_isvalid_queue_id(vf, vsi_id, in i40e_vc_config_irq_map_msg()
1402 if (!i40e_vc_isvalid_queue_id(vf, vsi_id, in i40e_vc_config_irq_map_msg()
1409 i40e_config_irq_link_list(vf, vsi_id, map); in i40e_vc_config_irq_map_msg()
1413 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP, in i40e_vc_config_irq_map_msg()
1425 static int i40e_vc_enable_queues_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_enable_queues_msg() argument
1429 struct i40e_pf *pf = vf->pf; in i40e_vc_enable_queues_msg()
1433 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) { in i40e_vc_enable_queues_msg()
1438 if (!i40e_vc_isvalid_vsi_id(vf, vsi_id)) { in i40e_vc_enable_queues_msg()
1448 if (i40e_vsi_control_rings(pf->vsi[vf->lan_vsi_idx], true)) in i40e_vc_enable_queues_msg()
1452 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_ENABLE_QUEUES, in i40e_vc_enable_queues_msg()
1465 static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_disable_queues_msg() argument
1469 struct i40e_pf *pf = vf->pf; in i40e_vc_disable_queues_msg()
1472 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) { in i40e_vc_disable_queues_msg()
1477 if (!i40e_vc_isvalid_vsi_id(vf, vqs->vsi_id)) { in i40e_vc_disable_queues_msg()
1487 if (i40e_vsi_control_rings(pf->vsi[vf->lan_vsi_idx], false)) in i40e_vc_disable_queues_msg()
1492 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_DISABLE_QUEUES, in i40e_vc_disable_queues_msg()
1504 static int i40e_vc_get_stats_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_get_stats_msg() argument
1508 struct i40e_pf *pf = vf->pf; in i40e_vc_get_stats_msg()
1515 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) { in i40e_vc_get_stats_msg()
1520 if (!i40e_vc_isvalid_vsi_id(vf, vqs->vsi_id)) { in i40e_vc_get_stats_msg()
1525 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_get_stats_msg()
1535 return i40e_vc_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_STATS, aq_ret, in i40e_vc_get_stats_msg()
1549 static inline int i40e_check_vf_permission(struct i40e_vf *vf, u8 *macaddr) in i40e_check_vf_permission() argument
1551 struct i40e_pf *pf = vf->pf; in i40e_check_vf_permission()
1558 } else if (vf->pf_set_mac && !is_multicast_ether_addr(macaddr) && in i40e_check_vf_permission()
1559 !ether_addr_equal(macaddr, vf->default_lan_addr.addr)) { in i40e_check_vf_permission()
1581 static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_add_mac_addr_msg() argument
1585 struct i40e_pf *pf = vf->pf; in i40e_vc_add_mac_addr_msg()
1591 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states) || in i40e_vc_add_mac_addr_msg()
1592 !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) || in i40e_vc_add_mac_addr_msg()
1593 !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { in i40e_vc_add_mac_addr_msg()
1599 ret = i40e_check_vf_permission(vf, al->list[i].addr); in i40e_vc_add_mac_addr_msg()
1603 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_mac_addr_msg()
1640 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS, in i40e_vc_add_mac_addr_msg()
1652 static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_del_mac_addr_msg() argument
1656 struct i40e_pf *pf = vf->pf; in i40e_vc_del_mac_addr_msg()
1662 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states) || in i40e_vc_del_mac_addr_msg()
1663 !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) || in i40e_vc_del_mac_addr_msg()
1664 !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { in i40e_vc_del_mac_addr_msg()
1678 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_del_mac_addr_msg()
1693 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS, in i40e_vc_del_mac_addr_msg()
1705 static int i40e_vc_add_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_add_vlan_msg() argument
1709 struct i40e_pf *pf = vf->pf; in i40e_vc_add_vlan_msg()
1715 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states) || in i40e_vc_add_vlan_msg()
1716 !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) || in i40e_vc_add_vlan_msg()
1717 !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { in i40e_vc_add_vlan_msg()
1730 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_add_vlan_msg()
1749 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_ADD_VLAN, aq_ret); in i40e_vc_add_vlan_msg()
1760 static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) in i40e_vc_remove_vlan_msg() argument
1764 struct i40e_pf *pf = vf->pf; in i40e_vc_remove_vlan_msg()
1770 if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states) || in i40e_vc_remove_vlan_msg()
1771 !test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) || in i40e_vc_remove_vlan_msg()
1772 !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { in i40e_vc_remove_vlan_msg()
1784 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_vc_remove_vlan_msg()
1801 return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_DEL_VLAN, aq_ret); in i40e_vc_remove_vlan_msg()
1813 static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode, in i40e_vc_validate_vf_msg() argument
1820 if (test_bit(I40E_VF_STAT_DISABLED, &vf->vf_states)) in i40e_vc_validate_vf_msg()
1832 if (VF_IS_V11(vf)) in i40e_vc_validate_vf_msg()
1907 i40e_vc_send_resp_to_vf(vf, v_opcode, I40E_ERR_PARAM); in i40e_vc_validate_vf_msg()
1930 struct i40e_vf *vf; in i40e_vc_process_vf_msg() local
1936 vf = &(pf->vf[local_vf_id]); in i40e_vc_process_vf_msg()
1938 ret = i40e_vc_validate_vf_msg(vf, v_opcode, v_retval, msg, msglen); in i40e_vc_process_vf_msg()
1948 ret = i40e_vc_get_version_msg(vf, msg); in i40e_vc_process_vf_msg()
1951 ret = i40e_vc_get_vf_resources_msg(vf, msg); in i40e_vc_process_vf_msg()
1954 i40e_vc_reset_vf_msg(vf); in i40e_vc_process_vf_msg()
1958 ret = i40e_vc_config_promiscuous_mode_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1961 ret = i40e_vc_config_queues_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1964 ret = i40e_vc_config_irq_map_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1967 ret = i40e_vc_enable_queues_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1968 i40e_vc_notify_vf_link_state(vf); in i40e_vc_process_vf_msg()
1971 ret = i40e_vc_disable_queues_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1974 ret = i40e_vc_add_mac_addr_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1977 ret = i40e_vc_del_mac_addr_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1980 ret = i40e_vc_add_vlan_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1983 ret = i40e_vc_remove_vlan_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1986 ret = i40e_vc_get_stats_msg(vf, msg, msglen); in i40e_vc_process_vf_msg()
1992 ret = i40e_vc_send_resp_to_vf(vf, v_opcode, in i40e_vc_process_vf_msg()
2011 struct i40e_vf *vf; in i40e_vc_process_vflr_event() local
2027 vf = &pf->vf[vf_id]; in i40e_vc_process_vflr_event()
2034 i40e_reset_vf(vf, true); in i40e_vc_process_vflr_event()
2055 struct i40e_vf *vf; in i40e_ndo_set_vf_mac() local
2066 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_mac()
2067 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_mac()
2068 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) { in i40e_ndo_set_vf_mac()
2088 i40e_del_filter(vsi, vf->default_lan_addr.addr, in i40e_ndo_set_vf_mac()
2089 vf->port_vlan_id ? vf->port_vlan_id : -1, in i40e_ndo_set_vf_mac()
2107 ether_addr_copy(vf->default_lan_addr.addr, mac); in i40e_ndo_set_vf_mac()
2108 vf->pf_set_mac = true; in i40e_ndo_set_vf_mac()
2110 i40e_vc_disable_vf(pf, vf); in i40e_ndo_set_vf_mac()
2134 struct i40e_vf *vf; in i40e_ndo_set_vf_port_vlan() local
2150 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_port_vlan()
2151 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_port_vlan()
2152 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) { in i40e_ndo_set_vf_port_vlan()
2174 i40e_vc_disable_vf(pf, vf); in i40e_ndo_set_vf_port_vlan()
2230 vf->port_vlan_id = le16_to_cpu(vsi->info.pvid); in i40e_ndo_set_vf_port_vlan()
2253 struct i40e_vf *vf; in i40e_ndo_set_vf_bw() local
2270 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_bw()
2271 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_set_vf_bw()
2272 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) { in i40e_ndo_set_vf_bw()
2294 max_tx_rate, vf->vf_id); in i40e_ndo_set_vf_bw()
2314 vf->tx_rate = max_tx_rate; in i40e_ndo_set_vf_bw()
2333 struct i40e_vf *vf; in i40e_ndo_get_vf_config() local
2343 vf = &(pf->vf[vf_id]); in i40e_ndo_get_vf_config()
2345 vsi = pf->vsi[vf->lan_vsi_idx]; in i40e_ndo_get_vf_config()
2346 if (!test_bit(I40E_VF_STAT_INIT, &vf->vf_states)) { in i40e_ndo_get_vf_config()
2352 ivi->vf = vf_id; in i40e_ndo_get_vf_config()
2354 ether_addr_copy(ivi->mac, vf->default_lan_addr.addr); in i40e_ndo_get_vf_config()
2356 ivi->max_tx_rate = vf->tx_rate; in i40e_ndo_get_vf_config()
2361 if (vf->link_forced == false) in i40e_ndo_get_vf_config()
2363 else if (vf->link_up == true) in i40e_ndo_get_vf_config()
2367 ivi->spoofchk = vf->spoofchk; in i40e_ndo_get_vf_config()
2388 struct i40e_vf *vf; in i40e_ndo_set_vf_link_state() local
2399 vf = &pf->vf[vf_id]; in i40e_ndo_set_vf_link_state()
2400 abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id; in i40e_ndo_set_vf_link_state()
2407 vf->link_forced = false; in i40e_ndo_set_vf_link_state()
2414 vf->link_forced = true; in i40e_ndo_set_vf_link_state()
2415 vf->link_up = true; in i40e_ndo_set_vf_link_state()
2420 vf->link_forced = true; in i40e_ndo_set_vf_link_state()
2421 vf->link_up = false; in i40e_ndo_set_vf_link_state()
2452 struct i40e_vf *vf; in i40e_ndo_set_vf_spoofchk() local
2462 vf = &(pf->vf[vf_id]); in i40e_ndo_set_vf_spoofchk()
2464 if (enable == vf->spoofchk) in i40e_ndo_set_vf_spoofchk()
2467 vf->spoofchk = enable; in i40e_ndo_set_vf_spoofchk()
2469 ctxt.seid = pf->vsi[vf->lan_vsi_idx]->seid; in i40e_ndo_set_vf_spoofchk()