static int ixgbe_dcbnl_ieee_setapp(struct net_device *dev, struct dcb_app *app) { struct ixgbe_adapter *adapter = netdev_priv(dev); if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE)) return -EINVAL; #ifdef IXGBE_FCOE if (app->selector == 1 && app->protocol == ETH_P_FCOE) { if (adapter->fcoe.tc == app->priority) goto setapp; /* In IEEE mode map up to tc 1:1 */ adapter->fcoe.tc = app->priority; adapter->fcoe.up = app->priority; /* Force hardware reset required to push FCoE * setup on {tx|rx}_rings */ adapter->dcb_set_bitmap |= BIT_APP_UPCHG; ixgbe_dcbnl_set_all(dev); } setapp: #endif dcb_setapp(dev, app); return 0; }
/** * ixgbe_dcbnl_setapp - set the DCBX application user priority * @netdev : the corresponding netdev * @idtype : identifies the id as ether type or TCP/UDP port number * @id: id is either ether type or TCP/UDP port number * @up: the 802.1p user priority bitmap * * Returns : 0 on success or 1 on error */ static u8 ixgbe_dcbnl_setapp(struct net_device *netdev, u8 idtype, u16 id, u8 up) { int err = 0; #ifdef HAVE_DCBNL_IEEE struct dcb_app app; app.selector = idtype; app.protocol = id; app.priority = up; err = dcb_setapp(netdev, &app); #endif switch (idtype) { case DCB_APP_IDTYPE_ETHTYPE: #ifdef IXGBE_FCOE if (id == ETH_P_FCOE) { struct ixgbe_adapter *adapter = netdev_priv(netdev); adapter->fcoe.up = ffs(up) - 1; } #endif break; case DCB_APP_IDTYPE_PORTNUM: break; default: break; } return err; }
/** * ixgbe_dcbnl_setapp - set the DCBX application user priority * @netdev : the corresponding netdev * @idtype : identifies the id as ether type or TCP/UDP port number * @id: id is either ether type or TCP/UDP port number * @up: the 802.1p user priority bitmap * * Returns : 0 on success or 1 on error */ static u8 ixgbe_dcbnl_setapp(struct net_device *netdev, u8 idtype, u16 id, u8 up) { struct ixgbe_adapter *adapter = netdev_priv(netdev); u8 rval = 1; struct dcb_app app = { .selector = idtype, .protocol = id, .priority = up }; if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) return rval; rval = dcb_setapp(netdev, &app); switch (idtype) { case DCB_APP_IDTYPE_ETHTYPE: #ifdef IXGBE_FCOE if (id == ETH_P_FCOE) { u8 old_tc; /* Get current programmed tc */ old_tc = adapter->fcoe.tc; rval = ixgbe_fcoe_setapp(adapter, up); if (rval || !(adapter->flags & IXGBE_FLAG_DCB_ENABLED) || !(adapter->flags & IXGBE_FLAG_FCOE_ENABLED)) break; /* The FCoE application priority may be changed multiple * times in quick succession with switches that build up * TLVs. To avoid creating uneeded device resets this * checks the actual HW configuration and clears * BIT_APP_UPCHG if a HW configuration change is not * need */ if (old_tc == adapter->fcoe.tc) adapter->dcb_set_bitmap &= ~BIT_APP_UPCHG; else adapter->dcb_set_bitmap |= BIT_APP_UPCHG; } #endif break; case DCB_APP_IDTYPE_PORTNUM: break; default: break; } return rval; }