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

July 2023

  • 1 participants
  • 3051 discussions
[L] Change in libosmo-netif[master]: stream: Add server-side (segmentation) support for IPA
by arehbein 29 Jul '23

29 Jul '23
Attention is currently required from: arehbein, laforge, daniel. Hello Jenkins Builder, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmo-netif/+/33197 to look at the new patch set (#12). Change subject: stream: Add server-side (segmentation) support for IPA ...................................................................... stream: Add server-side (segmentation) support for IPA With this commit, IPA segmentation can be taken care of by setting the segmentation callback osmo_ipa_segmentation_cb(). Depends: libosmocore.git I3a639e6896cc3b3fc8e9b2e1a58254710efa0d3f Related: OS#5753, OS#5751 Change-Id: I6c91ff385cb5f36ab6b6c96d0e44997995d0d24c --- M examples/ipa-stream-server.c M include/osmocom/netif/stream.h M src/stream.c M tests/stream/stream_test.c M tests/stream/stream_test.ok 5 files changed, 382 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/97/33197/12 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/33197 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I6c91ff385cb5f36ab6b6c96d0e44997995d0d24c Gerrit-Change-Number: 33197 Gerrit-PatchSet: 12 Gerrit-Owner: arehbein <arehbein(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: daniel <dwillmann(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: arehbein <arehbein(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in libosmo-netif[master]: examples: Add extension header octet to example
by arehbein 29 Jul '23

29 Jul '23
Attention is currently required from: arehbein, daniel. Hello Jenkins Builder, laforge, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmo-netif/+/33202 to look at the new patch set (#13). Change subject: examples: Add extension header octet to example ...................................................................... examples: Add extension header octet to example Mainly to make data/packets look (pseudo-)correct in Wireshark. Also: Add helper for allocating message buffers with extended headroom for IPA. Change-Id: I962b9edcba65cdc98da00d2f8753dc5acd481502 --- M examples/ipa-stream-client.c M include/osmocom/netif/ipa.h M src/ipa.c 3 files changed, 23 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/02/33202/13 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/33202 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I962b9edcba65cdc98da00d2f8753dc5acd481502 Gerrit-Change-Number: 33202 Gerrit-PatchSet: 13 Gerrit-Owner: arehbein <arehbein(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: arehbein <arehbein(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[L] Change in libosmo-netif[master]: stream: Add client-side (segmentation) support for IPA
by arehbein 29 Jul '23

29 Jul '23
Attention is currently required from: arehbein, daniel. Hello Jenkins Builder, laforge, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmo-netif/+/33198 to look at the new patch set (#15). Change subject: stream: Add client-side (segmentation) support for IPA ...................................................................... stream: Add client-side (segmentation) support for IPA With this commit, IPA segmentation is taken care of by setting the segmentation callback provided by libosmo-netif. The ipa-stream-server example needs to prepend IPA headers now because those are stripped by the segm. cb on both sides. Depends: libosmocore.git I3a639e6896cc3b3fc8e9b2e1a58254710efa0d3f Related: OS#5753, OS#5751 Change-Id: I822abf52c6ae396c90b5c50228a0a39c848d3de6 --- M examples/ipa-stream-client.c M examples/ipa-stream-server.c M include/osmocom/netif/stream.h M src/stream.c M tests/stream/stream_test.c M tests/stream/stream_test.ok 6 files changed, 366 insertions(+), 33 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/98/33198/15 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/33198 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I822abf52c6ae396c90b5c50228a0a39c848d3de6 Gerrit-Change-Number: 33198 Gerrit-PatchSet: 15 Gerrit-Owner: arehbein <arehbein(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: arehbein <arehbein(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[M] Change in libosmo-netif[master]: stream: Add and use IPA send function
by arehbein 29 Jul '23

29 Jul '23
Attention is currently required from: arehbein, laforge, daniel. Hello Jenkins Builder, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmo-netif/+/33201 to look at the new patch set (#13). Change subject: stream: Add and use IPA send function ...................................................................... stream: Add and use IPA send function Related OS#5753, OS#5751 Change-Id: I61e1fe59166c46595efe8c1f32b8f2607cb6c529 --- M examples/ipa-stream-client.c M examples/ipa-stream-server.c M include/osmocom/netif/ipa.h M src/ipa.c M tests/stream/stream_test.c 5 files changed, 68 insertions(+), 14 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/01/33201/13 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/33201 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I61e1fe59166c46595efe8c1f32b8f2607cb6c529 Gerrit-Change-Number: 33201 Gerrit-PatchSet: 13 Gerrit-Owner: arehbein <arehbein(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: daniel <dwillmann(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: arehbein <arehbein(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[L] Change in dahdi-tools[master]: Initial support for trunkdev
by laforge 29 Jul '23

29 Jul '23
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/dahdi-tools/+/34013 ) Change subject: Initial support for trunkdev ...................................................................... Initial support for trunkdev The 'trunkdev' is a virtual DAHDI device driver that exposes the multiplexed E1 frames on a /dev/dahdi/trunkdev device. This is useful for all kinds of simulated setup, as well as in the context of using osmo-e1d for OCTOI (Osmocom TDMoIP). In order for the dahdi_trunkdev utility to be built, you will need to have installed dahdi header files of dahdi-linux with trunkdev support, currently located at https://gitea.osmocom.org/retronetworking/dahdi-linux/src/branch/laforge/tr… Change-Id: Ie05100c80fd978e7ac6f5a028e0ef6c828e0bcc3 --- M Makefile.am M configure.ac A trunkdev/Makefile.am A trunkdev/dahdi-sysfs.c A trunkdev/dahdi-sysfs.h A trunkdev/trunkdev-tool.c 6 files changed, 468 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/dahdi-tools refs/changes/13/34013/1 diff --git a/Makefile.am b/Makefile.am index 9dd64b2..2c42d69 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,7 +17,7 @@ #-Wformat=2 endif -SUBDIRS = xpp doc hotplug +SUBDIRS = xpp doc hotplug trunkdev if PPPD SUBDIRS += ppp diff --git a/configure.ac b/configure.ac index 826a7ec..e11eec7 100644 --- a/configure.ac +++ b/configure.ac @@ -182,6 +182,7 @@ AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h]) DAHDI23_DIR="${DAHDI_DIR}" AST_C_DEFINE_CHECK([DAHDI23], [DAHDI_CONFIG_NTTE], [dahdi/user.h]) +AST_C_DEFINE_CHECK([TRUNKDEV], [DAHDI_TRUNKDEV_CREATE], [dahdi/user.h]) AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h]) AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h]) AST_EXT_LIB_CHECK([PCAP], [pcap], [pcap_compile], [pcap.h]) @@ -193,6 +194,7 @@ AM_CONDITIONAL([PBX_NEWT], [test "$PBX_NEWT" = "1"]) AM_CONDITIONAL([PBX_PCAP], [test "$PBX_PCAP" = "1" -a "$DAHDI_TXMIRROR" = "1"]) +AM_CONDITIONAL([PBX_TRUNKDEV], [test "$PBX_TRUNKDEV" = "1"]) AC_CHECK_FUNCS([semtimedop]) AC_CHECK_FUNCS([alarm bzero gettimeofday memset pow regcomp select socket strcasecmp strchr strdup strerror strrchr strstr strtol strtoul]) @@ -390,6 +392,7 @@ xpp/xtalk/Makefile xpp/oct612x/Makefile xpp/perl_modules/Makefile + trunkdev/Makefile ]) AC_OUTPUT diff --git a/trunkdev/Makefile.am b/trunkdev/Makefile.am new file mode 100644 index 0000000..af230f4 --- /dev/null +++ b/trunkdev/Makefile.am @@ -0,0 +1,14 @@ +CFLAGS += -g -Wall -O2 $(DAHDI_INCLUDE) + +if PBX_TRUNKDEV + +sbin_PROGRAMS = \ + dahdi_trunkdev \ + $(NULL) + +dahdi_trunkdev_SOURCES = \ + trunkdev-tool.c \ + dahdi-sysfs.c \ + $(NULL) + +endif diff --git a/trunkdev/dahdi-sysfs.c b/trunkdev/dahdi-sysfs.c new file mode 100644 index 0000000..63324e9 --- /dev/null +++ b/trunkdev/dahdi-sysfs.c @@ -0,0 +1,88 @@ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <fcntl.h> +#include <limits.h> + +#include "dahdi-sysfs.h" + +/* read a sysfs attribute from a file, stripping any trailing newline */ +char *sysfs_read_attr(const char *path) +{ + FILE *f; + char *buf; + + f = fopen(path, "r"); + if (!f) + return NULL; + + buf = malloc(256); + if (!buf) + goto out_close; + + if (!fgets(buf, 256, f)) + goto out_free; + + if (strlen(buf) && buf[strlen(buf)-1] == '\n') + buf[strlen(buf)-1] = '\0'; + + fclose(f); + printf("%s: %s\n", path, buf); + return buf; + +out_free: + free(buf); +out_close: + fclose(f); + return NULL; +} + +static char *sysfs_read_span_attr(unsigned int spanno, const char *name) +{ + char path[PATH_MAX]; + snprintf(path, sizeof(path), "/sys/bus/dahdi_spans/devices/span-%u/%s", spanno, name); + return sysfs_read_attr(path); +} + +static int sysfs_read_span_attr_int(unsigned int spanno, const char *name) +{ + char *attr; + int attr_int; + + attr = sysfs_read_span_attr(spanno, name); + if (!attr) + return -1; + + attr_int = atoi(attr); + free(attr); + + return attr_int; +} + +/* return number of channels in span */ +int dahdi_span_get_basechan(unsigned int spanno) +{ + return sysfs_read_span_attr_int(spanno, "basechan"); +} + +/* return number of channels in span */ +int dahdi_span_get_channels(unsigned int spanno) +{ + return sysfs_read_span_attr_int(spanno, "channels"); +} + +char *dahdi_span_get_name(unsigned int spanno) +{ + return sysfs_read_span_attr(spanno, "name"); +} + +char *dahdi_span_get_desc(unsigned int spanno) +{ + return sysfs_read_span_attr(spanno, "desc"); +} + +char *dahdi_span_get_spantype(unsigned int spanno) +{ + return sysfs_read_span_attr(spanno, "spantype"); +} diff --git a/trunkdev/dahdi-sysfs.h b/trunkdev/dahdi-sysfs.h new file mode 100644 index 0000000..2a8eaf7 --- /dev/null +++ b/trunkdev/dahdi-sysfs.h @@ -0,0 +1,9 @@ +#pragma once + +char *sysfs_read_attr(const char *path); + +int dahdi_span_get_basechan(unsigned int spanno); +int dahdi_span_get_channels(unsigned int spanno); +char *dahdi_span_get_name(unsigned int spanno); +char *dahdi_span_get_desc(unsigned int spanno); +char *dahdi_span_get_spantype(unsigned int spanno); diff --git a/trunkdev/trunkdev-tool.c b/trunkdev/trunkdev-tool.c new file mode 100644 index 0000000..355c5d0 --- /dev/null +++ b/trunkdev/trunkdev-tool.c @@ -0,0 +1,334 @@ +/* + * trunkdev configuration program for DAHDI Telephony Interface + * + * Copyright (C) 2022 Harald Welte <laforge(a)osmocom.org> + * Copyright (C) 2001-2008 Digium, Inc. + * + * All rights reserved. + * + * This program is free software, distributed under the terms of + * the GNU General Public License Version 2 as published by the + * Free Software Foundation. See the LICENSE file included with + * this program for more details. + */ + +#include <stdint.h> +#include <stdbool.h> +#include <string.h> +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <errno.h> +#include <fcntl.h> +#include <sys/ioctl.h> + +#include <sys/socket.h> +#include <dahdi/user.h> + +#include "dahdi-sysfs.h" + +static int g_fd = -1; + + +/* wrapper around DAHDI_TRUNKDEV_CREATE */ +static int trunkdev_create(int fd, const char *name) +{ + struct dahdi_trunkdev_create td_c = { 0 }; + int rc; + + strncpy(td_c.name, name, sizeof(td_c.name)); + td_c.name[sizeof(td_c.name)-1] = 0; + + rc = ioctl(fd, DAHDI_TRUNKDEV_CREATE, &td_c); + if (rc) + fprintf(stderr, "Error creating trunkdev '%s': %s\n", name, strerror(errno)); + + return rc; +} + +/* wrapper around DAHDI_TRUNKDEV_DELETE */ +static int trunkdev_delete(int fd, const char *name) +{ + struct dahdi_trunkdev_delete td_d = { 0 }; + int rc; + + strncpy(td_d.name, name, sizeof(td_d.name)); + td_d.name[sizeof(td_d.name)-1] = 0; + + rc = ioctl(fd, DAHDI_TRUNKDEV_DELETE, &td_d); + if (rc) + fprintf(stderr, "Error deleting trunkdev '%s': %s\n", name, strerror(errno)); + + return rc; +} + +/* wrapper around DAHDI_TRUNKDEV_SPECIFY */ +static int trunkdev_specify(int fd, const char *name) +{ + struct dahdi_trunkdev_open td_o = { 0 }; + int rc; + + strncpy(td_o.name, name, sizeof(td_o.name)); + td_o.name[sizeof(td_o.name)-1] = 0; + + rc = ioctl(fd, DAHDI_TRUNKDEV_OPEN, &td_o); + if (rc < 0) { + fprintf(stderr, "Error opening trunkdev '%s': %s\n", name, strerror(errno)); + return rc; + } + return td_o.spanno; +} + +/* wrapper around DAHDI_SPANCONFIG (assuming E1 with CRC4) */ +static int spanconfig(int fd, int spanno) +{ + struct dahdi_lineconfig dlc = { + .span = spanno, + .lbo = 0, + .lineconfig = DAHDI_CONFIG_CRC4, + .sync = 0, + }; + + return ioctl(fd, DAHDI_SPANCONFIG, &dlc); +} + +/* wrapper around DAHDI_CHANCONFIG (assuming E1/ALAW/CLEAR; unless dchan -> HDLCFCS) */ +static int chanconfig(int fd, int channo, bool dchan) +{ + struct dahdi_chanconfig dcc = { + .chan = channo, + .sigtype = DAHDI_SIG_CLEAR, + .deflaw = DAHDI_LAW_ALAW, + .master = 0, + .idlebits = 0, + }; + if (dchan) + dcc.sigtype = DAHDI_SIG_HDLCFCS; + + return ioctl(fd, DAHDI_CHANCONFIG, &dcc); +} + +static int chanconfig_hdlc_master(int fd, int channo, const char *netdev_name) +{ + struct dahdi_chanconfig dcc = { + .chan = channo, + .sigtype = DAHDI_SIG_HDLCNET, + .deflaw = DAHDI_LAW_ALAW, + .master = 0, + .idlebits = 0, + }; + strncpy(dcc.netdev_name, netdev_name, sizeof(dcc.netdev_name)); + dcc.netdev_name[sizeof(dcc.netdev_name)-1] = '\0'; + + return ioctl(fd, DAHDI_CHANCONFIG, &dcc); +} + +static int chanconfig_hdlc_slave(int fd, int channo, int master) +{ + struct dahdi_chanconfig dcc = { + .chan = channo, + .sigtype = DAHDI_SIG_SLAVE, + .deflaw = DAHDI_LAW_ALAW, + .master = master, + .idlebits = 0, + }; + + return ioctl(fd, DAHDI_CHANCONFIG, &dcc); +} + +/* high-level wrapper to configure an E1 span + all its channels */ +static int config(int spanno, const char *hdlc_netdev) +{ + struct dahdi_spaninfo dsi = { + .spanno = spanno, + }; + int fd, rc; + + fd = open("/dev/dahdi/ctl", O_RDWR); + if (fd < 0) { + fprintf(stderr, "Unable to open /dev/dahd/ctl: %s\n", strerror(errno)); + return fd; + } + + rc = ioctl(fd, DAHDI_SPANSTAT, &dsi); + if (rc < 0) { + fprintf(stderr, "Error during spanstat: %s\n", strerror(errno)); + close(fd); + return rc; + } + printf("Span %u (%s: %s)\n", dsi.spanno, dsi.name, dsi.desc); + printf(" numchans=%u, totalchans=%u\n", dsi.numchans, dsi.totalchans); + + rc = spanconfig(fd, spanno); + if (rc < 0) { + fprintf(stderr, "Error during spanconfig: %s\n", strerror(errno)); + close(fd); + return rc; + } + + /* resolve basechan + num_chan via sysfs */ + int basechan = dahdi_span_get_basechan(spanno); + int num_chan = dahdi_span_get_channels(spanno); + if (basechan < 0 || num_chan < 0) { + fprintf(stderr, "Error getting basechan=%d or channels=%d for spanno=%d: %s\n", + basechan, num_chan, spanno, strerror(errno)); + close(fd); + return -1; + } + + for (unsigned int i = basechan; i < basechan+num_chan; i++) { + if (!hdlc_netdev) { + /* ISDN: we assume a standard ISDN configuration with TS16 == D-channel */ + rc = chanconfig(fd, i, i == basechan + 15); + } else { + /* HDLC: we assume TS 1-31 as superchannel */ + if (i == basechan) + rc = chanconfig_hdlc_master(fd, i, hdlc_netdev); + else + rc = chanconfig_hdlc_slave(fd, i, basechan); + } + if (rc < 0) { + fprintf(stderr, "Error during spanconfig: %s\n", strerror(errno)); + close(fd); + return rc; + } + } + close(fd); + return 0; +} + +static void print_help(void) +{ + printf("\n"); + printf( "dahdi_trunkdev create NAME\n" + " Create a new dahdi trunkdev named NAME\n" + "dahdi_trunkdev delete NAME\n" + " Delete an existing dahdi trunkdev named NAME\n" + "dahdi_trunkdev config NAME\n" + " Configure span + all channels of trunkdev named NAME for ISDN\n" + "dahdi_trunkdev config-hdlc NAME\n" + " Configure span + all channels of trunkdev named NAME for HDLC\n" + "dahdi_trunkdev read NAME\n" + " Continuously read + discard frames from trunkdev named NAME\n" + "dahdi_trunkdev rdwr NAME\n" + " Continuously read + loop back (write) frames of trunkdev named NAME\n"); + +} + +int main(int argc, char **argv) +{ + int rc; + + printf("DAHDI trunkdev tool (C) 2022 by Harald Welte <laforge(a)osmocom.org>\n\n"); + + if (argc < 2) { + fprintf(stderr, "First argument must specify the command\n"); + print_help(); + exit(2); + } + + if (!strcmp(argv[1], "help") || !strcmp(argv[1], "--help")) { + print_help(); + exit(0); + } + + g_fd = open("/dev/dahdi/trunkdev", O_RDWR); + if (g_fd < 0) { + fprintf(stderr, "Unable to open trunkdev: %s\n", strerror(errno)); + exit(1); + } + + if (!strcmp(argv[1], "create")) { + /* dahdi_trunkdev create foo */ + if (argc < 3) { + fprintf(stderr, "Second argument must specify the name\n"); + exit(2); + } + rc = trunkdev_create(g_fd, argv[2]); + if (rc < 0) { + fprintf(stderr, "Unable to create trunkdev: %s\n", strerror(errno)); + exit(1); + } + printf("DAHDI trunkdev %s created; span number %d\n", argv[2], rc); + } else if (!strcmp(argv[1], "delete")) { + /* dahdi_trunkdev create foo */ + if (argc < 3) { + fprintf(stderr, "Second argument must specify the name\n"); + exit(2); + } + rc = trunkdev_delete(g_fd, argv[2]); + if (rc < 0) { + fprintf(stderr, "Unable to create trunkdev: %s\n", strerror(errno)); + exit(1); + } + printf("DAHDI trunkdev %s deleted\n", argv[2]); + } else if (!strcmp(argv[1], "config")) { + /* dahdi_trunkdev config foo */ + if (argc < 3) { + fprintf(stderr, "Second argument must specify the name\n"); + exit(2); + } + rc = trunkdev_specify(g_fd, argv[2]); + if (rc < 0) { + fprintf(stderr, "Unable to specify trunkdev: %s\n", strerror(errno)); + exit(2); + } + rc = config(rc, NULL); + if (rc < 0) + exit(2); + printf("DAHDI trunkdev %s configured\n", argv[2]); + } else if (!strcmp(argv[1], "config-hdlc")) { + /* dahdi_trunkdev config-hdlc foo hdlc-foo */ + if (argc < 3) { + fprintf(stderr, "Second argument must specify the name\n"); + exit(2); + } + if (argc < 4) { + fprintf(stderr, "Third argument must specify the net-device name\n"); + exit(2); + } + rc = trunkdev_specify(g_fd, argv[2]); + if (rc < 0) { + fprintf(stderr, "Unable to specify trunkdev: %s\n", strerror(errno)); + exit(2); + } + rc = config(rc, argv[3]); + if (rc < 0) + exit(2); + printf("DAHDI trunkdev %s configured as netdev %s\n", argv[2], argv[3]); + } else if (!strcmp(argv[1], "read") || !strcmp(argv[1], "rdwr")) { + /* dahdi_trunkdev (read|rdwr) foo */ + if (argc < 3) { + fprintf(stderr, "Second argument must specify the name\n"); + exit(2); + } + rc = trunkdev_specify(g_fd, argv[2]); + if (rc < 0) { + fprintf(stderr, "Unable to specify trunkdev: %s\n", strerror(errno)); + exit(1); + } + if (!strcmp(argv[1], "read")) + printf("Reading + Disccarding from DAHDI trunkdev %s\n", argv[2]); + else + printf("Reading + Writing (looping back) DAHDI trunkdev %s\n", argv[2]); + while (1) { + uint8_t buf[32*8]; + rc = read(g_fd, buf, sizeof(buf)); + if (rc <= 0) { + fprintf(stderr, "Error %d reading: %s\n", rc, strerror(errno)); + exit(1); + } + fputc('.', stdout); + if (!strcmp(argv[1], "rdwr")) { + rc = write(g_fd, buf, rc); + if (rc <= 0) { + fprintf(stderr, "Error %d writing: %s\n", rc, strerror(errno)); + exit(1); + } + } + } + } else + exit(23); + + exit(0); +} -- To view, visit https://gerrit.osmocom.org/c/dahdi-tools/+/34013 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: dahdi-tools Gerrit-Branch: master Gerrit-Change-Id: Ie05100c80fd978e7ac6f5a028e0ef6c828e0bcc3 Gerrit-Change-Number: 34013 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in dahdi-linux[master]: Introduce virtual DAHDI trunk device
by laforge 29 Jul '23

29 Jul '23
Attention is currently required from: manawyrm, roox, laforge, tnt. Hello Jenkins Builder, manawyrm, roox, tnt, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/dahdi-linux/+/34010 to look at the new patch set (#2). Change subject: Introduce virtual DAHDI trunk device ...................................................................... Introduce virtual DAHDI trunk device This virtual trunk device is a new character device. Contrary to the per-channel devices, this is a per-span device for virtual E1 spans. Userspace reads and writes 32-byte E1 frames on it. ioctl's are added to create and delete such virtual trunk devices at runtime. Each virtual trunk device is limited to one span. Opening trunkdev is similar to opening channels via /dev/dahd/chanw works: All users open the same generic device node but then issue an ioctl to specify which (named) trundev they actually want to open. This avoids having to dynamically register minor device ids, creating device nodes, etc. The trunkdev is in RED + LOS alarm after creation. Only once a userspace process opens the E1 frame side, those alarms cease. Change-Id: Iffd9a1a09d835b29927acd374364cab56745fb74 --- M drivers/dahdi/Kbuild M drivers/dahdi/Kconfig M drivers/dahdi/dahdi-base.c A drivers/dahdi/trunkdev/Kbuild A drivers/dahdi/trunkdev/frame_fifo.c A drivers/dahdi/trunkdev/frame_fifo.h A drivers/dahdi/trunkdev/trunkdev.c M include/dahdi/kernel.h M include/dahdi/user.h 9 files changed, 939 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/dahdi-linux refs/changes/10/34010/2 -- To view, visit https://gerrit.osmocom.org/c/dahdi-linux/+/34010 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: dahdi-linux Gerrit-Branch: master Gerrit-Change-Id: Iffd9a1a09d835b29927acd374364cab56745fb74 Gerrit-Change-Number: 34010 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: manawyrm <osmocom.account(a)tbspace.de> Gerrit-Reviewer: roox <mardnh(a)gmx.de> Gerrit-Reviewer: tnt <tnt(a)246tNt.com> Gerrit-Attention: manawyrm <osmocom.account(a)tbspace.de> Gerrit-Attention: roox <mardnh(a)gmx.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: tnt <tnt(a)246tNt.com> Gerrit-MessageType: newpatchset
1 0
0 0
[S] Change in dahdi-linux[master]: xpp_usb: Fix for 32bit architectures: use div_s64()
by laforge 29 Jul '23

29 Jul '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/dahdi-linux/+/34009 ) Change subject: xpp_usb: Fix for 32bit architectures: use div_s64() ...................................................................... xpp_usb: Fix for 32bit architectures: use div_s64() Change-Id: Ib5cef80c018f800cc0a0cd08a51d6cb7afd584c6 --- M drivers/dahdi/xpp/xpp_usb.c 1 file changed, 10 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/drivers/dahdi/xpp/xpp_usb.c b/drivers/dahdi/xpp/xpp_usb.c index 65f646a..0660de3 100644 --- a/drivers/dahdi/xpp/xpp_usb.c +++ b/drivers/dahdi/xpp/xpp_usb.c @@ -886,7 +886,7 @@ usec = 0; /* System clock jumped */ if (usec > xusb->max_tx_delay) xusb->max_tx_delay = usec; - i = usec / USEC_BUCKET; + i = div_s64(usec, USEC_BUCKET); if (i >= NUM_BUCKETS) i = NUM_BUCKETS - 1; xusb->usb_tx_delay[i]++; -- To view, visit https://gerrit.osmocom.org/c/dahdi-linux/+/34009 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: dahdi-linux Gerrit-Branch: master Gerrit-Change-Id: Ib5cef80c018f800cc0a0cd08a51d6cb7afd584c6 Gerrit-Change-Number: 34009 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
[S] Change in dahdi-linux[master]: xpp_usb: Fix for 32bit architectures: use div_s64()
by laforge 29 Jul '23

29 Jul '23
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/dahdi-linux/+/34009 ) Change subject: xpp_usb: Fix for 32bit architectures: use div_s64() ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/dahdi-linux/+/34009 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: dahdi-linux Gerrit-Branch: master Gerrit-Change-Id: Ib5cef80c018f800cc0a0cd08a51d6cb7afd584c6 Gerrit-Change-Number: 34009 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Sat, 29 Jul 2023 15:42:40 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in dahdi-linux[master]: trunkdev: Implement DAHDI_MAINT_{LOCAL,NETWORKPAYLOAD}LOOP
by laforge 29 Jul '23

29 Jul '23
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/dahdi-linux/+/34012 ) Change subject: trunkdev: Implement DAHDI_MAINT_{LOCAL,NETWORKPAYLOAD}LOOP ...................................................................... trunkdev: Implement DAHDI_MAINT_{LOCAL,NETWORKPAYLOAD}LOOP Using those maintenance modes we can test the local (DAHDI channel) and remote (trunkdev) sides indepdendent from each other. Change-Id: I12cf9647fb6def38865aaac8ad6bbb58ebf7b5fd --- M drivers/dahdi/trunkdev/trunkdev.c 1 file changed, 64 insertions(+), 8 deletions(-) git pull ssh://gerrit.osmocom.org:29418/dahdi-linux refs/changes/12/34012/1 diff --git a/drivers/dahdi/trunkdev/trunkdev.c b/drivers/dahdi/trunkdev/trunkdev.c index 339b9d0..f185c53 100644 --- a/drivers/dahdi/trunkdev/trunkdev.c +++ b/drivers/dahdi/trunkdev/trunkdev.c @@ -161,6 +161,35 @@ return 0; } +static const char *maint2str(int cmd) +{ + switch (cmd) { + case DAHDI_MAINT_NONE: return "NONE"; + case DAHDI_MAINT_LOCALLOOP: return "LOCALLOOP"; + case DAHDI_MAINT_NETWORKPAYLOADLOOP: return "NETWORKPAYLOADLOOP"; + default: return "UNKNOWN"; + } +} + +static int td_d_maint(struct dahdi_span *span, int cmd) +{ + struct dahdi_trunkdev *td = container_of(span, struct dahdi_trunkdev, dahdi.span); + + switch (cmd) { + case DAHDI_MAINT_NONE: + case DAHDI_MAINT_LOCALLOOP: + case DAHDI_MAINT_NETWORKPAYLOADLOOP: + /* we don't need to do anything, as span->maintstat is set by the core, + * just acknowledge those supported modes here */ + dev_info(&td->dahdi.dev->dev, "Setting maintenance mode to: %s\n", maint2str(cmd)); + break; + default: + return -ENOSYS; + } + return 0; +} + + /* called in hard_irq context with chan_lock held */ static void td_d_sync_tick(struct dahdi_span *span, int is_master) { @@ -178,14 +207,29 @@ uint8_t frame[32]; int rc; - /* Trunk -> DAHDI direction */ - rc = frame_fifo_out(&td->from_trunk, frame); - if (rc >= 0) - _span_demux_one_frame(td, frame); + switch (span->maintstat) { + case DAHDI_MAINT_NONE: + /* Trunk -> DAHDI direction */ + rc = frame_fifo_out(&td->from_trunk, frame); + if (rc >= 0) + _span_demux_one_frame(td, frame); - /* Trunk <- DAHDI direction */ - _span_mux_one_frame(td, frame); - frame_fifo_in(&td->to_trunk, frame); + /* Trunk <- DAHDI direction */ + _span_mux_one_frame(td, frame); + frame_fifo_in(&td->to_trunk, frame); + break; + case DAHDI_MAINT_LOCALLOOP: + /* Loop frame from DAHDI back to itself */ + _span_mux_one_frame(td, frame); + _span_demux_one_frame(td, frame); + break; + case DAHDI_MAINT_NETWORKPAYLOADLOOP: + /* Loop frame from trunkdev back to itself */ + rc = frame_fifo_out(&td->from_trunk, frame); + if (rc >= 0) + frame_fifo_in(&td->to_trunk, frame); + break; + } } /* wake up any processes doing blocking read or waiting in poll */ wake_up_interruptible(&td->waitq); @@ -197,7 +241,7 @@ .chanconfig = td_d_chanconfig, .startup = td_d_startup, .shutdown = td_d_shutdown, - //.maint = td_d_maint, + .maint = td_d_maint, .sync_tick = td_d_sync_tick, }; -- To view, visit https://gerrit.osmocom.org/c/dahdi-linux/+/34012 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: dahdi-linux Gerrit-Branch: master Gerrit-Change-Id: I12cf9647fb6def38865aaac8ad6bbb58ebf7b5fd Gerrit-Change-Number: 34012 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in dahdi-linux[master]: Flush DAHDI->trunkdev FIFO at open time
by laforge 29 Jul '23

29 Jul '23
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/dahdi-linux/+/34011 ) Change subject: Flush DAHDI->trunkdev FIFO at open time ...................................................................... Flush DAHDI->trunkdev FIFO at open time If we don't do this, we always have a full FIFO at the time userspace opens the trunkdev, adding latency for no good reason. Change-Id: Ifbda3766309cc7d6be485073e36607bdd6742f3a --- M drivers/dahdi/trunkdev/frame_fifo.c M drivers/dahdi/trunkdev/frame_fifo.h M drivers/dahdi/trunkdev/trunkdev.c 3 files changed, 26 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/dahdi-linux refs/changes/11/34011/1 diff --git a/drivers/dahdi/trunkdev/frame_fifo.c b/drivers/dahdi/trunkdev/frame_fifo.c index 19b6dba..3b7732f 100644 --- a/drivers/dahdi/trunkdev/frame_fifo.c +++ b/drivers/dahdi/trunkdev/frame_fifo.c @@ -53,6 +53,15 @@ spin_lock_init(&fifo->lock); } +/*! Flush (drop) the entire content of the FIFO */ +void frame_fifo_flush(struct frame_fifo *fifo) +{ + unsigned long flags; + spin_lock_irqsave(&fifo->lock, flags); + fifo->next_out = fifo->next_in; + spin_unlock_irqrestore(&fifo->lock, flags); +} + #define FIFO_BUF_END(f) ((f)->buf + sizeof((f)->buf)) /*! put one received frames into the FIFO. diff --git a/drivers/dahdi/trunkdev/frame_fifo.h b/drivers/dahdi/trunkdev/frame_fifo.h index af02811..b07cddc 100644 --- a/drivers/dahdi/trunkdev/frame_fifo.h +++ b/drivers/dahdi/trunkdev/frame_fifo.h @@ -20,6 +20,8 @@ void (*threshold_cb)(struct frame_fifo *fifo, unsigned int frames, void *priv), void *priv); +void frame_fifo_flush(struct frame_fifo *fifo); + /* number of frames currently available in FIFO */ static inline unsigned int __frame_fifo_frames(struct frame_fifo *fifo) { diff --git a/drivers/dahdi/trunkdev/trunkdev.c b/drivers/dahdi/trunkdev/trunkdev.c index 8375c86..339b9d0 100644 --- a/drivers/dahdi/trunkdev/trunkdev.c +++ b/drivers/dahdi/trunkdev/trunkdev.c @@ -456,6 +456,9 @@ span->alarms &= ~(ALL_RY_ALARMS|DAHDI_ALARM_LOS); dahdi_alarm_notify(span); spin_unlock_irqrestore(&span->lock, flags); + /* FIFO should be full at this point, let's flush it as now we actually + * have a receiver */ + frame_fifo_flush(&td->to_trunk); open.spanno = span->spanno; if (copy_to_user((__user void *) data, &open, sizeof(open))) -- To view, visit https://gerrit.osmocom.org/c/dahdi-linux/+/34011 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: dahdi-linux Gerrit-Branch: master Gerrit-Change-Id: Ifbda3766309cc7d6be485073e36607bdd6742f3a Gerrit-Change-Number: 34011 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • ...
  • 306
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.