Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
ec94adae
Commit
ec94adae
authored
Dec 09, 2020
by
Remi Hardy
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/NR-PHY-MAC-IF-multi-UE' into rh_wk50_debug
parents
c04a2ff4
13f0571a
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
171 additions
and
149 deletions
+171
-149
openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h
openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h
+2
-0
openair2/LAYER2/NR_MAC_UE/main_ue_nr.c
openair2/LAYER2/NR_MAC_UE/main_ue_nr.c
+0
-2
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
+0
-1
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+0
-1
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
+3
-10
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
+5
-2
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
+0
-1
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+0
-4
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
+45
-13
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
+33
-12
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
+13
-6
openair2/LAYER2/NR_MAC_gNB/main.c
openair2/LAYER2/NR_MAC_gNB/main.c
+0
-1
openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
+0
-3
openair2/NR_PHY_INTERFACE/NR_IF_Module.c
openair2/NR_PHY_INTERFACE/NR_IF_Module.c
+70
-93
No files found.
openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h
View file @
ec94adae
...
...
@@ -37,6 +37,8 @@
/*#include "PHY/defs_common.h"*/
extern
const
uint8_t
nr_slots_per_frame
[
5
];
/* extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE];
extern const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE];
extern const uint8_t cqi2fmt0_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE];
...
...
openair2/LAYER2/NR_MAC_UE/main_ue_nr.c
View file @
ec94adae
...
...
@@ -37,8 +37,6 @@
#include "assertions.h"
#include "PHY/types.h"
#include "PHY/defs_UE.h"
#include "openair2/LAYER2/RLC/rlc.h"
#include "openair2/LAYER2/PDCP_v10.1.0/pdcp.h"
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h"
#include "executables/softmodem-common.h"
...
...
openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
View file @
ec94adae
...
...
@@ -63,7 +63,6 @@
#include "LAYER2/NR_MAC_UE/mac_proto.h"
extern
int64_t
table_6_3_3_2_3_prachConfig_Index
[
256
][
9
];
extern
const
uint8_t
nr_slots_per_frame
[
5
];
//extern uint8_t nfapi_mode;
...
...
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
View file @
ec94adae
...
...
@@ -142,7 +142,6 @@ static ssb_list_info_t ssb_list;
extern
int
bwp_id
;
extern
dci_pdu_rel15_t
*
def_dci_pdu_rel15
;
extern
const
uint8_t
nr_slots_per_frame
[
5
];
extern
void
mac_rlc_data_ind
(
const
module_id_t
module_idP
,
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
View file @
ec94adae
...
...
@@ -32,9 +32,7 @@
#include "assertions.h"
#include "LAYER2/MAC/mac.h"
#include "NR_MAC_COMMON/nr_mac_extern.h"
#include "LAYER2/MAC/mac_proto.h"
#include "NR_MAC_gNB/mac_proto.h"
#include "common/utils/LOG/log.h"
...
...
@@ -51,15 +49,10 @@
#include "openair1/PHY/defs_gNB.h"
#include "openair1/PHY/NR_TRANSPORT/nr_dlsch.h"
//Agent-related headers
#include "flexran_agent_extern.h"
#include "flexran_agent_mac.h"
#include "intertask_interface.h"
#include "executables/softmodem-common.h"
const
uint8_t
slots_per_frame
[
5
]
=
{
10
,
20
,
40
,
80
,
160
};
uint16_t
nr_pdcch_order_table
[
6
]
=
{
31
,
31
,
511
,
2047
,
2047
,
8191
};
void
clear_mac_stats
(
gNB_MAC_INST
*
gNB
)
{
...
...
@@ -352,7 +345,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
AssertFatal
(
1
==
0
,
"Undefined tdd period %ld
\n
"
,
scc
->
tdd_UL_DL_ConfigurationCommon
->
pattern1
.
dl_UL_TransmissionPeriodicity
);
}
int
num_slots_per_tdd
=
(
slots_per_frame
[
*
scc
->
ssbSubcarrierSpacing
])
/
nb_periods_per_frame
;
int
num_slots_per_tdd
=
(
nr_
slots_per_frame
[
*
scc
->
ssbSubcarrierSpacing
])
/
nb_periods_per_frame
;
const
int
nr_ulmix_slots
=
tdd_pattern
->
nrofUplinkSlots
+
(
tdd_pattern
->
nrofUplinkSymbols
!=
0
);
...
...
@@ -393,7 +386,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
// This schedules MIB
schedule_nr_mib
(
module_idP
,
frame
,
slot
,
slots_per_frame
[
*
scc
->
ssbSubcarrierSpacing
]);
schedule_nr_mib
(
module_idP
,
frame
,
slot
,
nr_
slots_per_frame
[
*
scc
->
ssbSubcarrierSpacing
]);
// This schedule PRACH if we are not in phy_test mode
if
(
get_softmodem_params
()
->
phy_test
==
0
)
{
...
...
@@ -414,7 +407,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
// This schedule CSI measurement reporting
if
(
UE_info
->
active
[
UE_id
])
nr_csi_meas_reporting
(
module_idP
,
UE_id
,
frame
,
slot
,
num_slots_per_tdd
,
nr_ulmix_slots
,
slots_per_frame
[
*
scc
->
ssbSubcarrierSpacing
]);
nr_csi_meas_reporting
(
module_idP
,
UE_id
,
frame
,
slot
,
num_slots_per_tdd
,
nr_ulmix_slots
,
nr_
slots_per_frame
[
*
scc
->
ssbSubcarrierSpacing
]);
// This schedule RA procedure if not in phy_test mode
// Otherwise already consider 5G already connected
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
View file @
ec94adae
...
...
@@ -42,7 +42,6 @@
#include "SIMULATION/TOOLS/sim.h" // for taus
extern
RAN_CONTEXT_t
RC
;
extern
const
uint8_t
nr_slots_per_frame
[
5
];
uint8_t
DELTA
[
4
]
=
{
2
,
3
,
4
,
6
};
...
...
@@ -1041,7 +1040,11 @@ void nr_fill_rar(uint8_t Mod_idP,
uint8_t
*
dlsch_buffer
,
nfapi_nr_pusch_pdu_t
*
pusch_pdu
){
LOG_I
(
MAC
,
"[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u"
,
ra
->
Msg2_frame
,
ra
->
Msg2_slot
,
ra
->
preamble_index
);
LOG_I
(
MAC
,
"[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u
\n
"
,
ra
->
Msg2_frame
,
ra
->
Msg2_slot
,
ra
->
preamble_index
);
NR_RA_HEADER_RAPID
*
rarh
=
(
NR_RA_HEADER_RAPID
*
)
dlsch_buffer
;
NR_MAC_RAR
*
rar
=
(
NR_MAC_RAR
*
)
(
dlsch_buffer
+
1
);
unsigned
char
csi_req
=
0
,
tpc_command
;
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
View file @
ec94adae
...
...
@@ -38,7 +38,6 @@
#include "NR_MAC_COMMON/nr_mac.h"
#include "NR_MAC_gNB/nr_mac_gNB.h"
#include "NR_MAC_COMMON/nr_mac_extern.h"
#include "LAYER2/MAC/mac.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
/*NFAPI*/
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
View file @
ec94adae
...
...
@@ -32,7 +32,6 @@
#include "assertions.h"
#include "LAYER2/MAC/mac.h"
#include "NR_MAC_gNB/nr_mac_gNB.h"
#include "NR_MAC_COMMON/nr_mac_extern.h"
...
...
@@ -48,9 +47,6 @@
#include "RRC/NR/nr_rrc_extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
#include "intertask_interface.h"
#include "T.h"
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
View file @
ec94adae
...
...
@@ -274,15 +274,27 @@ void nr_csi_meas_reporting(int Mod_idP,
}
void
nr_rx_acknack
(
nfapi_nr_uci_pusch_pdu_t
*
uci_pusch
,
nfapi_nr_uci_pucch_pdu_format_0_1_t
*
uci_01
,
nfapi_nr_uci_pucch_pdu_format_2_3_4_t
*
uci_234
,
NR_UL_IND_t
*
UL_info
,
NR_UE_sched_ctrl_t
*
sched_ctrl
,
NR_mac_stats_t
*
stats
)
{
void
handle_nr_uci_pucch_0_1
(
module_id_t
mod_id
,
frame_t
frame
,
sub_frame_t
slot
,
const
nfapi_nr_uci_pucch_pdu_format_0_1_t
*
uci_01
)
{
int
UE_id
=
find_nr_UE_id
(
mod_id
,
uci_01
->
rnti
);
if
(
UE_id
<
0
)
{
LOG_E
(
MAC
,
"%s(): unknown RNTI %04x in PUCCH UCI
\n
"
,
__func__
,
uci_01
->
rnti
);
return
;
}
NR_UE_info_t
*
UE_info
=
&
RC
.
nrmac
[
mod_id
]
->
UE_info
;
NR_UE_sched_ctrl_t
*
sched_ctrl
=
&
UE_info
->
UE_sched_ctrl
[
UE_id
];
// tpc (power control)
sched_ctrl
->
tpc1
=
nr_get_tpc
(
RC
.
nrmac
[
mod_id
]
->
pucch_target_snrx10
,
uci_01
->
ul_cqi
,
30
);
// TODO
int
max_harq_rounds
=
4
;
// TODO define macro
if
(
uci_01
!=
NULL
)
{
if
(((
uci_01
->
pduBitmap
>>
1
)
&
0x01
))
{
// handle harq
int
harq_idx_s
=
0
;
...
...
@@ -291,7 +303,7 @@ void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch,
// search for the right harq process
for
(
int
harq_idx
=
harq_idx_s
;
harq_idx
<
NR_MAX_NB_HARQ_PROCESSES
;
harq_idx
++
)
{
// if the gNB received ack with a good confidence
if
((
UL_info
->
slot
-
1
)
==
sched_ctrl
->
harq_processes
[
harq_idx
].
feedback_slot
)
{
if
((
slot
-
1
)
==
sched_ctrl
->
harq_processes
[
harq_idx
].
feedback_slot
)
{
sched_ctrl
->
harq_processes
[
harq_idx
].
feedback_slot
=
-
1
;
if
((
uci_01
->
harq
->
harq_list
[
harq_bit
].
harq_value
==
1
)
&&
(
uci_01
->
harq
->
harq_confidence_level
==
0
))
{
...
...
@@ -307,13 +319,13 @@ void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch,
if
(
sched_ctrl
->
harq_processes
[
harq_idx
].
round
==
max_harq_rounds
)
{
sched_ctrl
->
harq_processes
[
harq_idx
].
ndi
^=
1
;
sched_ctrl
->
harq_processes
[
harq_idx
].
round
=
0
;
stats
->
dlsch_errors
++
;
UE_info
->
mac_stats
[
UE_id
].
dlsch_errors
++
;
}
break
;
}
// if feedback slot processing is aborted
else
if
(
sched_ctrl
->
harq_processes
[
harq_idx
].
feedback_slot
!=
-
1
&&
(
UL_info
->
slot
-
1
)
>
sched_ctrl
->
harq_processes
[
harq_idx
].
feedback_slot
&&
(
slot
-
1
)
>
sched_ctrl
->
harq_processes
[
harq_idx
].
feedback_slot
&&
sched_ctrl
->
harq_processes
[
harq_idx
].
is_waiting
)
{
sched_ctrl
->
harq_processes
[
harq_idx
].
feedback_slot
=
-
1
;
sched_ctrl
->
harq_processes
[
harq_idx
].
round
++
;
...
...
@@ -326,9 +338,29 @@ void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch,
}
}
}
}
void
handle_nr_uci_pucch_2_3_4
(
module_id_t
mod_id
,
frame_t
frame
,
sub_frame_t
slot
,
const
nfapi_nr_uci_pucch_pdu_format_2_3_4_t
*
uci_234
)
{
int
UE_id
=
find_nr_UE_id
(
mod_id
,
uci_234
->
rnti
);
if
(
UE_id
<
0
)
{
LOG_E
(
MAC
,
"%s(): unknown RNTI %04x in PUCCH UCI
\n
"
,
__func__
,
uci_234
->
rnti
);
return
;
}
NR_UE_info_t
*
UE_info
=
&
RC
.
nrmac
[
mod_id
]
->
UE_info
;
NR_UE_sched_ctrl_t
*
sched_ctrl
=
&
UE_info
->
UE_sched_ctrl
[
UE_id
];
// tpc (power control)
sched_ctrl
->
tpc1
=
nr_get_tpc
(
RC
.
nrmac
[
mod_id
]
->
pucch_target_snrx10
,
uci_234
->
ul_cqi
,
30
);
if
(
uci_234
!=
NULL
)
{
// TODO
int
max_harq_rounds
=
4
;
// TODO define macro
if
((
uci_234
->
pduBitmap
>>
1
)
&
0x01
)
{
int
harq_idx_s
=
0
;
int
acknack
;
...
...
@@ -337,7 +369,7 @@ void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch,
acknack
=
((
uci_234
->
harq
.
harq_payload
[
harq_bit
>>
3
])
>>
harq_bit
)
&
0x01
;
for
(
int
harq_idx
=
harq_idx_s
;
harq_idx
<
NR_MAX_NB_HARQ_PROCESSES
-
1
;
harq_idx
++
)
{
// if the gNB received ack with a good confidence or if the max harq rounds was reached
if
((
UL_info
->
slot
-
1
)
==
sched_ctrl
->
harq_processes
[
harq_idx
].
feedback_slot
)
{
if
((
slot
-
1
)
==
sched_ctrl
->
harq_processes
[
harq_idx
].
feedback_slot
)
{
// TODO add some confidence level for when there is no CRC
sched_ctrl
->
harq_processes
[
harq_idx
].
feedback_slot
=
-
1
;
if
((
uci_234
->
harq
.
harq_crc
!=
1
)
&&
acknack
)
{
...
...
@@ -353,13 +385,13 @@ void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch,
if
(
sched_ctrl
->
harq_processes
[
harq_idx
].
round
==
max_harq_rounds
)
{
sched_ctrl
->
harq_processes
[
harq_idx
].
ndi
^=
1
;
sched_ctrl
->
harq_processes
[
harq_idx
].
round
=
0
;
stats
->
dlsch_errors
++
;
UE_info
->
mac_stats
[
UE_id
].
dlsch_errors
++
;
}
break
;
}
// if feedback slot processing is aborted
else
if
(
sched_ctrl
->
harq_processes
[
harq_idx
].
feedback_slot
!=
-
1
&&
(
UL_info
->
slot
-
1
)
>
sched_ctrl
->
harq_processes
[
harq_idx
].
feedback_slot
&&
(
slot
-
1
)
>
sched_ctrl
->
harq_processes
[
harq_idx
].
feedback_slot
&&
sched_ctrl
->
harq_processes
[
harq_idx
].
is_waiting
)
{
sched_ctrl
->
harq_processes
[
harq_idx
].
feedback_slot
=
-
1
;
sched_ctrl
->
harq_processes
[
harq_idx
].
round
++
;
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
View file @
ec94adae
...
...
@@ -261,37 +261,58 @@ void nr_process_mac_pdu(
}
}
void
handle_nr_ul_harq
(
uint16_t
slot
,
NR_UE_sched_ctrl_t
*
sched_ctrl
,
NR_mac_stats_t
*
stats
,
nfapi_nr_crc_t
crc_pdu
)
{
void
handle_nr_ul_harq
(
module_id_t
mod_id
,
frame_t
frame
,
sub_frame_t
slot
,
const
nfapi_nr_crc_t
*
crc_pdu
)
{
int
UE_id
=
find_nr_UE_id
(
mod_id
,
crc_pdu
->
rnti
);
if
(
UE_id
<
0
)
{
LOG_E
(
MAC
,
"%s(): unknown RNTI %04x in PUSCH
\n
"
,
__func__
,
crc_pdu
->
rnti
);
return
;
}
NR_UE_info_t
*
UE_info
=
&
RC
.
nrmac
[
mod_id
]
->
UE_info
;
NR_UE_sched_ctrl_t
*
sched_ctrl
=
&
UE_info
->
UE_sched_ctrl
[
UE_id
];
int
max_harq_rounds
=
4
;
// TODO define macro
uint8_t
hrq_id
=
crc_pdu
.
harq_id
;
uint8_t
hrq_id
=
crc_pdu
->
harq_id
;
NR_UE_ul_harq_t
*
cur_harq
=
&
sched_ctrl
->
ul_harq_processes
[
hrq_id
];
if
(
cur_harq
->
state
==
ACTIVE_SCHED
)
{
if
(
!
crc_pdu
.
tb_crc_status
)
{
if
(
!
crc_pdu
->
tb_crc_status
)
{
cur_harq
->
ndi
^=
1
;
cur_harq
->
round
=
0
;
cur_harq
->
state
=
INACTIVE
;
// passed -> make inactive. can be used by scheduder for next grant
#ifdef UL_HARQ_PRINT
printf
(
"[HARQ HANDLER] Ulharq id %d crc passed, freeing it for scheduler
\n
"
,
hrq_id
);
#endif
LOG_D
(
MAC
,
"Ulharq id %d crc passed for RNTI %04x
\n
"
,
hrq_id
,
crc_pdu
->
rnti
);
}
else
{
cur_harq
->
round
++
;
cur_harq
->
state
=
ACTIVE_NOT_SCHED
;
#ifdef UL_HARQ_PRINT
printf
(
"[HARQ HANDLER] Ulharq id %d crc failed, requesting retransmission
\n
"
,
hrq_id
);
#endif
LOG_D
(
MAC
,
"Ulharq id %d crc failed for RNTI %04x
\n
"
,
hrq_id
,
crc_pdu
->
rnti
);
}
if
(
!
(
cur_harq
->
round
<
max_harq_rounds
))
{
cur_harq
->
ndi
^=
1
;
cur_harq
->
state
=
INACTIVE
;
// failed after 4 rounds -> make inactive
cur_harq
->
round
=
0
;
LOG_D
(
MAC
,
"[HARQ HANDLER] RNTI %x: Ulharq id %d crc failed in all round, freeing it for scheduler
\n
"
,
crc_pdu
.
rnti
,
hrq_id
);
stats
->
ulsch_errors
++
;
LOG_D
(
MAC
,
"RNTI %04x: Ulharq id %d crc failed in all rounds
\n
"
,
crc_pdu
->
rnti
,
hrq_id
);
UE_info
->
mac_stats
[
UE_id
].
ulsch_errors
++
;
}
return
;
}
else
LOG_W
(
MAC
,
"Incorrect ULSCH HARQ process %d or invalid state %d (ignore this warning for RA)
\n
"
,
hrq_id
,
cur_harq
->
state
);
LOG_W
(
MAC
,
"Incorrect ULSCH HARQ PID %d or invalid state %d for RNTI %04x "
"(ignore this warning for RA)
\n
"
,
hrq_id
,
cur_harq
->
state
,
crc_pdu
->
rnti
);
}
/*
...
...
openair2/LAYER2/NR_MAC_gNB/mac_proto.h
View file @
ec94adae
...
...
@@ -180,10 +180,15 @@ void nr_fill_nfapi_dl_pdu(int Mod_id,
int
ndi
,
int
round
);
void
nr_rx_acknack
(
nfapi_nr_uci_pusch_pdu_t
*
uci_pusch
,
nfapi_nr_uci_pucch_pdu_format_0_1_t
*
uci_01
,
nfapi_nr_uci_pucch_pdu_format_2_3_4_t
*
uci_234
,
NR_UL_IND_t
*
UL_info
,
NR_UE_sched_ctrl_t
*
sched_ctrl
,
NR_mac_stats_t
*
stats
);
void
handle_nr_uci_pucch_0_1
(
module_id_t
mod_id
,
frame_t
frame
,
sub_frame_t
slot
,
const
nfapi_nr_uci_pucch_pdu_format_0_1_t
*
uci_01
);
void
handle_nr_uci_pucch_2_3_4
(
module_id_t
mod_id
,
frame_t
frame
,
sub_frame_t
slot
,
const
nfapi_nr_uci_pucch_pdu_format_2_3_4_t
*
uci_234
);
void
config_uldci
(
NR_BWP_Uplink_t
*
ubwp
,
nfapi_nr_pusch_pdu_t
*
pusch_pdu
,
...
...
@@ -413,7 +418,10 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
const
uint8_t
ul_cqi
,
const
uint16_t
rssi
);
void
handle_nr_ul_harq
(
uint16_t
slot
,
NR_UE_sched_ctrl_t
*
sched_ctrl
,
NR_mac_stats_t
*
stats
,
nfapi_nr_crc_t
crc_pdu
);
void
handle_nr_ul_harq
(
module_id_t
mod_id
,
frame_t
frame
,
sub_frame_t
slot
,
const
nfapi_nr_crc_t
*
crc_pdu
);
int16_t
ssb_index_from_prach
(
module_id_t
module_idP
,
frame_t
frameP
,
...
...
@@ -424,5 +432,4 @@ int16_t ssb_index_from_prach(module_id_t module_idP,
void
find_SSB_and_RO_available
(
module_id_t
module_idP
);
void
handle_nr_uci
(
NR_UL_IND_t
*
UL_info
,
NR_UE_sched_ctrl_t
*
sched_ctrl
,
NR_mac_stats_t
*
stats
,
int
target_snrx10
);
#endif
/*__LAYER2_NR_MAC_PROTO_H__*/
openair2/LAYER2/NR_MAC_gNB/main.c
View file @
ec94adae
...
...
@@ -34,7 +34,6 @@
#include "NR_MAC_COMMON/nr_mac_extern.h"
#include "assertions.h"
#include "LAYER2/PDCP_v10.1.0/pdcp.h"
#include "LAYER2/nr_pdcp/nr_pdcp_entity.h"
#include "RRC/NR/nr_rrc_defs.h"
#include "common/utils/LOG/log.h"
...
...
openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
View file @
ec94adae
...
...
@@ -62,8 +62,6 @@
#include "NR_PHY_INTERFACE/NR_IF_Module.h"
/* MAC */
#include "LAYER2/MAC/mac.h"
#include "LAYER2/MAC/mac_proto.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
#include "NR_TAG.h"
...
...
@@ -457,7 +455,6 @@ typedef struct {
/*! \brief UE list used by gNB to order UEs/CC for scheduling*/
#define MAX_CSI_REPORTCONFIG 48
typedef
struct
{
DLSCH_PDU
DLSCH_pdu
[
4
][
MAX_MOBILES_PER_GNB
];
/// scheduling control info
nr_csi_report_t
csi_report_template
[
MAX_MOBILES_PER_GNB
][
MAX_CSI_REPORTCONFIG
];
NR_UE_sched_ctrl_t
UE_sched_ctrl
[
MAX_MOBILES_PER_GNB
];
...
...
openair2/NR_PHY_INTERFACE/NR_IF_Module.c
View file @
ec94adae
...
...
@@ -30,12 +30,9 @@
* \warning
*/
#include "openair1/PHY/defs_eNB.h"
#include "openair1/PHY/phy_extern.h"
#include "openair1/SCHED_NR/fapi_nr_l1.h"
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
#include "LAYER2/MAC/mac_proto.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "common/ran_context.h"
#include "executables/softmodem-common.h"
...
...
@@ -79,35 +76,28 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) {
}
void
handle_nr_uci
(
NR_UL_IND_t
*
UL_info
,
NR_UE_sched_ctrl_t
*
sched_ctrl
,
NR_mac_stats_t
*
stats
,
int
target_snrx10
)
{
void
handle_nr_uci
(
NR_UL_IND_t
*
UL_info
)
{
const
module_id_t
mod_id
=
UL_info
->
module_id
;
const
frame_t
frame
=
UL_info
->
frame
;
const
sub_frame_t
slot
=
UL_info
->
slot
;
int
num_ucis
=
UL_info
->
uci_ind
.
num_ucis
;
nfapi_nr_uci_t
*
uci_list
=
UL_info
->
uci_ind
.
uci_list
;
for
(
int
i
=
0
;
i
<
num_ucis
;
i
++
)
{
switch
(
uci_list
[
i
].
pdu_type
)
{
case
NFAPI_NR_UCI_PUSCH_PDU_TYPE
:
break
;
case
NFAPI_NR_UCI_PUSCH_PDU_TYPE
:
LOG_E
(
MAC
,
"%s(): unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE
\n
"
,
__func__
);
break
;
case
NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE
:
{
nfapi_nr_uci_pucch_pdu_format_0_1_t
*
uci_pdu
=
&
uci_list
[
i
].
pucch_pdu_format_0_1
;
// tpc (power control)
sched_ctrl
->
tpc1
=
nr_get_tpc
(
target_snrx10
,
uci_pdu
->
ul_cqi
,
30
);
if
(
(
uci_pdu
->
pduBitmap
>>
1
)
&
0x01
)
nr_rx_acknack
(
NULL
,
uci_pdu
,
NULL
,
UL_info
,
sched_ctrl
,
stats
);
const
nfapi_nr_uci_pucch_pdu_format_0_1_t
*
uci_pdu
=
&
uci_list
[
i
].
pucch_pdu_format_0_1
;
handle_nr_uci_pucch_0_1
(
mod_id
,
frame
,
slot
,
uci_pdu
);
break
;
}
case
NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE
:
{
nfapi_nr_uci_pucch_pdu_format_2_3_4_t
*
uci_pdu
=
&
uci_list
[
i
].
pucch_pdu_format_2_3_4
;
// tpc (power control)
sched_ctrl
->
tpc1
=
nr_get_tpc
(
target_snrx10
,
uci_pdu
->
ul_cqi
,
30
);
if
(
(
uci_pdu
->
pduBitmap
>>
1
)
&
0x01
)
nr_rx_acknack
(
NULL
,
NULL
,
uci_pdu
,
UL_info
,
sched_ctrl
,
stats
);
const
nfapi_nr_uci_pucch_pdu_format_2_3_4_t
*
uci_pdu
=
&
uci_list
[
i
].
pucch_pdu_format_2_3_4
;
handle_nr_uci_pucch_2_3_4
(
mod_id
,
frame
,
slot
,
uci_pdu
);
break
;
}
}
...
...
@@ -117,75 +107,62 @@ void handle_nr_uci(NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_
}
void
handle_nr_ulsch
(
NR_UL_IND_t
*
UL_info
,
NR_UE_sched_ctrl_t
*
sched_ctrl
,
NR_mac_stats_t
*
stats
)
{
if
(
nfapi_mode
==
1
)
{
if
(
UL_info
->
crc_ind
.
number_crcs
>
0
)
{
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
// oai_nfapi_crc_indication(&UL_info->crc_ind);
UL_info
->
crc_ind
.
number_crcs
=
0
;
}
if
(
UL_info
->
rx_ind
.
number_of_pdus
>
0
)
{
//LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
// oai_nfapi_rx_ind(&UL_info->rx_ind);
UL_info
->
rx_ind
.
number_of_pdus
=
0
;
}
}
else
{
if
(
UL_info
->
rx_ind
.
number_of_pdus
>
0
&&
UL_info
->
crc_ind
.
number_crcs
>
0
)
{
for
(
int
i
=
0
;
i
<
UL_info
->
rx_ind
.
number_of_pdus
;
i
++
)
{
for
(
int
j
=
0
;
j
<
UL_info
->
crc_ind
.
number_crcs
;
j
++
)
{
// find crc_indication j corresponding rx_indication i
LOG_D
(
PHY
,
"UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].rx_ue_information.rnti:%04x UL_info->rx_ind.rx_indication_body.rx_pdu_list[%d].rx_ue_information.rnti:%04x
\n
"
,
j
,
UL_info
->
crc_ind
.
crc_list
[
j
].
rnti
,
i
,
UL_info
->
rx_ind
.
pdu_list
[
i
].
rnti
);
if
(
UL_info
->
crc_ind
.
crc_list
[
j
].
rnti
==
UL_info
->
rx_ind
.
pdu_list
[
i
].
rnti
)
{
LOG_D
(
PHY
,
"UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].crc_indication_rel8.crc_flag:%d
\n
"
,
j
,
UL_info
->
crc_ind
.
crc_list
[
j
].
tb_crc_status
);
handle_nr_ul_harq
(
UL_info
->
slot
,
sched_ctrl
,
stats
,
UL_info
->
crc_ind
.
crc_list
[
j
]);
if
(
UL_info
->
crc_ind
.
crc_list
[
j
].
tb_crc_status
==
1
)
{
// CRC error indication
LOG_D
(
MAC
,
"Frame %d, Slot %d Calling rx_sdu (CRC error)
\n
"
,
UL_info
->
frame
,
UL_info
->
slot
);
nr_rx_sdu
(
UL_info
->
module_id
,
UL_info
->
CC_id
,
UL_info
->
rx_ind
.
sfn
,
//UL_info->frame,
UL_info
->
rx_ind
.
slot
,
//UL_info->slot,
UL_info
->
rx_ind
.
pdu_list
[
i
].
rnti
,
(
uint8_t
*
)
NULL
,
UL_info
->
rx_ind
.
pdu_list
[
i
].
pdu_length
,
UL_info
->
rx_ind
.
pdu_list
[
i
].
timing_advance
,
UL_info
->
rx_ind
.
pdu_list
[
i
].
ul_cqi
,
UL_info
->
rx_ind
.
pdu_list
[
i
].
rssi
);
}
else
{
LOG_D
(
MAC
,
"Frame %d, Slot %d Calling rx_sdu (CRC ok)
\n
"
,
UL_info
->
frame
,
UL_info
->
slot
);
nr_rx_sdu
(
UL_info
->
module_id
,
UL_info
->
CC_id
,
UL_info
->
rx_ind
.
sfn
,
//UL_info->frame,
UL_info
->
rx_ind
.
slot
,
//UL_info->slot,
UL_info
->
rx_ind
.
pdu_list
[
i
].
rnti
,
UL_info
->
rx_ind
.
pdu_list
[
i
].
pdu
,
UL_info
->
rx_ind
.
pdu_list
[
i
].
pdu_length
,
UL_info
->
rx_ind
.
pdu_list
[
i
].
timing_advance
,
UL_info
->
rx_ind
.
pdu_list
[
i
].
ul_cqi
,
UL_info
->
rx_ind
.
pdu_list
[
i
].
rssi
);
}
break
;
}
}
// for (j=0;j<UL_info->crc_ind.number_crcs;j++)
}
// for (i=0;i<UL_info->rx_ind.number_of_pdus;i++)
UL_info
->
crc_ind
.
number_crcs
=
0
;
UL_info
->
rx_ind
.
number_of_pdus
=
0
;
}
else
if
(
UL_info
->
rx_ind
.
number_of_pdus
!=
0
||
UL_info
->
crc_ind
.
number_crcs
!=
0
)
{
LOG_E
(
PHY
,
"hoping not to have mis-match between CRC ind and RX ind - hopefully the missing message is coming shortly rx_ind:%d(SFN/SL:%d/%d) crc_ind:%d(SFN/SL:%d/%d)
\n
"
,
UL_info
->
rx_ind
.
number_of_pdus
,
UL_info
->
rx_ind
.
sfn
,
UL_info
->
rx_ind
.
slot
,
UL_info
->
crc_ind
.
number_crcs
,
UL_info
->
rx_ind
.
sfn
,
UL_info
->
rx_ind
.
slot
);
}
void
handle_nr_ulsch
(
NR_UL_IND_t
*
UL_info
)
{
if
(
UL_info
->
rx_ind
.
number_of_pdus
>
0
&&
UL_info
->
crc_ind
.
number_crcs
>
0
)
{
for
(
int
i
=
0
;
i
<
UL_info
->
rx_ind
.
number_of_pdus
;
i
++
)
{
for
(
int
j
=
0
;
j
<
UL_info
->
crc_ind
.
number_crcs
;
j
++
)
{
// find crc_indication j corresponding rx_indication i
const
nfapi_nr_rx_data_pdu_t
*
rx
=
&
UL_info
->
rx_ind
.
pdu_list
[
i
];
const
nfapi_nr_crc_t
*
crc
=
&
UL_info
->
crc_ind
.
crc_list
[
j
];
LOG_D
(
PHY
,
"UL_info->crc_ind.pdu_list[%d].rnti:%04x "
"UL_info->rx_ind.pdu_list[%d].rnti:%04x
\n
"
,
j
,
crc
->
rnti
,
i
,
rx
->
rnti
);
if
(
crc
->
rnti
!=
rx
->
rnti
)
continue
;
LOG_D
(
MAC
,
"%4d.%2d Calling rx_sdu (CRC %s/tb_crc_status %d)
\n
"
,
UL_info
->
frame
,
UL_info
->
slot
,
crc
->
tb_crc_status
?
"error"
:
"ok"
,
crc
->
tb_crc_status
);
/* if CRC passes, pass PDU, otherwise pass NULL as error indication */
nr_rx_sdu
(
UL_info
->
module_id
,
UL_info
->
CC_id
,
UL_info
->
rx_ind
.
sfn
,
UL_info
->
rx_ind
.
slot
,
rx
->
rnti
,
crc
->
tb_crc_status
?
NULL
:
rx
->
pdu
,
rx
->
pdu_length
,
rx
->
timing_advance
,
rx
->
ul_cqi
,
rx
->
rssi
);
handle_nr_ul_harq
(
UL_info
->
module_id
,
UL_info
->
frame
,
UL_info
->
slot
,
crc
);
break
;
}
// for (j=0;j<UL_info->crc_ind.number_crcs;j++)
}
// for (i=0;i<UL_info->rx_ind.number_of_pdus;i++)
UL_info
->
crc_ind
.
number_crcs
=
0
;
UL_info
->
rx_ind
.
number_of_pdus
=
0
;
}
else
if
(
UL_info
->
rx_ind
.
number_of_pdus
!=
0
||
UL_info
->
crc_ind
.
number_crcs
!=
0
)
{
LOG_E
(
PHY
,
"hoping not to have mis-match between CRC ind and RX ind - "
"hopefully the missing message is coming shortly "
"rx_ind:%d(SFN/SL:%d/%d) crc_ind:%d(SFN/SL:%d/%d)
\n
"
,
UL_info
->
rx_ind
.
number_of_pdus
,
UL_info
->
rx_ind
.
sfn
,
UL_info
->
rx_ind
.
slot
,
UL_info
->
crc_ind
.
number_crcs
,
UL_info
->
rx_ind
.
sfn
,
UL_info
->
rx_ind
.
slot
);
}
}
...
...
@@ -218,10 +195,10 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
handle_nr_rach
(
UL_info
);
handle_nr_uci
(
UL_info
,
&
mac
->
UE_info
.
UE_sched_ctrl
[
0
],
&
mac
->
UE_info
.
mac_stats
[
0
],
mac
->
pucch_target_snrx10
);
handle_nr_uci
(
UL_info
);
// clear HI prior to handling ULSCH
mac
->
UL_dci_req
[
CC_id
].
numPdus
=
0
;
handle_nr_ulsch
(
UL_info
,
&
mac
->
UE_info
.
UE_sched_ctrl
[
0
],
&
mac
->
UE_info
.
mac_stats
[
0
]
);
handle_nr_ulsch
(
UL_info
);
if
(
nfapi_mode
!=
1
)
{
if
(
ifi
->
CC_mask
==
((
1
<<
MAX_NUM_CCs
)
-
1
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment