Added send_mac_slot_indications() and updated timing info procedure
This commit is contained in:
@@ -76,6 +76,13 @@ sudo <oai_codebase>/cmake_targets/ran_build/build/nr-softmodem -O <oai_codebase>
|
||||
* Sync with the latest stable commit in `develop` branch [`LOW-PRIORITY`]
|
||||
* check deviations
|
||||
|
||||
### Task-D
|
||||
* Write `send_mac_slot_indications()` which calls the `slot_indication` in `vnf_p7.c` file [x]
|
||||
* Change the `vnf_handle_timing_info()` function that calls p7 message unpack fn and initializes the sfn and slot in `vnf_p7.c` file [x]
|
||||
* Change pack and unpack functions `pack_timing_info()` and `unpack_timing_info()` [x]
|
||||
* Change `nfapi_timing_info_t` structure to support P7 in NR [x]
|
||||
* Change packing functions to support NR P7 procedures. [x]
|
||||
|
||||
|
||||
### Testing
|
||||
* Test by running VNF on a terminal and PNF in rfsim parallely
|
||||
|
||||
@@ -2510,19 +2510,33 @@ typedef struct {
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
uint32_t last_sfn_sf;
|
||||
uint32_t last_sfn;
|
||||
uint32_t last_slot;
|
||||
uint32_t time_since_last_timing_info;
|
||||
uint32_t dl_config_jitter;
|
||||
uint32_t tx_request_jitter;
|
||||
uint32_t ul_config_jitter;
|
||||
uint32_t hi_dci0_jitter;
|
||||
uint32_t dl_tti_jitter;
|
||||
uint32_t tx_data_request_jitter;
|
||||
uint32_t ul_tti_jitter;
|
||||
uint32_t ul_dci_jitter;
|
||||
int32_t dl_config_latest_delay;
|
||||
int32_t tx_request_latest_delay;
|
||||
int32_t ul_config_latest_delay;
|
||||
int32_t hi_dci0_latest_delay;
|
||||
int32_t dl_tti_latest_delay;
|
||||
int32_t tx_data_request_latest_delay;
|
||||
int32_t ul_tti_latest_delay;
|
||||
int32_t ul_dci_latest_delay;
|
||||
int32_t dl_config_earliest_arrival;
|
||||
int32_t tx_request_earliest_arrival;
|
||||
int32_t ul_config_earliest_arrival;
|
||||
int32_t hi_dci0_earliest_arrival;
|
||||
int32_t dl_tti_earliest_arrival;
|
||||
int32_t tx_data_request_earliest_arrival;
|
||||
int32_t ul_tti_earliest_arrival;
|
||||
int32_t ul_dci_earliest_arrival;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_timing_info_t;
|
||||
|
||||
|
||||
@@ -3335,7 +3335,25 @@ static uint8_t pack_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t
|
||||
static uint8_t pack_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg;
|
||||
|
||||
return (push32(pNfapiMsg->last_sfn, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->last_slot, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->dl_tti_jitter, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->tx_data_request_jitter, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->ul_tti_jitter, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->ul_dci_jitter, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->dl_tti_latest_delay, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->tx_data_request_latest_delay, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->ul_tti_latest_delay, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->ul_dci_latest_delay, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->dl_tti_earliest_arrival, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->tx_data_request_earliest_arrival, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->ul_tti_earliest_arrival, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->ul_dci_earliest_arrival, ppWritePackedMsg, end) &&
|
||||
pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
|
||||
|
||||
#if LTE
|
||||
return (push32(pNfapiMsg->last_sfn_sf, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) &&
|
||||
push32(pNfapiMsg->dl_config_jitter, ppWritePackedMsg, end) &&
|
||||
@@ -3351,6 +3369,7 @@ static uint8_t pack_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *
|
||||
pushs32(pNfapiMsg->ul_config_earliest_arrival, ppWritePackedMsg, end) &&
|
||||
pushs32(pNfapiMsg->hi_dci0_earliest_arrival, ppWritePackedMsg, end) &&
|
||||
pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -3368,7 +3387,13 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
printf("\n P7 MESSAGE SENT: \n");
|
||||
for(int i=0; i< packedBufLen; i++){
|
||||
printf("%d", *(uint8_t *)(pMessageBuf + i));
|
||||
}
|
||||
printf("\n");
|
||||
*/
|
||||
// process the header
|
||||
if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) &&
|
||||
push16(pMessageHeader->message_id, &pWritePackedMessage, end) &&
|
||||
@@ -7475,7 +7500,25 @@ static uint8_t unpack_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void
|
||||
unpack_p7_tlv_t unpack_fns[] =
|
||||
{
|
||||
};
|
||||
|
||||
return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn, end) &&
|
||||
pull32(ppReadPackedMsg, &pNfapiMsg->last_slot, end) &&
|
||||
pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) &&
|
||||
pull32(ppReadPackedMsg, &pNfapiMsg->dl_tti_jitter, end) &&
|
||||
pull32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_jitter, end) &&
|
||||
pull32(ppReadPackedMsg, &pNfapiMsg->ul_tti_jitter, end) &&
|
||||
pull32(ppReadPackedMsg, &pNfapiMsg->ul_dci_jitter, end) &&
|
||||
pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_latest_delay, end) &&
|
||||
pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_latest_delay, end) &&
|
||||
pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_latest_delay, end) &&
|
||||
pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_latest_delay, end) &&
|
||||
pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_earliest_arrival, end) &&
|
||||
pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_earliest_arrival, end) &&
|
||||
pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_earliest_arrival, end) &&
|
||||
pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_earliest_arrival, end) &&
|
||||
unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
|
||||
|
||||
#if LTE
|
||||
return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn_sf, end) &&
|
||||
pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) &&
|
||||
pull32(ppReadPackedMsg, &pNfapiMsg->dl_config_jitter, end) &&
|
||||
@@ -7491,6 +7534,7 @@ static uint8_t unpack_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void
|
||||
pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_earliest_arrival, end) &&
|
||||
pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_earliest_arrival, end) &&
|
||||
unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -7666,6 +7710,14 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint8_t *ptr = pMessageBuf;
|
||||
printf("\n Read P7 message unpack: ");
|
||||
while(ptr < end){
|
||||
printf(" %d ", *ptr);
|
||||
ptr++;
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
// clean the supplied buffer for - tag value blanking
|
||||
(void)memset(pUnpackedBuf, 0, unpackedBufLen);
|
||||
|
||||
@@ -132,6 +132,12 @@ typedef struct {
|
||||
uint32_t ul_config_jitter;
|
||||
uint32_t hi_dci0_jitter;
|
||||
uint32_t tx_jitter;
|
||||
|
||||
//P7 NR
|
||||
uint32_t dl_tti_jitter;
|
||||
uint32_t ul_tti_jitter;
|
||||
uint32_t ul_dci_jitter;
|
||||
uint32_t tx_data_jitter;
|
||||
|
||||
uint32_t tick;
|
||||
pnf_p7_stats_t stats;
|
||||
|
||||
@@ -648,6 +648,7 @@ void pnf_pack_and_send_timing_info(pnf_p7_t* pnf_p7)
|
||||
timing_info.header.message_id = NFAPI_TIMING_INFO;
|
||||
timing_info.header.phy_id = pnf_p7->_public.phy_id;
|
||||
|
||||
#if 0
|
||||
timing_info.last_sfn_sf = pnf_p7->sfn_sf;
|
||||
timing_info.time_since_last_timing_info = pnf_p7->timing_info_ms_counter;
|
||||
|
||||
@@ -665,6 +666,26 @@ void pnf_pack_and_send_timing_info(pnf_p7_t* pnf_p7)
|
||||
timing_info.tx_request_earliest_arrival = 0;
|
||||
timing_info.ul_config_earliest_arrival = 0;
|
||||
timing_info.hi_dci0_earliest_arrival = 0;
|
||||
#endif
|
||||
|
||||
timing_info.last_sfn = pnf_p7->sfn;
|
||||
timing_info.last_slot = pnf_p7->slot;
|
||||
timing_info.time_since_last_timing_info = pnf_p7->timing_info_ms_counter;
|
||||
|
||||
timing_info.dl_tti_jitter = pnf_p7->dl_tti_jitter;
|
||||
timing_info.tx_data_request_jitter = pnf_p7->tx_data_jitter;
|
||||
timing_info.ul_tti_jitter = pnf_p7->ul_tti_jitter;
|
||||
timing_info.ul_dci_jitter = pnf_p7->ul_dci_jitter;
|
||||
|
||||
timing_info.dl_tti_latest_delay = 0;
|
||||
timing_info.tx_data_request_latest_delay = 0;
|
||||
timing_info.ul_tti_latest_delay = 0;
|
||||
timing_info.ul_dci_latest_delay = 0;
|
||||
|
||||
timing_info.dl_tti_earliest_arrival = 0;
|
||||
timing_info.tx_data_request_earliest_arrival = 0;
|
||||
timing_info.ul_tti_earliest_arrival = 0;
|
||||
timing_info.ul_dci_earliest_arrival = 0;
|
||||
|
||||
|
||||
pnf_p7_pack_and_send_p7_message(pnf_p7, &(timing_info.header), sizeof(timing_info));
|
||||
|
||||
@@ -87,6 +87,8 @@ typedef struct nfapi_vnf_p7_connection_info {
|
||||
int32_t previous_sf_offset_filtered;
|
||||
|
||||
int sfn_sf;
|
||||
int sfn;
|
||||
int slot;
|
||||
|
||||
int socket;
|
||||
struct sockaddr_in local_addr;
|
||||
@@ -121,6 +123,7 @@ uint32_t vnf_get_current_time_hr(void);
|
||||
uint16_t increment_sfn_sf(uint16_t sfn_sf);
|
||||
int vnf_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info);
|
||||
int send_mac_subframe_indications(vnf_p7_t* config);
|
||||
int send_mac_slot_indications(vnf_p7_t* config);
|
||||
int vnf_p7_read_dispatch_message(vnf_p7_t* vnf_p7 );
|
||||
|
||||
void vnf_p7_connection_info_list_add(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* node);
|
||||
|
||||
@@ -802,7 +802,7 @@ void vnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, nfapi_vnf_confi
|
||||
if(msg)
|
||||
{
|
||||
if(nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, msg, msg_size, &config->codec_config) >= 0)
|
||||
{
|
||||
{ṭ
|
||||
if(config->vendor_ext)
|
||||
config->vendor_ext(config, p5_idx, msg);
|
||||
}
|
||||
|
||||
@@ -367,6 +367,26 @@ uint16_t increment_sfn_sf_by(uint16_t sfn_sf, uint8_t increment)
|
||||
return sfn_sf;
|
||||
}
|
||||
|
||||
int send_mac_slot_indications(vnf_p7_t* vnf_p7)
|
||||
{
|
||||
nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections;
|
||||
while(curr != 0)
|
||||
{
|
||||
if(curr->in_sync == 1)
|
||||
{
|
||||
// ask for subframes in the future
|
||||
//uint16_t sfn_sf_adv = increment_sfn_sf_by(curr->sfn_sf, 2);
|
||||
|
||||
//vnf_p7->_public.subframe_indication(&(vnf_p7->_public), curr->phy_id, sfn_sf_adv);
|
||||
// suggestion fix by Haruki NAOI
|
||||
vnf_p7->_public.slot_indication(&(vnf_p7->_public), curr->phy_id, curr->sfn,curr->slot);
|
||||
}
|
||||
|
||||
curr = curr->next;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int send_mac_subframe_indications(vnf_p7_t* vnf_p7)
|
||||
{
|
||||
@@ -1268,17 +1288,18 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
|
||||
if (vnf_p7 && vnf_p7->p7_connections)
|
||||
{
|
||||
int16_t vnf_pnf_sfnsf_delta = NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf) - NFAPI_SFNSF2DEC(ind.last_sfn_sf);
|
||||
|
||||
//int16_t vnf_pnf_sfnsf_delta = NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf) - NFAPI_SFNSF2DEC(ind.last_sfn_sf);
|
||||
int16_t vnf_pnf_sfnslot_delta = NFAPI_SFNSLOT2DEC(vnf_p7->p7_connections[0].sfn,vnf_p7->p7_connections[0].slot) - NFAPI_SFNSLOT2DEC(ind.last_sfn,ind.last_slot);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PNF:SFN/SF:%d VNF:SFN/SF:%d deltaSFNSF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind.last_sfn_sf), NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), vnf_pnf_sfnsf_delta);
|
||||
|
||||
// Panos: Careful here!!! Modification of the original nfapi-code
|
||||
//if (vnf_pnf_sfnsf_delta>1 || vnf_pnf_sfnsf_delta < -1)
|
||||
if (vnf_pnf_sfnsf_delta>0 || vnf_pnf_sfnsf_delta < 0)
|
||||
if (vnf_pnf_sfnslot_delta>0 || vnf_pnf_sfnslot_delta < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() LARGE SFN/SF DELTA between PNF and VNF delta:%d VNF:%d PNF:%d\n\n\n\n\n\n\n\n\n", __FUNCTION__, vnf_pnf_sfnsf_delta, NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), NFAPI_SFNSF2DEC(ind.last_sfn_sf));
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() LARGE SFN/SF DELTA between PNF and VNF delta:%d VNF:%d PNF:%d\n\n\n\n\n\n\n\n\n", __FUNCTION__, vnf_pnf_sfnslot_delta,NFAPI_SFNSLOT2DEC(vnf_p7->p7_connections[0].sfn,vnf_p7->p7_connections[0].slot),NFAPI_SFNSLOT2DEC(ind.last_sfn,ind.last_slot)) ;
|
||||
// Panos: Careful here!!! Modification of the original nfapi-code
|
||||
vnf_p7->p7_connections[0].sfn_sf = ind.last_sfn_sf;
|
||||
vnf_p7->p7_connections[0].sfn = ind.last_sfn;
|
||||
vnf_p7->p7_connections[0].slot = ind.last_slot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,13 +158,13 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
|
||||
struct timespec sf_duration;
|
||||
sf_duration.tv_sec = 0;
|
||||
sf_duration.tv_nsec = 1e6; // We want 1ms pause
|
||||
sf_duration.tv_nsec = 0.5e6; // We want 1ms pause //We want 0.5 ms pause for NR
|
||||
|
||||
struct timespec sf_start;
|
||||
clock_gettime(CLOCK_MONOTONIC, &sf_start);
|
||||
long millisecond = sf_start.tv_nsec / 1e6;
|
||||
long millisecond = sf_start.tv_nsec / 1e6; //Check if we have to change
|
||||
sf_start = timespec_add(sf_start, sf_duration);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "next slot will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
|
||||
|
||||
while(vnf_p7->terminate == 0)
|
||||
{
|
||||
@@ -361,14 +361,28 @@ if (selectRetval==-1 && errno == 22)
|
||||
|
||||
while(curr != 0)
|
||||
{
|
||||
curr->sfn_sf = increment_sfn_sf(curr->sfn_sf);
|
||||
|
||||
if (curr->slot == 19)
|
||||
{
|
||||
curr->sfn++;
|
||||
}
|
||||
else if(curr->slot > 19)
|
||||
{
|
||||
//error
|
||||
}
|
||||
else
|
||||
{
|
||||
curr->slot++;
|
||||
}
|
||||
//curr->sfn_sf = increment_sfn_sf(curr->sfn_sf);
|
||||
|
||||
vnf_sync(vnf_p7, curr);
|
||||
|
||||
curr = curr->next;
|
||||
}
|
||||
|
||||
send_mac_subframe_indications(vnf_p7);
|
||||
//send_mac_subframe_indications(vnf_p7);
|
||||
send_mac_slot_indications(vnf_p7);
|
||||
|
||||
}
|
||||
else if(selectRetval > 0)
|
||||
|
||||
Reference in New Issue
Block a user