Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Extracting CQI values in PDCP Layer

86 views
Skip to first unread message

Maria Eduarda Veras Martins

unread,
Aug 22, 2024, 10:56:59 PM8/22/24
to 5G-LENA-users
Hello everyone,

I have a question regarding the extraction of Channel Quality Indicator (CQI) values. Is there an easier way to obtain the CQI values directly at the PDCP layer, or do I need to pass the values from the PHY layer up to the PDCP layer manually?

Thank you for your help!

Best regards,
Maria Eduarda.

Kent Huns

unread,
Aug 23, 2024, 1:52:02 PM8/23/24
to Maria Eduarda Veras Martins, 5G-LENA-users
Hi, Maria

As you might know, PDCP layer doesn't exist in 5G-LENA and it works on ns-3(src/lte/model/lte-pdcp.cc).
Are you trying to reference the variable of 5G-LENA from ns-3?

Anyway, the timing after gNB receives CQI-feedback (and before starts MAC scheduling) is below.
Only when "ctrlMsgs" is a list of "MessageType:DL_DCI", "msg->GetDlCqi()" is the feedbacked CQI value . 

nr-gnb-phy.cc
void
NrGnbPhy::RetrievePrepareEncodeCtrlMsgs()
{
    auto ctrlMsgs = PopCurrentSlotCtrlMsgs();
    ctrlMsgs.merge(RetrieveMsgsFromDCIs(m_currentSlot));

    if (m_netDevice != nullptr)
    {
        DynamicCast<NrGnbNetDevice>(m_netDevice)->RouteOutgoingCtrlMsgs(ctrlMsgs, GetBwpId());
    }
    else
    {
        // No netDevice (that could happen in tests) so just redirect them to us
        for (const auto& msg : ctrlMsgs)
        {
            EncodeCtrlMsg(msg);
        }
    }
}

I'll recommend checking the following 2 files.
nr-ue-phy.cc
Ptr<NrDlCqiMessage>
NrUePhy::CreateDlCqiFeedbackMessage(const SpectrumValue& sinr)
{
    NS_LOG_FUNCTION(this);
    // Create DL CQI CTRL message
    Ptr<NrDlCqiMessage> msg = Create<NrDlCqiMessage>();
    msg->SetSourceBwp(GetBwpId());
    DlCqiInfo dlcqi;

    dlcqi.m_rnti = m_rnti;
    dlcqi.m_cqiType = DlCqiInfo::WB;

    std::vector<int> cqi;
    dlcqi.m_wbCqi = ComputeCqi(sinr);
    msg->SetDlCqi(dlcqi);
    return msg;
}
nr-control-messages.cc
NrControlMessage::messageType
NrControlMessage::GetMessageType() const
{
    return m_messageType;
}

void
NrDlCqiMessage::SetDlCqi(DlCqiInfo cqi)
{
    m_cqi = cqi;
}

DlCqiInfo
NrDlCqiMessage::GetDlCqi()
{
    return m_cqi;
}

Best regards,
Kent

--
You received this message because you are subscribed to the Google Groups "5G-LENA-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to 5g-lena-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/5g-lena-users/d2124946-ff00-4563-a31a-f1e5cd67e3fen%40googlegroups.com.

Kent Huns

unread,
Aug 23, 2024, 1:59:18 PM8/23/24
to Maria Eduarda Veras Martins, 5G-LENA-users
Sorry for typo 
>> "MessageType:DL_DCI"  →  "MessageType:DL_CQI"

Kent Huns

unread,
Aug 29, 2024, 7:19:16 AM8/29/24
to 5G-LENA-users
Hi, Maria

Thank you for response. This topic is very grateful for my training.

First, ccmMacSapUser and SR(scheduling request of uplink) is not so important now.
This process always occurs before CQI feedback(PUSCH), but SR doesn't reach RLC layer. 

>> Should I pass the CQI values through LteMacSapUser, especially considering the RLC is LTE?
I think that's a good idea. 
m_dlCqiReceived you found can be referred in below function.
 If CQI value could be added in rxParams, it should be reported to RLC layer.

nr-gnb-mac.cc
void
NrGnbMac::DoReceivePhyPdu(Ptr<Packet> p)
{
    LteRadioBearerTag tag;
    p->RemovePacketTag(tag);
......
    LteMacSapUser::ReceivePduParameters rxParams;
    rxParams.p = p;
    rxParams.lcid = macHeader.GetLcId();
    rxParams.rnti = rnti;

    if (rxParams.p->GetSize())
    {
        (*lcidIt).second->ReceivePdu(rxParams);
    }
}
src/model/lte-rlc.cc
void
LteRlcSpecificLteMacSapUser::ReceivePdu(LteMacSapUser::ReceivePduParameters params)
{
    m_rlc->DoReceivePdu(params);
}

src/model/lte-rlc-am.cc  (or  lte-rlc-um.cc)
void
LteRlcAm::DoReceivePdu(LteMacSapUser::ReceivePduParameters rxPduParams)
{
    NS_LOG_FUNCTION(this << m_rnti << (uint32_t)m_lcid << rxPduParams.p->GetSize());

    // Get RLC header parameters
    LteRlcAmHeader rlcAmHeader;
    rxPduParams.p->PeekHeader(rlcAmHeader);
    NS_LOG_LOGIC("RLC header: " << rlcAmHeader);

    // Receiver timestamp
    Time delay;
    RlcTag rlcTag;

    bool ret = rxPduParams.p->FindFirstMatchingByteTag(rlcTag);
    NS_ASSERT_MSG(ret, "RlcTag not found in RLC Header. The packet went into a real network?");

    delay = Simulator::Now() - rlcTag.GetSenderTimestamp();

    m_rxPdu(m_rnti, m_lcid, rxPduParams.p->GetSize(), delay.GetNanoSeconds());

    if (rlcAmHeader.IsDataPdu())
    {

On Thu, Aug 29, 2024 at 2:36 AM Maria Eduarda Veras Martins <me...@cin.ufpe.br> wrote:
Hi Kent,
Thank you for the explanation regarding CQI extraction.

After examining the code snippets you provided and locating the CQI values in the gNB MAC, I wanted to inquire about the best practice for passing these CQI values. Should I pass the CQI values through LteMacSapUser, especially considering the RLC is LTE? The screenshot I attached highlights where I found the CQI values in the gNB MAC.

Additionally, I found references to ccmMacSapUser in the code, but I'm not entirely clear on its significance for this particular aspect. Could you please clarify if the ccmMacSapUser is important for this process?

I appreciate your assistance and further clarification on this matter.

Maria Eduarda Veras Martins

unread,
Sep 11, 2024, 8:53:55 AM9/11/24
to Kent Huns, 5G-LENA-users
Dear Kent,

I hope this message finds you well. I wanted to follow up on your suggestion regarding using the m_dlCqiReceived. I tried implementing it, but I noticed that it always has a size of zero. 

Do you have any insights or advice on how to properly utilize this function or can you recommend an alternative approach?

Thank you for your assistance.

Best regards,
Maria.

Screenshot from 2024-09-11 09-47-10.png
Screenshot from 2024-09-11 09-47-41.png

Kent Huns

unread,
Sep 12, 2024, 8:28:35 AM9/12/24
to 5G-LENA-users
Hi Maria,

I don't know all the details but you can see m_dlCqiReceived is erased in the same NrGnbMac.
It is the original usage of m_dlCqiReceived, and it may be null at the time you refer to it.
I guess dlCqiInfoReq.m_cqiList is also available, or you could define a private variable and Set/Get functions to store the value of m_dlCqiReceived.

By the way, is it equal that the period when UE sends CQI feedback to gNB=DU and the period when DU(MAC) sends UL signal to CU(PDCP)?
I wonder whether CQI value should be sent as averaged value or the latest instantaneous value, and what effect will it have.

void
NrGnbMac::DoSlotDlIndication(const SfnSf& sfnSf, LteNrTddSlotType type)
{
    NS_LOG_FUNCTION(this);
    NS_LOG_LOGIC("Perform things on DL, slot on the air: " << sfnSf);

    // --- DOWNLINK ---
    // Send Dl-CQI info to the scheduler    if(m_dlCqiReceived.size () > 0)
    {
        NrMacSchedSapProvider::SchedDlCqiInfoReqParameters dlCqiInfoReq;
        dlCqiInfoReq.m_sfnsf = sfnSf;

        dlCqiInfoReq.m_cqiList.insert(dlCqiInfoReq.m_cqiList.begin(),
                                      m_dlCqiReceived.begin(),
                                      m_dlCqiReceived.end());
        m_dlCqiReceived.erase(m_dlCqiReceived.begin(), m_dlCqiReceived.end());

        m_macSchedSapProvider->SchedDlCqiInfoReq(dlCqiInfoReq);

        for (const auto& v : dlCqiInfoReq.m_cqiList)
        {
            Ptr<NrDlCqiMessage> msg = Create<NrDlCqiMessage>();
            msg->SetDlCqi(v);
            m_macRxedCtrlMsgsTrace(m_currentSlot, GetCellId(), v.m_rnti, GetBwpId(), msg);
        }
    }
Reply all
Reply to author
Forward
0 new messages