Lines Matching refs:vf

43 	struct bnxt_vf_info *vf;  in bnxt_set_vf_spoofchk()  local
52 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_spoofchk()
53 if (vf->flags & BNXT_VF_SPOOFCHK) in bnxt_set_vf_spoofchk()
58 func_flags = vf->func_flags; in bnxt_set_vf_spoofchk()
67 req.vf_id = cpu_to_le16(vf->fw_fid); in bnxt_set_vf_spoofchk()
71 vf->func_flags = func_flags; in bnxt_set_vf_spoofchk()
73 vf->flags |= BNXT_VF_SPOOFCHK; in bnxt_set_vf_spoofchk()
75 vf->flags &= ~BNXT_VF_SPOOFCHK; in bnxt_set_vf_spoofchk()
84 struct bnxt_vf_info *vf; in bnxt_get_vf_config() local
91 ivi->vf = vf_id; in bnxt_get_vf_config()
92 vf = &bp->pf.vf[vf_id]; in bnxt_get_vf_config()
94 memcpy(&ivi->mac, vf->mac_addr, ETH_ALEN); in bnxt_get_vf_config()
95 ivi->max_tx_rate = vf->max_tx_rate; in bnxt_get_vf_config()
96 ivi->min_tx_rate = vf->min_tx_rate; in bnxt_get_vf_config()
97 ivi->vlan = vf->vlan; in bnxt_get_vf_config()
98 ivi->qos = vf->flags & BNXT_VF_QOS; in bnxt_get_vf_config()
99 ivi->spoofchk = vf->flags & BNXT_VF_SPOOFCHK; in bnxt_get_vf_config()
100 if (!(vf->flags & BNXT_VF_LINK_FORCED)) in bnxt_get_vf_config()
102 else if (vf->flags & BNXT_VF_LINK_UP) in bnxt_get_vf_config()
114 struct bnxt_vf_info *vf; in bnxt_set_vf_mac() local
127 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_mac()
129 memcpy(vf->mac_addr, mac, ETH_ALEN); in bnxt_set_vf_mac()
131 req.vf_id = cpu_to_le16(vf->fw_fid); in bnxt_set_vf_mac()
132 req.flags = cpu_to_le32(vf->func_flags); in bnxt_set_vf_mac()
142 struct bnxt_vf_info *vf; in bnxt_set_vf_vlan() local
156 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_vlan()
158 if (vlan_tag == vf->vlan) in bnxt_set_vf_vlan()
162 req.vf_id = cpu_to_le16(vf->fw_fid); in bnxt_set_vf_vlan()
163 req.flags = cpu_to_le32(vf->func_flags); in bnxt_set_vf_vlan()
168 vf->vlan = vlan_tag; in bnxt_set_vf_vlan()
177 struct bnxt_vf_info *vf; in bnxt_set_vf_bw() local
185 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_bw()
198 if (min_tx_rate == vf->min_tx_rate && max_tx_rate == vf->max_tx_rate) in bnxt_set_vf_bw()
201 req.vf_id = cpu_to_le16(vf->fw_fid); in bnxt_set_vf_bw()
202 req.flags = cpu_to_le32(vf->func_flags); in bnxt_set_vf_bw()
209 vf->min_tx_rate = min_tx_rate; in bnxt_set_vf_bw()
210 vf->max_tx_rate = max_tx_rate; in bnxt_set_vf_bw()
218 struct bnxt_vf_info *vf; in bnxt_set_vf_link_state() local
225 vf = &bp->pf.vf[vf_id]; in bnxt_set_vf_link_state()
227 vf->flags &= ~(BNXT_VF_LINK_UP | BNXT_VF_LINK_FORCED); in bnxt_set_vf_link_state()
230 vf->flags |= BNXT_VF_LINK_UP; in bnxt_set_vf_link_state()
233 vf->flags |= BNXT_VF_LINK_FORCED; in bnxt_set_vf_link_state()
236 vf->flags |= BNXT_VF_LINK_UP | BNXT_VF_LINK_FORCED; in bnxt_set_vf_link_state()
251 struct bnxt_vf_info *vf; in bnxt_set_vf_attr() local
254 vf = &bp->pf.vf[i]; in bnxt_set_vf_attr()
255 memset(vf, 0, sizeof(*vf)); in bnxt_set_vf_attr()
256 vf->flags = BNXT_VF_QOS | BNXT_VF_LINK_UP; in bnxt_set_vf_attr()
298 kfree(bp->pf.vf); in bnxt_free_vf_resources()
299 bp->pf.vf = NULL; in bnxt_free_vf_resources()
307 bp->pf.vf = kcalloc(num_vfs, sizeof(struct bnxt_vf_info), GFP_KERNEL); in bnxt_alloc_vf_resources()
308 if (!bp->pf.vf) in bnxt_alloc_vf_resources()
328 struct bnxt_vf_info *vf = &bp->pf.vf[k]; in bnxt_alloc_vf_resources() local
330 vf->hwrm_cmd_req_addr = bp->pf.hwrm_cmd_req_addr[i] + in bnxt_alloc_vf_resources()
332 vf->hwrm_cmd_req_dma_addr = in bnxt_alloc_vf_resources()
427 bp->pf.vf[i].fw_fid = le16_to_cpu(req.vf_id); in bnxt_hwrm_func_cfg()
586 static int bnxt_hwrm_fwd_resp(struct bnxt *bp, struct bnxt_vf_info *vf, in bnxt_hwrm_fwd_resp() argument
597 req.target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_fwd_resp()
622 static int bnxt_hwrm_fwd_err_resp(struct bnxt *bp, struct bnxt_vf_info *vf, in bnxt_hwrm_fwd_err_resp() argument
631 req.target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_fwd_err_resp()
632 memcpy(req.encap_request, vf->hwrm_cmd_req_addr, msg_size); in bnxt_hwrm_fwd_err_resp()
653 static int bnxt_hwrm_exec_fwd_resp(struct bnxt *bp, struct bnxt_vf_info *vf, in bnxt_hwrm_exec_fwd_resp() argument
662 req.target_id = cpu_to_le16(vf->fw_fid); in bnxt_hwrm_exec_fwd_resp()
663 memcpy(req.encap_request, vf->hwrm_cmd_req_addr, msg_size); in bnxt_hwrm_exec_fwd_resp()
684 static int bnxt_vf_validate_set_mac(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_vf_validate_set_mac() argument
688 (struct hwrm_cfa_l2_filter_alloc_input *)vf->hwrm_cmd_req_addr; in bnxt_vf_validate_set_mac()
690 if (!is_valid_ether_addr(vf->mac_addr) || in bnxt_vf_validate_set_mac()
691 ether_addr_equal((const u8 *)req->l2_addr, vf->mac_addr)) in bnxt_vf_validate_set_mac()
692 return bnxt_hwrm_exec_fwd_resp(bp, vf, msg_size); in bnxt_vf_validate_set_mac()
694 return bnxt_hwrm_fwd_err_resp(bp, vf, msg_size); in bnxt_vf_validate_set_mac()
697 static int bnxt_vf_set_link(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_vf_set_link() argument
701 if (!(vf->flags & BNXT_VF_LINK_FORCED)) { in bnxt_vf_set_link()
704 bp, vf, sizeof(struct hwrm_port_phy_qcfg_input)); in bnxt_vf_set_link()
710 (struct hwrm_port_phy_qcfg_input *)vf->hwrm_cmd_req_addr; in bnxt_vf_set_link()
717 if (vf->flags & BNXT_VF_LINK_UP) { in bnxt_vf_set_link()
742 rc = bnxt_hwrm_fwd_resp(bp, vf, &phy_qcfg_resp, in bnxt_vf_set_link()
750 static int bnxt_vf_req_validate_snd(struct bnxt *bp, struct bnxt_vf_info *vf) in bnxt_vf_req_validate_snd() argument
753 struct hwrm_cmd_req_hdr *encap_req = vf->hwrm_cmd_req_addr; in bnxt_vf_req_validate_snd()
758 rc = bnxt_vf_validate_set_mac(bp, vf); in bnxt_vf_req_validate_snd()
765 bp, vf, sizeof(struct hwrm_func_cfg_input)); in bnxt_vf_req_validate_snd()
768 rc = bnxt_vf_set_link(bp, vf); in bnxt_vf_req_validate_snd()
787 bnxt_vf_req_validate_snd(bp, &bp->pf.vf[vf_id]); in bnxt_hwrm_exec_fwd_req()
807 if (!ether_addr_equal(resp->perm_mac_address, bp->vf.mac_addr)) in bnxt_update_vf_mac()
808 memcpy(bp->vf.mac_addr, resp->perm_mac_address, ETH_ALEN); in bnxt_update_vf_mac()
810 memcpy(bp->dev->dev_addr, bp->vf.mac_addr, ETH_ALEN); in bnxt_update_vf_mac()