# [Intern] 26/08/2022 6th Task
###### tags: `BMW-Lab`, `Intern`
:::success
**Goal:** Understand what function is being called [MAC] and [NR_MAC] and the purpose of it.
:::
:::info
**Question List:**
1. Collect all the log that has [MAC] and [NR_MAC]. List all of them.
2. Trace what function is being called and the purpose of it (Task 3 and Task 4, for example, has the purpose of initializing connection with OAI CU on F1 interface).
:::
:::success
**References**
- [5G Wikipedia](https://wiki.patras5g.eu/radio-equipment/g-node-bs)
- [OpenAir2](https://gitlab.eurecom.fr/oai/openairinterface5g/-/tree/NR_SA_F1AP_5GRECORDS/openair2/LAYER2)
- [About MAC](http://5g-range.eu/wp-content/uploads/2018/05/D4.1_Cognitive_MAC_Reference_Architecture.pdf)
- [About NR_MAC](https://devopedia.org/5g-nr-mac)
:::
## Background

MAC layer provide services to the upper layers and it expects some services from the physical layer. Physical layer offers transport channels to MAC layer to support transport services for data transfer over radio interface. MAC layer offers logical channels to RLC sublayer. The logical channels exist between MAC and PHY where as transport channels exist between PHY and radio layer. Hence MAC is the interface between logical channels and PHY transport channels.

The MAC sublayer provides two main services to upper layers viz. data transfer and radio resource allocation. The other functions of 5G NR MAC are as follows.
• Mapping between logical and transport channels (Both Downlink and Uplink).
• Multiplexing of MAC SDUs onto TBs (Transport Blocks) (In Uplink), SDUs belong to logical channels and transport blocks belong to transport channels.
• Demultiplexing of MAC SDUs from TBs (In Downlink)
• Scheduling information reporting (In Uplink)
• Error correction through HARQ (In Downlink and Uplink)
• Logical Channel Prioritisation (In Uplink)
## Log list
MAC-RRC
MAC-RLC
MAC-PHY
MAC-SCHED
MAC-OAM
#### Functions
| Name | Description | Major primitives |
| --- | ------- | ------- |
| MAC-RRC | In this implementation, RRC is expected to be collocated in the same processing domain as the MAC. MAC provides an asynchronous functional interface to RRC | N/A it will be implemented as a class or set of classes, sharing public methods for data transfer.There are methods for cell configuration, UE configuration (e.g. create UE entity, delete UE entity, reconfigure UE entity), paging (PCCH) and common control channels (CCCH and BCCH message request) |
| MAC-RLC | RLC is expected to be collocated (same processor) and has multiple instances. MAC must provide a functional asynchronous interface to receive and send data with RLC | It will be implemented as a class or set of classes, allowing RLC instances to be registered and sharing public methods for data transfer. Some examples of methods from RLC to MAC are: reportBufferStatus, transmitRlcPdu Some examples of methods from MAC to RLC are: notifyTxOpportunity, receiveRlcPdu |
| MAC-PHY | It implements FAPI-like interfaces P5 and P7 –FAPI and nFAPI specifications v9.0.PHY and MAC are not co-located. They run in different processors. The message exchange is TLV based for both data (P7) and control (P5).| Some P5 examples are:PARAM.request, PARAM.response,CONFIG.request, DL_CONFIG.request,UL_CONFI.request.Some P7 examples are:SUBFRAME. indication, HARQ.indication,RX_CQI.indication,TX.request, RX_ULSCH.indication |
| MAC-SCHED | It is a FAPI like interface – LTE MAC Scheduler Interface Specification v1.11 | Some examples of CSched SAP are:CSCHED_CELL_CONFIG_REQ/CNF,CSCHED_UE_CONFIG_REQ/CNF,CSCHED_LC_CONFIG_REQ/CNF,CSCHED_CELL_CONFIG_UPDATE_IND,CSCHED_UE_CONFIG_UPDATE_IND.Some examples of Sched SAP are: SCHED_DL_TRIGGER_REQ/CNF, SCHED_UL_TRIGGER_REQ/CNF, SCHED_DL_RLC_BUFFER_REQ/CNF, SCHED_DL_MAC_BUFFER_REQ/CNF,SCHED_UL_CQI_INFO_REQ/CNF,SCHED_UL_SR_INFO_REQ/CNF |
| MAC-OAM | This interface allows external commands via TLV messages for OAM functions such as log, statistics,initialization, and access to TVWS database. | Some examples of TLV messages are: OAM_MAC_INIT_REQ/CNF, OAM_MAC_STATUS_REQ/CNF, OAM_MAC_LOG_ LEVEL_REQ/CNF,OAM_MAC_STATS_REQ/CNF,OAM_MAC_DBS_TVWS_REQ/CNF |