uhd/mpm
Abhishek Verma 6e11078807 mpm: net.py: optimize netlink ops to fix RPC starvation
usrp_hwd runs all gRPC greenlets on a single gevent hub, so any
non-yielding C call blocks every other RPC. Under a uhd_find_devices
discovery flood, the GetDeviceInfo interface enumeration run long enough
And may starve most claimed RPC past its default 2s client deadline,
causing "Deadline Exceeded" failures.

Three places that this commit optimizes, all in net.py:

- get_local_ip_addrs() used pyroute2 IPDB, which spawns helper threads
  and mirrors the full link/addr/route/neighbour tables on every call
  (~100s of ms, non-yielding) --> Replace it with a single stateless
  IPRoute get_addr() dump. Keep IFA_LOCAL (falling back to IFA_ADDRESS)
  so the returned set matches IPDB's behaviour, including point-to-point
  links.

- get_link_speed() used to create a new pyudev.Context() per interface,
  which forks on creation, tripping gRPC's fork handlers. gRPC then
  freezes all workder threads and restarts after fork is done. Fix is to
  reuse one PID-guarded pyudev context per process.

- get_valid_interfaces() did an O(N) netlink round-trip per interface.
  This stalls gRPC server. --> Dump all links and IPv4 addresses once
   and filter in Python.

IPRoute stays per-call: it opens its own netlink socket and does not
fork, so there is no shared state to lock.
2026-09-18 16:12:41 +01:00
..
cmake/Modules mpm: fixed cmake macro for enabling modules 2020-01-22 12:54:54 -08:00
include doc: Fix documentation for Doxygen 2026-05-07 14:58:01 +02:00
lib mpm: include missing header in mykonos lib 2026-03-24 11:29:27 +01:00
python mpm: net.py: optimize netlink ops to fix RPC starvation 2026-09-18 16:12:41 +01:00
systemd mpm: deactivate Duplicate Address Detection (DAD) on int0 interface 2024-06-11 10:20:08 +02:00
tests uhd: mpm: update all license header w/ "-or-later" 2019-03-08 00:43:07 +01:00
tools mpm: use flag locked_fpga=True for L variant devices 2026-08-25 22:03:46 +01:00
.gitignore Move ignore of build folders into top level 2025-07-18 11:19:52 +02:00
CMakeLists.txt cmake: Remove some Boost dependencies 2026-06-15 09:50:16 +02:00