2 * data structures for NVMe Dissection
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef _PACKET_NVME_H_
13 #define _PACKET_NVME_H_
15 #define NVME_CMD_SIZE 64
16 #define NVME_CQE_SIZE 16
19 wmem_tree_t *pending_cmds;
20 wmem_tree_t *done_cmds;
21 wmem_tree_t *data_requests;
22 wmem_tree_t *data_responses;
27 guint32 cmd_pkt_num; /* pkt number of the cmd */
28 guint32 cqe_pkt_num; /* pkt number of the cqe */
30 guint32 data_req_pkt_num;
31 guint32 data_resp_pkt_num;
33 nstime_t cmd_start_time;
34 nstime_t cmd_end_time;
35 gboolean fabric; /* indicate whether cmd fabric type or not */
43 nvme_publish_qid(proto_tree *tree, int field_index, guint16 qid);
46 nvme_publish_cmd_latency(proto_tree *tree, struct nvme_cmd_ctx *cmd_ctx,
49 nvme_publish_cqe_to_cmd_link(proto_tree *cqe_tree, tvbuff_t *cqe_tvb,
50 int hf_index, struct nvme_cmd_ctx *cmd_ctx);
52 nvme_publish_cmd_to_cqe_link(proto_tree *cmd_tree, tvbuff_t *cqe_tvb,
53 int hf_index, struct nvme_cmd_ctx *cmd_ctx);
55 void nvme_update_cmd_end_info(packet_info *pinfo, struct nvme_cmd_ctx *cmd_ctx);
58 nvme_add_cmd_to_pending_list(packet_info *pinfo, struct nvme_q_ctx *q_ctx,
59 struct nvme_cmd_ctx *cmd_ctx,
60 void *ctx, guint16 cmd_id);
61 void* nvme_lookup_cmd_in_pending_list(struct nvme_q_ctx *q_ctx, guint16 cmd_id);
63 void nvme_add_data_request(packet_info *pinfo, struct nvme_q_ctx *q_ctx,
64 struct nvme_cmd_ctx *cmd_ctx, void *ctx);
65 void* nvme_lookup_data_request(struct nvme_q_ctx *q_ctx, guint32 key);
68 nvme_add_data_response(struct nvme_q_ctx *q_ctx,
69 struct nvme_cmd_ctx *cmd_ctx, guint32 rkey);
71 nvme_lookup_data_response(packet_info *pinfo, struct nvme_q_ctx *q_ctx,
75 nvme_add_cmd_cqe_to_done_list(struct nvme_q_ctx *q_ctx,
76 struct nvme_cmd_ctx *cmd_ctx, guint16 cmd_id);
78 nvme_lookup_cmd_in_done_list(packet_info *pinfo, struct nvme_q_ctx *q_ctx,
81 void dissect_nvme_cmd_sgl(tvbuff_t *cmd_tvb, proto_tree *cmd_tree,
82 int field_index, struct nvme_cmd_ctx *cmd_ctx);
85 dissect_nvme_cmd(tvbuff_t *nvme_tvb, packet_info *pinfo, proto_tree *root_tree,
86 struct nvme_q_ctx *q_ctx, struct nvme_cmd_ctx *cmd_ctx);
89 dissect_nvme_data_response(tvbuff_t *nvme_tvb, packet_info *pinfo, proto_tree *root_tree,
90 struct nvme_q_ctx *q_ctx, struct nvme_cmd_ctx *cmd_ctx, guint len);
93 dissect_nvme_cqe(tvbuff_t *nvme_tvb, packet_info *pinfo, proto_tree *root_tree,
94 struct nvme_cmd_ctx *cmd_ctx);
99 * Editor modelines - http://www.wireshark.org/tools/modelines.html
104 * indent-tabs-mode: nil
107 * vi: set shiftwidth=4 tabstop=8 expandtab:
108 * :indentSize=4:tabSize=8:noTabs=true: