Support parsing of multiple mac resources in the same timeslot

Change-Id: Ic2956a5f10cffe296b76a290a0d16f45461eb2e7
This commit is contained in:
wbokslag 2022-09-16 16:12:11 +02:00
parent 1f48ec8627
commit 79560cbf86
3 changed files with 29 additions and 15 deletions

View File

@ -307,10 +307,32 @@ void tp_sap_udata_ind(enum tp_sap_data_type type, int blk_num, const uint8_t *bi
/* FIXME: do something */
break;
}
/* send Rx time along with the TMV-UNITDATA.ind primitive */
memcpy(&tup->tdma_time, &tcd->time, sizeof(tup->tdma_time));
upper_mac_prim_recv(&ttp->oph, tms);
int pdu_bits = 0;
uint32_t offset = 0;
uint8_t *orig_head = msg->head;
uint8_t *orig_tail = msg->tail;
while (offset < tbp->type1_bits - 16) {
/* send Rx time along with the TMV-UNITDATA.ind primitive */
memcpy(&tup->tdma_time, &tcd->time, sizeof(tup->tdma_time));
pdu_bits = upper_mac_prim_recv(&ttp->oph, tms);
if (pdu_bits < 0) {
/* -1 is returned when pdu fills slot or length could not be determined */
break;
}
/* Increment head and l1h ptrs and reset tail to end of msg (may be altered by removing FCS) */
offset += pdu_bits;
msg->head = orig_head + offset;
msg->tail = orig_tail;
msg->len = msg->tail - msg->head;
msg->l1h = msg->head;
msg->l2h = 0;
msg->l3h = 0;
msg->l4h = 0;
}
talloc_free(msg);
talloc_free(ttp);
}

View File

@ -64,16 +64,11 @@ struct msgb *tetra_gsmtap_makemsg(struct tetra_tdma_time *tm, enum tetra_log_cha
int tetra_gsmtap_sendmsg(struct msgb *msg)
{
int rc;
if (g_gti) {
rc = gsmtap_sendmsg_free(g_gti, msg);
return gsmtap_sendmsg(g_gti, msg);
} else {
msgb_free(msg);
rc = 0;
return 0;
}
return rc;
}
int tetra_gsmtap_init(const char *host, uint16_t port)

View File

@ -559,8 +559,5 @@ int upper_mac_prim_recv(struct osmo_prim_hdr *op, void *priv)
break;
}
talloc_free(op->msg);
talloc_free(op);
return pdu_bits;
}