Lines Matching refs:vf

29 					  struct bnxt_vf_info *vf, u16 event_id)  in bnxt_hwrm_fwd_async_event_cmpl()  argument
39 if (vf) in bnxt_hwrm_fwd_async_event_cmpl()
40 req->encap_async_event_target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_fwd_async_event_cmpl()
75 struct bnxt_vf_info *vf; in bnxt_set_vf_spoofchk() local
86 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_spoofchk()
87 if (vf->flags & BNXT_VF_SPOOFCHK) in bnxt_set_vf_spoofchk()
101 req->fid = cpu_to_le16(vf->fw_fid); in bnxt_set_vf_spoofchk()
106 vf->flags |= BNXT_VF_SPOOFCHK; in bnxt_set_vf_spoofchk()
108 vf->flags &= ~BNXT_VF_SPOOFCHK; in bnxt_set_vf_spoofchk()
114 static int bnxt_hwrm_func_qcfg_flags(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_hwrm_func_qcfg_flags() argument
124 req->fid = cpu_to_le16(BNXT_PF(bp) ? vf->fw_fid : 0xffff); in bnxt_hwrm_func_qcfg_flags()
128 vf->func_qcfg_flags = le16_to_cpu(resp->flags); in bnxt_hwrm_func_qcfg_flags()
133 bool bnxt_is_trusted_vf(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_is_trusted_vf() argument
136 return !!(vf->flags & BNXT_VF_TRUST); in bnxt_is_trusted_vf()
138 bnxt_hwrm_func_qcfg_flags(bp, vf); in bnxt_is_trusted_vf()
139 return !!(vf->func_qcfg_flags & FUNC_QCFG_RESP_FLAGS_TRUSTED_VF); in bnxt_is_trusted_vf()
142 static int bnxt_hwrm_set_trusted_vf(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_hwrm_set_trusted_vf() argument
154 req->fid = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_set_trusted_vf()
155 if (vf->flags & BNXT_VF_TRUST) in bnxt_hwrm_set_trusted_vf()
165 struct bnxt_vf_info *vf; in bnxt_set_vf_trust() local
170 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_trust()
172 vf->flags |= BNXT_VF_TRUST; in bnxt_set_vf_trust()
174 vf->flags &= ~BNXT_VF_TRUST; in bnxt_set_vf_trust()
176 bnxt_hwrm_set_trusted_vf(bp, vf); in bnxt_set_vf_trust()
184 struct bnxt_vf_info *vf; in bnxt_get_vf_config() local
191 ivi->vf = vf_id; in bnxt_get_vf_config()
192 vf = &bp->pf.vf[vf_id]; in bnxt_get_vf_config()
194 if (is_valid_ether_addr(vf->mac_addr)) in bnxt_get_vf_config()
195 memcpy(&ivi->mac, vf->mac_addr, ETH_ALEN); in bnxt_get_vf_config()
197 memcpy(&ivi->mac, vf->vf_mac_addr, ETH_ALEN); in bnxt_get_vf_config()
198 ivi->max_tx_rate = vf->max_tx_rate; in bnxt_get_vf_config()
199 ivi->min_tx_rate = vf->min_tx_rate; in bnxt_get_vf_config()
200 ivi->vlan = vf->vlan & VLAN_VID_MASK; in bnxt_get_vf_config()
201 ivi->qos = vf->vlan >> VLAN_PRIO_SHIFT; in bnxt_get_vf_config()
202 ivi->spoofchk = !!(vf->flags & BNXT_VF_SPOOFCHK); in bnxt_get_vf_config()
203 ivi->trusted = bnxt_is_trusted_vf(bp, vf); in bnxt_get_vf_config()
204 if (!(vf->flags & BNXT_VF_LINK_FORCED)) in bnxt_get_vf_config()
206 else if (vf->flags & BNXT_VF_LINK_UP) in bnxt_get_vf_config()
218 struct bnxt_vf_info *vf; in bnxt_set_vf_mac() local
231 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_mac()
237 memcpy(vf->mac_addr, mac, ETH_ALEN); in bnxt_set_vf_mac()
239 req->fid = cpu_to_le16(vf->fw_fid); in bnxt_set_vf_mac()
250 struct bnxt_vf_info *vf; in bnxt_set_vf_vlan() local
270 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_vlan()
272 if (vlan_tag == vf->vlan) in bnxt_set_vf_vlan()
277 req->fid = cpu_to_le16(vf->fw_fid); in bnxt_set_vf_vlan()
286 vf->vlan = vlan_tag; in bnxt_set_vf_vlan()
296 struct bnxt_vf_info *vf; in bnxt_set_vf_bw() local
304 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_bw()
317 if (min_tx_rate == vf->min_tx_rate && max_tx_rate == vf->max_tx_rate) in bnxt_set_vf_bw()
321 req->fid = cpu_to_le16(vf->fw_fid); in bnxt_set_vf_bw()
328 vf->min_tx_rate = min_tx_rate; in bnxt_set_vf_bw()
329 vf->max_tx_rate = max_tx_rate; in bnxt_set_vf_bw()
338 struct bnxt_vf_info *vf; in bnxt_set_vf_link_state() local
345 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_link_state()
347 vf->flags &= ~(BNXT_VF_LINK_UP | BNXT_VF_LINK_FORCED); in bnxt_set_vf_link_state()
350 vf->flags |= BNXT_VF_LINK_UP; in bnxt_set_vf_link_state()
353 vf->flags |= BNXT_VF_LINK_FORCED; in bnxt_set_vf_link_state()
356 vf->flags |= BNXT_VF_LINK_UP | BNXT_VF_LINK_FORCED; in bnxt_set_vf_link_state()
363 if (vf->flags & (BNXT_VF_LINK_UP | BNXT_VF_LINK_FORCED)) in bnxt_set_vf_link_state()
364 rc = bnxt_hwrm_fwd_async_event_cmpl(bp, vf, in bnxt_set_vf_link_state()
372 struct bnxt_vf_info *vf; in bnxt_set_vf_attr() local
375 vf = &bp->pf.vf[i]; in bnxt_set_vf_attr()
376 memset(vf, 0, sizeof(*vf)); in bnxt_set_vf_attr()
420 kfree(bp->pf.vf); in bnxt_free_vf_resources()
421 bp->pf.vf = NULL; in bnxt_free_vf_resources()
429 bp->pf.vf = kcalloc(num_vfs, sizeof(struct bnxt_vf_info), GFP_KERNEL); in bnxt_alloc_vf_resources()
430 if (!bp->pf.vf) in bnxt_alloc_vf_resources()
450 struct bnxt_vf_info *vf = &bp->pf.vf[k]; in bnxt_alloc_vf_resources() local
452 vf->hwrm_cmd_req_addr = bp->pf.hwrm_cmd_req_addr[i] + in bnxt_alloc_vf_resources()
454 vf->hwrm_cmd_req_dma_addr = in bnxt_alloc_vf_resources()
493 struct bnxt_vf_info *vf; in __bnxt_set_vf_params() local
500 vf = &bp->pf.vf[vf_id]; in __bnxt_set_vf_params()
501 req->fid = cpu_to_le16(vf->fw_fid); in __bnxt_set_vf_params()
503 if (is_valid_ether_addr(vf->mac_addr)) { in __bnxt_set_vf_params()
505 memcpy(req->dflt_mac_addr, vf->mac_addr, ETH_ALEN); in __bnxt_set_vf_params()
507 if (vf->vlan) { in __bnxt_set_vf_params()
509 req->dflt_vlan = cpu_to_le16(vf->vlan); in __bnxt_set_vf_params()
511 if (vf->max_tx_rate) { in __bnxt_set_vf_params()
514 req->max_bw = cpu_to_le32(vf->max_tx_rate); in __bnxt_set_vf_params()
515 req->min_bw = cpu_to_le32(vf->min_tx_rate); in __bnxt_set_vf_params()
517 if (vf->flags & BNXT_VF_TRUST) in __bnxt_set_vf_params()
620 pf->vf[i].fw_fid = pf->first_vf_id + i; in bnxt_hwrm_func_vf_resc_cfg()
711 pf->vf[i].fw_fid = le16_to_cpu(req->fid); in bnxt_hwrm_func_cfg()
712 rc = __bnxt_hwrm_get_tx_rings(bp, pf->vf[i].fw_fid, in bnxt_hwrm_func_cfg()
943 static int bnxt_hwrm_fwd_resp(struct bnxt *bp, struct bnxt_vf_info *vf, in bnxt_hwrm_fwd_resp() argument
959 req->target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_fwd_resp()
960 req->encap_resp_target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_fwd_resp()
973 static int bnxt_hwrm_fwd_err_resp(struct bnxt *bp, struct bnxt_vf_info *vf, in bnxt_hwrm_fwd_err_resp() argument
985 req->target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_fwd_err_resp()
986 req->encap_resp_target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_fwd_err_resp()
987 memcpy(req->encap_request, vf->hwrm_cmd_req_addr, msg_size); in bnxt_hwrm_fwd_err_resp()
996 static int bnxt_hwrm_exec_fwd_resp(struct bnxt *bp, struct bnxt_vf_info *vf, in bnxt_hwrm_exec_fwd_resp() argument
1008 req->target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_exec_fwd_resp()
1009 req->encap_resp_target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_exec_fwd_resp()
1010 memcpy(req->encap_request, vf->hwrm_cmd_req_addr, msg_size); in bnxt_hwrm_exec_fwd_resp()
1019 static int bnxt_vf_configure_mac(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_vf_configure_mac() argument
1023 (struct hwrm_func_vf_cfg_input *)vf->hwrm_cmd_req_addr; in bnxt_vf_configure_mac()
1029 bool trust = bnxt_is_trusted_vf(bp, vf); in bnxt_vf_configure_mac()
1032 (trust || !is_valid_ether_addr(vf->mac_addr) || in bnxt_vf_configure_mac()
1033 ether_addr_equal(req->dflt_mac_addr, vf->mac_addr))) { in bnxt_vf_configure_mac()
1034 ether_addr_copy(vf->vf_mac_addr, req->dflt_mac_addr); in bnxt_vf_configure_mac()
1035 return bnxt_hwrm_exec_fwd_resp(bp, vf, msg_size); in bnxt_vf_configure_mac()
1037 return bnxt_hwrm_fwd_err_resp(bp, vf, msg_size); in bnxt_vf_configure_mac()
1039 return bnxt_hwrm_exec_fwd_resp(bp, vf, msg_size); in bnxt_vf_configure_mac()
1042 static int bnxt_vf_validate_set_mac(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_vf_validate_set_mac() argument
1046 (struct hwrm_cfa_l2_filter_alloc_input *)vf->hwrm_cmd_req_addr; in bnxt_vf_validate_set_mac()
1050 return bnxt_hwrm_fwd_err_resp(bp, vf, msg_size); in bnxt_vf_validate_set_mac()
1057 if (bnxt_is_trusted_vf(bp, vf)) { in bnxt_vf_validate_set_mac()
1059 } else if (is_valid_ether_addr(vf->mac_addr)) { in bnxt_vf_validate_set_mac()
1060 if (ether_addr_equal((const u8 *)req->l2_addr, vf->mac_addr)) in bnxt_vf_validate_set_mac()
1062 } else if (is_valid_ether_addr(vf->vf_mac_addr)) { in bnxt_vf_validate_set_mac()
1063 if (ether_addr_equal((const u8 *)req->l2_addr, vf->vf_mac_addr)) in bnxt_vf_validate_set_mac()
1075 return bnxt_hwrm_exec_fwd_resp(bp, vf, msg_size); in bnxt_vf_validate_set_mac()
1076 return bnxt_hwrm_fwd_err_resp(bp, vf, msg_size); in bnxt_vf_validate_set_mac()
1079 static int bnxt_vf_set_link(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_vf_set_link() argument
1083 if (!(vf->flags & BNXT_VF_LINK_FORCED)) { in bnxt_vf_set_link()
1086 bp, vf, sizeof(struct hwrm_port_phy_qcfg_input)); in bnxt_vf_set_link()
1092 (struct hwrm_port_phy_qcfg_input *)vf->hwrm_cmd_req_addr; in bnxt_vf_set_link()
1106 if (vf->flags & BNXT_VF_LINK_UP) { in bnxt_vf_set_link()
1130 rc = bnxt_hwrm_fwd_resp(bp, vf, &phy_qcfg_resp, in bnxt_vf_set_link()
1138 static int bnxt_vf_req_validate_snd(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_vf_req_validate_snd() argument
1141 struct input *encap_req = vf->hwrm_cmd_req_addr; in bnxt_vf_req_validate_snd()
1146 rc = bnxt_vf_configure_mac(bp, vf); in bnxt_vf_req_validate_snd()
1149 rc = bnxt_vf_validate_set_mac(bp, vf); in bnxt_vf_req_validate_snd()
1156 bp, vf, sizeof(struct hwrm_func_cfg_input)); in bnxt_vf_req_validate_snd()
1159 rc = bnxt_vf_set_link(bp, vf); in bnxt_vf_req_validate_snd()
1178 bnxt_vf_req_validate_snd(bp, &bp->pf.vf[vf_id]); in bnxt_hwrm_exec_fwd_req()
1192 if (is_valid_ether_addr(bp->vf.mac_addr)) in bnxt_approve_mac()
1238 if (!ether_addr_equal(resp->mac_address, bp->vf.mac_addr)) { in bnxt_update_vf_mac()
1239 memcpy(bp->vf.mac_addr, resp->mac_address, ETH_ALEN); in bnxt_update_vf_mac()
1243 if (!is_valid_ether_addr(bp->vf.mac_addr)) in bnxt_update_vf_mac()
1248 if (is_valid_ether_addr(bp->vf.mac_addr)) in bnxt_update_vf_mac()
1249 eth_hw_addr_set(bp->dev, bp->vf.mac_addr); in bnxt_update_vf_mac()