From 0a796ebb6cbd55d18dbc57f96860ad43706e67d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Soares=20Silva?= Date: Thu, 11 Sep 2025 09:40:46 +0100 Subject: [PATCH 1/2] Fix ERROR.indication unpack function Fix an issue in which the unpacking is erroneously deemed unsuccessful even though it succeed in pulling all the bytes, this was due to not properly handling the return value of pull16 which is either 0 or 2, not 0 or 1. Check the results of push and pull operation with correct boolean operator. --- nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c | 27 +++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c b/nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c index a7cb729f6c..4bcc9b2a44 100644 --- a/nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c +++ b/nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c @@ -1866,22 +1866,23 @@ uint8_t unpack_nr_stop_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void uint8_t pack_nr_error_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) { nfapi_nr_error_indication_scf_t *pNfapiMsg = (nfapi_nr_error_indication_scf_t *)msg; - uint8_t retval = push16(pNfapiMsg->sfn, ppWritePackedMsg, end) != 0; - retval &= push16(pNfapiMsg->slot, ppWritePackedMsg, end) != 0; - retval &= push8(pNfapiMsg->message_id, ppWritePackedMsg, end); - retval &= push8(pNfapiMsg->error_code, ppWritePackedMsg, end); - - retval &= pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); - return retval; + if (push16(pNfapiMsg->sfn, ppWritePackedMsg, end) && push16(pNfapiMsg->slot, ppWritePackedMsg, end) + && push8(pNfapiMsg->message_id, ppWritePackedMsg, end) && push8(pNfapiMsg->error_code, ppWritePackedMsg, end) + && pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)) { + return 1; + } else { + return 0; + } } uint8_t unpack_nr_error_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) { nfapi_nr_error_indication_scf_t *pNfapiMsg = (nfapi_nr_error_indication_scf_t *)msg; - uint8_t retval = pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end); - retval &= pull16(ppReadPackedMsg, &pNfapiMsg->slot, end); - retval &= pull8(ppReadPackedMsg, &pNfapiMsg->message_id, end); - retval &= pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end); - retval &= unpack_nr_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)); - return retval; + if (pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end) && pull16(ppReadPackedMsg, &pNfapiMsg->slot, end) + && pull8(ppReadPackedMsg, &pNfapiMsg->message_id, end) && pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end) + && unpack_nr_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension))) { + return 1; + } else { + return 0; + } } From 6ff098e0bd56653759df060c81e812eb9fa341c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Soares=20Silva?= Date: Wed, 10 Sep 2025 16:20:12 +0100 Subject: [PATCH 2/2] Add Aerial-specific ERROR.indication codes This adds the expectable error codes from Aerial L1, as described in https://docs.nvidia.com/aerial/archive/aerial-sdk/23-3/text/cubb_release_notes/scf_fapi_support.html#additional-aerial-specific-error-codes-reported-in-error-indication-from-l1-to-l2 The errors are added in such a way that they're only visible when compiled with Aerial --- .../nfapi/public_inc/nfapi_nr_interface_scf.h | 43 ++++++++++++++----- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h index f186352b6d..fc45a620d2 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h @@ -707,18 +707,41 @@ typedef enum { NFAPI_NR_STOP_MSG_INVALID_STATE } nfapi_nr_stop_errors_e; -//3.3.5 PHY Notifications +// 3.3.5 PHY Notifications + +#define SCF_ERROR_LIST \ + X(NFAPI_NR_PHY_API_MSG_OK, 0x0) \ + X(NFAPI_NR_PHY_API_MSG_INVALID_STATE, 0x1) \ + X(NFAPI_NR_PHY_API_MSG_INVALID_CONFIG, 0x2) \ + X(NFAPI_NR_PHY_API_SFN_OUT_OF_SYNC, 0X3) \ + X(NFAPI_NR_PHY_API_MSG_SLOR_ERR, 0X4) \ + X(NFAPI_NR_PHY_API_MSG_BCH_MISSING, 0X5) \ + X(NFAPI_NR_PHY_API_MSG_INVALID_SFN, 0X6) \ + X(NFAPI_NR_PHY_API_MSG_UL_DCI_ERR, 0X7) \ + X(NFAPI_NR_PHY_API_MSG_TX_ERR, 0X8) + +#ifdef ENABLE_AERIAL +#define AERIAL_ERROR_LIST \ + X(AERIAL_ERROR_CODE_FAPI_END, 0x32) \ + X(AERIAL_ERROR_CODE_L1_PROC_OBJ_UNAVAILABLE_ERR, 0x33) \ + X(AERIAL_ERROR_CODE_MSG_LATE_SLOT_ERR, 0x34) \ + X(AERIAL_ERROR_CODE_PARTIAL_SRS_IND_ERR, 0x35) \ + X(AERIAL_ERROR_CODE_L1_DL_CPLANE_TX_ERROR, 0x36) \ + X(AERIAL_ERROR_CODE_L1_UL_CPLANE_TX_ERROR, 0x37) \ + X(AERIAL_ERROR_CODE_L1_DL_GPU_ERROR, 0x38) \ + X(AERIAL_ERROR_CODE_L1_DL_CPU_TASK_ERROR, 0x39) \ + X(AERIAL_ERROR_CODE_L1_UL_CPU_TASK_ERROR, 0x3A) \ + X(AERIAL_ERROR_CODE_L1_P1_EXIT_ERROR, 0x3B) \ + X(AERIAL_ERROR_CODE_L1_P2_EXIT_ERROR, 0x3C) \ + X(AERIAL_ERROR_CODE_L1_DL_CH_ERROR, 0x3D) \ + X(AERIAL_ERROR_CODE_L1_UL_CH_ERROR, 0x3E) +#else +#define AERIAL_ERROR_LIST +#endif #define NFAPI_PHY_ERROR_LIST \ -X(NFAPI_NR_PHY_API_MSG_OK ,0x0)\ -X(NFAPI_NR_PHY_API_MSG_INVALID_STATE ,0x1)\ -X(NFAPI_NR_PHY_API_MSG_INVALID_CONFIG ,0x2)\ -X(NFAPI_NR_PHY_API_SFN_OUT_OF_SYNC ,0X3)\ -X(NFAPI_NR_PHY_API_MSG_SLOR_ERR ,0X4)\ -X(NFAPI_NR_PHY_API_MSG_BCH_MISSING ,0X5)\ -X(NFAPI_NR_PHY_API_MSG_INVALID_SFN ,0X6)\ -X(NFAPI_NR_PHY_API_MSG_UL_DCI_ERR ,0X7)\ -X(NFAPI_NR_PHY_API_MSG_TX_ERR ,0X8) + SCF_ERROR_LIST \ + AERIAL_ERROR_LIST typedef enum { #define X(name, value) name = value,