Commit Graph

31 Commits

Author SHA1 Message Date
Harald Welte e324507676 OCTOI: initial support for E1oIP forwarding
This introduces initial support for operation as OCTOI (Osmocom
Community TDMoIP) server and client operation.

Various features are still absent (user authentication, support for
re-ordered packets), but this version is already able to provide
services to clients with dynamic IP addresses as well as servers.

The bulk of the OCTOI / E1oIP code is implemented as a shared library,
to facilitate the development of other servers and clients in the
future, and also to minimize the impact on the existing osmo-e1d code
base.

More information is available at https://osmocom.org/projects/octoi/wiki

Change-Id: I05f5ff697ca8f7dccdcf89660f12089babfcc92e
2022-03-28 12:26:09 +02:00
Harald Welte f18dcc706f usb: rename 'size' to 'len' in callback functions
What we are passing is not the [underlying] size of the buffer, but
the length of the valid data in them.

Change-Id: I8ce91527351a56c103bd077c9565be2a81d175ac
2022-03-27 17:14:49 +02:00
Harald Welte 8e3924db25 Proper libusb error reporting in all error paths
... using libusb_strerror().

Change-Id: Id205f1cf1bbccd83b789f8ab31fe1d5d4e1fb8a9
2022-02-07 18:38:08 +01:00
Harald Welte 7bc8404f63 GPS-DO support for icE1usb hardware
This adds support for monitoring the GPS-DO that is built-in to the
icE1usb device.  It assumes a very recent firmware with GPS-DO control
moved to a separate USB interface, i.e. after osmo-e1-hardware.git
Change-Id Icd6555a14896c38626fb147b78af44ff719f2254 is merged.

Change-Id: If5e2a6b2dae0290ce3186009e68f618049ebf5ff
2022-02-07 18:38:08 +01:00
Harald Welte f5362e9217 Allow configuration of interfaces/lines via VTY
So far, osmo-e1d automatically opened all compatible icE1usb devices
and all E1 lines on those interfaces.  Let's allow for 'interface' and
'line' configuration in the VTY.  USB devices can be identified by
their serial number string.

If a given device (== E1 interface)  has a VTY configuration, then only
those E1 lines with VTY configuration opened.

For each Line (icE1usb or vpair), the mode (channelized/superchannel)
can also be set via VTY.

Change-Id: I89b57b688b68901f87d9683ab9294772ee747d77
Closes: OS#5400
2022-02-01 17:17:31 +00:00
Harald Welte ef69fd1a63 e1_{intf,line}_new: Allow caller to specify the numeric identifier
This will be used by the upcoming VTY interface changes.

Change-Id: I9ff80831a3e3e3cb6dae178f8b438a9f3f4747df
2022-01-31 19:51:14 +01:00
Harald Welte c6246b654b usb: Use libusb_status_str when logging INT EP error
Change-Id: I3a3cd88ba35796740dbd399eb618617941dae54a
2022-01-10 11:00:06 +01:00
Harald Welte a3ff181a82 usb: Print failed USB isochronous packets
Change-Id: Ib6fcf46be40d47817632ccae4e742d6cf7340cda
2022-01-10 11:00:03 +01:00
Harald Welte 3fff68cbf8 cosmetic: Adhere osmocom coding style in for-loops
We either have to bring osmo-e1d in line with other osmocom projects,
or we'd have to disable the linter in jenkins.

Change-Id: I74ab20b22118d471dcdb60d1b9681ab62eb13d51
2022-01-09 23:39:42 +01:00
Sylvain Munaut 0d2a42bc12 usb: Add warning for error during interrupt transfers
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Id4d2c95a2d934700f817e971aa4ce29e4bd85675
2022-01-09 11:43:03 +01:00
Sylvain Munaut 73d7184088 Fix a bunch of warning raised by the new build warning options
A lot of them are related to signedness or type range limitation.
A lot are not actual issues and work find in practice, but a few
lead to actual bad behavior.

This makes all the conversion explicit to mark intent.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I992b9bc51659e85966651b1146091501b8f149f5
2022-01-09 11:43:01 +01:00
Sylvain Munaut 3bea0bcedc e1d/usb: Use wMaxPacketSize to know maximum number of frames to send
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I9595cba39377e45303d41a06753861bf72d5a93a
2022-01-06 16:10:28 +01:00
Sylvain Munaut 4b1226f5ac e1d/usb: Limit feedback EP transfer size to 3
Newer descriptors have the max packet size set to 3 to save on
isochronous bandwidth.

By specs, the feed back endpoints transfer are 24 bits anyway,
so no point is using anything larger.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: I09e259db539e62571fd17fc16ffaa317564ba257
2022-01-06 16:10:26 +01:00
Harald Welte d1d6d93f2e Add support for icE1usb RAI interrupt error flag
In osmo-e1-hardware.git Change-Id Ic4f57cf79bd32cf75f81ef3073cb8d4a2d1857d8
we added support for passing RAI (remote alarm indication) as a flag via
the USB interrupt messages; let's add support for this here.

osmo-e1d already internally parses TS0 to determine the same
information, and we have to keep this for backwards-compatibility with
older firmware builds.  But maybe at some future point we can remove
our own TS0 scanning code here and rely on the USB device to inform
us about remote alarms.

Change-Id: Ie1994968e792c37f9272b9854547db95a41cab5b
2022-01-02 13:04:09 +01:00
Harald Welte 890e153170 update ice1usb_proto.h to current master
Copy from firmware source code repo at
https://git.osmocom.org/osmo-e1-hardware/tree/firmware/ice40-riscv/icE1usb/ice1usb_proto.h
as of d376b2e852fbf26a60ac4d6f66e54bb85f0b7204

Change-Id: I8f7b9462482421993e3516aa9d0794bb8076b65b
2021-12-31 20:35:19 +01:00
Harald Welte 31ac0bea55 Evaluate received E and A bits in TS0
Related: OS#4917
Change-Id: I7e1c919518b3418e973b7ae5bedd5a6dd1c2adec
2021-01-05 23:46:02 +01:00
Harald Welte d270f73d66 usb.c: Mark _e1_usb_open_device() as static
Change-Id: Ic4ac2b77f12479daa52392cc31ca1e7d9ed96567
2020-12-20 11:45:44 +01:00
Harald Welte 9408fc3839 support for control endpoint requests to icE1usb to switch Rx/Tx mode
Change-Id: I62f3175a216eb5db0847f4b16c91bc23697a7623
2020-12-20 11:45:44 +01:00
Harald Welte 8f3064a2c8 Add per-line rate counter group to count various errors
Change-Id: I766b717843d7cd8ac00d4ce18c38773ac50ec3e6
2020-12-20 11:45:44 +01:00
Harald Welte a74aaf172c Add support for icE1usb interrupt endpoint error reporting
Related: OS#4674
Change-Id: I5b0bf3cf40c623c17f2e88292e880b545c36b7b6
Depends: osmo-e1-hardware If157fde9d4ca05910b09537e19f37603c6d925f0
2020-12-20 11:29:59 +01:00
Harald Welte 515be330cb usb: Increase number of transfers from 2 to 4
Experimentally this has shown a much lower probability of
USB related overruns/underruns, at least on my system.

Change-Id: I5c73b29462a4870d3c86fd7f46e1574daae6f93f
2020-12-19 18:27:41 +01:00
Harald Welte 51e12ad603 usb: Don't pass negative length values to e1_line_demux_in()
every so often, the USB transfer completes without data (due to
"unlucky" time alignment between E1 and USB frame clock).  Don't
call the demuxer in that case.

Otherwise the user is confused by error messages like

<0001> intf_line.c:467 (I0:L0) IN ERROR: -4

Change-Id: Ia99f97c2cca44d15a83a54cebe884b343ec44f46
2020-09-01 09:37:33 +02:00
Harald Welte 80df1a9fb2 usb.c: Fix error introducing Tx underflows
In Change-Id I7d4d4ab39cb3e7e6a7eb8e738a367122eb3fbee2 I inroduced
a bug that would cause e1_usb_xfer_out() to return four bytes too
little, which in turn causes E1 Tx underflows to happen in the device
firmware.

Change-Id: I71675d4de781421286f0d1febedfdb1f7b523c38
2020-07-09 20:57:07 +00:00
Harald Welte 3e5741352e migrate to proper allocated USB Product ID
The 0xe1e1 was a neat hack in the early days, but now 0x6145 has been
allocated within the Openmoko USB VendorID.    The current device
firmware already uses the new ProductID, let's change it here, too.

Change-Id: Iea6087ce02c931c796d9c9cae89cdf5b5e0b28c5
2020-07-09 20:54:50 +00:00
Harald Welte 4b1f06a47f Always log context (interface/line/timeslot) when available
We always want to know as much context as possible.  Which exact
timeslot on which line of which interface ha logged something?

Change-Id: I3d8909b396928ed3c023b8ac47fa9ec72c99e681
2020-06-29 23:09:27 +02:00
Harald Welte 9bedf75f2b introduce notion of 'driver'
Change-Id: Ic168e25f2622b397bac2c133ec35f4a0a38f859b
2020-06-29 22:12:42 +02:00
Harald Welte 946eaba82b move from printf() debug output to libosmocore logging
Change-Id: I6b652554c472c0fa7d180b533ef1ed4b92b49ab9
2020-06-29 17:19:14 +02:00
Harald Welte 7f08470706 remove code not specific to USB from usb.c to intf_line.c
Change-Id: I7d4d4ab39cb3e7e6a7eb8e738a367122eb3fbee2
2020-06-29 17:19:13 +02:00
Harald Welte 8db1624323 port to new libosmousb
libosmousb, recently introduced to libosmocore.git, is taking care
of main loop integration of libusb into osmo_select_main().  This
means we don't need to do any polling here anymore.

Change-Id: I3f3b61dfa217d6ef8c17970b2cf1cc627bb13bbe
2020-01-06 17:37:07 +01:00
Sylvain Munaut bb1f1997b1 usb: Temporarily mark e1uf_destroy as 'unused'
The code is not 100% finished yet and ATM flow destructions isn't
handled ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-07-10 15:40:42 +02:00
Sylvain Munaut cf189940be Initial code import
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-05-11 22:31:12 +02:00