9#include "nr-simple-ue-component-carrier-manager.h"
16NS_LOG_COMPONENT_DEFINE(
"NrSimpleUeComponentCarrierManager");
18NS_OBJECT_ENSURE_REGISTERED(NrSimpleUeComponentCarrierManager);
29class NrSimpleUeCcmMacSapProvider :
public NrMacSapProvider
37 NrSimpleUeCcmMacSapProvider(NrSimpleUeComponentCarrierManager* mac);
40 void TransmitPdu(NrMacSapProvider::TransmitPduParameters params)
override;
41 void BufferStatusReport(NrMacSapProvider::BufferStatusReportParameters params)
override;
44 NrSimpleUeComponentCarrierManager* m_mac;
47NrSimpleUeCcmMacSapProvider::NrSimpleUeCcmMacSapProvider(NrSimpleUeComponentCarrierManager* mac)
53NrSimpleUeCcmMacSapProvider::TransmitPdu(TransmitPduParameters params)
55 m_mac->DoTransmitPdu(params);
59NrSimpleUeCcmMacSapProvider::BufferStatusReport(BufferStatusReportParameters params)
61 m_mac->DoTransmitBufferStatusReport(params);
69class NrSimpleUeCcmMacSapUser :
public NrMacSapUser
77 NrSimpleUeCcmMacSapUser(NrSimpleUeComponentCarrierManager* mac);
80 void NotifyTxOpportunity(NrMacSapUser::TxOpportunityParameters txOpParams)
override;
81 void ReceivePdu(NrMacSapUser::ReceivePduParameters rxPduParams)
override;
82 void NotifyHarqDeliveryFailure()
override;
85 NrSimpleUeComponentCarrierManager* m_mac;
88NrSimpleUeCcmMacSapUser::NrSimpleUeCcmMacSapUser(NrSimpleUeComponentCarrierManager* mac)
94NrSimpleUeCcmMacSapUser::NotifyTxOpportunity(NrMacSapUser::TxOpportunityParameters txOpParams)
96 NS_LOG_INFO(
"NrSimpleUeCcmMacSapUser::NotifyTxOpportunity for ccId:"
97 << (uint32_t)txOpParams.componentCarrierId);
98 m_mac->DoNotifyTxOpportunity(txOpParams);
102NrSimpleUeCcmMacSapUser::ReceivePdu(NrMacSapUser::ReceivePduParameters rxPduParams)
104 m_mac->DoReceivePdu(rxPduParams);
108NrSimpleUeCcmMacSapUser::NotifyHarqDeliveryFailure()
110 m_mac->DoNotifyHarqDeliveryFailure();
117NrSimpleUeComponentCarrierManager::NrSimpleUeComponentCarrierManager()
119 NS_LOG_FUNCTION(
this);
121 m_ccmMacSapUser =
new NrSimpleUeCcmMacSapUser(
this);
122 m_ccmMacSapProvider =
new NrSimpleUeCcmMacSapProvider(
this);
125NrSimpleUeComponentCarrierManager::~NrSimpleUeComponentCarrierManager()
127 NS_LOG_FUNCTION(
this);
131NrSimpleUeComponentCarrierManager::DoDispose()
133 NS_LOG_FUNCTION(
this);
134 delete m_ccmRrcSapProvider;
135 delete m_ccmMacSapUser;
136 delete m_ccmMacSapProvider;
140NrSimpleUeComponentCarrierManager::GetTypeId()
142 static TypeId tid = TypeId(
"ns3::NrSimpleUeComponentCarrierManager")
150NrSimpleUeComponentCarrierManager::GetNrMacSapProvider()
152 NS_LOG_FUNCTION(
this);
153 return m_ccmMacSapProvider;
157NrSimpleUeComponentCarrierManager::DoInitialize()
159 NS_LOG_FUNCTION(
this);
160 NrUeComponentCarrierManager::DoInitialize();
166 NS_LOG_FUNCTION(
this << rnti << (uint16_t)measResults.
measId);
172 NS_LOG_FUNCTION(
this);
174 NS_ABORT_MSG_IF(it == m_macSapProvidersMap.end(),
175 "could not find Sap for NrComponentCarrier "
178 it->second->TransmitPdu(params);
182NrSimpleUeComponentCarrierManager::DoTransmitBufferStatusReport(
185 NS_LOG_FUNCTION(
this);
186 NS_LOG_DEBUG(
"BSR from RLC for LCID = " << (uint16_t)params.
lcid);
187 auto it = m_macSapProvidersMap.find(0);
188 NS_ABORT_MSG_IF(it == m_macSapProvidersMap.end(),
"could not find Sap for NrComponentCarrier");
190 NS_LOG_DEBUG(
"Size of component carrier LC map " << m_componentCarrierLcMap.size());
192 for (
auto ccLcMapIt = m_componentCarrierLcMap.begin();
193 ccLcMapIt != m_componentCarrierLcMap.end();
196 NS_LOG_DEBUG(
"BSR from RLC for CC id = " << (uint16_t)ccLcMapIt->first);
197 auto it = ccLcMapIt->second.find(params.
lcid);
198 if (it != ccLcMapIt->second.end())
200 it->second->BufferStatusReport(params);
206NrSimpleUeComponentCarrierManager::DoNotifyHarqDeliveryFailure()
208 NS_LOG_FUNCTION(
this);
212NrSimpleUeComponentCarrierManager::DoNotifyTxOpportunity(
215 NS_LOG_FUNCTION(
this);
216 auto lcidIt = m_lcAttached.find(txOpParams.
lcid);
217 NS_ABORT_MSG_IF(lcidIt == m_lcAttached.end(),
218 "could not find LCID" << (uint16_t)txOpParams.
lcid);
219 NS_LOG_DEBUG(
this <<
" lcid = " << (uint32_t)txOpParams.
lcid
220 <<
" layer= " << (uint16_t)txOpParams.
layer <<
" componentCarrierId "
223 NS_LOG_DEBUG(
this <<
" MAC is asking component carrier id = "
225 <<
" with lcid = " << (uint32_t)txOpParams.
lcid <<
" to transmit "
226 << txOpParams.
bytes <<
" bytes");
227 (*lcidIt).second->NotifyTxOpportunity(txOpParams);
233 NS_LOG_FUNCTION(
this);
234 auto lcidIt = m_lcAttached.find(rxPduParams.
lcid);
235 NS_ABORT_MSG_IF(lcidIt == m_lcAttached.end(),
236 "could not find LCID" << (uint16_t)rxPduParams.
lcid);
237 if (lcidIt != m_lcAttached.end())
239 (*lcidIt).second->ReceivePdu(rxPduParams);
247NrSimpleUeComponentCarrierManager::DoRemoveLc(uint8_t lcid)
249 NS_LOG_FUNCTION(
this <<
" lcId" << lcid);
250 std::vector<uint16_t> res;
251 NS_ABORT_MSG_IF(m_lcAttached.find(lcid) == m_lcAttached.end(),
"could not find LCID " << lcid);
252 m_lcAttached.erase(lcid);
255 auto it = m_componentCarrierLcMap.begin();
256 while (it != m_componentCarrierLcMap.end())
258 auto lcToRemove = it->second.find(lcid);
259 if (lcToRemove != it->second.end())
261 res.insert(res.end(), it->first);
263 it->second.erase(lcToRemove);
266 NS_ABORT_MSG_IF(res.empty(),
267 "LCID " << lcid <<
" not found in the ComponentCarrierManager map");
273NrSimpleUeComponentCarrierManager::DoReset()
275 NS_LOG_FUNCTION(
this);
277 auto it = m_lcAttached.begin();
278 while (it != m_lcAttached.end())
288 m_lcAttached.erase(it++);
293std::vector<NrUeCcmRrcSapProvider::LcsConfig>
294NrSimpleUeComponentCarrierManager::DoAddLc(uint8_t lcId,
298 NS_LOG_FUNCTION(
this);
299 std::vector<NrUeCcmRrcSapProvider::LcsConfig> res;
300 auto it = m_lcAttached.find(lcId);
301 NS_ABORT_MSG_IF(it != m_lcAttached.end(),
"Warning, LCID " << lcId <<
" already exist");
302 m_lcAttached.insert(std::pair<uint8_t, NrMacSapUser*>(lcId, msu));
304 for (uint8_t ncc = 0; ncc < m_noOfComponentCarriers; ncc++)
308 elem.
msu = m_ccmMacSapUser;
309 res.insert(res.end(), elem);
311 auto ccLcMapIt = m_componentCarrierLcMap.find(ncc);
312 if (ccLcMapIt != m_componentCarrierLcMap.end())
314 ccLcMapIt->second.insert(
315 std::pair<uint8_t, NrMacSapProvider*>(lcId, m_macSapProvidersMap.at(ncc)));
319 std::map<uint8_t, NrMacSapProvider*> empty;
320 auto ret = m_componentCarrierLcMap.insert(
321 std::pair<uint8_t, std::map<uint8_t, NrMacSapProvider*>>(ncc, empty));
322 NS_ABORT_MSG_IF(!ret.second,
323 "element already present, ComponentCarrierId already exist");
324 ccLcMapIt = m_componentCarrierLcMap.find(ncc);
325 ccLcMapIt->second.insert(
326 std::pair<uint8_t, NrMacSapProvider*>(lcId, m_macSapProvidersMap.at(ncc)));
334NrSimpleUeComponentCarrierManager::DoConfigureSignalBearer(
339 NS_LOG_FUNCTION(
this);
340 auto it = m_lcAttached.find(lcid);
343 NS_ABORT_MSG_IF(it != m_lcAttached.end(),
344 "Warning, LCID " << (uint8_t)lcid <<
" already exist");
346 m_lcAttached.insert(std::pair<uint8_t, NrMacSapUser*>(lcid, msu));
348 for (uint8_t ncc = 0; ncc < m_noOfComponentCarriers; ncc++)
350 auto ccLcMapIt = m_componentCarrierLcMap.find(ncc);
351 if (ccLcMapIt != m_componentCarrierLcMap.end())
353 ccLcMapIt->second.insert(
354 std::pair<uint8_t, NrMacSapProvider*>(lcid, m_macSapProvidersMap.at(ncc)));
358 std::map<uint8_t, NrMacSapProvider*> empty;
359 auto ret = m_componentCarrierLcMap.insert(
360 std::pair<uint8_t, std::map<uint8_t, NrMacSapProvider*>>(ncc, empty));
361 NS_ABORT_MSG_IF(!ret.second,
362 "element already present, ComponentCarrierId already existed");
363 ccLcMapIt = m_componentCarrierLcMap.find(ncc);
364 ccLcMapIt->second.insert(
365 std::pair<uint8_t, NrMacSapProvider*>(lcid, m_macSapProvidersMap.at(ncc)));
369 return m_ccmMacSapUser;
MemberNrUeCcmRrcSapProvider class.
Component carrier manager implementation which simply does nothing.
The abstract base class of a Component Carrier Manager* for UE that operates using the component carr...
uint8_t componentCarrierId
uint8_t componentCarrierId
NrUeCmacSapProvider::LogicalChannelConfig lcConfig
logical channel config
uint8_t componentCarrierId
component carrier ID
LogicalChannelConfig structure.