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 uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/19346 ) Change subject: make RAW read buffer size configurable (instead of hard-coded 160) ...................................................................... make RAW read buffer size configurable (instead of hard-coded 160) When opening a timeslot, the client can now specify the (from application perspective) timeslot read buffer size. This breaks ABI, but then we're still at a point where only prototype hardware exists, so we can get away with it. Change-Id: I6d603778cce14c5d72fe5f54904905ea7e66d7ff --- M include/osmocom/e1d/proto.h M include/osmocom/e1d/proto_clnt.h M src/ctl.c M src/e1d-ts-pipe.c M src/proto_clnt.c 5 files changed, 19 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/46/19346/1 diff --git a/include/osmocom/e1d/proto.h b/include/osmocom/e1d/proto.h index d8bce1f..304db94 100644 --- a/include/osmocom/e1d/proto.h +++ b/include/osmocom/e1d/proto.h @@ -116,6 +116,7 @@ struct osmo_e1dp_ts_config { uint8_t mode; + uint16_t read_bufsize; } __attribute__((packed)); struct osmo_e1dp_ts_info { diff --git a/include/osmocom/e1d/proto_clnt.h b/include/osmocom/e1d/proto_clnt.h index ff2cebf..5a4f965 100644 --- a/include/osmocom/e1d/proto_clnt.h +++ b/include/osmocom/e1d/proto_clnt.h @@ -45,4 +45,4 @@ 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); + enum osmo_e1dp_ts_mode mode, uint16_t read_bufsize); diff --git a/src/ctl.c b/src/ctl.c index d62195a..fee96f8 100644 --- a/src/ctl.c +++ b/src/ctl.c @@ -138,7 +138,7 @@ } static int -_e1d_ts_start(struct e1_ts *ts, enum e1_ts_mode mode) +_e1d_ts_start(struct e1_ts *ts, enum e1_ts_mode mode, uint16_t bufsize) { int ret, sd[2]; int sock_type; @@ -151,7 +151,7 @@ break; case E1_TS_MODE_RAW: sock_type = SOCK_STREAM; - _e1d_ts_raw_buf_realloc(ts, 160); /* TODO: make configurable */ + _e1d_ts_raw_buf_realloc(ts, bufsize); break; default: return -EINVAL; @@ -383,11 +383,14 @@ return 0; } + if (cfg->read_bufsize == 0) + return 0; + /* If already open, close previous */ e1_ts_stop(ts); /* Init */ - ret = _e1d_ts_start(ts, mode); + ret = _e1d_ts_start(ts, mode, cfg->read_bufsize); if (ret < 0) return ret; diff --git a/src/e1d-ts-pipe.c b/src/e1d-ts-pipe.c index 6d3ec80..bae45de 100644 --- a/src/e1d-ts-pipe.c +++ b/src/e1d-ts-pipe.c @@ -44,9 +44,9 @@ static int ts_open(uint8_t intf_nr, uint8_t line_nr, uint8_t ts_nr, - enum osmo_e1dp_ts_mode mode) + enum osmo_e1dp_ts_mode mode, uint16_t bufsize) { - int rc = osmo_e1dp_client_ts_open(g_client, intf_nr, line_nr, ts_nr, mode); + int rc = osmo_e1dp_client_ts_open(g_client, intf_nr, line_nr, ts_nr, mode, bufsize); if (rc < 0) fprintf(stderr, "Cannot open e1d timeslot %u:%u:%u\n", intf_nr, line_nr, ts_nr); return rc; @@ -122,6 +122,7 @@ int intf_nr = -1, line_nr = -1, ts_nr = -1; enum osmo_e1dp_ts_mode mode = E1DP_TSMODE_RAW; char *path = E1DP_DEFAULT_SOCKET; + int bufsize = 160; int tsfd; int option_index, rc; @@ -141,10 +142,11 @@ { "timeslot", 1, 0, 't' }, { "mode", 1, 0, 'm' }, { "read", 1, 0, 'r' }, + { "read-bufsize", 1, 0, 'b' }, { 0,0,0,0 } }; - c = getopt_long(argc, argv, "hp:i:l:t:m:r:", long_options, &option_index); + c = getopt_long(argc, argv, "hp:i:l:t:m:r:b:", long_options, &option_index); if (c == -1) break; @@ -180,6 +182,9 @@ } infd = rc; break; + case 'b': + bufsize = atoi(optarg); + break; } } @@ -194,7 +199,7 @@ exit(1); } - tsfd = ts_open(intf_nr, line_nr, ts_nr, mode); + tsfd = ts_open(intf_nr, line_nr, ts_nr, mode, bufsize); if (tsfd < 0) exit(2); diff --git a/src/proto_clnt.c b/src/proto_clnt.c index ca62abe..69c7234 100644 --- a/src/proto_clnt.c +++ b/src/proto_clnt.c @@ -318,7 +318,7 @@ 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) + enum osmo_e1dp_ts_mode mode, uint16_t read_bufsize) { struct msgb *msgb; struct osmo_e1dp_msg_hdr hdr; @@ -333,6 +333,7 @@ memset(&cfg, 0x00, sizeof(struct osmo_e1dp_ts_config)); cfg.mode = mode; + cfg.read_bufsize = read_bufsize; tsfd = -1; -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/19346 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: I6d603778cce14c5d72fe5f54904905ea7e66d7ff Gerrit-Change-Number: 19346 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200720/9ef5bb28/attachment.htm>