Lines Matching refs:veb

37 static int i40e_add_veb(struct i40e_veb *veb, struct i40e_vsi *vsi);
52 static int i40e_veb_get_bw_info(struct i40e_veb *veb);
556 struct i40e_veb *veb; in i40e_pf_reset_stats() local
563 i40e_pf_for_each_veb(pf, i, veb) { in i40e_pf_reset_stats()
564 memset(&veb->stats, 0, sizeof(veb->stats)); in i40e_pf_reset_stats()
565 memset(&veb->stats_offsets, 0, sizeof(veb->stats_offsets)); in i40e_pf_reset_stats()
566 memset(&veb->tc_stats, 0, sizeof(veb->tc_stats)); in i40e_pf_reset_stats()
567 memset(&veb->tc_stats_offsets, 0, sizeof(veb->tc_stats_offsets)); in i40e_pf_reset_stats()
568 veb->stat_offsets_loaded = false; in i40e_pf_reset_stats()
776 void i40e_update_veb_stats(struct i40e_veb *veb) in i40e_update_veb_stats() argument
778 struct i40e_pf *pf = veb->pf; in i40e_update_veb_stats()
786 idx = veb->stats_idx; in i40e_update_veb_stats()
787 es = &veb->stats; in i40e_update_veb_stats()
788 oes = &veb->stats_offsets; in i40e_update_veb_stats()
789 veb_es = &veb->tc_stats; in i40e_update_veb_stats()
790 veb_oes = &veb->tc_stats_offsets; in i40e_update_veb_stats()
794 veb->stat_offsets_loaded, in i40e_update_veb_stats()
798 veb->stat_offsets_loaded, in i40e_update_veb_stats()
802 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()
815 veb->stat_offsets_loaded, in i40e_update_veb_stats()
818 veb->stat_offsets_loaded, in i40e_update_veb_stats()
821 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()
839 veb->stat_offsets_loaded, in i40e_update_veb_stats()
844 veb->stat_offsets_loaded, in i40e_update_veb_stats()
848 veb->stat_offsets_loaded = true; in i40e_update_veb_stats()
6765 int i40e_veb_config_tc(struct i40e_veb *veb, u8 enabled_tc) in i40e_veb_config_tc() argument
6768 struct i40e_pf *pf = veb->pf; in i40e_veb_config_tc()
6773 if (!enabled_tc || veb->enabled_tc == enabled_tc) in i40e_veb_config_tc()
6785 ret = i40e_aq_config_switch_comp_bw_config(&pf->hw, veb->seid, in i40e_veb_config_tc()
6796 ret = i40e_veb_get_bw_info(veb); in i40e_veb_config_tc()
6820 struct i40e_veb *veb; in i40e_dcb_reconfigure() local
6830 i40e_pf_for_each_veb(pf, v, veb) { in i40e_dcb_reconfigure()
6831 ret = i40e_veb_config_tc(veb, tc_map); in i40e_dcb_reconfigure()
6835 veb->seid); in i40e_dcb_reconfigure()
9941 static void i40e_veb_link_event(struct i40e_veb *veb, bool link_up) in i40e_veb_link_event() argument
9947 if (!veb || !veb->pf) in i40e_veb_link_event()
9949 pf = veb->pf; in i40e_veb_link_event()
9953 if (vsi->uplink_seid == veb->seid) in i40e_veb_link_event()
9964 struct i40e_veb *veb = i40e_pf_get_main_veb(pf); in i40e_link_event() local
10004 if (veb) in i40e_link_event()
10005 i40e_veb_link_event(veb, new_link); in i40e_link_event()
10048 struct i40e_veb *veb; in i40e_watchdog_subtask() local
10075 i40e_pf_for_each_veb(pf, i, veb) in i40e_watchdog_subtask()
10076 i40e_update_veb_stats(veb); in i40e_watchdog_subtask()
10407 static void i40e_config_bridge_mode(struct i40e_veb *veb) in i40e_config_bridge_mode() argument
10409 struct i40e_pf *pf = veb->pf; in i40e_config_bridge_mode()
10413 veb->bridge_mode == BRIDGE_MODE_VEPA ? "VEPA" : "VEB"); in i40e_config_bridge_mode()
10414 if (veb->bridge_mode & BRIDGE_MODE_VEPA) in i40e_config_bridge_mode()
10428 static int i40e_reconstitute_veb(struct i40e_veb *veb) in i40e_reconstitute_veb() argument
10431 struct i40e_pf *pf = veb->pf; in i40e_reconstitute_veb()
10439 if (WARN_ON(veb->uplink_seid && veb->uplink_seid != pf->mac_seid)) { in i40e_reconstitute_veb()
10441 "Invalid uplink SEID for VEB %d\n", veb->idx); in i40e_reconstitute_veb()
10445 if (veb->uplink_seid == pf->mac_seid) { in i40e_reconstitute_veb()
10449 if (WARN_ON(ctl_vsi->veb_idx != veb->idx || in i40e_reconstitute_veb()
10452 "Invalid control VSI for VEB %d\n", veb->idx); in i40e_reconstitute_veb()
10461 veb->idx, ret); in i40e_reconstitute_veb()
10469 ret = i40e_add_veb(veb, ctl_vsi); in i40e_reconstitute_veb()
10473 if (veb->uplink_seid) { in i40e_reconstitute_veb()
10475 veb->bridge_mode = BRIDGE_MODE_VEB; in i40e_reconstitute_veb()
10477 veb->bridge_mode = BRIDGE_MODE_VEPA; in i40e_reconstitute_veb()
10478 i40e_config_bridge_mode(veb); in i40e_reconstitute_veb()
10486 if (vsi->veb_idx == veb->idx) { in i40e_reconstitute_veb()
10487 vsi->uplink_seid = veb->seid; in i40e_reconstitute_veb()
10897 struct i40e_veb *veb; in i40e_rebuild() local
11041 i40e_pf_for_each_veb(pf, v, veb) { in i40e_rebuild()
11042 ret = i40e_reconstitute_veb(veb); in i40e_rebuild()
11052 if (veb->uplink_seid == pf->mac_seid) { in i40e_rebuild()
11058 } else if (veb->uplink_seid == 0) { in i40e_rebuild()
13165 struct i40e_veb *veb; in i40e_ndo_bridge_setlink() local
13173 veb = i40e_pf_get_veb_by_seid(pf, vsi->uplink_seid); in i40e_ndo_bridge_setlink()
13187 if (!veb) { in i40e_ndo_bridge_setlink()
13188 veb = i40e_veb_setup(pf, vsi->uplink_seid, vsi->seid, in i40e_ndo_bridge_setlink()
13190 if (veb) { in i40e_ndo_bridge_setlink()
13191 veb->bridge_mode = mode; in i40e_ndo_bridge_setlink()
13192 i40e_config_bridge_mode(veb); in i40e_ndo_bridge_setlink()
13198 } else if (mode != veb->bridge_mode) { in i40e_ndo_bridge_setlink()
13200 veb->bridge_mode = mode; in i40e_ndo_bridge_setlink()
13234 struct i40e_veb *veb; in i40e_ndo_bridge_getlink() local
13241 veb = i40e_pf_get_veb_by_seid(pf, vsi->uplink_seid); in i40e_ndo_bridge_getlink()
13242 if (!veb) in i40e_ndo_bridge_getlink()
13245 return ndo_dflt_bridge_getlink(skb, pid, seq, dev, veb->bridge_mode, in i40e_ndo_bridge_getlink()
13892 struct i40e_veb *veb; in i40e_is_vsi_uplink_mode_veb() local
13899 veb = pf->veb[vsi->veb_idx]; in i40e_is_vsi_uplink_mode_veb()
13900 if (!veb) { in i40e_is_vsi_uplink_mode_veb()
13907 if (veb->bridge_mode & BRIDGE_MODE_VEPA) { in i40e_is_vsi_uplink_mode_veb()
14175 struct i40e_veb *veb; in i40e_vsi_release() local
14244 veb = i40e_pf_get_veb_by_seid(pf, uplink_seid); in i40e_vsi_release()
14245 if (veb && veb->uplink_seid) { in i40e_vsi_release()
14258 i40e_veb_release(veb); in i40e_vsi_release()
14415 struct i40e_veb *veb = NULL; in i40e_vsi_setup() local
14433 veb = i40e_pf_get_veb_by_seid(pf, uplink_seid); in i40e_vsi_setup()
14434 if (!veb && uplink_seid != pf->mac_seid) { in i40e_vsi_setup()
14443 veb = i40e_veb_setup(pf, pf->mac_seid, vsi->seid, in i40e_vsi_setup()
14446 veb = i40e_veb_setup(pf, vsi->uplink_seid, vsi->seid, in i40e_vsi_setup()
14448 if (veb) { in i40e_vsi_setup()
14459 veb->bridge_mode = BRIDGE_MODE_VEPA; in i40e_vsi_setup()
14462 i40e_config_bridge_mode(veb); in i40e_vsi_setup()
14464 veb = i40e_pf_get_veb_by_seid(pf, vsi->uplink_seid); in i40e_vsi_setup()
14465 if (!veb) { in i40e_vsi_setup()
14471 uplink_seid = veb->seid; in i40e_vsi_setup()
14482 vsi->veb_idx = (veb ? veb->idx : I40E_NO_VEB); in i40e_vsi_setup()
14589 static int i40e_veb_get_bw_info(struct i40e_veb *veb) in i40e_veb_get_bw_info() argument
14593 struct i40e_pf *pf = veb->pf; in i40e_veb_get_bw_info()
14599 ret = i40e_aq_query_switch_comp_bw_config(hw, veb->seid, in i40e_veb_get_bw_info()
14609 ret = i40e_aq_query_switch_comp_ets_config(hw, veb->seid, in i40e_veb_get_bw_info()
14619 veb->bw_limit = le16_to_cpu(ets_data.port_bw_limit); in i40e_veb_get_bw_info()
14620 veb->bw_max_quanta = ets_data.tc_bw_max; in i40e_veb_get_bw_info()
14621 veb->is_abs_credits = bw_data.absolute_credits_enable; in i40e_veb_get_bw_info()
14622 veb->enabled_tc = ets_data.tc_valid_bits; in i40e_veb_get_bw_info()
14626 veb->bw_tc_share_credits[i] = bw_data.tc_bw_share_credits[i]; in i40e_veb_get_bw_info()
14627 veb->bw_tc_limit_credits[i] = in i40e_veb_get_bw_info()
14629 veb->bw_tc_max_quanta[i] = ((tc_bw_max >> (i*4)) & 0x7); in i40e_veb_get_bw_info()
14646 struct i40e_veb *veb; in i40e_veb_mem_alloc() local
14659 while ((i < I40E_MAX_VEB) && (pf->veb[i] != NULL)) in i40e_veb_mem_alloc()
14666 veb = kzalloc(sizeof(*veb), GFP_KERNEL); in i40e_veb_mem_alloc()
14667 if (!veb) { in i40e_veb_mem_alloc()
14671 veb->pf = pf; in i40e_veb_mem_alloc()
14672 veb->idx = i; in i40e_veb_mem_alloc()
14673 veb->enabled_tc = 1; in i40e_veb_mem_alloc()
14675 pf->veb[i] = veb; in i40e_veb_mem_alloc()
14695 struct i40e_veb *veb; in i40e_switch_branch_release() local
14699 i40e_pf_for_each_veb(pf, i, veb) in i40e_switch_branch_release()
14700 if (veb->uplink_seid == branch->seid) in i40e_switch_branch_release()
14701 i40e_switch_branch_release(veb); in i40e_switch_branch_release()
14718 if (pf->veb[veb_idx]) in i40e_switch_branch_release()
14719 i40e_veb_release(pf->veb[veb_idx]); in i40e_switch_branch_release()
14726 static void i40e_veb_clear(struct i40e_veb *veb) in i40e_veb_clear() argument
14728 if (!veb) in i40e_veb_clear()
14731 if (veb->pf) { in i40e_veb_clear()
14732 struct i40e_pf *pf = veb->pf; in i40e_veb_clear()
14735 if (pf->veb[veb->idx] == veb) in i40e_veb_clear()
14736 pf->veb[veb->idx] = NULL; in i40e_veb_clear()
14740 kfree(veb); in i40e_veb_clear()
14747 void i40e_veb_release(struct i40e_veb *veb) in i40e_veb_release() argument
14753 pf = veb->pf; in i40e_veb_release()
14757 if (vsi_it->uplink_seid == veb->seid) { in i40e_veb_release()
14766 if ((veb->uplink_seid && n != 1) || (!veb->uplink_seid && n != 0)) { in i40e_veb_release()
14769 veb->seid, n); in i40e_veb_release()
14774 if (veb->uplink_seid) { in i40e_veb_release()
14776 vsi->uplink_seid = veb->uplink_seid; in i40e_veb_release()
14780 i40e_aq_delete_element(&pf->hw, veb->seid, NULL); in i40e_veb_release()
14781 i40e_veb_clear(veb); in i40e_veb_release()
14789 static int i40e_add_veb(struct i40e_veb *veb, struct i40e_vsi *vsi) in i40e_add_veb() argument
14791 struct i40e_pf *pf = veb->pf; in i40e_add_veb()
14795 ret = i40e_aq_add_veb(&pf->hw, veb->uplink_seid, vsi ? vsi->seid : 0, in i40e_add_veb()
14796 veb->enabled_tc, vsi ? false : true, in i40e_add_veb()
14797 &veb->seid, enable_stats, NULL); in i40e_add_veb()
14809 ret = i40e_aq_get_veb_parameters(&pf->hw, veb->seid, NULL, NULL, in i40e_add_veb()
14810 &veb->stats_idx, NULL, NULL, NULL); in i40e_add_veb()
14818 ret = i40e_veb_get_bw_info(veb); in i40e_add_veb()
14824 i40e_aq_delete_element(&pf->hw, veb->seid, NULL); in i40e_add_veb()
14829 vsi->uplink_seid = veb->seid; in i40e_add_veb()
14830 vsi->veb_idx = veb->idx; in i40e_add_veb()
14856 struct i40e_veb *veb; in i40e_veb_setup() local
14883 veb = pf->veb[veb_idx]; in i40e_veb_setup()
14884 veb->uplink_seid = uplink_seid; in i40e_veb_setup()
14885 veb->enabled_tc = (enabled_tc ? enabled_tc : 0x1); in i40e_veb_setup()
14888 ret = i40e_add_veb(veb, vsi); in i40e_veb_setup()
14893 pf->lan_veb = veb->idx; in i40e_veb_setup()
14895 return veb; in i40e_veb_setup()
14898 i40e_veb_clear(veb); in i40e_veb_setup()
14920 struct i40e_veb *veb; in i40e_setup_pf_switch_element() local
14935 veb = i40e_pf_get_main_veb(pf); in i40e_setup_pf_switch_element()
14936 if (!veb) { in i40e_setup_pf_switch_element()
14940 veb = i40e_pf_get_veb_by_seid(pf, seid); in i40e_setup_pf_switch_element()
14941 if (veb) { in i40e_setup_pf_switch_element()
14942 pf->lan_veb = veb->idx; in i40e_setup_pf_switch_element()
14952 veb = i40e_pf_get_main_veb(pf); in i40e_setup_pf_switch_element()
14953 if (!veb) in i40e_setup_pf_switch_element()
14956 veb->seid = seid; in i40e_setup_pf_switch_element()
14957 veb->uplink_seid = pf->mac_seid; in i40e_setup_pf_switch_element()
14958 veb->pf = pf; in i40e_setup_pf_switch_element()
15103 struct i40e_veb *veb; in i40e_setup_pf_switch() local
15109 veb = i40e_pf_get_main_veb(pf); in i40e_setup_pf_switch()
15110 if (veb) in i40e_setup_pf_switch()
15111 uplink_seid = veb->seid; in i40e_setup_pf_switch()
16233 struct i40e_veb *veb; in i40e_remove() local
16291 i40e_pf_for_each_veb(pf, i, veb) in i40e_remove()
16292 if (veb->uplink_seid == pf->mac_seid || in i40e_remove()
16293 veb->uplink_seid == 0) in i40e_remove()
16294 i40e_switch_branch_release(veb); in i40e_remove()
16349 i40e_pf_for_each_veb(pf, i, veb) { in i40e_remove()
16350 kfree(veb); in i40e_remove()
16351 pf->veb[i] = NULL; in i40e_remove()