nfapi: support SRS channel reports for 64 gNB antenna elements#268
Open
gabri94 wants to merge 2 commits into
Open
nfapi: support SRS channel reports for 64 gNB antenna elements#268gabri94 wants to merge 2 commits into
gabri94 wants to merge 2 commits into
Conversation
The SRS.indication report structs were dimensioned for 8 gNB antenna elements: channel_matrix held 272*2*8*4 bytes and the report TLV value carried 64 KiB. A massive-MIMO L1 (Aerial) reporting the normalized channel IQ matrix for 64 antenna elements needs up to 272 PRGs * 4 UE ports * 64 elements * 4 B = 272 KiB per report. Introduce NFAPI_NR_SRS_MAX_* dimensioning macros and size both channel_matrix and the report TLV value from them, so the two buffers stay consistent (the report TLV previously allowed more UE ports than channel_matrix could hold). Assisted-by: Claude Code:claude-fable-5
| uint8_t unpack_nr_srs_report_tlv_value(nfapi_srs_report_tlv_t *report_tlv, uint8_t **ppReadPackedMsg, uint8_t *end) | ||
| { | ||
| if ((report_tlv->length + 3) / 4 > sizeof(report_tlv->value) / sizeof(report_tlv->value[0])) { | ||
| return 0; |
Collaborator
There was a problem hiding this comment.
I think here a warning should be printed, informing that a report too big to be unpacked was received, maybe NFAPI_TRACE_DEBUG.
Collaborator
Author
There was a problem hiding this comment.
Done, but i used NFAPI_TRACE_ERROR rather than DEBUG, since it's quite a critical problem if it happens. Moreover all the other unpack failures for FAPI are treated as ERRORS.
With 64 gNB antenna elements the SRS channel IQ matrix exceeds the ranges the SRS report code path was written for (272 PRGs * 2 UE ports * 64 elements * 4 B = 136 KiB per report): - unpack_nr_srs_report_tlv_value(): last_idx was int16_t, which overflows at report lengths >= 128 KiB, so the copy loop never ran and the report was silently dropped. Widen to int32_t and reject reports larger than the value buffer instead of overrunning it. - pack/unpack_nr_srs_normalized_channel_iq_matrix(): channel_matrix_size was uint16_t and wraps at 64 KiB, truncating the matrix. Widen to uint32_t and bound it by sizeof(channel_matrix). - handle_nr_srs_measurements(): the SRS_IND_DEBUG print indexed the matrix with a uint16_t, which wraps for Nu*Ng*Np > 65535. Assisted-by: Claude Code:claude-fable-5
gabri94
commented
Jul 9, 2026
| // elements (Ng), 4 sampled UE SRS ports (Nu), 272 PRGs and 4-byte complex | ||
| // samples (iqSize). | ||
| #define NFAPI_NR_SRS_MAX_PRGS 272 | ||
| #define NFAPI_NR_SRS_MAX_GNB_ANTENNA_ELEMENTS 64 |
Collaborator
Author
There was a problem hiding this comment.
Do we want to make this a configuration parameter? or a compile-time definition? I feel that by always allocating 64AE we're wasting a lot of resources for all CAT-A users
Collaborator
|
CI Build: #777 | Failed on the following stages: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This MR is part of the reciprocity-based dynamic BF series and goes together with #156 and #267.
Additional MRs will follow with the FAPI changes to support Dynamic Beamforming, as well as adaptations to the scheduler.
Body
SRS-reciprocity workflows with Aerial mMIMO (Cat-B, 64-element arrays) return the
normalized channel IQ matrix over FAPI, but the SRS.indication structs and codec
were dimensioned for 8 gNB antenna elements. A 64-element report needs up to
272 PRGs × 4 UE ports × 64 elements × 4 B ≈ 272 KiB, which the current code
truncates or silently drops.
Changes
nfapi_nr_interface_scf.h): newNFAPI_NR_SRS_MAX_*macros size
channel_matrixand the SRS report TLVvalue[]for64 antenna elements / 4 UE SRS ports / 272 PRGs. The two buffers are now sized
consistently (previously the report TLV allowed more UE ports than
channel_matrixcould hold).report sizes:
unpack_nr_srs_report_tlv_value():last_idxwasint16_t, overflowing forreports ≥ 128 KiB so the copy loop never ran and the report was dropped.
Widened to
int32_t, and oversized reports are now rejected instead ofoverrunning the value buffer.
pack/unpack_nr_srs_normalized_channel_iq_matrix():channel_matrix_sizewas
uint16_t(wraps at 64 KiB). Widened touint32_tand bounded bysizeof(channel_matrix).handle_nr_srs_measurements(): theSRS_IND_DEBUGprint indexed the matrixwith a
uint16_t, which wraps for Nu·Ng·Np > 65535.