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
lizhongxiao
OpenXG-RAN
Commits
198c3197
Commit
198c3197
authored
Oct 05, 2023
by
Raymond Knopp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
intermediate commit
parent
18d720f3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
181 additions
and
81 deletions
+181
-81
openair2/LAYER2/NR_MAC_UE/mac_defs.h
openair2/LAYER2/NR_MAC_UE/mac_defs.h
+1
-1
openair2/LAYER2/NR_MAC_UE/nr_slsch_scheduler.c
openair2/LAYER2/NR_MAC_UE/nr_slsch_scheduler.c
+46
-40
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures_sl.c
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures_sl.c
+37
-34
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
+97
-6
No files found.
openair2/LAYER2/NR_MAC_UE/mac_defs.h
View file @
198c3197
...
...
@@ -612,7 +612,7 @@ typedef struct {
sl_nr_ue_mac_params_t
*
SL_MAC_PARAMS
;
// SIDELINK Scheduling fields
NR_SL_UEs_t
UE
_info
;
NR_SL_UEs_t
sl
_info
;
// current SCI pdu build from SCI1 and SCI2
nr_sci_pdu_t
sci_pdu_rx
;
...
...
openair2/LAYER2/NR_MAC_UE/nr_slsch_scheduler.c
View file @
198c3197
...
...
@@ -40,52 +40,58 @@
#include "NR_MAC_UE/mac_extern.h"
#include "NR_MAC_UE/nr_ue_sci.h"
bool
nr_schedule_slsch
(
nr_sci_pdu_t
*
sci_pdu
,
nr_sci_pdu_t
*
sci2_pdu
,
uint8_t
*
slsch_pdu
,
nr_sci_format_t
format2
,
uint16_t
*
slsch_pdu_length
)
{
bool
nr_schedule_slsch
(
int
frameP
,
int
slotP
,
nr_sci_pdu_t
*
sci_pdu
,
nr_sci_pdu_t
*
sci2_pdu
,
uint8_t
*
slsch_pdu
,
nr_sci_format_t
format2
,
uint16_t
*
slsch_pdu_length_max
)
{
mac_rlc_status_resp_t
rlc_status
=
mac_rlc_status_ind
(
0
,
0
,
0
,
frameP
,
slotP
,
ENB_FLAG_NO
,
MBMS_FLAG_NO
,
4
,
0
,
0
);
if
(
rlc_status
.
bytes_in_buffer
>
0
)
{
// Fill SCI1A
sci_pdu
->
priority
=
0
;
sci_pdu
->
frequency_resource_assignment
.
val
=
0
;
sci_pdu
->
time_resource_assignment
.
val
=
0
;
sci_pdu
->
resource_reservation_period
.
val
=
0
;
sci_pdu
->
dmrs_pattern
.
val
=
0
;
sci_pdu
->
second_stage_sci_format
=
0
;
sci_pdu
->
number_of_dmrs_port
=
0
;
sci_pdu
->
mcs
=
9
;
sci_pdu
->
additional_mcs
.
val
=
0
;
sci_pdu
->
psfch_overhead
.
val
=
0
;
sci_pdu
->
reserved
.
val
=
0
;
sci_pdu
->
conflict_information_receiver
.
val
=
0
;
sci_pdu
->
beta_offset_indicator
=
0
;
sci_pdu
->
priority
=
0
;
sci_pdu
->
frequency_resource_assignment
.
val
=
0
;
sci_pdu
->
time_resource_assignment
.
val
=
0
;
sci_pdu
->
resource_reservation_period
.
val
=
0
;
sci_pdu
->
dmrs_pattern
.
val
=
0
;
sci_pdu
->
second_stage_sci_format
=
0
;
sci_pdu
->
number_of_dmrs_port
=
0
;
sci_pdu
->
mcs
=
9
;
sci_pdu
->
additional_mcs
.
val
=
0
;
sci_pdu
->
psfch_overhead
.
val
=
0
;
sci_pdu
->
reserved
.
val
=
0
;
sci_pdu
->
conflict_information_receiver
.
val
=
0
;
sci_pdu
->
beta_offset_indicator
=
0
;
// Fill SCI2A
sci2_pdu
->
harq_pid
=
0
;
sci2_pdu
->
ndi
=
(
1
-
sci2_pdu
->
ndi
)
&
1
;
sci2_pdu
->
rv_index
=
0
;
sci2_pdu
->
source_id
=
0x12
;
sci2_pdu
->
dest_id
=
0xabcd
;
sci2_pdu
->
harq_feedback
=
1
;
sci2_pdu
->
cast_type
=
0
;
if
(
format2
==
NR_SL_SCI_FORMAT_2C
||
format2
==
NR_SL_SCI_FORMAT_2A
)
sci2_pdu
->
csi_req
=
1
;
if
(
format2
==
NR_SL_SCI_FORMAT_2B
)
sci2_pdu
->
zone_id
=
0
;
sci2_pdu
->
harq_pid
=
0
;
sci2_pdu
->
ndi
=
(
1
-
sci2_pdu
->
ndi
)
&
1
;
sci2_pdu
->
rv_index
=
0
;
sci2_pdu
->
source_id
=
0x12
;
sci2_pdu
->
dest_id
=
0xabcd
;
sci2_pdu
->
harq_feedback
=
1
;
sci2_pdu
->
cast_type
=
0
;
if
(
format2
==
NR_SL_SCI_FORMAT_2C
||
format2
==
NR_SL_SCI_FORMAT_2A
)
sci2_pdu
->
csi_req
=
1
;
if
(
format2
==
NR_SL_SCI_FORMAT_2B
)
sci2_pdu
->
zone_id
=
0
;
// Fill in for R17: communication_range
sci2_pdu
->
communication_range
.
val
=
0
;
if
(
format2
==
NR_SL_SCI_FORMAT_2C
)
{
sci2_pdu
->
providing_req_ind
=
0
;
// Fill in for R17 : resource combinations
sci2_pdu
->
resource_combinations
.
val
=
0
;
sci2_pdu
->
first_resource_location
=
0
;
// Fill in for R17 : reference_slot_location
sci2_pdu
->
reference_slot_location
.
val
=
0
;
sci2_pdu
->
resource_set_type
=
0
;
// Fill in for R17 : lowest_subchannel_indices
sci2_pdu
->
lowest_subchannel_indices
.
val
=
0
;
}
sci2_pdu
->
communication_range
.
val
=
0
;
if
(
format2
==
NR_SL_SCI_FORMAT_2C
)
{
sci2_pdu
->
providing_req_ind
=
0
;
// Fill in for R17 : resource combinations
sci2_pdu
->
resource_combinations
.
val
=
0
;
sci2_pdu
->
first_resource_location
=
0
;
// Fill in for R17 : reference_slot_location
sci2_pdu
->
reference_slot_location
.
val
=
0
;
sci2_pdu
->
resource_set_type
=
0
;
// Fill in for R17 : lowest_subchannel_indices
sci2_pdu
->
lowest_subchannel_indices
.
val
=
0
;
}
// Set SLSCH
*
slsch_pdu_length
=
1024
;
for
(
uint32_t
n
=
0
;
n
<*
slsch_pdu_length
;
n
++
)
slsch_pdu
[
n
]
=
(
uint8_t
)(
n
&
255
);
return
true
;
*
slsch_pdu_length_max
=
rlc_status
.
bytes_in_buffer
;
return
true
;
}
return
false
;
}
openair2/LAYER2/NR_MAC_UE/nr_ue_procedures_sl.c
View file @
198c3197
...
...
@@ -590,7 +590,8 @@ void nr_ue_process_mac_sl_pdu(int module_idP,
}
LOG_I
(
NR_MAC
,
"In %s : processing PDU %d (with length %d) of %d total number of PDUs...
\n
"
,
__FUNCTION__
,
pdu_id
,
pdu_len
,
rx_ind
->
number_pdus
);
/*
mac
->
sl_info
while
(
!
done
&&
pdu_len
>
0
){
uint16_t
mac_len
=
0x0000
;
uint16_t
mac_subheader_len
=
0x0001
;
// default to fixed-length subheader = 1-oct
...
...
@@ -600,37 +601,39 @@ void nr_ue_process_mac_sl_pdu(int module_idP,
bool
ret
;
switch
(
rx_lcid
){
// MAC CE
case SL_SCH_LCID_CCCH:
// MSG4 RRC Setup 38.331
// variable length
ret=get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len);
AssertFatal(ret, "The mac_len (%d) has an invalid size. PDU len = %d! \n",
mac_len, pdu_len);
// Check if it is a valid CCCH message, we get all 00's messages very often
int i = 0;
for(i=0; i<(mac_subheader_len+mac_len); i++) {
if(pduP[i] != 0) {
break;
}
}
if (i == (mac_subheader_len+mac_len)) {
LOG_D(NR_MAC, "%s() Invalid CCCH message!, pdu_len: %d\n", __func__, pdu_len);
done = 1;
break;
}
if ( mac_len > 0 ) {
LOG_D(NR_MAC,"DL_SCH_LCID_CCCH (e.g. RRCSetup) with payload len %d\n", mac_len);
for (int i = 0; i < mac_subheader_len; i++) {
LOG_D(NR_MAC, "MAC header %d: 0x%x\n", i, pduP[i]);
}
for (int i = 0; i < mac_len; i++) {
LOG_D(NR_MAC, "%d: 0x%x\n", i, pduP[mac_subheader_len + i]);
}
nr_mac_rrc_data_ind_ue(module_idP, CC_id, gNB_index, frameP, 0, mac->crnti, CCCH, pduP+mac_subheader_len, mac_len);
}
break;
case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH:
*/
case
SL_SCH_LCID_4_19
:
if
(
!
get_mac_len
(
pduP
,
pdu_len
,
&
mac_len
,
&
mac_subheader_len
))
return
;
LOG_D
(
NR_MAC
,
"%4d.%2d : SLSCH -> LCID %d %d bytes
\n
"
,
frameP
,
slot
,
rx_lcid
,
mac_len
);
mac_rlc_data_ind
(
module_idP
,
0
,
0
,
frameP
,
ENB_FLAG_NO
,
MBMS_FLAG_NO
,
rx_lcid
,
(
char
*
)(
pduP
+
mac_subheader_len
),
mac_len
,
1
,
NULL
);
break
;
case
SL_SCH_LCID_SL_CSI_REPORT
:
break
;
case
SL_SCH_LCID_SL_PADDING
:
done
=
1
;
break
;
case
SL_SCH_LCID_SCCH_PC5_NOT_PROT
:
case
SL_SCH_LCID_SCCH_PC5_DSMC
:
case
SL_SCH_LCID_SCCH_PC5_PROT
:
case
SL_SCH_LCID_SCCH_PC5_RRC
:
case
SL_SCH_LCID_20_55
:
case
SL_SCH_LCID_SCCH_RRC_SL_RLC0
:
case
SL_SCH_LCID_SCCH_RRC_SL_RLC1
:
case
SL_SCH_LCID_SCCH_SL_DISCOVERY
:
case
SL_SCH_LCID_SL_INTER_UE_COORD_REQ
:
case
SL_SCH_LCID_SL_INTER_UE_COORD_INFO
:
case
SL_SCH_LCID_SL_DRX_CMD
:
LOG_W
(
NR_MAC
,
"Received unsupported SL LCID %d
\n
"
,
rx_lcid
);
break
;
}
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
View file @
198c3197
...
...
@@ -3265,11 +3265,15 @@ bool nr_ue_sl_pssch_scheduler(NR_UE_MAC_INST_t *mac,
LOG_D
(
NR_MAC
,
"[UE%d] SL-PSSCH SCHEDULER: Frame:SLOT %d:%d, slot_type:%d
\n
"
,
sl_ind
->
module_id
,
frame
,
slot
,
sl_ind
->
slot_type
);
uint16_t
slsch_pdu_length
;
uint16_t
slsch_pdu_length
_max
;
tx_config
->
tx_config_list
[
0
].
tx_pscch_pssch_config_pdu
.
slsch_payload
=
mac
->
slsch_payload
;
bool
schedule_slsch
=
nr_schedule_slsch
(
&
mac
->
sci1_pdu
,
&
mac
->
sci2_pdu
,
tx_config
->
tx_config_list
[
0
].
tx_pscch_pssch_config_pdu
.
slsch_payload
,
NR_SL_SCI_FORMAT_2A
,
&
slsch_pdu_length
);
bool
schedule_slsch
=
nr_schedule_slsch
(
&
mac
->
sci1_pdu
,
&
mac
->
sci2_pdu
,
tx_config
->
tx_config_list
[
0
].
tx_pscch_pssch_config_pdu
.
slsch_payload
,
NR_SL_SCI_FORMAT_2A
,
&
slsch_pdu_length
_max
);
if
(
!
schedule_slsch
)
return
false
;
const
uint8_t
sh_size
=
sizeof
(
NR_MAC_SUBHEADER_LONG
);
uint8_t
*
pdu
=
tx_config
->
tx_config_list
[
0
].
tx_pscch_pssch_config_pdu
.
slsch_payload
;
*
config_type
=
SL_NR_CONFIG_TYPE_TX_PSCCH_PSSCH
;
tx_config
->
number_pdus
=
1
;
tx_config
->
sfn
=
frame
;
...
...
@@ -3280,17 +3284,104 @@ bool nr_ue_sl_pssch_scheduler(NR_UE_MAC_INST_t *mac,
sl_res_pool
,
&
mac
->
sci1_pdu
,
&
mac
->
sci2_pdu
,
slsch_pdu_length
,
slsch_pdu_length
_max
,
NR_SL_SCI_FORMAT_1A
,
NR_SL_SCI_FORMAT_2A
);
int
buflen
=
tx_config
->
tx_config_list
[
0
].
tx_pscch_pssch_config_pdu
.
tb_size
;
LOG_I
(
NR_MAC
,
"[UE%d] TTI-%d:%d TX PSCCH_PSSCH REQ
\n
"
,
sl_ind
->
module_id
,
frame
,
slot
);
NR_UE_MAC_CE_INFO
mac_ce_info
;
NR_UE_MAC_CE_INFO
*
mac_ce_p
=&
mac_ce_info
;
mac_ce_p
->
bsr_len
=
0
;
mac_ce_p
->
bsr_ce_len
=
0
;
mac_ce_p
->
bsr_header_len
=
0
;
mac_ce_p
->
phr_len
=
0
;
LOG_I
(
NR_MAC
,
"[UE%d] TTI-%d:%d TX PSCCH_PSSCH REQ TBS %d
\n
"
,
sl_ind
->
module_id
,
frame
,
slot
,
buflen
);
//nr_ue_get_sdu_mac_ce_pre updates all mac_ce related header field related to length
mac_ce_p
->
tot_mac_ce_len
=
nr_ue_get_sdu_mac_ce_pre
(
module_idP
,
CC_id
,
frameP
,
subframe
,
gNB_index
,
ulsch_buffer
,
buflen
,
mac_ce_p
);
mac_ce_p
->
total_mac_pdu_header_len
=
mac_ce_p
->
tot_mac_ce_len
;
ret_status
=
schedule_slsch
;
buflen_remain
=
buflen
-
(
mac_ce_p
->
total_mac_pdu_header_len
+
mac_ce_p
->
sdu_length_total
+
sh_size
)
;
return
ret_status
;
LOG_D
(
NR_MAC
,
"In %s: [UE %d] [%d.%d] SL-DXCH -> SLSCH, RLC with LCID 0x%02x (TBS %d bytes, sdu_length_total %d bytes, MAC header len %d bytes, buflen_remain %d bytes)
\n
"
,
__FUNCTION__
,
module_idP
,
frameP
,
subframe
,
lcid
,
buflen
,
mac_ce_p
->
sdu_length_total
,
mac_ce_p
->
tot_mac_ce_len
,
buflen_remain
);
while
(
buflen_remain
>
0
){
// Pointer used to build the MAC sub-PDU headers in the ULSCH buffer for each SDU
NR_MAC_SUBHEADER_LONG
*
header
=
(
NR_MAC_SUBHEADER_LONG
*
)
pdu
;
pdu
+=
sh_size
;
sdu_length
=
mac_rlc_data_req
(
module_idP
,
0
,
0
,
frameP
,
ENB_FLAG_NO
,
MBMS_FLAG_NO
,
lcid
,
buflen_remain
,
(
char
*
)
pdu
,
0
,
0
);
AssertFatal
(
buflen_remain
>=
sdu_length
,
"In %s: LCID = 0x%02x RLC has segmented %d bytes but MAC has max %d remaining bytes
\n
"
,
__FUNCTION__
,
lcid
,
sdu_length
,
buflen_remain
);
if
(
sdu_length
>
0
)
{
LOG_D
(
NR_MAC
,
"In %s: [UE %d] [%d.%d] SL-DXCH -> SLSCH, Generating SL MAC sub-PDU for SDU %d, length %d bytes, RB with LCID 0x%02x (buflen (TBS) %d bytes)
\n
"
,
__FUNCTION__
,
module_idP
,
frameP
,
subframe
,
num_sdus
+
1
,
sdu_length
,
lcid
,
buflen
);
header
->
R
=
0
;
header
->
F
=
1
;
header
->
LCID
=
lcid
;
header
->
L
=
htons
(
sdu_length
);
#ifdef ENABLE_SLMAC_PAYLOAD_DEBUG
LOG_I
(
NR_MAC
,
"In %s: dumping MAC sub-header with length %d:
\n
"
,
__FUNCTION__
,
sh_size
);
log_dump
(
NR_MAC
,
header
,
sh_size
,
LOG_DUMP_CHAR
,
"
\n
"
);
LOG_I
(
NR_MAC
,
"In %s: dumping MAC SDU with length %d
\n
"
,
__FUNCTION__
,
sdu_length
);
log_dump
(
NR_MAC
,
pdu
,
sdu_length
,
LOG_DUMP_CHAR
,
"
\n
"
);
#endif
pdu
+=
sdu_length
;
mac_ce_p
->
sdu_length_total
+=
sdu_length
;
mac_ce_p
->
total_mac_pdu_header_len
+=
sh_size
;
num_sdus
++
;
}
else
{
pdu
-=
sh_size
;
LOG_D
(
NR_MAC
,
"In %s: no data to transmit for RB with LCID 0x%02x
\n
"
,
__FUNCTION__
,
lcid
);
break
;
}
buflen_remain
=
buflen
-
(
mac_ce_p
->
total_mac_pdu_header_len
+
mac_ce_p
->
sdu_length_total
+
sh_size
);
}
}
return
true
;
}
void
nr_ue_sl_pscch_rx_scheduler
(
nr_sidelink_indication_t
*
sl_ind
,
...
...
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