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,
|
||||
|
||||
@@ -28,8 +28,11 @@
|
||||
#define NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH 3
|
||||
#define NFAPI_MAX_NUM_RF_BANDS 16
|
||||
|
||||
#ifdef ENABLE_WLS
|
||||
#define NFAPI_MAX_PACKED_MESSAGE_SIZE 1024*1024*2
|
||||
#else
|
||||
#define NFAPI_MAX_PACKED_MESSAGE_SIZE 32768
|
||||
|
||||
#endif
|
||||
// The following definition control the size of arrays used in the interface.
|
||||
// These may be changed if desired. They are used in the encoder to make sure
|
||||
// that the user has not specified a 'count' larger than the max array, and also
|
||||
|
||||
@@ -6206,6 +6206,10 @@ bool peek_nr_nfapi_p7_sfn_slot(void *pMessageBuf, uint32_t messageBufLen, uint16
|
||||
#ifdef ENABLE_SOCKET
|
||||
// Socket transport will always use nFAPI encoding
|
||||
uint8_t *pReadPackedMessage = &((uint8_t *)pMessageBuf)[NFAPI_NR_P7_HEADER_LENGTH];
|
||||
#endif
|
||||
#ifdef ENABLE_WLS
|
||||
// WLS transport will always use FAPI encoding
|
||||
uint8_t *pReadPackedMessage = &((uint8_t *)pMessageBuf)[NFAPI_HEADER_LENGTH];
|
||||
#endif
|
||||
uint8_t *end = (uint8_t*)pMessageBuf + messageBufLen;
|
||||
if(!(pull16(&pReadPackedMessage, SFN, end) && pull16(&pReadPackedMessage, Slot, end))) {
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "nfapi_pnf_interface.h"
|
||||
|
||||
#define NFAPI_MAX_PACKED_MESSAGE_SIZE 32768
|
||||
|
||||
struct pnf_t {
|
||||
|
||||
@@ -46,5 +45,15 @@ int pnf_send_message(pnf_t* pnf, uint8_t* msg, uint32_t msg_len, uint16_t stream
|
||||
|
||||
nfapi_pnf_phy_config_t* nfapi_pnf_phy_config_find(nfapi_pnf_config_t* config, uint16_t phy_id);
|
||||
|
||||
void pnf_nr_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen);
|
||||
void pnf_nr_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen);
|
||||
void pnf_nr_handle_pnf_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen);
|
||||
void pnf_handle_pnf_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen);
|
||||
void pnf_nr_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen);
|
||||
void pnf_nr_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen);
|
||||
void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen);
|
||||
void pnf_nr_handle_stop_request(pnf_t* pnf, void* pRecvMsg, int recvMsgLen);
|
||||
|
||||
|
||||
#endif // _PNF_H_
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "nfapi_pnf_interface.h"
|
||||
|
||||
#define NFAPI_MAX_PACKED_MESSAGE_SIZE 32768
|
||||
|
||||
typedef struct {
|
||||
uint16_t dl_conf_ontime;
|
||||
|
||||
@@ -49,7 +49,9 @@
|
||||
|
||||
#include "NR_MIB.h"
|
||||
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||
|
||||
#ifdef ENABLE_WLS
|
||||
#include "wls_integration/include/wls_pnf.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define MAX_SCTP_STREAMS 16
|
||||
|
||||
@@ -281,10 +281,9 @@ int main(int argc, char *argv[])
|
||||
printf("\n");
|
||||
AssertFatal(byte_count >= sizeof(fapi_message_header_t), "Read byte amount not enough to encode the header. Should have a minimum of %lu bytes, aborting...", sizeof(fapi_message_header_t));
|
||||
uint8_t *ptr = hex_values; // Points to the first element of the array
|
||||
uint8_t **msg_ptr = &ptr; // Pointer to the pointer
|
||||
|
||||
fapi_message_header_t hdr = {.num_msg = 0, .opaque_handle = 0, .message_id = 0, .message_length = 0};
|
||||
fapi_nr_message_header_unpack(msg_ptr, NFAPI_HEADER_LENGTH, &hdr, sizeof(fapi_message_header_t), 0);
|
||||
fapi_nr_message_header_unpack(ptr, NFAPI_HEADER_LENGTH, &hdr, sizeof(fapi_message_header_t), 0);
|
||||
|
||||
printf("Decoded message %s message length 0x%02x\n", message_id_to_str(hdr.message_id), hdr.message_length);
|
||||
// Unpack the message
|
||||
|
||||
@@ -33,7 +33,6 @@ extern "C" {
|
||||
typedef struct vnf_t vnf_t;
|
||||
typedef struct vnf_p7_t vnf_p7_t;
|
||||
|
||||
#define NFAPI_MAX_PACKED_MESSAGE_SIZE 32768
|
||||
|
||||
/*! The nfapi VNF phy configuration information
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user