]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - include/linux/qed/qed_nvmetcp_if.h
5180edad24e5ca361818ebb48a68ce9c5418af70
[mirror_ubuntu-jammy-kernel.git] / include / linux / qed / qed_nvmetcp_if.h
1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2 /* Copyright 2021 Marvell. All rights reserved. */
3
4 #ifndef _QED_NVMETCP_IF_H
5 #define _QED_NVMETCP_IF_H
6 #include <linux/types.h>
7 #include <linux/qed/qed_if.h>
8
9 #define QED_NVMETCP_MAX_IO_SIZE 0x800000
10
11 typedef int (*nvmetcp_event_cb_t) (void *context,
12 u8 fw_event_code, void *fw_handle);
13
14 struct qed_dev_nvmetcp_info {
15 struct qed_dev_info common;
16 u8 port_id; /* Physical port */
17 u8 num_cqs;
18 };
19
20 #define MAX_TID_BLOCKS_NVMETCP (512)
21 struct qed_nvmetcp_tid {
22 u32 size; /* In bytes per task */
23 u32 num_tids_per_block;
24 u8 *blocks[MAX_TID_BLOCKS_NVMETCP];
25 };
26
27 struct qed_nvmetcp_id_params {
28 u8 mac[ETH_ALEN];
29 u32 ip[4];
30 u16 port;
31 };
32
33 struct qed_nvmetcp_params_offload {
34 /* FW initializations */
35 dma_addr_t sq_pbl_addr;
36 dma_addr_t nvmetcp_cccid_itid_table_addr;
37 u16 nvmetcp_cccid_max_range;
38 u8 default_cq;
39
40 /* Networking and TCP stack initializations */
41 struct qed_nvmetcp_id_params src;
42 struct qed_nvmetcp_id_params dst;
43 u32 ka_timeout;
44 u32 ka_interval;
45 u32 max_rt_time;
46 u32 cwnd;
47 u16 mss;
48 u16 vlan_id;
49 bool timestamp_en;
50 bool delayed_ack_en;
51 bool tcp_keep_alive_en;
52 bool ecn_en;
53 u8 ip_version;
54 u8 ka_max_probe_cnt;
55 u8 ttl;
56 u8 tos_or_tc;
57 u8 rcv_wnd_scale;
58 };
59
60 struct qed_nvmetcp_params_update {
61 u32 max_io_size;
62 u32 max_recv_pdu_length;
63 u32 max_send_pdu_length;
64
65 /* Placeholder: pfv, cpda, hpda */
66
67 bool hdr_digest_en;
68 bool data_digest_en;
69 };
70
71 struct qed_nvmetcp_cb_ops {
72 struct qed_common_cb_ops common;
73 };
74
75 /**
76 * struct qed_nvmetcp_ops - qed NVMeTCP operations.
77 * @common: common operations pointer
78 * @ll2: light L2 operations pointer
79 * @fill_dev_info: fills NVMeTCP specific information
80 * @param cdev
81 * @param info
82 * @return 0 on success, otherwise error value.
83 * @register_ops: register nvmetcp operations
84 * @param cdev
85 * @param ops - specified using qed_nvmetcp_cb_ops
86 * @param cookie - driver private
87 * @start: nvmetcp in FW
88 * @param cdev
89 * @param tasks - qed will fill information about tasks
90 * return 0 on success, otherwise error value.
91 * @stop: nvmetcp in FW
92 * @param cdev
93 * return 0 on success, otherwise error value.
94 * @acquire_conn: acquire a new nvmetcp connection
95 * @param cdev
96 * @param handle - qed will fill handle that should be
97 * used henceforth as identifier of the
98 * connection.
99 * @param p_doorbell - qed will fill the address of the
100 * doorbell.
101 * @return 0 on sucesss, otherwise error value.
102 * @release_conn: release a previously acquired nvmetcp connection
103 * @param cdev
104 * @param handle - the connection handle.
105 * @return 0 on success, otherwise error value.
106 * @offload_conn: configures an offloaded connection
107 * @param cdev
108 * @param handle - the connection handle.
109 * @param conn_info - the configuration to use for the
110 * offload.
111 * @return 0 on success, otherwise error value.
112 * @update_conn: updates an offloaded connection
113 * @param cdev
114 * @param handle - the connection handle.
115 * @param conn_info - the configuration to use for the
116 * offload.
117 * @return 0 on success, otherwise error value.
118 * @destroy_conn: stops an offloaded connection
119 * @param cdev
120 * @param handle - the connection handle.
121 * @return 0 on success, otherwise error value.
122 * @clear_sq: clear all task in sq
123 * @param cdev
124 * @param handle - the connection handle.
125 * @return 0 on success, otherwise error value.
126 * @add_src_tcp_port_filter: Add source tcp port filter
127 * @param cdev
128 * @param src_port
129 * @remove_src_tcp_port_filter: Remove source tcp port filter
130 * @param cdev
131 * @param src_port
132 * @add_dst_tcp_port_filter: Add destination tcp port filter
133 * @param cdev
134 * @param dest_port
135 * @remove_dst_tcp_port_filter: Remove destination tcp port filter
136 * @param cdev
137 * @param dest_port
138 * @clear_all_filters: Clear all filters.
139 * @param cdev
140 */
141 struct qed_nvmetcp_ops {
142 const struct qed_common_ops *common;
143
144 const struct qed_ll2_ops *ll2;
145
146 int (*fill_dev_info)(struct qed_dev *cdev,
147 struct qed_dev_nvmetcp_info *info);
148
149 void (*register_ops)(struct qed_dev *cdev,
150 struct qed_nvmetcp_cb_ops *ops, void *cookie);
151
152 int (*start)(struct qed_dev *cdev,
153 struct qed_nvmetcp_tid *tasks,
154 void *event_context, nvmetcp_event_cb_t async_event_cb);
155
156 int (*stop)(struct qed_dev *cdev);
157
158 int (*acquire_conn)(struct qed_dev *cdev,
159 u32 *handle,
160 u32 *fw_cid, void __iomem **p_doorbell);
161
162 int (*release_conn)(struct qed_dev *cdev, u32 handle);
163
164 int (*offload_conn)(struct qed_dev *cdev,
165 u32 handle,
166 struct qed_nvmetcp_params_offload *conn_info);
167
168 int (*update_conn)(struct qed_dev *cdev,
169 u32 handle,
170 struct qed_nvmetcp_params_update *conn_info);
171
172 int (*destroy_conn)(struct qed_dev *cdev, u32 handle, u8 abrt_conn);
173
174 int (*clear_sq)(struct qed_dev *cdev, u32 handle);
175
176 int (*add_src_tcp_port_filter)(struct qed_dev *cdev, u16 src_port);
177
178 void (*remove_src_tcp_port_filter)(struct qed_dev *cdev, u16 src_port);
179
180 int (*add_dst_tcp_port_filter)(struct qed_dev *cdev, u16 dest_port);
181
182 void (*remove_dst_tcp_port_filter)(struct qed_dev *cdev, u16 dest_port);
183
184 void (*clear_all_filters)(struct qed_dev *cdev);
185 };
186
187 const struct qed_nvmetcp_ops *qed_get_nvmetcp_ops(void);
188 void qed_put_nvmetcp_ops(void);
189 #endif