Lines Matching refs:veb

34 static int i40e_add_veb(struct i40e_veb *veb, struct i40e_vsi *vsi);
49 static int i40e_veb_get_bw_info(struct i40e_veb *veb);
541 if (pf->veb[i]) { in i40e_pf_reset_stats()
542 memset(&pf->veb[i]->stats, 0, in i40e_pf_reset_stats()
543 sizeof(pf->veb[i]->stats)); in i40e_pf_reset_stats()
544 memset(&pf->veb[i]->stats_offsets, 0, in i40e_pf_reset_stats()
545 sizeof(pf->veb[i]->stats_offsets)); in i40e_pf_reset_stats()
546 memset(&pf->veb[i]->tc_stats, 0, in i40e_pf_reset_stats()
547 sizeof(pf->veb[i]->tc_stats)); in i40e_pf_reset_stats()
548 memset(&pf->veb[i]->tc_stats_offsets, 0, in i40e_pf_reset_stats()
549 sizeof(pf->veb[i]->tc_stats_offsets)); in i40e_pf_reset_stats()
550 pf->veb[i]->stat_offsets_loaded = false; in i40e_pf_reset_stats()
766 void i40e_update_veb_stats(struct i40e_veb *veb) in i40e_update_veb_stats() argument
768 struct i40e_pf *pf = veb->pf; in i40e_update_veb_stats()
776 idx = veb->stats_idx; in i40e_update_veb_stats()
777 es = &veb->stats; in i40e_update_veb_stats()
778 oes = &veb->stats_offsets; in i40e_update_veb_stats()
779 veb_es = &veb->tc_stats; in i40e_update_veb_stats()
780 veb_oes = &veb->tc_stats_offsets; in i40e_update_veb_stats()
784 veb->stat_offsets_loaded, in i40e_update_veb_stats()
788 veb->stat_offsets_loaded, in i40e_update_veb_stats()
792 veb->stat_offsets_loaded, in i40e_update_veb_stats()
795 veb->stat_offsets_loaded, in i40e_update_veb_stats()
798 veb->stat_offsets_loaded, in i40e_update_veb_stats()
801 veb->stat_offsets_loaded, in i40e_update_veb_stats()
805 veb->stat_offsets_loaded, in i40e_update_veb_stats()
808 veb->stat_offsets_loaded, in i40e_update_veb_stats()
811 veb->stat_offsets_loaded, in i40e_update_veb_stats()
814 veb->stat_offsets_loaded, in i40e_update_veb_stats()
819 veb->stat_offsets_loaded, in i40e_update_veb_stats()
824 veb->stat_offsets_loaded, in i40e_update_veb_stats()
829 veb->stat_offsets_loaded, in i40e_update_veb_stats()
834 veb->stat_offsets_loaded, in i40e_update_veb_stats()
838 veb->stat_offsets_loaded = true; in i40e_update_veb_stats()
6685 int i40e_veb_config_tc(struct i40e_veb *veb, u8 enabled_tc) in i40e_veb_config_tc() argument
6688 struct i40e_pf *pf = veb->pf; in i40e_veb_config_tc()
6693 if (!enabled_tc || veb->enabled_tc == enabled_tc) in i40e_veb_config_tc()
6705 ret = i40e_aq_config_switch_comp_bw_config(&pf->hw, veb->seid, in i40e_veb_config_tc()
6716 ret = i40e_veb_get_bw_info(veb); in i40e_veb_config_tc()
6749 if (!pf->veb[v]) in i40e_dcb_reconfigure()
6751 ret = i40e_veb_config_tc(pf->veb[v], tc_map); in i40e_dcb_reconfigure()
6755 pf->veb[v]->seid); in i40e_dcb_reconfigure()
9849 static void i40e_veb_link_event(struct i40e_veb *veb, bool link_up) in i40e_veb_link_event() argument
9854 if (!veb || !veb->pf) in i40e_veb_link_event()
9856 pf = veb->pf; in i40e_veb_link_event()
9860 if (pf->veb[i] && (pf->veb[i]->uplink_seid == veb->seid)) in i40e_veb_link_event()
9861 i40e_veb_link_event(pf->veb[i], link_up); in i40e_veb_link_event()
9865 if (pf->vsi[i] && (pf->vsi[i]->uplink_seid == veb->seid)) in i40e_veb_link_event()
9915 if (pf->lan_veb < I40E_MAX_VEB && pf->veb[pf->lan_veb]) in i40e_link_event()
9916 i40e_veb_link_event(pf->veb[pf->lan_veb], new_link); in i40e_link_event()
9985 if (pf->veb[i]) in i40e_watchdog_subtask()
9986 i40e_update_veb_stats(pf->veb[i]); in i40e_watchdog_subtask()
10317 static void i40e_config_bridge_mode(struct i40e_veb *veb) in i40e_config_bridge_mode() argument
10319 struct i40e_pf *pf = veb->pf; in i40e_config_bridge_mode()
10323 veb->bridge_mode == BRIDGE_MODE_VEPA ? "VEPA" : "VEB"); in i40e_config_bridge_mode()
10324 if (veb->bridge_mode & BRIDGE_MODE_VEPA) in i40e_config_bridge_mode()
10339 static int i40e_reconstitute_veb(struct i40e_veb *veb) in i40e_reconstitute_veb() argument
10342 struct i40e_pf *pf = veb->pf; in i40e_reconstitute_veb()
10349 pf->vsi[v]->veb_idx == veb->idx && in i40e_reconstitute_veb()
10357 "missing owner VSI for veb_idx %d\n", veb->idx); in i40e_reconstitute_veb()
10367 veb->idx, ret); in i40e_reconstitute_veb()
10373 ret = i40e_add_veb(veb, ctl_vsi); in i40e_reconstitute_veb()
10378 veb->bridge_mode = BRIDGE_MODE_VEB; in i40e_reconstitute_veb()
10380 veb->bridge_mode = BRIDGE_MODE_VEPA; in i40e_reconstitute_veb()
10381 i40e_config_bridge_mode(veb); in i40e_reconstitute_veb()
10388 if (pf->vsi[v]->veb_idx == veb->idx) { in i40e_reconstitute_veb()
10391 vsi->uplink_seid = veb->seid; in i40e_reconstitute_veb()
10405 if (pf->veb[veb_idx] && pf->veb[veb_idx]->veb_idx == veb->idx) { in i40e_reconstitute_veb()
10406 pf->veb[veb_idx]->uplink_seid = veb->seid; in i40e_reconstitute_veb()
10407 ret = i40e_reconstitute_veb(pf->veb[veb_idx]); in i40e_reconstitute_veb()
10954 if (!pf->veb[v]) in i40e_rebuild()
10957 if (pf->veb[v]->uplink_seid == pf->mac_seid || in i40e_rebuild()
10958 pf->veb[v]->uplink_seid == 0) { in i40e_rebuild()
10959 ret = i40e_reconstitute_veb(pf->veb[v]); in i40e_rebuild()
10970 if (pf->veb[v]->uplink_seid == pf->mac_seid) { in i40e_rebuild()
10976 } else if (pf->veb[v]->uplink_seid == 0) { in i40e_rebuild()
13116 struct i40e_veb *veb = NULL; in i40e_ndo_bridge_setlink() local
13125 for (i = 0; i < I40E_MAX_VEB && !veb; i++) { in i40e_ndo_bridge_setlink()
13126 if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid) in i40e_ndo_bridge_setlink()
13127 veb = pf->veb[i]; in i40e_ndo_bridge_setlink()
13144 if (!veb) { in i40e_ndo_bridge_setlink()
13145 veb = i40e_veb_setup(pf, 0, vsi->uplink_seid, vsi->seid, in i40e_ndo_bridge_setlink()
13147 if (veb) { in i40e_ndo_bridge_setlink()
13148 veb->bridge_mode = mode; in i40e_ndo_bridge_setlink()
13149 i40e_config_bridge_mode(veb); in i40e_ndo_bridge_setlink()
13155 } else if (mode != veb->bridge_mode) { in i40e_ndo_bridge_setlink()
13157 veb->bridge_mode = mode; in i40e_ndo_bridge_setlink()
13191 struct i40e_veb *veb = NULL; in i40e_ndo_bridge_getlink() local
13199 for (i = 0; i < I40E_MAX_VEB && !veb; i++) { in i40e_ndo_bridge_getlink()
13200 if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid) in i40e_ndo_bridge_getlink()
13201 veb = pf->veb[i]; in i40e_ndo_bridge_getlink()
13204 if (!veb) in i40e_ndo_bridge_getlink()
13207 return ndo_dflt_bridge_getlink(skb, pid, seq, dev, veb->bridge_mode, in i40e_ndo_bridge_getlink()
13844 struct i40e_veb *veb; in i40e_is_vsi_uplink_mode_veb() local
13851 veb = pf->veb[vsi->veb_idx]; in i40e_is_vsi_uplink_mode_veb()
13852 if (!veb) { in i40e_is_vsi_uplink_mode_veb()
13859 if (veb->bridge_mode & BRIDGE_MODE_VEPA) { in i40e_is_vsi_uplink_mode_veb()
14127 struct i40e_veb *veb = NULL; in i40e_vsi_release() local
14201 if (!pf->veb[i]) in i40e_vsi_release()
14203 if (pf->veb[i]->uplink_seid == uplink_seid) in i40e_vsi_release()
14205 if (pf->veb[i]->seid == uplink_seid) in i40e_vsi_release()
14206 veb = pf->veb[i]; in i40e_vsi_release()
14208 if (n == 0 && veb && veb->uplink_seid != 0) in i40e_vsi_release()
14209 i40e_veb_release(veb); in i40e_vsi_release()
14363 struct i40e_veb *veb = NULL; in i40e_vsi_setup() local
14382 if (pf->veb[i] && pf->veb[i]->seid == uplink_seid) { in i40e_vsi_setup()
14383 veb = pf->veb[i]; in i40e_vsi_setup()
14388 if (!veb && uplink_seid != pf->mac_seid) { in i40e_vsi_setup()
14403 veb = i40e_veb_setup(pf, 0, pf->mac_seid, vsi->seid, in i40e_vsi_setup()
14406 veb = i40e_veb_setup(pf, 0, vsi->uplink_seid, vsi->seid, in i40e_vsi_setup()
14408 if (veb) { in i40e_vsi_setup()
14419 veb->bridge_mode = BRIDGE_MODE_VEPA; in i40e_vsi_setup()
14422 i40e_config_bridge_mode(veb); in i40e_vsi_setup()
14424 for (i = 0; i < I40E_MAX_VEB && !veb; i++) { in i40e_vsi_setup()
14425 if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid) in i40e_vsi_setup()
14426 veb = pf->veb[i]; in i40e_vsi_setup()
14428 if (!veb) { in i40e_vsi_setup()
14434 uplink_seid = veb->seid; in i40e_vsi_setup()
14445 vsi->veb_idx = (veb ? veb->idx : I40E_NO_VEB); in i40e_vsi_setup()
14539 static int i40e_veb_get_bw_info(struct i40e_veb *veb) in i40e_veb_get_bw_info() argument
14543 struct i40e_pf *pf = veb->pf; in i40e_veb_get_bw_info()
14549 ret = i40e_aq_query_switch_comp_bw_config(hw, veb->seid, in i40e_veb_get_bw_info()
14559 ret = i40e_aq_query_switch_comp_ets_config(hw, veb->seid, in i40e_veb_get_bw_info()
14569 veb->bw_limit = le16_to_cpu(ets_data.port_bw_limit); in i40e_veb_get_bw_info()
14570 veb->bw_max_quanta = ets_data.tc_bw_max; in i40e_veb_get_bw_info()
14571 veb->is_abs_credits = bw_data.absolute_credits_enable; in i40e_veb_get_bw_info()
14572 veb->enabled_tc = ets_data.tc_valid_bits; in i40e_veb_get_bw_info()
14576 veb->bw_tc_share_credits[i] = bw_data.tc_bw_share_credits[i]; in i40e_veb_get_bw_info()
14577 veb->bw_tc_limit_credits[i] = in i40e_veb_get_bw_info()
14579 veb->bw_tc_max_quanta[i] = ((tc_bw_max >> (i*4)) & 0x7); in i40e_veb_get_bw_info()
14596 struct i40e_veb *veb; in i40e_veb_mem_alloc() local
14609 while ((i < I40E_MAX_VEB) && (pf->veb[i] != NULL)) in i40e_veb_mem_alloc()
14616 veb = kzalloc(sizeof(*veb), GFP_KERNEL); in i40e_veb_mem_alloc()
14617 if (!veb) { in i40e_veb_mem_alloc()
14621 veb->pf = pf; in i40e_veb_mem_alloc()
14622 veb->idx = i; in i40e_veb_mem_alloc()
14623 veb->enabled_tc = 1; in i40e_veb_mem_alloc()
14625 pf->veb[i] = veb; in i40e_veb_mem_alloc()
14648 if (!pf->veb[i]) in i40e_switch_branch_release()
14650 if (pf->veb[i]->uplink_seid == branch->seid) in i40e_switch_branch_release()
14651 i40e_switch_branch_release(pf->veb[i]); in i40e_switch_branch_release()
14673 if (pf->veb[veb_idx]) in i40e_switch_branch_release()
14674 i40e_veb_release(pf->veb[veb_idx]); in i40e_switch_branch_release()
14681 static void i40e_veb_clear(struct i40e_veb *veb) in i40e_veb_clear() argument
14683 if (!veb) in i40e_veb_clear()
14686 if (veb->pf) { in i40e_veb_clear()
14687 struct i40e_pf *pf = veb->pf; in i40e_veb_clear()
14690 if (pf->veb[veb->idx] == veb) in i40e_veb_clear()
14691 pf->veb[veb->idx] = NULL; in i40e_veb_clear()
14695 kfree(veb); in i40e_veb_clear()
14702 void i40e_veb_release(struct i40e_veb *veb) in i40e_veb_release() argument
14708 pf = veb->pf; in i40e_veb_release()
14712 if (pf->vsi[i] && pf->vsi[i]->uplink_seid == veb->seid) { in i40e_veb_release()
14720 veb->seid, n); in i40e_veb_release()
14726 if (veb->uplink_seid) { in i40e_veb_release()
14727 vsi->uplink_seid = veb->uplink_seid; in i40e_veb_release()
14728 if (veb->uplink_seid == pf->mac_seid) in i40e_veb_release()
14731 vsi->veb_idx = veb->veb_idx; in i40e_veb_release()
14738 i40e_aq_delete_element(&pf->hw, veb->seid, NULL); in i40e_veb_release()
14739 i40e_veb_clear(veb); in i40e_veb_release()
14747 static int i40e_add_veb(struct i40e_veb *veb, struct i40e_vsi *vsi) in i40e_add_veb() argument
14749 struct i40e_pf *pf = veb->pf; in i40e_add_veb()
14753 ret = i40e_aq_add_veb(&pf->hw, veb->uplink_seid, vsi->seid, in i40e_add_veb()
14754 veb->enabled_tc, false, in i40e_add_veb()
14755 &veb->seid, enable_stats, NULL); in i40e_add_veb()
14767 ret = i40e_aq_get_veb_parameters(&pf->hw, veb->seid, NULL, NULL, in i40e_add_veb()
14768 &veb->stats_idx, NULL, NULL, NULL); in i40e_add_veb()
14776 ret = i40e_veb_get_bw_info(veb); in i40e_add_veb()
14782 i40e_aq_delete_element(&pf->hw, veb->seid, NULL); in i40e_add_veb()
14786 vsi->uplink_seid = veb->seid; in i40e_add_veb()
14787 vsi->veb_idx = veb->idx; in i40e_add_veb()
14813 struct i40e_veb *veb, *uplink_veb = NULL; in i40e_veb_setup() local
14838 if (pf->veb[veb_idx] && in i40e_veb_setup()
14839 pf->veb[veb_idx]->seid == uplink_seid) { in i40e_veb_setup()
14840 uplink_veb = pf->veb[veb_idx]; in i40e_veb_setup()
14855 veb = pf->veb[veb_idx]; in i40e_veb_setup()
14856 veb->flags = flags; in i40e_veb_setup()
14857 veb->uplink_seid = uplink_seid; in i40e_veb_setup()
14858 veb->veb_idx = (uplink_veb ? uplink_veb->idx : I40E_NO_VEB); in i40e_veb_setup()
14859 veb->enabled_tc = (enabled_tc ? enabled_tc : 0x1); in i40e_veb_setup()
14862 ret = i40e_add_veb(veb, pf->vsi[vsi_idx]); in i40e_veb_setup()
14866 pf->lan_veb = veb->idx; in i40e_veb_setup()
14868 return veb; in i40e_veb_setup()
14871 i40e_veb_clear(veb); in i40e_veb_setup()
14912 if (pf->veb[v] && (pf->veb[v]->seid == seid)) { in i40e_setup_pf_switch_element()
14927 pf->veb[pf->lan_veb]->seid = seid; in i40e_setup_pf_switch_element()
14928 pf->veb[pf->lan_veb]->uplink_seid = pf->mac_seid; in i40e_setup_pf_switch_element()
14929 pf->veb[pf->lan_veb]->pf = pf; in i40e_setup_pf_switch_element()
14930 pf->veb[pf->lan_veb]->veb_idx = I40E_NO_VEB; in i40e_setup_pf_switch_element()
15080 if (pf->lan_veb < I40E_MAX_VEB && pf->veb[pf->lan_veb]) in i40e_setup_pf_switch()
15081 uplink_seid = pf->veb[pf->lan_veb]->seid; in i40e_setup_pf_switch()
16259 if (!pf->veb[i]) in i40e_remove()
16262 if (pf->veb[i]->uplink_seid == pf->mac_seid || in i40e_remove()
16263 pf->veb[i]->uplink_seid == 0) in i40e_remove()
16264 i40e_switch_branch_release(pf->veb[i]); in i40e_remove()
16319 kfree(pf->veb[i]); in i40e_remove()
16320 pf->veb[i] = NULL; in i40e_remove()