Skip to content

Commit

Permalink
feat(storage/nvme): pass max_nsq, max_ncq to controller
Browse files Browse the repository at this point in the history
Signed-off-by: Artsiom Koltun <[email protected]>
  • Loading branch information
artek-koltun committed Nov 28, 2023
1 parent 5967f26 commit 42493e5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pydpu/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,18 @@ class NvmeController:
pf: physical_function of PciEndpoint
vf: virtual_function of PciEndpoint
port: port_id of PciEndpoint
max_nsq: maximum number of host submission queues allowed. For 0 the xPU will provide a default.
max_ncq: maximum number of host completion queues allowed. For 0 the xPU will provide a default.
"""

def __repr__(self) -> str:
return f"{type(self).__name__}({str(self.id)}, nqn={str(self.queue)}, port={str(self.port)}, pf={str(self.pf)}, vf={self.vf})"
return f"{type(self).__name__}({str(self.id)}, nqn={str(self.queue)}, " + \
f"port={str(self.port)}, pf={str(self.pf)}, vf={self.vf}, " + \
f"max_nsq={str(self.max_nsq)}, max_ncq={self.max_ncq})"

def __init__(self, subsystem: NvmeSubsystem, queue: int,
pf: int, vf: int, port: int = 0) -> None:
pf: int, vf: int, port: int = 0,
max_nsq: int = 0, max_ncq: int = 0) -> None:
self.id = "opi-" + str(uuid.uuid1())
self.fullname = "//storage.opiproject.org/subsystems/{}/controllers{}".format(
subsystem.id, self.id
Expand All @@ -129,6 +134,8 @@ def __init__(self, subsystem: NvmeSubsystem, queue: int,
self.pf = pf
self.vf = vf
self.port = port
self.max_nsq = max_nsq
self.max_ncq = max_ncq

def create(self, address):
with grpc.insecure_channel(address) as channel:
Expand All @@ -144,8 +151,8 @@ def create(self, address):
virtual_function=wrappers_pb2.Int32Value(value=2),
port_id=wrappers_pb2.Int32Value(value=3),
),
max_nsq=5,
max_ncq=6,
max_nsq=self.max_nsq,
max_ncq=self.max_ncq,
sqes=7,
cqes=8,
nvme_controller_id=1,
Expand Down

0 comments on commit 42493e5

Please sign in to comment.