1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-30 08:32:52 +08:00

Fix get_free_tag

This commit is contained in:
Alex Forencich 2019-11-04 14:11:24 -08:00
parent 097244162e
commit 34c97150e8

View File

@ -1810,15 +1810,14 @@ class Function(PMCapability, PCIECapability):
return None
def get_free_tag(self):
tag = None
tag_count = 256 if self.extended_tag_field_enable else 32
for k in range(tag_count):
if not self.rx_cpl_queues[self.current_tag]:
tag = self.current_tag
self.current_tag = (self.current_tag + 1) % tag_count
if not self.rx_cpl_queues[self.current_tag]:
return self.current_tag
return tag
return None
def handle_config_0_tlp(self, tlp):
if tlp.dest_id.device == self.device_num and tlp.dest_id.function == self.function_num:
@ -3411,15 +3410,14 @@ class RootComplex(Switch):
return None
def get_free_tag(self):
tag = None
tag_count = 32
for k in range(tag_count):
if not self.rx_cpl_queues[self.current_tag]:
tag = self.current_tag
self.current_tag = (self.current_tag + 1) % tag_count
if not self.rx_cpl_queues[self.current_tag]:
return self.current_tag
return tag
return None
def handle_io_read_tlp(self, tlp):
if self.find_io_region(tlp.address):