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()
6697 int i40e_veb_config_tc(struct i40e_veb *veb, u8 enabled_tc) in i40e_veb_config_tc() argument
6700 struct i40e_pf *pf = veb->pf; in i40e_veb_config_tc()
6705 if (!enabled_tc || veb->enabled_tc == enabled_tc) in i40e_veb_config_tc()
6717 ret = i40e_aq_config_switch_comp_bw_config(&pf->hw, veb->seid, in i40e_veb_config_tc()
6728 ret = i40e_veb_get_bw_info(veb); in i40e_veb_config_tc()
6761 if (!pf->veb[v]) in i40e_dcb_reconfigure()
6763 ret = i40e_veb_config_tc(pf->veb[v], tc_map); in i40e_dcb_reconfigure()
6767 pf->veb[v]->seid); in i40e_dcb_reconfigure()
9861 static void i40e_veb_link_event(struct i40e_veb *veb, bool link_up) in i40e_veb_link_event() argument
9866 if (!veb || !veb->pf) in i40e_veb_link_event()
9868 pf = veb->pf; in i40e_veb_link_event()
9872 if (pf->veb[i] && (pf->veb[i]->uplink_seid == veb->seid)) in i40e_veb_link_event()
9873 i40e_veb_link_event(pf->veb[i], link_up); in i40e_veb_link_event()
9877 if (pf->vsi[i] && (pf->vsi[i]->uplink_seid == veb->seid)) in i40e_veb_link_event()
9927 if (pf->lan_veb < I40E_MAX_VEB && pf->veb[pf->lan_veb]) in i40e_link_event()
9928 i40e_veb_link_event(pf->veb[pf->lan_veb], new_link); in i40e_link_event()
9997 if (pf->veb[i]) in i40e_watchdog_subtask()
9998 i40e_update_veb_stats(pf->veb[i]); in i40e_watchdog_subtask()
10329 static void i40e_config_bridge_mode(struct i40e_veb *veb) in i40e_config_bridge_mode() argument
10331 struct i40e_pf *pf = veb->pf; in i40e_config_bridge_mode()
10335 veb->bridge_mode == BRIDGE_MODE_VEPA ? "VEPA" : "VEB"); in i40e_config_bridge_mode()
10336 if (veb->bridge_mode & BRIDGE_MODE_VEPA) in i40e_config_bridge_mode()
10351 static int i40e_reconstitute_veb(struct i40e_veb *veb) in i40e_reconstitute_veb() argument
10354 struct i40e_pf *pf = veb->pf; in i40e_reconstitute_veb()
10361 pf->vsi[v]->veb_idx == veb->idx && in i40e_reconstitute_veb()
10369 "missing owner VSI for veb_idx %d\n", veb->idx); in i40e_reconstitute_veb()
10379 veb->idx, ret); in i40e_reconstitute_veb()
10385 ret = i40e_add_veb(veb, ctl_vsi); in i40e_reconstitute_veb()
10390 veb->bridge_mode = BRIDGE_MODE_VEB; in i40e_reconstitute_veb()
10392 veb->bridge_mode = BRIDGE_MODE_VEPA; in i40e_reconstitute_veb()
10393 i40e_config_bridge_mode(veb); in i40e_reconstitute_veb()
10400 if (pf->vsi[v]->veb_idx == veb->idx) { in i40e_reconstitute_veb()
10403 vsi->uplink_seid = veb->seid; in i40e_reconstitute_veb()
10417 if (pf->veb[veb_idx] && pf->veb[veb_idx]->veb_idx == veb->idx) { in i40e_reconstitute_veb()
10418 pf->veb[veb_idx]->uplink_seid = veb->seid; in i40e_reconstitute_veb()
10419 ret = i40e_reconstitute_veb(pf->veb[veb_idx]); in i40e_reconstitute_veb()
10966 if (!pf->veb[v]) in i40e_rebuild()
10969 if (pf->veb[v]->uplink_seid == pf->mac_seid || in i40e_rebuild()
10970 pf->veb[v]->uplink_seid == 0) { in i40e_rebuild()
10971 ret = i40e_reconstitute_veb(pf->veb[v]); in i40e_rebuild()
10982 if (pf->veb[v]->uplink_seid == pf->mac_seid) { in i40e_rebuild()
10988 } else if (pf->veb[v]->uplink_seid == 0) { in i40e_rebuild()
13128 struct i40e_veb *veb = NULL; in i40e_ndo_bridge_setlink() local
13137 for (i = 0; i < I40E_MAX_VEB && !veb; i++) { in i40e_ndo_bridge_setlink()
13138 if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid) in i40e_ndo_bridge_setlink()
13139 veb = pf->veb[i]; in i40e_ndo_bridge_setlink()
13156 if (!veb) { in i40e_ndo_bridge_setlink()
13157 veb = i40e_veb_setup(pf, 0, vsi->uplink_seid, vsi->seid, in i40e_ndo_bridge_setlink()
13159 if (veb) { in i40e_ndo_bridge_setlink()
13160 veb->bridge_mode = mode; in i40e_ndo_bridge_setlink()
13161 i40e_config_bridge_mode(veb); in i40e_ndo_bridge_setlink()
13167 } else if (mode != veb->bridge_mode) { in i40e_ndo_bridge_setlink()
13169 veb->bridge_mode = mode; in i40e_ndo_bridge_setlink()
13203 struct i40e_veb *veb = NULL; in i40e_ndo_bridge_getlink() local
13211 for (i = 0; i < I40E_MAX_VEB && !veb; i++) { in i40e_ndo_bridge_getlink()
13212 if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid) in i40e_ndo_bridge_getlink()
13213 veb = pf->veb[i]; in i40e_ndo_bridge_getlink()
13216 if (!veb) in i40e_ndo_bridge_getlink()
13219 return ndo_dflt_bridge_getlink(skb, pid, seq, dev, veb->bridge_mode, in i40e_ndo_bridge_getlink()
13856 struct i40e_veb *veb; in i40e_is_vsi_uplink_mode_veb() local
13863 veb = pf->veb[vsi->veb_idx]; in i40e_is_vsi_uplink_mode_veb()
13864 if (!veb) { in i40e_is_vsi_uplink_mode_veb()
13871 if (veb->bridge_mode & BRIDGE_MODE_VEPA) { in i40e_is_vsi_uplink_mode_veb()
14139 struct i40e_veb *veb = NULL; in i40e_vsi_release() local
14213 if (!pf->veb[i]) in i40e_vsi_release()
14215 if (pf->veb[i]->uplink_seid == uplink_seid) in i40e_vsi_release()
14217 if (pf->veb[i]->seid == uplink_seid) in i40e_vsi_release()
14218 veb = pf->veb[i]; in i40e_vsi_release()
14220 if (n == 0 && veb && veb->uplink_seid != 0) in i40e_vsi_release()
14221 i40e_veb_release(veb); in i40e_vsi_release()
14375 struct i40e_veb *veb = NULL; in i40e_vsi_setup() local
14394 if (pf->veb[i] && pf->veb[i]->seid == uplink_seid) { in i40e_vsi_setup()
14395 veb = pf->veb[i]; in i40e_vsi_setup()
14400 if (!veb && uplink_seid != pf->mac_seid) { in i40e_vsi_setup()
14415 veb = i40e_veb_setup(pf, 0, pf->mac_seid, vsi->seid, in i40e_vsi_setup()
14418 veb = i40e_veb_setup(pf, 0, vsi->uplink_seid, vsi->seid, in i40e_vsi_setup()
14420 if (veb) { in i40e_vsi_setup()
14431 veb->bridge_mode = BRIDGE_MODE_VEPA; in i40e_vsi_setup()
14434 i40e_config_bridge_mode(veb); in i40e_vsi_setup()
14436 for (i = 0; i < I40E_MAX_VEB && !veb; i++) { in i40e_vsi_setup()
14437 if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid) in i40e_vsi_setup()
14438 veb = pf->veb[i]; in i40e_vsi_setup()
14440 if (!veb) { in i40e_vsi_setup()
14446 uplink_seid = veb->seid; in i40e_vsi_setup()
14457 vsi->veb_idx = (veb ? veb->idx : I40E_NO_VEB); in i40e_vsi_setup()
14551 static int i40e_veb_get_bw_info(struct i40e_veb *veb) in i40e_veb_get_bw_info() argument
14555 struct i40e_pf *pf = veb->pf; in i40e_veb_get_bw_info()
14561 ret = i40e_aq_query_switch_comp_bw_config(hw, veb->seid, in i40e_veb_get_bw_info()
14571 ret = i40e_aq_query_switch_comp_ets_config(hw, veb->seid, in i40e_veb_get_bw_info()
14581 veb->bw_limit = le16_to_cpu(ets_data.port_bw_limit); in i40e_veb_get_bw_info()
14582 veb->bw_max_quanta = ets_data.tc_bw_max; in i40e_veb_get_bw_info()
14583 veb->is_abs_credits = bw_data.absolute_credits_enable; in i40e_veb_get_bw_info()
14584 veb->enabled_tc = ets_data.tc_valid_bits; in i40e_veb_get_bw_info()
14588 veb->bw_tc_share_credits[i] = bw_data.tc_bw_share_credits[i]; in i40e_veb_get_bw_info()
14589 veb->bw_tc_limit_credits[i] = in i40e_veb_get_bw_info()
14591 veb->bw_tc_max_quanta[i] = ((tc_bw_max >> (i*4)) & 0x7); in i40e_veb_get_bw_info()
14608 struct i40e_veb *veb; in i40e_veb_mem_alloc() local
14621 while ((i < I40E_MAX_VEB) && (pf->veb[i] != NULL)) in i40e_veb_mem_alloc()
14628 veb = kzalloc(sizeof(*veb), GFP_KERNEL); in i40e_veb_mem_alloc()
14629 if (!veb) { in i40e_veb_mem_alloc()
14633 veb->pf = pf; in i40e_veb_mem_alloc()
14634 veb->idx = i; in i40e_veb_mem_alloc()
14635 veb->enabled_tc = 1; in i40e_veb_mem_alloc()
14637 pf->veb[i] = veb; in i40e_veb_mem_alloc()
14660 if (!pf->veb[i]) in i40e_switch_branch_release()
14662 if (pf->veb[i]->uplink_seid == branch->seid) in i40e_switch_branch_release()
14663 i40e_switch_branch_release(pf->veb[i]); in i40e_switch_branch_release()
14685 if (pf->veb[veb_idx]) in i40e_switch_branch_release()
14686 i40e_veb_release(pf->veb[veb_idx]); in i40e_switch_branch_release()
14693 static void i40e_veb_clear(struct i40e_veb *veb) in i40e_veb_clear() argument
14695 if (!veb) in i40e_veb_clear()
14698 if (veb->pf) { in i40e_veb_clear()
14699 struct i40e_pf *pf = veb->pf; in i40e_veb_clear()
14702 if (pf->veb[veb->idx] == veb) in i40e_veb_clear()
14703 pf->veb[veb->idx] = NULL; in i40e_veb_clear()
14707 kfree(veb); in i40e_veb_clear()
14714 void i40e_veb_release(struct i40e_veb *veb) in i40e_veb_release() argument
14720 pf = veb->pf; in i40e_veb_release()
14724 if (pf->vsi[i] && pf->vsi[i]->uplink_seid == veb->seid) { in i40e_veb_release()
14732 veb->seid, n); in i40e_veb_release()
14738 if (veb->uplink_seid) { in i40e_veb_release()
14739 vsi->uplink_seid = veb->uplink_seid; in i40e_veb_release()
14740 if (veb->uplink_seid == pf->mac_seid) in i40e_veb_release()
14743 vsi->veb_idx = veb->veb_idx; in i40e_veb_release()
14750 i40e_aq_delete_element(&pf->hw, veb->seid, NULL); in i40e_veb_release()
14751 i40e_veb_clear(veb); in i40e_veb_release()
14759 static int i40e_add_veb(struct i40e_veb *veb, struct i40e_vsi *vsi) in i40e_add_veb() argument
14761 struct i40e_pf *pf = veb->pf; in i40e_add_veb()
14765 ret = i40e_aq_add_veb(&pf->hw, veb->uplink_seid, vsi->seid, in i40e_add_veb()
14766 veb->enabled_tc, false, in i40e_add_veb()
14767 &veb->seid, enable_stats, NULL); in i40e_add_veb()
14779 ret = i40e_aq_get_veb_parameters(&pf->hw, veb->seid, NULL, NULL, in i40e_add_veb()
14780 &veb->stats_idx, NULL, NULL, NULL); in i40e_add_veb()
14788 ret = i40e_veb_get_bw_info(veb); in i40e_add_veb()
14794 i40e_aq_delete_element(&pf->hw, veb->seid, NULL); in i40e_add_veb()
14798 vsi->uplink_seid = veb->seid; in i40e_add_veb()
14799 vsi->veb_idx = veb->idx; in i40e_add_veb()
14825 struct i40e_veb *veb, *uplink_veb = NULL; in i40e_veb_setup() local
14850 if (pf->veb[veb_idx] && in i40e_veb_setup()
14851 pf->veb[veb_idx]->seid == uplink_seid) { in i40e_veb_setup()
14852 uplink_veb = pf->veb[veb_idx]; in i40e_veb_setup()
14867 veb = pf->veb[veb_idx]; in i40e_veb_setup()
14868 veb->flags = flags; in i40e_veb_setup()
14869 veb->uplink_seid = uplink_seid; in i40e_veb_setup()
14870 veb->veb_idx = (uplink_veb ? uplink_veb->idx : I40E_NO_VEB); in i40e_veb_setup()
14871 veb->enabled_tc = (enabled_tc ? enabled_tc : 0x1); in i40e_veb_setup()
14874 ret = i40e_add_veb(veb, pf->vsi[vsi_idx]); in i40e_veb_setup()
14878 pf->lan_veb = veb->idx; in i40e_veb_setup()
14880 return veb; in i40e_veb_setup()
14883 i40e_veb_clear(veb); in i40e_veb_setup()
14924 if (pf->veb[v] && (pf->veb[v]->seid == seid)) { in i40e_setup_pf_switch_element()
14939 pf->veb[pf->lan_veb]->seid = seid; in i40e_setup_pf_switch_element()
14940 pf->veb[pf->lan_veb]->uplink_seid = pf->mac_seid; in i40e_setup_pf_switch_element()
14941 pf->veb[pf->lan_veb]->pf = pf; in i40e_setup_pf_switch_element()
14942 pf->veb[pf->lan_veb]->veb_idx = I40E_NO_VEB; in i40e_setup_pf_switch_element()
15092 if (pf->lan_veb < I40E_MAX_VEB && pf->veb[pf->lan_veb]) in i40e_setup_pf_switch()
15093 uplink_seid = pf->veb[pf->lan_veb]->seid; in i40e_setup_pf_switch()
16271 if (!pf->veb[i]) in i40e_remove()
16274 if (pf->veb[i]->uplink_seid == pf->mac_seid || in i40e_remove()
16275 pf->veb[i]->uplink_seid == 0) in i40e_remove()
16276 i40e_switch_branch_release(pf->veb[i]); in i40e_remove()
16331 kfree(pf->veb[i]); in i40e_remove()
16332 pf->veb[i] = NULL; in i40e_remove()