Lines Matching refs:vf

28 					  struct bnxt_vf_info *vf, u16 event_id)  in bnxt_hwrm_fwd_async_event_cmpl()  argument
38 if (vf) in bnxt_hwrm_fwd_async_event_cmpl()
39 req->encap_async_event_target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_fwd_async_event_cmpl()
74 struct bnxt_vf_info *vf; in bnxt_set_vf_spoofchk() local
85 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_spoofchk()
86 if (vf->flags & BNXT_VF_SPOOFCHK) in bnxt_set_vf_spoofchk()
100 req->fid = cpu_to_le16(vf->fw_fid); in bnxt_set_vf_spoofchk()
105 vf->flags |= BNXT_VF_SPOOFCHK; in bnxt_set_vf_spoofchk()
107 vf->flags &= ~BNXT_VF_SPOOFCHK; in bnxt_set_vf_spoofchk()
113 static int bnxt_hwrm_func_qcfg_flags(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_hwrm_func_qcfg_flags() argument
123 req->fid = cpu_to_le16(BNXT_PF(bp) ? vf->fw_fid : 0xffff); in bnxt_hwrm_func_qcfg_flags()
127 vf->func_qcfg_flags = le16_to_cpu(resp->flags); in bnxt_hwrm_func_qcfg_flags()
132 bool bnxt_is_trusted_vf(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_is_trusted_vf() argument
135 return !!(vf->flags & BNXT_VF_TRUST); in bnxt_is_trusted_vf()
137 bnxt_hwrm_func_qcfg_flags(bp, vf); in bnxt_is_trusted_vf()
138 return !!(vf->func_qcfg_flags & FUNC_QCFG_RESP_FLAGS_TRUSTED_VF); in bnxt_is_trusted_vf()
141 static int bnxt_hwrm_set_trusted_vf(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_hwrm_set_trusted_vf() argument
153 req->fid = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_set_trusted_vf()
154 if (vf->flags & BNXT_VF_TRUST) in bnxt_hwrm_set_trusted_vf()
164 struct bnxt_vf_info *vf; in bnxt_set_vf_trust() local
169 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_trust()
171 vf->flags |= BNXT_VF_TRUST; in bnxt_set_vf_trust()
173 vf->flags &= ~BNXT_VF_TRUST; in bnxt_set_vf_trust()
175 bnxt_hwrm_set_trusted_vf(bp, vf); in bnxt_set_vf_trust()
183 struct bnxt_vf_info *vf; in bnxt_get_vf_config() local
190 ivi->vf = vf_id; in bnxt_get_vf_config()
191 vf = &bp->pf.vf[vf_id]; in bnxt_get_vf_config()
193 if (is_valid_ether_addr(vf->mac_addr)) in bnxt_get_vf_config()
194 memcpy(&ivi->mac, vf->mac_addr, ETH_ALEN); in bnxt_get_vf_config()
196 memcpy(&ivi->mac, vf->vf_mac_addr, ETH_ALEN); in bnxt_get_vf_config()
197 ivi->max_tx_rate = vf->max_tx_rate; in bnxt_get_vf_config()
198 ivi->min_tx_rate = vf->min_tx_rate; in bnxt_get_vf_config()
199 ivi->vlan = vf->vlan; in bnxt_get_vf_config()
200 if (vf->flags & BNXT_VF_QOS) in bnxt_get_vf_config()
201 ivi->qos = vf->vlan >> VLAN_PRIO_SHIFT; in bnxt_get_vf_config()
204 ivi->spoofchk = !!(vf->flags & BNXT_VF_SPOOFCHK); in bnxt_get_vf_config()
205 ivi->trusted = bnxt_is_trusted_vf(bp, vf); in bnxt_get_vf_config()
206 if (!(vf->flags & BNXT_VF_LINK_FORCED)) in bnxt_get_vf_config()
208 else if (vf->flags & BNXT_VF_LINK_UP) in bnxt_get_vf_config()
220 struct bnxt_vf_info *vf; in bnxt_set_vf_mac() local
233 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_mac()
239 memcpy(vf->mac_addr, mac, ETH_ALEN); in bnxt_set_vf_mac()
241 req->fid = cpu_to_le16(vf->fw_fid); in bnxt_set_vf_mac()
252 struct bnxt_vf_info *vf; in bnxt_set_vf_vlan() local
272 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_vlan()
274 if (vlan_tag == vf->vlan) in bnxt_set_vf_vlan()
279 req->fid = cpu_to_le16(vf->fw_fid); in bnxt_set_vf_vlan()
284 vf->vlan = vlan_tag; in bnxt_set_vf_vlan()
294 struct bnxt_vf_info *vf; in bnxt_set_vf_bw() local
302 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_bw()
315 if (min_tx_rate == vf->min_tx_rate && max_tx_rate == vf->max_tx_rate) in bnxt_set_vf_bw()
319 req->fid = cpu_to_le16(vf->fw_fid); in bnxt_set_vf_bw()
326 vf->min_tx_rate = min_tx_rate; in bnxt_set_vf_bw()
327 vf->max_tx_rate = max_tx_rate; in bnxt_set_vf_bw()
336 struct bnxt_vf_info *vf; in bnxt_set_vf_link_state() local
343 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_link_state()
345 vf->flags &= ~(BNXT_VF_LINK_UP | BNXT_VF_LINK_FORCED); in bnxt_set_vf_link_state()
348 vf->flags |= BNXT_VF_LINK_UP; in bnxt_set_vf_link_state()
351 vf->flags |= BNXT_VF_LINK_FORCED; in bnxt_set_vf_link_state()
354 vf->flags |= BNXT_VF_LINK_UP | BNXT_VF_LINK_FORCED; in bnxt_set_vf_link_state()
361 if (vf->flags & (BNXT_VF_LINK_UP | BNXT_VF_LINK_FORCED)) in bnxt_set_vf_link_state()
362 rc = bnxt_hwrm_fwd_async_event_cmpl(bp, vf, in bnxt_set_vf_link_state()
370 struct bnxt_vf_info *vf; in bnxt_set_vf_attr() local
373 vf = &bp->pf.vf[i]; in bnxt_set_vf_attr()
374 memset(vf, 0, sizeof(*vf)); in bnxt_set_vf_attr()
418 kfree(bp->pf.vf); in bnxt_free_vf_resources()
419 bp->pf.vf = NULL; in bnxt_free_vf_resources()
427 bp->pf.vf = kcalloc(num_vfs, sizeof(struct bnxt_vf_info), GFP_KERNEL); in bnxt_alloc_vf_resources()
428 if (!bp->pf.vf) in bnxt_alloc_vf_resources()
448 struct bnxt_vf_info *vf = &bp->pf.vf[k]; in bnxt_alloc_vf_resources() local
450 vf->hwrm_cmd_req_addr = bp->pf.hwrm_cmd_req_addr[i] + in bnxt_alloc_vf_resources()
452 vf->hwrm_cmd_req_dma_addr = in bnxt_alloc_vf_resources()
491 struct bnxt_vf_info *vf; in __bnxt_set_vf_params() local
498 vf = &bp->pf.vf[vf_id]; in __bnxt_set_vf_params()
499 req->fid = cpu_to_le16(vf->fw_fid); in __bnxt_set_vf_params()
501 if (is_valid_ether_addr(vf->mac_addr)) { in __bnxt_set_vf_params()
503 memcpy(req->dflt_mac_addr, vf->mac_addr, ETH_ALEN); in __bnxt_set_vf_params()
505 if (vf->vlan) { in __bnxt_set_vf_params()
507 req->dflt_vlan = cpu_to_le16(vf->vlan); in __bnxt_set_vf_params()
509 if (vf->max_tx_rate) { in __bnxt_set_vf_params()
512 req->max_bw = cpu_to_le32(vf->max_tx_rate); in __bnxt_set_vf_params()
513 req->min_bw = cpu_to_le32(vf->min_tx_rate); in __bnxt_set_vf_params()
515 if (vf->flags & BNXT_VF_TRUST) in __bnxt_set_vf_params()
610 pf->vf[i].fw_fid = pf->first_vf_id + i; in bnxt_hwrm_func_vf_resc_cfg()
701 pf->vf[i].fw_fid = le16_to_cpu(req->fid); in bnxt_hwrm_func_cfg()
702 rc = __bnxt_hwrm_get_tx_rings(bp, pf->vf[i].fw_fid, in bnxt_hwrm_func_cfg()
927 static int bnxt_hwrm_fwd_resp(struct bnxt *bp, struct bnxt_vf_info *vf, in bnxt_hwrm_fwd_resp() argument
940 req->target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_fwd_resp()
941 req->encap_resp_target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_fwd_resp()
954 static int bnxt_hwrm_fwd_err_resp(struct bnxt *bp, struct bnxt_vf_info *vf, in bnxt_hwrm_fwd_err_resp() argument
966 req->target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_fwd_err_resp()
967 req->encap_resp_target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_fwd_err_resp()
968 memcpy(req->encap_request, vf->hwrm_cmd_req_addr, msg_size); in bnxt_hwrm_fwd_err_resp()
977 static int bnxt_hwrm_exec_fwd_resp(struct bnxt *bp, struct bnxt_vf_info *vf, in bnxt_hwrm_exec_fwd_resp() argument
989 req->target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_exec_fwd_resp()
990 req->encap_resp_target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_exec_fwd_resp()
991 memcpy(req->encap_request, vf->hwrm_cmd_req_addr, msg_size); in bnxt_hwrm_exec_fwd_resp()
1000 static int bnxt_vf_configure_mac(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_vf_configure_mac() argument
1004 (struct hwrm_func_vf_cfg_input *)vf->hwrm_cmd_req_addr; in bnxt_vf_configure_mac()
1010 bool trust = bnxt_is_trusted_vf(bp, vf); in bnxt_vf_configure_mac()
1013 (trust || !is_valid_ether_addr(vf->mac_addr) || in bnxt_vf_configure_mac()
1014 ether_addr_equal(req->dflt_mac_addr, vf->mac_addr))) { in bnxt_vf_configure_mac()
1015 ether_addr_copy(vf->vf_mac_addr, req->dflt_mac_addr); in bnxt_vf_configure_mac()
1016 return bnxt_hwrm_exec_fwd_resp(bp, vf, msg_size); in bnxt_vf_configure_mac()
1018 return bnxt_hwrm_fwd_err_resp(bp, vf, msg_size); in bnxt_vf_configure_mac()
1020 return bnxt_hwrm_exec_fwd_resp(bp, vf, msg_size); in bnxt_vf_configure_mac()
1023 static int bnxt_vf_validate_set_mac(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_vf_validate_set_mac() argument
1027 (struct hwrm_cfa_l2_filter_alloc_input *)vf->hwrm_cmd_req_addr; in bnxt_vf_validate_set_mac()
1031 return bnxt_hwrm_fwd_err_resp(bp, vf, msg_size); in bnxt_vf_validate_set_mac()
1038 if (bnxt_is_trusted_vf(bp, vf)) { in bnxt_vf_validate_set_mac()
1040 } else if (is_valid_ether_addr(vf->mac_addr)) { in bnxt_vf_validate_set_mac()
1041 if (ether_addr_equal((const u8 *)req->l2_addr, vf->mac_addr)) in bnxt_vf_validate_set_mac()
1043 } else if (is_valid_ether_addr(vf->vf_mac_addr)) { in bnxt_vf_validate_set_mac()
1044 if (ether_addr_equal((const u8 *)req->l2_addr, vf->vf_mac_addr)) in bnxt_vf_validate_set_mac()
1056 return bnxt_hwrm_exec_fwd_resp(bp, vf, msg_size); in bnxt_vf_validate_set_mac()
1057 return bnxt_hwrm_fwd_err_resp(bp, vf, msg_size); in bnxt_vf_validate_set_mac()
1060 static int bnxt_vf_set_link(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_vf_set_link() argument
1064 if (!(vf->flags & BNXT_VF_LINK_FORCED)) { in bnxt_vf_set_link()
1067 bp, vf, sizeof(struct hwrm_port_phy_qcfg_input)); in bnxt_vf_set_link()
1073 (struct hwrm_port_phy_qcfg_input *)vf->hwrm_cmd_req_addr; in bnxt_vf_set_link()
1082 if (vf->flags & BNXT_VF_LINK_UP) { in bnxt_vf_set_link()
1106 rc = bnxt_hwrm_fwd_resp(bp, vf, &phy_qcfg_resp, in bnxt_vf_set_link()
1114 static int bnxt_vf_req_validate_snd(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_vf_req_validate_snd() argument
1117 struct input *encap_req = vf->hwrm_cmd_req_addr; in bnxt_vf_req_validate_snd()
1122 rc = bnxt_vf_configure_mac(bp, vf); in bnxt_vf_req_validate_snd()
1125 rc = bnxt_vf_validate_set_mac(bp, vf); in bnxt_vf_req_validate_snd()
1132 bp, vf, sizeof(struct hwrm_func_cfg_input)); in bnxt_vf_req_validate_snd()
1135 rc = bnxt_vf_set_link(bp, vf); in bnxt_vf_req_validate_snd()
1154 bnxt_vf_req_validate_snd(bp, &bp->pf.vf[vf_id]); in bnxt_hwrm_exec_fwd_req()
1168 if (is_valid_ether_addr(bp->vf.mac_addr)) in bnxt_approve_mac()
1214 if (!ether_addr_equal(resp->mac_address, bp->vf.mac_addr)) { in bnxt_update_vf_mac()
1215 memcpy(bp->vf.mac_addr, resp->mac_address, ETH_ALEN); in bnxt_update_vf_mac()
1219 if (!is_valid_ether_addr(bp->vf.mac_addr)) in bnxt_update_vf_mac()
1224 if (is_valid_ether_addr(bp->vf.mac_addr)) in bnxt_update_vf_mac()
1225 eth_hw_addr_set(bp->dev, bp->vf.mac_addr); in bnxt_update_vf_mac()