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