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
This commit is contained in:
parent
5706083138
commit
6473bf0fe0
|
@ -71,6 +71,7 @@ enum osmo_e1dp_ts_mode {
|
|||
|
||||
#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"
|
||||
|
||||
|
|
|
@ -68,7 +68,12 @@ e1_intf_find_line(struct e1_intf *intf, uint8_t id)
|
|||
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
|
||||
|
|
13
src/e1d.h
13
src/e1d.h
|
@ -55,15 +55,28 @@ struct e1_ts {
|
|||
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 {
|
||||
|
|
|
@ -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 @@ e1_intf_destroy(struct e1_intf *intf)
|
|||
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 @@ e1_line_new(struct e1_intf *intf, void *drv_data)
|
|||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue