Projects
osmocom:master
osmo-pcu
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 124
View file
osmo-pcu.spec
Changed
@@ -14,13 +14,13 @@ Name: osmo-pcu Requires: osmocom-master -Version: 1.2.0.148.06b5 +Version: 1.2.0.150.35a7 Release: 0 Summary: Osmocom GPRS Packet Control Unit (PCU) License: GPL-2.0-only Group: Productivity/Telephony/Servers URL: https://osmocom.org/projects/osmopcu -Source: osmo-pcu_1.2.0.148.06b5.tar.xz +Source: osmo-pcu_1.2.0.150.35a7.tar.xz Source1: rpmlintrc BuildRequires: autoconf BuildRequires: automake
View file
commit_06b50c57a1cc1cdc531b3d136257680484d9e39e.txt
Deleted
View file
commit_35a782465812b03ec3f0cfbfb4a97861325f06fb.txt
Added
View file
osmo-pcu_1.2.0.148.06b5.dsc
Deleted
@@ -1,21 +0,0 @@ -Format: 3.0 (native) -Source: osmo-pcu -Binary: osmo-pcu, osmo-pcu-dbg, osmo-pcu-doc -Architecture: any all -Version: 1.2.0.148.06b5 -Maintainer: Osmocom team <openbsc@lists.osmocom.org> -Homepage: http://osmocom.org/projects/osmopcu -Standards-Version: 3.9.8 -Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-pcu -Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-pcu -Build-Depends: debhelper (>= 10), dh-autoreconf, autotools-dev, pkg-config, libosmo-abis-dev (>= 1.4.0), libosmocore-dev (>= 1.8.0), osmo-gsm-manuals-dev (>= 1.4.0) -Package-List: - osmo-pcu deb net optional arch=any - osmo-pcu-dbg deb debug extra arch=any - osmo-pcu-doc deb doc optional arch=all -Checksums-Sha1: - daca250898ef5fd55b22f7f9a916a60d606d9bf5 424828 osmo-pcu_1.2.0.148.06b5.tar.xz -Checksums-Sha256: - 0a3f2a8aad0935a4775957aca53b30be39c4b840e1031660bcc84962caea8dba 424828 osmo-pcu_1.2.0.148.06b5.tar.xz -Files: - 11e97419daa6525eb22b6f84b6070289 424828 osmo-pcu_1.2.0.148.06b5.tar.xz
View file
osmo-pcu_1.2.0.148.06b5.tar.xz/src/osmobts_sock.c
Deleted
@@ -1,259 +0,0 @@ -/* osmobts_sock.cpp - * - * Copyright (C) 2012 Andreas Eversberg <jolly@eversberg.eu> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> -#include <assert.h> -#include <sys/socket.h> -#include <sys/un.h> - -#include <osmocom/core/select.h> -#include <osmocom/core/msgb.h> -#include <osmocom/core/linuxlist.h> -#include <osmocom/core/logging.h> -#include <osmocom/core/timer.h> - - -#include <pcu_l1_if.h> -#include <pcu_l1_if_phy.h> -#include <gprs_debug.h> -#include <gprs_bssgp_pcu.h> -#include <osmocom/pcu/pcuif_proto.h> -#include <bts.h> -#include <tbf.h> -#include <pdch.h> - -/* - * osmo-bts PCU socket functions - */ - -static struct { - struct osmo_fd conn_bfd; /* fd for connection to the BTS */ - struct osmo_timer_list timer; /* socket connect retry timer */ - struct llist_head upqueue; /* queue for sending messages */ -} pcu_sock_state; - -static void pcu_sock_timeout(void *_priv) -{ - pcu_l1if_open(); -} - -static void pcu_tx_txt_retry(void *_priv) -{ - struct gprs_rlcmac_bts *bts; - bool retry = llist_empty(&the_pcu->bts_list); - - llist_for_each_entry(bts, &the_pcu->bts_list, list) { - if (bts->active) - continue; - retry = true; - pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION); - break; - } - - /* If no BTS (or not all) yet active, retry */ - if (retry) - osmo_timer_schedule(&pcu_sock_state.timer, 5, 0); -} - -int pcu_sock_send(struct msgb *msg) -{ - struct osmo_fd *conn_bfd; - - conn_bfd = &pcu_sock_state.conn_bfd; - if (conn_bfd->fd <= 0) { - LOGP(DL1IF, LOGL_NOTICE, "PCU socket not connected, dropping " - "message\n"); - return -EIO; - } - msgb_enqueue(&pcu_sock_state.upqueue, msg); - osmo_fd_write_enable(conn_bfd); - - return 0; -} - -static void pcu_sock_close(int lost) -{ - struct osmo_fd *bfd = &pcu_sock_state.conn_bfd; - struct gprs_rlcmac_bts *bts; - uint8_t trx, ts; - - LOGP(DL1IF, LOGL_NOTICE, "PCU socket has %s connection\n", - (lost) ? "LOST" : "closed"); - - osmo_fd_unregister(bfd); - close(bfd->fd); - bfd->fd = -1; - - /* flush the queue */ - while (!llist_empty(&pcu_sock_state.upqueue)) { - struct msgb *msg = msgb_dequeue(&pcu_sock_state.upqueue); - msgb_free(msg); - } - - llist_for_each_entry(bts, &the_pcu->bts_list, list) { - /* disable all slots, kick all TBFs */ - for (trx = 0; trx < 8; trx++) { -#ifdef ENABLE_DIRECT_PHY - if (bts->trxtrx.fl1h) { - l1if_close_trx(bts->trxtrx.fl1h); - bts->trxtrx.fl1h = NULL; - } -#endif - for (ts = 0; ts < 8; ts++) - if (pdch_is_enabled(&bts->trxtrx.pdchts)) - pdch_disable(&bts->trxtrx.pdchts); - /* FIXME: NOT ALL RESOURCES are freed in this case... inconsistent with the other code. Share the code with pcu_l1if.c - for the reset. */ - bts_trx_free_all_tbf(&bts->trxtrx); - } - gprs_bssgp_destroy(bts); - } - exit(0); -} - -static int pcu_sock_read(struct osmo_fd *bfd) -{ - const size_t max_len = sizeof(struct gsm_pcu_if) + 1000; - uint8_t *buf = alloca(max_len); - struct gsm_pcu_if *pcu_prim = (struct gsm_pcu_if *)buf; - int rc; - - rc = recv(bfd->fd, buf, max_len, 0); - if (rc < 0 && errno == EAGAIN) - return 0; /* Try again later */ - if (rc <= 0) { - LOGP(DL1IF, LOGL_ERROR, "%s: recv() failed with rc=%d errno=%d\n", __func__, rc, errno); - pcu_sock_close(1); - return -EIO; - } - - if (rc < PCUIF_HDR_SIZE) { - LOGP(DL1IF, LOGL_ERROR, "Received %d bytes on PCU Socket, but primitive " - "hdr size is %zu, discarding\n", rc, PCUIF_HDR_SIZE); - return -EINVAL; - } - - return pcu_rx(pcu_prim, rc); -} - -static int pcu_sock_write(struct osmo_fd *bfd) -{ - int rc; - - while (!llist_empty(&pcu_sock_state.upqueue)) { - struct msgb *msg, *msg2; - struct gsm_pcu_if *pcu_prim; - - /* peek at the beginning of the queue */ - msg = llist_entry(pcu_sock_state.upqueue.next, struct msgb, list); - pcu_prim = (struct gsm_pcu_if *)msg->data; - - osmo_fd_write_disable(bfd); - - /* bug hunter 8-): maybe someone forgot msgb_put(...) ? */ - if (!msgb_length(msg)) { - LOGP(DL1IF, LOGL_ERROR, "message type (%d) with ZERO " - "bytes!\n", pcu_prim->msg_type); - goto dontsend; - } - - /* try to send it over the socket */ - rc = write(bfd->fd, msgb_data(msg), msgb_length(msg)); - if (rc == 0) - goto close; - if (rc < 0) { - if (errno == EAGAIN) { - osmo_fd_write_enable(bfd); - break; - } - goto close; - } - -dontsend: - /* _after_ we send it, we can deueue */ - msg2 = msgb_dequeue(&pcu_sock_state.upqueue); - assert(msg == msg2); - msgb_free(msg); - } - return 0; - -close: - pcu_sock_close(1); - - return -1; -} - -static int pcu_sock_cb(struct osmo_fd *bfd, unsigned int flags) -{ - int rc = 0; - - if (flags & OSMO_FD_READ) - rc = pcu_sock_read(bfd); - if (rc < 0) - return rc; - - if (flags & OSMO_FD_WRITE) - rc = pcu_sock_write(bfd); - - return rc; -} - -int pcu_l1if_open(void) -{ - int rc; - LOGP(DL1IF, LOGL_INFO, "Opening OsmoPCU L1 interface v%u to OsmoBTS\n", PCU_IF_VERSION); - - memset(&pcu_sock_state, 0x00, sizeof(pcu_sock_state)); - INIT_LLIST_HEAD(&pcu_sock_state.upqueue); - - rc = osmo_sock_unix_init_ofd(&pcu_sock_state.conn_bfd, SOCK_SEQPACKET, 0, - the_pcu->pcu_sock_path, OSMO_SOCK_F_CONNECT); - if (rc < 0) { - LOGP(DL1IF, LOGL_ERROR, "Failed to connect to the BTS (%s). " - "Retrying...\n", the_pcu->pcu_sock_path); - osmo_timer_setup(&pcu_sock_state.timer, pcu_sock_timeout, NULL); - osmo_timer_schedule(&pcu_sock_state.timer, 5, 0); - return 0; - } - - pcu_sock_state.conn_bfd.cb = pcu_sock_cb; - pcu_sock_state.conn_bfd.data = NULL; - - LOGP(DL1IF, LOGL_NOTICE, "osmo-bts PCU socket %s has been connected\n", - the_pcu->pcu_sock_path); - - pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION); - - /* Schedule a timer so we keep trying until the BTS becomes active. */ - osmo_timer_setup(&pcu_sock_state.timer, pcu_tx_txt_retry, NULL); - osmo_timer_schedule(&pcu_sock_state.timer, 5, 0); - - return 0; -} - -void pcu_l1if_close(void) -{ - struct osmo_fd *bfd; - - osmo_timer_del(&pcu_sock_state.timer); - - bfd = &pcu_sock_state.conn_bfd; - if (bfd->fd > 0) - pcu_sock_close(0); -}
View file
osmo-pcu_1.2.0.150.35a7.dsc
Added
@@ -0,0 +1,21 @@ +Format: 3.0 (native) +Source: osmo-pcu +Binary: osmo-pcu, osmo-pcu-dbg, osmo-pcu-doc +Architecture: any all +Version: 1.2.0.150.35a7 +Maintainer: Osmocom team <openbsc@lists.osmocom.org> +Homepage: http://osmocom.org/projects/osmopcu +Standards-Version: 3.9.8 +Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-pcu +Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-pcu +Build-Depends: debhelper (>= 10), dh-autoreconf, autotools-dev, pkg-config, libosmo-abis-dev (>= 1.4.0), libosmocore-dev (>= 1.8.0), osmo-gsm-manuals-dev (>= 1.4.0) +Package-List: + osmo-pcu deb net optional arch=any + osmo-pcu-dbg deb debug extra arch=any + osmo-pcu-doc deb doc optional arch=all +Checksums-Sha1: + cf56bf6ccd039e0939ef7b18b6bc4173767b2f27 426552 osmo-pcu_1.2.0.150.35a7.tar.xz +Checksums-Sha256: + 051c88b9720d28ca5524d8e39e15e16470684c40c4370b679afafd111d614b7f 426552 osmo-pcu_1.2.0.150.35a7.tar.xz +Files: + e06c159106ceebbdaaad553ae77fc037 426552 osmo-pcu_1.2.0.150.35a7.tar.xz
View file
osmo-pcu_1.2.0.148.06b5.tar.xz/.tarball-version -> osmo-pcu_1.2.0.150.35a7.tar.xz/.tarball-version
Changed
@@ -1 +1 @@ -1.2.0.148-06b5 +1.2.0.150-35a7
View file
osmo-pcu_1.2.0.148.06b5.tar.xz/debian/changelog -> osmo-pcu_1.2.0.150.35a7.tar.xz/debian/changelog
Changed
@@ -1,8 +1,8 @@ -osmo-pcu (1.2.0.148.06b5) unstable; urgency=medium +osmo-pcu (1.2.0.150.35a7) unstable; urgency=medium * Automatically generated changelog entry for building the Osmocom master feed - -- Osmocom OBS scripts <info@osmocom.org> Fri, 01 Sep 2023 09:41:34 +0000 + -- Osmocom OBS scripts <info@osmocom.org> Mon, 04 Sep 2023 20:25:49 +0000 osmo-pcu (1.2.0) unstable; urgency=medium
View file
osmo-pcu_1.2.0.148.06b5.tar.xz/src/Makefile.am -> osmo-pcu_1.2.0.150.35a7.tar.xz/src/Makefile.am
Changed
@@ -82,7 +82,7 @@ rlc_window.cpp \ rlc_window_dl.cpp \ rlc_window_ul.cpp \ - osmobts_sock.c \ + pcuif_sock.c \ gprs_codel.c \ coding_scheme.c \ egprs_rlc_compression.cpp \
View file
osmo-pcu_1.2.0.150.35a7.tar.xz/src/pcuif_sock.c
Added
@@ -0,0 +1,259 @@ +/* osmobts_sock.cpp + * + * Copyright (C) 2012 Andreas Eversberg <jolly@eversberg.eu> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <assert.h> +#include <sys/socket.h> +#include <sys/un.h> + +#include <osmocom/core/select.h> +#include <osmocom/core/msgb.h> +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/logging.h> +#include <osmocom/core/timer.h> + + +#include <pcu_l1_if.h> +#include <pcu_l1_if_phy.h> +#include <gprs_debug.h> +#include <gprs_bssgp_pcu.h> +#include <osmocom/pcu/pcuif_proto.h> +#include <bts.h> +#include <tbf.h> +#include <pdch.h> + +/* + * osmo-bts PCU socket functions + */ + +static struct { + struct osmo_fd conn_bfd; /* fd for connection to the BTS */ + struct osmo_timer_list timer; /* socket connect retry timer */ + struct llist_head upqueue; /* queue for sending messages */ +} pcu_sock_state; + +static void pcu_sock_timeout(void *_priv) +{ + pcu_l1if_open(); +} + +static void pcu_tx_txt_retry(void *_priv) +{ + struct gprs_rlcmac_bts *bts; + bool retry = llist_empty(&the_pcu->bts_list); + + llist_for_each_entry(bts, &the_pcu->bts_list, list) { + if (bts->active) + continue; + retry = true; + pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION); + break; + } + + /* If no BTS (or not all) yet active, retry */ + if (retry) + osmo_timer_schedule(&pcu_sock_state.timer, 5, 0); +} + +int pcu_sock_send(struct msgb *msg) +{ + struct osmo_fd *conn_bfd; + + conn_bfd = &pcu_sock_state.conn_bfd; + if (conn_bfd->fd <= 0) { + LOGP(DL1IF, LOGL_NOTICE, "PCU socket not connected, dropping " + "message\n"); + return -EIO; + } + msgb_enqueue(&pcu_sock_state.upqueue, msg); + osmo_fd_write_enable(conn_bfd); + + return 0; +} + +static void pcu_sock_close(int lost) +{ + struct osmo_fd *bfd = &pcu_sock_state.conn_bfd; + struct gprs_rlcmac_bts *bts; + uint8_t trx, ts; + + LOGP(DL1IF, LOGL_NOTICE, "PCU socket has %s connection\n", + (lost) ? "LOST" : "closed"); + + osmo_fd_unregister(bfd); + close(bfd->fd); + bfd->fd = -1; + + /* flush the queue */ + while (!llist_empty(&pcu_sock_state.upqueue)) { + struct msgb *msg = msgb_dequeue(&pcu_sock_state.upqueue); + msgb_free(msg); + } + + llist_for_each_entry(bts, &the_pcu->bts_list, list) { + /* disable all slots, kick all TBFs */ + for (trx = 0; trx < 8; trx++) { +#ifdef ENABLE_DIRECT_PHY + if (bts->trxtrx.fl1h) { + l1if_close_trx(bts->trxtrx.fl1h); + bts->trxtrx.fl1h = NULL; + } +#endif + for (ts = 0; ts < 8; ts++) + if (pdch_is_enabled(&bts->trxtrx.pdchts)) + pdch_disable(&bts->trxtrx.pdchts); + /* FIXME: NOT ALL RESOURCES are freed in this case... inconsistent with the other code. Share the code with pcu_l1if.c + for the reset. */ + bts_trx_free_all_tbf(&bts->trxtrx); + } + gprs_bssgp_destroy(bts); + } + exit(0); +} + +static int pcu_sock_read(struct osmo_fd *bfd) +{ + const size_t max_len = sizeof(struct gsm_pcu_if) + 1000; + uint8_t *buf = alloca(max_len); + struct gsm_pcu_if *pcu_prim = (struct gsm_pcu_if *)buf; + int rc; + + rc = recv(bfd->fd, buf, max_len, 0); + if (rc < 0 && errno == EAGAIN) + return 0; /* Try again later */ + if (rc <= 0) { + LOGP(DL1IF, LOGL_ERROR, "%s: recv() failed with rc=%d errno=%d\n", __func__, rc, errno); + pcu_sock_close(1); + return -EIO; + } + + if (rc < PCUIF_HDR_SIZE) { + LOGP(DL1IF, LOGL_ERROR, "Received %d bytes on PCU Socket, but primitive " + "hdr size is %zu, discarding\n", rc, PCUIF_HDR_SIZE); + return -EINVAL; + } + + return pcu_rx(pcu_prim, rc); +} + +static int pcu_sock_write(struct osmo_fd *bfd) +{ + int rc; + + while (!llist_empty(&pcu_sock_state.upqueue)) { + struct msgb *msg, *msg2; + struct gsm_pcu_if *pcu_prim; + + /* peek at the beginning of the queue */ + msg = llist_entry(pcu_sock_state.upqueue.next, struct msgb, list); + pcu_prim = (struct gsm_pcu_if *)msg->data; + + osmo_fd_write_disable(bfd); + + /* bug hunter 8-): maybe someone forgot msgb_put(...) ? */ + if (!msgb_length(msg)) { + LOGP(DL1IF, LOGL_ERROR, "message type (%d) with ZERO " + "bytes!\n", pcu_prim->msg_type); + goto dontsend; + } + + /* try to send it over the socket */ + rc = write(bfd->fd, msgb_data(msg), msgb_length(msg)); + if (rc == 0) + goto close; + if (rc < 0) { + if (errno == EAGAIN) { + osmo_fd_write_enable(bfd); + break; + } + goto close; + } + +dontsend: + /* _after_ we send it, we can deueue */ + msg2 = msgb_dequeue(&pcu_sock_state.upqueue); + assert(msg == msg2); + msgb_free(msg); + } + return 0; + +close: + pcu_sock_close(1); + + return -1; +} + +static int pcu_sock_cb(struct osmo_fd *bfd, unsigned int flags) +{ + int rc = 0; + + if (flags & OSMO_FD_READ) + rc = pcu_sock_read(bfd); + if (rc < 0) + return rc; + + if (flags & OSMO_FD_WRITE) + rc = pcu_sock_write(bfd); + + return rc; +} + +int pcu_l1if_open(void) +{ + int rc; + LOGP(DL1IF, LOGL_INFO, "Opening OsmoPCU L1 interface v%u to OsmoBTS/OsmoBSC\n", PCU_IF_VERSION); + + memset(&pcu_sock_state, 0x00, sizeof(pcu_sock_state)); + INIT_LLIST_HEAD(&pcu_sock_state.upqueue); + + rc = osmo_sock_unix_init_ofd(&pcu_sock_state.conn_bfd, SOCK_SEQPACKET, 0, + the_pcu->pcu_sock_path, OSMO_SOCK_F_CONNECT); + if (rc < 0) { + LOGP(DL1IF, LOGL_ERROR, "Failed to connect to the BTS (%s). " + "Retrying...\n", the_pcu->pcu_sock_path); + osmo_timer_setup(&pcu_sock_state.timer, pcu_sock_timeout, NULL); + osmo_timer_schedule(&pcu_sock_state.timer, 5, 0); + return 0; + } + + pcu_sock_state.conn_bfd.cb = pcu_sock_cb; + pcu_sock_state.conn_bfd.data = NULL; + + LOGP(DL1IF, LOGL_NOTICE, "osmo-bts PCU socket %s has been connected\n", + the_pcu->pcu_sock_path); + + pcu_tx_txt_ind(PCU_VERSION, "%s", PACKAGE_VERSION); + + /* Schedule a timer so we keep trying until the BTS becomes active. */ + osmo_timer_setup(&pcu_sock_state.timer, pcu_tx_txt_retry, NULL); + osmo_timer_schedule(&pcu_sock_state.timer, 5, 0); + + return 0; +} + +void pcu_l1if_close(void) +{ + struct osmo_fd *bfd; + + osmo_timer_del(&pcu_sock_state.timer); + + bfd = &pcu_sock_state.conn_bfd; + if (bfd->fd > 0) + pcu_sock_close(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
.