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 -----
  • 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

April 2023

  • 1 participants
  • 2252 discussions
[S] Change in osmo-pcu[master]: pcu_l1_if: cosmetic: reformat comment
by laforge 14 Apr '23

14 Apr '23
Attention is currently required from: dexter. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/32306 ) Change subject: pcu_l1_if: cosmetic: reformat comment ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/32306 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: Ib4ae65e1bc118572135fbec02e64dbec35f208b4 Gerrit-Change-Number: 32306 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Fri, 14 Apr 2023 15:37:19 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: modem: sndcp: Apply API change in libosmo-gprs-sncp
by pespin 14 Apr '23

14 Apr '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32313 ) Change subject: layer23: modem: sndcp: Apply API change in libosmo-gprs-sncp ...................................................................... layer23: modem: sndcp: Apply API change in libosmo-gprs-sncp Depends: libosmo-gprs.git Change-Id Iebce37a50917b13c23de1528469d66c310ced7f2 Related: OS#5502 Change-Id: I4f559e4a882a85742c45609dec596f0485eafed0 --- M src/host/layer23/src/modem/sndcp.c 1 file changed, 12 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/13/32313/1 diff --git a/src/host/layer23/src/modem/sndcp.c b/src/host/layer23/src/modem/sndcp.c index ee5380f..f8710ec 100644 --- a/src/host/layer23/src/modem/sndcp.c +++ b/src/host/layer23/src/modem/sndcp.c @@ -146,7 +146,7 @@ int modem_sndcp_init(struct osmocom_ms *ms) { int rc; - rc = osmo_gprs_sndcp_init(); + rc = osmo_gprs_sndcp_init(OSMO_GPRS_SNDCP_LOCATION_MS); if (rc != 0) return rc; -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32313 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I4f559e4a882a85742c45609dec596f0485eafed0 Gerrit-Change-Number: 32313 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in libosmo-gprs[master]: sndcp: Test MS vs NET paths separately and implement missing prims fo...
by pespin 14 Apr '23

14 Apr '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/32312 ) Change subject: sndcp: Test MS vs NET paths separately and implement missing prims for MS ...................................................................... sndcp: Test MS vs NET paths separately and implement missing prims for MS Related: OS#5502 Change-Id: Iebce37a50917b13c23de1528469d66c310ced7f2 --- M include/osmocom/gprs/sndcp/sndcp.h M include/osmocom/gprs/sndcp/sndcp_private.h M src/sndcp/sndcp.c M src/sndcp/sndcp_prim.c M tests/sndcp/slhc_test.c M tests/sndcp/sndcp_prim_test.c M tests/sndcp/sndcp_prim_test.err M tests/sndcp/sndcp_prim_test.ok M tests/sndcp/sndcp_xid_test.c 9 files changed, 395 insertions(+), 150 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/12/32312/1 diff --git a/include/osmocom/gprs/sndcp/sndcp.h b/include/osmocom/gprs/sndcp/sndcp.h index d9492a3..8acf93f 100644 --- a/include/osmocom/gprs/sndcp/sndcp.h +++ b/include/osmocom/gprs/sndcp/sndcp.h @@ -5,7 +5,13 @@ #include <stdint.h> #include <stddef.h> -int osmo_gprs_sndcp_init(void); +enum osmo_gprs_sndcp_location { + OSMO_GPRS_SNDCP_LOCATION_UNSET, + OSMO_GPRS_SNDCP_LOCATION_MS, + OSMO_GPRS_SNDCP_LOCATION_NET, +}; + +int osmo_gprs_sndcp_init(enum osmo_gprs_sndcp_location location); enum osmo_gprs_sndcp_log_cat { OSMO_GPRS_SNDCP_LOGC_SNDCP, diff --git a/include/osmocom/gprs/sndcp/sndcp_private.h b/include/osmocom/gprs/sndcp/sndcp_private.h index 6f4da3b..dcbde67 100644 --- a/include/osmocom/gprs/sndcp/sndcp_private.h +++ b/include/osmocom/gprs/sndcp/sndcp_private.h @@ -83,6 +83,7 @@ }; struct gprs_sndcp_ctx { + enum osmo_gprs_sndcp_location location; osmo_gprs_sndcp_prim_up_cb sndcp_up_cb; void *sndcp_up_cb_user_data; @@ -157,6 +158,10 @@ /* The defragmentation queue */ struct gprs_sndcp_defrag_state defrag; + /* Whether we have an XID Request in transit which was originated by upper layers (TS 24.007 C.6): */ + bool xid_req_in_transit_orig_snsm_activate_ind; /* origin = SNSM-ACTIVATE.ind */ + bool xid_req_in_transit_orig_sn_xid_req; /* origin = SN-XID.req */ + /* Copy of the XID fields array we have sent with the last * originated XID-Request. NULL if not existing (and l3xid_req_len = 0) */ uint8_t *l3xid_req; @@ -196,16 +201,22 @@ /* sndcp_prim.c: */ struct osmo_gprs_sndcp_prim *gprs_sndcp_prim_alloc_sn_unitdata_ind(uint32_t tlli, uint8_t sapi, uint8_t nsapi, uint8_t *npdu, size_t npdu_len); struct osmo_gprs_sndcp_prim *gprs_sndcp_prim_alloc_sn_xid_ind(uint32_t tlli, uint8_t sapi, uint8_t nsapi); +struct osmo_gprs_sndcp_prim *gprs_sndcp_prim_alloc_sn_xid_cnf(uint32_t tlli, uint8_t sapi, uint8_t nsapi); struct osmo_gprs_sndcp_prim *gprs_sndcp_prim_alloc_snsm_activate_rsp(uint32_t tlli, uint8_t nsapi); int gprs_sndcp_prim_call_up_cb(struct osmo_gprs_sndcp_prim *sndcp_prim); int gprs_sndcp_prim_call_down_cb(struct osmo_gprs_llc_prim *llc_prim); +int gprs_sndcp_prim_call_snsm_cb(struct osmo_gprs_sndcp_prim *sndcp_prim); /* sndcp.c: */ struct gprs_sndcp_mgmt_entity *gprs_sndcp_snme_alloc(uint32_t tlli); struct gprs_sndcp_mgmt_entity *gprs_sndcp_snme_find_by_tlli(uint32_t tlli); struct gprs_sndcp_entity *gprs_sndcp_sne_alloc(struct gprs_sndcp_mgmt_entity *snme, uint8_t llc_sapi, uint8_t nsapi); void gprs_sndcp_sne_free(struct gprs_sndcp_entity *sne); +struct gprs_sndcp_entity *gprs_sndcp_sne_by_dlci(uint32_t tlli, uint8_t llc_sapi); struct gprs_sndcp_entity *gprs_sndcp_sne_by_dlci_nsapi(uint32_t tlli, uint8_t llc_sapi, uint8_t nsapi); +int gprs_sndcp_sne_submit_llc_ll_establish_req(struct gprs_sndcp_entity *sne); +int gprs_sndcp_sne_submit_llc_ll_xid_req(struct gprs_sndcp_entity *sne); +int gprs_sndcp_sne_submit_snsm_activate_rsp(struct gprs_sndcp_entity *sne); int gprs_sndcp_sne_handle_llc_ll_unitdata_ind(struct gprs_sndcp_entity *sne, struct sndcp_common_hdr *sch, uint16_t len); int gprs_sndcp_snme_handle_llc_ll_xid_ind(struct gprs_sndcp_mgmt_entity *snme, uint32_t sapi, uint8_t *l3params, unsigned int l3params_len); diff --git a/src/sndcp/sndcp.c b/src/sndcp/sndcp.c index 6041ecd..4b54be3 100644 --- a/src/sndcp/sndcp.c +++ b/src/sndcp/sndcp.c @@ -34,12 +34,13 @@ struct gprs_sndcp_ctx *g_sndcp_ctx; -int osmo_gprs_sndcp_init(void) +int osmo_gprs_sndcp_init(enum osmo_gprs_sndcp_location location) { if (g_sndcp_ctx) talloc_free(g_sndcp_ctx); g_sndcp_ctx = talloc_zero(NULL, struct gprs_sndcp_ctx); + g_sndcp_ctx->location = location; INIT_LLIST_HEAD(&g_sndcp_ctx->snme_list); return 0; } @@ -142,6 +143,27 @@ talloc_free(sne); } +struct gprs_sndcp_entity *gprs_sndcp_sne_by_dlci(uint32_t tlli, uint8_t llc_sapi) +{ + struct gprs_sndcp_mgmt_entity *snme = gprs_sndcp_snme_find_by_tlli(tlli); + struct gprs_sndcp_entity *sne; + unsigned int i; + + if (!snme) + return NULL; + + for (i = 0; i < ARRAY_SIZE(snme->sne); i++) { + sne = snme->sne[i]; + if (!sne) + continue; + if (sne->llc_sapi != llc_sapi) + continue; + return sne; + } + + return NULL; +} + struct gprs_sndcp_entity *gprs_sndcp_sne_by_dlci_nsapi(uint32_t tlli, uint8_t llc_sapi, uint8_t nsapi) { struct gprs_sndcp_mgmt_entity *snme = gprs_sndcp_snme_find_by_tlli(tlli); @@ -156,6 +178,52 @@ return sne; } +int gprs_sndcp_sne_submit_llc_ll_establish_req(struct gprs_sndcp_entity *sne) +{ + struct osmo_gprs_llc_prim *llc_prim_tx; + int rc; + + llc_prim_tx = osmo_gprs_llc_prim_alloc_ll_establish_req(sne->snme->tlli, sne->llc_sapi, + sne->l3xid_req, sne->l3xid_req_len); + OSMO_ASSERT(llc_prim_tx); + rc = gprs_sndcp_prim_call_down_cb(llc_prim_tx); + return rc; +} + +int gprs_sndcp_sne_submit_llc_ll_xid_req(struct gprs_sndcp_entity *sne) +{ + struct osmo_gprs_llc_prim *llc_prim_tx; + int rc; + + llc_prim_tx = osmo_gprs_llc_prim_alloc_ll_xid_req(sne->snme->tlli, sne->llc_sapi, + sne->l3xid_req, sne->l3xid_req_len); + OSMO_ASSERT(llc_prim_tx); + rc = gprs_sndcp_prim_call_down_cb(llc_prim_tx); + return rc; +} + +int gprs_sndcp_sne_submit_sn_xid_cnf(struct gprs_sndcp_entity *sne) +{ + struct osmo_gprs_sndcp_prim *sndcp_prim_tx; + int rc; + + sndcp_prim_tx = gprs_sndcp_prim_alloc_sn_xid_cnf(sne->snme->tlli, sne->llc_sapi, sne->nsapi); + OSMO_ASSERT(sndcp_prim_tx); + rc = gprs_sndcp_prim_call_up_cb(sndcp_prim_tx); + return rc; +} + +int gprs_sndcp_sne_submit_snsm_activate_rsp(struct gprs_sndcp_entity *sne) +{ + struct osmo_gprs_sndcp_prim *sndcp_prim_tx; + int rc; + + sndcp_prim_tx = gprs_sndcp_prim_alloc_snsm_activate_rsp(sne->snme->tlli, sne->nsapi); + OSMO_ASSERT(sndcp_prim_tx); + rc = gprs_sndcp_prim_call_snsm_cb(sndcp_prim_tx); + return rc; +} + /* Check if any compression parameters are set in the sgsn configuration */ static inline int any_pcomp_or_dcomp_active(const struct gprs_sndcp_ctx *sgsn) { @@ -695,7 +763,6 @@ { int rc; uint8_t l3params[1024]; - struct osmo_gprs_llc_prim *llc_prim_tx; /* Wipe off all compression entities and their states to * get rid of possible leftovers from a previous session */ @@ -714,12 +781,9 @@ talloc_free(sne->l3xid_req); sne->l3xid_req = NULL; } + sne->xid_req_in_transit_orig_sn_xid_req = true; - llc_prim_tx = osmo_gprs_llc_prim_alloc_ll_xid_req(sne->snme->tlli, sne->llc_sapi, - sne->l3xid_req, sne->l3xid_req_len); - OSMO_ASSERT(llc_prim_tx); - rc = gprs_sndcp_prim_call_down_cb(llc_prim_tx); - + rc = gprs_sndcp_sne_submit_llc_ll_xid_req(sne); return rc; } @@ -1020,8 +1084,6 @@ if (sne_i->llc_sapi != sapi) continue; LOGSNE(sne_i, LOGL_DEBUG, "LL-XID.cnf: Found SNE SAPI=%u\n", sapi); - if (!sne_i->l3xid_req || sne_i->l3xid_req_len == 0) - continue; sne = sne_i; break; } @@ -1030,38 +1092,56 @@ return -EINVAL; } - /* Parse SNDCP-CID XID-Field */ - comp_fields_req = gprs_sndcp_parse_xid(NULL, sne, sne->l3xid_req, sne->l3xid_req_len, NULL); - if (!comp_fields_req) - return -EINVAL; + if (sne->l3xid_req && sne->l3xid_req_len > 0) { + /* Parse SNDCP-CID XID-Field */ + comp_fields_req = gprs_sndcp_parse_xid(NULL, sne, sne->l3xid_req, sne->l3xid_req_len, NULL); + if (!comp_fields_req) + return -EINVAL; - /* Parse SNDCP-CID XID-Field */ - comp_fields_conf = gprs_sndcp_parse_xid(NULL, sne, l3params, l3params_len, comp_fields_req); - if (!comp_fields_conf) { - talloc_free(comp_fields_req); - return -EINVAL; - } - - LOGSNDCP(LOGL_DEBUG, "LL-XID.cnf response comp_fields:\n"); - gprs_sndcp_dump_comp_fields(comp_fields_conf, LOGL_DEBUG); - - /* Handle compression entities */ - llist_for_each_entry(comp_field, comp_fields_conf, list) { - compclass = gprs_sndcp_get_compression_class(comp_field); - if (compclass == SNDCP_XID_PROTOCOL_COMPRESSION) - rc = gprs_sndcp_snme_handle_pcomp_entities(snme, sapi, comp_field); - else if (compclass == SNDCP_XID_DATA_COMPRESSION) - rc = gprs_sndcp_snme_handle_dcomp_entities(snme, sapi, comp_field); - else { - gprs_sndcp_comp_delete(snme->comp.proto, comp_field->entity); - gprs_sndcp_comp_delete(snme->comp.data, comp_field->entity); - rc = 0; + /* Parse SNDCP-CID XID-Field */ + comp_fields_conf = gprs_sndcp_parse_xid(NULL, sne, l3params, l3params_len, comp_fields_req); + if (!comp_fields_conf) { + talloc_free(comp_fields_req); + return -EINVAL; } - if (rc < 0) - break; + + LOGSNDCP(LOGL_DEBUG, "LL-XID.cnf response comp_fields:\n"); + gprs_sndcp_dump_comp_fields(comp_fields_conf, LOGL_DEBUG); + + /* Handle compression entities */ + llist_for_each_entry(comp_field, comp_fields_conf, list) { + compclass = gprs_sndcp_get_compression_class(comp_field); + if (compclass == SNDCP_XID_PROTOCOL_COMPRESSION) + rc = gprs_sndcp_snme_handle_pcomp_entities(snme, sapi, comp_field); + else if (compclass == SNDCP_XID_DATA_COMPRESSION) + rc = gprs_sndcp_snme_handle_dcomp_entities(snme, sapi, comp_field); + else { + gprs_sndcp_comp_delete(snme->comp.proto, comp_field->entity); + gprs_sndcp_comp_delete(snme->comp.data, comp_field->entity); + rc = 0; + } + if (rc < 0) + break; + } + + talloc_free(comp_fields_req); + talloc_free(comp_fields_conf); } - talloc_free(comp_fields_req); - talloc_free(comp_fields_conf); + /* Originated by SNSM-ACTIVATE.ind: */ + if (sne->xid_req_in_transit_orig_snsm_activate_ind) { + sne->xid_req_in_transit_orig_snsm_activate_ind = false; + rc = gprs_sndcp_sne_submit_snsm_activate_rsp(sne); + } + /* Originated by SN-XID.req: */ + if (sne->xid_req_in_transit_orig_sn_xid_req) { + sne->xid_req_in_transit_orig_sn_xid_req = false; + rc = gprs_sndcp_sne_submit_sn_xid_cnf(sne); + } + + /* TODO: + * gprs_sndcp_prim_alloc_sn_xid_cnf() SN-XID-CNF if SN-XID-REQ pending + * gprs_sndcp_prim_alloc_snsm_activate_rsp() SNSM-ACTIVATE-RSP if SNSM-ACTIVATE-IND pending + */ return rc; } diff --git a/src/sndcp/sndcp_prim.c b/src/sndcp/sndcp_prim.c index bc22c9c..b9b5041 100644 --- a/src/sndcp/sndcp_prim.c +++ b/src/sndcp/sndcp_prim.c @@ -206,7 +206,7 @@ return sndcp_prim; } -/* 5.1.1.5 SN-XID.indication */ +/* 5.1.1.6 SN-XID.indication */ struct osmo_gprs_sndcp_prim *gprs_sndcp_prim_alloc_sn_xid_ind(uint32_t tlli, uint8_t sapi, uint8_t nsapi) { struct osmo_gprs_sndcp_prim *sndcp_prim; @@ -228,6 +228,17 @@ return sndcp_prim; } +/* 5.1.1.8 SN-XID.confirmation */ +struct osmo_gprs_sndcp_prim *gprs_sndcp_prim_alloc_sn_xid_cnf(uint32_t tlli, uint8_t sapi, uint8_t nsapi) +{ + struct osmo_gprs_sndcp_prim *sndcp_prim; + sndcp_prim = sndcp_prim_sn_alloc(OSMO_GPRS_SNDCP_SN_XID, PRIM_OP_CONFIRM, 0); + sndcp_prim->sn.tlli = tlli; + sndcp_prim->sn.sapi = sapi; + sndcp_prim->sn.xid_ind.nsapi = nsapi; + return sndcp_prim; +} + /*** SN SM ***/ static inline struct osmo_gprs_sndcp_prim *sndcp_prim_snsm_alloc(enum osmo_gprs_sndcp_snsm_prim_type type, @@ -456,6 +467,23 @@ return rc; } +static int gprs_sndcp_prim_handle_llc_ll_establish_cnf(struct osmo_gprs_llc_prim *llc_prim) +{ + int rc; + struct gprs_sndcp_entity *sne; + + sne = gprs_sndcp_sne_by_dlci(llc_prim->ll.tlli, llc_prim->ll.sapi); + if (!sne) { + LOGSNDCP(LOGL_ERROR, "Message for non-existing SNDCP Entity " + "(TLLI=%08x, SAPI=%u)\n", + llc_prim->ll.tlli, llc_prim->ll.sapi); + return -EIO; + } + + rc = gprs_sndcp_sne_submit_snsm_activate_rsp(sne); + return rc; +} + static int gprs_sndcp_prim_handle_llc_ll_xid_ind(struct osmo_gprs_llc_prim *llc_prim) { int rc; @@ -500,6 +528,9 @@ case OSMO_PRIM(OSMO_GPRS_LLC_LL_UNITDATA, PRIM_OP_INDICATION): rc = gprs_sndcp_prim_handle_llc_ll_unitdata_ind(llc_prim); break; + case OSMO_PRIM(OSMO_GPRS_LLC_LL_ESTABLISH, PRIM_OP_CONFIRM): + rc = gprs_sndcp_prim_handle_llc_ll_establish_cnf(llc_prim); + break; case OSMO_PRIM(OSMO_GPRS_LLC_LL_XID, PRIM_OP_INDICATION): rc = gprs_sndcp_prim_handle_llc_ll_xid_ind(llc_prim); break; @@ -528,6 +559,7 @@ break; default: rc = gprs_sndcp_prim_handle_llc_ll_unsupported(llc_prim); + rc = 1; } /* Special return value '1' means: do not free */ @@ -561,6 +593,7 @@ uint8_t sapi = sndcp_prim->snsm.activate_ind.sapi; uint8_t nsapi = sndcp_prim->snsm.activate_ind.nsapi; struct gprs_sndcp_mgmt_entity *snme; + struct gprs_sndcp_entity *sne; LOGSNDCP(LOGL_INFO, "SNSM-ACTIVATE.ind (TLLI=%08x, SAPI=%u, NSAPI=%u)\n", tlli, sapi, nsapi); @@ -568,23 +601,36 @@ snme = gprs_sndcp_snme_find_by_tlli(tlli); if (!snme) { snme = gprs_sndcp_snme_alloc(tlli); - } else if (gprs_sndcp_snme_get_sne(snme, nsapi)) { - LOGSNDCP(LOGL_ERROR, "Trying to ACTIVATE already-existing entity " - "(TLLI=%08x, SAPI=%u, NSAPI=%u)\n", - tlli, sapi, nsapi); - return -EEXIST; + if (!snme) { + LOGSNDCP(LOGL_ERROR, "Out of memory during ACTIVATE\n"); + return -ENOMEM; + } } - if (!snme) { - LOGSNDCP(LOGL_ERROR, "Out of memory during ACTIVATE\n"); - return -ENOMEM; + if (!(sne = gprs_sndcp_snme_get_sne(snme, nsapi))) { + sne = gprs_sndcp_sne_alloc(snme, sapi, nsapi); + if (!sne) { + LOGSNME(snme, LOGL_ERROR, "Out of memory during ACTIVATE\n"); + return -ENOMEM; + } } - if (!gprs_sndcp_sne_alloc(snme, sapi, nsapi)) { - LOGSNDCP(LOGL_ERROR, "Out of memory during ACTIVATE\n"); - return -ENOMEM; - } + /* Nothing to do below if we are not MS. In NET mode, we wait for + * LL-ESTABLISH-IND or LL-XID-IND. */ + if (g_sndcp_ctx->location != OSMO_GPRS_SNDCP_LOCATION_MS) + return 0; + /* TODO: when supporting and using LLC ABM mode, flow should go through + * LL-ESTABLISH.req, as per TS 24.007 C.6 "No LLC link exists yet, + * establish a link and exchange XID" + * + * rc = gprs_sndcp_sne_submit_llc_ll_establish_req(sne); + * return rc; + */ + + /* TS 24.007 C.6 "LLC link exists already, only XID exchange" */ + sne->xid_req_in_transit_orig_snsm_activate_ind = true; + rc = gprs_sndcp_sne_submit_llc_ll_xid_req(sne); return rc; } diff --git a/tests/sndcp/slhc_test.c b/tests/sndcp/slhc_test.c index fdebb5b..31126ad 100644 --- a/tests/sndcp/slhc_test.c +++ b/tests/sndcp/slhc_test.c @@ -262,7 +262,7 @@ log_ctx = talloc_named_const(ctx, 0, "log"); osmo_init_logging2(log_ctx, &info); - rc = osmo_gprs_sndcp_init(); + rc = osmo_gprs_sndcp_init(OSMO_GPRS_SNDCP_LOCATION_MS); OSMO_ASSERT(rc == 0); osmo_gprs_sndcp_set_log_cat(OSMO_GPRS_SNDCP_LOGC_SNDCP, DSNDCP); osmo_gprs_sndcp_set_log_cat(OSMO_GPRS_SNDCP_LOGC_SLHC, DSLHC); diff --git a/tests/sndcp/sndcp_prim_test.c b/tests/sndcp/sndcp_prim_test.c index b1f29ef..cf29ec0 100644 --- a/tests/sndcp/sndcp_prim_test.c +++ b/tests/sndcp/sndcp_prim_test.c @@ -93,7 +93,15 @@ OSMO_ASSERT(0); } - printf("%s(): Rx %s\n", __func__, npdu_name); + switch (OSMO_PRIM_HDR(&sndcp_prim->oph)) { + case OSMO_PRIM(OSMO_GPRS_SNDCP_SNSM_ACTIVATE, PRIM_OP_RESPONSE): + printf("%s(): Rx %s\n", __func__, npdu_name); + break; + default: + printf("%s(): Unexpected Rx %s\n", __func__, npdu_name); + OSMO_ASSERT(0); + } + return 0; } @@ -113,7 +121,7 @@ 0x01, 0x05, 0x00, 0x06, 0x00, 0x07, 0x01, 0x07, 0x00, 0x08, 0x01, 0x08, 0x80, 0x00, 0x04, 0x12, 0x00, 0x40, 0x07 }; -static void test_sndcp_prim(void) +static void test_sndcp_prim_net(void) { struct osmo_gprs_sndcp_prim *sndcp_prim; struct osmo_gprs_llc_prim *llc_prim; @@ -124,32 +132,21 @@ int rc; printf("==== %s() [start] ====\n", __func__); - rc = osmo_gprs_sndcp_init(); + rc = osmo_gprs_sndcp_init(OSMO_GPRS_SNDCP_LOCATION_NET); OSMO_ASSERT(rc == 0); osmo_gprs_sndcp_prim_set_up_cb(test_sndcp_prim_up_cb, NULL); osmo_gprs_sndcp_prim_set_down_cb(test_sndcp_prim_down_cb, NULL); osmo_gprs_sndcp_prim_set_snsm_cb(test_sndcp_prim_snsm_cb, NULL); - /* SNSM-ACTIVATE.Ind: */ + /* SNSM-ACTIVATE.Ind, internally submits LL-XID.Req (it would submit + * LL-ESTABLISH.Req in ABM mode if we supported it): */ sndcp_prim = osmo_gprs_sndcp_prim_alloc_snsm_activate_ind(tlli, nsapi, ll_sapi); OSMO_ASSERT(sndcp_prim); rc = osmo_gprs_sndcp_prim_dispatch_snsm(sndcp_prim); OSMO_ASSERT(rc == 0); - /* Submit SN-XID.Req, triggers rx of LL-XID.Req: */ - sndcp_prim = osmo_gprs_sndcp_prim_alloc_sn_xid_req(tlli, ll_sapi, nsapi); - OSMO_ASSERT(sndcp_prim); - sndcp_prim->sn.xid_req.pcomp_rfc1144.active = true; - sndcp_prim->sn.xid_req.pcomp_rfc1144.s01 = 7; - rc = osmo_gprs_sndcp_prim_upper_down(sndcp_prim); - OSMO_ASSERT(rc == 0); - - /* Submit LL-XID.Cnf, triggers rx of LL-XID.cnf */ - llc_prim = gprs_llc_prim_alloc_ll_xid_cnf(tlli, ll_sapi, (uint8_t *)sndcp_xid, sizeof(sndcp_xid)); - OSMO_ASSERT(llc_prim); - rc = osmo_gprs_sndcp_prim_lower_up(llc_prim); - OSMO_ASSERT(rc == 0); + /* Id we supported and use ABM: Submit LL-ESTABLISH.Ind, triggers rx of LL-ESTABLISH.Rsp */ /* Submit LL-XID.Ind, triggers rx of SN-XID.Ind: */ llc_prim = gprs_llc_prim_alloc_ll_xid_ind(tlli, ll_sapi, (uint8_t *)sndcp_xid, sizeof(sndcp_xid)); @@ -177,7 +174,84 @@ /* TODO: SN-XID REQ / IND / RESP / CONF - * TODO: Other primitivbes coming from LLC layer + * TODO: Other primitives coming from LLC layer + */ + + /* SNSM-DEACTIVATE.Ind: */ + sndcp_prim = osmo_gprs_sndcp_prim_alloc_snsm_deactivate_ind(tlli, nsapi); + OSMO_ASSERT(sndcp_prim); + rc = osmo_gprs_sndcp_prim_dispatch_snsm(sndcp_prim); + OSMO_ASSERT(rc == 0); + + printf("==== %s() [end] ====\n", __func__); +} + +static void test_sndcp_prim_ms(void) +{ + struct osmo_gprs_sndcp_prim *sndcp_prim; + struct osmo_gprs_llc_prim *llc_prim; + const uint32_t tlli = 0xe1c5d364; + const enum osmo_gprs_llc_sapi ll_sapi = OSMO_GPRS_LLC_SAPI_SNDCP3; + const uint8_t nsapi = 0x05; + uint8_t sndcp_data[1024]; + int rc; + printf("==== %s() [start] ====\n", __func__); + + rc = osmo_gprs_sndcp_init(OSMO_GPRS_SNDCP_LOCATION_MS); + OSMO_ASSERT(rc == 0); + + osmo_gprs_sndcp_prim_set_up_cb(test_sndcp_prim_up_cb, NULL); + osmo_gprs_sndcp_prim_set_down_cb(test_sndcp_prim_down_cb, NULL); + osmo_gprs_sndcp_prim_set_snsm_cb(test_sndcp_prim_snsm_cb, NULL); + + /* SNSM-ACTIVATE.Ind, internally submits LL-XID.Req (it would submit + * LL-ESTABLISH.Req in ABM mode if we supported it): */ + sndcp_prim = osmo_gprs_sndcp_prim_alloc_snsm_activate_ind(tlli, nsapi, ll_sapi); + OSMO_ASSERT(sndcp_prim); + rc = osmo_gprs_sndcp_prim_dispatch_snsm(sndcp_prim); + OSMO_ASSERT(rc == 0); + + /* Id we supported and use ABM: Submit LL-ESTABLISH.Cnf, triggers rx of SNSM-ACTIVATE.Rsp */ + //llc_prim = gprs_llc_prim_alloc_ll_establish_cnf(tlli, ll_sapi, (uint8_t *)sndcp_xid, sizeof(sndcp_xid)); + //OSMO_ASSERT(llc_prim); + //rc = osmo_gprs_sndcp_prim_lower_up(llc_prim); + //OSMO_ASSERT(rc == 0); + + /* Network answers XID req, Submit LL-XID.Cnf, triggers rx of SNSM-ACTIVATE-RSP */ + llc_prim = gprs_llc_prim_alloc_ll_xid_cnf(tlli, ll_sapi, (uint8_t *)sndcp_xid, sizeof(sndcp_xid)); + OSMO_ASSERT(llc_prim); + rc = osmo_gprs_sndcp_prim_lower_up(llc_prim); + OSMO_ASSERT(rc == 0); + + /* Submit SN-XID.Req from upper layers, triggers rx of LL-XID.Req: */ + sndcp_prim = osmo_gprs_sndcp_prim_alloc_sn_xid_req(tlli, ll_sapi, nsapi); + OSMO_ASSERT(sndcp_prim); + sndcp_prim->sn.xid_req.pcomp_rfc1144.active = true; + sndcp_prim->sn.xid_req.pcomp_rfc1144.s01 = 7; + rc = osmo_gprs_sndcp_prim_upper_down(sndcp_prim); + OSMO_ASSERT(rc == 0); + + /* Submit LL-XID.Cnf, triggers rx of SN-XID.cnf */ + llc_prim = gprs_llc_prim_alloc_ll_xid_cnf(tlli, ll_sapi, (uint8_t *)sndcp_xid, sizeof(sndcp_xid)); + OSMO_ASSERT(llc_prim); + rc = osmo_gprs_sndcp_prim_lower_up(llc_prim); + OSMO_ASSERT(rc == 0); + + OSMO_ASSERT(osmo_hexparse(sndcp_data_hex, sndcp_data, sizeof(sndcp_data)) > 0); + llc_prim = gprs_llc_prim_alloc_ll_unitdata_ind(tlli, ll_sapi, (uint8_t *)sndcp_data, sizeof(sndcp_data)); + OSMO_ASSERT(llc_prim); + rc = osmo_gprs_sndcp_prim_lower_up(llc_prim); + OSMO_ASSERT(rc == 0); + + char ndpu_data[] = "some-npdu-data-like-an-ip-pkt"; + sndcp_prim = osmo_gprs_sndcp_prim_alloc_sn_unitdata_req(tlli, ll_sapi, nsapi, (uint8_t *)ndpu_data, sizeof(ndpu_data)); + OSMO_ASSERT(sndcp_prim); + rc = osmo_gprs_sndcp_prim_upper_down(sndcp_prim); + OSMO_ASSERT(rc == 0); + + + /* TODO: SN-XID REQ / IND / RESP / CONF + * TODO: Other primitives coming from LLC layer */ /* SNSM-DEACTIVATE.Ind: */ @@ -208,7 +282,8 @@ log_set_print_level(osmo_stderr_target, 1); log_set_use_color(osmo_stderr_target, 0); - test_sndcp_prim(); + test_sndcp_prim_net(); + test_sndcp_prim_ms(); talloc_free(tall_ctx); } diff --git a/tests/sndcp/sndcp_prim_test.err b/tests/sndcp/sndcp_prim_test.err index f27486d..d61a18a 100644 --- a/tests/sndcp/sndcp_prim_test.err +++ b/tests/sndcp/sndcp_prim_test.err @@ -1,79 +1,5 @@ DLGLOBAL INFO Rx from SNDCP SM sublayer: SNSM-ACTIVATE.indication DLGLOBAL INFO SNSM-ACTIVATE.ind (TLLI=e1c5d364, SAPI=3, NSAPI=5) -DLGLOBAL INFO Rx from upper layers: SN-XID.request -DLGLOBAL DEBUG SNE(e1c5d364,SNDCP3,5) SN-XID.req comp_fields: -DLGLOBAL DEBUG SNDCP-XID: -DLGLOBAL DEBUG struct gprs_sndcp_comp_field { -DLGLOBAL DEBUG entity=0; -DLGLOBAL DEBUG algo=0; -DLGLOBAL DEBUG comp_len=2; -DLGLOBAL DEBUG comp[0]=1; -DLGLOBAL DEBUG comp[1]=2; -DLGLOBAL DEBUG gprs_sndcp_pcomp_rfc1144_params { -DLGLOBAL DEBUG nsapi_len=1; -DLGLOBAL DEBUG nsapi[0]=5; -DLGLOBAL DEBUG s01=7; -DLGLOBAL DEBUG } -DLGLOBAL DEBUG } -DLGLOBAL INFO Rx from lower layers: LL-XID.confirm -DLGLOBAL DEBUG SNE(e1c5d364,SNDCP3,5) LL-XID.cnf: Found SNE SAPI=3 -DLGLOBAL DEBUG LL-XID.cnf response comp_fields: -DLGLOBAL DEBUG SNDCP-XID: -DLGLOBAL DEBUG struct gprs_sndcp_comp_field { -DLGLOBAL DEBUG entity=0; -DLGLOBAL DEBUG algo=0; -DLGLOBAL DEBUG comp_len=2; -DLGLOBAL DEBUG comp[0]=1; -DLGLOBAL DEBUG comp[1]=2; -DLGLOBAL DEBUG gprs_sndcp_pcomp_rfc1144_params { -DLGLOBAL DEBUG nsapi_len=1; -DLGLOBAL DEBUG nsapi[0]=6; -DLGLOBAL DEBUG s01=7; -DLGLOBAL DEBUG } -DLGLOBAL DEBUG } -DLGLOBAL DEBUG SNDCP-XID: -DLGLOBAL DEBUG struct gprs_sndcp_comp_field { -DLGLOBAL DEBUG entity=2; -DLGLOBAL DEBUG algo=2; -DLGLOBAL DEBUG comp_len=2; -DLGLOBAL DEBUG comp[0]=8; -DLGLOBAL DEBUG comp[1]=9; -DLGLOBAL DEBUG gprs_sndcp_pcomp_rohc_params { -DLGLOBAL DEBUG nsapi_len=11; -DLGLOBAL DEBUG nsapi[0]=5; -DLGLOBAL DEBUG nsapi[1]=6; -DLGLOBAL DEBUG nsapi[2]=7; -DLGLOBAL DEBUG nsapi[3]=8; -DLGLOBAL DEBUG nsapi[4]=9; -DLGLOBAL DEBUG nsapi[5]=10; -DLGLOBAL DEBUG nsapi[6]=11; -DLGLOBAL DEBUG nsapi[7]=12; -DLGLOBAL DEBUG nsapi[8]=13; -DLGLOBAL DEBUG nsapi[9]=14; -DLGLOBAL DEBUG nsapi[10]=15; -DLGLOBAL DEBUG max_cid=15; -DLGLOBAL DEBUG max_header=168; -DLGLOBAL DEBUG profile_len=16; -DLGLOBAL DEBUG profile[0]=0000; -DLGLOBAL DEBUG profile[1]=0001; -DLGLOBAL DEBUG profile[2]=0101; -DLGLOBAL DEBUG profile[3]=0002; -DLGLOBAL DEBUG profile[4]=0102; -DLGLOBAL DEBUG profile[5]=0003; -DLGLOBAL DEBUG profile[6]=0103; -DLGLOBAL DEBUG profile[7]=0004; -DLGLOBAL DEBUG profile[8]=0104; -DLGLOBAL DEBUG profile[9]=0005; -DLGLOBAL DEBUG profile[10]=0105; -DLGLOBAL DEBUG profile[11]=0006; -DLGLOBAL DEBUG profile[12]=0007; -DLGLOBAL DEBUG profile[13]=0107; -DLGLOBAL DEBUG profile[14]=0008; -DLGLOBAL DEBUG profile[15]=0108; -DLGLOBAL DEBUG } -DLGLOBAL DEBUG } -DLGLOBAL DEBUG SNME(e1c5d364) Rejecting RFC1144 header compression... -DLGLOBAL DEBUG SNME(e1c5d364) Rejecting ROHC header compression... DLGLOBAL INFO Rx from lower layers: LL-XID.indication DLGLOBAL DEBUG SNE(e1c5d364,SNDCP3,5) LL-XID.ind: Found SNE SAPI=3 DLGLOBAL DEBUG SNME(e1c5d364) LL-XID.cnf requested comp_fields: @@ -185,3 +111,87 @@ DLGLOBAL DEBUG SNE(e1c5d364,SNDCP3,5) free() DLGLOBAL DEBUG SNME(e1c5d364) No SNDCP Entities left activate, freeing SNME DLGLOBAL DEBUG SNME(e1c5d364) free() +DLGLOBAL INFO Rx from SNDCP SM sublayer: SNSM-ACTIVATE.indication +DLGLOBAL INFO SNSM-ACTIVATE.ind (TLLI=e1c5d364, SAPI=3, NSAPI=5) +DLGLOBAL INFO Rx from lower layers: LL-XID.confirm +DLGLOBAL DEBUG SNE(e1c5d364,SNDCP3,5) LL-XID.cnf: Found SNE SAPI=3 +DLGLOBAL INFO Rx from upper layers: SN-XID.request +DLGLOBAL DEBUG SNE(e1c5d364,SNDCP3,5) SN-XID.req comp_fields: +DLGLOBAL DEBUG SNDCP-XID: +DLGLOBAL DEBUG struct gprs_sndcp_comp_field { +DLGLOBAL DEBUG entity=0; +DLGLOBAL DEBUG algo=0; +DLGLOBAL DEBUG comp_len=2; +DLGLOBAL DEBUG comp[0]=1; +DLGLOBAL DEBUG comp[1]=2; +DLGLOBAL DEBUG gprs_sndcp_pcomp_rfc1144_params { +DLGLOBAL DEBUG nsapi_len=1; +DLGLOBAL DEBUG nsapi[0]=5; +DLGLOBAL DEBUG s01=7; +DLGLOBAL DEBUG } +DLGLOBAL DEBUG } +DLGLOBAL INFO Rx from lower layers: LL-XID.confirm +DLGLOBAL DEBUG SNE(e1c5d364,SNDCP3,5) LL-XID.cnf: Found SNE SAPI=3 +DLGLOBAL DEBUG LL-XID.cnf response comp_fields: +DLGLOBAL DEBUG SNDCP-XID: +DLGLOBAL DEBUG struct gprs_sndcp_comp_field { +DLGLOBAL DEBUG entity=0; +DLGLOBAL DEBUG algo=0; +DLGLOBAL DEBUG comp_len=2; +DLGLOBAL DEBUG comp[0]=1; +DLGLOBAL DEBUG comp[1]=2; +DLGLOBAL DEBUG gprs_sndcp_pcomp_rfc1144_params { +DLGLOBAL DEBUG nsapi_len=1; +DLGLOBAL DEBUG nsapi[0]=6; +DLGLOBAL DEBUG s01=7; +DLGLOBAL DEBUG } +DLGLOBAL DEBUG } +DLGLOBAL DEBUG SNDCP-XID: +DLGLOBAL DEBUG struct gprs_sndcp_comp_field { +DLGLOBAL DEBUG entity=2; +DLGLOBAL DEBUG algo=2; +DLGLOBAL DEBUG comp_len=2; +DLGLOBAL DEBUG comp[0]=8; +DLGLOBAL DEBUG comp[1]=9; +DLGLOBAL DEBUG gprs_sndcp_pcomp_rohc_params { +DLGLOBAL DEBUG nsapi_len=11; +DLGLOBAL DEBUG nsapi[0]=5; +DLGLOBAL DEBUG nsapi[1]=6; +DLGLOBAL DEBUG nsapi[2]=7; +DLGLOBAL DEBUG nsapi[3]=8; +DLGLOBAL DEBUG nsapi[4]=9; +DLGLOBAL DEBUG nsapi[5]=10; +DLGLOBAL DEBUG nsapi[6]=11; +DLGLOBAL DEBUG nsapi[7]=12; +DLGLOBAL DEBUG nsapi[8]=13; +DLGLOBAL DEBUG nsapi[9]=14; +DLGLOBAL DEBUG nsapi[10]=15; +DLGLOBAL DEBUG max_cid=15; +DLGLOBAL DEBUG max_header=168; +DLGLOBAL DEBUG profile_len=16; +DLGLOBAL DEBUG profile[0]=0000; +DLGLOBAL DEBUG profile[1]=0001; +DLGLOBAL DEBUG profile[2]=0101; +DLGLOBAL DEBUG profile[3]=0002; +DLGLOBAL DEBUG profile[4]=0102; +DLGLOBAL DEBUG profile[5]=0003; +DLGLOBAL DEBUG profile[6]=0103; +DLGLOBAL DEBUG profile[7]=0004; +DLGLOBAL DEBUG profile[8]=0104; +DLGLOBAL DEBUG profile[9]=0005; +DLGLOBAL DEBUG profile[10]=0105; +DLGLOBAL DEBUG profile[11]=0006; +DLGLOBAL DEBUG profile[12]=0007; +DLGLOBAL DEBUG profile[13]=0107; +DLGLOBAL DEBUG profile[14]=0008; +DLGLOBAL DEBUG profile[15]=0108; +DLGLOBAL DEBUG } +DLGLOBAL DEBUG } +DLGLOBAL DEBUG SNME(e1c5d364) Rejecting RFC1144 header compression... +DLGLOBAL DEBUG SNME(e1c5d364) Rejecting ROHC header compression... +DLGLOBAL INFO Rx from lower layers: LL-UNITDATA.indication +DLGLOBAL INFO Rx from upper layers: SN-UNITDATA.request +DLGLOBAL INFO Rx from SNDCP SM sublayer: SNSM-DEACTIVATE.indication +DLGLOBAL DEBUG SNE(e1c5d364,SNDCP3,5) free() +DLGLOBAL DEBUG SNME(e1c5d364) No SNDCP Entities left activate, freeing SNME +DLGLOBAL DEBUG SNME(e1c5d364) free() diff --git a/tests/sndcp/sndcp_prim_test.ok b/tests/sndcp/sndcp_prim_test.ok index 4a635fc..621aea7 100644 --- a/tests/sndcp/sndcp_prim_test.ok +++ b/tests/sndcp/sndcp_prim_test.ok @@ -1,7 +1,14 @@ -==== test_sndcp_prim() [start] ==== -test_sndcp_prim_down_cb(): Rx LL-XID.request +==== test_sndcp_prim_net() [start] ==== test_sndcp_prim_up_cb(): Rx SN-XID.indication test_sndcp_prim_down_cb(): Rx LL-XID.response test_sndcp_prim_up_cb(): Rx SN-UNITDATA.indication TLLI=0xe1c5d364 SAPI=SNDCP3 NSAPI=5 NPDU=[75 22 fa 7c ff d9 56 ba 86 c7 2a f3 d2 1d ce bc 88 3a 8e b6 24 7d de 26 6a 58 de 29 be 96 d2 40 94 7f 9f 4d f5 9c 61 d4 19 e9 9a 58 75 21 21 a9 fd 1f d7 96 90 a7 3f fe 5b 59 f0 e7 c1 52 2c aa a1 39 b6 c5 fd 68 2e fc f4 c0 10 9b 7a 64 9d ae 3a ff a3 0f b0 56 7d 4b 52 33 74 13 67 44 6a ce 62 45 ea cb 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ] test_sndcp_prim_down_cb(): Rx LL-UNITDATA.request TLLI=0xe1c5d364 SAPI=SNDCP3 L3=[65 00 00 00 73 6f 6d 65 2d 6e 70 64 75 2d 64 61 74 61 2d 6c 69 6b 65 2d 61 6e 2d 69 70 2d 70 6b 74 00 ] -==== test_sndcp_prim() [end] ==== +==== test_sndcp_prim_net() [end] ==== +==== test_sndcp_prim_ms() [start] ==== +test_sndcp_prim_down_cb(): Rx LL-XID.request +test_sndcp_prim_snsm_cb(): Rx SNSM-ACTIVATE.response +test_sndcp_prim_down_cb(): Rx LL-XID.request +test_sndcp_prim_up_cb(): Rx SN-XID.confirm +test_sndcp_prim_up_cb(): Rx SN-UNITDATA.indication TLLI=0xe1c5d364 SAPI=SNDCP3 NSAPI=5 NPDU=[75 22 fa 7c ff d9 56 ba 86 c7 2a f3 d2 1d ce bc 88 3a 8e b6 24 7d de 26 6a 58 de 29 be 96 d2 40 94 7f 9f 4d f5 9c 61 d4 19 e9 9a 58 75 21 21 a9 fd 1f d7 96 90 a7 3f fe 5b 59 f0 e7 c1 52 2c aa a1 39 b6 c5 fd 68 2e fc f4 c0 10 9b 7a 64 9d ae 3a ff a3 0f b0 56 7d 4b 52 33 74 13 67 44 6a ce 62 45 ea cb 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ] +test_sndcp_prim_down_cb(): Rx LL-UNITDATA.request TLLI=0xe1c5d364 SAPI=SNDCP3 L3=[65 00 00 00 73 6f 6d 65 2d 6e 70 64 75 2d 64 61 74 61 2d 6c 69 6b 65 2d 61 6e 2d 69 70 2d 70 6b 74 00 ] +==== test_sndcp_prim_ms() [end] ==== diff --git a/tests/sndcp/sndcp_xid_test.c b/tests/sndcp/sndcp_xid_test.c index 8016dd0..63a479a 100644 --- a/tests/sndcp/sndcp_xid_test.c +++ b/tests/sndcp/sndcp_xid_test.c @@ -270,7 +270,7 @@ log_ctx = talloc_named_const(xid_ctx, 0, "log"); osmo_init_logging2(log_ctx, &info); - rc = osmo_gprs_sndcp_init(); + rc = osmo_gprs_sndcp_init(OSMO_GPRS_SNDCP_LOCATION_MS); OSMO_ASSERT(rc == 0); osmo_gprs_sndcp_set_log_cat(OSMO_GPRS_SNDCP_LOGC_SNDCP, DSNDCP); -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/32312 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Iebce37a50917b13c23de1528469d66c310ced7f2 Gerrit-Change-Number: 32312 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmo-gprs[master]: tests/sndcp: Fix incorrect check comparing against wrong SAPI
by pespin 14 Apr '23

14 Apr '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/32309 ) Change subject: tests/sndcp: Fix incorrect check comparing against wrong SAPI ...................................................................... tests/sndcp: Fix incorrect check comparing against wrong SAPI Change-Id: I03e75d290efdd682e6d2705921c76708a3bffef5 --- M tests/sndcp/sndcp_prim_test.c 1 file changed, 10 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/09/32309/1 diff --git a/tests/sndcp/sndcp_prim_test.c b/tests/sndcp/sndcp_prim_test.c index e8c4a7e..b1f29ef 100644 --- a/tests/sndcp/sndcp_prim_test.c +++ b/tests/sndcp/sndcp_prim_test.c @@ -88,7 +88,7 @@ { const char *npdu_name = osmo_gprs_sndcp_prim_name(sndcp_prim); - if (sndcp_prim->oph.sap != OSMO_GPRS_SNDCP_SAP_SN) { + if (sndcp_prim->oph.sap != OSMO_GPRS_SNDCP_SAP_SNSM) { printf("%s(): Unexpected Rx %s\n", __func__, npdu_name); OSMO_ASSERT(0); } -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/32309 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I03e75d290efdd682e6d2705921c76708a3bffef5 Gerrit-Change-Number: 32309 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmo-gprs[master]: sndcp: Allocate snme->comp.{data,proto} during snme alloc
by pespin 14 Apr '23

14 Apr '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/32310 ) Change subject: sndcp: Allocate snme->comp.{data,proto} during snme alloc ...................................................................... sndcp: Allocate snme->comp.{data,proto} during snme alloc This way we guarantee the llist object is always available even before an XID.req is received (which may not be the case in NET mode). Change-Id: Ib9540cc62a61ad7cb26ae90ec1500f1a022bada5 --- M src/sndcp/sndcp.c 1 file changed, 17 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/10/32310/1 diff --git a/src/sndcp/sndcp.c b/src/sndcp/sndcp.c index ff38b1c..6041ecd 100644 --- a/src/sndcp/sndcp.c +++ b/src/sndcp/sndcp.c @@ -53,6 +53,9 @@ return NULL; snme->tlli = tlli; + snme->comp.proto = gprs_sndcp_comp_alloc(snme); + snme->comp.data = gprs_sndcp_comp_alloc(snme); + llist_add(&snme->list, &g_sndcp_ctx->snme_list); return snme; @@ -698,8 +701,8 @@ * get rid of possible leftovers from a previous session */ gprs_sndcp_comp_free(sne->snme->comp.proto); gprs_sndcp_comp_free(sne->snme->comp.data); - sne->snme->comp.proto = gprs_sndcp_comp_alloc(sne); - sne->snme->comp.data = gprs_sndcp_comp_alloc(sne); + sne->snme->comp.proto = gprs_sndcp_comp_alloc(sne->snme); + sne->snme->comp.data = gprs_sndcp_comp_alloc(sne->snme); /* Generate compression parameter bytestream */ sne->l3xid_req_len = gprs_sndcp_sne_gen_sndcp_xid(sne, l3params, sizeof(l3params), sndcp_prim); -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/32310 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Ib9540cc62a61ad7cb26ae90ec1500f1a022bada5 Gerrit-Change-Number: 32310 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in libosmo-gprs[master]: sndcp: Fix potential null ptr access if SNE not found
by pespin 14 Apr '23

14 Apr '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/32308 ) Change subject: sndcp: Fix potential null ptr access if SNE not found ...................................................................... sndcp: Fix potential null ptr access if SNE not found Change-Id: Ie04ec971680ea2aaa905539fafc936af8f14e9f5 --- M src/sndcp/sndcp.c 1 file changed, 10 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/08/32308/1 diff --git a/src/sndcp/sndcp.c b/src/sndcp/sndcp.c index 1ff5893..ff38b1c 100644 --- a/src/sndcp/sndcp.c +++ b/src/sndcp/sndcp.c @@ -148,7 +148,7 @@ return NULL; sne = gprs_sndcp_snme_get_sne(snme, nsapi); - if (sne->llc_sapi != llc_sapi) + if (!sne || sne->llc_sapi != llc_sapi) return NULL; return sne; } -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/32308 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: Ie04ec971680ea2aaa905539fafc936af8f14e9f5 Gerrit-Change-Number: 32308 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in libosmo-gprs[master]: llc: Implement some parts of LL-ESTABLISH.req/cnf
by pespin 14 Apr '23

14 Apr '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/32311 ) Change subject: llc: Implement some parts of LL-ESTABLISH.req/cnf ...................................................................... llc: Implement some parts of LL-ESTABLISH.req/cnf As seen in TS 23.007 C.6. We still don't need/want to implement ABM (acknowledged mode), hence only the interface related parts are implemented, and transmit of SABM message is left for the future. Change-Id: I27aff368f4a70d30c23523946d72a751e100f298 --- M include/osmocom/gprs/llc/llc_prim.h M include/osmocom/gprs/llc/llc_private.h M src/llc/llc.c M src/llc/llc_ll.c M tests/llc/llc_prim_test.c M tests/llc/llc_prim_test.err 6 files changed, 84 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/11/32311/1 diff --git a/include/osmocom/gprs/llc/llc_prim.h b/include/osmocom/gprs/llc/llc_prim.h index 66b8a2a..a2b53cb 100644 --- a/include/osmocom/gprs/llc/llc_prim.h +++ b/include/osmocom/gprs/llc/llc_prim.h @@ -284,6 +284,8 @@ struct osmo_gprs_llc_prim *osmo_gprs_llc_prim_alloc_llgm_reset_req(uint32_t tlli); /* Alloc primitive for LL SAP: */ +struct osmo_gprs_llc_prim *osmo_gprs_llc_prim_alloc_ll_establish_req(uint32_t tlli, enum osmo_gprs_llc_sapi ll_sapi, + uint8_t *l3_par, unsigned int l3_par_len); struct osmo_gprs_llc_prim *osmo_gprs_llc_prim_alloc_ll_xid_req(uint32_t tlli, enum osmo_gprs_llc_sapi ll_sapi, uint8_t *l3_par, unsigned int l3_par_len); struct osmo_gprs_llc_prim *osmo_gprs_llc_prim_alloc_ll_xid_resp(uint32_t tlli, enum osmo_gprs_llc_sapi ll_sapi, diff --git a/include/osmocom/gprs/llc/llc_private.h b/include/osmocom/gprs/llc/llc_private.h index 3f7ee15..994acd8 100644 --- a/include/osmocom/gprs/llc/llc_private.h +++ b/include/osmocom/gprs/llc/llc_private.h @@ -287,6 +287,8 @@ /* llc_ll.c */ int gprs_llc_prim_ll_upper_down(struct osmo_gprs_llc_prim *llc_prim); +struct osmo_gprs_llc_prim *gprs_llc_prim_alloc_ll_establish_cnf(uint32_t tlli, enum osmo_gprs_llc_sapi ll_sapi, + uint8_t *l3_par, unsigned int l3_par_len); struct osmo_gprs_llc_prim *gprs_llc_prim_alloc_ll_xid_ind(uint32_t tlli, enum osmo_gprs_llc_sapi ll_sapi, uint8_t *l3_par, unsigned int l3_par_len); struct osmo_gprs_llc_prim *gprs_llc_prim_alloc_ll_xid_cnf(uint32_t tlli, enum osmo_gprs_llc_sapi ll_sapi, @@ -312,6 +314,7 @@ int gprs_llc_lle_rx_unitdata_ind(struct gprs_llc_lle *lle, uint8_t *ll_pdu, size_t ll_pdu_len, struct gprs_llc_pdu_decoded *pdu_dec); void gprs_llc_llme_free(struct gprs_llc_llme *llme); +int gprs_llc_lle_tx_sabm(struct gprs_llc_lle *lle, uint8_t *l3par, unsigned int l3par_len); int gprs_llc_lle_tx_xid(const struct gprs_llc_lle *lle, uint8_t *xid_payload, unsigned int xid_payload_len, bool is_cmd); int gprs_llc_lle_tx_xid_req(struct gprs_llc_lle *lle, uint8_t *l3par, unsigned int l3par_len); int gprs_llc_lle_tx_xid_resp(struct gprs_llc_lle *lle, uint8_t *l3par, unsigned int l3par_len); diff --git a/src/llc/llc.c b/src/llc/llc.c index e9e8e3b..3831f8a 100644 --- a/src/llc/llc.c +++ b/src/llc/llc.c @@ -432,6 +432,13 @@ return rc; } +/* LL-ESTABLISH negotiation (See also: TS 101 351, Section 7.2.2.2) */ +int gprs_llc_lle_tx_sabm(struct gprs_llc_lle *lle, uint8_t *l3par, unsigned int l3par_len) +{ + LOGLLE(lle, LOGL_ERROR, "Tx SABM: ABM mode not supported yet!\n"); + return -ENOTSUP; +} + /* Set of LL-XID negotiation (See also: TS 101 351, Section 7.2.2.4) */ int gprs_llc_lle_tx_xid_req(struct gprs_llc_lle *lle, uint8_t *l3par, unsigned int l3par_len) { diff --git a/src/llc/llc_ll.c b/src/llc/llc_ll.c index 72ef889..43a0951 100644 --- a/src/llc/llc_ll.c +++ b/src/llc/llc_ll.c @@ -54,6 +54,30 @@ return gprs_llc_prim_alloc(OSMO_GPRS_LLC_SAP_LL, type, operation, l3_len); } +/* 7.2.2.2 LL-ESTABLISH.req (MS/SGSN) */ +struct osmo_gprs_llc_prim *osmo_gprs_llc_prim_alloc_ll_establish_req(uint32_t tlli, enum osmo_gprs_llc_sapi ll_sapi, uint8_t *l3_par, unsigned int l3_par_len) +{ + struct osmo_gprs_llc_prim *llc_prim; + llc_prim = llc_prim_ll_alloc(OSMO_GPRS_LLC_LL_ESTABLISH, PRIM_OP_REQUEST, l3_par_len); + llc_prim->ll.tlli = tlli; + llc_prim->ll.sapi = ll_sapi; + llc_prim->ll.l3_pdu = l3_par; + llc_prim->ll.l3_pdu_len = l3_par_len; + return llc_prim; +} + +/* 7.2.2.2 LL-ESTABLISH.cnf (MS/SGSN) */ +struct osmo_gprs_llc_prim *gprs_llc_prim_alloc_ll_establish_cnf(uint32_t tlli, enum osmo_gprs_llc_sapi ll_sapi, uint8_t *l3_par, unsigned int l3_par_len) +{ + struct osmo_gprs_llc_prim *llc_prim; + llc_prim = llc_prim_ll_alloc(OSMO_GPRS_LLC_LL_ESTABLISH, PRIM_OP_CONFIRM, l3_par_len); + llc_prim->ll.tlli = tlli; + llc_prim->ll.sapi = ll_sapi; + llc_prim->ll.l3_pdu = l3_par; + llc_prim->ll.l3_pdu_len = l3_par_len; + return llc_prim; +} + /* 7.2.2.4 LL-XID.req (MS/SGSN) */ struct osmo_gprs_llc_prim *osmo_gprs_llc_prim_alloc_ll_xid_req(uint32_t tlli, enum osmo_gprs_llc_sapi ll_sapi, uint8_t *l3_par, unsigned int l3_par_len) { @@ -172,6 +196,28 @@ * Handling from upper layers: ********************************/ +/* 7.2.2.2 LL-ESTABLISH.req (MS/SGSN):*/ +static int llc_prim_handle_ll_establish_req(struct osmo_gprs_llc_prim *llc_prim) +{ + int rc = 0; + struct gprs_llc_lle *lle; + + lle = gprs_llc_find_lle_by_tlli_sapi(llc_prim->ll.tlli, llc_prim->ll.sapi); + if (!lle) { + LOGLLC(LOGL_NOTICE, "Rx %s: Unknown TLLI 0x%08x SAPI 0x%02x\n", + osmo_gprs_llc_prim_name(llc_prim), llc_prim->ll.tlli, + llc_prim->ll.sapi); + rc = -ENOKEY; + goto ret_free; + } + + rc = gprs_llc_lle_tx_sabm(lle, llc_prim->ll.l3_pdu, llc_prim->ll.l3_pdu_len); + +ret_free: + msgb_free(llc_prim->oph.msg); + return rc; +} + /* 7.2.2.4 LL-XID.req (MS/SGSN):*/ static int llc_prim_handle_ll_xid_req(struct osmo_gprs_llc_prim *llc_prim) { @@ -243,6 +289,11 @@ { int rc; switch (OSMO_PRIM_HDR(&llc_prim->oph)) { + case OSMO_PRIM(OSMO_GPRS_LLC_LL_ESTABLISH, PRIM_OP_REQUEST): + OSMO_ASSERT(g_llc_ctx->location == OSMO_GPRS_LLC_LOCATION_MS || + g_llc_ctx->location == OSMO_GPRS_LLC_LOCATION_SGSN); + rc = llc_prim_handle_ll_establish_req(llc_prim); + break; case OSMO_PRIM(OSMO_GPRS_LLC_LL_XID, PRIM_OP_REQUEST): OSMO_ASSERT(g_llc_ctx->location == OSMO_GPRS_LLC_LOCATION_MS || g_llc_ctx->location == OSMO_GPRS_LLC_LOCATION_SGSN); diff --git a/tests/llc/llc_prim_test.c b/tests/llc/llc_prim_test.c index 83a7556..54dabb6 100644 --- a/tests/llc/llc_prim_test.c +++ b/tests/llc/llc_prim_test.c @@ -231,6 +231,11 @@ OSMO_ASSERT(rc == 0); char xid_l3_pars[] = "xid-l3-dummy-buffer"; + llc_prim = osmo_gprs_llc_prim_alloc_ll_establish_req(tlli, OSMO_GPRS_LLC_SAPI_SNDCP3, (uint8_t *)xid_l3_pars, sizeof(xid_l3_pars)); + OSMO_ASSERT(llc_prim); + rc = osmo_gprs_llc_prim_upper_down(llc_prim); + OSMO_ASSERT(rc == -ENOTSUP); /* ABM mode not supported yet. */ + llc_prim = osmo_gprs_llc_prim_alloc_ll_xid_req(tlli, OSMO_GPRS_LLC_SAPI_SNDCP3, (uint8_t *)xid_l3_pars, sizeof(xid_l3_pars)); OSMO_ASSERT(llc_prim); rc = osmo_gprs_llc_prim_upper_down(llc_prim); diff --git a/tests/llc/llc_prim_test.err b/tests/llc/llc_prim_test.err index 667b423..444f3da 100644 --- a/tests/llc/llc_prim_test.err +++ b/tests/llc/llc_prim_test.err @@ -13,6 +13,8 @@ DLGLOBAL NOTICE LLME(e1c5d364/e1c5d364){ASSIGNED} LLGM Assign post (e1c5d364 => e1c5d364) DLGLOBAL INFO Rx from upper layers: LLGMM-RESET.request DLGLOBAL INFO LLME(e1c5d364/e1c5d364){ASSIGNED} LLGMM-RESET.request +DLGLOBAL INFO Rx from upper layers: LL-ESTABLISH.request +DLGLOBAL ERROR LLE(e1c5d364/e1c5d364,SNDCP3){UNASSIGNED} Tx SABM: ABM mode not supported yet! DLGLOBAL INFO Rx from upper layers: LL-XID.request DLGLOBAL NOTICE LLE(e1c5d364/e1c5d364,SNDCP3){UNASSIGNED} Sending XID type L3-Params (30 bytes) request to MS... DLGLOBAL INFO Rx from upper layers: LL-UNITDATA.request -- To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/32311 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-gprs Gerrit-Branch: master Gerrit-Change-Id: I27aff368f4a70d30c23523946d72a751e100f298 Gerrit-Change-Number: 32311 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-bsc[master]: log: N-PCSTATE: use new value_strings
by neels 14 Apr '23

14 Apr '23
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/32152 ) ( 4 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: log: N-PCSTATE: use new value_strings ...................................................................... log: N-PCSTATE: use new value_strings Related: SYS#6319 Depends: I873ea30e8f64280487769668c748c67ce4ff4023 (libosmo-sccp) Change-Id: I7a13fcf2bfee232c6cebc3c1180b956a73abc24e --- M src/osmo-bsc/osmo_bsc_sigtran.c 1 file changed, 22 insertions(+), 6 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c index f4c8f81..64bddf6 100644 --- a/src/osmo-bsc/osmo_bsc_sigtran.c +++ b/src/osmo-bsc/osmo_bsc_sigtran.c @@ -210,8 +210,9 @@ bool connected; bool disconnected; - LOGP(DMSC, LOGL_DEBUG, "N-PCSTATE ind: affected_pc=%u sp_status=%d remote_sccp_status=%d\n", - pcst->affected_pc, pcst->sp_status, pcst->remote_sccp_status); + LOGP(DMSC, LOGL_DEBUG, "N-PCSTATE ind: affected_pc=%u sp_status=%s remote_sccp_status=%s\n", + pcst->affected_pc, osmo_sccp_sp_status_name(pcst->sp_status), + osmo_sccp_rem_sccp_status_name(pcst->remote_sccp_status)); /* If we don't care about that point-code, ignore PCSTATE. */ msc = get_msc_by_pc(cs7, pcst->affected_pc); @@ -273,14 +274,18 @@ if (disconnected && a_reset_conn_ready(msc)) { LOGP(DMSC, LOGL_NOTICE, - "(msc%d) now unreachable: N-PCSTATE ind: pc=%u sp_status=%d remote_sccp_status=%d\n", - msc->nr, pcst->affected_pc, pcst->sp_status, pcst->remote_sccp_status); + "(msc%d) now unreachable: N-PCSTATE ind: pc=%u sp_status=%s remote_sccp_status=%s\n", + msc->nr, pcst->affected_pc, + osmo_sccp_sp_status_name(pcst->sp_status), + osmo_sccp_rem_sccp_status_name(pcst->remote_sccp_status)); /* A previously usable MSC has disconnected. Kick the BSSMAP back to DISC state. */ bssmap_reset_set_disconnected(msc->a.bssmap_reset); } else if (connected && !a_reset_conn_ready(msc)) { LOGP(DMSC, LOGL_NOTICE, - "(msc%d) now available: N-PCSTATE ind: pc=%u sp_status=%d remote_sccp_status=%d\n", - msc->nr, pcst->affected_pc, pcst->sp_status, pcst->remote_sccp_status); + "(msc%d) now available: N-PCSTATE ind: pc=%u sp_status=%s remote_sccp_status=%s\n", + msc->nr, pcst->affected_pc, + osmo_sccp_sp_status_name(pcst->sp_status), + osmo_sccp_rem_sccp_status_name(pcst->remote_sccp_status)); /* A previously unusable MSC has become reachable. Trigger immediate BSSMAP RESET -- we would resend a * RESET either way, but we might as well do it now to speed up connecting. */ bssmap_reset_resend_reset(msc->a.bssmap_reset); -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/32152 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I7a13fcf2bfee232c6cebc3c1180b956a73abc24e Gerrit-Change-Number: 32152 Gerrit-PatchSet: 5 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-bsc[master]: SCCP N-PCSTATE: trigger MSC status on PC availability
by neels 14 Apr '23

14 Apr '23
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/32151 ) Change subject: SCCP N-PCSTATE: trigger MSC status on PC availability ...................................................................... SCCP N-PCSTATE: trigger MSC status on PC availability Related: SYS#6319 Related: Ia1aea4e33230d6a685b72ea5ba20dd9c7d265d44 osmo-ttcn3-hacks Related: Ib4a5330df30a73e744c316898817b2fa3271d75e osmo-ttcn3-hacks Change-Id: I3a0869598b8395601a16d78dbc46eec400c0ea84 --- M include/osmocom/bsc/bssmap_reset.h M src/osmo-bsc/bssmap_reset.c M src/osmo-bsc/osmo_bsc_sigtran.c 3 files changed, 123 insertions(+), 1 deletion(-) Approvals: laforge: Looks good to me, but someone else must approve neels: Looks good to me, approved msuraev: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/include/osmocom/bsc/bssmap_reset.h b/include/osmocom/bsc/bssmap_reset.h index fcd850b..c0de13c 100644 --- a/include/osmocom/bsc/bssmap_reset.h +++ b/include/osmocom/bsc/bssmap_reset.h @@ -28,4 +28,5 @@ struct bssmap_reset *bssmap_reset_alloc(void *ctx, const char *label, const struct bssmap_reset_cfg *cfg); bool bssmap_reset_is_conn_ready(const struct bssmap_reset *bssmap_reset); void bssmap_reset_resend_reset(struct bssmap_reset *bssmap_reset); +void bssmap_reset_set_disconnected(struct bssmap_reset *bssmap_reset); void bssmap_reset_term_and_free(struct bssmap_reset *bssmap_reset); diff --git a/src/osmo-bsc/bssmap_reset.c b/src/osmo-bsc/bssmap_reset.c index fa6684d..ac304a5 100644 --- a/src/osmo-bsc/bssmap_reset.c +++ b/src/osmo-bsc/bssmap_reset.c @@ -251,6 +251,12 @@ osmo_fsm_inst_state_chg_ms(bssmap_reset->fi, BSSMAP_RESET_ST_DISC, 1, 0); } +void bssmap_reset_set_disconnected(struct bssmap_reset *bssmap_reset) +{ + /* Go to disconnected state, with the normal RESET timeout to re-send RESET. */ + bssmap_reset_fsm_state_chg(bssmap_reset->fi, BSSMAP_RESET_ST_DISC); +} + static __attribute__((constructor)) void bssmap_reset_fsm_init(void) { OSMO_ASSERT(osmo_fsm_register(&bssmap_reset_fsm) == 0); diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c index 8837330..f4c8f81 100644 --- a/src/osmo-bsc/osmo_bsc_sigtran.c +++ b/src/osmo-bsc/osmo_bsc_sigtran.c @@ -36,6 +36,7 @@ #include <osmocom/bsc/gsm_data.h> #include <osmocom/bsc/bts.h> #include <osmocom/bsc/paging.h> +#include <osmocom/bsc/bssmap_reset.h> #include <osmocom/mgcp_client/mgcp_common.h> /* A pointer to a list with all involved MSCs @@ -92,7 +93,7 @@ &msc->a.msc_addr, msg); } -/* Find an MSC by its sigtran point code */ +/* Find an MSC by its remote SCCP address */ static struct bsc_msc_data *get_msc_by_addr(const struct osmo_sccp_addr *msc_addr) { struct osmo_ss7_instance *ss7; @@ -107,6 +108,21 @@ return NULL; } +/* Find an MSC by its remote sigtran point code on a given cs7 instance. */ +static struct bsc_msc_data *get_msc_by_pc(struct osmo_ss7_instance *cs7, uint32_t pc) +{ + struct bsc_msc_data *msc; + llist_for_each_entry(msc, msc_list, entry) { + if (msc->a.cs7_instance != cs7->cfg.id) + continue; + if ((msc->a.msc_addr.presence & OSMO_SCCP_ADDR_T_PC) == 0) + continue; + if (msc->a.msc_addr.pc == pc) + return msc; + } + return NULL; +} + /* Received data from MSC, use the connection id which MSC it is */ static int handle_data_from_msc(struct gsm_subscriber_connection *conn, struct msgb *msg) { @@ -188,6 +204,89 @@ return rc; } +static void handle_pcstate_ind(struct osmo_ss7_instance *cs7, const struct osmo_scu_pcstate_param *pcst) +{ + struct bsc_msc_data *msc; + bool connected; + bool disconnected; + + LOGP(DMSC, LOGL_DEBUG, "N-PCSTATE ind: affected_pc=%u sp_status=%d remote_sccp_status=%d\n", + pcst->affected_pc, pcst->sp_status, pcst->remote_sccp_status); + + /* If we don't care about that point-code, ignore PCSTATE. */ + msc = get_msc_by_pc(cs7, pcst->affected_pc); + if (!msc) + return; + + /* See if this marks the point code to have become available, or to have been lost. + * + * I want to detect two events: + * - connection event (both indicators say PC is reachable). + * - disconnection event (at least one indicator says the PC is not reachable). + * + * There are two separate incoming indicators with various possible values -- the incoming events can be: + * + * - neither connection nor disconnection indicated -- just indicating congestion + * connected == false, disconnected == false --> do nothing. + * - both incoming values indicate that we are connected + * --> trigger connected + * - both indicate we are disconnected + * --> trigger disconnected + * - one value indicates 'connected', the other indicates 'disconnected' + * --> trigger disconnected + * + * Congestion could imply that we're connected, but it does not indicate that a PC's reachability changed, so no need to + * trigger on that. + */ + connected = false; + disconnected = false; + + switch (pcst->sp_status) { + case OSMO_SCCP_SP_S_ACCESSIBLE: + connected = true; + break; + case OSMO_SCCP_SP_S_INACCESSIBLE: + disconnected = true; + break; + default: + case OSMO_SCCP_SP_S_CONGESTED: + /* Neither connecting nor disconnecting */ + break; + } + + switch (pcst->remote_sccp_status) { + case OSMO_SCCP_REM_SCCP_S_AVAILABLE: + if (!disconnected) + connected = true; + break; + case OSMO_SCCP_REM_SCCP_S_UNAVAILABLE_UNKNOWN: + case OSMO_SCCP_REM_SCCP_S_UNEQUIPPED: + case OSMO_SCCP_REM_SCCP_S_INACCESSIBLE: + disconnected = true; + connected = false; + break; + default: + case OSMO_SCCP_REM_SCCP_S_CONGESTED: + /* Neither connecting nor disconnecting */ + break; + } + + if (disconnected && a_reset_conn_ready(msc)) { + LOGP(DMSC, LOGL_NOTICE, + "(msc%d) now unreachable: N-PCSTATE ind: pc=%u sp_status=%d remote_sccp_status=%d\n", + msc->nr, pcst->affected_pc, pcst->sp_status, pcst->remote_sccp_status); + /* A previously usable MSC has disconnected. Kick the BSSMAP back to DISC state. */ + bssmap_reset_set_disconnected(msc->a.bssmap_reset); + } else if (connected && !a_reset_conn_ready(msc)) { + LOGP(DMSC, LOGL_NOTICE, + "(msc%d) now available: N-PCSTATE ind: pc=%u sp_status=%d remote_sccp_status=%d\n", + msc->nr, pcst->affected_pc, pcst->sp_status, pcst->remote_sccp_status); + /* A previously unusable MSC has become reachable. Trigger immediate BSSMAP RESET -- we would resend a + * RESET either way, but we might as well do it now to speed up connecting. */ + bssmap_reset_resend_reset(msc->a.bssmap_reset); + } +} + /* Callback function, called by the SCCP stack when data arrives */ static int sccp_sap_up(struct osmo_prim_hdr *oph, void *_scu) { @@ -255,6 +354,10 @@ } break; + case OSMO_PRIM(OSMO_SCU_PRIM_N_PCSTATE, PRIM_OP_INDICATION): + handle_pcstate_ind(osmo_sccp_get_ss7(sccp), &scu_prim->u.pcstate); + break; + default: LOGP(DMSC, LOGL_ERROR, "Unhandled SIGTRAN operation %s on primitive %u\n", get_value_string(osmo_prim_op_names, oph->operation), oph->primitive); -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/32151 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I3a0869598b8395601a16d78dbc46eec400c0ea84 Gerrit-Change-Number: 32151 Gerrit-PatchSet: 5 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-bsc[master]: SCCP N-PCSTATE: trigger MSC status on PC availability
by neels 14 Apr '23

14 Apr '23
Attention is currently required from: pespin. neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/32151 ) Change subject: SCCP N-PCSTATE: trigger MSC status on PC availability ...................................................................... Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/32151 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I3a0869598b8395601a16d78dbc46eec400c0ea84 Gerrit-Change-Number: 32151 Gerrit-PatchSet: 4 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Fri, 14 Apr 2023 14:32:40 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • ...
  • 226
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.