F1AP IDs: Add update method to fix concurrency bug
Introduce function cu_update_f1_ue_data() which does remove+add under one lock. This fixes a concurrency bug. For instance, during reestablishment, the CU needs to update the DU UE ID under which the UE is identified in the DU. Previously, the CU would remove, then add the DU UE ID info. At the same time, the PDCP thread might look up the information. This can lead to asserts. Use the above addmod functionality to do the remove-add under a mutex. Modify test to verify this works as expected.
This commit is contained in:
@@ -84,6 +84,18 @@ bool cu_exists_f1_ue_data(uint32_t ue_id)
|
||||
return ret == HASH_TABLE_OK;
|
||||
}
|
||||
|
||||
bool cu_update_f1_ue_data(uint32_t ue_id, const f1_ue_data_t *data)
|
||||
{
|
||||
pthread_mutex_lock(&cu2du_mutex);
|
||||
DevAssert(cu2du_ue_mapping != NULL);
|
||||
uint64_t key = ue_id;
|
||||
hashtable_rc_t retrm = hashtable_remove(cu2du_ue_mapping, key);
|
||||
AssertFatal(retrm == HASH_TABLE_OK, "could not remove UE %d, ret %d\n", ue_id, retrm);
|
||||
bool ret = add_hashtable_data(cu2du_ue_mapping, key, data);
|
||||
pthread_mutex_unlock(&cu2du_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
f1_ue_data_t cu_get_f1_ue_data(uint32_t ue_id)
|
||||
{
|
||||
pthread_mutex_lock(&cu2du_mutex);
|
||||
|
||||
Reference in New Issue
Block a user