Commit f7617f8c authored by Robert Schmidt's avatar Robert Schmidt

nFAPI time conversion: handle numerologies flexibly

At both the PNF and the VNF, introduce a separate numerology field, and
pass the numerology when converting time information using macros from
nfapi_interface.h. The actually numerology is still hardcoded to 1 (as it
was before), but the follow-up commits will put a suitable numerology.

In both cases, but the numerology next to the frame/slot information.
parent abe77333
...@@ -290,8 +290,9 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -290,8 +290,9 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
free_and_zero(ch_info); free_and_zero(ch_info);
} }
frame_t frame = NFAPI_SFNSLOT2SFN(sfn_slot); int mu = 1; // NR-UE emul-L1 is hardcoded to 30kHZ, see check_and_process_dci()
int slot = NFAPI_SFNSLOT2SLOT(sfn_slot); frame_t frame = NFAPI_SFNSLOTDEC2SFN(mu, sfn_slot);
int slot = NFAPI_SFNSLOTDEC2SLOT(mu, sfn_slot);
if (sfn_slot == last_sfn_slot) { if (sfn_slot == last_sfn_slot) {
LOG_D(NR_MAC, "repeated sfn_sf = %d.%d\n", LOG_D(NR_MAC, "repeated sfn_sf = %d.%d\n",
frame, slot); frame, slot);
......
...@@ -1702,6 +1702,9 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nf ...@@ -1702,6 +1702,9 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nf
p7_config->timing_info_mode_aperiodic = 1; p7_config->timing_info_mode_aperiodic = 1;
} }
pnf_p7_t* pnf_p7 = (pnf_p7_t*)(p7_config);
pnf_p7->mu = 1; /* TODO */
// NR // NR
p7_config->dl_tti_req_fn = &pnf_phy_dl_tti_req; p7_config->dl_tti_req_fn = &pnf_phy_dl_tti_req;
p7_config->ul_tti_req_fn = &pnf_phy_ul_tti_req; p7_config->ul_tti_req_fn = &pnf_phy_ul_tti_req;
...@@ -2281,20 +2284,23 @@ void handle_nr_slot_ind(uint16_t sfn, uint16_t slot) ...@@ -2281,20 +2284,23 @@ void handle_nr_slot_ind(uint16_t sfn, uint16_t slot)
maybe_slow_down_pnf(); maybe_slow_down_pnf();
} }
nfapi_pnf_p7_config_t* config = p7_config_g;
pnf_p7_t* _this = (pnf_p7_t*)(config);
//send VNF slot indication, which is aligned with TX thread, so that it can call the scheduler //send VNF slot indication, which is aligned with TX thread, so that it can call the scheduler
//we give four additional slots (2ms) which should be enough time for the VNF to //we give four additional slots (2ms) which should be enough time for the VNF to
//answer //answer
int slot_ahead = 4; int slot_ahead = 4;
uint32_t sfn_slot_tx = sfnslot_add_slot(sfn, slot, slot_ahead); int mu = _this->mu;
uint16_t sfn_tx = NFAPI_SFNSLOT2SFN(sfn_slot_tx); uint16_t sfn_tx = sfn;
uint8_t slot_tx = NFAPI_SFNSLOT2SLOT(sfn_slot_tx); uint16_t slot_tx = slot;
sfnslot_add_slot(mu, &sfn_tx, &slot_tx, slot_ahead); // modify: do in place
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "send slot indication for sfn/slot:%4d.%2d current:%4d.%2d\n", sfn_tx, slot_tx, sfn, slot); //printf("send slot indication for sfn/slot:%4d.%2d current:%4d.%2d\n", sfn_tx, slot_tx, sfn, slot);
nfapi_nr_slot_indication_scf_t ind = { .sfn = sfn_tx, .slot = slot_tx }; nfapi_nr_slot_indication_scf_t ind = { .sfn = sfn_tx, .slot = slot_tx };
oai_nfapi_nr_slot_indication(&ind); oai_nfapi_nr_slot_indication(&ind);
//copy data from appropriate p7 slot buffers into channel structures for PHY processing //copy data from appropriate p7 slot buffers into channel structures for PHY processing
nfapi_pnf_p7_slot_ind(p7_config_g, p7_config_g->phy_id, sfn, slot); nfapi_pnf_p7_slot_ind(config, config->phy_id, sfn, slot);
return; return;
} }
......
...@@ -29,7 +29,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add ...@@ -29,7 +29,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add
void oai_subframe_ind(uint16_t sfn, uint16_t sf); void oai_subframe_ind(uint16_t sfn, uint16_t sf);
void handle_nr_slot_ind(uint16_t sfn, uint16_t slot); void handle_nr_slot_ind(uint16_t sfn, uint16_t slot);
uint32_t sfnslot_add_slot(uint16_t sfn, uint16_t slot, int offset); void sfnslot_add_slot(int mu, uint16_t *sfn, uint16_t *slot, int offset);
int oai_nfapi_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind); int oai_nfapi_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind);
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind); int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind);
......
...@@ -25,6 +25,4 @@ ...@@ -25,6 +25,4 @@
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port); void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port); void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
uint32_t sfnslot_add_slot(uint16_t sfn, uint16_t slot, int offset);
#endif /* NFAPI_VNF_H_ */ #endif /* NFAPI_VNF_H_ */
...@@ -120,16 +120,14 @@ typedef struct { ...@@ -120,16 +120,14 @@ typedef struct {
#define NFAPI_TAG_LENGTH_PACKED_LEN 4 #define NFAPI_TAG_LENGTH_PACKED_LEN 4
// Convenience methods to convert between SFN/SLOT formats // Convenience methods to convert between SFN/SLOT formats
#define NFAPI_SFNSLOT2DEC(_sfn,_slot) ( _sfn*20 + _slot ) // total count of slots #define NFAPI_SLOTNUM(_mu) (10 << (_mu))
#define NFAPI_SFNSLOTDEC2SFNSLOT(_sfnslot_dec) ((((_sfnslot_dec) / 20) << 6) | (((_sfnslot_dec) - (((_sfnslot_dec) / 20) * 20)) & 0x3F)) #define NFAPI_SLOTLEN(_mu) (1000.f / (1 << _mu))
#define NFAPI_SFNSLOT2SFN(_sfnslot) ((_sfnslot) >> 6) #define NFAPI_SFNSLOT2DEC(_mu, _sfn, _slot) ((_sfn) * NFAPI_SLOTNUM(_mu) + (_slot))
#define NFAPI_SFNSLOT2SLOT(_sfnslot) ((_sfnslot) & 0x3F) #define NFAPI_SFNSLOTDEC2SFN(_mu, _sfnslot_dec) ((_sfnslot_dec) / NFAPI_SLOTNUM(_mu))
#define NFAPI_SFNSLOTDEC2SFN(_sfnslot_dec) ((_sfnslot_dec) / 20) #define NFAPI_SFNSLOTDEC2SLOT(_mu, _sfnslot_dec) ((_sfnslot_dec) % NFAPI_SLOTNUM(_mu))
#define NFAPI_SFNSLOTDEC2SLOT(_sfnslot_dec) ((_sfnslot_dec) % 20)
#define NFAPI_SFNSLOT2HEX(_sfn,_slot) ((_sfn << 6) | (_slot & 0x3F))
#define NFAPI_MAX_SFNSLOTDEC 1024*20 // 20 is for numerology 1 #define NFAPI_MAX_SFNSLOTDEC(_mu) (1024 * NFAPI_SLOTNUM(_mu))
// Convenience methods to convert between SFN/SFN formats // Convenience methods to convert between SFN/SFN formats
#define NFAPI_SFNSF2DEC(_sfnsf) ((((_sfnsf) >> 4) * 10) + ((_sfnsf) & 0xF)) #define NFAPI_SFNSF2DEC(_sfnsf) ((((_sfnsf) >> 4) * 10) + ((_sfnsf) & 0xF))
......
...@@ -114,6 +114,7 @@ typedef struct { ...@@ -114,6 +114,7 @@ typedef struct {
uint16_t sfn; uint16_t sfn;
uint16_t slot; uint16_t slot;
int mu;
uint16_t sfn_slot; uint16_t sfn_slot;
uint32_t slot_start_time_hr; uint32_t slot_start_time_hr;
int32_t slot_shift; int32_t slot_shift;
......
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
extern int sf_ahead; extern int sf_ahead;
void add_slot(uint16_t *frameP, uint16_t *slotP, int offset) static void add_slot(int mu, uint16_t *frameP, uint16_t *slotP, int offset)
{ {
uint16_t num_slots = 20; // set based on numerlogy (fixing for 1) uint16_t num_slots = NFAPI_SLOTNUM(mu);
*frameP = (*frameP + ((*slotP + offset) / num_slots))%1024; *frameP = (*frameP + ((*slotP + offset) / num_slots))%1024;
...@@ -61,18 +61,12 @@ void subtract_sf(uint16_t *frameP, uint16_t *subframeP, int offset) ...@@ -61,18 +61,12 @@ void subtract_sf(uint16_t *frameP, uint16_t *subframeP, int offset)
*subframeP = (*subframeP+10-offset)%10; *subframeP = (*subframeP+10-offset)%10;
} }
uint32_t sfnslot_add_slot(uint16_t sfn, uint16_t slot, int offset) void sfnslot_add_slot(int mu, uint16_t *sfn, uint16_t *slot, int offset)
{ {
uint32_t new_sfnslot;
//printf("%s() sfn:%u sf:%u\n", __FUNCTION__, sfn, sf); //printf("%s() sfn:%u sf:%u\n", __FUNCTION__, sfn, sf);
add_slot(&sfn, &slot, offset); add_slot(mu, sfn, slot, offset);
new_sfnslot = sfn<<6|slot;
//printf("%s() sfn:%u sf:%u offset:%d sfnsf:%d(DEC:%d) new:%d(DEC:%d)\n", __FUNCTION__, sfn, sf, offset, sfnsf, NFAPI_SFNSF2DEC(sfnsf), new_sfnsf, NFAPI_SFNSF2DEC(new_sfnsf)); //printf("%s() sfn:%u sf:%u offset:%d sfnsf:%d(DEC:%d) new:%d(DEC:%d)\n", __FUNCTION__, sfn, sf, offset, sfnsf, NFAPI_SFNSF2DEC(sfnsf), new_sfnsf, NFAPI_SFNSF2DEC(new_sfnsf));
return new_sfnslot;
} }
uint16_t sfnsf_add_sf(uint16_t sfnsf, int offset) uint16_t sfnsf_add_sf(uint16_t sfnsf, int offset)
...@@ -786,8 +780,8 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl ...@@ -786,8 +780,8 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
pnf_p7->sfn = sfn; pnf_p7->sfn = sfn;
pnf_p7->slot = slot; pnf_p7->slot = slot;
uint32_t tx_slot_dec = NFAPI_SFNSLOT2DEC(sfn,slot); uint32_t tx_slot_dec = NFAPI_SFNSLOT2DEC(pnf_p7->mu, sfn,slot);
uint8_t buffer_index_tx = tx_slot_dec % 20; uint8_t buffer_index_tx = tx_slot_dec % NFAPI_SLOTNUM(pnf_p7->mu);
// If the subframe_buffer has been configured // If the subframe_buffer has been configured
if(pnf_p7->_public.slot_buffer_size!= 0) // for now value is same as sf_buffer_size if(pnf_p7->_public.slot_buffer_size!= 0) // for now value is same as sf_buffer_size
...@@ -800,9 +794,9 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl ...@@ -800,9 +794,9 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
// adjust for wrap-around // adjust for wrap-around
if(shifted_slot < 0) if(shifted_slot < 0)
shifted_slot += NFAPI_MAX_SFNSLOTDEC; shifted_slot += NFAPI_MAX_SFNSLOTDEC(pnf_p7->mu);
else if(shifted_slot > NFAPI_MAX_SFNSLOTDEC) else if(shifted_slot > NFAPI_MAX_SFNSLOTDEC(pnf_p7->mu))
shifted_slot -= NFAPI_MAX_SFNSLOTDEC; shifted_slot -= NFAPI_MAX_SFNSLOTDEC(pnf_p7->mu);
// NFAPI_TRACE(NFAPI_TRACE_INFO, "Applying shift %d to sfn/slot (%d -> %d)\n", pnf_p7->sfn_slot_shift, NFAPI_SFNSF2DEC(sfn_slot), shifted_sfn_slot); // NFAPI_TRACE(NFAPI_TRACE_INFO, "Applying shift %d to sfn/slot (%d -> %d)\n", pnf_p7->sfn_slot_shift, NFAPI_SFNSF2DEC(sfn_slot), shifted_sfn_slot);
slot = shifted_slot; slot = shifted_slot;
...@@ -1187,12 +1181,12 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) ...@@ -1187,12 +1181,12 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
bool is_nr_p7_request_in_window(const uint16_t sfn, const uint16_t slot, const char* name, const pnf_p7_t* phy) bool is_nr_p7_request_in_window(const uint16_t sfn, const uint16_t slot, const char* name, const pnf_p7_t* phy)
{ {
const uint32_t recv = NFAPI_SFNSLOT2DEC(sfn, slot); // unpack sfn/slot const uint32_t recv = NFAPI_SFNSLOT2DEC(phy->mu, sfn, slot); // unpack sfn/slot
const uint32_t curr = NFAPI_SFNSLOT2DEC(phy->sfn, phy->slot); const uint32_t curr = NFAPI_SFNSLOT2DEC(phy->mu, phy->sfn, phy->slot);
const uint8_t timing_window = phy->_public.slot_buffer_size; const uint8_t timing_window = phy->_public.slot_buffer_size; // TODO check
uint32_t diff = curr < recv ? recv - curr : curr - recv; uint32_t diff = curr < recv ? recv - curr : curr - recv;
if (diff > NFAPI_MAX_SFNSLOTDEC / 2) if (diff > NFAPI_MAX_SFNSLOTDEC(phy->mu) / 2)
diff = NFAPI_MAX_SFNSLOTDEC - diff; diff = NFAPI_MAX_SFNSLOTDEC(phy->mu) - diff;
if (diff > timing_window) { if (diff > timing_window) {
NFAPI_TRACE(NFAPI_TRACE_WARN, "[%d] %s is out of window %d (delta:%d) [max:%d]\n", curr, name, recv, diff, timing_window); NFAPI_TRACE(NFAPI_TRACE_WARN, "[%d] %s is out of window %d (delta:%d) [max:%d]\n", curr, name, recv, diff, timing_window);
return false; return false;
...@@ -1289,8 +1283,8 @@ void pnf_handle_dl_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7) ...@@ -1289,8 +1283,8 @@ void pnf_handle_dl_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
} }
if (check_nr_nfapi_p7_slot_type(frame, slot, "DL_TTI.request", NR_DOWNLINK_SLOT) if (check_nr_nfapi_p7_slot_type(frame, slot, "DL_TTI.request", NR_DOWNLINK_SLOT)
&& is_nr_p7_request_in_window(frame, slot, "dl_tti_request", pnf_p7)) { && is_nr_p7_request_in_window(frame, slot, "dl_tti_request", pnf_p7)) {
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(frame, slot); uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(pnf_p7->mu, frame, slot);
uint8_t buffer_index = sfn_slot_dec % 20; uint8_t buffer_index = sfn_slot_dec % NFAPI_SLOTNUM(pnf_p7->mu);
pnf_p7->slot_buffer[buffer_index].sfn = frame; pnf_p7->slot_buffer[buffer_index].sfn = frame;
pnf_p7->slot_buffer[buffer_index].slot = slot; pnf_p7->slot_buffer[buffer_index].slot = slot;
nfapi_nr_dl_tti_request_t *req = &pnf_p7->slot_buffer[buffer_index].dl_tti_req; nfapi_nr_dl_tti_request_t *req = &pnf_p7->slot_buffer[buffer_index].dl_tti_req;
...@@ -1422,8 +1416,8 @@ void pnf_handle_ul_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7) ...@@ -1422,8 +1416,8 @@ void pnf_handle_ul_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
if (check_nr_nfapi_p7_slot_type(frame, slot, "UL_TTI.request", NR_UPLINK_SLOT) if (check_nr_nfapi_p7_slot_type(frame, slot, "UL_TTI.request", NR_UPLINK_SLOT)
&& is_nr_p7_request_in_window(frame, slot, "ul_tti_request", pnf_p7)) { && is_nr_p7_request_in_window(frame, slot, "ul_tti_request", pnf_p7)) {
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(frame, slot); uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(pnf_p7->mu, frame, slot);
uint8_t buffer_index = (sfn_slot_dec % 20); uint8_t buffer_index = sfn_slot_dec % NFAPI_SLOTNUM(pnf_p7->mu);
pnf_p7->slot_buffer[buffer_index].sfn = frame; pnf_p7->slot_buffer[buffer_index].sfn = frame;
pnf_p7->slot_buffer[buffer_index].slot = slot; pnf_p7->slot_buffer[buffer_index].slot = slot;
nfapi_nr_ul_tti_request_t* req = &pnf_p7->slot_buffer[buffer_index].ul_tti_req; nfapi_nr_ul_tti_request_t* req = &pnf_p7->slot_buffer[buffer_index].ul_tti_req;
...@@ -1541,8 +1535,8 @@ void pnf_handle_ul_dci_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7) ...@@ -1541,8 +1535,8 @@ void pnf_handle_ul_dci_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
} }
if (check_nr_nfapi_p7_slot_type(frame, slot, "UL_DCI.request", NR_DOWNLINK_SLOT) if (check_nr_nfapi_p7_slot_type(frame, slot, "UL_DCI.request", NR_DOWNLINK_SLOT)
&& is_nr_p7_request_in_window(frame, slot, "ul_dci_request", pnf_p7)) { && is_nr_p7_request_in_window(frame, slot, "ul_dci_request", pnf_p7)) {
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(frame, slot); uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(pnf_p7->mu, frame, slot);
uint8_t buffer_index = sfn_slot_dec % 20; uint8_t buffer_index = sfn_slot_dec % NFAPI_SLOTNUM(pnf_p7->mu);
pnf_p7->slot_buffer[buffer_index].sfn = frame; pnf_p7->slot_buffer[buffer_index].sfn = frame;
pnf_p7->slot_buffer[buffer_index].slot = slot; pnf_p7->slot_buffer[buffer_index].slot = slot;
nfapi_nr_ul_dci_request_t *req = &pnf_p7->slot_buffer[buffer_index].ul_dci_req; nfapi_nr_ul_dci_request_t *req = &pnf_p7->slot_buffer[buffer_index].ul_dci_req;
...@@ -1654,8 +1648,8 @@ void pnf_handle_tx_data_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7 ...@@ -1654,8 +1648,8 @@ void pnf_handle_tx_data_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7
} }
if (check_nr_nfapi_p7_slot_type(frame, slot, "TX_DATA.REQUEST", NR_DOWNLINK_SLOT) if (check_nr_nfapi_p7_slot_type(frame, slot, "TX_DATA.REQUEST", NR_DOWNLINK_SLOT)
&& is_nr_p7_request_in_window(frame, slot, "tx_request", pnf_p7)) { && is_nr_p7_request_in_window(frame, slot, "tx_request", pnf_p7)) {
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(frame, slot); uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(pnf_p7->mu, frame, slot);
uint8_t buffer_index = sfn_slot_dec % 20; uint8_t buffer_index = sfn_slot_dec % NFAPI_SLOTNUM(pnf_p7->mu); // TODO where is buffer length?
pnf_p7->slot_buffer[buffer_index].sfn = frame; pnf_p7->slot_buffer[buffer_index].sfn = frame;
pnf_p7->slot_buffer[buffer_index].slot = slot; pnf_p7->slot_buffer[buffer_index].slot = slot;
nfapi_nr_tx_data_request_t *req = &pnf_p7->slot_buffer[buffer_index].tx_data_req; nfapi_nr_tx_data_request_t *req = &pnf_p7->slot_buffer[buffer_index].tx_data_req;
...@@ -1957,10 +1951,10 @@ uint32_t calculate_t2(uint32_t now_time_hr, uint16_t sfn_sf, uint32_t sf_start_t ...@@ -1957,10 +1951,10 @@ uint32_t calculate_t2(uint32_t now_time_hr, uint16_t sfn_sf, uint32_t sf_start_t
return t2; return t2;
} }
uint32_t calculate_nr_t2(uint32_t now_time_hr, uint16_t sfn,uint16_t slot, uint32_t slot_start_time_hr) static uint32_t calculate_nr_t2(uint32_t now_time_hr, int mu, uint16_t sfn,uint16_t slot, uint32_t slot_start_time_hr)
{ {
uint32_t slot_time_us = get_slot_time(now_time_hr, slot_start_time_hr); uint32_t slot_time_us = get_slot_time(now_time_hr, slot_start_time_hr);
uint32_t t2 = (NFAPI_SFNSLOT2DEC(sfn, slot) * 500) + slot_time_us; uint32_t t2 = NFAPI_SFNSLOT2DEC(mu, sfn, slot) * NFAPI_SLOTLEN(mu) + slot_time_us;
if (0) if (0)
{ {
...@@ -1990,13 +1984,13 @@ uint32_t calculate_t3(uint16_t sfn_sf, uint32_t sf_start_time_hr) ...@@ -1990,13 +1984,13 @@ uint32_t calculate_t3(uint16_t sfn_sf, uint32_t sf_start_time_hr)
return t3; return t3;
} }
uint32_t calculate_nr_t3(uint16_t sfn, uint16_t slot, uint32_t slot_start_time_hr) static uint32_t calculate_nr_t3(int mu, uint16_t sfn, uint16_t slot, uint32_t slot_start_time_hr)
{ {
uint32_t now_time_hr = pnf_get_current_time_hr(); uint32_t now_time_hr = pnf_get_current_time_hr();
uint32_t slot_time_us = get_slot_time(now_time_hr, slot_start_time_hr); uint32_t slot_time_us = get_slot_time(now_time_hr, slot_start_time_hr);
uint32_t t3 = (NFAPI_SFNSLOT2DEC(sfn, slot) * 500) + slot_time_us; uint32_t t3 = NFAPI_SFNSLOT2DEC(mu, sfn, slot) * NFAPI_SLOTLEN(mu) + slot_time_us;
return t3; return t3;
} }
...@@ -2092,8 +2086,8 @@ void pnf_nr_handle_dl_node_sync(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7 ...@@ -2092,8 +2086,8 @@ void pnf_nr_handle_dl_node_sync(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7
ul_node_sync.header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC; ul_node_sync.header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC;
ul_node_sync.header.phy_id = dl_node_sync.header.phy_id; ul_node_sync.header.phy_id = dl_node_sync.header.phy_id;
ul_node_sync.t1 = dl_node_sync.t1; ul_node_sync.t1 = dl_node_sync.t1;
ul_node_sync.t2 = calculate_nr_t2(rx_hr_time, pnf_p7->sfn,pnf_p7->slot, pnf_p7->slot_start_time_hr); ul_node_sync.t2 = calculate_nr_t2(rx_hr_time, pnf_p7->mu, pnf_p7->sfn,pnf_p7->slot, pnf_p7->slot_start_time_hr);
ul_node_sync.t3 = calculate_nr_t3(pnf_p7->sfn,pnf_p7->slot, pnf_p7->slot_start_time_hr); ul_node_sync.t3 = calculate_nr_t3(pnf_p7->mu, pnf_p7->sfn,pnf_p7->slot, pnf_p7->slot_start_time_hr);
if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0) if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
{ {
......
...@@ -91,6 +91,8 @@ typedef struct nfapi_vnf_p7_connection_info { ...@@ -91,6 +91,8 @@ typedef struct nfapi_vnf_p7_connection_info {
int sfn_sf; int sfn_sf;
int sfn; int sfn;
int slot; int slot;
int mu; // some 5G slot calculations need the numerology to know the number
// of slots
int socket; int socket;
struct sockaddr_in local_addr; struct sockaddr_in local_addr;
......
This diff is collapsed.
...@@ -558,6 +558,7 @@ int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr, ...@@ -558,6 +558,7 @@ int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr,
node->sfn = 0; node->sfn = 0;
node->slot = 0; node->slot = 0;
node->min_sync_cycle_count = 8; node->min_sync_cycle_count = 8;
node->mu = 1; /* TODO */
// save the remote endpoint information // save the remote endpoint information
node->remote_addr.sin_family = AF_INET; node->remote_addr.sin_family = AF_INET;
......
...@@ -2523,7 +2523,9 @@ void nr_ue_pucch_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, int slotP) ...@@ -2523,7 +2523,9 @@ void nr_ue_pucch_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, int slotP)
LOG_E(NR_MAC, "Error in pucch allocation\n"); LOG_E(NR_MAC, "Error in pucch allocation\n");
return; return;
} }
mac->nr_ue_emul_l1.active_uci_sfn_slot = NFAPI_SFNSLOT2HEX(frameP, slotP); DevAssert(mac->current_DL_BWP != NULL);
int mu = mac->current_DL_BWP->scs;
mac->nr_ue_emul_l1.active_uci_sfn_slot = NFAPI_SFNSLOT2DEC(mu, frameP, slotP);
int ret = nr_ue_configure_pucch(mac, int ret = nr_ue_configure_pucch(mac,
slotP, slotP,
frameP, frameP,
......
...@@ -1043,11 +1043,13 @@ void *nrue_standalone_pnf_task(void *context) ...@@ -1043,11 +1043,13 @@ void *nrue_standalone_pnf_task(void *context)
// TODO: Update sinr field of slot_rnti_mcs to be array. // TODO: Update sinr field of slot_rnti_mcs to be array.
for (int i = 0; i < ch_info->nb_of_csi; ++i) for (int i = 0; i < ch_info->nb_of_csi; ++i)
{ {
slot_rnti_mcs[NFAPI_SFNSLOT2SLOT(ch_info->sfn_slot)].sinr = ch_info->csi[i].sinr; int mu = 1; // NR-UE emul-L1 is hardcoded to 30kHZ, see check_and_process_dci()
slot_rnti_mcs[NFAPI_SFNSLOT2SLOT(ch_info->sfn_slot)].area_code = ch_info->csi[i].area_code; int frame = NFAPI_SFNSLOTDEC2SFN(mu, ch_info->sfn_slot);
int slot = NFAPI_SFNSLOTDEC2SLOT(mu, ch_info->sfn_slot);
slot_rnti_mcs[slot].sinr = ch_info->csi[i].sinr;
slot_rnti_mcs[slot].area_code = ch_info->csi[i].area_code;
LOG_D(NR_PHY, "Received_SINR[%d] = %f, sfn:slot %d:%d\n", LOG_D(NR_PHY, "Received_SINR[%d] = %f, sfn:slot %d:%d\n", i, ch_info->csi[i].sinr, frame, slot);
i, ch_info->csi[i].sinr, NFAPI_SFNSLOT2SFN(ch_info->sfn_slot), NFAPI_SFNSLOT2SLOT(ch_info->sfn_slot));
} }
if (!put_queue(&nr_chan_param_queue, ch_info)) if (!put_queue(&nr_chan_param_queue, ch_info))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment