xref: /freebsd/sys/dev/qlnx/qlnxe/ecore_fcoe_api.h (revision d6b92ffa)
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  * $FreeBSD$
28  *
29  */
30 
31 #ifndef __ECORE_FCOE_API_H__
32 #define __ECORE_FCOE_API_H__
33 
34 #include "ecore_sp_api.h"
35 
36 struct ecore_fcoe_conn {
37 	osal_list_entry_t	list_entry;
38 	bool			free_on_delete;
39 
40 	u16			conn_id;
41 	u32			icid;
42 	u32			fw_cid;
43 	u8			layer_code;
44 
45 	dma_addr_t		sq_pbl_addr;
46 	dma_addr_t		sq_curr_page_addr;
47 	dma_addr_t		sq_next_page_addr;
48 	dma_addr_t		xferq_pbl_addr;
49 	void			*xferq_pbl_addr_virt_addr;
50 	dma_addr_t		xferq_addr[4];
51 	void			*xferq_addr_virt_addr[4];
52 	dma_addr_t		confq_pbl_addr;
53 	void			*confq_pbl_addr_virt_addr;
54 	dma_addr_t		confq_addr[2];
55 	void			*confq_addr_virt_addr[2];
56 
57 	dma_addr_t		terminate_params;
58 
59 	u16			dst_mac_addr_lo;
60 	u16			dst_mac_addr_mid;
61 	u16			dst_mac_addr_hi;
62 	u16			src_mac_addr_lo;
63 	u16			src_mac_addr_mid;
64 	u16			src_mac_addr_hi;
65 
66 	u16			tx_max_fc_pay_len;
67 	u16			e_d_tov_timer_val;
68 	u16			rec_tov_timer_val;
69 	u16			rx_max_fc_pay_len;
70 	u16			vlan_tag;
71 	u16			physical_q0;
72 
73 	struct fc_addr_nw	s_id;
74 	u8 max_conc_seqs_c3;
75 	struct fc_addr_nw	d_id;
76 	u8			flags;
77 	u8			def_q_idx;
78 };
79 
80 struct ecore_fcoe_stats {
81 	u64	fcoe_rx_byte_cnt;
82 	u64	fcoe_rx_data_pkt_cnt;
83 	u64	fcoe_rx_xfer_pkt_cnt;
84 	u64	fcoe_rx_other_pkt_cnt;
85 	u32	fcoe_silent_drop_pkt_cmdq_full_cnt;
86 	u32	fcoe_silent_drop_pkt_rq_full_cnt;
87 	u32	fcoe_silent_drop_pkt_crc_error_cnt;
88 	u32	fcoe_silent_drop_pkt_task_invalid_cnt;
89 	u32	fcoe_silent_drop_total_pkt_cnt;
90 
91 	u64	fcoe_tx_byte_cnt;
92 	u64	fcoe_tx_data_pkt_cnt;
93 	u64	fcoe_tx_xfer_pkt_cnt;
94 	u64	fcoe_tx_other_pkt_cnt;
95 };
96 
97 enum _ecore_status_t
98 ecore_fcoe_acquire_connection(struct ecore_hwfn *p_hwfn,
99 			      struct ecore_fcoe_conn *p_in_conn,
100 			      struct ecore_fcoe_conn **p_out_conn);
101 
102 void OSAL_IOMEM *ecore_fcoe_get_db_addr(struct ecore_hwfn *p_hwfn,
103 					u32 cid);
104 
105 void OSAL_IOMEM *ecore_fcoe_get_global_cmdq_cons(struct ecore_hwfn *p_hwfn,
106 						 u8 relative_q_id);
107 
108 void OSAL_IOMEM *ecore_fcoe_get_primary_bdq_prod(struct ecore_hwfn *p_hwfn,
109 						  u8 bdq_id);
110 
111 void OSAL_IOMEM *ecore_fcoe_get_secondary_bdq_prod(struct ecore_hwfn *p_hwfn,
112 						    u8 bdq_id);
113 
114 enum _ecore_status_t
115 ecore_fcoe_offload_connection(struct ecore_hwfn	*p_hwfn,
116 			      struct ecore_fcoe_conn *p_conn);
117 
118 enum _ecore_status_t
119 ecore_fcoe_terminate_connection(struct ecore_hwfn *p_hwfn,
120 				struct ecore_fcoe_conn *p_conn);
121 
122 void ecore_fcoe_release_connection(struct ecore_hwfn *p_hwfn,
123 				   struct ecore_fcoe_conn *p_conn);
124 
125 enum _ecore_status_t
126 ecore_sp_fcoe_func_start(struct ecore_hwfn *p_hwfn,
127 			 enum spq_mode comp_mode,
128 			 struct ecore_spq_comp_cb *p_comp_addr);
129 
130 enum _ecore_status_t
131 ecore_sp_fcoe_func_stop(struct ecore_hwfn *p_hwfn,
132 			struct ecore_ptt *p_ptt,
133 			enum spq_mode comp_mode,
134 			struct ecore_spq_comp_cb *p_comp_addr);
135 
136 enum _ecore_status_t
137 ecore_fcoe_get_stats(struct ecore_hwfn *p_hwfn,
138 		     struct ecore_fcoe_stats *stats);
139 
140 #endif
141