diff options
Diffstat (limited to 'mpm')
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/base.py | 5 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/n310.py | 13 |
2 files changed, 13 insertions, 5 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/base.py b/mpm/python/usrp_mpm/periph_manager/base.py index d1ae84df6..8acc21b90 100644 --- a/mpm/python/usrp_mpm/periph_manager/base.py +++ b/mpm/python/usrp_mpm/periph_manager/base.py @@ -135,7 +135,6 @@ class PeriphManagerBase(object): self.log = get_logger('PeriphManager') self.claimed = False self._init_args = {} - self._available_endpoints = list(range(256)) try: self._init_mboard_with_eeprom() self._init_mboard_overlays(self._eeprom_head, args) @@ -338,7 +337,6 @@ class PeriphManagerBase(object): for dboard in self.dboards: dboard.deinit() self.log.trace("Resetting SID pool...") - self._available_endpoints = list(range(256)) def tear_down(self): """ @@ -647,6 +645,9 @@ class PeriphManagerBase(object): - type: Type of transport, e.g., "UDP", "liberio". - ipv4 (UDP only): IPv4 address to connect to. - port (UDP only): IP port to connect to. + - send_sid: String version of the SID used for this transport. This is + the definitive version of the SID, the suggested_src_address + can be ignored at this point. - allocation: This is an integer value which represents a score of how much bandwidth is used. Note: Currently does not have any unit, is just a counter. Higher numbers mean diff --git a/mpm/python/usrp_mpm/periph_manager/n310.py b/mpm/python/usrp_mpm/periph_manager/n310.py index 135f5e290..4a7997d75 100644 --- a/mpm/python/usrp_mpm/periph_manager/n310.py +++ b/mpm/python/usrp_mpm/periph_manager/n310.py @@ -297,6 +297,7 @@ class n310(PeriphManagerBase): self._ext_clock_freq = None self._clock_source = None self._time_source = None + self._available_endpoints = list(range(256)) try: self._init_peripherals(args) self._device_initialized = True @@ -417,6 +418,7 @@ class n310(PeriphManagerBase): super(n310, self).deinit() for xport_mgr in itervalues(self._xport_mgrs): xport_mgr.deinit() + self._available_endpoints = list(range(256)) def tear_down(self): """ @@ -443,14 +445,19 @@ class n310(PeriphManagerBase): """ See PeriphManagerBase.request_xport() for docs. """ - # For now, we always accept the suggestion if available, or fail + # Try suggested address first, then just pick the first available one: src_address = suggested_src_address if src_address not in self._available_endpoints: - raise RuntimeError("no more sids yo") + if len(self._available_endpoints) == 0: + raise RuntimeError( + "Depleted pool of SID endpoints for this device!") + else: + src_address = self._available_endpoints[0] sid = SID(src_address << 16 | dst_address) + # Note: This SID may change its source address! self.log.debug( "request_xport(dst=0x%04X, suggested_src_address=0x%04X, xport_type=%s): " \ - "operating on SID: %s", + "operating on temporary SID: %s", dst_address, suggested_src_address, str(xport_type), str(sid)) # FIXME token! assert self.mboard_info['rpc_connection'] in ('remote', 'local') |