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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
OpenXG
OpenXG-RAN
Commits
00ac4f0b
Commit
00ac4f0b
authored
Feb 13, 2025
by
francescomani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
functions to read BSR tables
parent
26c94a34
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
26 deletions
+38
-26
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
+12
-0
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
+2
-1
openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h
openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h
+0
-11
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
+20
-10
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
+4
-4
No files found.
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
View file @
00ac4f0b
...
@@ -45,6 +45,12 @@ const uint32_t NR_SHORT_BSR_TABLE[NR_SHORT_BSR_TABLE_SIZE] = {
...
@@ -45,6 +45,12 @@ const uint32_t NR_SHORT_BSR_TABLE[NR_SHORT_BSR_TABLE_SIZE] = {
20516
,
28581
,
39818
,
55474
,
77284
,
107669
,
150000
,
300000
20516
,
28581
,
39818
,
55474
,
77284
,
107669
,
150000
,
300000
};
};
uint32_t
get_short_bsr_value
(
int
idx
)
{
AssertFatal
(
idx
<
NR_SHORT_BSR_TABLE_SIZE
,
"Short BSR table index %d exceeding its size
\n
"
,
idx
);
return
NR_SHORT_BSR_TABLE
[
idx
];
}
//38.321 Table 6.1.3.1-2
//38.321 Table 6.1.3.1-2
const
uint32_t
NR_LONG_BSR_TABLE
[
NR_LONG_BSR_TABLE_SIZE
]
=
{
const
uint32_t
NR_LONG_BSR_TABLE
[
NR_LONG_BSR_TABLE_SIZE
]
=
{
0
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
22
,
23
,
25
,
26
,
0
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
20
,
22
,
23
,
25
,
26
,
...
@@ -65,6 +71,12 @@ const uint32_t NR_LONG_BSR_TABLE[NR_LONG_BSR_TABLE_SIZE] ={
...
@@ -65,6 +71,12 @@ const uint32_t NR_LONG_BSR_TABLE[NR_LONG_BSR_TABLE_SIZE] ={
35910462
,
38241455
,
40723756
,
43367187
,
46182206
,
49179951
,
52372284
,
55771835
,
59392055
,
63247269
,
67352729
,
71724679
,
76380419
,
81338368
,
162676736
,
4294967295
35910462
,
38241455
,
40723756
,
43367187
,
46182206
,
49179951
,
52372284
,
55771835
,
59392055
,
63247269
,
67352729
,
71724679
,
76380419
,
81338368
,
162676736
,
4294967295
};
};
uint32_t
get_long_bsr_value
(
int
idx
)
{
AssertFatal
(
idx
<
NR_LONG_BSR_TABLE_SIZE
,
"Short BSR table index %d exceeding its size
\n
"
,
idx
);
return
NR_LONG_BSR_TABLE
[
idx
];
}
// start symbols for SSB types A,B,C,D,E
// start symbols for SSB types A,B,C,D,E
static
const
uint16_t
symbol_ssb_AC
[
8
]
=
{
2
,
8
,
16
,
22
,
30
,
36
,
44
,
50
};
static
const
uint16_t
symbol_ssb_AC
[
8
]
=
{
2
,
8
,
16
,
22
,
30
,
36
,
44
,
50
};
static
const
uint16_t
symbol_ssb_BD
[
64
]
=
{
4
,
8
,
16
,
20
,
32
,
36
,
44
,
48
,
60
,
64
,
72
,
76
,
88
,
92
,
100
,
104
,
static
const
uint16_t
symbol_ssb_BD
[
64
]
=
{
4
,
8
,
16
,
20
,
32
,
36
,
44
,
48
,
60
,
64
,
72
,
76
,
88
,
92
,
100
,
104
,
...
...
openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
View file @
00ac4f0b
...
@@ -55,7 +55,8 @@ typedef enum {
...
@@ -55,7 +55,8 @@ typedef enum {
uint32_t
get_Y
(
const
NR_SearchSpace_t
*
ss
,
int
slot
,
rnti_t
rnti
);
uint32_t
get_Y
(
const
NR_SearchSpace_t
*
ss
,
int
slot
,
rnti_t
rnti
);
uint8_t
get_BG
(
uint32_t
A
,
uint16_t
R
);
uint8_t
get_BG
(
uint32_t
A
,
uint16_t
R
);
uint32_t
get_short_bsr_value
(
int
idx
);
uint32_t
get_long_bsr_value
(
int
idx
);
int16_t
fill_dmrs_mask
(
const
NR_PDSCH_Config_t
*
pdsch_Config
,
int16_t
fill_dmrs_mask
(
const
NR_PDSCH_Config_t
*
pdsch_Config
,
int
dci_format
,
int
dci_format
,
int
dmrs_TypeA_Position
,
int
dmrs_TypeA_Position
,
...
...
openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h
View file @
00ac4f0b
...
@@ -32,16 +32,5 @@
...
@@ -32,16 +32,5 @@
#ifndef __NR_MAC_EXTERN_H__
#ifndef __NR_MAC_EXTERN_H__
#define __NR_MAC_EXTERN_H__
#define __NR_MAC_EXTERN_H__
#include "common/ran_context.h"
#include "nr_mac.h"
/*#include "PHY/defs_common.h"*/
/* Scheduler */
extern
RAN_CONTEXT_t
RC
;
extern
uint8_t
nfapi_mode
;
extern
const
uint32_t
NR_SHORT_BSR_TABLE
[
NR_SHORT_BSR_TABLE_SIZE
];
extern
const
uint32_t
NR_LONG_BSR_TABLE
[
NR_LONG_BSR_TABLE_SIZE
];
#endif //DEF_H
#endif //DEF_H
openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
View file @
00ac4f0b
...
@@ -1701,28 +1701,38 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
...
@@ -1701,28 +1701,38 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
}
}
}
}
static
uint8_t
nr_locate_BsrIndexByBufferSize
(
const
uint32_t
*
table
,
int
size
,
int
value
)
static
uint8_t
nr_locate_BsrIndexByBufferSize
(
int
size
,
int
value
)
{
{
if
(
value
==
0
)
{
if
(
value
==
0
)
{
return
0
;
//elseif (value > 150000) return 63;
return
0
;
//elseif (value > 150000) return 63;
}
}
uint32_t
(
*
get_bsr_value
)(
int
);
if
(
size
==
NR_SHORT_BSR_TABLE_SIZE
)
get_bsr_value
=
&
get_short_bsr_value
;
else
get_bsr_value
=
&
get_long_bsr_value
;
int
jl
=
0
;
// lower bound
int
jl
=
0
;
// lower bound
int
ju
=
size
-
1
;
// upper bound
int
ju
=
size
-
1
;
// upper bound
bool
ascend
=
table
[
ju
]
>=
table
[
jl
]
?
1
:
0
;
// determine the order of the the table: 1 if ascending order of table, 0 otherwise
// determine the order of the the table: 1 if ascending order of table, 0 otherwise
bool
ascend
=
(
*
get_bsr_value
)(
ju
)
>=
(
*
get_bsr_value
)(
jl
)
?
1
:
0
;
while
(
ju
-
jl
>
1
)
{
//If we are not yet done,
while
(
ju
-
jl
>
1
)
{
//If we are not yet done,
int
jm
=
(
ju
+
jl
)
/
2
;
// compute a midpoint,
int
jm
=
(
ju
+
jl
)
/
2
;
// compute a midpoint,
if
((
value
>=
table
[
jm
]
)
==
ascend
)
{
if
((
value
>=
(
*
get_bsr_value
)(
jm
)
)
==
ascend
)
{
jl
=
jm
;
// replace the lower limit
jl
=
jm
;
// replace the lower limit
}
else
{
}
else
{
ju
=
jm
;
//replace the upper limit
ju
=
jm
;
//replace the upper limit
}
}
LOG_T
(
NR_MAC
,
"[UE] searching BSR index %d for (BSR TABLE %d < value %d)
\n
"
,
LOG_T
(
NR_MAC
,
jm
,
table
[
jm
],
value
);
"[UE] searching BSR index %d for (BSR TABLE %d < value %d)
\n
"
,
jm
,
(
*
get_bsr_value
)(
jm
),
value
);
}
}
if
(
value
==
table
[
jl
]
)
{
if
(
value
==
(
*
get_bsr_value
)(
jl
)
)
{
return
jl
;
return
jl
;
}
else
{
}
else
{
return
jl
+
1
;
//equally ju
return
jl
+
1
;
//equally ju
...
@@ -3144,7 +3154,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac,
...
@@ -3144,7 +3154,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac,
mac_ce_p
->
bsr
.
type_bsr
=
b_short
;
mac_ce_p
->
bsr
.
type_bsr
=
b_short
;
mac_ce_p
->
bsr
.
bsr
.
s
.
LcgID
=
lcg_id_bsr_max
;
mac_ce_p
->
bsr
.
bsr
.
s
.
LcgID
=
lcg_id_bsr_max
;
mac_ce_p
->
bsr
.
bsr
.
s
.
Buffer_size
=
mac_ce_p
->
bsr
.
bsr
.
s
.
Buffer_size
=
nr_locate_BsrIndexByBufferSize
(
NR_SHORT_BSR_TABLE
,
NR_SHORT_BSR_TABLE
_SIZE
,
LCG_bytes
[
lcg_id_bsr_max
]);
nr_locate_BsrIndexByBufferSize
(
NR_SHORT_BSR_TABLE_SIZE
,
LCG_bytes
[
lcg_id_bsr_max
]);
LOG_D
(
NR_MAC
,
LOG_D
(
NR_MAC
,
"[UE %d] sfn %d.%d BSR Trigger=0x%x report SHORT BSR with level %d for LCGID %d
\n
"
,
"[UE %d] sfn %d.%d BSR Trigger=0x%x report SHORT BSR with level %d for LCGID %d
\n
"
,
mac
->
ue_id
,
mac
->
ue_id
,
...
@@ -3159,7 +3169,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac,
...
@@ -3159,7 +3169,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac,
mac_ce_p
->
bsr
.
type_bsr
=
b_long
;
mac_ce_p
->
bsr
.
type_bsr
=
b_long
;
uint8_t
*
tmp
=
mac_ce_p
->
bsr
.
bsr
.
lcg_bsr
;
uint8_t
*
tmp
=
mac_ce_p
->
bsr
.
bsr
.
lcg_bsr
;
for
(
int
lcg_id
=
0
;
lcg_id
<
8
;
lcg_id
++
)
{
for
(
int
lcg_id
=
0
;
lcg_id
<
8
;
lcg_id
++
)
{
tmp
[
lcg_id
]
=
nr_locate_BsrIndexByBufferSize
(
NR_LONG_BSR_TABLE
,
NR_LONG_BSR_TABLE
_SIZE
,
LCG_bytes
[
lcg_id
]);
tmp
[
lcg_id
]
=
nr_locate_BsrIndexByBufferSize
(
NR_LONG_BSR_TABLE_SIZE
,
LCG_bytes
[
lcg_id
]);
}
}
LOG_D
(
NR_MAC
,
LOG_D
(
NR_MAC
,
"[UE %d] sfn %d.%d BSR Trig=0x%x report LONG BSR (level LCGID %d %d %d %d %d %d %d %d)
\n
"
,
"[UE %d] sfn %d.%d BSR Trig=0x%x report LONG BSR (level LCGID %d %d %d %d %d %d %d %d)
\n
"
,
...
@@ -3179,7 +3189,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac,
...
@@ -3179,7 +3189,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac,
mac_ce_p
->
bsr
.
type_bsr
=
b_short_trunc
;
mac_ce_p
->
bsr
.
type_bsr
=
b_short_trunc
;
mac_ce_p
->
bsr
.
bsr
.
s
.
LcgID
=
lcg_id_bsr_max
;
mac_ce_p
->
bsr
.
bsr
.
s
.
LcgID
=
lcg_id_bsr_max
;
mac_ce_p
->
bsr
.
bsr
.
s
.
Buffer_size
=
mac_ce_p
->
bsr
.
bsr
.
s
.
Buffer_size
=
nr_locate_BsrIndexByBufferSize
(
NR_SHORT_BSR_TABLE
,
NR_SHORT_BSR_TABLE
_SIZE
,
LCG_bytes
[
lcg_id_bsr_max
]);
nr_locate_BsrIndexByBufferSize
(
NR_SHORT_BSR_TABLE_SIZE
,
LCG_bytes
[
lcg_id_bsr_max
]);
}
else
if
(
padding_len
>=
sizeof
(
NR_BSR_LONG
)
+
sizeof
(
NR_MAC_SUBHEADER_SHORT
))
{
}
else
if
(
padding_len
>=
sizeof
(
NR_BSR_LONG
)
+
sizeof
(
NR_MAC_SUBHEADER_SHORT
))
{
mac_ce_p
->
bsr
.
type_bsr
=
b_long_trunc
;
mac_ce_p
->
bsr
.
type_bsr
=
b_long_trunc
;
// Fixme: this should be sorted by (TS 38.321, 5.4.5)
// Fixme: this should be sorted by (TS 38.321, 5.4.5)
...
@@ -3188,7 +3198,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac,
...
@@ -3188,7 +3198,7 @@ static void nr_ue_get_sdu_mac_ce_post(NR_UE_MAC_INST_t *mac,
// available for transmission) in each of these LCG(s), and in case of equal priority, in increasing order of LCGID
// available for transmission) in each of these LCG(s), and in case of equal priority, in increasing order of LCGID
uint8_t
*
tmp
=
mac_ce_p
->
bsr
.
bsr
.
lcg_bsr
;
uint8_t
*
tmp
=
mac_ce_p
->
bsr
.
bsr
.
lcg_bsr
;
for
(
int
lcg_id
=
0
;
lcg_id
<
8
;
lcg_id
++
)
{
for
(
int
lcg_id
=
0
;
lcg_id
<
8
;
lcg_id
++
)
{
tmp
[
lcg_id
]
=
nr_locate_BsrIndexByBufferSize
(
NR_LONG_BSR_TABLE
,
NR_LONG_BSR_TABLE
_SIZE
,
LCG_bytes
[
lcg_id
]);
tmp
[
lcg_id
]
=
nr_locate_BsrIndexByBufferSize
(
NR_LONG_BSR_TABLE_SIZE
,
LCG_bytes
[
lcg_id
]);
}
}
}
else
}
else
LOG_D
(
NR_MAC
,
"Can't add any BSR, not enough padding
\n
"
);
LOG_D
(
NR_MAC
,
"Can't add any BSR, not enough padding
\n
"
);
...
...
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
View file @
00ac4f0b
...
@@ -112,9 +112,9 @@ static int estimate_ul_buffer_short_bsr(const NR_BSR_SHORT *bsr)
...
@@ -112,9 +112,9 @@ static int estimate_ul_buffer_short_bsr(const NR_BSR_SHORT *bsr)
* differentiate them */
* differentiate them */
int
rep_idx
=
bsr
->
Buffer_size
;
int
rep_idx
=
bsr
->
Buffer_size
;
int
estim_idx
=
overestim_bsr_index
(
rep_idx
);
int
estim_idx
=
overestim_bsr_index
(
rep_idx
);
int
max
=
sizeofArray
(
NR_SHORT_BSR_TABLE
)
-
1
;
int
max
=
NR_SHORT_BSR_TABLE_SIZE
-
1
;
int
idx
=
min
(
estim_idx
,
max
);
int
idx
=
min
(
estim_idx
,
max
);
int
estim_size
=
NR_SHORT_BSR_TABLE
[
idx
]
;
int
estim_size
=
get_short_bsr_value
(
idx
)
;
LOG_D
(
NR_MAC
,
"short BSR LCGID %d index %d estim index %d size %d
\n
"
,
bsr
->
LcgID
,
rep_idx
,
estim_idx
,
estim_size
);
LOG_D
(
NR_MAC
,
"short BSR LCGID %d index %d estim index %d size %d
\n
"
,
bsr
->
LcgID
,
rep_idx
,
estim_idx
,
estim_size
);
return
estim_size
;
return
estim_size
;
}
}
...
@@ -134,7 +134,7 @@ static int estimate_ul_buffer_long_bsr(const NR_BSR_LONG *bsr)
...
@@ -134,7 +134,7 @@ static int estimate_ul_buffer_long_bsr(const NR_BSR_LONG *bsr)
bool
bsr_active
[
8
]
=
{
bsr
->
LcgID0
!=
0
,
bsr
->
LcgID1
!=
0
,
bsr
->
LcgID2
!=
0
,
bsr
->
LcgID3
!=
0
,
bsr
->
LcgID4
!=
0
,
bsr
->
LcgID5
!=
0
,
bsr
->
LcgID6
!=
0
,
bsr
->
LcgID7
!=
0
};
bool
bsr_active
[
8
]
=
{
bsr
->
LcgID0
!=
0
,
bsr
->
LcgID1
!=
0
,
bsr
->
LcgID2
!=
0
,
bsr
->
LcgID3
!=
0
,
bsr
->
LcgID4
!=
0
,
bsr
->
LcgID5
!=
0
,
bsr
->
LcgID6
!=
0
,
bsr
->
LcgID7
!=
0
};
int
estim_size
=
0
;
int
estim_size
=
0
;
int
max
=
sizeofArray
(
NR_LONG_BSR_TABLE
)
-
1
;
int
max
=
NR_LONG_BSR_TABLE_SIZE
-
1
;
uint8_t
*
payload
=
((
uint8_t
*
)
bsr
)
+
1
;
uint8_t
*
payload
=
((
uint8_t
*
)
bsr
)
+
1
;
int
m
=
0
;
int
m
=
0
;
const
int
total_lcgids
=
8
;
/* see 38.321 6.1.3.1 */
const
int
total_lcgids
=
8
;
/* see 38.321 6.1.3.1 */
...
@@ -144,7 +144,7 @@ static int estimate_ul_buffer_long_bsr(const NR_BSR_LONG *bsr)
...
@@ -144,7 +144,7 @@ static int estimate_ul_buffer_long_bsr(const NR_BSR_LONG *bsr)
int
rep_idx
=
payload
[
m
];
int
rep_idx
=
payload
[
m
];
int
estim_idx
=
overestim_bsr_index
(
rep_idx
);
int
estim_idx
=
overestim_bsr_index
(
rep_idx
);
int
idx
=
min
(
estim_idx
,
max
);
int
idx
=
min
(
estim_idx
,
max
);
estim_size
+=
NR_LONG_BSR_TABLE
[
idx
]
;
estim_size
+=
get_long_bsr_value
(
idx
)
;
LOG_D
(
NR_MAC
,
"LONG BSR LCGID/m %d/%d Index %d estim index %d size %d"
,
n
,
m
,
rep_idx
,
estim_idx
,
estim_size
);
LOG_D
(
NR_MAC
,
"LONG BSR LCGID/m %d/%d Index %d estim index %d size %d"
,
n
,
m
,
rep_idx
,
estim_idx
,
estim_size
);
m
++
;
m
++
;
...
...
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