osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/31926 )
Change subject: obs: lib.args: store argparse result here
......................................................................
obs: lib.args: store argparse result here
Prepare to add more arguments to the OBS scripts, so they can be used
for building the wireshark package in its own OBS project.
It was not so clear to me when writing this initially, but with more and
more arguments getting added: it's not very maintainable to pass each
variable from the argparse result several functions down to where it
gets used... so unfortunately this means the code needs to be refactored
to just use libs.args in the few lines of code where the arguments
actually get used.
This patch adds lib.args, and the next patches refactor existing code to
use it instead of passing parameters, where it makes sense. After that
follow the patches related to adding the wireshark package.
Related: OS#2537
Change-Id: I48853444f1386dfb842c174ebc45f9decc8bec0f
---
M scripts/obs/build_binpkg.py
M scripts/obs/build_srcpkg.py
M scripts/obs/lib/__init__.py
M scripts/obs/update_obs_project.py
4 files changed, 37 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/26/31926/1
diff --git a/scripts/obs/build_binpkg.py b/scripts/obs/build_binpkg.py
index a34a699..dcd6cdc 100755
--- a/scripts/obs/build_binpkg.py
+++ b/scripts/obs/build_binpkg.py
@@ -38,7 +38,7 @@
help="package name, e.g. libosmocore")
args = parser.parse_args()
- lib.set_cmds_verbose(args.verbose)
+ lib.set_args(args)
srcdir = f"{lib.config.path_temp}/srcpkgs/{args.package}"
if not os.path.exists(srcdir):
diff --git a/scripts/obs/build_srcpkg.py b/scripts/obs/build_srcpkg.py
index ad21927..869b8ef 100755
--- a/scripts/obs/build_srcpkg.py
+++ b/scripts/obs/build_srcpkg.py
@@ -28,7 +28,7 @@
print("ERROR: specify -m and/or a package. See -h for help.")
exit(1)
- lib.set_cmds_verbose(args.verbose)
+ lib.set_args(args)
if args.docker:
lib.docker.run_in_docker_and_exit("build_srcpkg.py")
diff --git a/scripts/obs/lib/__init__.py b/scripts/obs/lib/__init__.py
index 479c1c1..edf19f4 100644
--- a/scripts/obs/lib/__init__.py
+++ b/scripts/obs/lib/__init__.py
@@ -10,6 +10,10 @@
import inspect
import lib.config
+# Argparse result
+args = None
+
+# Print output of commands as they run, not only on error
cmds_verbose = False
@@ -60,6 +64,12 @@
cmds_verbose = new_val
+def set_args(new_val):
+ global args
+ args = new_val
+ set_cmds_verbose(args.verbose)
+
+
def check_required_programs():
ok = True
diff --git a/scripts/obs/update_obs_project.py b/scripts/obs/update_obs_project.py
index 86cf40a..0ae949b 100755
--- a/scripts/obs/update_obs_project.py
+++ b/scripts/obs/update_obs_project.py
@@ -199,7 +199,7 @@
branch = args.git_branch
packages = parse_packages(args.package)
- lib.set_cmds_verbose(args.verbose)
+ lib.set_args(args)
if args.docker:
lib.docker.run_in_docker_and_exit("update_obs_project.py", True)
--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/31926
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I48853444f1386dfb842c174ebc45f9decc8bec0f
Gerrit-Change-Number: 31926
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: newchange
vp has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/31925 )
Change subject: Fix mistypes
......................................................................
Fix mistypes
Change-Id: I87da6bec137c7be37ec748ec1f9f8d072517022d
---
M common/chapters/cell-broadcast.adoc
M common/chapters/preface.adoc
M common/chapters/sigtran-osmocom.adoc
M common/chapters/sigtran.adoc
4 files changed, 19 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/25/31925/1
diff --git a/common/chapters/cell-broadcast.adoc b/common/chapters/cell-broadcast.adoc
index a87efae..842e8d1 100644
--- a/common/chapters/cell-broadcast.adoc
+++ b/common/chapters/cell-broadcast.adoc
@@ -18,7 +18,7 @@
=== Use Cases
Cell Broadcast was used for various different use cases primarily in
-the 1990ies and early 2000s, including
+the 1990s and early 2000s, including
* advertisement of the GPS position of the cell tower you're currently camping on
* advertisement of the calling codes of your current "home zone", i.e. a
diff --git a/common/chapters/preface.adoc b/common/chapters/preface.adoc
index 76e6f48..b8f7e72 100644
--- a/common/chapters/preface.adoc
+++ b/common/chapters/preface.adoc
@@ -1,7 +1,7 @@
== Foreword
Digital cellular networks based on the GSM specification were designed
-in the late 1980ies and first deployed in the early 1990ies in Europe.
+in the late 1980s and first deployed in the early 1990s in Europe.
Over the last 25 years, hundreds of networks were established globally
and billions of subscribers have joined the associated networks.
diff --git a/common/chapters/sigtran-osmocom.adoc b/common/chapters/sigtran-osmocom.adoc
index fa8e128..05cdedb 100644
--- a/common/chapters/sigtran-osmocom.adoc
+++ b/common/chapters/sigtran-osmocom.adoc
@@ -38,7 +38,7 @@
==== The present (2017)
In 2017, sysmocom was tasked with implementing a 3GPP AoIP compliant A
-interface. This meant that lot of things had to change in the
+interface. This meant that a lot of things had to change in the
existing code:
* removal of the existing hard-wired SCCPlite/IPA code from OsmoBSC
@@ -112,7 +112,7 @@
`accept-asp-connections dynamic-permitted`.
To enable dynamic registration of routing keys via RKM, the
-corresponding SS7 Instance (<<ss7-instance>>) must be confgured with
+corresponding SS7 Instance (<<ss7-instance>>) must be configured with
`xua rkm routing-key-allocation dynamic-permitted`.
This is of course highly insecure and can only be used in trusted,
@@ -349,7 +349,7 @@
|Recovery Timeout|Duration of the AS T(r) recovery timer. During this time,
outgoing messages are queued. If the AS is ACTIVE
before timer expiration, the queue is drained. At
- expriation, the queue is flushed.
+ expiration, the queue is flushed.
|State|Application Server State (Down, Inactive, Active, Pending)
|ASPs|Which ASPs are permitted to transfer traffic for this AS
|====
@@ -360,7 +360,7 @@
connection. From the STP/SG (Server) point-of-view, those are
incoming connections from Application Servers such as the BSCs. From
the ASP (Client) Point of view, it has one `osmo_ss7_asp` object for
-each outbound SIGTARN connection.
+each outbound SIGTRAN connection.
An ASP has the following properties:
diff --git a/common/chapters/sigtran.adoc b/common/chapters/sigtran.adoc
index 2cbd84c..51ef65e 100644
--- a/common/chapters/sigtran.adoc
+++ b/common/chapters/sigtran.adoc
@@ -33,7 +33,7 @@
=== Message Transfer Part (MTP)
MTP is the lower layer of the SS7 protocol stack. It is comprised of
-two sub-layes, called MTP2 and MTP3.
+two sub-layers, called MTP2 and MTP3.
Nodes in a MTP network are addressed by their unique PC (Point Code).
@@ -54,7 +54,7 @@
==== Point Codes
The length of point codes depends on the particular MTP dialect that
-is used. In the 1980ies, when international telephony signaling
+is used. In the 1980s, when international telephony signaling
networks were established, most countries had their own national
dialects with certain specifics.
@@ -210,7 +210,7 @@
SS7 backbone by means as SUA and M3UA. Over time, even the links of
the actual network backbone networks became more and more IP based.
-In order to replace existing TDM-based SS7 links/liksets with SIGTRAN,
+In order to replace existing TDM-based SS7 links/linksets with SIGTRAN,
the M2UA or M2PA variants are used as a kind of drop-in replacement
for physical links.
@@ -334,7 +334,7 @@
underlying IP transport is transparent to the SS7/SCCP applications,
there is no restriction on whether to use SIGTRAN over IPv4 or IPv6.
-==== SCTP multi-homing in SIGTARN
+==== SCTP multi-homing in SIGTRAN
SCTP, unlike more traditional IP L4 protocols (TCP, UDP) doesn't work
based on a _connection_ between source IP:port and Destination IP:port.
--
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/31925
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-Change-Id: I87da6bec137c7be37ec748ec1f9f8d072517022d
Gerrit-Change-Number: 31925
Gerrit-PatchSet: 1
Gerrit-Owner: vp <vilius(a)elitnet.lt>
Gerrit-MessageType: newchange
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/31924 )
Change subject: Rewrite pcu_sock_write()
......................................................................
Rewrite pcu_sock_write()
The code in that function is pretty rotten:
* osmo_fd_write_disable() is called for each message in the queue,
there's no need for that. Let's simply call it at the end if the queue
is empty.
* Asserting for obvious stuff like dequeue returning the first entry in
the list.
* Having error code path for empty message: That shouldn't happen, abort
immediately.
With all thse changes, the function is way simpler, easy to read and
more efficient.
Change-Id: I7ffff98cd8cdf2041bff486c3fde6f16365028d5
---
M src/common/pcu_sock.c
1 file changed, 32 insertions(+), 25 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
osmith: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index 145942b..5e4b06b 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -28,6 +28,7 @@
#include <inttypes.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/core/utils.h>
#include <osmocom/core/select.h>
#include <osmocom/core/socket.h>
#include <osmocom/gsm/gsm23003.h>
@@ -1087,48 +1088,33 @@
static int pcu_sock_write(struct osmo_fd *bfd)
{
struct pcu_sock_state *state = bfd->data;
+ struct msgb *msg;
int rc;
- while (!llist_empty(&state->upqueue)) {
- struct msgb *msg, *msg2;
- struct gsm_pcu_if *pcu_prim;
-
- /* peek at the beginning of the queue */
- msg = llist_entry(state->upqueue.next, struct msgb, list);
- pcu_prim = (struct gsm_pcu_if *)msg->data;
-
- osmo_fd_write_disable(bfd);
-
+ while ((msg = msgb_dequeue(&state->upqueue))) {
/* bug hunter 8-): maybe someone forgot msgb_put(...) ? */
- if (!msgb_length(msg)) {
- LOGP(DPCU, LOGL_ERROR, "message type (%d) with ZERO "
- "bytes!\n", pcu_prim->msg_type);
- goto dontsend;
- }
+ OSMO_ASSERT(msgb_length(msg) > 0);
/* try to send it over the socket */
rc = write(bfd->fd, msgb_data(msg), msgb_length(msg));
- if (rc == 0)
+ if (OSMO_UNLIKELY(rc == 0))
goto close;
- if (rc < 0) {
+ if (OSMO_UNLIKELY(rc < 0)) {
if (errno == EAGAIN) {
- osmo_fd_write_enable(bfd);
- break;
+ /* Re-insert at the start of the queue, skip disabling fd WRITE */
+ llist_add(&msg->list, &state->upqueue);
+ return 0;
}
goto close;
}
-
-dontsend:
- /* _after_ we send it, we can deueue */
- msg2 = msgb_dequeue(&state->upqueue);
- assert(msg == msg2);
msgb_free(msg);
}
+ osmo_fd_write_disable(bfd);
return 0;
close:
+ msgb_free(msg);
pcu_sock_close(state);
-
return -1;
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/31924
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I7ffff98cd8cdf2041bff486c3fde6f16365028d5
Gerrit-Change-Number: 31924
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: arehbein <arehbein(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged