/** * i40e_dcbnl_set_all - set all the apps and ieee data from DCBx config * @vsi: the corresponding vsi * * Set up all the IEEE APPs in the DCBNL App Table and generate event for * other settings **/ void i40e_dcbnl_set_all(struct i40e_vsi *vsi) { struct net_device *dev = vsi->netdev; struct i40e_pf *pf = i40e_netdev_to_pf(dev); struct i40e_dcbx_config *dcbxcfg; struct i40e_hw *hw = &pf->hw; struct dcb_app sapp; u8 prio, tc_map; int i; /* DCB not enabled */ if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) return; dcbxcfg = &hw->local_dcbx_config; /* Set up all the App TLVs if DCBx is negotiated */ for (i = 0; i < dcbxcfg->numapps; i++) { prio = dcbxcfg->app[i].priority; tc_map = (1 << dcbxcfg->etscfg.prioritytable[prio]); /* Add APP only if the TC is enabled for this VSI */ if (tc_map & vsi->tc_config.enabled_tc) { sapp.selector = dcbxcfg->app[i].selector; sapp.protocol = dcbxcfg->app[i].protocolid; sapp.priority = prio; dcb_ieee_setapp(dev, &sapp); } } /* Notify user-space of the changes */ dcbnl_ieee_notify(dev, RTM_SETDCB, DCB_CMD_IEEE_SET, 0, 0); }
static int ixgbe_dcbnl_ieee_setapp(struct net_device *dev, struct dcb_app *app) { struct ixgbe_adapter *adapter = netdev_priv(dev); int err = -EINVAL; if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE)) return err; err = dcb_ieee_setapp(dev, app); #ifdef IXGBE_FCOE if (!err && app->selector == IEEE_8021QAZ_APP_SEL_ETHERTYPE && app->protocol == ETH_P_FCOE) { u8 app_mask = dcb_ieee_getapp_mask(dev, app); if (app_mask & (1 << adapter->fcoe.up)) return err; adapter->fcoe.up = app->priority; ixgbe_dcbnl_devreset(dev); } #endif return 0; }
static int ixgbe_dcbnl_ieee_setapp(struct net_device *dev, struct dcb_app *app) { struct ixgbe_adapter *adapter = netdev_priv(dev); int err = -EINVAL; if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE)) return err; err = dcb_ieee_setapp(dev, app); if (err) return err; #ifdef IXGBE_FCOE if (app->selector == IEEE_8021QAZ_APP_SEL_ETHERTYPE && app->protocol == ETH_P_FCOE) { u8 app_mask = dcb_ieee_getapp_mask(dev, app); if (app_mask & (1 << adapter->fcoe.up)) return err; adapter->fcoe.up = app->priority; ixgbe_dcbnl_devreset(dev); } #endif /* VF devices should use default UP when available */ if (app->selector == IEEE_8021QAZ_APP_SEL_ETHERTYPE && app->protocol == 0) { int vf; adapter->default_up = app->priority; for (vf = 0; vf < adapter->num_vfs; vf++) { struct vf_data_storage *vfinfo = &adapter->vfinfo[vf]; if (!vfinfo->pf_qos) ixgbe_set_vmvir(adapter, vfinfo->pf_vlan, app->priority, vf); } } return 0; }