static u8 ixgbe_dcbnl_setapp(struct net_device *netdev, u8 idtype, u16 id, u8 up) { u8 rval = 1; switch (idtype) { case DCB_APP_IDTYPE_ETHTYPE: #ifdef IXGBE_FCOE if (id == ETH_P_FCOE) { u8 tc; struct ixgbe_adapter *adapter; adapter = netdev_priv(netdev); tc = adapter->fcoe.tc; rval = ixgbe_fcoe_setapp(adapter, up); if ((!rval) && (tc != adapter->fcoe.tc) && (adapter->flags & IXGBE_FLAG_DCB_ENABLED) && (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)) { adapter->dcb_set_bitmap |= BIT_APP_UPCHG; adapter->dcb_set_bitmap |= BIT_RESETLINK; } } #endif break; case DCB_APP_IDTYPE_PORTNUM: break; default: break; } return rval; }
/** * 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; }
/** * 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) { u8 rval = 1; switch (idtype) { case DCB_APP_IDTYPE_ETHTYPE: #ifdef IXGBE_FCOE if (id == ETH_P_FCOE) { u8 old_tc, reg_idx; struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_fcoe *fcoe = &adapter->fcoe; rval = ixgbe_fcoe_setapp(adapter, up); if (rval || !(adapter->flags & IXGBE_FLAG_DCB_ENABLED) || !(adapter->flags & IXGBE_FLAG_FCOE_ENABLED)) break; /* Get current programmed tc */ reg_idx = adapter->tx_ring[fcoe->tc]->reg_idx + 1; old_tc = ixgbe_dcb_txq_to_tc(adapter, reg_idx); /* The FCoE application priority may be changed multiple * times in quick sucession 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; }