Commit Graph

39 Commits

Author SHA1 Message Date
Martin Braun
3eb6fe492a uhd: Remove usage of boost::optional
- boost::optional is replaced by std::optional
- In public APIs, boost::optional is still usable, but it is declared
  deprecated. That means this is no API break (but it is an ABI break).
- Within the library portion (host/lib/**) there is no more usage of
  boost::optional. Some backward-compatibility code (in actions.cpp and
  ctrlport_endpoint.cpp) was moved out to the header.

Note: The most difficult replacement was that for
parse_log_level_from_string(), where boost::optional is the return
value. To retain API compatibility, we had to create a helper function.
2026-05-05 14:41:39 +02:00
Martin Braun
2d430f98c3 mpm: Add rpc_version key in device find routine
This adds a new key to the discovery information coming from MPM
devices (rpc_version). The purpose of this is to smooth a transition to
alternative RPC subsystems other than mprpc.

If a device reports a different RPC version than supported by UHD, it
can still be found, but cannot be used for UHD sessions.
2026-04-09 10:23:59 +02:00
Grant Meyerhoff
43f48152a3 mpmd: allow for mpm device to tell host to reboot mpm 2023-09-06 10:09:36 -05:00
Martin Braun
107a49c0c2 host: Update code base using clang-tidy
The checks from the new clang-tidy file are applied to the source tree
using:

$ find . -name "*.cpp" | sort -u | xargs \
    --max-procs 8 --max-args 1 clang-tidy --format-style=file \
    --fix -p /path/to/compile_commands.json
2021-03-04 08:07:26 -06:00
Martin Braun
124ed644ee mpmd: Export RPC token and mb_args to the property tree
There are applications (typically for debugging purposes) which need
access to the token and the mb_args. They are thus published via the
property tree.
2020-12-04 12:06:14 -08:00
Samuel O'Brien
00c306d5c4 sim: Integrate simulator into UHD
This commit adds a device::register_device which allows uhd to start up
a simulator when uhd is called with the arguments type=sim. Creating the
device object creates a subprocess using pybind and an embedded
interpreter, and destroying the object cleans up those subprocesses.

Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
2020-10-28 15:25:48 -05:00
Martin Braun
876d4150aa uhd: Apply clang-format against all .cpp and .hpp files in host/
Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of
files that clang-format gets applied against.
2020-03-03 08:51:32 -06:00
Martin Braun
c256b9df65 x300/mpmd: Port all RFNoC devices to the new RFNoC framework
Co-Authored-By: Alex Williams <alex.williams@ni.com>
Co-Authored-By: Sugandha Gupta <sugandha.gupta@ettus.com>
Co-Authored-By: Brent Stapleton <brent.stapleton@ettus.com>
Co-Authored-By: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
2019-11-26 12:16:25 -08:00
Sugandha Gupta
fe3fa1dd31 device3: Constraint send/recv_frame_size based on down/upstream MTU
We need to properly contraint the send/recv_frame_size based on the
minimum MTU of all the down/upstream blocks. This fixes the issue with
E310 tx/rx streaming as it has smaller MTU sizes than the other usrps.
2019-05-01 15:17:23 -07:00
Martin Braun
a272da1d65 mpmd: Allow reclaim failures on component updates
MPM has a flag that identifies component reloads as requiring to restart
the RPC server. This change honours that flag, and doesn't cause a fatal
failure when reclaims fail to ack for certain operations.

For example, running uhd_image_loader on an N310 could fail after the
FPGA was reloaded because the communication to the RPC server was
temporarily interrupted. This is not always avoidable, since the RPC
server does actually go down, and Ethernet connections might also be
lost. So, we cut our losses and accept failures in that case.
2019-02-22 16:12:23 -08:00
Trung Tran
66bfc90c27 mpmd: implement get_*x_hints
Fix transport related arguments passed down the stack.
2019-01-21 14:44:02 -08:00
Brent Stapleton
967be2a4e8 uhd: mpm: apply clang-format to all files
Applying formatting changes to all .cpp and .hpp files in the following
directories:
```
find host/examples/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/tests/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/dboard/neon/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/dboard/magnesium/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/device3/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/mpmd/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/x300/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/utils/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find mpm/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
```

Also formatted host/include/, except Cpp03 was used as a the language
standard instead of Cpp11.
```
sed -i 's/ Cpp11/ Cpp03/g' .clang-format
find host/include/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
```

Formatting style was designated by the .clang-format file.
2019-01-16 11:40:23 -08:00
Brent Stapleton
91251133d0 formatting: remove vim hints in headers
Remove trailing vim hints in header files. This functionality will be
replaced by clang-format.
2019-01-16 11:40:23 -08:00
Trung Tran
d89149a84f mpmd: increase claim_rpc call timeout.
During certain RPC calls (e.g. update_component), the MPM RPC server is
slow to respond to reclaim requests, which can causes RPC timeouts.
These changes fix those timeouts.

By setting the reclaiming timeout to twice the timeout of an RPC call,
we have some margin for error on the host side, while not affecting the
underlying claiming logic in MPM. The loop should still operate on a 5
second period, but now has more leeway during stressful conditions.
2019-01-14 09:43:56 -08:00
Trung Tran
a8ac2016ee rpc,mpmd: replace all set_timeout() to new api
Using new rpc client new API that ensure atomic setting of timeout on
each rpc call.
2019-01-14 09:43:56 -08:00
Trung Tran
654c2fece9 mpmd_impl: move timeout constants to header 2019-01-14 09:43:56 -08:00
Martin Braun
a308d2e024 mpmd: Add set_timeout_init() API call to mpmd_mboard_impl 2018-07-18 16:21:58 -07:00
Trung N Tran
4e2fd551ad mpmd: Use separate rpc connection for claim loop
We need a separate RPC connection for the claim loop such that it is not
blocked by other long executions of rpc calls.
2018-04-30 14:36:29 -07:00
Martin Braun
6652eb4a03 uhd: Move internal headers to uhdlib/
To avoid the proliferation of additional include directories and
multiple ways of including project-local headers, we now default to
moving all headers that are used across UHD into the uhdlib/
subdirectory.

Some #include statements were also reordered as they were modified for
closer compliance with the coding guidelines.

Internal cpp source files should now include files like this:

    #include <uhdlib/rfnoc/ctrl_iface.hpp>

Reviewed-by: Ashish Chaudhari <ashish.chaudhari@ettus.com>
2018-03-14 15:17:44 -07:00
Martin Braun
ae5211d71d uhd: Update license headers
All copyright is now attributed to "Ettus Research, a National
Instruments company".

SPDX headers were also updated to latest version 3.0.
2018-02-19 16:54:52 -08:00
Martin Braun
a2b3955e99 mpmd: Fix compiler issues
- Initialization of device_addr_t from another using auto doesn't work
  across compilers
- Moved MPMD_DISC_RESPONSE_PREAMBLE to mpmd_find where it belongs
2018-02-10 00:18:43 +01:00
Martin Braun
3df3b6cc62 mpmd: Factor find and prop tree init code out of mpmd_impl.cpp
No functional changes.
2018-02-07 17:01:06 -08:00
Martin Braun
14babab1bd mpmd: Let 'find' via broadcast check for reachability
In particular, when running uhd_find_devices, this will limit the
devices to ones that can actually be reached via CHDR. There is a new
key, find_all, which allows finding all devices even those not
reachable from UHD.

Reviewed-by: Brent Stapleton <brent.stapleton@ettus.com>
2018-02-07 15:46:43 -08:00
Martin Braun
02b407c921 mpmd: Add API to read back logs from device and send to native logging 2018-01-10 12:25:13 -08:00
Martin Braun
33ddbbb257 mpmd: Refactor device initialization for better parallelizability
Note: This doesn't add any concurrency, rather, it changes the
structure of the code to allow that. Notable changes:
- All prop tree inits in one place
- No access to containers in methods that might be run in parallel
- Split initialization and claiming in mpmd_mboard_impl, calling ctor
  will no longer run the full initialization.
- Added comments to identify parallelizable spots
2018-01-08 17:38:29 -08:00
Brent Stapleton
acd1f6d91e mpm: Increase RPC timeout during update_component
Increases the host's timeout during update_component times, then resets
it to the default RPC timeout after the call is complete.

Reviewed-by: Martin Braun <martin.braun@ettus.com>
2018-01-05 16:10:47 -08:00
Martin Braun
83dd47dc88 mpmd: Allow user-overrides for MPM ports
Adds two device args: discovery_port and rpc_port. Both are integers
which override the respective constants.

Reviewed-by: Ashish Chaudhari <ashish.chaudhari@ettus.com>
2018-01-04 14:17:09 -08:00
Martin Braun
af0fe0f8dc mpmd: Optionally parallelize all calls to setup_rpc_blocks
Default is to not serialize inits.
2017-12-22 15:06:11 -08:00
Martin Braun
a2d0b50bc6 mpmd: Expose get_mtu() API to mpmd_mboard_impl and to prop tree 2017-12-22 15:06:11 -08:00
Martin Braun
27f2aa86ac n310: Move SID framing all the way to n310.py
MPM will now no longer keep a SID framer variable.

Reviewed-by: Trung Tran <trung.tran@ettus.com>
Reviewed-by: Brent Stapleton <brent.stapleton@ettus.com>
2017-12-22 15:06:03 -08:00
Martin Braun
87dbcd9f1a mpmd: Refactor MPM transport architecture, use managers
This splits up the transport code in mpmd_impl across multiple classes
to properly leverage the request_xport/commit_xport API in MPM.
Different types of transport (UDP, liberio) use their own distinct
classes, which are generated dynamically on request.

This is a true refactoring despite the large amount of changes; there
are no functional differences.

Reviewed-By: Brent Stapleton <brent.stapleton@ettus.com>
Reviewed-By: Trung Tran <trung.tran@ettus.com>
Reviewed-By: Ashish Chaudhari <ashish.chaudhari@ettus.com>
2017-12-22 15:05:58 -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
2c9fe05fa8 mpmd: Use the get_last_error feature from the RPC client
The RPC client will now query the MPM server for details when an error
occured.
2017-12-22 15:05:05 -08:00
Martin Braun
b14bc217e9 mpm/mpmd: Dboard info is now stored in mboard info; refactored initialization 2017-12-22 15:03:59 -08:00
Martin Braun
039de2841b mpm/mpmd: Allow SID increment; more fixes for multi-usrp operation 2017-12-22 15:03:59 -08:00
Martin Braun
1809822893 mpm/mpmd: Further improvements on multi-device operations
- Crossbar local addr is now written during initialization of UHD
  session
- Support for multiple crossbars per device (at least on UHD side)
- Crossbars are now sequentially given a unique address
2017-12-22 15:03:58 -08:00
Martin Braun
cd03692e92 mpmd: Refactored code to allow multi-device initialization 2017-12-22 15:03:58 -08:00
Martin Braun
2b864696b7 mpmd: Added preliminary support for passing RPC client to blocks 2017-12-22 15:03:58 -08:00
Martin Braun
65713fa6f5 Rename netd to mpmd 2017-12-22 15:03:53 -08:00