Implementation of PNF using WLS as message transport
The common library exposes functions for the PNF to return the received blocks to the VNF for it to call WLS_Enqueue on them. This is done in order to ensure the Blocks are returned after processing, also preventing the Dequeueing of blocks that are still being used, i.e. the internal value is not -1 All saved blocks are to be enqueued at the reception of a SLOT.indication by the VNF Additionally, the definition of NFAPI_MAX_PACKED_MESSAGE_SIZE was moved to nfapi_interface.h and removed from the other headers, this is done to allow to set the maximum message size when using WLS by only changing the value in one place Fixup fapi_nr_message_header_unpack call in nfapi_hex_parser
This commit is contained in:
@@ -23,4 +23,8 @@ if (OAI_AERIAL)
|
||||
target_compile_definitions(nr_fapi_p7 PRIVATE ENABLE_AERIAL)
|
||||
endif ()
|
||||
|
||||
target_compile_definitions(nr_fapi_common PRIVATE ENABLE_SOCKET)
|
||||
if(OAI_WLS)
|
||||
target_compile_definitions(nr_fapi_common PRIVATE ENABLE_WLS)
|
||||
else()
|
||||
target_compile_definitions(nr_fapi_common PRIVATE ENABLE_SOCKET)
|
||||
endif()
|
||||
|
||||
@@ -77,12 +77,34 @@ bool isFAPIMessageIDValid(uint16_t id);
|
||||
|
||||
int check_nr_fapi_unpack_length(nfapi_nr_phy_msg_type_e msgId, uint32_t unpackedBufLen);
|
||||
|
||||
int fapi_nr_message_header_unpack(void *pMessageBuf,
|
||||
/*! \brief Decodes a FAPI P5 message header
|
||||
* \param pMessageBuf A pointer to an encoded P5 message header
|
||||
* \param messageBufLen The size of the encoded P5 message header
|
||||
* \param pUnpackedBuf A pointer to the fapi_message_header
|
||||
* \param unpackedBufLen The size of fapi_message_header structure.
|
||||
* \param config A pointer to the nfapi configuration structure
|
||||
* \return true on success, false on failure.
|
||||
*
|
||||
* The function will decode a byte stream pointed to by pMessageBuf into a FAPI p5 header structure pointed to by pUnpackedBuf
|
||||
*/
|
||||
bool fapi_nr_message_header_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
nfapi_p4_p5_codec_config_t *config);
|
||||
int fapi_nr_p7_message_header_unpack(void *pMessageBuf,
|
||||
|
||||
/*! \brief Decodes a FAPI P7 message header
|
||||
* \param pMessageBuf A pointer to an encoded P5 message header
|
||||
* \param messageBufLen The size of the encoded P5 message header
|
||||
* \param pUnpackedBuf A pointer to the fapi_message_header
|
||||
* \param unpackedBufLen The size of fapi_message_header structure.
|
||||
* \param config A pointer to the nfapi configuration structure
|
||||
* \return true on success, false on failure.
|
||||
*
|
||||
* This function is a dummy function that points to fapi_nr_message_header_unpack,
|
||||
* since in FAPI there's no difference in the structure of the message headers for P5 and P7
|
||||
*/
|
||||
bool fapi_nr_p7_message_header_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
|
||||
@@ -30,7 +30,7 @@ int fapi_nr_p5_message_pack(void *pMessageBuf,
|
||||
uint32_t packedBufLen,
|
||||
nfapi_p4_p5_codec_config_t *config);
|
||||
|
||||
int fapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
bool fapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#define OPENAIRINTERFACE_NR_FAPI_P5_UTILS_H
|
||||
#include "stdio.h"
|
||||
#include "stdint.h"
|
||||
#include "nr_fapi.h"
|
||||
#include "nfapi/open-nFAPI/fapi/inc/nr_fapi.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
bool eq_param_request(const nfapi_nr_param_request_scf_t *unpacked_req, const nfapi_nr_param_request_scf_t *req);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
int fapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t *config);
|
||||
|
||||
int fapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
bool fapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#define OPENAIRINTERFACE_NR_FAPI_P7_UTILS_H
|
||||
#include "stdio.h"
|
||||
#include "stdint.h"
|
||||
#include "nr_fapi.h"
|
||||
#include "nfapi/open-nFAPI/fapi/inc/nr_fapi.h"
|
||||
|
||||
bool eq_dl_tti_request(const nfapi_nr_dl_tti_request_t *a, const nfapi_nr_dl_tti_request_t *b);
|
||||
bool eq_ul_tti_request(const nfapi_nr_ul_tti_request_t *a, const nfapi_nr_ul_tti_request_t *b);
|
||||
|
||||
@@ -54,7 +54,6 @@ bool isFAPIMessageIDValid(const uint16_t id)
|
||||
int check_nr_fapi_unpack_length(nfapi_nr_phy_msg_type_e msgId, uint32_t unpackedBufLen)
|
||||
{
|
||||
int retLen = 0;
|
||||
|
||||
// check for size of nFAPI struct without the nFAPI specific parameters
|
||||
switch (msgId) {
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST:
|
||||
@@ -165,7 +164,7 @@ int check_nr_fapi_unpack_length(nfapi_nr_phy_msg_type_e msgId, uint32_t unpacked
|
||||
return retLen;
|
||||
}
|
||||
|
||||
int fapi_nr_p7_message_header_unpack(void *pMessageBuf,
|
||||
bool fapi_nr_p7_message_header_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
@@ -178,7 +177,7 @@ int fapi_nr_p7_message_header_unpack(void *pMessageBuf,
|
||||
NULL);
|
||||
}
|
||||
|
||||
int fapi_nr_message_header_unpack(void *pMessageBuf,
|
||||
bool fapi_nr_message_header_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
@@ -190,12 +189,12 @@ int fapi_nr_message_header_unpack(void *pMessageBuf,
|
||||
|
||||
if (pMessageBuf == NULL || pUnpackedBuf == NULL || messageBufLen < NFAPI_HEADER_LENGTH
|
||||
|| unpackedBufLen < sizeof(fapi_message_header_t)) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
uint8_t *end = pMessageBuf + messageBufLen;
|
||||
// process the header
|
||||
int result =
|
||||
(pull8(&pReadPackedMessage, &fapi_msg.num_msg, end) && pull8(&pReadPackedMessage, &fapi_msg.opaque_handle, end)
|
||||
&& pull16(&pReadPackedMessage, &header->message_id, end) && pull32(&pReadPackedMessage, &header->message_length, end));
|
||||
return (result);
|
||||
return result != 0;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ int fapi_nr_p5_message_pack(void *pMessageBuf,
|
||||
return packedMsgLen;
|
||||
}
|
||||
|
||||
int fapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
bool fapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
const uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
const uint32_t unpackedBufLen,
|
||||
@@ -143,10 +143,9 @@ int fapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
unpackedBufLen);
|
||||
// clean the supplied buffer for - tag value blanking
|
||||
(void)memset(pUnpackedBuf, 0, unpackedBufLen);
|
||||
if (fapi_nr_message_header_unpack(pMessageBuf, NFAPI_HEADER_LENGTH, pMessageHeader, sizeof(fapi_message_header_t), 0)
|
||||
< 0) {
|
||||
if (!fapi_nr_message_header_unpack(pMessageBuf, NFAPI_HEADER_LENGTH, pMessageHeader, sizeof(fapi_message_header_t), 0)) {
|
||||
// failed to read the header
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
uint8_t *pReadPackedMessage = pMessageBuf + NFAPI_HEADER_LENGTH;
|
||||
uint8_t *end = (uint8_t *)pMessageBuf + messageBufLen;
|
||||
@@ -154,14 +153,14 @@ int fapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
|
||||
if (check_nr_fapi_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0) {
|
||||
// the unpack buffer is not big enough for the struct
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
// look for the specific message
|
||||
switch (pMessageHeader->message_id) {
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST:
|
||||
// PARAM request has no body;
|
||||
result = 0;
|
||||
result = 1;
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE:
|
||||
@@ -209,7 +208,7 @@ int fapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
return result != 0;
|
||||
}
|
||||
|
||||
uint8_t pack_nr_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config)
|
||||
|
||||
@@ -134,7 +134,7 @@ int fapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packed
|
||||
return packedMsgLen;
|
||||
}
|
||||
|
||||
int fapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
bool fapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
@@ -150,9 +150,9 @@ int fapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
messageBufLen,
|
||||
unpackedBufLen);
|
||||
|
||||
if (fapi_nr_message_header_unpack(pMessageBuf, NFAPI_HEADER_LENGTH, &fapi_hdr, sizeof(fapi_message_header_t), 0) < 0) {
|
||||
if (!fapi_nr_message_header_unpack(pMessageBuf, NFAPI_HEADER_LENGTH, &fapi_hdr, sizeof(fapi_message_header_t), 0)) {
|
||||
// failed to read the header
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
uint8_t *pReadPackedMessage = pMessageBuf + NFAPI_HEADER_LENGTH;
|
||||
uint8_t *end = (uint8_t *)pMessageBuf + messageBufLen;
|
||||
@@ -160,7 +160,7 @@ int fapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
pMessageHeader->message_id = fapi_hdr.message_id;
|
||||
if ((uint8_t *)(pMessageBuf + pMessageHeader->message_length) > end) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n");
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
// look for the specific message
|
||||
@@ -231,9 +231,9 @@ int fapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
|
||||
if (result == 0) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Unpack failed to unpack message\n");
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint8_t pack_nr_tx_beamforming_pdu(const nfapi_nr_tx_precoding_and_beamforming_t *beamforming_pdu,
|
||||
|
||||
Reference in New Issue
Block a user