laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/19229 )
Change subject: introduce concept of superchannel to data structures ...................................................................... introduce concept of superchannel to data structures We treat the superchannel as an extra, separate timeslot. Initially I thought of simply re-using TS1, but keeping the superchannel separate ensures that it doesn't inherit any state (like half-sent HDLC frames) from another timeslot when we switch between the modes at runtime. Change-Id: I0aacf251e155de2bb6ad03ffc4181067b22f1c90 --- M include/osmocom/e1d/proto.h M src/ctl.c M src/e1d.h M src/intf_line.c 4 files changed, 33 insertions(+), 6 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve tnt: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/e1d/proto.h b/include/osmocom/e1d/proto.h index 56064b8..6711332 100644 --- a/include/osmocom/e1d/proto.h +++ b/include/osmocom/e1d/proto.h @@ -71,6 +71,7 @@ #define E1DP_MAGIC 0x00e1 #define E1DP_MAX_LEN 4096 +#define E1DP_TS_SUPERCHAN 0xfe #define E1DP_INVALID 0xff #define E1DP_DEFAULT_SOCKET "/tmp/osmo-e1d.ctl" diff --git a/src/ctl.c b/src/ctl.c index 482366f..5322ab4 100644 --- a/src/ctl.c +++ b/src/ctl.c @@ -68,7 +68,12 @@ static struct e1_ts * _e1d_get_ts(struct e1_line *line, uint8_t ts) { - return (ts < 32) ? &line->ts[ts] : NULL; + if (ts < 32) + return &line->ts[ts]; + else if (ts == E1DP_TS_SUPERCHAN) + return &line->superchan; + else + return NULL; } static void diff --git a/src/e1d.h b/src/e1d.h index f556e8f..2b8e32b 100644 --- a/src/e1d.h +++ b/src/e1d.h @@ -55,15 +55,28 @@ int fd; }; +enum e1_line_mode { + /* 31 individual 64k timeslots, as used on 3GPP Abis, 3GPP A or ISDN */ + E1_LINE_MODE_CHANNELIZED, + /* 1 channel group spanning all 31 TS, as used e.g. when using Frame Relay + * or raw HDLC over channelized E1. */ + E1_LINE_MODE_SUPERCHANNEL, +}; + struct e1_line { struct llist_head list; struct e1_intf *intf; uint8_t id; + enum e1_line_mode mode; + void *drv_data; + /* timeslots for channelized mode */ struct e1_ts ts[32]; + /* superchannel */ + struct e1_ts superchan; }; enum e1_driver { diff --git a/src/intf_line.c b/src/intf_line.c index e206f76..421c528 100644 --- a/src/intf_line.c +++ b/src/intf_line.c @@ -33,6 +33,7 @@ #include <osmocom/core/isdnhdlc.h> #include <osmocom/core/utils.h> +#include <osmocom/e1d/proto.h> #include "e1d.h" #include "log.h" @@ -90,6 +91,14 @@ talloc_free(intf); } +static void +_ts_init(struct e1_ts *ts, struct e1_line *line, int id) +{ + ts->line = line; + ts->id = id; + ts->fd = -1; +} + struct e1_line * e1_line_new(struct e1_intf *intf, void *drv_data) { @@ -100,12 +109,11 @@ line->intf = intf; line->drv_data = drv_data; + line->mode = E1_LINE_MODE_CHANNELIZED; - for (int i=0; i<32; i++) { - line->ts[i].line = line; - line->ts[i].id = i; - line->ts[i].fd = -1; - } + for (int i=0; i<32; i++) + _ts_init(&line->ts[i], line, i); + _ts_init(&line->superchan, line, E1DP_TS_SUPERCHAN); INIT_LLIST_HEAD(&line->list); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/19229 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I0aacf251e155de2bb6ad03ffc4181067b22f1c90 Gerrit-Change-Number: 19229 Gerrit-PatchSet: 5 Gerrit-Owner: laforge <lafo...@osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <lafo...@osmocom.org> Gerrit-Reviewer: pespin <pes...@sysmocom.de> Gerrit-Reviewer: tnt <t...@246tnt.com> Gerrit-MessageType: merged