Projects
osmocom:master
osmo-trx
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 27
View file
osmo-trx.spec
Changed
@@ -14,13 +14,13 @@ Name: osmo-trx Requires: osmocom-master -Version: 1.5.0.45.287a +Version: 1.5.0.47.5829 Release: 0 Summary: SDR transceiver that implements Layer 1 of a GSM BTS License: AGPL-3.0-or-later Group: Productivity/Telephony/Servers URL: https://osmocom.org/projects/osmotrx -Source: osmo-trx_1.5.0.45.287a.tar.xz +Source: osmo-trx_1.5.0.47.5829.tar.xz Source1: rpmlintrc BuildRequires: autoconf BuildRequires: automake
View file
commit_287ae681b726c746958347752c271c818e277e75.txt
Deleted
View file
commit_58294fde4ba15a1246d2ba64fb0b1d38a1b69df7.txt
Added
View file
osmo-trx_1.5.0.45.287a.dsc -> osmo-trx_1.5.0.47.5829.dsc
Changed
@@ -2,7 +2,7 @@ Source: osmo-trx Binary: osmo-trx, osmo-trx-dbg, osmo-trx-uhd, osmo-trx-usrp1, osmo-trx-lms, osmo-trx-ipc, osmo-trx-doc Architecture: any all -Version: 1.5.0.45.287a +Version: 1.5.0.47.5829 Maintainer: Osmocom team <openbsc@lists.osmocom.org> Homepage: https://projects.osmocom.org/projects/osmotrx Standards-Version: 3.9.6 @@ -18,8 +18,8 @@ osmo-trx-uhd deb net optional arch=any osmo-trx-usrp1 deb net optional arch=any Checksums-Sha1: - 5fd756796123c80e45855c5a5bd4ca940356a621 1389712 osmo-trx_1.5.0.45.287a.tar.xz + 29879a7c76dccc9e828bc14ebae62c69633f1382 1388220 osmo-trx_1.5.0.47.5829.tar.xz Checksums-Sha256: - c0592499e7fd0d36559dbda37936756e3e6f61321ba6847c47c17f8f14d4e052 1389712 osmo-trx_1.5.0.45.287a.tar.xz + 8fe4a983f1d3108bf07cf9e540590d41a93d24079e59d789fffa84587c85c9d3 1388220 osmo-trx_1.5.0.47.5829.tar.xz Files: - 868e96955d2f58138fd1b970ead890a2 1389712 osmo-trx_1.5.0.45.287a.tar.xz + 3b435e9da3950cf584a8c2fa5928f631 1388220 osmo-trx_1.5.0.47.5829.tar.xz
View file
osmo-trx_1.5.0.45.287a.tar.xz/.tarball-version -> osmo-trx_1.5.0.47.5829.tar.xz/.tarball-version
Changed
@@ -1 +1 @@ -1.5.0.45-287a +1.5.0.47-5829
View file
osmo-trx_1.5.0.45.287a.tar.xz/Transceiver52M/ms/ms.h -> osmo-trx_1.5.0.47.5829.tar.xz/Transceiver52M/ms/ms.h
Changed
@@ -50,7 +50,7 @@ template <typename T> void clamp_array(T *start2, unsigned int len, T max) { - for (int i = 0; i < len; i++) { + for (unsigned int i = 0; i < len; i++) { const T t1 = start2i < -max ? -max : start2i; const T t2 = t1 > max ? max : t1; start2i = t2; @@ -263,7 +263,6 @@ std::thread lower_rx_task; std::thread lower_tx_task; - std::thread *calcrval_task; // provides bursts to upper rx thread rx_queue_t rxqueue; @@ -300,10 +299,12 @@ void maybe_update_gain(one_burst &brst); ms_trx() - : timing_advance(0), do_auto_gain(false), rxqueue(), first_sch_buf(new blade_sample_typeSCH_LEN_SPS), - burst_copy_buffer(new blade_sample_typeONE_TS_BURST_LEN), rcv_done{ false }, - sch_thread_done{ false }, hw_cpus(std::thread::hardware_concurrency()), - hw_target(hw_cpus > 4 ? sched_params::target::ODROID : sched_params::target::PI4) + : mTSC(0), mBSIC(0), timing_advance(0), do_auto_gain(false), rxqueue(), + first_sch_buf(new blade_sample_typeSCH_LEN_SPS), + burst_copy_buffer(new blade_sample_typeONE_TS_BURST_LEN), first_sch_buf_rcv_ts(0), + rcv_done{ false }, sch_thread_done{ false }, hw_cpus(std::thread::hardware_concurrency()), + hw_target(hw_cpus > 4 ? sched_params::target::ODROID : sched_params::target::PI4), + upper_is_ready(false) { std::cerr << "scheduling for: " << (hw_cpus > 4 ? "odroid" : "pi4") << std::endl; set_name_aff_sched(worker_thread.get_handle(), sched_params::thread_names::SCH_SEARCH); @@ -336,6 +337,15 @@ set_name_aff_sched(h, tgt.name, tgt.core, tgt.schedtype, tgt.prio); } + using pt_sig = void *(*)(void *); + + pthread_t spawn_worker_thread(sched_params::thread_names name, pt_sig fun, void *arg) + { + auto tgt = schdphw_targetname; + // std::cerr << "scheduling for: " << tgt.name << ":" << tgt.core << " prio:" << tgt.prio << std::endl; + return do_spawn_thr(tgt.name, tgt.core, tgt.schedtype, tgt.prio, fun, arg); + } + private: void set_name_aff_sched(std::thread::native_handle_type h, const char *name, int cpunum, int schedtype, int prio) @@ -359,4 +369,28 @@ return exit(0); } } + + pthread_t do_spawn_thr(const char *name, int cpunum, int schedtype, int prio, pt_sig fun, void *arg) + { + pthread_t thread; + + pthread_attr_t attr; + pthread_attr_init(&attr); + + sched_param sch_params; + sch_params.sched_priority = prio; + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + CPU_SET(cpunum, &cpuset); + auto a = pthread_attr_setaffinity_np(&attr, sizeof(cpu_set_t), &cpuset); + a |= pthread_attr_setschedpolicy(&attr, schedtype); + a |= pthread_attr_setschedparam(&attr, &sch_params); + a |= pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + if(a) + std::cerr << "thread arg rc:" << a << std::endl; + pthread_create(&thread, &attr, fun, arg); + pthread_setname_np(thread, name); + pthread_attr_destroy(&attr); + return thread; + } };
View file
osmo-trx_1.5.0.45.287a.tar.xz/Transceiver52M/ms/ms_trxcon_if.h -> osmo-trx_1.5.0.47.5829.tar.xz/Transceiver52M/ms/ms_trxcon_if.h
Changed
@@ -38,5 +38,5 @@ } }; using tx_queue_t = spsc_cond<8 * 1, internal_q_tx_buf, true, false>; -using cmd_queue_t = spsc_cond<8 * 1, trxcon_phyif_cmd, true, false>; +using cmd_queue_t = spsc_cond_timeout<8 * 1, trxcon_phyif_cmd, true, false>; using cmdr_queue_t = spsc_cond<8 * 1, trxcon_phyif_rsp, false, false>;
View file
osmo-trx_1.5.0.45.287a.tar.xz/Transceiver52M/ms/ms_upper.cpp -> osmo-trx_1.5.0.47.5829.tar.xz/Transceiver52M/ms/ms_upper.cpp
Changed
@@ -27,6 +27,8 @@ #include <radioInterface.h> #include <grgsm_vitac/grgsm_vitac.h> +// #define TXDEBUG + extern "C" { #include "sch.h" @@ -66,29 +68,54 @@ { g_exit_flag = true; - if (thr_control.joinable()) - thr_control.join(); - if (thr_rx.joinable()) - thr_rx.join(); - if (thr_tx.joinable()) - thr_tx.join(); + pthread_join(thr_control, NULL); + pthread_join(thr_tx, NULL); } + void upper_trx::start_threads() { - thr_control = std::thread(this { - set_name_aff_sched(sched_params::thread_names::U_CTL); - while (!g_exit_flag) { - driveControl(); - } - std::cerr << "exit U control!" << std::endl; - }); - thr_tx = std::thread(this { - set_name_aff_sched(sched_params::thread_names::U_TX); - while (!g_exit_flag) { - driveTx(); - } - std::cerr << "exit U tx!" << std::endl; - }); + DBGLG(...) << "spawning threads.." << std::endl; + + thr_control = spawn_worker_thread( + sched_params::thread_names::U_CTL, + (void *args) -> void * { + upper_trx *t = reinterpret_cast<upper_trx *>(args); +#ifdef TXDEBUG + struct sched_param param; + int policy; + pthread_getschedparam(pthread_self(), &policy, ¶m); + printf("ID: %lu, CPU: %d policy = %d priority = %d\n", pthread_self(), sched_getcpu(), policy, + param.sched_priority); +#endif + std::cerr << "started U control!" << std::endl; + while (!g_exit_flag) { + t->driveControl(); + } + std::cerr << "exit U control!" << std::endl; + + return 0; + }, + this); + thr_tx = spawn_worker_thread( + sched_params::thread_names::U_TX, + (void *args) -> void * { + upper_trx *t = reinterpret_cast<upper_trx *>(args); +#ifdef TXDEBUG + struct sched_param param; + int policy; + pthread_getschedparam(pthread_self(), &policy, ¶m); + printf("ID: %lu, CPU: %d policy = %d priority = %d\n", pthread_self(), sched_getcpu(), policy, + param.sched_priority); +#endif + std::cerr << "started U tx!" << std::endl; + while (!g_exit_flag) { + t->driveTx(); + } + std::cerr << "exit U tx!" << std::endl; + + return 0; + }, + this); #ifdef LSANDEBUG std::thread(this { @@ -251,7 +278,7 @@ internal_q_tx_buf *burst = &e; -#ifdef TXDEBUG +#ifdef TXDEBUG2 DBGLG() << "got burst!" << burst->r.fn << ":" << burst->ts << " current: " << timekeeper.gsmtime().FN() << " dff: " << (int64_t)((int64_t)timekeeper.gsmtime().FN() - (int64_t)burst->r.fn) << std::endl; #endif @@ -270,7 +297,7 @@ // float -> int16 blade_sample_type burst_buftxburst->size(); convert_and_scale(burst_buf, txburst->begin(), txburst->size() * 2, 1); -#ifdef TXDEBUG +#ifdef TXDEBUG2 auto check = signalVector(txburst->size(), 40); convert_and_scale(check.begin(), burst_buf, txburst->size() * 2, 1); estim_burst_params ebp; @@ -313,7 +340,7 @@ static void print_cmd(trxcon_phyif_cmd_type c) { - DBGLG() << cmd2str(c) << std::endl; + DBGLG() << "handling " << cmd2str(c) << std::endl; } #endif @@ -323,6 +350,8 @@ trxcon_phyif_cmd cmd; while (!cmdq_to_phy.spsc_pop(&cmd)) { cmdq_to_phy.spsc_prep_pop(); + if (g_exit_flag) + return false; } if (g_exit_flag)
View file
osmo-trx_1.5.0.45.287a.tar.xz/Transceiver52M/ms/ms_upper.h -> osmo-trx_1.5.0.47.5829.tar.xz/Transceiver52M/ms/ms_upper.h
Changed
@@ -27,22 +27,22 @@ #include "ms.h" class upper_trx : public ms_trx { - bool mOn; + volatile bool mOn; char demodded_softbits444; // void driveControl(); - bool driveControl(); - void driveReceiveFIFO(); - void driveTx(); - bool pullRadioVector(GSM::Time &wTime, int &RSSI, int &timingOffset); - std::thread thr_control, thr_rx, thr_tx; + pthread_t thr_control, thr_tx; public: void start_threads(); void main_loop(); void stop_upper_threads(); - upper_trx(){}; + bool driveControl(); + void driveReceiveFIFO(); + void driveTx(); + + upper_trx() : mOn(false){}; };
View file
osmo-trx_1.5.0.45.287a.tar.xz/Transceiver52M/ms/threadpool.h -> osmo-trx_1.5.0.47.5829.tar.xz/Transceiver52M/ms/threadpool.h
Changed
@@ -45,7 +45,7 @@ return; } - single_thread_pool() : worker_thread(std::thread(this { thread_loop(); })) + single_thread_pool() : stop_flag(false), is_ready(false), worker_thread(std::thread(this { thread_loop(); })) { } ~single_thread_pool()
View file
osmo-trx_1.5.0.45.287a.tar.xz/debian/changelog -> osmo-trx_1.5.0.47.5829.tar.xz/debian/changelog
Changed
@@ -1,8 +1,8 @@ -osmo-trx (1.5.0.45.287a) unstable; urgency=medium +osmo-trx (1.5.0.47.5829) unstable; urgency=medium * Automatically generated changelog entry for building the Osmocom master feed - -- Osmocom OBS scripts <info@osmocom.org> Wed, 30 Aug 2023 10:42:54 +0000 + -- Osmocom OBS scripts <info@osmocom.org> Thu, 31 Aug 2023 15:35:55 +0000 osmo-trx (1.5.0) unstable; urgency=medium
View file
osmo-trx_1.5.0.45.287a.tar.xz/osmocom-bb/include/l1ctl_proto.h -> osmo-trx_1.5.0.47.5829.tar.xz/osmocom-bb/include/l1ctl_proto.h
Changed
@@ -350,6 +350,7 @@ uint8_t tbf_ref; uint8_t slotmask; uint8_t padding2; + uint32_t start_fn; /* TBF Starting Time (absolute Fn) */ } __attribute__((packed)); /* payload of L1CTL_GPRS_DL_TBF_CFG_REQ */ @@ -358,6 +359,7 @@ uint8_t slotmask; uint8_t dl_tfi; uint8_t padding1; + uint32_t start_fn; /* TBF Starting Time (absolute Fn) */ } __attribute__((packed)); /* part of L1CTL_GPRS_{UL,DL}_BLOCK_{REQ,IND} */
View file
osmo-trx_1.5.0.45.287a.tar.xz/osmocom-bb/include/l1gprs.h -> osmo-trx_1.5.0.47.5829.tar.xz/osmocom-bb/include/l1gprs.h
Changed
@@ -2,6 +2,7 @@ #include <stdint.h> #include <stdbool.h> +#include <stddef.h> #include <osmocom/core/linuxlist.h> @@ -34,6 +35,14 @@ uint32_t dl_tfi_mask; }; +static inline size_t l1gprs_pdch_use_count(const struct l1gprs_pdch *pdch) +{ + return pdch->ul_tbf_count + pdch->dl_tbf_count; +} + + +typedef void (*l1gprs_pdch_changed_t)(struct l1gprs_pdch *pdch, bool active); + struct l1gprs_state { /*! PDCH state for each timeslot */ struct l1gprs_pdch pdch8; @@ -43,11 +52,14 @@ char *log_prefix; /*! Some private data for API user */ void *priv; + /*! Callback triggered to signal lower layers when a PDCH TS has to be activated/deactivated */ + l1gprs_pdch_changed_t pdch_changed_cb; }; void l1gprs_logging_init(int logc); struct l1gprs_state *l1gprs_state_alloc(void *ctx, const char *log_prefix, void *priv); void l1gprs_state_free(struct l1gprs_state *gprs); +void l1gprs_state_set_pdch_changed_cb(struct l1gprs_state *gprs, l1gprs_pdch_changed_t pdch_changed_cb); int l1gprs_handle_ul_tbf_cfg_req(struct l1gprs_state *gprs, const struct msgb *msg); int l1gprs_handle_dl_tbf_cfg_req(struct l1gprs_state *gprs, const struct msgb *msg);
View file
osmo-trx_1.5.0.45.287a.tar.xz/osmocom-bb/src/host/layer23/include/osmocom/bb/common/apn.h -> osmo-trx_1.5.0.47.5829.tar.xz/osmocom-bb/src/host/layer23/include/osmocom/bb/common/apn.h
Changed
@@ -38,6 +38,9 @@ uint8_t qos_len; uint8_t pcoOSMO_GPRS_SM_PCO_MAXLEN; uint8_t pco_len; + enum osmo_gprs_sm_pdp_addr_ietf_type pdp_addr_ietf_type; + struct osmo_sockaddr pdp_addr_v4; + struct osmo_sockaddr pdp_addr_v6; }; struct osmobb_apn {
View file
osmo-trx_1.5.0.45.287a.tar.xz/osmocom-bb/src/host/layer23/include/osmocom/bb/common/l1ctl.h -> osmo-trx_1.5.0.47.5829.tar.xz/osmocom-bb/src/host/layer23/include/osmocom/bb/common/l1ctl.h
Changed
@@ -81,10 +81,11 @@ /* Transmit L1CTL_GPRS_UL_TBF_CFG_REQ */ int l1ctl_tx_gprs_ul_tbf_cfg_req(struct osmocom_ms *ms, uint8_t tbf_ref, - uint8_t slotmask); + uint8_t slotmask, uint32_t start_fn); /* Transmit L1CTL_GPRS_DL_TBF_CFG_REQ */ int l1ctl_tx_gprs_dl_tbf_cfg_req(struct osmocom_ms *ms, uint8_t tbf_ref, - uint8_t slotmask, uint8_t dl_tfi); + uint8_t slotmask, uint32_t start_fn, + uint8_t dl_tfi); #endif
View file
osmo-trx_1.5.0.45.287a.tar.xz/osmocom-bb/src/host/layer23/src/common/l1ctl.c -> osmo-trx_1.5.0.47.5829.tar.xz/osmocom-bb/src/host/layer23/src/common/l1ctl.c
Changed
@@ -317,6 +317,7 @@ PRIM_OP_INDICATION, msg); pp.u.data.chan_nr = dl->chan_nr; pp.u.data.link_id = dl->link_id; + pp.u.data.fn = tm.fn; /* send it up into LAPDm */ return lapdm_phsap_up(&pp.oph, le); @@ -1010,7 +1011,7 @@ /* Transmit L1CTL_GPRS_UL_TBF_CFG_REQ */ int l1ctl_tx_gprs_ul_tbf_cfg_req(struct osmocom_ms *ms, uint8_t tbf_ref, - uint8_t slotmask) + uint8_t slotmask, uint32_t start_fn) { struct l1ctl_gprs_ul_tbf_cfg_req *req; struct msgb *msg; @@ -1023,17 +1024,20 @@ *req = (struct l1ctl_gprs_ul_tbf_cfg_req) { .tbf_ref = tbf_ref, .slotmask = slotmask, + .start_fn = htonl(start_fn), }; - DEBUGP(DL1C, "Tx GPRS UL TBF CFG (tbf_ref=%u, slotmask=0x%02x)\n", - tbf_ref, slotmask); + DEBUGP(DL1C, "Tx GPRS UL TBF CFG: " + "tbf_ref=%u, slotmask=0x%02x, start_fn=%u\n", + tbf_ref, slotmask, start_fn); return osmo_send_l1(ms, msg); } /* Transmit L1CTL_GPRS_DL_TBF_CFG_REQ */ int l1ctl_tx_gprs_dl_tbf_cfg_req(struct osmocom_ms *ms, uint8_t tbf_ref, - uint8_t slotmask, uint8_t dl_tfi) + uint8_t slotmask, uint32_t start_fn, + uint8_t dl_tfi) { struct l1ctl_gprs_dl_tbf_cfg_req *req; struct msgb *msg; @@ -1046,11 +1050,13 @@ *req = (struct l1ctl_gprs_dl_tbf_cfg_req) { .tbf_ref = tbf_ref, .slotmask = slotmask, + .start_fn = htonl(start_fn), .dl_tfi = dl_tfi, }; - DEBUGP(DL1C, "Tx GPRS DL TBF CFG (tbf_ref=%u, slotmask=0x%02x, dl_tfi=%u)\n", - tbf_ref, slotmask, dl_tfi); + DEBUGP(DL1C, "Tx GPRS DL TBF CFG: " + "tbf_ref=%u, slotmask=0x%02x, start_fn=%u, dl_tfi=%u)\n", + tbf_ref, slotmask, start_fn, dl_tfi); return osmo_send_l1(ms, msg); }
View file
osmo-trx_1.5.0.45.287a.tar.xz/osmocom-bb/src/host/layer23/src/common/vty.c -> osmo-trx_1.5.0.47.5829.tar.xz/osmocom-bb/src/host/layer23/src/common/vty.c
Changed
@@ -819,7 +819,8 @@ OSMO_STRLCPY_ARRAY(set->imei, argv0); OSMO_STRLCPY_ARRAY(set->imeisv, argv0); - OSMO_STRLCPY_ARRAY(set->imeisv + 15, sv); + osmo_strlcpy(set->imeisv + GSM23003_IMEI_NUM_DIGITS, sv, + sizeof(set->imeisv) - GSM23003_IMEI_NUM_DIGITS); return CMD_SUCCESS; }
View file
osmo-trx_1.5.0.45.287a.tar.xz/osmocom-bb/src/host/layer23/src/modem/app_modem.c -> osmo-trx_1.5.0.47.5829.tar.xz/osmocom-bb/src/host/layer23/src/modem/app_modem.c
Changed
@@ -121,6 +121,28 @@ LOGPAPN(LOGL_DEBUG, apn, "system wants to transmit IPv%c pkt to %s (%zu bytes)\n", iph->version == 4 ? '4' : '6', osmo_sockaddr_ntop(&dst.u.sa, addrstr), pkt_len); + switch (apn->pdp.pdp_addr_ietf_type) { + case OSMO_GPRS_SM_PDP_ADDR_IETF_IPV4: + if (iph->version != 4) { + LOGPAPN(LOGL_NOTICE, apn, + "system wants to transmit IPv%u pkt to %s (%zu bytes) on IPv4-only PDP Ctx, discarding!\n", + iph->version, osmo_sockaddr_ntop(&dst.u.sa, addrstr), pkt_len); + goto free_ret; + } + break; + case OSMO_GPRS_SM_PDP_ADDR_IETF_IPV6: + if (iph->version != 6) { + LOGPAPN(LOGL_NOTICE, apn, + "system wants to transmit IPv%u pkt to %s (%zu bytes) on IPv6-only PDP Ctx, discarding!\n", + iph->version, osmo_sockaddr_ntop(&dst.u.sa, addrstr), pkt_len); + goto free_ret; + } + break; + default: /* OSMO_GPRS_SM_PDP_ADDR_IETF_IPV4V6 */ + /* Allow any */ + break; + } + rc = modem_sndcp_sn_unitdata_req(apn, msgb_data(msg), pkt_len); free_ret:
View file
osmo-trx_1.5.0.45.287a.tar.xz/osmocom-bb/src/host/layer23/src/modem/gmm.c -> osmo-trx_1.5.0.47.5829.tar.xz/osmocom-bb/src/host/layer23/src/modem/gmm.c
Changed
@@ -60,8 +60,9 @@ switch (OSMO_PRIM_HDR(&gmm_prim->oph)) { case OSMO_PRIM(OSMO_GPRS_GMM_GMMREG_ATTACH, PRIM_OP_CONFIRM): if (gmm_prim->gmmreg.attach_cnf.accepted) { - LOGP(DGMM, LOGL_NOTICE, "%s(): Rx %s: Attach success P-TMSI=0x%08x\n", - __func__, pdu_name, gmm_prim->gmmreg.attach_cnf.acc.allocated_ptmsi); + LOGP(DGMM, LOGL_NOTICE, "%s(): Rx %s: Attach success P-TMSI=0x%08x TLLI=0x%08x\n", + __func__, pdu_name, gmm_prim->gmmreg.attach_cnf.acc.allocated_ptmsi, + gmm_prim->gmmreg.attach_cnf.acc.allocated_tlli); ms->subscr.gprs.ptmsi = gmm_prim->gmmreg.attach_cnf.acc.allocated_ptmsi; ms->gmmlayer.tlli = gmm_prim->gmmreg.attach_cnf.acc.allocated_tlli; app_data.modem_state = MODEM_ST_ATTACHED; @@ -161,7 +162,7 @@ } } else { if (old_tlli != OSMO_GPRS_GMM_TLLI_UNASSIGNED) - LOGP(DGMM, LOGL_ERROR, "%s(): Unexpected Rx %s with unknown TLLI=0x%08xn", + LOGP(DGMM, LOGL_NOTICE, "%s(): Rx %s with unknown TLLI=0x%08x, probably the MS is still attaching\n", __func__, pdu_name, old_tlli); }
View file
osmo-trx_1.5.0.45.287a.tar.xz/osmocom-bb/src/host/layer23/src/modem/grr.c -> osmo-trx_1.5.0.47.5829.tar.xz/osmocom-bb/src/host/layer23/src/modem/grr.c
Changed
@@ -661,7 +661,8 @@ const struct osmo_gprs_rlcmac_l1ctl_prim *lp = data; l1ctl_tx_gprs_ul_tbf_cfg_req(ms, lp->cfg_ul_tbf_req.ul_tbf_nr, - lp->cfg_ul_tbf_req.ul_slotmask); + lp->cfg_ul_tbf_req.ul_slotmask, + 0xffffffff /* TODO: start Fn */); break; } case GRR_EV_PDCH_DL_TBF_CFG_REQ: @@ -670,6 +671,7 @@ l1ctl_tx_gprs_dl_tbf_cfg_req(ms, lp->cfg_dl_tbf_req.dl_tbf_nr, lp->cfg_dl_tbf_req.dl_slotmask, + 0xffffffff, /* TODO: start Fn */ lp->cfg_dl_tbf_req.dl_tfi); break; }
View file
osmo-trx_1.5.0.45.287a.tar.xz/osmocom-bb/src/host/layer23/src/modem/sm.c -> osmo-trx_1.5.0.47.5829.tar.xz/osmocom-bb/src/host/layer23/src/modem/sm.c
Changed
@@ -79,11 +79,14 @@ ms->subscr.gprs.ptmsi = sm_prim->smreg.pdp_act_cnf.acc.gmm.allocated_ptmsi; ms->gmmlayer.tlli = sm_prim->smreg.pdp_act_cnf.acc.gmm.allocated_tlli; + apn->pdp.pdp_addr_ietf_type = sm_prim->smreg.pdp_act_cnf.acc.pdp_addr_ietf_type; + netdev = osmo_tundev_get_netdev(apn->tun); switch (sm_prim->smreg.pdp_act_cnf.acc.pdp_addr_ietf_type) { case OSMO_GPRS_SM_PDP_ADDR_IETF_IPV4: LOGPAPN(LOGL_INFO, apn, "Rx %s: IPv4=%s\n", pdu_name, osmo_sockaddr_ntop(&sm_prim->smreg.pdp_act_cnf.acc.pdp_addr_v4.u.sa, buf_addr)); + memcpy(&apn->pdp.pdp_addr_v4, &sm_prim->smreg.pdp_act_cnf.acc.pdp_addr_v4, sizeof(struct osmo_sockaddr)); rc = osmo_netdev_add_addr(netdev, &sm_prim->smreg.pdp_act_cnf.acc.pdp_addr_v4, 30); if (rc < 0) { LOGPAPN(LOGL_ERROR, apn, "Rx %s: Failed setting IPv4=%s\n", pdu_name, @@ -94,6 +97,7 @@ case OSMO_GPRS_SM_PDP_ADDR_IETF_IPV6: LOGPAPN(LOGL_INFO, apn, "Rx %s: IPv6=%s FIXME: IPv6 not yet supported!\n", pdu_name, osmo_sockaddr_ntop(&sm_prim->smreg.pdp_act_cnf.acc.pdp_addr_v6.u.sa, buf_addr)); + memcpy(&apn->pdp.pdp_addr_v6, &sm_prim->smreg.pdp_act_cnf.acc.pdp_addr_v6, sizeof(struct osmo_sockaddr)); rc = osmo_netdev_add_addr(netdev, &sm_prim->smreg.pdp_act_cnf.acc.pdp_addr_v6, 64); if (rc < 0) { LOGPAPN(LOGL_ERROR, apn, "Rx %s: Failed setting IPv6=%s\n", pdu_name, @@ -105,6 +109,8 @@ LOGPAPN(LOGL_INFO, apn, "Rx %s: IPv4=%s IPv6=%s FIXME: IPv6 not yet supported!\n", pdu_name, osmo_sockaddr_ntop(&sm_prim->smreg.pdp_act_cnf.acc.pdp_addr_v4.u.sa, buf_addr), osmo_sockaddr_ntop(&sm_prim->smreg.pdp_act_cnf.acc.pdp_addr_v6.u.sa, buf_addr2)); + memcpy(&apn->pdp.pdp_addr_v4, &sm_prim->smreg.pdp_act_cnf.acc.pdp_addr_v4, sizeof(struct osmo_sockaddr)); + memcpy(&apn->pdp.pdp_addr_v6, &sm_prim->smreg.pdp_act_cnf.acc.pdp_addr_v6, sizeof(struct osmo_sockaddr)); rc = osmo_netdev_add_addr(netdev, &sm_prim->smreg.pdp_act_cnf.acc.pdp_addr_v4, 30); if (rc < 0) { LOGPAPN(LOGL_ERROR, apn, "Rx %s: Failed setting IPv4=%s\n", pdu_name,
View file
osmo-trx_1.5.0.45.287a.tar.xz/osmocom-bb/src/host/trxcon/src/trxcon_fsm.c -> osmo-trx_1.5.0.47.5829.tar.xz/osmocom-bb/src/host/trxcon/src/trxcon_fsm.c
Changed
@@ -517,6 +517,30 @@ } } +static void handle_tbf_cfg_req(struct trxcon_inst *trxcon, uint8_t tn, bool active) +{ + struct l1sched_state *sched = trxcon->sched; + + if (active) { + if (sched->tstn != NULL) /* already enabled */ + return; + if (l1sched_configure_ts(sched, tn, GSM_PCHAN_PDCH) != 0) + return; + OSMO_ASSERT(sched->tstn != NULL); + + l1sched_activate_lchan(sched->tstn, L1SCHED_PDTCH); + l1sched_activate_lchan(sched->tstn, L1SCHED_PTCCH); + /* FIXME: set TSC for both lchans */ + } else { + l1sched_del_ts(sched, tn); + } +} + +static void trxcon_l1gprs_state_changed_cb(struct l1gprs_pdch *pdch, bool active) +{ + handle_tbf_cfg_req(pdch->gprs->priv, pdch->tn, active); +} + static void trxcon_st_packet_data_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) { @@ -524,6 +548,7 @@ OSMO_ASSERT(trxcon->gprs == NULL); trxcon->gprs = l1gprs_state_alloc(trxcon, trxcon->log_prefix, trxcon); + l1gprs_state_set_pdch_changed_cb(trxcon->gprs, trxcon_l1gprs_state_changed_cb); OSMO_ASSERT(trxcon->gprs != NULL); }
View file
osmo-trx_1.5.0.45.287a.tar.xz/osmocom-bb/src/shared/l1gprs.c -> osmo-trx_1.5.0.47.5829.tar.xz/osmocom-bb/src/shared/l1gprs.c
Changed
@@ -118,6 +118,12 @@ LOGP_PDCH(pdch, LOGL_DEBUG, "Linked " LOG_TBF_FMT "\n", LOG_TBF_ARGS(tbf)); + + /* If just got first use: */ + if (l1gprs_pdch_use_count(pdch) == 1) { + if (gprs->pdch_changed_cb) + gprs->pdch_changed_cb(pdch, true); + } } llist_add_tail(&tbf->list, &gprs->tbf_list); @@ -127,19 +133,67 @@ LOG_TBF_ARGS(tbf)); } -static void l1gprs_unregister_tbf(struct l1gprs_state *gprs, - bool uplink, uint8_t tbf_ref) +static void l1gprs_update_tbf(struct l1gprs_state *gprs, struct l1gprs_tbf *tbf, uint8_t slotmask) { - struct l1gprs_tbf *tbf; + OSMO_ASSERT(tbf->slotmask != 0x00); + OSMO_ASSERT(slotmask != 0x00); - tbf = l1gprs_find_tbf(gprs, uplink, tbf_ref); - if (tbf == NULL) { - LOGP_GPRS(gprs, LOGL_ERROR, - "%s(): " LOG_TBF_FMT " not found\n", - __func__, uplink ? 'U' : 'D', tbf_ref); - return; + if (tbf->slotmask == slotmask) + return; /* No change at all, skip */ + + /* Update the PDCH states */ + for (unsigned int tn = 0; tn < ARRAY_SIZE(gprs->pdch); tn++) { + struct l1gprs_pdch *pdch = &gprs->pdchtn; + + if ((tbf->slotmask & (1 << tn)) == (slotmask & (1 << tn))) + continue; /* No change, skip */ + + if (tbf->slotmask & (1 << tn)) { + /* slot previously set, remove it */ + if (tbf->uplink) { + OSMO_ASSERT(pdch->ul_tbf_count > 0); + pdch->ul_tbf_count--; + } else { + OSMO_ASSERT(pdch->dl_tbf_count > 0); + pdch->dl_tbf_count--; + pdch->dl_tfi_mask &= ~(1 << tbf->dl_tfi); + } + LOGP_PDCH(pdch, LOGL_DEBUG, "Unlinked " LOG_TBF_FMT "\n", + LOG_TBF_ARGS(tbf)); + /* If not more in use: */ + if (l1gprs_pdch_use_count(pdch) == 0) { + if (gprs->pdch_changed_cb) + gprs->pdch_changed_cb(pdch, false); + } + } else { + /* Slot was not set, add it */ + if (tbf->uplink) { + pdch->ul_tbf_count++; + } else { + pdch->dl_tbf_count++; + pdch->dl_tfi_mask |= (1 << tbf->dl_tfi); + } + LOGP_PDCH(pdch, LOGL_DEBUG, "Linked " LOG_TBF_FMT "\n", + LOG_TBF_ARGS(tbf)); + /* If just got first use: */ + if (l1gprs_pdch_use_count(pdch) == 1) { + if (gprs->pdch_changed_cb) + gprs->pdch_changed_cb(pdch, true); + } + } } + LOGP_GPRS(gprs, LOGL_INFO, + LOG_TBF_FMT " slotmask updated 0x%02x -> 0x%02x\n", + LOG_TBF_ARGS(tbf), tbf->slotmask, slotmask); + + tbf->slotmask = slotmask; +} + +static void l1gprs_unregister_tbf(struct l1gprs_state *gprs, struct l1gprs_tbf *tbf) +{ + OSMO_ASSERT(tbf->slotmask != 0x00); + /* Update the PDCH states */ for (unsigned int tn = 0; tn < ARRAY_SIZE(gprs->pdch); tn++) { struct l1gprs_pdch *pdch = &gprs->pdchtn; @@ -159,6 +213,12 @@ LOGP_PDCH(pdch, LOGL_DEBUG, "Unlinked " LOG_TBF_FMT "\n", LOG_TBF_ARGS(tbf)); + + /* If not more in use: */ + if (l1gprs_pdch_use_count(pdch) == 0) { + if (gprs->pdch_changed_cb) + gprs->pdch_changed_cb(pdch, false); + } } LOGP_GPRS(gprs, LOGL_INFO, @@ -271,6 +331,11 @@ talloc_free(gprs); } +void l1gprs_state_set_pdch_changed_cb(struct l1gprs_state *gprs, l1gprs_pdch_changed_t pdch_changed_cb) +{ + gprs->pdch_changed_cb = pdch_changed_cb; +} + int l1gprs_handle_ul_tbf_cfg_req(struct l1gprs_state *gprs, const struct msgb *msg) { const struct l1ctl_gprs_ul_tbf_cfg_req *req = (void *)msg->l1h; @@ -289,11 +354,22 @@ "Rx Uplink TBF config: tbf_ref=%u, slotmask=0x%02x\n", req->tbf_ref, req->slotmask); + tbf = l1gprs_find_tbf(gprs, true, req->tbf_ref); + if (req->slotmask != 0x00) { - tbf = l1gprs_tbf_alloc(gprs, true, req->tbf_ref, req->slotmask); - l1gprs_register_tbf(gprs, tbf); + if (tbf) { + l1gprs_update_tbf(gprs, tbf, req->slotmask); + } else { + tbf = l1gprs_tbf_alloc(gprs, true, req->tbf_ref, req->slotmask); + l1gprs_register_tbf(gprs, tbf); + } } else { - l1gprs_unregister_tbf(gprs, true, req->tbf_ref); + if (tbf == NULL) { + LOGP_GPRS(gprs, LOGL_ERROR, "%s(): " LOG_TBF_FMT " not found\n", + __func__, 'U', req->tbf_ref); + return -ENOENT; + } + l1gprs_unregister_tbf(gprs, tbf); } return 0; @@ -324,12 +400,23 @@ return -EINVAL; } + tbf = l1gprs_find_tbf(gprs, false, req->tbf_ref); + if (req->slotmask != 0x00) { - tbf = l1gprs_tbf_alloc(gprs, false, req->tbf_ref, req->slotmask); - tbf->dl_tfi = req->dl_tfi; - l1gprs_register_tbf(gprs, tbf); + if (tbf) { + l1gprs_update_tbf(gprs, tbf, req->slotmask); + } else { + tbf = l1gprs_tbf_alloc(gprs, false, req->tbf_ref, req->slotmask); + tbf->dl_tfi = req->dl_tfi; + l1gprs_register_tbf(gprs, tbf); + } } else { - l1gprs_unregister_tbf(gprs, false, req->tbf_ref); + if (tbf == NULL) { + LOGP_GPRS(gprs, LOGL_ERROR, "%s(): " LOG_TBF_FMT " not found\n", + __func__, 'D', req->tbf_ref); + return -ENOENT; + } + l1gprs_unregister_tbf(gprs, tbf); } return 0;
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.