aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python/usrp_mpm
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-12-14 14:08:35 -0800
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:05:59 -0800
commit8b700c7e0825fa23959748dd37f65e59aa1bda03 (patch)
tree688bab006fb4206b00718cda147f433ddb792b9a /mpm/python/usrp_mpm
parenta3cbdf481b30eca98dad24735d8e52ed18d3c7db (diff)
downloaduhd-8b700c7e0825fa23959748dd37f65e59aa1bda03.tar.gz
uhd-8b700c7e0825fa23959748dd37f65e59aa1bda03.tar.bz2
uhd-8b700c7e0825fa23959748dd37f65e59aa1bda03.zip
mpm: udp xport: Increment TX/RX allocations for streamers
Reviewed-by: Trung Tran <trung.tran@ettus.com>
Diffstat (limited to 'mpm/python/usrp_mpm')
-rw-r--r--mpm/python/usrp_mpm/xports/xportmgr_udp.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/mpm/python/usrp_mpm/xports/xportmgr_udp.py b/mpm/python/usrp_mpm/xports/xportmgr_udp.py
index 48f6b5cf2..9ae76a610 100644
--- a/mpm/python/usrp_mpm/xports/xportmgr_udp.py
+++ b/mpm/python/usrp_mpm/xports/xportmgr_udp.py
@@ -43,6 +43,7 @@ class XportMgrUDP(object):
self._chdr_ifaces = \
self._init_interfaces(self._possible_chdr_ifaces)
self._eth_dispatchers = {}
+ self._allocations = {}
def _init_interfaces(self, possible_ifaces):
"""
@@ -105,7 +106,7 @@ class XportMgrUDP(object):
def deinit(self):
" Clean up after a session terminates "
- pass
+ self._allocations = {}
def _preload_ethtables(self, eth_dispatchers, table_file):
"""
@@ -170,15 +171,20 @@ class XportMgrUDP(object):
Return UDP xport info
"""
assert xport_type in ('CTRL', 'ASYNC_MSG', 'TX_DATA', 'RX_DATA')
- # for iface_name, iface_info in iteritems(self._chdr_ifaces):
-
+ allocation_getter = lambda iface: {
+ 'CTRL': 0,
+ 'ASYNC_MSG': 0,
+ 'RX_DATA': self._allocations.get(iface, {}).get('rx', 0),
+ 'TX_DATA': self._allocations.get(iface, {}).get('tx', 0),
+ }[xport_type]
xport_info = [
{
'type': 'UDP',
'ipv4': str(iface_info['ip_addr']),
'port': str(self.chdr_port),
'send_sid': str(sid),
- 'allocation': '0',
+ 'allocation': str(allocation_getter(iface_name)),
+ 'xport_type': xport_type,
}
for _, iface_info in iteritems(self._chdr_ifaces)
]
@@ -215,5 +221,17 @@ class XportMgrUDP(object):
self._eth_dispatchers[eth_iface].set_route(
sid.reversed(), sender_addr, sender_port)
self.log.trace("UDP transport successfully committed!")
+ if xport_info.get('xport_type') == 'TX_DATA':
+ self._allocations[eth_iface]['tx'] = \
+ self._allocations.get(eth_iface, {}).get('tx', 0) + 1
+ if xport_info.get('xport_type') == 'RX_DATA':
+ self._allocations[eth_iface]['rx'] = \
+ self._allocations.get(eth_iface, {}).get('rx', 0) + 1
+ self.log.trace(
+ "New link allocations for %s: TX: %d RX: %d",
+ eth_iface,
+ self._allocations.get(eth_iface, {}).get('tx', 0),
+ self._allocations.get(eth_iface, {}).get('rx', 0),
+ )
return True