forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/drivers/net/ethernet/qlogic/qed/qed_rdma.h
....@@ -1,34 +1,9 @@
1
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
12 /* QLogic qed NIC Driver
23 * Copyright (c) 2015-2017 QLogic Corporation
3
- *
4
- * This software is available to you under a choice of one of two
5
- * licenses. You may choose to be licensed under the terms of the GNU
6
- * General Public License (GPL) Version 2, available from the file
7
- * COPYING in the main directory of this source tree, or the
8
- * OpenIB.org BSD license below:
9
- *
10
- * Redistribution and use in source and binary forms, with or
11
- * without modification, are permitted provided that the following
12
- * conditions are met:
13
- *
14
- * - Redistributions of source code must retain the above
15
- * copyright notice, this list of conditions and the following
16
- * disclaimer.
17
- *
18
- * - Redistributions in binary form must reproduce the above
19
- * copyright notice, this list of conditions and the following
20
- * disclaimer in the documentation and /or other materials
21
- * provided with the distribution.
22
- *
23
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
- * SOFTWARE.
4
+ * Copyright (c) 2019-2020 Marvell International Ltd.
315 */
6
+
327 #ifndef _QED_RDMA_H
338 #define _QED_RDMA_H
349 #include <linux/types.h>
....@@ -45,7 +20,6 @@
4520 #include "qed_iwarp.h"
4621 #include "qed_roce.h"
4722
48
-#define QED_RDMA_MAX_FMR (RDMA_MAX_TIDS)
4923 #define QED_RDMA_MAX_P_KEY (1)
5024 #define QED_RDMA_MAX_WQE (0x7FFF)
5125 #define QED_RDMA_MAX_SRQ_WQE_ELEM (0x7FFF)
....@@ -62,6 +36,11 @@
6236
6337 #define QED_RDMA_MAX_CQE_32_BIT (0x7FFFFFFF - 1)
6438 #define QED_RDMA_MAX_CQE_16_BIT (0x7FFF - 1)
39
+
40
+/* Up to 2^16 XRC Domains are supported, but the actual number of supported XRC
41
+ * SRQs is much smaller so there's no need to have that many domains.
42
+ */
43
+#define QED_RDMA_MAX_XRCDS (roundup_pow_of_two(RDMA_MAX_XRC_SRQS))
6544
6645 enum qed_rdma_toggle_bit {
6746 QED_RDMA_TOGGLE_BIT_CLEAR = 0,
....@@ -81,9 +60,11 @@
8160
8261 struct qed_bmap cq_map;
8362 struct qed_bmap pd_map;
63
+ struct qed_bmap xrcd_map;
8464 struct qed_bmap tid_map;
8565 struct qed_bmap qp_map;
8666 struct qed_bmap srq_map;
67
+ struct qed_bmap xrc_srq_map;
8768 struct qed_bmap cid_map;
8869 struct qed_bmap tcp_cid_map;
8970 struct qed_bmap real_cid_map;
....@@ -111,6 +92,7 @@
11192 u32 qpid;
11293 u16 icid;
11394 enum qed_roce_qp_state cur_state;
95
+ enum qed_rdma_qp_type qp_type;
11496 enum qed_iwarp_qp_state iwarp_state;
11597 bool use_srq;
11698 bool signal_all;
....@@ -153,18 +135,21 @@
153135 dma_addr_t orq_phys_addr;
154136 u8 orq_num_pages;
155137 bool req_offloaded;
138
+ bool has_req;
156139
157140 /* responder */
158141 u8 max_rd_atomic_resp;
159142 u32 rq_psn;
160143 u16 rq_cq_id;
161144 u16 rq_num_pages;
145
+ u16 xrcd_id;
162146 dma_addr_t rq_pbl_ptr;
163147 void *irq;
164148 dma_addr_t irq_phys_addr;
165149 u8 irq_num_pages;
166150 bool resp_offloaded;
167151 u32 cq_prod;
152
+ bool has_resp;
168153
169154 u8 remote_mac_addr[6];
170155 u8 local_mac_addr[6];
....@@ -172,8 +157,17 @@
172157 void *shared_queue;
173158 dma_addr_t shared_queue_phys_addr;
174159 struct qed_iwarp_ep *ep;
160
+ u8 edpm_mode;
175161 };
176162
163
+static inline bool qed_rdma_is_xrc_qp(struct qed_rdma_qp *qp)
164
+{
165
+ if (qp->qp_type == QED_RDMA_QP_TYPE_XRC_TGT ||
166
+ qp->qp_type == QED_RDMA_QP_TYPE_XRC_INI)
167
+ return true;
168
+
169
+ return false;
170
+}
177171 #if IS_ENABLED(CONFIG_QED_RDMA)
178172 void qed_rdma_dpm_bar(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
179173 void qed_rdma_dpm_conf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
....@@ -207,7 +201,7 @@
207201 int
208202 qed_bmap_test_id(struct qed_hwfn *p_hwfn, struct qed_bmap *bmap, u32 id_num);
209203
210
-void qed_rdma_set_fw_mac(u16 *p_fw_mac, u8 *p_qed_mac);
204
+void qed_rdma_set_fw_mac(__le16 *p_fw_mac, const u8 *p_qed_mac);
211205
212206 bool qed_rdma_allocated_qps(struct qed_hwfn *p_hwfn);
213207 #endif