lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

February 2024

  • 1 participants
  • 1748 discussions
[M] Change in libosmo-gprs[master]: rlcmac: Add new structure to allow passing FN+TN to TBF handling func...
by pespin 02 Feb '24

02 Feb '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/35782?usp=email ) Change subject: rlcmac: Add new structure to allow passing FN+TN to TBF handling functions ...................................................................... rlcmac: Add new structure to allow passing FN+TN to TBF handling functions The different paths will be updated as required as needed in the future. Until now it was difficult while still valuable to have access to current FN+TS, even if only for logging. Follow up patch will use this info to be able to calculate poll FN from RRBP more deep in the stack (ul_tbf_fsm). Change-Id: Ifa09cd70c915aa3a2b799412cb02315aaebc0503 --- M include/osmocom/gprs/rlcmac/rlcmac_private.h M include/osmocom/gprs/rlcmac/tbf_ul.h M src/rlcmac/rlcmac.c M src/rlcmac/tbf_ul.c 4 files changed, 64 insertions(+), 49 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/82/35782/1 diff --git a/include/osmocom/gprs/rlcmac/rlcmac_private.h b/include/osmocom/gprs/rlcmac/rlcmac_private.h index 0fefd11..75f7028 100644 --- a/include/osmocom/gprs/rlcmac/rlcmac_private.h +++ b/include/osmocom/gprs/rlcmac/rlcmac_private.h @@ -42,6 +42,13 @@ struct gprs_rlcmac_dl_tbf_allocation_ts ts[8]; }; +/* PDCH_DATA.ind coming from lower layers, but with data already decoded as RlcMacDownlink_t */ +struct gprs_rlcmac_dl_block_ind { + RlcMacDownlink_t dl_block; + uint32_t fn; + uint8_t ts_nr; +}; + extern int g_rlcmac_log_cat[_OSMO_GPRS_RLCMAC_LOGC_MAX]; #define LOGRLCMAC(lvl, fmt, args...) LOGP(g_rlcmac_log_cat[OSMO_GPRS_RLCMAC_LOGC_RLCMAC], lvl, fmt, ## args) diff --git a/include/osmocom/gprs/rlcmac/tbf_ul.h b/include/osmocom/gprs/rlcmac/tbf_ul.h index bb0231e..c30a566 100644 --- a/include/osmocom/gprs/rlcmac/tbf_ul.h +++ b/include/osmocom/gprs/rlcmac/tbf_ul.h @@ -73,8 +73,7 @@ int gprs_rlcmac_ul_tbf_handle_pkt_ul_ack_nack(struct gprs_rlcmac_ul_tbf *ul_tbf, const RlcMacDownlink_t *dl_block); int gprs_rlcmac_ul_tbf_handle_pkt_ul_ass(struct gprs_rlcmac_ul_tbf *ul_tbf, - const struct osmo_gprs_rlcmac_prim *rlcmac_prim, - const RlcMacDownlink_t *dl_block); + const struct gprs_rlcmac_dl_block_ind *dlbi); static inline struct gprs_rlcmac_tbf *ul_tbf_as_tbf(struct gprs_rlcmac_ul_tbf *ul_tbf) { diff --git a/src/rlcmac/rlcmac.c b/src/rlcmac/rlcmac.c index ac168c2..590bb49 100644 --- a/src/rlcmac/rlcmac.c +++ b/src/rlcmac/rlcmac.c @@ -642,10 +642,11 @@ } -static int gprs_rlcmac_handle_pkt_dl_ass(const struct osmo_gprs_rlcmac_prim *rlcmac_prim, const RlcMacDownlink_t *dl_block) +static int gprs_rlcmac_handle_pkt_dl_ass(const struct gprs_rlcmac_dl_block_ind *dlbi) { struct gprs_rlcmac_tbf *tbf = NULL; struct gprs_rlcmac_entity *gre = NULL; + const RlcMacDownlink_t *dl_block = &dlbi->dl_block; const Packet_Downlink_Assignment_t *dlass = &dl_block->u.Packet_Downlink_Assignment; struct tbf_start_ev_rx_pacch_pkt_ass_ctx ev_data; int rc; @@ -666,21 +667,20 @@ if (!gre) { LOGRLCMAC(LOGL_INFO, "TS=%u FN=%u Rx Pkt DL ASS: MS not found\n", - rlcmac_prim->l1ctl.pdch_data_ind.ts_nr, - rlcmac_prim->l1ctl.pdch_data_ind.fn); + dlbi->ts_nr, dlbi->fn); return -ENOENT; } ev_data = (struct tbf_start_ev_rx_pacch_pkt_ass_ctx) { - .ts_nr = rlcmac_prim->l1ctl.pdch_data_ind.ts_nr, - .fn = rlcmac_prim->l1ctl.pdch_data_ind.fn, + .ts_nr = dlbi->ts_nr, + .fn = dlbi->fn, .dl_block = dl_block, }; rc = gprs_rlcmac_tbf_start_from_pacch(&gre->dl_tbf_dl_ass_fsm, &ev_data); if (dl_block->SP) { - uint32_t poll_fn = rrbp2fn(rlcmac_prim->l1ctl.pdch_data_ind.fn, dl_block->RRBP); - gprs_rlcmac_pdch_ulc_reserve(g_rlcmac_ctx->sched.ulc[rlcmac_prim->l1ctl.pdch_data_ind.ts_nr], + uint32_t poll_fn = rrbp2fn(dlbi->fn, dl_block->RRBP); + gprs_rlcmac_pdch_ulc_reserve(g_rlcmac_ctx->sched.ulc[dlbi->ts_nr], poll_fn, GPRS_RLCMAC_PDCH_ULC_POLL_DL_ASS, gre); @@ -698,37 +698,35 @@ return rc; } -static int gprs_rlcmac_handle_pkt_ul_ack_nack(const struct osmo_gprs_rlcmac_prim *rlcmac_prim, const RlcMacDownlink_t *dl_block) +static int gprs_rlcmac_handle_pkt_ul_ack_nack(const struct gprs_rlcmac_dl_block_ind *dlbi) { struct gprs_rlcmac_ul_tbf *ul_tbf; int rc; - const Packet_Uplink_Ack_Nack_t *pkt_ul_ack = &dl_block->u.Packet_Uplink_Ack_Nack; + const Packet_Uplink_Ack_Nack_t *pkt_ul_ack = &dlbi->dl_block.u.Packet_Uplink_Ack_Nack; ul_tbf = gprs_rlcmac_find_ul_tbf_by_tfi(pkt_ul_ack->UPLINK_TFI); if (!ul_tbf) { LOGRLCMAC(LOGL_INFO, "TS=%u FN=%u Rx Pkt UL ACK/NACK: UL_TBF TFI=%u not found\n", - rlcmac_prim->l1ctl.pdch_data_ind.ts_nr, - rlcmac_prim->l1ctl.pdch_data_ind.fn, - pkt_ul_ack->UPLINK_TFI); + dlbi->ts_nr, dlbi->fn, pkt_ul_ack->UPLINK_TFI); return -ENOENT; } - rc = gprs_rlcmac_ul_tbf_handle_pkt_ul_ack_nack(ul_tbf, dl_block); + rc = gprs_rlcmac_ul_tbf_handle_pkt_ul_ack_nack(ul_tbf, &dlbi->dl_block); /* If RRBP contains valid data, schedule a response (PKT CONTROL ACK or PKT RESOURCE REQ). */ - if (dl_block->SP) { - uint32_t poll_fn = rrbp2fn(rlcmac_prim->l1ctl.pdch_data_ind.fn, dl_block->RRBP); - gprs_rlcmac_pdch_ulc_reserve(g_rlcmac_ctx->sched.ulc[rlcmac_prim->l1ctl.pdch_data_ind.ts_nr], poll_fn, + if (dlbi->dl_block.SP) { + uint32_t poll_fn = rrbp2fn(dlbi->fn, dlbi->dl_block.RRBP); + gprs_rlcmac_pdch_ulc_reserve(g_rlcmac_ctx->sched.ulc[dlbi->ts_nr], poll_fn, GPRS_RLCMAC_PDCH_ULC_POLL_UL_ACK, ul_tbf_as_tbf(ul_tbf)); } return rc; } -static int gprs_rlcmac_handle_pkt_ul_ass(const struct osmo_gprs_rlcmac_prim *rlcmac_prim, const RlcMacDownlink_t *dl_block) +static int gprs_rlcmac_handle_pkt_ul_ass(const struct gprs_rlcmac_dl_block_ind *dlbi) { struct gprs_rlcmac_entity *gre = NULL; - const Packet_Uplink_Assignment_t *ulass = &dl_block->u.Packet_Uplink_Assignment; + const Packet_Uplink_Assignment_t *ulass = &dlbi->dl_block.u.Packet_Uplink_Assignment; int rc; /* Attempt to find relevant MS owning UL TBF in assignment state from ID (set "gre" ptr): */ @@ -742,27 +740,23 @@ case 2: /* TQI */ case 3: /* Packet_Request_Reference */ LOGRLCMAC(LOGL_NOTICE, "TS=%u FN=%u Rx Pkt UL ASS: HANDLING OF ID=%u NOT IMPLEMENTED!\n", - ulass->ID.UnionType, - rlcmac_prim->l1ctl.pdch_data_ind.ts_nr, - rlcmac_prim->l1ctl.pdch_data_ind.fn); + ulass->ID.UnionType, dlbi->ts_nr, dlbi->fn); break; } if (!gre) { LOGRLCMAC(LOGL_INFO, "TS=%u FN=%u Rx Pkt UL ASS: MS not found\n", - rlcmac_prim->l1ctl.pdch_data_ind.ts_nr, - rlcmac_prim->l1ctl.pdch_data_ind.fn); + dlbi->ts_nr, dlbi->fn); return -ENOENT; } if (!gre->ul_tbf) { LOGGRE(gre, LOGL_INFO, "TS=%u FN=%u Rx Pkt UL ASS: MS has no UL TBF\n", - rlcmac_prim->l1ctl.pdch_data_ind.ts_nr, - rlcmac_prim->l1ctl.pdch_data_ind.fn); + dlbi->ts_nr, dlbi->fn); return -ENOENT; } - rc = gprs_rlcmac_ul_tbf_handle_pkt_ul_ass(gre->ul_tbf, rlcmac_prim, dl_block); + rc = gprs_rlcmac_ul_tbf_handle_pkt_ul_ass(gre->ul_tbf, dlbi); return rc; } @@ -770,7 +764,7 @@ static int gprs_rlcmac_handle_gprs_dl_ctrl_block(const struct osmo_gprs_rlcmac_prim *rlcmac_prim) { struct bitvec *bv; - RlcMacDownlink_t *dl_ctrl_block; + struct gprs_rlcmac_dl_block_ind *dlbi; size_t max_len = gprs_rlcmac_mcs_max_bytes_dl(GPRS_RLCMAC_CS_1); int rc; @@ -778,9 +772,11 @@ OSMO_ASSERT(bv); bitvec_unpack(bv, rlcmac_prim->l1ctl.pdch_data_ind.data); - dl_ctrl_block = (RlcMacDownlink_t *)talloc_zero(g_rlcmac_ctx, RlcMacDownlink_t); - OSMO_ASSERT(dl_ctrl_block); - rc = osmo_gprs_rlcmac_decode_downlink(bv, dl_ctrl_block); + dlbi = (struct gprs_rlcmac_dl_block_ind *)talloc_zero(g_rlcmac_ctx, struct gprs_rlcmac_dl_block_ind); + dlbi->fn = rlcmac_prim->l1ctl.pdch_data_ind.fn; + dlbi->ts_nr = rlcmac_prim->l1ctl.pdch_data_ind.ts_nr; + OSMO_ASSERT(dlbi); + rc = osmo_gprs_rlcmac_decode_downlink(bv, &dlbi->dl_block); if (rc < 0) { LOGRLCMAC(LOGL_NOTICE, "Failed decoding dl ctrl block: %s\n", osmo_hexdump(rlcmac_prim->l1ctl.pdch_data_ind.data, @@ -788,32 +784,30 @@ goto free_ret; } - LOGRLCMAC(LOGL_INFO, "TS=%u FN=%u Rx %s\n", - rlcmac_prim->l1ctl.pdch_data_ind.ts_nr, - rlcmac_prim->l1ctl.pdch_data_ind.fn, - get_value_string(osmo_gprs_rlcmac_dl_msg_type_names, dl_ctrl_block->u.MESSAGE_TYPE)); + LOGRLCMAC(LOGL_INFO, "TS=%u FN=%u Rx %s\n", dlbi->ts_nr, dlbi->fn, + get_value_string(osmo_gprs_rlcmac_dl_msg_type_names, dlbi->dl_block.u.MESSAGE_TYPE)); - switch (dl_ctrl_block->u.MESSAGE_TYPE) { + switch (dlbi->dl_block.u.MESSAGE_TYPE) { case OSMO_GPRS_RLCMAC_DL_MSGT_PACKET_DOWNLINK_ASSIGNMENT: - rc = gprs_rlcmac_handle_pkt_dl_ass(rlcmac_prim, dl_ctrl_block); + rc = gprs_rlcmac_handle_pkt_dl_ass(dlbi); break; case OSMO_GPRS_RLCMAC_DL_MSGT_PACKET_UPLINK_ACK_NACK: - rc = gprs_rlcmac_handle_pkt_ul_ack_nack(rlcmac_prim, dl_ctrl_block); + rc = gprs_rlcmac_handle_pkt_ul_ack_nack(dlbi); break; case OSMO_GPRS_RLCMAC_DL_MSGT_PACKET_UPLINK_ASSIGNMENT: - rc = gprs_rlcmac_handle_pkt_ul_ass(rlcmac_prim, dl_ctrl_block); + rc = gprs_rlcmac_handle_pkt_ul_ass(dlbi); break; case OSMO_GPRS_RLCMAC_DL_MSGT_PACKET_DOWNLINK_DUMMY_CONTROL_BLOCK: break; /* Ignore dummy blocks */ default: LOGRLCMAC(LOGL_ERROR, "TS=%u FN=%u Rx %s NOT SUPPORTED! ignoring\n", - rlcmac_prim->l1ctl.pdch_data_ind.ts_nr, - rlcmac_prim->l1ctl.pdch_data_ind.fn, - get_value_string(osmo_gprs_rlcmac_dl_msg_type_names, dl_ctrl_block->u.MESSAGE_TYPE)); + dlbi->ts_nr, + dlbi->fn, + get_value_string(osmo_gprs_rlcmac_dl_msg_type_names, dlbi->dl_block.u.MESSAGE_TYPE)); } free_ret: - talloc_free(dl_ctrl_block); + talloc_free(dlbi); bitvec_free(bv); return rc; } diff --git a/src/rlcmac/tbf_ul.c b/src/rlcmac/tbf_ul.c index 34268ee..c6d81d4 100644 --- a/src/rlcmac/tbf_ul.c +++ b/src/rlcmac/tbf_ul.c @@ -352,14 +352,13 @@ } int gprs_rlcmac_ul_tbf_handle_pkt_ul_ass(struct gprs_rlcmac_ul_tbf *ul_tbf, - const struct osmo_gprs_rlcmac_prim *rlcmac_prim, - const RlcMacDownlink_t *dl_block) + const struct gprs_rlcmac_dl_block_ind *dlbi) { int rc; struct tbf_ul_ass_ev_rx_pkt_ul_ass_ctx d = { - .ts_nr = rlcmac_prim->l1ctl.pdch_data_ind.ts_nr, - .fn = rlcmac_prim->l1ctl.pdch_data_ind.fn, - .dl_block = dl_block, + .ts_nr = dlbi->ts_nr, + .fn = dlbi->fn, + .dl_block = &dlbi->dl_block, }; rc = osmo_fsm_inst_dispatch(ul_tbf->ul_ass_fsm.fi, GPRS_RLCMAC_TBF_UL_ASS_EV_RX_PKT_UL_ASS, &d); -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/35782?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Ifa09cd70c915aa3a2b799412cb02315aaebc0503 Gerrit-Change-Number: 35782 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in libosmo-gprs[master]: rlcmac: ul_tbf: Register UL ACK/NACK poll inside FSM
by pespin 02 Feb '24

02 Feb '24
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/35783?usp=email ) Change subject: rlcmac: ul_tbf: Register UL ACK/NACK poll inside FSM ...................................................................... rlcmac: ul_tbf: Register UL ACK/NACK poll inside FSM The poll is part of the FSM mechanism to get events to transit over the different states. Register it from within the FSM to have more fine grained control as well as have knowledge about the FN being reserved. This knowledge will be used ina follow up patch for the UL TBF to wait for the correct PKT CTRL ACK BLOCk.conf. Change-Id: Iaa8ad8052b9f3b52b05af2b7fc9cb8172f1b6bb7 --- M include/osmocom/gprs/rlcmac/tbf_ul.h M include/osmocom/gprs/rlcmac/tbf_ul_fsm.h M src/rlcmac/rlcmac.c M src/rlcmac/tbf_ul.c M src/rlcmac/tbf_ul_fsm.c M tests/rlcmac/rlcmac_prim_test.err 6 files changed, 67 insertions(+), 27 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/83/35783/1 diff --git a/include/osmocom/gprs/rlcmac/tbf_ul.h b/include/osmocom/gprs/rlcmac/tbf_ul.h index c30a566..847b965 100644 --- a/include/osmocom/gprs/rlcmac/tbf_ul.h +++ b/include/osmocom/gprs/rlcmac/tbf_ul.h @@ -71,7 +71,7 @@ struct msgb *gprs_rlcmac_ul_tbf_dummy_create(struct gprs_rlcmac_ul_tbf *ul_tbf); int gprs_rlcmac_ul_tbf_handle_pkt_ul_ack_nack(struct gprs_rlcmac_ul_tbf *ul_tbf, - const RlcMacDownlink_t *dl_block); + const struct gprs_rlcmac_dl_block_ind *dlbi); int gprs_rlcmac_ul_tbf_handle_pkt_ul_ass(struct gprs_rlcmac_ul_tbf *ul_tbf, const struct gprs_rlcmac_dl_block_ind *dlbi); diff --git a/include/osmocom/gprs/rlcmac/tbf_ul_fsm.h b/include/osmocom/gprs/rlcmac/tbf_ul_fsm.h index 059dad4..e3aeb3f 100644 --- a/include/osmocom/gprs/rlcmac/tbf_ul_fsm.h +++ b/include/osmocom/gprs/rlcmac/tbf_ul_fsm.h @@ -42,8 +42,7 @@ }; struct tbf_ul_ass_ev_rx_ul_ack_nack { - bool final_ack; - bool tbf_est; + const struct gprs_rlcmac_dl_block_ind *dlbi; }; int gprs_rlcmac_tbf_ul_fsm_init(void); diff --git a/src/rlcmac/rlcmac.c b/src/rlcmac/rlcmac.c index 590bb49..3ed8368 100644 --- a/src/rlcmac/rlcmac.c +++ b/src/rlcmac/rlcmac.c @@ -710,16 +710,7 @@ dlbi->ts_nr, dlbi->fn, pkt_ul_ack->UPLINK_TFI); return -ENOENT; } - - rc = gprs_rlcmac_ul_tbf_handle_pkt_ul_ack_nack(ul_tbf, &dlbi->dl_block); - - /* If RRBP contains valid data, schedule a response (PKT CONTROL ACK or PKT RESOURCE REQ). */ - if (dlbi->dl_block.SP) { - uint32_t poll_fn = rrbp2fn(dlbi->fn, dlbi->dl_block.RRBP); - gprs_rlcmac_pdch_ulc_reserve(g_rlcmac_ctx->sched.ulc[dlbi->ts_nr], poll_fn, - GPRS_RLCMAC_PDCH_ULC_POLL_UL_ACK, - ul_tbf_as_tbf(ul_tbf)); - } + rc = gprs_rlcmac_ul_tbf_handle_pkt_ul_ack_nack(ul_tbf, dlbi); return rc; } diff --git a/src/rlcmac/tbf_ul.c b/src/rlcmac/tbf_ul.c index c6d81d4..3d4ba2b 100644 --- a/src/rlcmac/tbf_ul.c +++ b/src/rlcmac/tbf_ul.c @@ -305,9 +305,9 @@ } int gprs_rlcmac_ul_tbf_handle_pkt_ul_ack_nack(struct gprs_rlcmac_ul_tbf *ul_tbf, - const RlcMacDownlink_t *dl_block) + const struct gprs_rlcmac_dl_block_ind *dlbi) { - const Packet_Uplink_Ack_Nack_t *ack = &dl_block->u.Packet_Uplink_Ack_Nack; + const Packet_Uplink_Ack_Nack_t *ack = &dlbi->dl_block.u.Packet_Uplink_Ack_Nack; const PU_AckNack_GPRS_t *gprs = &ack->u.PU_AckNack_GPRS_Struct; const Ack_Nack_Description_t *ack_desc = &gprs->Ack_Nack_Description; int bsn_begin, bsn_end; @@ -321,8 +321,7 @@ }; int rc; struct tbf_ul_ass_ev_rx_ul_ack_nack ev_ack = { - .final_ack = ack_desc->FINAL_ACK_INDICATION, - .tbf_est = (gprs->Exist_AdditionsR99 && gprs->AdditionsR99.TBF_EST), + .dlbi = dlbi, }; num_blocks = gprs_rlcmac_decode_gprs_acknack_bits( diff --git a/src/rlcmac/tbf_ul_fsm.c b/src/rlcmac/tbf_ul_fsm.c index 0949ca6..92d1d64 100644 --- a/src/rlcmac/tbf_ul_fsm.c +++ b/src/rlcmac/tbf_ul_fsm.c @@ -27,8 +27,11 @@ #include <osmocom/gprs/rlcmac/tbf_ul.h> #include <osmocom/gprs/rlcmac/rlc_window_ul.h> #include <osmocom/gprs/rlcmac/gre.h> +#include <osmocom/gprs/rlcmac/pdch_ul_controller.h> #define X(s) (1 << (s)) +#define LOGPFSMLDLBI(fi, dlbi, lvl, fmt, args...) \ + LOGPFSML(fi, lvl, "(ts=%u,fn=%u) " fmt, (dlbi)->ts_nr, (dlbi)->fn, ## args) static const struct value_string tbf_ul_fsm_event_names[] = { { GPRS_RLCMAC_TBF_UL_EV_UL_ASS_START, "UL_ASS_START" }, @@ -198,12 +201,30 @@ reinit_pkt_acces_procedure(ctx); break; case GPRS_RLCMAC_TBF_UL_EV_RX_UL_ACK_NACK: + { + struct tbf_ul_ass_ev_rx_ul_ack_nack *ctx_ul_ack_nack = (struct tbf_ul_ass_ev_rx_ul_ack_nack *)data; + const struct gprs_rlcmac_dl_block_ind *dlbi = ctx_ul_ack_nack->dlbi; + const Packet_Uplink_Ack_Nack_t *ack = &dlbi->dl_block.u.Packet_Uplink_Ack_Nack; + const PU_AckNack_GPRS_t *gprs = &ack->u.PU_AckNack_GPRS_Struct; + const Ack_Nack_Description_t *ack_desc = &gprs->Ack_Nack_Description; + if (gprs_rlcmac_ul_tbf_in_contention_resolution(ctx->ul_tbf)) { _contention_resolution_succeeded(ctx); } + /* If RRBP contains valid data, schedule a response (PKT CONTROL ACK or PKT RESOURCE REQ). */ + if (dlbi->dl_block.SP) { + uint32_t poll_fn = rrbp2fn(dlbi->fn, dlbi->dl_block.RRBP); + gprs_rlcmac_pdch_ulc_reserve(g_rlcmac_ctx->sched.ulc[dlbi->ts_nr], poll_fn, + GPRS_RLCMAC_PDCH_ULC_POLL_UL_ACK, + ul_tbf_as_tbf(ctx->ul_tbf)); + } /* It's impossible we receive a correct final_ack here, since we didn't * sent last data (FSM would be in FINISHED state then) */ + if (ack_desc->FINAL_ACK_INDICATION) + LOGPFSMLDLBI(ctx->fi, dlbi, LOGL_INFO, "Rx unexpected final_ack while not finished sending blocks. Network bug!\n"); + break; + } case GPRS_RLCMAC_TBF_UL_EV_LAST_UL_DATA_SENT: arm_T3182_if_needed(ctx); tbf_ul_fsm_state_chg(fi, GPRS_RLCMAC_TBF_UL_ST_FINISHED); @@ -216,13 +237,18 @@ static void st_finished(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct gprs_rlcmac_tbf_ul_fsm_ctx *ctx = (struct gprs_rlcmac_tbf_ul_fsm_ctx *)fi->priv; - struct tbf_ul_ass_ev_rx_ul_ack_nack *ctx_ul_ack_nack; switch (event) { case GPRS_RLCMAC_TBF_UL_EV_N3104_MAX: reinit_pkt_acces_procedure(ctx); break; case GPRS_RLCMAC_TBF_UL_EV_RX_UL_ACK_NACK: - ctx_ul_ack_nack = (struct tbf_ul_ass_ev_rx_ul_ack_nack *)data; + { + struct tbf_ul_ass_ev_rx_ul_ack_nack *ctx_ul_ack_nack = (struct tbf_ul_ass_ev_rx_ul_ack_nack *)data; + const struct gprs_rlcmac_dl_block_ind *dlbi = ctx_ul_ack_nack->dlbi; + const Packet_Uplink_Ack_Nack_t *ack = &dlbi->dl_block.u.Packet_Uplink_Ack_Nack; + const PU_AckNack_GPRS_t *gprs = &ack->u.PU_AckNack_GPRS_Struct; + const Ack_Nack_Description_t *ack_desc = &gprs->Ack_Nack_Description; + if (gprs_rlcmac_ul_tbf_in_contention_resolution(ctx->ul_tbf)) { _contention_resolution_succeeded(ctx); } else if (fi->T == 3182 && osmo_timer_pending(&fi->timer)) { @@ -230,16 +256,25 @@ * the mobile station shall stop timer T3182 for the TBF". * In our case we only use T3128 once we are out of contention resolution (T3166) */ - LOGPFSML(ctx->fi, LOGL_DEBUG, "Rx Pkt UL ACK/NACK, stop T3182\n"); + LOGPFSMLDLBI(ctx->fi, dlbi, LOGL_DEBUG, "Rx Pkt UL ACK/NACK, stop T3182\n"); osmo_timer_del(&fi->timer); fi->T = 0; } - if (ctx_ul_ack_nack->final_ack) { - LOGPFSML(ctx->fi, LOGL_DEBUG, "Final ACK received\n"); - ctx->rx_final_pkt_ul_ack_nack_has_tbf_est = ctx_ul_ack_nack->tbf_est; + /* If RRBP contains valid data, schedule a response (PKT CONTROL ACK or PKT RESOURCE REQ). */ + if (dlbi->dl_block.SP) { + uint32_t poll_fn = rrbp2fn(dlbi->fn, dlbi->dl_block.RRBP); + gprs_rlcmac_pdch_ulc_reserve(g_rlcmac_ctx->sched.ulc[dlbi->ts_nr], poll_fn, + GPRS_RLCMAC_PDCH_ULC_POLL_UL_ACK, + ul_tbf_as_tbf(ctx->ul_tbf)); + } + if (ack_desc->FINAL_ACK_INDICATION) { + bool tbf_est = (gprs->Exist_AdditionsR99 && gprs->AdditionsR99.TBF_EST); + LOGPFSMLDLBI(ctx->fi, dlbi, LOGL_DEBUG, "Final ACK received\n"); + ctx->rx_final_pkt_ul_ack_nack_has_tbf_est = tbf_est; tbf_ul_fsm_state_chg(fi, GPRS_RLCMAC_TBF_UL_ST_RELEASING); } break; + } case GPRS_RLCMAC_TBF_UL_EV_LAST_UL_DATA_SENT: /* If LAST_UL_DATA_SENT is received in this state, it means the UL TBF is retransmitting the block. */ ctx->last_data_block_retrans_attempts++; diff --git a/tests/rlcmac/rlcmac_prim_test.err b/tests/rlcmac/rlcmac_prim_test.err index c6c4ebc..366e321 100644 --- a/tests/rlcmac/rlcmac_prim_test.err +++ b/tests/rlcmac/rlcmac_prim_test.err @@ -61,9 +61,9 @@ DLGLOBAL DEBUG TBF(UL:NR-0:TLLI-00002342) V(B): (V(A)=2)""(V(S)-1=1) A=Acked N=Nacked U=Unacked X=Resend-Unacked I=Invalid DLGLOBAL INFO UL_TBF{FINISHED}: Received Event RX_UL_ACK_NACK DLGLOBAL INFO UL_TBF{FINISHED}: Contention resolution succeeded, stop T3166 -DLGLOBAL DEBUG UL_TBF{FINISHED}: Final ACK received -DLGLOBAL INFO UL_TBF{FINISHED}: state_chg to RELEASING DLGLOBAL DEBUG Register POLL (TS=7 FN=21, reason=UL_ACK) +DLGLOBAL DEBUG UL_TBF{FINISHED}: (ts=7,fn=8) Final ACK received +DLGLOBAL INFO UL_TBF{FINISHED}: state_chg to RELEASING DLGLOBAL DEBUG Rx from lower layers: L1CTL-PDCH_RTS.indication DLGLOBAL DEBUG Rx RTS.ind (fn=21, ts=7, usf=0) DLGLOBAL DEBUG (ts=7,fn=21,usf=0) Tx Pkt Control Ack (UL ACK/NACK poll) @@ -933,9 +933,9 @@ DLGLOBAL DEBUG TBF(UL:NR-0:TLLI-00002342) V(B): (V(A)=1)""(V(S)-1=0) A=Acked N=Nacked U=Unacked X=Resend-Unacked I=Invalid DLGLOBAL INFO UL_TBF{FINISHED}: Received Event RX_UL_ACK_NACK DLGLOBAL INFO UL_TBF{FINISHED}: Contention resolution succeeded, stop T3166 -DLGLOBAL DEBUG UL_TBF{FINISHED}: Final ACK received -DLGLOBAL INFO UL_TBF{FINISHED}: state_chg to RELEASING DLGLOBAL DEBUG Register POLL (TS=7 FN=17, reason=UL_ACK) +DLGLOBAL DEBUG UL_TBF{FINISHED}: (ts=7,fn=4) Final ACK received +DLGLOBAL INFO UL_TBF{FINISHED}: state_chg to RELEASING DLGLOBAL INFO Rx from upper layers: GRR-UNITDATA.request DLGLOBAL DEBUG GRE(00002342) Enqueueing LLC-PDU len=14 SAPI=GMM radio_prio=1 DLGLOBAL DEBUG Rx from lower layers: L1CTL-PDCH_RTS.indication -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/35783?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Iaa8ad8052b9f3b52b05af2b7fc9cb8172f1b6bb7 Gerrit-Change-Number: 35783 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-sgsn[master]: ctrl: Add ctrl trap on PDP Context changes
by matanp 02 Feb '24

02 Feb '24
matanp has abandoned this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/35781?usp=email ) Change subject: ctrl: Add ctrl trap on PDP Context changes ...................................................................... Abandoned To similar to CDR CTRL -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/35781?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: Ie0ab550125372047e8267f008fe1dfd0cc70148a Gerrit-Change-Number: 35781 Gerrit-PatchSet: 1 Gerrit-Owner: matanp <matan1008(a)gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-MessageType: abandon
1 0
0 0
[M] Change in osmo-sgsn[master]: ctrl: Add ctrl trap on PDP Context changes
by matanp 02 Feb '24

02 Feb '24
matanp has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/35781?usp=email ) Change subject: ctrl: Add ctrl trap on PDP Context changes ...................................................................... ctrl: Add ctrl trap on PDP Context changes This change allows to easily understand PDP context status changes. The trap sent contains the following (in a comma delimited format): status, IMSI, SAPI, NSAPI, TI, APN if found, IP address if found, IPv6 address in case the MS has both. Change-Id: Ie0ab550125372047e8267f008fe1dfd0cc70148a --- M include/osmocom/sgsn/sgsn.h M src/sgsn/sgsn.c M src/sgsn/sgsn_ctrl.c 3 files changed, 94 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/81/35781/1 diff --git a/include/osmocom/sgsn/sgsn.h b/include/osmocom/sgsn/sgsn.h index 6e93178..75a70ec 100644 --- a/include/osmocom/sgsn/sgsn.h +++ b/include/osmocom/sgsn/sgsn.h @@ -169,7 +169,7 @@ /* * ctrl interface related work (sgsn_ctrl.c) */ -int sgsn_ctrl_cmds_install(void); +int sgsn_ctrl_cmds_install(struct sgsn_instance *sgsn); /* sgsn_vty.c */ diff --git a/src/sgsn/sgsn.c b/src/sgsn/sgsn.c index 6619bf2..99ad031 100644 --- a/src/sgsn/sgsn.c +++ b/src/sgsn/sgsn.c @@ -200,7 +200,7 @@ return -EIO; } - rc = sgsn_ctrl_cmds_install(); + rc = sgsn_ctrl_cmds_install(sgsn); if (rc != 0) { LOGP(DGPRS, LOGL_ERROR, "Failed to install CTRL commands.\n"); return -EFAULT; diff --git a/src/sgsn/sgsn_ctrl.c b/src/sgsn/sgsn_ctrl.c index 069304a..addb85e 100644 --- a/src/sgsn/sgsn_ctrl.c +++ b/src/sgsn/sgsn_ctrl.c @@ -25,6 +25,8 @@ #include <osmocom/sgsn/pdpctx.h> #include <osmocom/sgsn/sgsn.h> #include <osmocom/sgsn/debug.h> +#include <osmocom/sgsn/signal.h> +#include <osmocom/gsm/apn.h> #include <pdp.h> @@ -53,9 +55,84 @@ } CTRL_CMD_DEFINE_RO(subscriber_list, "subscriber-list-active-v1"); -int sgsn_ctrl_cmds_install(void) +/* Sends trap for PDP context status changes. + * format: <status>,<imsi>,<sapi>,<nsapi>,<ti>,<apn>,<ip>[,<ipv6>] + */ +static int handle_pdp_status_change(unsigned int subsys, unsigned int signal, + void *handler_data, void *_signal_data) +{ + struct sgsn_signal_data *signal_data = _signal_data; + struct sgsn_instance *inst = handler_data; + struct sgsn_pdp_ctx *pdp = signal_data->pdp; + struct ctrl_cmd *cmd; + char *status, *imsi; + char apnbuf[APN_MAXLEN + 1]; + + if (subsys != SS_SGSN) + return 0; + + if (!pdp) + return 0; + + switch (signal) { + case S_SGSN_PDP_ACT: + status = "activate"; + break; + case S_SGSN_PDP_DEACT: + status = "deactivate"; + break; + case S_SGSN_PDP_TERMINATE: + status = "terminate"; + break; + case S_SGSN_PDP_FREE: + status = "free"; + break; + default: + return 0; + } + + cmd = ctrl_cmd_create(NULL, CTRL_TYPE_TRAP); + if (!cmd) + goto err; + + cmd->id = "0"; + cmd->node = inst; + cmd->variable = "pdp_status"; + + imsi = pdp->mm ? pdp->mm->imsi : ""; + cmd->reply = talloc_asprintf(cmd, "%s,%s,%u,%u,%u", status, imsi, pdp->sapi, pdp->nsapi, pdp->ti); + + if (!cmd->reply) + goto err; + + if (pdp->lib) { + cmd->reply = talloc_asprintf_append(cmd->reply, ",%s,%s", + osmo_apn_to_str(apnbuf, pdp->lib->apn_use.v, pdp->lib->apn_use.l), + gprs_pdpaddr2str(pdp->lib->eua.v, pdp->lib->eua.l, false)); + if (!cmd->reply) + goto err; + + if (pdp->lib->eua.v[1] == PDP_TYPE_N_IETF_IPv4v6) { + cmd->reply = talloc_asprintf_append(cmd->reply, ",%s", + gprs_pdpaddr2str(pdp->lib->eua.v, pdp->lib->eua.l, true)); + if (!cmd->reply) + goto err; + } + } + + ctrl_cmd_send_to_all(inst->ctrlh, cmd); + talloc_free(cmd); + return 0; + +err: + LOGP(DCTRL, LOGL_ERROR, "Trap creation failed.\n"); + return 0; +} + +int sgsn_ctrl_cmds_install(struct sgsn_instance *sgsn) { int rc = 0; rc |= ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_subscriber_list); + rc |= osmo_signal_register_handler(SS_SGSN, handle_pdp_status_change, sgsn); return rc; } -- To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/35781?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: Ie0ab550125372047e8267f008fe1dfd0cc70148a Gerrit-Change-Number: 35781 Gerrit-PatchSet: 1 Gerrit-Owner: matanp <matan1008(a)gmail.com> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: cosmetic: clarify GPRS related L1CTL logging
by pespin 02 Feb '24

02 Feb '24
Attention is currently required from: fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35779?usp=email ) Change subject: layer23: cosmetic: clarify GPRS related L1CTL logging ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35779?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Idcde85c132a52b7bc6c3f2f58c2eac0a509b7b43 Gerrit-Change-Number: 35779 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Fri, 02 Feb 2024 12:06:09 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmocom-bb[master]: trxcon/l1sched: trigger sending UL BLOCK.cnf for PDTCH
by pespin 02 Feb '24

02 Feb '24
Attention is currently required from: fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35778?usp=email ) Change subject: trxcon/l1sched: trigger sending UL BLOCK.cnf for PDTCH ...................................................................... Patch Set 1: (1 comment) Patchset: PS1: We are still missing selectively sending the conf, aka in .req saying needs_conf=true. -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35778?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: If32fafeef0ea347ed3800e6b67349bf12e66047f Gerrit-Change-Number: 35778 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Fri, 02 Feb 2024 12:05:49 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmocom-bb[master]: trxcon/l1sched: trigger sending UL BLOCK.cnf for PDTCH
by pespin 02 Feb '24

02 Feb '24
Attention is currently required from: fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35778?usp=email ) Change subject: trxcon/l1sched: trigger sending UL BLOCK.cnf for PDTCH ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35778?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: If32fafeef0ea347ed3800e6b67349bf12e66047f Gerrit-Change-Number: 35778 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Fri, 02 Feb 2024 12:05:25 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmocom-bb[master]: l1gprs: implement UL BLOCK.cnf (L1CTL_GPRS_UL_BLOCK_CNF)
by pespin 02 Feb '24

02 Feb '24
Attention is currently required from: fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35777?usp=email ) Change subject: l1gprs: implement UL BLOCK.cnf (L1CTL_GPRS_UL_BLOCK_CNF) ...................................................................... Patch Set 1: Code-Review+1 (1 comment) File src/shared/l1gprs.c: https://gerrit.osmocom.org/c/osmocom-bb/+/35777/comment/87c36d10_b4f465eb PS1, Line 690: /* TODO: include the block data? */ yeah that would be great. -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35777?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I56e0b5631c7446390adbfc5664e56f56ebb88cc1 Gerrit-Change-Number: 35777 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Fri, 02 Feb 2024 12:03:21 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmocom-bb[master]: l1gprs: minor changes to l1gprs_handle_rts_ind()
by pespin 02 Feb '24

02 Feb '24
Attention is currently required from: fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35776?usp=email ) Change subject: l1gprs: minor changes to l1gprs_handle_rts_ind() ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35776?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Ie74d1c4123715d61875c4c956eb4a1ce97ed5f24 Gerrit-Change-Number: 35776 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Fri, 02 Feb 2024 12:01:06 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmocom-bb[master]: l1gprs: implement UL BLOCK.cnf (L1CTL_GPRS_UL_BLOCK_CNF)
by fixeria 02 Feb '24

02 Feb '24
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35777?usp=email ) Change subject: l1gprs: implement UL BLOCK.cnf (L1CTL_GPRS_UL_BLOCK_CNF) ...................................................................... l1gprs: implement UL BLOCK.cnf (L1CTL_GPRS_UL_BLOCK_CNF) Change-Id: I56e0b5631c7446390adbfc5664e56f56ebb88cc1 --- M include/l1ctl_proto.h M include/l1gprs.h M src/shared/l1gprs.c 3 files changed, 55 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/77/35777/1 diff --git a/include/l1ctl_proto.h b/include/l1ctl_proto.h index 941a947..ab98b09 100644 --- a/include/l1ctl_proto.h +++ b/include/l1ctl_proto.h @@ -60,6 +60,7 @@ /* Extended (11-bit) RACH (see 3GPP TS 05.02, section 5.2.7) */ L1CTL_EXT_RACH_REQ = 0x24, L1CTL_GPRS_RTS_IND = 0x25, + L1CTL_GPRS_UL_BLOCK_CNF = 0x26, }; enum ccch_mode { @@ -401,4 +402,10 @@ uint8_t usf; } __attribute__((packed)); +/* payload of L1CTL_GPRS_UL_BLOCK_CNF */ +struct l1ctl_gprs_ul_block_cnf { + uint32_t fn; + uint8_t tn; +} __attribute__((packed)); + #endif /* __L1CTL_PROTO_H__ */ diff --git a/include/l1gprs.h b/include/l1gprs.h index 57380d3..1c77525 100644 --- a/include/l1gprs.h +++ b/include/l1gprs.h @@ -111,6 +111,8 @@ int l1gprs_handle_ul_block_req(struct l1gprs_state *gprs, struct l1gprs_prim_ul_block_req *req, const struct msgb *msg); +struct msgb *l1gprs_handle_ul_block_cnf(struct l1gprs_state *gprs, + uint32_t fn, uint8_t tn); struct msgb *l1gprs_handle_dl_block_ind(struct l1gprs_state *gprs, const struct l1gprs_prim_dl_block_ind *ind, uint8_t *usf); struct msgb *l1gprs_handle_rts_ind(struct l1gprs_state *gprs, uint32_t fn, uint8_t tn, uint8_t usf); diff --git a/src/shared/l1gprs.c b/src/shared/l1gprs.c index 1da2276..d93a149 100644 --- a/src/shared/l1gprs.c +++ b/src/shared/l1gprs.c @@ -1,7 +1,7 @@ /* * l1gprs - GPRS layer 1 implementation * - * (C) 2022-2023 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * (C) 2022-2024 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> * Author: Vadim Yanitskiy <vyanitskiy(a)sysmocom.de> * * All Rights Reserved @@ -656,6 +656,42 @@ return 0; } +struct msgb *l1gprs_handle_ul_block_cnf(struct l1gprs_state *gprs, + uint32_t fn, uint8_t tn) +{ + const struct l1gprs_pdch *pdch = NULL; + struct l1ctl_gprs_ul_block_cnf *l1bc; + struct msgb *msg; + + OSMO_ASSERT(tn < ARRAY_SIZE(gprs->pdch)); + pdch = &gprs->pdch[tn]; + + LOGP_PDCH(pdch, LOGL_DEBUG, "Rx UL BLOCK.cnf (fn=%u)\n", fn); + + if (pdch->ul_tbf_count + pdch->dl_tbf_count == 0) { + LOGP_PDCH(pdch, LOGL_ERROR, + "Rx UL BLOCK.cnf (fn=%u), but this PDCH has no active TBFs\n", + fn); + return NULL; + } + + msg = l1gprs_l1ctl_msgb_alloc(L1CTL_GPRS_UL_BLOCK_CNF); + if (OSMO_UNLIKELY(msg == NULL)) { + LOGP_GPRS(gprs, LOGL_ERROR, "l1gprs_l1ctl_msgb_alloc() failed\n"); + return NULL; + } + + l1bc = (void *)msgb_put(msg, sizeof(*l1bc)); + *l1bc = (struct l1ctl_gprs_ul_block_cnf) { + .fn = htonl(fn), + .tn = tn, + }; + + /* TODO: include the block data? */ + + return msg; +} + /* Check if a Downlink block is a PTCCH/D (see 3GPP TS 45.002, table 6) */ #define BLOCK_IND_IS_PTCCH(ind) \ (((ind)->hdr.fn % 104) == 12) -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35777?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I56e0b5631c7446390adbfc5664e56f56ebb88cc1 Gerrit-Change-Number: 35777 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • ...
  • 175
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.