From 1302b48b923e24b09680297a0ff6c8c3ae0f0c4f Mon Sep 17 00:00:00 2001
From: luis_pereira87 <lpereira@allbesmart.pt>
Date: Wed, 1 Dec 2021 22:28:06 +0000
Subject: [PATCH] Temporary fix to avoid QUECTEL to reject the
 RRCReconfiguration in NSA mode

For now, QUECTEL rejects the RRCReconfiguration with more than 1 BWP Dedicated, need to understand why...
---
 openair2/RRC/NR/rrc_gNB_nsa.c      | 11 +++++++++++
 openair2/RRC/NR/rrc_gNB_reconfig.c |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c
index faf1ac8867c..a7f00a408ce 100644
--- a/openair2/RRC/NR/rrc_gNB_nsa.c
+++ b/openair2/RRC/NR/rrc_gNB_nsa.c
@@ -126,6 +126,17 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, NR_UE_CapabilityRAT_ContainerL
 
   ue_context_p->ue_context.spCellConfig = calloc(1, sizeof(struct NR_SpCellConfig));
   ue_context_p->ue_context.spCellConfig->spCellConfigDedicated = rrc->carrier.servingcellconfig;
+
+  // TODO: to be removed! For now, QUECTEL rejects the RRCReconfiguration with more than 1 BWP Dedicated, need to understand why...
+  ue_context_p->ue_context.spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[1] = NULL;
+  ue_context_p->ue_context.spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[2] = NULL;
+  ue_context_p->ue_context.spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[3] = NULL;
+  ue_context_p->ue_context.spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count = 1;
+  ue_context_p->ue_context.spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[1] = NULL;
+  ue_context_p->ue_context.spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[2] = NULL;
+  ue_context_p->ue_context.spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[3] = NULL;
+  ue_context_p->ue_context.spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count = 1;
+
   LOG_I(NR_RRC,"Adding new NSA user (%p)\n",ue_context_p);
   rrc_add_nsa_user(rrc,ue_context_p, m);
 }
diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c
index b52367b258e..52ace5beb22 100644
--- a/openair2/RRC/NR/rrc_gNB_reconfig.c
+++ b/openair2/RRC/NR/rrc_gNB_reconfig.c
@@ -369,7 +369,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
  secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToReleaseList= NULL;
  
  NR_BWP_Downlink_t *bwp = NULL;
- for (int bwp_loop = 0; bwp_loop < 4 ; bwp_loop++ )
+ for (int bwp_loop = 0; bwp_loop < 1 ; bwp_loop++ )
  {
  
  if (servingcellconfigdedicated) {
-- 
GitLab