1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ 2 /* Copyright 2021 Marvell. All rights reserved. */ 3 4 #ifndef _QED_NVMETCP_H 5 #define _QED_NVMETCP_H 6 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> 14 #include "qed.h" 15 #include "qed_hsi.h" 16 #include "qed_mcp.h" 17 #include "qed_sp.h" 18 19 #define QED_NVMETCP_FW_CQ_SIZE (4 * 1024) 20 21 /* tcp parameters */ 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 27 28 struct qed_nvmetcp_info { 29 spinlock_t lock; /* Connection resources. */ 30 struct list_head free_list; 31 u16 max_num_outstanding_tasks; 32 void *event_context; 33 nvmetcp_event_cb_t event_cb; 34 }; 35 36 struct qed_hash_nvmetcp_con { 37 struct hlist_node node; 38 struct qed_nvmetcp_conn *con; 39 }; 40 41 struct qed_nvmetcp_conn { 42 struct list_head list_entry; 43 bool free_on_delete; 44 u16 conn_id; 45 u32 icid; 46 u32 fw_cid; 47 u8 layer_code; 48 u8 offl_flags; 49 u8 connect_mode; 50 dma_addr_t sq_pbl_addr; 51 struct qed_chain r2tq; 52 struct qed_chain xhq; 53 struct qed_chain uhq; 54 u8 local_mac[6]; 55 u8 remote_mac[6]; 56 u8 ip_version; 57 u8 ka_max_probe_cnt; 58 u16 vlan_id; 59 u16 tcp_flags; 60 u32 remote_ip[4]; 61 u32 local_ip[4]; 62 u32 flow_label; 63 u32 ka_timeout; 64 u32 ka_interval; 65 u32 max_rt_time; 66 u8 ttl; 67 u8 tos_or_tc; 68 u16 remote_port; 69 u16 local_port; 70 u16 mss; 71 u8 rcv_wnd_scale; 72 u32 rcv_wnd; 73 u32 cwnd; 74 u8 update_flag; 75 u8 default_cq; 76 u8 abortive_dsconnect; 77 u32 max_seq_size; 78 u32 max_recv_pdu_length; 79 u32 max_send_pdu_length; 80 u32 first_seq_length; 81 u16 physical_q0; 82 u16 physical_q1; 83 u16 nvmetcp_cccid_max_range; 84 dma_addr_t nvmetcp_cccid_itid_table_addr; 85 }; 86 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); 91 92 #else /* IS_ENABLED(CONFIG_QED_NVMETCP) */ qed_nvmetcp_alloc(struct qed_hwfn * p_hwfn)93static inline int qed_nvmetcp_alloc(struct qed_hwfn *p_hwfn) 94 { 95 return -EINVAL; 96 } 97 qed_nvmetcp_setup(struct qed_hwfn * p_hwfn)98static inline void qed_nvmetcp_setup(struct qed_hwfn *p_hwfn) {} qed_nvmetcp_free(struct qed_hwfn * p_hwfn)99static inline void qed_nvmetcp_free(struct qed_hwfn *p_hwfn) {} 100 101 #endif /* IS_ENABLED(CONFIG_QED_NVMETCP) */ 102 103 #endif 104