Merge remote-tracking branch 'origin/fapi-wls-integration' into integration_2025_w29 (!3346)
Add WLS as a transport option for VNF/PNF, refactor existing options This MR adds a new transport mechanism for the VNF and PNF split, using the Intel WLS library, which makes use of DPDK and shared memory to transport messages. This transport mechanism is what is used to interface with Radisys ODU, while also working with OAI VNF/PNF. The VNF and PNF have been refactored so that the transport-specific functions are isolated from the rest of the logic, and as such, interchangeable by means of function pointers. The same change is done for the packing/unpacking procedures, allowing to switch between FAPI and nFAPI encoding. This MR also reduces the amount of duplicated code, by refactoring the VNF with Aerial, which now only has the transport-relevant functions, as well as the ones that are unique to it ( for example, the unpacking procedures where a secondary data buffer is used for the message payloads ) Additionally a new callback is added to the VNF to process ERROR.indication messages, which currently only indicates which message originated the error, and which error occurred.
This commit is contained in:
@@ -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
|
||||
@@ -115,7 +118,8 @@ typedef struct {
|
||||
#define NFAPI_P7_GET_MORE(_mss) ( ((_mss) & 0x8000) >> 15 )
|
||||
#define NFAPI_P7_GET_SEGMENT(_mss) ( ((_mss) & 0x7F00) >> 8 )
|
||||
#define NFAPI_P7_GET_SEQUENCE(_mss) ( (_mss) & 0x00FF )
|
||||
#define NFAPI_P7_SET_MSS(_more, _segm, _sequ) ( (((_more) & 0x1) << 7) | (((_segm) & 0x7) << 4) | ((_sequ) & 0xF) )
|
||||
#define NFAPI_NR_P7_SET_MSS(_more, _segm, _sequ) ( (((_more) & 0x1) << 15) | (((_segm) & 0x7F) << 8) | ((_sequ) & 0xFF) )
|
||||
#define NFAPI_P7_SET_MSS(_more, _segm, _sequ) ( (((_more) & 0x1) << 7) | (((_segm) & 0x7F) << 4) | ((_sequ) & 0xF) )
|
||||
|
||||
#define NFAPI_TAG_LENGTH_PACKED_LEN 4
|
||||
|
||||
|
||||
@@ -110,11 +110,11 @@ uint8_t pack_nr_p5_message_body(nfapi_nr_p4_p5_message_header_t *header,
|
||||
* \param pUnpackedBuf A pointer to the nfapi_message_header
|
||||
* \param unpackedBufLen The size of nfapi_message_header structure.
|
||||
* \param config A pointer to the nfapi configuration structure
|
||||
* \return 10 ( size of the unpacked header ) on success, -1 on failure.
|
||||
* \return true on success, false on failure.
|
||||
*
|
||||
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p5 header structure pointed to by pUnpackedBuf
|
||||
*/
|
||||
int nfapi_nr_p5_message_header_unpack(void *pMessageBuf,
|
||||
bool nfapi_nr_p5_message_header_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
@@ -126,11 +126,11 @@ int nfapi_nr_p5_message_header_unpack(void *pMessageBuf,
|
||||
* \param pUnpackedBuf A pointer to the nfapi_message_header
|
||||
* \param unpackedBufLen The size of nfapi_message_header structure.
|
||||
* \param config A pointer to the nfapi configuration structure
|
||||
* \return != -1 means success, -1 means failure.
|
||||
* \return true on success, false on failure.
|
||||
*
|
||||
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p5 message structure pointer to by pUnpackedBuf
|
||||
*/
|
||||
int nfapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
bool nfapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
@@ -154,13 +154,13 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe
|
||||
* \param pUnpackedBuf A pointer to the nfapi_message_header
|
||||
* \param unpackedBufLen The size of nfapi_message_header structure.
|
||||
* \param config A pointer to the nfapi configuration structure
|
||||
* \return 0 means success, -1 means failure.
|
||||
* \return true on success, false on failure.
|
||||
*
|
||||
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi_p7_message_header structure pointer to by
|
||||
pUnpackedBuf
|
||||
|
||||
*/
|
||||
int nfapi_nr_p7_message_header_unpack(void *pMessageBuf,
|
||||
bool nfapi_nr_p7_message_header_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
@@ -172,11 +172,11 @@ int nfapi_nr_p7_message_header_unpack(void *pMessageBuf,
|
||||
* \param pUnpackedBuf A pointer to the nfapi_message_header
|
||||
* \param unpackedBufLen The size of nfapi_message_header structure.
|
||||
* \param config A pointer to the nfapi configuration structure
|
||||
* \return 0 means success, -1 means failure.
|
||||
* \return true on success, false failure.
|
||||
*
|
||||
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p7 message structure pointer to by pUnpackedBuf
|
||||
*/
|
||||
int nfapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
bool nfapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
|
||||
@@ -701,16 +701,22 @@ typedef enum {
|
||||
} nfapi_nr_stop_errors_e;
|
||||
|
||||
//3.3.5 PHY Notifications
|
||||
|
||||
#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)
|
||||
|
||||
typedef enum {
|
||||
NFAPI_NR_PHY_API_MSG_OK =0x0,
|
||||
NFAPI_NR_PHY_API_MSG_INVALID_STATE =0x1,
|
||||
NFAPI_NR_PHY_API_MSG_INVALID_CONFIG =0x2,
|
||||
NFAPI_NR_PHY_API_SFN_OUT_OF_SYNC =0X3,
|
||||
NFAPI_NR_PHY_API_MSG_SLOR_ERR =0X4,
|
||||
NFAPI_NR_PHY_API_MSG_BCH_MISSING =0X5,
|
||||
NFAPI_NR_PHY_API_MSG_INVALID_SFN =0X6,
|
||||
NFAPI_NR_PHY_API_MSG_UL_DCI_ERR =0X7,
|
||||
NFAPI_NR_PHY_API_MSG_TX_ERR =0X8
|
||||
#define X(name, value) name = value,
|
||||
NFAPI_PHY_ERROR_LIST
|
||||
#undef X
|
||||
} nfapi_nr_phy_notifications_errors_e;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -2325,7 +2325,7 @@ int nfapi_p5_message_header_unpack(void *pMessageBuf,
|
||||
return 8;
|
||||
}
|
||||
|
||||
int nfapi_nr_p5_message_header_unpack(void *pMessageBuf,
|
||||
bool nfapi_nr_p5_message_header_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
@@ -2336,25 +2336,25 @@ int nfapi_nr_p5_message_header_unpack(void *pMessageBuf,
|
||||
|
||||
if (pMessageBuf == NULL || pUnpackedBuf == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 header unpack supplied pointers are null\n");
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t *end = pMessageBuf + messageBufLen;
|
||||
|
||||
if (messageBufLen < NFAPI_NR_P5_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_nr_p4_p5_message_header_t)) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
// process the header
|
||||
if (!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && pull16(&pReadPackedMessage, &pMessageHeader->message_id, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->message_length, end)
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->spare, end))) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
return NFAPI_NR_P5_HEADER_LENGTH;
|
||||
return true;
|
||||
}
|
||||
|
||||
int nfapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
bool nfapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
@@ -2362,11 +2362,11 @@ int nfapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
{
|
||||
if (pMessageBuf == NULL || pUnpackedBuf == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 unpack supplied pointers are null\n");
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
if (messageBufLen < NFAPI_NR_P5_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_nr_p4_p5_message_header_t)) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P5 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
nfapi_nr_p4_p5_message_header_t *pMessageHeader = pUnpackedBuf;
|
||||
@@ -2374,7 +2374,7 @@ int nfapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
(void)memset(pUnpackedBuf, 0, unpackedBufLen);
|
||||
// process the header
|
||||
if (!nfapi_nr_p5_message_header_unpack(pMessageBuf, messageBufLen, pMessageHeader, unpackedBufLen, config)) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
uint8_t *pReadPackedMessage = pMessageBuf + NFAPI_NR_P5_HEADER_LENGTH;
|
||||
uint8_t *end = (uint8_t *)pMessageBuf + messageBufLen;
|
||||
@@ -2382,7 +2382,7 @@ int nfapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
|
||||
if (check_nr_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
|
||||
@@ -2476,7 +2476,7 @@ int nfapi_nr_p5_message_unpack(void *pMessageBuf,
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
return result == 1;
|
||||
}
|
||||
|
||||
int nfapi_p5_message_unpack(void *pMessageBuf,
|
||||
|
||||
@@ -5930,7 +5930,7 @@ int nfapi_p7_message_header_unpack(void *pMessageBuf,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nfapi_nr_p7_message_header_unpack(void *pMessageBuf,
|
||||
bool nfapi_nr_p7_message_header_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
@@ -5941,14 +5941,14 @@ int nfapi_nr_p7_message_header_unpack(void *pMessageBuf,
|
||||
|
||||
if (pMessageBuf == NULL || pUnpackedBuf == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied pointers are null\n");
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t *end = (uint8_t *)pMessageBuf + messageBufLen;
|
||||
|
||||
if (messageBufLen < NFAPI_NR_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_nr_p7_message_header_t)) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
// process the header
|
||||
if (!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && pull16(&pReadPackedMessage, &pMessageHeader->message_id, end)
|
||||
@@ -5956,9 +5956,9 @@ int nfapi_nr_p7_message_header_unpack(void *pMessageBuf,
|
||||
&& pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->checksum, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
|
||||
return -1;
|
||||
return false;
|
||||
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
int nfapi_p7_message_unpack(void *pMessageBuf,
|
||||
@@ -6203,7 +6203,14 @@ int nfapi_p7_message_unpack(void *pMessageBuf,
|
||||
|
||||
bool peek_nr_nfapi_p7_sfn_slot(void *pMessageBuf, uint32_t messageBufLen, uint16_t *SFN, uint16_t *Slot)
|
||||
{
|
||||
#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))) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to peek SFN.Slot\n");
|
||||
@@ -6213,7 +6220,7 @@ bool peek_nr_nfapi_p7_sfn_slot(void *pMessageBuf, uint32_t messageBufLen, uint16
|
||||
return true;
|
||||
}
|
||||
|
||||
int nfapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
bool nfapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
uint32_t messageBufLen,
|
||||
void *pUnpackedBuf,
|
||||
uint32_t unpackedBufLen,
|
||||
@@ -6225,14 +6232,14 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
|
||||
if (pMessageBuf == NULL || pUnpackedBuf == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n");
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t *end = (uint8_t *)pMessageBuf + messageBufLen;
|
||||
|
||||
if (messageBufLen < NFAPI_NR_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_nr_p7_message_header_t)) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
// process the header
|
||||
@@ -6242,11 +6249,11 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->checksum, end)
|
||||
&& pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n");
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -6356,7 +6363,7 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf,
|
||||
|
||||
if (result == 0) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n");
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user