Commit graph

49 commits

Author SHA1 Message Date
Trung Trang
0f7d3b6f71 mpm: rpc server: Remove disable_commit for init()
The async calls to long C++ methods allows the claimer loop to smoothly
continue during init, so this hack is no longer necessary.
2018-04-30 14:36:29 -07:00
Trung Trang
bd14776500 mpm: rpc server: Increase claim timeout to 5 seconds
Usually, the current timeout is fine, but there are cases when a lot of
RPC traffic could drown out the reclaim calls. 5 seconds is an
experimentally derived safe value.
2018-04-30 14:36:29 -07:00
Trung N Tran
6e66bd7d7b mpm: increase timeout interval for claiming 2018-04-02 14:57:21 -07:00
Trung N Tran
4e34d35ec4 mpm: improve logging on exception 2018-03-30 11:05:53 -07:00
Martin Braun
86b95486ed mpm: Add INFO log statements on MPM reset and component update 2018-03-13 16:19:03 -07:00
Martin Braun
725debb964 mpm: Rename n310 to n3xx
This module (and class) are, in fact, used for all N3xx-derivates so
renaming it is the more correct thing to do.
2018-03-05 15:56:41 -08:00
Martin Braun
d04b6e3a62 mpm: uhd: RPC server reports MPM version, uhd_usrp_probe reads it 2018-03-02 13:48:14 -08:00
Brent Stapleton
94aedfd2d9 mpm: adding get_component_info
Add getter function for updateable component information. This is a
minor compat number bump.
2018-02-19 16:58:52 -08:00
Martin Braun
e9288a439c mpm: Update all license headers
- Fix typo in company name (missing 'a')
- Updated SPDX license identifier to version 3.0
2018-02-19 16:55:08 -08:00
Martin Braun
832cbe095a mpm: Use prefs API for periph manager
- Allow to set default args via config file
- Read them from prefs API
- override-db-pids uses the same APIs now ([overrides] section in
  config file, prefs API, and same dictionary as --default-args when
  used on the command line
2018-02-08 22:18:14 +01:00
Martin Braun
0d73d8ab81 mpm: rpc_server: Declare local connection for *all* local IPs
Before, it was possible to trick the RPC server in believing a
connection was remote when the incoming connection was from a local IP
address that was not 127.0.0.1.
2018-02-07 13:46:53 -08:00
Martin Braun
4c81ed0a5d fixup! mpm: Log timeouts during API calls, reset timer on claimed calls 2018-01-23 15:21:28 -08:00
Martin Braun
f83f6fb464 mpm: Log timeouts during API calls, reset timer on claimed calls
Reviewed-by: Trung Tran <trung.tran@ettus.com>
2018-01-22 15:36:13 -08:00
Martin Braun
1400004154 mpm: Update unclaim timeout logic
- Allow configurable timeout values from the command line
- Add flag to disable timeouts for long calls; this fixes the case
  where reclaimers re-initialize a disabled timer
- Add methods for timeout event for better tracking
2018-01-18 18:26:55 -08:00
Martin Braun
40c5b598c0 mpm: Refactored RPC server
- No functional changes
- Grouped methods by function
- Improved some comments
2018-01-17 10:44:50 -08:00
Martin Braun
66d0257b2e mpm: Enable systemd watchdog and update it from MPM
- Updated systemd service file
- Added health status flag in shared data object
- Added thread in RPC process to update watchdog

Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
2018-01-15 10:45:07 -08:00
Martin Braun
410e87e282 mpm: Add API call for claim and unclaim
These are hooks that the RPC server calls into when claiming a device,
and allow the device implementation to trigger user-definable actions
on claiming/unclaiming.
2018-01-10 17:31:21 -08:00
Martin Braun
0691c5ea75 mpm: Spawn periph manager inside the RPC process
Reviewed-by: Brent Stapleton <brent.stapleton@ettus.com>
2018-01-10 17:29:49 -08:00
Martin Braun
121c37751c mpm: Add API to read back log buffer
Reviewed-by: Brent Stapleton <brent.stapleton@ettus.com>
2018-01-08 11:48:25 -08:00
Brent Stapleton
a927a364c5 mpm: mpmd: Add MPM compat number check
Reviewed-by: Martin Braun <martin.braun@ettus.com>
2017-12-22 15:05:58 -08:00
Martin Braun
0c94fff330 mpm: rpc_server: Unregister old RPC calls _init_rpc_calls()
On FPGA loads, when the periph_manager is respawned, this will now
clear the previously registered methods.

Reviewed-By: Brent Stapleton <brent.stapleton@ettus.com>
2017-12-22 15:05:58 -08:00
Martin Braun
20160e8061 mpm: rpc_server: Fix use of to_binary_str()
Reviewed-By: Brent Stapleton <brent.stapleton@ettus.com>
2017-12-22 15:05:58 -08:00
Martin Braun
8815098747 mpm: Harmonize all license header
Now uses SPDX headers everywhere.
2017-12-22 15:05:58 -08:00
Brent Stapleton
0bf22a3e57 mpm: UIOs now open only when necessary
Refactoring to use the C++-based UIO objects. The Liberio and Ethernet
objects now open the UIO before using it, and close it once done.

Reviewed-By: Martin Braun <martin.braun@ettus.com>
2017-12-22 15:05:58 -08:00
Martin Braun
d3e6dd1140 mpm: Harmonize imports, tidy + sort modules
- Moved nijesdcore to cores/
- Moved udev, net, dtoverlay, uio to sys_utils/
- Made all imports non-relative (except in __init__.py files)
- Removed some unnecessary imports
- Reordered some imports for Python conventions
2017-12-22 15:05:58 -08:00
Martin Braun
b3662efeb3 mpm: Add temporary failure for FPGA reload
Note: This is subject to removal, but makes the FPGA reloading code
available to all until we fix the reload bug.
2017-12-22 15:05:57 -08:00
Brent Stapleton
19cdfb4148 mpm: Reset periph manager on update
Upon updating certain components (the FPGA, for example), the
Peripheral Manager is restarted, and the overlay is reapplied. In order
to facilitate this, the RPC server intercepts and handles the
update_component function.

Tested on the RJ45 ethernet connection. It probably won't work as well
if the SFP connection goes down when the overlay is removed.
2017-12-22 15:05:57 -08:00
Martin Braun
b12b9465ed mpm/mpmd: Move to request_xport()/commit_xport() architecture
This commit combines code from various branches to finally enable both
UDP and Liberio transports.
2017-12-22 15:05:06 -08:00
Martin Braun
fb5e10a8e4 mpm: Cache connection type in PeriphManagerBase
Now, when claiming a device, the connection type will be stored as a
string in PeriphManagerBase. This way we can read out the current
connection type even when not currently inside an RPC call.
2017-12-22 15:05:05 -08:00
Martin Braun
16da5da375 mpm: Remove leading _ from _get_device_info()
Use @norpc instead. This fixes some linting issues.
2017-12-22 15:05:05 -08:00
Martin Braun
bcf3f28e15 mpm: Improve exception/error handling
- Any RPC call with uncaught exceptions will result in additional
  logging on MPM side
- Adds get_last_error() API call
- get_last_error() is populated by various methods within rpc_server.py,
  but also from every uncaught exception
2017-12-22 15:05:05 -08:00
Brent Stapleton
2196878439 mpm: server supports binary strings being sent across rpc 2017-12-22 15:04:03 -08:00
Martin Braun
d711ad4c93 mpm: RPC methods now tell us if they need a claim
On the RPC server side, we keep track of which methods require a claim
token. MPM shell uses this info to automatically add claim tokens when
required.
2017-12-22 15:04:00 -08:00
Martin Braun
8063697d68 mpm: Check rpc server has matching lock release/acquires 2017-12-22 15:04:00 -08:00
Martin Braun
40235b8c5a mpm/mpmd: Call init() during UHD session init, not on hwd spawn 2017-12-22 15:03:59 -08:00
Martin Braun
797b61a3fb mpm: RPC servers own methods can no longer be overwritten 2017-12-22 15:03:59 -08:00
Martin Braun
4b9e07629d mpm: Improved token checking in RPC server 2017-12-22 15:03:58 -08:00
Martin Braun
664f471baf mpm: Addition Py3k fixes, all related to string/UTF-8/ascii differences
- Also fixed some error handling in various cases
2017-12-22 15:03:58 -08:00
Martin Braun
6183d9eeaa mpm: Made code Python3-compatible 2017-12-22 15:03:58 -08:00
Martin Braun
5dcaffcd0b mpm: RPC server now provides decorators for no token and no RPC
- Also token length is now variable, and 16 characters
2017-12-22 15:03:58 -08:00
Martin Braun
0a9632ad39 mpm: RPC server unitializes a device when claim is lost 2017-12-22 15:03:53 -08:00
Martin Braun
4efea95324 mpm: Enabled mboard EEPROM readout 2017-12-22 15:03:53 -08:00
Martin Braun
1b27c16dd3 mpm: Updating ref clock frequency will propagate to dboard, changed slot indexing to numbers 2017-12-22 15:03:52 -08:00
Martin Braun
285f14392b mpm: Moved over to new logging infrastructure
Also currently hardcodes some settings.
2017-12-22 15:03:45 -08:00
Andrej Rode
7f71111988 mpm: comment out functionality to make it work
- add uio udev find routine
 - add debug prints

Signed-off-by: Andrej Rode <andrej.rode@ettus.com>
Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
2017-12-22 15:03:45 -08:00
Andrej Rode
6a12add156 mpm: mpm reorganization 2017-12-22 15:03:45 -08:00
Andrej Rode
8ac9014d5c mpm: CMake cleanup, Python code enhancements
- Send user defined data in ping
- Improve rpc_shell, add mpm_debug.py, fix tracebacks in multiprocessing
2017-12-22 15:03:44 -08:00
Andrej Rode
ef6326a174 mpm: python refactoring 2017-12-22 15:03:44 -08:00
Martin Braun
1a4348038d Initial commit for N3xx development.
- Creates mpm/ subdirectory
- First pass at hardware daemon/MPM
- New code for LMK04828, AD9371
- spidev integration

Contributions by:

Martin Braun <martin.braun@ettus.com>
Derek Kozel <derek.kozel@ettus.com>
Mark Meserve <mark.meserve@ni.com>
Andrej Rode <andrej.rode@ettus.com>
2017-12-22 15:03:44 -08:00