xref: /freebsd/sys/dev/qlnx/qlnxe/ecore_fcoe_api.h (revision 06c3fb27)
1 /*
2  * Copyright (c) 2017-2018 Cavium, Inc.
3  * All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions
7  *  are met:
8  *
9  *  1. Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer.
11  *  2. Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution.
14  *
15  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  *  POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
29 #ifndef __ECORE_FCOE_API_H__
30 #define __ECORE_FCOE_API_H__
31 
32 #include "ecore_sp_api.h"
33 
34 #ifndef __EXTRACT__LINUX__C__
35 struct ecore_fcoe_conn {
36 	osal_list_entry_t	list_entry;
37 	bool			free_on_delete;
38 
39 	u16			conn_id;
40 	u32			icid;
41 	u32			fw_cid;
42 	u8			layer_code;
43 
44 	dma_addr_t		sq_pbl_addr;
45 	dma_addr_t		sq_curr_page_addr;
46 	dma_addr_t		sq_next_page_addr;
47 	dma_addr_t		xferq_pbl_addr;
48 	void			*xferq_pbl_addr_virt_addr;
49 	dma_addr_t		xferq_addr[4];
50 	void			*xferq_addr_virt_addr[4];
51 	dma_addr_t		confq_pbl_addr;
52 	void			*confq_pbl_addr_virt_addr;
53 	dma_addr_t		confq_addr[2];
54 	void			*confq_addr_virt_addr[2];
55 
56 	dma_addr_t		terminate_params;
57 
58 	u16			dst_mac_addr_lo;
59 	u16			dst_mac_addr_mid;
60 	u16			dst_mac_addr_hi;
61 	u16			src_mac_addr_lo;
62 	u16			src_mac_addr_mid;
63 	u16			src_mac_addr_hi;
64 
65 	u16			tx_max_fc_pay_len;
66 	u16			e_d_tov_timer_val;
67 	u16			rec_tov_timer_val;
68 	u16			rx_max_fc_pay_len;
69 	u16			vlan_tag;
70 	u16			physical_q0;
71 
72 	struct fc_addr_nw	s_id;
73 	u8 max_conc_seqs_c3;
74 	struct fc_addr_nw	d_id;
75 	u8			flags;
76 	u8			def_q_idx;
77 };
78 #endif
79 
80 #ifndef __EXTRACT__LINUX__IF__
81 struct ecore_fcoe_stats {
82 	u64	fcoe_rx_byte_cnt;
83 	u64	fcoe_rx_data_pkt_cnt;
84 	u64	fcoe_rx_xfer_pkt_cnt;
85 	u64	fcoe_rx_other_pkt_cnt;
86 	u32	fcoe_silent_drop_pkt_cmdq_full_cnt;
87 	u32	fcoe_silent_drop_pkt_rq_full_cnt;
88 	u32	fcoe_silent_drop_pkt_crc_error_cnt;
89 	u32	fcoe_silent_drop_pkt_task_invalid_cnt;
90 	u32	fcoe_silent_drop_total_pkt_cnt;
91 
92 	u64	fcoe_tx_byte_cnt;
93 	u64	fcoe_tx_data_pkt_cnt;
94 	u64	fcoe_tx_xfer_pkt_cnt;
95 	u64	fcoe_tx_other_pkt_cnt;
96 };
97 #endif
98 
99 enum _ecore_status_t
100 ecore_fcoe_acquire_connection(struct ecore_hwfn *p_hwfn,
101 			      struct ecore_fcoe_conn *p_in_conn,
102 			      struct ecore_fcoe_conn **p_out_conn);
103 
104 void OSAL_IOMEM *ecore_fcoe_get_db_addr(struct ecore_hwfn *p_hwfn,
105 					u32 cid);
106 
107 void OSAL_IOMEM *ecore_fcoe_get_global_cmdq_cons(struct ecore_hwfn *p_hwfn,
108 						 u8 relative_q_id);
109 
110 void OSAL_IOMEM *ecore_fcoe_get_primary_bdq_prod(struct ecore_hwfn *p_hwfn,
111 						  u8 bdq_id);
112 
113 void OSAL_IOMEM *ecore_fcoe_get_secondary_bdq_prod(struct ecore_hwfn *p_hwfn,
114 						    u8 bdq_id);
115 
116 enum _ecore_status_t
117 ecore_fcoe_offload_connection(struct ecore_hwfn	*p_hwfn,
118 			      struct ecore_fcoe_conn *p_conn);
119 
120 enum _ecore_status_t
121 ecore_fcoe_terminate_connection(struct ecore_hwfn *p_hwfn,
122 				struct ecore_fcoe_conn *p_conn);
123 
124 void ecore_fcoe_release_connection(struct ecore_hwfn *p_hwfn,
125 				   struct ecore_fcoe_conn *p_conn);
126 
127 enum _ecore_status_t
128 ecore_sp_fcoe_func_start(struct ecore_hwfn *p_hwfn,
129 			 enum spq_mode comp_mode,
130 			 struct ecore_spq_comp_cb *p_comp_addr);
131 
132 enum _ecore_status_t
133 ecore_sp_fcoe_func_stop(struct ecore_hwfn *p_hwfn,
134 			struct ecore_ptt *p_ptt,
135 			enum spq_mode comp_mode,
136 			struct ecore_spq_comp_cb *p_comp_addr);
137 
138 enum _ecore_status_t
139 ecore_fcoe_get_stats(struct ecore_hwfn *p_hwfn,
140 		     struct ecore_fcoe_stats *stats);
141 
142 #endif
143