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

December 2023

  • 1 participants
  • 1601 discussions
[S] Change in osmo-mgw[master]: systemd,manual: set LimitNOFILE=65536
by laforge 03 Dec '23

03 Dec '23
Attention is currently required from: neels. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/35178?usp=email ) Change subject: systemd,manual: set LimitNOFILE=65536 ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/35178?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I46512517bc3b5bb90cac7643e7ac73afba398d36 Gerrit-Change-Number: 35178 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Sun, 03 Dec 2023 02:20:46 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmocom-bb[master]: mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810
by laforge 03 Dec '23

03 Dec '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/33532?usp=email ) Change subject: mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810 ...................................................................... mobile: Fix PCS ARFCN handling: PCS can only be ARFCN 512..810 While it is correct to use the band indicator from SI1 rest octets, it may only be applied for ARFCN values in the range 512..810. The function gsm_refer_pcs() is used to determine, if the cell (which 'talks' about ARFCNs) refers to them PCS or DCS channels. It returns true, if it refers to PCS, but this only means that ARFCNs in the range 512..810 are PCS channels, not all ARFCNs. The new function gsm_arfcn_refer_pcs() is used to add the PCS flag to an ARFCN, if the given cell refers to PCS and the given ARFCN is in the PCS range 512..810. Change-Id: Id99c8534bf853f4f24f99364790c1ac1df6cc007 Related: OS#6078 --- M src/host/layer23/include/osmocom/bb/common/sysinfo.h M src/host/layer23/src/common/sysinfo.c M src/host/layer23/src/mobile/gsm322.c M src/host/layer23/src/mobile/gsm48_rr.c 4 files changed, 71 insertions(+), 41 deletions(-) Approvals: fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified jolly: Looks good to me, approved diff --git a/src/host/layer23/include/osmocom/bb/common/sysinfo.h b/src/host/layer23/include/osmocom/bb/common/sysinfo.h index 9efb248..c31cf9d 100644 --- a/src/host/layer23/include/osmocom/bb/common/sysinfo.h +++ b/src/host/layer23/include/osmocom/bb/common/sysinfo.h @@ -71,7 +71,7 @@ /* si1 rest */ uint8_t nch; uint8_t nch_position; - uint8_t band_ind; /* set for DCS */ + bool band_ind; /* set for DCS */ /* si3 rest */ uint8_t sp; @@ -181,7 +181,8 @@ }; char *gsm_print_arfcn(uint16_t arfcn); -uint8_t gsm_refer_pcs(uint16_t arfcn, const struct gsm48_sysinfo *s); +bool gsm_refer_pcs(uint16_t cell_arfcn, const struct gsm48_sysinfo *cell_s); +uint16_t gsm_arfcn_refer_pcs(uint16_t cell_arfcn, const struct gsm48_sysinfo *cell_s, uint16_t arfcn); int gsm48_sysinfo_dump(const struct gsm48_sysinfo *s, uint16_t arfcn, void (*print)(void *, const char *, ...), void *priv, uint8_t *freq_map); diff --git a/src/host/layer23/src/common/sysinfo.c b/src/host/layer23/src/common/sysinfo.c index f541c85..7fdc6ff 100644 --- a/src/host/layer23/src/common/sysinfo.c +++ b/src/host/layer23/src/common/sysinfo.c @@ -50,20 +50,35 @@ return text; } -/* check if the cell 'talks' about DCS (0) or PCS (1) */ -uint8_t gsm_refer_pcs(uint16_t arfcn, const struct gsm48_sysinfo *s) +/* Check if the cell 'talks' about DCS (false) or PCS (true) */ +bool gsm_refer_pcs(uint16_t cell_arfcn, const struct gsm48_sysinfo *cell_s) { /* If ARFCN is PCS band, the cell refers to PCS */ - if ((arfcn & ARFCN_PCS)) - return 1; + if ((cell_arfcn & ARFCN_PCS)) + return true; /* If no SI1 is available, we assume DCS. Be sure to call this * function only if SI 1 is available. */ - if (!s->si1) + if (!cell_s->si1) return 0; /* If band indicator indicates PCS band, the cell refers to PCSThe */ - return s->band_ind; + return cell_s->band_ind; +} + +/* Change the given ARFCN to PCS ARFCN, if it is in the PCS channel range and the cell refers to PCS band. */ +uint16_t gsm_arfcn_refer_pcs(uint16_t cell_arfcn, const struct gsm48_sysinfo *cell_s, uint16_t arfcn) +{ + /* If ARFCN is not one of the overlapping channel of PCS and DCS. */ + if (arfcn < 512 && arfcn > 810) + return arfcn; + + /* If the 'cell' does not refer to PCS. */ + if (!gsm_refer_pcs(cell_arfcn, cell_s)) + return arfcn; + + /* The ARFCN is PCS, because the ARFCN is in the PCS range and the cell refers to it. */ + return arfcn | ARFCN_PCS; } int gsm48_sysinfo_dump(const struct gsm48_sysinfo *s, uint16_t arfcn, @@ -541,10 +556,7 @@ s->nch_position = bitvec_get_uint(&bv, 5); } else s->nch = 0; - if (bitvec_get_bit_high(&bv) == H) - s->band_ind = 1; - else - s->band_ind = 0; + s->band_ind = (bitvec_get_bit_high(&bv) == H); return 0; } diff --git a/src/host/layer23/src/mobile/gsm322.c b/src/host/layer23/src/mobile/gsm322.c index 35811d3..3d0cc77 100644 --- a/src/host/layer23/src/mobile/gsm322.c +++ b/src/host/layer23/src/mobile/gsm322.c @@ -2419,7 +2419,8 @@ struct gsm322_cellsel *cs = &ms->cellsel; struct gsm48_sysinfo *s; struct gsm322_ba_list *ba = NULL; - int i, refer_pcs; + int i; + bool refer_pcs; uint8_t freq[128+38]; if (!cs) { @@ -2472,7 +2473,8 @@ struct gsm48_sysinfo *s) { struct gsm322_ba_list *ba; - int i, refer_pcs; + int i; + bool refer_pcs; uint8_t freq[128+38]; /* find or create ba list */ @@ -3408,8 +3410,7 @@ } /* create temporary ba range with given frequency ranges */ -struct gsm322_ba_list *gsm322_cs_ba_range(struct osmocom_ms *ms, - uint32_t *range, uint8_t ranges, uint8_t refer_pcs) +static struct gsm322_ba_list *gsm322_cs_ba_range(struct osmocom_ms *ms, uint32_t *range, uint8_t ranges, bool refer_pcs) { static struct gsm322_ba_list ba; int lower, higher; @@ -4403,7 +4404,8 @@ uint8_t map[128]; uint16_t nc[32]; uint8_t changed = 0; - int refer_pcs, index; + bool refer_pcs; + int index; uint16_t arfcn; if (cs->ms->settings.no_neighbour) diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c index 97ba173..6ba57e3 100644 --- a/src/host/layer23/src/mobile/gsm48_rr.c +++ b/src/host/layer23/src/mobile/gsm48_rr.c @@ -2600,7 +2600,8 @@ && s->si5 && (!s->nb_ext_ind_si5 || s->si5bis)) { struct gsm48_rr_meas *rrmeas = &ms->rrlayer.meas; - int i, refer_pcs; + int i; + bool refer_pcs; int16_t arfcn; LOGP(DRR, LOGL_NOTICE, "Complete set of SI5* for BA(%d)\n", @@ -3385,8 +3386,7 @@ } else { cd.h = 0; gsm48_decode_chan_h0(&ia->chan_desc, &cd.tsc, &cd.arfcn); - if (gsm_refer_pcs(cs->arfcn, s)) - cd.arfcn |= ARFCN_PCS; + cd.arfcn = gsm_arfcn_refer_pcs(cs->arfcn, s, cd.arfcn); LOGP(DRR, LOGL_INFO, " (ta %d/%dm ra 0x%02x chan_nr 0x%02x " "ARFCN %s TS %u SS %u TSC %u)\n", ia->timing_advance, @@ -3504,8 +3504,7 @@ } else { cd1.h = 0; gsm48_decode_chan_h0(&ia->chan_desc1, &cd1.tsc, &cd1.arfcn); - if (gsm_refer_pcs(cs->arfcn, s)) - cd1.arfcn |= ARFCN_PCS; + cd1.arfcn = gsm_arfcn_refer_pcs(cs->arfcn, s, cd1.arfcn); LOGP(DRR, LOGL_INFO, " assignment 1 (ta %d/%dm ra 0x%02x " "chan_nr 0x%02x ARFCN %s TS %u SS %u TSC %u)\n", ia->timing_advance1, @@ -3533,8 +3532,7 @@ } else { cd2.h = 0; gsm48_decode_chan_h0(&ia->chan_desc2, &cd2.tsc, &cd2.arfcn); - if (gsm_refer_pcs(cs->arfcn, s)) - cd2.arfcn |= ARFCN_PCS; + cd2.arfcn = gsm_arfcn_refer_pcs(cs->arfcn, s, cd2.arfcn); LOGP(DRR, LOGL_INFO, " assignment 2 (ta %d/%dm ra 0x%02x " "chan_nr 0x%02x ARFCN %s TS %u SS %u TSC %u)\n", ia->timing_advance2, @@ -3998,8 +3996,8 @@ struct gsm322_cellsel *cs = &ms->cellsel; struct gsm48_sysinfo *s = cs->si; struct gsm_settings *set = &ms->settings; - int i, pcs, index; - uint16_t arfcn; + int i, index; + uint16_t arfcn, pcs; pcs = gsm_refer_pcs(cs->arfcn, s) ? ARFCN_PCS : 0; @@ -4102,7 +4100,9 @@ /* convert to band_arfcn and check for unsported frequency */ for (i = 0; i < *ma_len; i++) { - arfcn = ma[i] | pcs; + arfcn = ma[i]; + if (arfcn >= 512 && arfcn <= 810) + arfcn |= pcs; ma[i] = arfcn; index = arfcn2index(arfcn); if (!(set->freq_map[index >> 3] & (1 << (index & 7)))) { @@ -4490,8 +4490,7 @@ } else { cd.h = 0; gsm48_decode_chan_h0(&fr->chan_desc, &cd.tsc, &cd.arfcn); - if (gsm_refer_pcs(cs->arfcn, s)) - cd.arfcn |= ARFCN_PCS; + cd.arfcn = gsm_arfcn_refer_pcs(cs->arfcn, s, cd.arfcn); LOGP(DRR, LOGL_INFO, " (ARFCN %s TS %u SS %u TSC %u)\n", gsm_print_arfcn(cd.arfcn), ch_ts, ch_subch, cd.tsc); } @@ -4600,8 +4599,7 @@ } else { cd->h = 0; gsm48_decode_chan_h0(&cm->chan_desc, &cd->tsc, &cd->arfcn); - if (gsm_refer_pcs(cs->arfcn, s)) - cd->arfcn |= ARFCN_PCS; + cd->arfcn = gsm_arfcn_refer_pcs(cs->arfcn, s, cd->arfcn); LOGP(DRR, LOGL_INFO, " (chan_nr 0x%02x ARFCN %s TS %u SS %u " "TSC %u mode %u)\n", cm->chan_desc.chan_nr, gsm_print_arfcn(cd->arfcn), ch_ts, ch_subch, cd->tsc, @@ -4744,8 +4742,7 @@ } else { cdb->h = 0; gsm48_decode_chan_h0(ccd, &cdb->tsc, &cdb->arfcn); - if (gsm_refer_pcs(cs->arfcn, s)) - cdb->arfcn |= ARFCN_PCS; + cdb->arfcn = gsm_arfcn_refer_pcs(cs->arfcn, s, cdb->arfcn); LOGP(DRR, LOGL_INFO, " before: (chan_nr 0x%02x " "ARFCN %s TS %u SS %u TSC %u)\n", ccd->chan_nr, gsm_print_arfcn(cdb->arfcn), @@ -4772,8 +4769,7 @@ } else { cda->h = 0; gsm48_decode_chan_h0(&ac->chan_desc, &cda->tsc, &cda->arfcn); - if (gsm_refer_pcs(cs->arfcn, s)) - cda->arfcn |= ARFCN_PCS; + cda->arfcn = gsm_arfcn_refer_pcs(cs->arfcn, s, cda->arfcn); LOGP(DRR, LOGL_INFO, " after: (chan_nr 0x%02x ARFCN %s TS %u " "SS %u TSC %u)\n", ac->chan_desc.chan_nr, gsm_print_arfcn(cda->arfcn), ch_ts, ch_subch, cda->tsc); @@ -5149,8 +5145,7 @@ } else { cdb->h = 0; gsm48_decode_chan_h0(ccd, &cdb->tsc, &cdb->arfcn); - if (gsm_refer_pcs(cs->arfcn, s)) - cdb->arfcn |= ARFCN_PCS; + cdb->arfcn = gsm_arfcn_refer_pcs(cs->arfcn, s, cdb->arfcn); LOGP(DRR, LOGL_INFO, " before: (chan_nr 0x%02x " "ARFCN %s TS %u SS %u TSC %u)\n", ccd->chan_nr, gsm_print_arfcn(cdb->arfcn), @@ -5177,8 +5172,7 @@ } else { cda->h = 0; gsm48_decode_chan_h0(&ho->chan_desc, &cda->tsc, &cda->arfcn); - if (gsm_refer_pcs(cs->arfcn, s)) - cda->arfcn |= ARFCN_PCS; + cda->arfcn = gsm_arfcn_refer_pcs(cs->arfcn, s, cda->arfcn); LOGP(DRR, LOGL_INFO, " after: (chan_nr 0x%02x ARFCN %s TS %u " "SS %u TSC %u)\n", ho->chan_desc.chan_nr, gsm_print_arfcn(cda->arfcn), ch_ts, ch_subch, cda->tsc); @@ -5737,8 +5731,7 @@ } else { cd.h = 0; gsm48_decode_chan_h0(ch_desc, &cd.tsc, &cd.arfcn); - if (gsm_refer_pcs(cs->arfcn, s)) - cd.arfcn |= ARFCN_PCS; + cd.arfcn = gsm_arfcn_refer_pcs(cs->arfcn, s, cd.arfcn); LOGP(DRR, LOGL_INFO, " (chan_nr 0x%02x ARFCN %s TS %u SS %u TSC %u)\n", ch_desc->chan_nr, gsm_print_arfcn(cd.arfcn), ch_ts, ch_subch, cd.tsc); } -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/33532?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: Id99c8534bf853f4f24f99364790c1ac1df6cc007 Gerrit-Change-Number: 33532 Gerrit-PatchSet: 4 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmocore[master]: soft_uart: fix doxygen doc for osmo_soft_uart_tx_ubits()
by laforge 03 Dec '23

03 Dec '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35170?usp=email ) Change subject: soft_uart: fix doxygen doc for osmo_soft_uart_tx_ubits() ...................................................................... soft_uart: fix doxygen doc for osmo_soft_uart_tx_ubits() Change-Id: I648db45bbde39c6b3d839c744a56d01a562e4129 Related: OS#4396 --- M src/core/soft_uart.c 1 file changed, 11 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified osmith: Looks good to me, approved diff --git a/src/core/soft_uart.c b/src/core/soft_uart.c index 5ddddb4..8d9142b 100644 --- a/src/core/soft_uart.c +++ b/src/core/soft_uart.c @@ -280,7 +280,7 @@ * \param[in] suart soft-UART instance to pull the bits from. * \param[out] ubits pointer to a buffer where to store pulled bits. * \param[in] n_ubits number of unpacked bits to be pulled. - * \returns number of unpacked bits pulled; negative on error. */ + * \returns 0 on success; negative on error. */ int osmo_soft_uart_tx_ubits(struct osmo_soft_uart *suart, ubit_t *ubits, size_t n_ubits) { const struct osmo_soft_uart_cfg *cfg = &suart->cfg; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35170?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I648db45bbde39c6b3d839c744a56d01a562e4129 Gerrit-Change-Number: 35170 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmocore[master]: soft_uart: add osmo_soft_uart_{get,set}_name()
by laforge 03 Dec '23

03 Dec '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35169?usp=email ) Change subject: soft_uart: add osmo_soft_uart_{get,set}_name() ...................................................................... soft_uart: add osmo_soft_uart_{get,set}_name() Change-Id: Iabf29f42d876035481011fa8e8a51c0590fe63b8 Related: OS#4396 --- M include/osmocom/core/soft_uart.h M src/core/libosmocore.map M src/core/soft_uart.c 3 files changed, 32 insertions(+), 0 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/core/soft_uart.h b/include/osmocom/core/soft_uart.h index 097d2ee..7b7c394 100644 --- a/include/osmocom/core/soft_uart.h +++ b/include/osmocom/core/soft_uart.h @@ -87,6 +87,10 @@ const struct osmo_soft_uart_cfg *cfg); void osmo_soft_uart_free(struct osmo_soft_uart *suart); int osmo_soft_uart_configure(struct osmo_soft_uart *suart, const struct osmo_soft_uart_cfg *cfg); + +const char *osmo_soft_uart_get_name(const struct osmo_soft_uart *suart); +void osmo_soft_uart_set_name(struct osmo_soft_uart *suart, const char *name); + int osmo_soft_uart_set_rx(struct osmo_soft_uart *suart, bool enable); int osmo_soft_uart_set_tx(struct osmo_soft_uart *suart, bool enable); diff --git a/src/core/libosmocore.map b/src/core/libosmocore.map index 3d6aa42..4ae5108 100644 --- a/src/core/libosmocore.map +++ b/src/core/libosmocore.map @@ -444,6 +444,8 @@ osmo_soft_uart_alloc; osmo_soft_uart_free; osmo_soft_uart_configure; +osmo_soft_uart_get_name; +osmo_soft_uart_set_name; osmo_soft_uart_set_rx; osmo_soft_uart_set_tx; osmo_soft_uart_rx_ubits; diff --git a/src/core/soft_uart.c b/src/core/soft_uart.c index 4fffaee..5ddddb4 100644 --- a/src/core/soft_uart.c +++ b/src/core/soft_uart.c @@ -396,6 +396,22 @@ return 0; } +/*! Get a name for the given soft-UART instance. + * \param[in] suart soft-UART instance to get the name from. + * \returns name of the given soft-UART instance. */ +const char *osmo_soft_uart_get_name(const struct osmo_soft_uart *suart) +{ + return suart->name; +} + +/*! Set a new name for the given soft-UART instance. + * \param[in] suart soft-UART instance to set the name for. + * \param[in] name the new name. */ +void osmo_soft_uart_set_name(struct osmo_soft_uart *suart, const char *name) +{ + osmo_talloc_replace_string(suart, (char **)&suart->name, name); +} + /*! Enable/disable receiver of the given soft-UART. * \param[in] suart soft-UART instance to be re-configured. * \param[in] enable enable/disable state of the receiver. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35169?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Iabf29f42d876035481011fa8e8a51c0590fe63b8 Gerrit-Change-Number: 35169 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmocore[master]: soft_uart: check Rx/Tx state once in osmo_soft_uart_{rx,tx}_ubits()
by laforge 03 Dec '23

03 Dec '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35171?usp=email ) Change subject: soft_uart: check Rx/Tx state once in osmo_soft_uart_{rx,tx}_ubits() ...................................................................... soft_uart: check Rx/Tx state once in osmo_soft_uart_{rx,tx}_ubits() Check it once rather than doing this in a loop. Return -EAGAIN if Rx or Tx is not enabled when calling osmo_soft_uart_{rx,tx}_ubits(). This [theoretically] improves performance by reducing the number of conditional statements in loops. In the Tx path, this also prevents calling the .tx_cb() when the transmitter is disabled, so that we don't loose the application data. Change-Id: I70f93b3655eb21c2323e451052c40cd305c016c8 Related: OS#4396 --- M src/core/soft_uart.c M tests/soft_uart/soft_uart_test.c 2 files changed, 36 insertions(+), 8 deletions(-) Approvals: osmith: Looks good to me, but someone else must approve laforge: Looks good to me, approved neels: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/core/soft_uart.c b/src/core/soft_uart.c index 8d9142b..8cf45e1 100644 --- a/src/core/soft_uart.c +++ b/src/core/soft_uart.c @@ -111,9 +111,6 @@ /* receive a single bit */ static inline void osmo_uart_rx_bit(struct osmo_soft_uart *suart, const ubit_t bit) { - if (!suart->rx.running) - return; - switch (suart->rx.flow_state) { case SUART_FLOW_ST_IDLE: if (bit == 0) { /* start bit condition */ @@ -196,9 +193,12 @@ * \param[in] suart soft-UART instance to feed bits into. * \param[in] ubits pointer to the unpacked bits. * \param[in] n_ubits number of unpacked bits to be fed. - * \returns 0 on success; negative on error. */ + * \returns 0 on success; negative on error. + * -EAGAIN indicates that the receiver is disabled. */ int osmo_soft_uart_rx_ubits(struct osmo_soft_uart *suart, const ubit_t *ubits, size_t n_ubits) { + if (!suart->rx.running) + return -EAGAIN; for (size_t i = 0; i < n_ubits; i++) osmo_uart_rx_bit(suart, ubits[i]); return 0; @@ -213,9 +213,6 @@ { ubit_t tx_bit = 1; - if (!suart->tx.running) - return tx_bit; - switch (suart->tx.flow_state) { case SUART_FLOW_ST_IDLE: if (msg && msgb_length(msg) > 0) { /* if we have pending data */ @@ -280,7 +277,8 @@ * \param[in] suart soft-UART instance to pull the bits from. * \param[out] ubits pointer to a buffer where to store pulled bits. * \param[in] n_ubits number of unpacked bits to be pulled. - * \returns 0 on success; negative on error. */ + * \returns 0 on success; negative on error. + * -EAGAIN indicates that the transmitter is disabled. */ int osmo_soft_uart_tx_ubits(struct osmo_soft_uart *suart, ubit_t *ubits, size_t n_ubits) { const struct osmo_soft_uart_cfg *cfg = &suart->cfg; @@ -290,6 +288,9 @@ if (OSMO_UNLIKELY(n_ubits == 0)) return -EINVAL; + if (!suart->tx.running) + return -EAGAIN; + /* calculate UART frame size for the effective config */ n_frame_bits = 1 + cfg->num_data_bits + cfg->num_stop_bits; if (cfg->parity_mode != OSMO_SUART_PARITY_NONE) diff --git a/tests/soft_uart/soft_uart_test.c b/tests/soft_uart/soft_uart_test.c index 522739a..276ffe1 100644 --- a/tests/soft_uart/soft_uart_test.c +++ b/tests/soft_uart/soft_uart_test.c @@ -16,6 +16,7 @@ * */ +#include <errno.h> #include <stdio.h> #include <stdint.h> @@ -256,10 +257,18 @@ { struct osmo_soft_uart_cfg cfg; struct osmo_soft_uart *suart; + int rc; suart = osmo_soft_uart_alloc(NULL, __func__, &suart_test_default_cfg); OSMO_ASSERT(suart != NULL); + /* expect -EAGAIN when the transmitter is not enabled */ + rc = osmo_soft_uart_tx_ubits(suart, NULL, 42); + OSMO_ASSERT(rc == -EAGAIN); + /* expect -EAGAIN when the receiver is not enabled */ + rc = osmo_soft_uart_rx_ubits(suart, NULL, 42); + OSMO_ASSERT(rc == -EAGAIN); + osmo_soft_uart_set_tx(suart, true); osmo_soft_uart_set_rx(suart, true); -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35171?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I70f93b3655eb21c2323e451052c40cd305c016c8 Gerrit-Change-Number: 35171 Gerrit-PatchSet: 4 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in libosmocore[master]: soft_uart: check Rx/Tx state once in osmo_soft_uart_{rx,tx}_ubits()
by laforge 03 Dec '23

03 Dec '23
Attention is currently required from: fixeria. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35171?usp=email ) Change subject: soft_uart: check Rx/Tx state once in osmo_soft_uart_{rx,tx}_ubits() ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35171?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I70f93b3655eb21c2323e451052c40cd305c016c8 Gerrit-Change-Number: 35171 Gerrit-PatchSet: 3 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Sun, 03 Dec 2023 02:18:52 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in libosmocore[master]: osmo_io: Factor out and use common send function from backend
by laforge 03 Dec '23

03 Dec '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35078?usp=email ) Change subject: osmo_io: Factor out and use common send function from backend ...................................................................... osmo_io: Factor out and use common send function from backend This handles reenqueuing a message on EAGAIN and incomplete write Change-Id: I6da2653d32aedd0e7872be0cf90a841b56462e59 --- M src/core/osmo_io.c M src/core/osmo_io_internal.h M src/core/osmo_io_poll.c M src/core/osmo_io_uring.c 4 files changed, 58 insertions(+), 60 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index 8507f46..e059f87 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -344,6 +344,46 @@ } } +/*! completion handler: Calld by osmo_io backend after a given I/O operation has completed + * \param[in] iofd I/O file-descriptor on which I/O has completed + * \param[in] rc return value of the I/O operation + * \param[in] msghdr serialized msghdr containing state of completed I/O + */ +void iofd_handle_send_completion(struct osmo_io_fd *iofd, int rc, struct iofd_msghdr *msghdr) +{ + struct msgb *msg = msghdr->msg; + + /* Incomplete write */ + if (rc > 0 && rc < msgb_length(msg)) { + /* Re-enqueue remaining data */ + msgb_pull(msg, rc); + msghdr->iov[0].iov_len = msgb_length(msg); + iofd_txqueue_enqueue_front(iofd, msghdr); + return; + } + + /* Reenqueue the complete msgb */ + if (rc == -EAGAIN) { + iofd_txqueue_enqueue_front(iofd, msghdr); + return; + } + + /* All other failure and success cases are handled here */ + switch (msghdr->action) { + case IOFD_ACT_WRITE: + iofd->io_ops.write_cb(iofd, rc, msg); + break; + case IOFD_ACT_SENDTO: + iofd->io_ops.sendto_cb(iofd, rc, msg, &msghdr->osa); + break; + default: + OSMO_ASSERT(0); + } + + msgb_free(msghdr->msg); + iofd_msghdr_free(msghdr); +} + /* Public functions */ /*! Send a message through a connected socket. diff --git a/src/core/osmo_io_internal.h b/src/core/osmo_io_internal.h index 73a81e1..e8f4ea2 100644 --- a/src/core/osmo_io_internal.h +++ b/src/core/osmo_io_internal.h @@ -146,6 +146,7 @@ struct msgb *iofd_msgb_pending_or_alloc(struct osmo_io_fd *iofd); void iofd_handle_recv(struct osmo_io_fd *iofd, struct msgb *msg, int rc, struct iofd_msghdr *msghdr); +void iofd_handle_send_completion(struct osmo_io_fd *iofd, int rc, struct iofd_msghdr *msghdr); void iofd_handle_segmented_read(struct osmo_io_fd *iofd, struct msgb *msg, int rc); int iofd_txqueue_enqueue(struct osmo_io_fd *iofd, struct iofd_msghdr *msghdr); diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c index 2c1e422..5000dca 100644 --- a/src/core/osmo_io_poll.c +++ b/src/core/osmo_io_poll.c @@ -78,33 +78,8 @@ if (what & OSMO_FD_WRITE) { struct iofd_msghdr *msghdr = iofd_txqueue_dequeue(iofd); if (msghdr) { - msg = msghdr->msg; - rc = sendmsg(ofd->fd, &msghdr->hdr, msghdr->flags); - if (rc > 0 && rc < msgb_length(msg)) { - msgb_pull(msg, rc); - iofd_txqueue_enqueue_front(iofd, msghdr); - return; - } - if (rc == -EAGAIN) { - iofd_txqueue_enqueue_front(iofd, msghdr); - return; - } - - switch (iofd->mode) { - case OSMO_IO_FD_MODE_READ_WRITE: - iofd->io_ops.write_cb(iofd, rc, msg); - break; - case OSMO_IO_FD_MODE_RECVFROM_SENDTO: - iofd->io_ops.sendto_cb(iofd, rc, msg, &msghdr->osa); - break; - case OSMO_IO_FD_MODE_SCTP_RECVMSG_SEND: - OSMO_ASSERT(false); - break; - } - - talloc_free(msghdr); - msgb_free(msg); + iofd_handle_send_completion(iofd, rc, msghdr); } else { if (iofd->mode == OSMO_IO_FD_MODE_READ_WRITE) /* Socket is writable, but we have no data to send. A non-blocking/async diff --git a/src/core/osmo_io_uring.c b/src/core/osmo_io_uring.c index abeea79..1aa17d4 100644 --- a/src/core/osmo_io_uring.c +++ b/src/core/osmo_io_uring.c @@ -186,43 +186,14 @@ static void iofd_uring_handle_tx(struct iofd_msghdr *msghdr, int rc) { struct osmo_io_fd *iofd = msghdr->iofd; - struct msgb *msg = msghdr->msg; - if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED)) - goto out_free; - - /* Error during write */ - if (rc < 0) { - if (msghdr->action == IOFD_ACT_WRITE) - iofd->io_ops.write_cb(iofd, rc, msg); - else if (msghdr->action == IOFD_ACT_SENDTO) - iofd->io_ops.sendto_cb(iofd, rc, msg, &msghdr->osa); - else - OSMO_ASSERT(0); - goto out_free; + if (OSMO_UNLIKELY(IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED))) { + msgb_free(msghdr->msg); + iofd_msghdr_free(msghdr); + } else { + iofd_handle_send_completion(iofd, rc, msghdr); } - /* Incomplete write */ - if (rc < msgb_length(msg)) { - /* Re-enqueue remaining data */ - msgb_pull(msg, rc); - msghdr->iov[0].iov_len = msgb_length(msg); - iofd_txqueue_enqueue_front(iofd, msghdr); - goto out; - } - - if (msghdr->action == IOFD_ACT_WRITE) - iofd->io_ops.write_cb(iofd, rc, msg); - else if (msghdr->action == IOFD_ACT_SENDTO) - iofd->io_ops.sendto_cb(iofd, rc, msg, &msghdr->osa); - else - OSMO_ASSERT(0); - -out_free: - msgb_free(msghdr->msg); - iofd_msghdr_free(msghdr); - -out: iofd->u.uring.write_msghdr = NULL; /* submit the next to-be-transmitted message for this file descriptor */ if (iofd->u.uring.write_enabled && !IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED)) -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35078?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I6da2653d32aedd0e7872be0cf90a841b56462e59 Gerrit-Change-Number: 35078 Gerrit-PatchSet: 3 Gerrit-Owner: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in libosmocore[master]: osmo_io: Factor out and use common send function from backend
by laforge 03 Dec '23

03 Dec '23
Attention is currently required from: daniel, lynxis lazus, pespin. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35078?usp=email ) Change subject: osmo_io: Factor out and use common send function from backend ...................................................................... Patch Set 3: Code-Review+2 (1 comment) File src/core/osmo_io_uring.c: https://gerrit.osmocom.org/c/libosmocore/+/35078/comment/e6fd896d_11d3bc56 PS3, Line 191: msgb_free(msghdr->msg); > msg is not owned by msghdr because during receive msg needs to live longer. Done -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35078?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I6da2653d32aedd0e7872be0cf90a841b56462e59 Gerrit-Change-Number: 35078 Gerrit-PatchSet: 3 Gerrit-Owner: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu> Gerrit-Comment-Date: Sun, 03 Dec 2023 02:18:09 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Comment-In-Reply-To: daniel <dwillmann(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[L] Change in osmo-msc[master]: test_call: codecs: test specific PT from MO to MT
by laforge 03 Dec '23

03 Dec '23
Attention is currently required from: neels. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/35174?usp=email ) Change subject: test_call: codecs: test specific PT from MO to MT ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/35174?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I8fbabe242982441d676d09f4d0ed7557c8349f2c Gerrit-Change-Number: 35174 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Sun, 03 Dec 2023 02:17:35 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-msc[master]: test_call: codecs: allow specific PT numbers [2/2]
by laforge 03 Dec '23

03 Dec '23
Attention is currently required from: neels. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/35141?usp=email ) Change subject: test_call: codecs: allow specific PT numbers [2/2] ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/35141?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Change-Id: I25df2ed7ad792fbe66dfd0fbf08182c9cf6cfc5b Gerrit-Change-Number: 35141 Gerrit-PatchSet: 2 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Sun, 03 Dec 2023 02:17:31 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • ...
  • 161
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.