1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, v.1,  (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://opensource.org/licenses/CDDL-1.0.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 
22 /*
23 * Copyright 2014-2017 Cavium, Inc.
24 * The contents of this file are subject to the terms of the Common Development
25 * and Distribution License, v.1,  (the "License").
26 
27 * You may not use this file except in compliance with the License.
28 
29 * You can obtain a copy of the License at available
30 * at http://opensource.org/licenses/CDDL-1.0
31 
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
34 */
35 
36 #ifndef __ECORE_FCOE_API_H__
37 #define __ECORE_FCOE_API_H__
38 
39 #include "ecore_sp_api.h"
40 
41 struct ecore_fcoe_conn {
42 	osal_list_entry_t	list_entry;
43 	bool			free_on_delete;
44 
45 	u16			conn_id;
46 	u32			icid;
47 	u32			fw_cid;
48 	u8			layer_code;
49 
50 	dma_addr_t		sq_pbl_addr;
51 	dma_addr_t		sq_curr_page_addr;
52 	dma_addr_t		sq_next_page_addr;
53 	dma_addr_t		xferq_pbl_addr;
54 	void			*xferq_pbl_addr_virt_addr;
55 	dma_addr_t		xferq_addr[4];
56 	void			*xferq_addr_virt_addr[4];
57 	dma_addr_t		confq_pbl_addr;
58 	void			*confq_pbl_addr_virt_addr;
59 	dma_addr_t		confq_addr[2];
60 	void			*confq_addr_virt_addr[2];
61 
62 	dma_addr_t		terminate_params;
63 
64 	u16			dst_mac_addr_lo;
65 	u16			dst_mac_addr_mid;
66 	u16			dst_mac_addr_hi;
67 	u16			src_mac_addr_lo;
68 	u16			src_mac_addr_mid;
69 	u16			src_mac_addr_hi;
70 
71 	u16			tx_max_fc_pay_len;
72 	u16			e_d_tov_timer_val;
73 	u16			rec_tov_timer_val;
74 	u16			rx_max_fc_pay_len;
75 	u16			vlan_tag;
76 	u16			physical_q0;
77 
78 	struct fc_addr_nw	s_id;
79 	u8 max_conc_seqs_c3;
80 	struct fc_addr_nw	d_id;
81 	u8			flags;
82 	u8			def_q_idx;
83 };
84 
85 #ifndef __EXTRACT__LINUX__
86 struct ecore_fcoe_stats {
87 	u64	fcoe_rx_byte_cnt;
88 	u64	fcoe_rx_data_pkt_cnt;
89 	u64	fcoe_rx_xfer_pkt_cnt;
90 	u64	fcoe_rx_other_pkt_cnt;
91 	u32	fcoe_silent_drop_pkt_cmdq_full_cnt;
92 	u32	fcoe_silent_drop_pkt_rq_full_cnt;
93 	u32	fcoe_silent_drop_pkt_crc_error_cnt;
94 	u32	fcoe_silent_drop_pkt_task_invalid_cnt;
95 	u32	fcoe_silent_drop_total_pkt_cnt;
96 
97 	u64	fcoe_tx_byte_cnt;
98 	u64	fcoe_tx_data_pkt_cnt;
99 	u64	fcoe_tx_xfer_pkt_cnt;
100 	u64	fcoe_tx_other_pkt_cnt;
101 };
102 #endif
103 
104 enum _ecore_status_t
105 ecore_fcoe_acquire_connection(struct ecore_hwfn *p_hwfn,
106 			      struct ecore_fcoe_conn *p_in_conn,
107 			      struct ecore_fcoe_conn **p_out_conn);
108 
109 void OSAL_IOMEM *ecore_fcoe_get_db_addr(struct ecore_hwfn *p_hwfn,
110 					u32 cid);
111 
112 void OSAL_IOMEM *ecore_fcoe_get_global_cmdq_cons(struct ecore_hwfn *p_hwfn,
113 						 u8 relative_q_id);
114 
115 void OSAL_IOMEM *ecore_fcoe_get_primary_bdq_prod(struct ecore_hwfn *p_hwfn,
116 						  u8 bdq_id);
117 
118 void OSAL_IOMEM *ecore_fcoe_get_secondary_bdq_prod(struct ecore_hwfn *p_hwfn,
119 						    u8 bdq_id);
120 
121 enum _ecore_status_t
122 ecore_fcoe_offload_connection(struct ecore_hwfn	*p_hwfn,
123 			      struct ecore_fcoe_conn *p_conn);
124 
125 enum _ecore_status_t
126 ecore_fcoe_terminate_connection(struct ecore_hwfn *p_hwfn,
127 				struct ecore_fcoe_conn *p_conn);
128 
129 void ecore_fcoe_release_connection(struct ecore_hwfn *p_hwfn,
130 				   struct ecore_fcoe_conn *p_conn);
131 
132 enum _ecore_status_t
133 ecore_sp_fcoe_func_start(struct ecore_hwfn *p_hwfn,
134 			 enum spq_mode comp_mode,
135 			 struct ecore_spq_comp_cb *p_comp_addr);
136 
137 enum _ecore_status_t
138 ecore_sp_fcoe_func_stop(struct ecore_hwfn *p_hwfn,
139 			enum spq_mode comp_mode,
140 			struct ecore_spq_comp_cb *p_comp_addr);
141 
142 enum _ecore_status_t
143 ecore_fcoe_get_stats(struct ecore_hwfn *p_hwfn,
144 		     struct ecore_fcoe_stats *stats);
145 
146 #endif
147