Reduce receiver mutex scope
This seems to reduce packet loss on my machine.
This commit is contained in:
@@ -1024,8 +1024,6 @@ static int Gtpv1uHandleGpdu(int h, uint8_t *msgBuf, uint32_t msgBufLen, uint16_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_lock(&globGtp.gtp_lock);
|
pthread_mutex_lock(&globGtp.gtp_lock);
|
||||||
// the socket Linux file handler is the instance id
|
|
||||||
getInstRetInt(h);
|
|
||||||
auto tunnel = globGtp.te2ue_mapping.find(ntohl(msgHdr->teid));
|
auto tunnel = globGtp.te2ue_mapping.find(ntohl(msgHdr->teid));
|
||||||
|
|
||||||
if (tunnel == globGtp.te2ue_mapping.end()) {
|
if (tunnel == globGtp.te2ue_mapping.end()) {
|
||||||
@@ -1033,6 +1031,8 @@ static int Gtpv1uHandleGpdu(int h, uint8_t *msgBuf, uint32_t msgBufLen, uint16_t
|
|||||||
pthread_mutex_unlock(&globGtp.gtp_lock);
|
pthread_mutex_unlock(&globGtp.gtp_lock);
|
||||||
return GTPNOK;
|
return GTPNOK;
|
||||||
}
|
}
|
||||||
|
ueidData_t uedata = tunnel->second;
|
||||||
|
pthread_mutex_unlock(&globGtp.gtp_lock);
|
||||||
|
|
||||||
/* see TS 29.281 5.1 */
|
/* see TS 29.281 5.1 */
|
||||||
// Minimum length of GTP-U header if non of the optional fields are present
|
// Minimum length of GTP-U header if non of the optional fields are present
|
||||||
@@ -1109,17 +1109,9 @@ static int Gtpv1uHandleGpdu(int h, uint8_t *msgBuf, uint32_t msgBufLen, uint16_t
|
|||||||
// This context is not good for gtp
|
// This context is not good for gtp
|
||||||
// frame, ... has no meaning
|
// frame, ... has no meaning
|
||||||
// manyother attributes may come from create tunnel
|
// manyother attributes may come from create tunnel
|
||||||
protocol_ctxt_t ctxt;
|
protocol_ctxt_t ctxt = { .enb_flag = 1, .rntiMaybeUEid = uedata.ue_id, };
|
||||||
ctxt.module_id = 0;
|
|
||||||
ctxt.enb_flag = 1;
|
|
||||||
ctxt.instance = inst->addr.originInstance;
|
|
||||||
ctxt.rntiMaybeUEid = tunnel->second.ue_id;
|
|
||||||
ctxt.frame = 0;
|
|
||||||
ctxt.subframe = 0;
|
|
||||||
ctxt.eNB_index = 0;
|
|
||||||
ctxt.brOption = 0;
|
|
||||||
const srb_flag_t srb_flag = SRB_FLAG_NO;
|
const srb_flag_t srb_flag = SRB_FLAG_NO;
|
||||||
const rb_id_t rb_id = tunnel->second.incoming_rb_id;
|
const rb_id_t rb_id = uedata.incoming_rb_id;
|
||||||
const mui_t mui = RLC_MUI_UNDEFINED;
|
const mui_t mui = RLC_MUI_UNDEFINED;
|
||||||
const confirm_t confirm = RLC_SDU_CONFIRM_NO;
|
const confirm_t confirm = RLC_SDU_CONFIRM_NO;
|
||||||
const sdu_size_t sdu_buffer_size = msgBufLen - offset;
|
const sdu_size_t sdu_buffer_size = msgBufLen - offset;
|
||||||
@@ -1127,12 +1119,11 @@ static int Gtpv1uHandleGpdu(int h, uint8_t *msgBuf, uint32_t msgBufLen, uint16_t
|
|||||||
const pdcp_transmission_mode_t mode = PDCP_TRANSMISSION_MODE_DATA;
|
const pdcp_transmission_mode_t mode = PDCP_TRANSMISSION_MODE_DATA;
|
||||||
const uint32_t sourceL2Id = 0;
|
const uint32_t sourceL2Id = 0;
|
||||||
const uint32_t destinationL2Id = 0;
|
const uint32_t destinationL2Id = 0;
|
||||||
pthread_mutex_unlock(&globGtp.gtp_lock);
|
|
||||||
|
|
||||||
if (sdu_buffer_size > 0) {
|
if (sdu_buffer_size > 0) {
|
||||||
if (qfi != -1 && tunnel->second.callBackSDAP) {
|
if (qfi != -1 && uedata.callBackSDAP) {
|
||||||
if (!tunnel->second.callBackSDAP(&ctxt,
|
if (!uedata.callBackSDAP(&ctxt,
|
||||||
tunnel->second.ue_id,
|
uedata.ue_id,
|
||||||
srb_flag,
|
srb_flag,
|
||||||
rb_id,
|
rb_id,
|
||||||
mui,
|
mui,
|
||||||
@@ -1144,11 +1135,10 @@ static int Gtpv1uHandleGpdu(int h, uint8_t *msgBuf, uint32_t msgBufLen, uint16_t
|
|||||||
&destinationL2Id,
|
&destinationL2Id,
|
||||||
qfi,
|
qfi,
|
||||||
rqi,
|
rqi,
|
||||||
tunnel->second.pdusession_id))
|
uedata.pdusession_id))
|
||||||
LOG_E(GTPU, "[%d] down layer refused incoming packet\n", h);
|
LOG_E(GTPU, "[%d] down layer refused incoming packet\n", h);
|
||||||
} else {
|
} else {
|
||||||
if (!tunnel->second
|
if (!uedata.callBack(&ctxt, srb_flag, rb_id, mui, confirm, sdu_buffer_size, sdu_buffer, mode, &sourceL2Id, &destinationL2Id))
|
||||||
.callBack(&ctxt, srb_flag, rb_id, mui, confirm, sdu_buffer_size, sdu_buffer, mode, &sourceL2Id, &destinationL2Id))
|
|
||||||
LOG_E(GTPU, "[%d] down layer refused incoming packet\n", h);
|
LOG_E(GTPU, "[%d] down layer refused incoming packet\n", h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user