Skip to content

Commit

Permalink
discovery: merge code block in reply_get_log_page()
Browse files Browse the repository at this point in the history
Signed-off-by: Yin Congmin <[email protected]>
  • Loading branch information
CongMinYin committed Sep 7, 2023
1 parent ede3065 commit d65c6b2
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions control/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,20 +795,12 @@ def reply_get_log_page(self, conn, data, cmd_id):
nvme_tcp_data_pdu.data_length = nvme_data_len

# reply based on the received get log page request packet(length)
if nvme_data_len < 1024:
# nvme cli version: 1.x
if nvme_data_len <= 1024 and nvme_logpage_offset == 0:
nvme_get_log_page_reply = NVMeGetLogPage()
nvme_get_log_page_reply.genctr = self_conn.gen_cnt
nvme_get_log_page_reply.numrec = len(listeners)

reply = pdu_reply + nvme_tcp_data_pdu + bytes(nvme_get_log_page_reply)[:nvme_data_len]
elif nvme_data_len == 1024 and nvme_logpage_offset == 0:
# nvme cli version: 2.x
nvme_get_log_page_reply = NVMeGetLogPage()
nvme_get_log_page_reply.genctr = self_conn.gen_cnt
nvme_get_log_page_reply.numrec = len(listeners)

reply = pdu_reply + nvme_tcp_data_pdu+ nvme_get_log_page_reply
elif nvme_data_len % 1024 == 0:
# reply log pages
reply = pdu_reply + nvme_tcp_data_pdu + \
Expand Down

0 comments on commit d65c6b2

Please sign in to comment.