This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/19249 ) Change subject: Add new E1DP_CMD_LINE_CONFIG for switching channelized/superchannel ...................................................................... Add new E1DP_CMD_LINE_CONFIG for switching channelized/superchannel This adds the related code to the server and client side of the CTL interface to switch a line between CHANNELIZED and SUPERCHANNEL. Change-Id: I765b5c3bc9e07b2353f8647e8260ff95df3727e6 --- M include/osmocom/e1d/proto.h M include/osmocom/e1d/proto_clnt.h M src/ctl.c M src/proto.c M src/proto_clnt.c 5 files changed, 122 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/include/osmocom/e1d/proto.h b/include/osmocom/e1d/proto.h index 6711332..d8bce1f 100644 --- a/include/osmocom/e1d/proto.h +++ b/include/osmocom/e1d/proto.h @@ -2,6 +2,7 @@ * proto.h * * (C) 2019 by Sylvain Munaut <tnt at 246tNt.com> + * (C) 2020 by Harald Welte <laforge at gnumonks.org> * * All Rights Reserved * @@ -44,6 +45,11 @@ * in: n/a * out: array of osmo_e1dp_ts_info * + * E1DP_CMD_LINE_CONFIG + * filter: intf (required), line (required) + * in: osmo_e1dp_line_config + * out: osmo_e1dp_line_info + * * E1DP_CMD_TS_OPEN * filter: intf (required), line (required), ts (required) * in: osmo_e1dp_ts_config @@ -55,6 +61,7 @@ E1DP_CMD_INTF_QUERY = 0x00, E1DP_CMD_LINE_QUERY = 0x01, E1DP_CMD_TS_QUERY = 0x02, + E1DP_CMD_LINE_CONFIG = 0x03, E1DP_CMD_TS_OPEN = 0x04, E1DP_EVT_TYPE = 0x40, E1DP_RESP_TYPE = 0x80, @@ -62,6 +69,12 @@ E1DP_TYPE_MSK = 0xc0, }; +enum osmo_e1dp_line_mode { + E1DP_LMODE_OFF = 0x00, + E1DP_LMODE_CHANNELIZED = 0x20, + E1DP_LMODE_SUPERCHANNEL = 0x21, +}; + enum osmo_e1dp_ts_mode { E1DP_TSMODE_OFF = 0x00, E1DP_TSMODE_RAW = 0x10, @@ -91,8 +104,13 @@ uint8_t n_lines; } __attribute__((packed)); +struct osmo_e1dp_line_config { + uint8_t mode; +} __attribute__((packed)); + struct osmo_e1dp_line_info { uint8_t id; + struct osmo_e1dp_line_config cfg; uint8_t status; /* TBD */ } __attribute__((packed)); @@ -111,4 +129,5 @@ int osmo_e1dp_send(struct osmo_fd *ofd, struct msgb *msgb, int fd); extern const struct value_string osmo_e1dp_msg_type_names[]; +extern const struct value_string osmo_e1dp_line_mode_names[]; extern const struct value_string osmo_e1dp_ts_mode_names[]; diff --git a/include/osmocom/e1d/proto_clnt.h b/include/osmocom/e1d/proto_clnt.h index 0914de7..ff2cebf 100644 --- a/include/osmocom/e1d/proto_clnt.h +++ b/include/osmocom/e1d/proto_clnt.h @@ -41,6 +41,8 @@ int osmo_e1dp_client_ts_query(struct osmo_e1dp_client *clnt, struct osmo_e1dp_ts_info **ti, int *n, uint8_t intf, uint8_t line, uint8_t ts); +int osmo_e1dp_client_line_config(struct osmo_e1dp_client *clnt, + uint8_t intf, uint8_t line, enum osmo_e1dp_line_mode mode); int osmo_e1dp_client_ts_open(struct osmo_e1dp_client *clnt, uint8_t intf, uint8_t line, uint8_t ts, enum osmo_e1dp_ts_mode mode); diff --git a/src/ctl.c b/src/ctl.c index 5322ab4..4e74485 100644 --- a/src/ctl.c +++ b/src/ctl.c @@ -2,6 +2,7 @@ * ctl.c * * (C) 2019 by Sylvain Munaut <tnt at 246tNt.com> + * (C) 2020 by Harald Welte <laforge at gnumonks.org> * * All Rights Reserved * @@ -87,6 +88,16 @@ _e1d_fill_line_info(struct osmo_e1dp_line_info *li, struct e1_line *line) { li->id = line->id; + switch (line->mode) { + case E1_LINE_MODE_CHANNELIZED: + li->cfg.mode = E1DP_LMODE_CHANNELIZED; + break; + case E1_LINE_MODE_SUPERCHANNEL: + li->cfg.mode = E1DP_LMODE_SUPERCHANNEL; + break; + default: + OSMO_ASSERT(0); + } li->status = 0x00; } @@ -273,6 +284,53 @@ } static int +_e1d_ctl_line_config(void *data, struct msgb *msgb, struct msgb *rmsgb, int *rfd) +{ + struct e1_daemon *e1d = (struct e1_daemon *)data; + struct osmo_e1dp_msg_hdr *hdr = msgb_l1(msgb); + struct osmo_e1dp_line_config *cfg = msgb_l2(msgb); + struct osmo_e1dp_line_info *info; + struct e1_intf *intf = NULL; + struct e1_line *line = NULL; + + /* Process query and find timeslot */ + intf = e1d_find_intf(e1d, hdr->intf); + if (!intf) + return 0; + + line = e1_intf_find_line(intf, hdr->line); + if (!line) + return 0; + + LOGPLI(line, DE1D, LOGL_NOTICE, "Setting line mode from %s to %s\n", + get_value_string(e1_line_mode_names, line->mode), + get_value_string(osmo_e1dp_line_mode_names, cfg->mode)); + /* Select mode */ + switch (cfg->mode) { + case E1DP_LMODE_CHANNELIZED: + line->mode = E1_LINE_MODE_CHANNELIZED; + break; + case E1DP_LMODE_SUPERCHANNEL: + line->mode = E1_LINE_MODE_SUPERCHANNEL; + break; + default: + return 0; + } + + /* Allocate response */ + rmsgb->l2h = msgb_put(rmsgb, sizeof(struct osmo_e1dp_line_info)); + info = msgb_l2(rmsgb); + + memset(info, 0x00, sizeof(struct osmo_e1dp_line_info)); + + /* Fill reponse */ + _e1d_fill_line_info(info, line); + + return 0; +} + + +static int _e1d_ctl_ts_open(void *data, struct msgb *msgb, struct msgb *rmsgb, int *rfd) { struct e1_daemon *e1d = (struct e1_daemon *)data; @@ -355,6 +413,12 @@ .fn = _e1d_ctl_ts_query, }, { + .type = E1DP_CMD_LINE_CONFIG, + .flags = E1DP_SF_INTF_REQ | E1DP_SF_LINE_REQ, + .payload_len = sizeof(struct osmo_e1dp_line_config), + .fn = _e1d_ctl_line_config, + }, + { .type = E1DP_CMD_TS_OPEN, .flags = E1DP_SF_INTF_REQ | E1DP_SF_LINE_REQ | E1DP_SF_TS_REQ, .payload_len = sizeof(struct osmo_e1dp_ts_config), diff --git a/src/proto.c b/src/proto.c index 85f5115..479175a 100644 --- a/src/proto.c +++ b/src/proto.c @@ -46,6 +46,12 @@ { E1DP_ERR_TYPE, "ERR_TYPE" }, { 0, NULL } }; +const struct value_string osmo_e1dp_line_mode_names[] = { + { E1DP_LMODE_OFF, "OFF" }, + { E1DP_LMODE_CHANNELIZED, "CHANNELIZED" }, + { E1DP_LMODE_SUPERCHANNEL, "SUPERCHANNEL" }, + { 0, NULL } +}; const struct value_string osmo_e1dp_ts_mode_names[] = { { E1DP_TSMODE_OFF, "OFF" }, { E1DP_TSMODE_RAW, "RAW" }, diff --git a/src/proto_clnt.c b/src/proto_clnt.c index 7c6df27..ca62abe 100644 --- a/src/proto_clnt.c +++ b/src/proto_clnt.c @@ -2,6 +2,7 @@ * proto_clnt.c * * (C) 2019 by Sylvain Munaut <tnt at 246tNt.com> + * (C) 2020 by Harald Welte <laforge at gnumonks.org> * * All Rights Reserved * @@ -285,6 +286,36 @@ } int +osmo_e1dp_client_line_config(struct osmo_e1dp_client *clnt, + uint8_t intf, uint8_t line, enum osmo_e1dp_line_mode mode) +{ + struct msgb *msgb; + struct osmo_e1dp_msg_hdr hdr; + struct osmo_e1dp_line_config cfg; + int rc; + + memset(&hdr, 0x00, sizeof(struct osmo_e1dp_msg_hdr)); + hdr.type = E1DP_CMD_LINE_CONFIG; + hdr.intf = intf; + hdr.line = line; + hdr.ts = E1DP_INVALID; + + memset(&cfg, 0x00, sizeof(struct osmo_e1dp_line_config)); + cfg.mode = mode; + + rc = _e1dp_client_query_base(clnt, &hdr, &cfg, sizeof(struct osmo_e1dp_line_config), &msgb, NULL); + if (rc) + return rc; + + if (msgb_l2len(msgb) != sizeof(struct osmo_e1dp_line_info)) + return -EPIPE; + + msgb_free(msgb); + + return 0; +} + +int osmo_e1dp_client_ts_open(struct osmo_e1dp_client *clnt, uint8_t intf, uint8_t line, uint8_t ts, enum osmo_e1dp_ts_mode mode) -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/19249 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I765b5c3bc9e07b2353f8647e8260ff95df3727e6 Gerrit-Change-Number: 19249 Gerrit-PatchSet: 5 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-Reviewer: tnt <tnt at 246tNt.com> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200715/340b2c8d/attachment.htm>