diff --git a/ci-scripts/conf_files/gnb-cu.sa.f1.conf b/ci-scripts/conf_files/gnb-cu.sa.f1.conf index 1cd2d76318..2126aac17f 100644 --- a/ci-scripts/conf_files/gnb-cu.sa.f1.conf +++ b/ci-scripts/conf_files/gnb-cu.sa.f1.conf @@ -22,8 +22,8 @@ gNBs = tr_s_preference = "f1"; - local_s_address = "192.168.68.194"; - remote_s_address = "192.168.68.195"; + local_s_address = "127.0.0.4"; + remote_s_address = "127.0.0.5"; local_s_portc = 501; local_s_portd = 2153; remote_s_portc = 500; @@ -44,8 +44,8 @@ gNBs = NETWORK_INTERFACES : { - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.68.194"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.68.194"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.16.109"; + GNB_IPV4_ADDRESS_FOR_NGU = "172.21.16.109"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; } diff --git a/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf b/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf index 7f7daa1370..153e7f77a3 100644 --- a/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf +++ b/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf @@ -23,8 +23,8 @@ gNBs = tr_s_preference = "f1"; - local_s_address = "192.168.68.194"; - remote_s_address = "192.168.68.195"; + local_s_address = "127.0.0.4"; + remote_s_address = "127.0.0.5"; local_s_portc = 501; local_s_portd = 2153; remote_s_portc = 500; @@ -46,16 +46,16 @@ gNBs = ( { type = "cp"; - ipv4_cucp = "192.168.68.194"; + ipv4_cucp = "127.0.0.4"; port_cucp = 38462; - ipv4_cuup = "192.168.68.196"; + ipv4_cuup = "127.0.0.6"; port_cuup = 38462; } ) NETWORK_INTERFACES : { - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.68.194"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.16.109"; }; } ); diff --git a/ci-scripts/conf_files/gnb-cuup.sa.f1.quectel.conf b/ci-scripts/conf_files/gnb-cuup.sa.f1.quectel.conf index 2b231e950d..fa6532be7b 100644 --- a/ci-scripts/conf_files/gnb-cuup.sa.f1.quectel.conf +++ b/ci-scripts/conf_files/gnb-cuup.sa.f1.quectel.conf @@ -21,8 +21,8 @@ gNBs = tr_s_preference = "f1"; - local_s_address = "192.168.68.196"; - remote_s_address = "192.168.68.195"; + local_s_address = "127.0.0.6"; + remote_s_address = "127.0.0.5"; local_s_portc = 501; local_s_portd = 2153; remote_s_portc = 500; @@ -40,15 +40,15 @@ gNBs = ( { type = "up"; - ipv4_cucp = "192.168.68.194"; - ipv4_cuup = "192.168.68.196"; + ipv4_cucp = "127.0.0.4"; + ipv4_cuup = "127.0.0.6"; } ) NETWORK_INTERFACES : { - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.68.196"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.68.196"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.16.109"; + GNB_IPV4_ADDRESS_FOR_NGU = "172.21.16.109"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; } diff --git a/ci-scripts/conf_files/gnb-du.sa.band1.52prb.usrpb210.conf b/ci-scripts/conf_files/gnb-du.sa.band1.52prb.usrpb210.conf index 5afadb781a..7c4550b346 100644 --- a/ci-scripts/conf_files/gnb-du.sa.band1.52prb.usrpb210.conf +++ b/ci-scripts/conf_files/gnb-du.sa.band1.52prb.usrpb210.conf @@ -162,8 +162,8 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "f1"; - local_n_address = "192.168.68.195"; - remote_n_address = "192.168.68.194"; + local_n_address = "127.0.0.5"; + remote_n_address = "127.0.0.4"; local_n_portc = 500; local_n_portd = 2153; remote_n_portc = 501; diff --git a/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf index 07be610807..24a81ae0ae 100644 --- a/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf +++ b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf @@ -169,8 +169,8 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "f1"; - local_n_address = "192.168.68.195"; - remote_n_address = "192.168.68.194"; + local_n_address = "127.0.0.5"; + remote_n_address = "127.0.0.4"; local_n_portc = 500; local_n_portd = 2153; remote_n_portc = 501; diff --git a/ci-scripts/conf_files/gnb.sa.band78.106prb.usrpb200.sc-fdma.conf b/ci-scripts/conf_files/gnb.sa.band78.106prb.usrpb200.sc-fdma.conf index 82fb9f90e1..6a82a57dcd 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.106prb.usrpb200.sc-fdma.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.106prb.usrpb200.sc-fdma.conf @@ -161,8 +161,8 @@ gNBs = NETWORK_INTERFACES : { - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.68.194"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.68.194"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.16.109"; + GNB_IPV4_ADDRESS_FOR_NGU = "172.21.16.109"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; diff --git a/ci-scripts/conf_files/gnb.sa.band78.51prb.usrpb200.conf b/ci-scripts/conf_files/gnb.sa.band78.51prb.usrpb200.conf index c39f38d55e..a53fefea34 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.51prb.usrpb200.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.51prb.usrpb200.conf @@ -161,8 +161,8 @@ gNBs = NETWORK_INTERFACES : { - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.68.194"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.68.194"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.16.109"; + GNB_IPV4_ADDRESS_FOR_NGU = "172.21.16.109"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; diff --git a/ci-scripts/xml_files/container_sa_b200_quectel.xml b/ci-scripts/xml_files/container_sa_b200_quectel.xml index 3eff9cddfd..db4c9d1d67 100644 --- a/ci-scripts/xml_files/container_sa_b200_quectel.xml +++ b/ci-scripts/xml_files/container_sa_b200_quectel.xml @@ -185,14 +185,14 @@ Custom_Command Trigger Reestablishment ofqot - echo ci force_reestab | nc -N 192.168.68.194 9090 | grep -E 'Reset RLC counters of UE RNTI [0-9a-f]{4} to trigger reestablishment' + echo ci force_reestab | nc -N 127.0.0.1 9090 | grep -E 'Reset RLC counters of UE RNTI [0-9a-f]{4} to trigger reestablishment' yes Custom_Command Verify Reestablishment ofqot - echo ci get_reestab_count | nc -N 192.168.68.194 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1' + echo ci get_reestab_count | nc -N 127.0.0.1 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1' yes diff --git a/ci-scripts/xml_files/container_sa_e1_b200_quectel.xml b/ci-scripts/xml_files/container_sa_e1_b200_quectel.xml index b888cdb855..92577c3abc 100644 --- a/ci-scripts/xml_files/container_sa_e1_b200_quectel.xml +++ b/ci-scripts/xml_files/container_sa_e1_b200_quectel.xml @@ -177,14 +177,14 @@ Custom_Command Trigger Reestablishment (on DU) ofqot - echo ci force_reestab | nc -N 192.168.68.195 9090 | grep -E 'Reset RLC counters of UE RNTI [0-9a-f]{4} to trigger reestablishment' + echo ci force_reestab | nc -N 127.0.0.1 9091 | grep -E 'Reset RLC counters of UE RNTI [0-9a-f]{4} to trigger reestablishment' yes Custom_Command Verify Reestablishment (on CU) ofqot - echo ci get_reestab_count | nc -N 192.168.68.194 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1' + echo ci get_reestab_count | nc -N 127.0.0.1 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1' yes diff --git a/ci-scripts/xml_files/container_sa_f1_b200_quectel.xml b/ci-scripts/xml_files/container_sa_f1_b200_quectel.xml index df69f4c32c..6989c8fc26 100644 --- a/ci-scripts/xml_files/container_sa_f1_b200_quectel.xml +++ b/ci-scripts/xml_files/container_sa_f1_b200_quectel.xml @@ -209,14 +209,14 @@ Custom_Command Trigger Reestablishment (on DU) ofqot - echo ci force_reestab | nc -N 192.168.68.195 9090 | grep -E 'Reset RLC counters of UE RNTI [0-9a-f]{4} to trigger reestablishment' + echo ci force_reestab | nc -N 127.0.0.1 9091 | grep -E 'Reset RLC counters of UE RNTI [0-9a-f]{4} to trigger reestablishment' yes Custom_Command Verify Reestablishment (on CU) ofqot - echo ci get_reestab_count | nc -N 192.168.68.194 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1' + echo ci get_reestab_count | nc -N 127.0.0.1 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1' yes diff --git a/ci-scripts/xml_files/container_sa_sc_b200_quectel.xml b/ci-scripts/xml_files/container_sa_sc_b200_quectel.xml index 4c1e2ab506..09720f422a 100644 --- a/ci-scripts/xml_files/container_sa_sc_b200_quectel.xml +++ b/ci-scripts/xml_files/container_sa_sc_b200_quectel.xml @@ -179,14 +179,14 @@ Custom_Command Trigger Reestablishment ofqot - echo ci force_reestab | nc -N 192.168.68.194 9090 | grep -E 'Reset RLC counters of UE RNTI [0-9a-f]{4} to trigger reestablishment' + echo ci force_reestab | nc -N 127.0.0.1 9090 | grep -E 'Reset RLC counters of UE RNTI [0-9a-f]{4} to trigger reestablishment' yes Custom_Command Verify Reestablishment ofqot - echo ci get_reestab_count | nc -N 192.168.68.194 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1' + echo ci get_reestab_count | nc -N 127.0.0.1 9090 | grep -E 'UE RNTI [0-9a-f]{4} reestab 1' yes diff --git a/ci-scripts/yaml_files/sa_b200_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_b200_gnb/docker-compose.yml index a859159e59..e440cec52d 100644 --- a/ci-scripts/yaml_files/sa_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/sa_b200_gnb/docker-compose.yml @@ -11,9 +11,11 @@ services: volumes: - ../../conf_files/gnb.sa.band78.51prb.usrpb200.conf:/opt/oai-gnb/etc/gnb.conf - /dev:/dev - networks: - public_net: - ipv4_address: 192.168.68.194 + # for performance reasons, we use host mode: in bridge mode, we have + # unacceptable DL TCP performance. However, the whole point of + # containerization is to not be in host mode, so update this to macvlan + # later. + network_mode: "host" #entrypoint: /bin/bash -c "sleep infinity" healthcheck: # pgrep does NOT work @@ -21,12 +23,3 @@ services: interval: 10s timeout: 5s retries: 5 - -networks: - public_net: - name: sa-b200-gnb-net - ipam: - config: - - subnet: 192.168.68.192/26 - driver_opts: - com.docker.network.bridge.name: "sa-gnb-net" diff --git a/ci-scripts/yaml_files/sa_e1_b200_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_e1_b200_gnb/docker-compose.yml index 5cb9d350c2..7798d41c88 100644 --- a/ci-scripts/yaml_files/sa_e1_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/sa_e1_b200_gnb/docker-compose.yml @@ -6,12 +6,16 @@ services: ulimits: core: -1 # for core dumps environment: - USE_ADDITIONAL_OPTIONS: --sa --telnetsrv --telnetsrv.shrmod ci --log_config.global_log_options level,nocolor,time,line_num,function + USE_ADDITIONAL_OPTIONS: --sa + --telnetsrv --telnetsrv.listenport 9090 --telnetsrv.shrmod ci + --log_config.global_log_options level,nocolor,time,line_num,function volumes: - ../../conf_files/gnb-cucp.sa.f1.quectel.conf:/opt/oai-gnb/etc/gnb.conf - networks: - public_net: - ipv4_address: 192.168.68.194 + # for performance reasons, we use host mode: in bridge mode, we have + # unacceptable DL TCP performance. However, the whole point of + # containerization is to not be in host mode, so update this to macvlan + # later. + network_mode: "host" healthcheck: # pgrep does NOT work test: /bin/bash -c "ps aux | grep -v grep | grep -c softmodem" @@ -26,12 +30,15 @@ services: ulimits: core: -1 # for core dumps environment: - USE_ADDITIONAL_OPTIONS: --sa --log_config.global_log_options level,nocolor,time,line_num,function + USE_ADDITIONAL_OPTIONS: --sa + --log_config.global_log_options level,nocolor,time,line_num,function volumes: - ../../conf_files/gnb-cuup.sa.f1.quectel.conf:/opt/oai-gnb/etc/gnb.conf - networks: - public_net: - ipv4_address: 192.168.68.196 + # for performance reasons, we use host mode: in bridge mode, we have + # unacceptable DL TCP performance. However, the whole point of + # containerization is to not be in host mode, so update this to macvlan + # later. + network_mode: "host" healthcheck: # pgrep does NOT work test: /bin/bash -c "ps aux | grep -v grep | grep -c nr-cuup" @@ -50,16 +57,18 @@ services: USE_ADDITIONAL_OPTIONS: --sa --RUs.[0].sdr_addrs serial=30C51D4 --continuous-tx -E - --telnetsrv --telnetsrv.shrmod ci + --telnetsrv --telnetsrv.listenport 9091 --telnetsrv.shrmod ci --gNBs.[0].min_rxtxtime 2 --gNBs.[0].do_CSIRS 1 --gNBs.[0].do_SRS 1 --RUs.[0].att_rx 14 --RUs.[0].att_tx 14 --log_config.global_log_options level,nocolor,time,line_num,function volumes: - ../../conf_files/gnb-du.sa.band78.106prb.usrpb200.conf:/opt/oai-gnb/etc/gnb.conf - /dev:/dev - networks: - public_net: - ipv4_address: 192.168.68.195 + # for performance reasons, we use host mode: in bridge mode, we have + # unacceptable DL TCP performance. However, the whole point of + # containerization is to not be in host mode, so update this to macvlan + # later. + network_mode: "host" #entrypoint: /bin/bash -c "sleep infinity" healthcheck: # pgrep does NOT work @@ -67,12 +76,3 @@ services: interval: 10s timeout: 5s retries: 5 - -networks: - public_net: - name: sa-b200-gnb-net - ipam: - config: - - subnet: 192.168.68.192/26 - driver_opts: - com.docker.network.bridge.name: "sa-gnb-net" diff --git a/ci-scripts/yaml_files/sa_f1_b200_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_f1_b200_gnb/docker-compose.yml index 97438eb67e..b2f682aada 100644 --- a/ci-scripts/yaml_files/sa_f1_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/sa_f1_b200_gnb/docker-compose.yml @@ -6,12 +6,16 @@ services: ulimits: core: -1 # for core dumps environment: - USE_ADDITIONAL_OPTIONS: --sa --telnetsrv --telnetsrv.shrmod ci --log_config.global_log_options level,nocolor,time,line_num,function + USE_ADDITIONAL_OPTIONS: --sa + --telnetsrv --telnetsrv.listenport 9090 --telnetsrv.shrmod ci + --log_config.global_log_options level,nocolor,time,line_num,function volumes: - ../../conf_files/gnb-cu.sa.f1.conf:/opt/oai-gnb/etc/gnb.conf - networks: - public_net: - ipv4_address: 192.168.68.194 + # for performance reasons, we use host mode: in bridge mode, we have + # unacceptable DL TCP performance. However, the whole point of + # containerization is to not be in host mode, so update this to macvlan + # later. + network_mode: "host" #entrypoint: /bin/bash -c "sleep infinity" healthcheck: # pgrep does NOT work @@ -28,13 +32,18 @@ services: core: -1 # for core dumps environment: USE_B2XX: 'yes' - USE_ADDITIONAL_OPTIONS: --sa --RUs.[0].sdr_addrs serial=30C51D4 --continuous-tx --telnetsrv --telnetsrv.shrmod ci --log_config.global_log_options level,nocolor,time,line_num,function --gNBs.[0].min_rxtxtime 2 --gNBs.[0].do_CSIRS 1 --gNBs.[0].do_SRS 0 --L1s.[0].max_ldpc_iterations 20 + USE_ADDITIONAL_OPTIONS: --sa --RUs.[0].sdr_addrs serial=30C51D4 --continuous-tx + --telnetsrv --telnetsrv.listenport 9091 --telnetsrv.shrmod ci + --gNBs.[0].min_rxtxtime 2 --gNBs.[0].do_CSIRS 1 --gNBs.[0].do_SRS 0 --L1s.[0].max_ldpc_iterations 20 + --log_config.global_log_options level,nocolor,time,line_num,function volumes: - ../../conf_files/gnb-du.sa.band1.52prb.usrpb210.conf:/opt/oai-gnb/etc/gnb.conf - /dev:/dev - networks: - public_net: - ipv4_address: 192.168.68.195 + # for performance reasons, we use host mode: in bridge mode, we have + # unacceptable DL TCP performance. However, the whole point of + # containerization is to not be in host mode, so update this to macvlan + # later. + network_mode: "host" #entrypoint: /bin/bash -c "sleep infinity" healthcheck: # pgrep does NOT work @@ -42,12 +51,3 @@ services: interval: 10s timeout: 5s retries: 5 - -networks: - public_net: - name: sa-b200-gnb-net - ipam: - config: - - subnet: 192.168.68.192/26 - driver_opts: - com.docker.network.bridge.name: "sa-gnb-net" diff --git a/ci-scripts/yaml_files/sa_sc_b200_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_sc_b200_gnb/docker-compose.yml index c82b5f428a..7bd0f03b10 100644 --- a/ci-scripts/yaml_files/sa_sc_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/sa_sc_b200_gnb/docker-compose.yml @@ -11,9 +11,11 @@ services: volumes: - ../../conf_files/gnb.sa.band78.106prb.usrpb200.sc-fdma.conf:/opt/oai-gnb/etc/gnb.conf - /dev:/dev - networks: - public_net: - ipv4_address: 192.168.68.194 + # for performance reasons, we use host mode: in bridge mode, we have + # unacceptable DL TCP performance. However, the whole point of + # containerization is to not be in host mode, so update this to macvlan + # later. + network_mode: "host" #entrypoint: /bin/bash -c "sleep infinity" healthcheck: # pgrep does NOT work @@ -21,12 +23,3 @@ services: interval: 10s timeout: 5s retries: 5 - -networks: - public_net: - name: sa-b200-gnb-net - ipam: - config: - - subnet: 192.168.68.192/26 - driver_opts: - com.docker.network.bridge.name: "sa-gnb-net" diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index fec34b753f..6d76a66877 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -111,6 +111,65 @@ static int compute_ph_factor(int mu, int tbs_bits, int rb, int n_layers, int n_s return ((int)roundf(delta_tf + bw_factor)); } +/* \brief over-estimate the BSR index, given real_index. + * + * BSR does not account for headers, so we need to estimate. See 38.321 + * 6.1.3.1: "The size of the RLC headers and MAC subheaders are not considered + * in the buffer size computation." */ +static int overestim_bsr_index(int real_index) +{ + /* if UE reports BSR 0, it means "no data"; otherwise, overestimate to + * account for headers */ + const int add_overestim = 1; + return real_index > 0 ? real_index + add_overestim : real_index; +} + +static int estimate_ul_buffer_short_bsr(const NR_BSR_SHORT *bsr) +{ + /* NOTE: the short BSR might be for different LCGID than 0, but we do not + * differentiate them */ + int rep_idx = bsr->Buffer_size; + int estim_idx = overestim_bsr_index(rep_idx); + int max = sizeofArray(NR_SHORT_BSR_TABLE); + int idx = min(estim_idx, max); + int estim_size = NR_SHORT_BSR_TABLE[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); + return estim_size; +} + +static int estimate_ul_buffer_long_bsr(const NR_BSR_LONG *bsr) +{ + LOG_D(NR_MAC, + "LONG BSR, LCG ID(7-0) %d/%d/%d/%d/%d/%d/%d/%d\n", + bsr->LcgID7, + bsr->LcgID6, + bsr->LcgID5, + bsr->LcgID4, + bsr->LcgID3, + bsr->LcgID2, + bsr->LcgID1, + bsr->LcgID0); + 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 max = sizeofArray(NR_LONG_BSR_TABLE); + uint8_t *payload = ((uint8_t*) bsr) + 1; + int m = 0; + const int total_lcgids = 8; /* see 38.321 6.1.3.1 */ + for (int n = 0; n < total_lcgids; n++) { + if (!bsr_active[n]) + continue; + int rep_idx = payload[m]; + int estim_idx = overestim_bsr_index(rep_idx); + int idx = min(estim_idx, max); + estim_size += NR_LONG_BSR_TABLE[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); + m++; + } + return estim_size; +} + // For both UL-SCH except: // - UL-SCH: fixed-size MAC CE(known by LCID) // - UL-SCH: padding @@ -166,7 +225,6 @@ static int nr_process_mac_pdu(instance_t module_idP, LOG_D(NR_MAC, "In %s: received UL-SCH sub-PDU with LCID 0x%x in %d.%d (remaining PDU length %d)\n", __func__, rx_lcid, frameP, slot, pdu_len); unsigned char *ce_ptr; - int n_Lcg = 0; switch(rx_lcid){ // MAC CE @@ -192,17 +250,8 @@ static int nr_process_mac_pdu(instance_t module_idP, } /* Extract short BSR value */ ce_ptr = &pduP[mac_subheader_len]; - NR_BSR_SHORT *bsr_s = (NR_BSR_SHORT *) ce_ptr; - sched_ctrl->estimated_ul_buffer = 0; - sched_ctrl->estimated_ul_buffer = NR_SHORT_BSR_TABLE[bsr_s->Buffer_size]; - LOG_D(NR_MAC, - "SHORT BSR at %4d.%2d, LCG ID %d, BS Index %d, BS value < %d, est buf %d\n", - frameP, - slot, - bsr_s->LcgID, - bsr_s->Buffer_size, - NR_SHORT_BSR_TABLE[bsr_s->Buffer_size], - sched_ctrl->estimated_ul_buffer); + sched_ctrl->estimated_ul_buffer = estimate_ul_buffer_short_bsr((NR_BSR_SHORT *)ce_ptr); + LOG_D(NR_MAC, "SHORT BSR at %4d.%2d, est buf %d\n", frameP, slot, sched_ctrl->estimated_ul_buffer); break; case UL_SCH_LCID_L_BSR: case UL_SCH_LCID_L_TRUNCATED_BSR: @@ -219,32 +268,8 @@ static int nr_process_mac_pdu(instance_t module_idP, } /* Extract long BSR value */ ce_ptr = &pduP[mac_subheader_len]; - NR_BSR_LONG *bsr_l = (NR_BSR_LONG *) ce_ptr; - sched_ctrl->estimated_ul_buffer = 0; - - n_Lcg = bsr_l->LcgID7 + bsr_l->LcgID6 + bsr_l->LcgID5 + bsr_l->LcgID4 + - bsr_l->LcgID3 + bsr_l->LcgID2 + bsr_l->LcgID1 + bsr_l->LcgID0; - - LOG_D(NR_MAC, "LONG BSR, LCG ID(7-0) %d/%d/%d/%d/%d/%d/%d/%d\n", - bsr_l->LcgID7, bsr_l->LcgID6, bsr_l->LcgID5, bsr_l->LcgID4, - bsr_l->LcgID3, bsr_l->LcgID2, bsr_l->LcgID1, bsr_l->LcgID0); - - for (int n = 0; n < n_Lcg; n++){ - LOG_D(NR_MAC, "LONG BSR, %d/%d (n/n_Lcg), BS Index %d, BS value < %d", - n, n_Lcg, pduP[mac_subheader_len + 1 + n], - NR_LONG_BSR_TABLE[pduP[mac_subheader_len + 1 + n]]); - sched_ctrl->estimated_ul_buffer += NR_LONG_BSR_TABLE[pduP[mac_subheader_len + 1 + n]]; - LOG_D(NR_MAC, - "LONG BSR at %4d.%2d, %d/%d (n/n_Lcg), BS Index %d, BS value < %d, total %d\n", - frameP, - slot, - n, - n_Lcg, - pduP[mac_subheader_len + 1 + n], - NR_LONG_BSR_TABLE[pduP[mac_subheader_len + 1 + n]], - sched_ctrl->estimated_ul_buffer); - } - + sched_ctrl->estimated_ul_buffer = estimate_ul_buffer_long_bsr((NR_BSR_LONG *)ce_ptr); + LOG_D(NR_MAC, "LONG BSR at %4d.%2d, estim buf %d\n", frameP, slot, sched_ctrl->estimated_ul_buffer); break; case UL_SCH_LCID_C_RNTI: