Commit da6b1a4b authored by Guido Casati's avatar Guido Casati

Fixes to SI message struct item in CU messages

* num_SI is the size of the list of gNB-CU System Information messages
* the new struct member is an array, sized after the maximum nb
  of SIB types, which contains the SI container, the container length
  and the SIB type
parent 4b5ea6dc
......@@ -81,6 +81,8 @@
#define F1AP_MAX_NO_UE_ID 1024
#define F1AP_MAX_NO_OF_INDIVIDUAL_CONNECTIONS_TO_RESET 65536
/* 9.3.1.42 of 3GPP TS 38.473 - gNB-CU System Information */
#define F1AP_MAX_NO_SIB_TYPES 32
typedef struct f1ap_net_config_t {
char *CU_f1_ip_address;
......@@ -176,6 +178,14 @@ typedef struct f1ap_du_register_req_t {
f1ap_net_config_t net_config;
} f1ap_du_register_req_t;
typedef struct f1ap_sib_msg_t {
/// RRC container with system information owned by gNB-CU
uint8_t *SI_container;
int SI_container_length;
/// SIB block type, e.g. 2 for sibType2
int SI_type;
} f1ap_sib_msg_t;
typedef struct served_cells_to_activate_s {
f1ap_plmn_t plmn;
// NR Global Cell Id
......@@ -184,10 +194,8 @@ typedef struct served_cells_to_activate_s {
uint16_t nrpci;
/// num SI messages per DU cell
uint8_t num_SI;
/// SI message containers (up to 21 messages per cell)
uint8_t *SI_container[21];
int SI_container_length[21];
int SI_type[21];
/// gNB-CU System Information message (up to 32 messages per cell)
f1ap_sib_msg_t SI_msg[F1AP_MAX_NO_SIB_TYPES];
} served_cells_to_activate_t;
typedef struct f1ap_setup_resp_s {
......
......@@ -322,14 +322,22 @@ int CU_send_F1_SETUP_RESPONSE(sctp_assoc_t assoc_id, f1ap_setup_resp_t *f1ap_set
// for (int sIBtype=2;sIBtype<33;sIBtype++) { //21 ? 33 ?
for (int sIBtype=2; sIBtype<21; sIBtype++) {
if (f1ap_setup_resp->cells_to_activate[i].SI_container[sIBtype]!=NULL) {
AssertFatal(sIBtype < 6 || sIBtype == 9, "Illegal SI type %d\n",sIBtype);
asn1cSequenceAdd(gNB_CUSystemInformation->sibtypetobeupdatedlist.list, F1AP_SibtypetobeupdatedListItem_t, sib_item);
sib_item->sIBtype = sIBtype;
OCTET_STRING_fromBuf(&sib_item->sIBmessage,
(const char *)f1ap_setup_resp->cells_to_activate[i].SI_container[sIBtype],
f1ap_setup_resp->cells_to_activate[i].SI_container_length[sIBtype]);
LOG_D(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,sIBtype,f1ap_setup_resp->cells_to_activate[i].SI_container_length[sIBtype]);
for (int n = 0; n < f1ap_setup_resp->cells_to_activate[i].num_SI; n++) {
if (f1ap_setup_resp->cells_to_activate[i].SI_msg[n].SI_container != NULL) {
if (f1ap_setup_resp->cells_to_activate[i].SI_msg[n].SI_type > 6
&& f1ap_setup_resp->cells_to_activate[i].SI_msg[n].SI_type != 9) {
asn1cSequenceAdd(gNB_CUSystemInformation->sibtypetobeupdatedlist.list, F1AP_SibtypetobeupdatedListItem_t, sib_item);
sib_item->sIBtype = f1ap_setup_resp->cells_to_activate[i].SI_msg[n].SI_type;
OCTET_STRING_fromBuf(&sib_item->sIBmessage,
(const char *)f1ap_setup_resp->cells_to_activate[i].SI_msg[n].SI_container,
f1ap_setup_resp->cells_to_activate[i].SI_msg[n].SI_container_length);
LOG_D(F1AP,
"f1ap_setup_resp->cells_to_activate[%d].SI_msg[%d].SI_container_length = %d \n",
i,
n,
f1ap_setup_resp->cells_to_activate[i].SI_msg[n].SI_container_length);
}
}
}
}
}
......@@ -875,16 +883,18 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(sctp_assoc_t assoc_id, f1ap_gnb_cu_confi
//printf("\n");
// for (int sIBtype=2;sIBtype<33;sIBtype++) { //21 ? 33 ?
for (int sIBtype=2; sIBtype<21; sIBtype++) {
if (f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype]!=NULL) {
AssertFatal(sIBtype < 6 || sIBtype == 9, "Illegal SI type %d\n",sIBtype);
for (int j = 0; j < sizeofArray(f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_msg); j++) {
f1ap_sib_msg_t *SI_msg = &f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_msg[j];
if (SI_msg->SI_container != NULL) {
asn1cSequenceAdd(gNB_CUSystemInformation->sibtypetobeupdatedlist.list, F1AP_SibtypetobeupdatedListItem_t, sib_item);
sib_item->sIBtype = sIBtype;
OCTET_STRING_fromBuf(&sib_item->sIBmessage,
(const char *)f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype],
f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container_length[sIBtype]);
LOG_D(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,sIBtype,
f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container_length[sIBtype]);
sib_item->sIBtype = SI_msg->SI_type;
AssertFatal(sib_item->sIBtype < 6 || sib_item->sIBtype == 9, "Illegal SI type %ld\n", sib_item->sIBtype);
OCTET_STRING_fromBuf(&sib_item->sIBmessage, (const char *)SI_msg->SI_container, SI_msg->SI_container_length);
LOG_D(F1AP,
"f1ap_gnb_cu_configuration_update->SI_container_length[%d][sIBtype %ld] = %d \n",
i,
sib_item->sIBtype,
SI_msg->SI_container_length);
}
}
}
......
......@@ -525,15 +525,15 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint
resp.cells_to_activate[i].plmn.mnc,
resp.cells_to_activate[i].nr_cellid,
resp.cells_to_activate[i].num_SI);
for (int si = 0; si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; si++) {
F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si];
size_t size = sib_item->sIBmessage.size;
resp.cells_to_activate[i].SI_container_length[si] = size;
LOG_D(F1AP, "F1AP: SI_container_length[%d][%ld] %ld bytes\n", i, sib_item->sIBtype, size);
resp.cells_to_activate[i].SI_container[si] = malloc(resp.cells_to_activate[i].SI_container_length[si]);
memcpy(resp.cells_to_activate[i].SI_container[si], sib_item->sIBmessage.buf, size);
resp.cells_to_activate[i].SI_type[si]=sib_item->sIBtype;
for (int s = 0; s < resp.cells_to_activate[i].num_SI; s++) {
F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[s];
f1ap_sib_msg_t *SI_msg = &resp.cells_to_activate[i].SI_msg[s];
SI_msg->SI_container = calloc(sib_item->sIBmessage.size, sizeof(uint8_t));
AssertFatal(SI_msg->SI_container != NULL, "out of memory\n");
memcpy(SI_msg->SI_container, sib_item->sIBmessage.buf, sib_item->sIBmessage.size);
SI_msg->SI_container_length = sib_item->sIBmessage.size;
SI_msg->SI_type = sib_item->sIBtype;
LOG_D(F1AP, "F1AP: SI_container_length[%d][%ld] %ld bytes\n", i, sib_item->sIBtype, sib_item->sIBmessage.size);
}
break;
......@@ -816,13 +816,12 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t asso
for (int si = 0; si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; si++) {
F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si];
size_t size = sib_item->sIBmessage.size;
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container_length[si] = size;
f1ap_sib_msg_t *SI_msg = &F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).cells_to_activate[i].SI_msg[si];
SI_msg->SI_container_length = size;
LOG_D(F1AP, "F1AP: SI_container_length[%d][%ld] %ld bytes\n", i, sib_item->sIBtype, size);
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[si] = malloc(F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container_length[si]);
memcpy((void *)F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[si],
(void *)sib_item->sIBmessage.buf,
size);
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_type[si]=sib_item->sIBtype;
SI_msg->SI_container = malloc(SI_msg->SI_container_length);
memcpy((void *)SI_msg->SI_container, (void *)sib_item->sIBmessage.buf, size);
SI_msg->SI_type = sib_item->sIBtype;
}
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment