Section: 5.4.3.1 Logical channel prioritization
Content: The Logical Channel Prioritization procedure is applied when a new transmission is performed. RRC controls the scheduling of uplink data by signalling for each logical channel: priority where an increasing priority value indicates a lower priority level, prioritisedBitRate which sets the Prioritized Bit Rate (PBR), bucketSizeDuration which sets the Bucket Size Duration (BSD), and optionally allowedTTI-Lengths which sets the allowed TTI lengths. For NB-IoT, prioritisedBitRate, bucketSizeDuration and the corresponding steps of the Logical Channel Prioritisation procedure (i.e., Step 1 and Step 2 below) are not applicable. The MAC entity shall maintain a variable Bj for each logical channel j. Bj shall be initialized to zero when the related logical channel is established, and incremented by the product PBR × TTI duration for each TTI, where PBR is Prioritized Bit Rate of logical channel j. However, the value of Bj can never exceed the bucket size and if the value of Bj is larger than the bucket size of logical channel j, it shall be set to the bucket size. The bucket size of a logical channel is equal to PBR × BSD, where PBR and BSD are configured by upper layers. Before the successful completion of the contention based Random Access procedure initiated for DAPS handover, the target MAC entity shall not select the logical channel(s) corresponding to non-DAPS DRB(s) for the uplink grant received in a Random Access Response. The source MAC entity shall select only the logical channel(s) corresponding to DAPS DRB(s) during DAPS handover. The MAC entity shall perform the following Logical Channel Prioritization procedure when a new transmission is performed on an UL grant with a certain TTI length: - The MAC entity shall allocate resources to the logical channels that are allowed to transmit using the TTI length of the grant, in the following steps: - Step 1: All the allowed logical channels with Bj > 0 are allocated resources in a decreasing priority order. If the PBR of a logical channel is set to "infinity", the MAC entity shall allocate resources for all the data that is available for transmission on the logical channel before meeting the PBR of the lower priority logical channel(s); - Step 2: the MAC entity shall decrement Bj by the total size of MAC SDUs served to logical channel j in Step 1; NOTE 1: The value of Bj can be negative. - Step 3: if any resources remain, all the allowed logical channels are served in a strict decreasing priority order (regardless of the value of Bj) until either the data for that logical channel or the UL grant is exhausted, whichever comes first. Logical channels configured with equal priority should be served equally. - The UE shall also follow the rules below during the scheduling procedures above: - the UE should not segment an RLC SDU (or partially transmitted SDU or retransmitted RLC PDU) if the whole SDU (or partially transmitted SDU or retransmitted RLC PDU) fits into the remaining resources of the associated MAC entity; - if the UE segments an RLC SDU from the logical channel, it shall maximize the size of the segment to fill the grant of the associated MAC entity as much as possible; - the UE should maximise the transmission of data. - if the MAC entity is given an UL grant size that is equal to or larger than 4 bytes while having data available for transmission, the MAC entity shall not transmit only padding BSR and/or padding (unless the UL grant size is less than 7 bytes and an AMD PDU segment needs to be transmitted); - for transmissions on serving cells operating according to Frame Structure Type 3, the MAC entity shall only consider logical channels for which laa-UL-Allowed has been configured; - if a logical channel has been configured with lch-CellRestriction and if PDCP duplication within the same MAC entity (i.e. CA duplication) is activated, for this logical channel the MAC entity shall consider the cells indicated by lch-CellRestriction to be restricted for transmission. - the MAC entity shall map the logical channel configured with allowedHARQ-mode to the HARQ process with corresponding UL HARQ mode for transmission. - for NB-IoT UEs, BL UEs or UEs in enhanced coverage, if edt-SmallTBS-Enabled is set to TRUE for the corresponding PRACH resource, the UE shall choose a TB size among the set of possible TB sizes as described in clauses 8.6.2 and 16.3.3 of TS 36.213[ Evolved Universal Terrestrial Radio Access (E-UTRA); Physical layer procedures ]  [2] The MAC entity shall not transmit data for a logical channel corresponding to a radio bearer that is suspended (the conditions for when a radio bearer is considered suspended are defined in TS 36.331[ Evolved Universal Terrestrial Radio Access (E-UTRA); Radio Resource Control (RRC); Protocol specification ]  [8]). If the MAC PDU includes only the MAC CE for padding BSR or periodic BSR with zero MAC SDUs and there is no aperiodic CSI requested for this TTI, as specified in TS 36.213[ Evolved Universal Terrestrial Radio Access (E-UTRA); Physical layer procedures ]  [2], the MAC entity shall not generate a MAC PDU for the HARQ entity in the following cases: - in case the MAC entity is configured with skipUplinkTxDynamic and the grant indicated to the HARQ entity was addressed to a C-RNTI; or - in case the MAC entity is configured with skipUplinkTxSPS and the grant indicated to the HARQ entity is a configured uplink grant activated by the MAC entity's Semi-Persistent Scheduling C-RNTI or by the MAC entity's UL Semi-Persistent Scheduling V-RNTI; or - in case the grant indicated to the HARQ entity is a configured uplink grant activated by the MAC entity's AUL C-RNTI; or - in case the grant indicated to the HARQ entity is a preconfigured uplink grant. NOTE 1a: If at least one MAC PDU is to be generated for the HARQ entity for this TTI, the MAC entity generates MAC PDUs corresponding to all UL grants indicated to the HARQ entity for this TTI. For the Logical Channel Prioritization procedure, the MAC entity shall take into account the following relative priority in decreasing order: - MAC control element for C-RNTI or data from UL-CCCH; - MAC control element for DPR; - MAC control element for SPS confirmation; - MAC control element for AUL confirmation; - MAC control element for Timing Advance Report; - MAC control element for GNSS Validity Duration Report; - MAC control element for BSR, with exception of BSR included for padding; - MAC control element for PHR, Extended PHR, or Dual Connectivity PHR; - MAC control element for Sidelink BSR, with exception of Sidelink BSR included for padding; - MAC control element for DCQR and AS RAI, with exception of when DCQR is to be included in Msg3; - data from any Logical Channel, except data from UL-CCCH; - MAC control element for DCQR and AS RAI, when DCQR is to be included in Msg3; - MAC control element for Recommended bit rate query; - MAC control element for BSR included for padding; - MAC control element for Sidelink BSR included for padding. When AS RAI has been triggered, DCQR and AS RAI MAC control element shall have higher priority than data from any Logical Channel, except data from UL-CCCH, only if after logical channel prioritization including AS RAI in the resulting MAC PDU does not require segmenting RLC SDU. Otherwise data from any Logical Channel shall have higher priority than DCQR and AS RAI MAC control element. NOTE 2: When the MAC entity is requested to transmit multiple MAC PDUs in one TTI, steps 1 to 3 and the associated rules may be applied either to each grant independently or to the sum of the capacities of the grants. Also the order in which the grants are processed is left up to UE implementation. It is up to the UE implementation to decide in which MAC PDU a MAC control element is included when MAC entity is requested to transmit multiple MAC PDUs in one TTI. When the UE is requested to generate MAC PDU(s) in two MAC entities in one TTI, it is up to UE implementation in which order the grants are processed.