1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2 /* Copyright 2021 Marvell. All rights reserved. */
7 #include <linux/types.h>
8 #include <linux/list.h>
9 #include <linux/slab.h>
10 #include <linux/spinlock.h>
11 #include <linux/qed/tcp_common.h>
12 #include <linux/qed/qed_nvmetcp_if.h>
13 #include <linux/qed/qed_chain.h>
19 #define QED_NVMETCP_FW_CQ_SIZE (4 * 1024)
22 #define QED_TCP_FLOW_LABEL 0
23 #define QED_TCP_TWO_MSL_TIMER 4000
24 #define QED_TCP_HALF_WAY_CLOSE_TIMEOUT 10
25 #define QED_TCP_MAX_FIN_RT 2
26 #define QED_TCP_SWS_TIMER 5000
28 struct qed_nvmetcp_info
{
29 spinlock_t lock
; /* Connection resources. */
30 struct list_head free_list
;
31 u16 max_num_outstanding_tasks
;
33 nvmetcp_event_cb_t event_cb
;
36 struct qed_hash_nvmetcp_con
{
37 struct hlist_node node
;
38 struct qed_nvmetcp_conn
*con
;
41 struct qed_nvmetcp_conn
{
42 struct list_head list_entry
;
50 dma_addr_t sq_pbl_addr
;
51 struct qed_chain r2tq
;
76 u8 abortive_dsconnect
;
78 u32 max_recv_pdu_length
;
79 u32 max_send_pdu_length
;
83 u16 nvmetcp_cccid_max_range
;
84 dma_addr_t nvmetcp_cccid_itid_table_addr
;
87 #if IS_ENABLED(CONFIG_QED_NVMETCP)
88 int qed_nvmetcp_alloc(struct qed_hwfn
*p_hwfn
);
89 void qed_nvmetcp_setup(struct qed_hwfn
*p_hwfn
);
90 void qed_nvmetcp_free(struct qed_hwfn
*p_hwfn
);
92 #else /* IS_ENABLED(CONFIG_QED_NVMETCP) */
93 static inline int qed_nvmetcp_alloc(struct qed_hwfn
*p_hwfn
)
98 static inline void qed_nvmetcp_setup(struct qed_hwfn
*p_hwfn
) {}
99 static inline void qed_nvmetcp_free(struct qed_hwfn
*p_hwfn
) {}
101 #endif /* IS_ENABLED(CONFIG_QED_NVMETCP) */