1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2021 Broadcom. All Rights Reserved. The term
4 * ���Broadcom��� refers to Broadcom Inc. and/or its subsidiaries.
5 */
6
7#ifndef __EFC_ELS_H__
8#define __EFC_ELS_H__
9
10#define EFC_STATUS_INVALID	INT_MAX
11#define EFC_ELS_IO_POOL_SZ	1024
12
13struct efc_els_io_req {
14	struct list_head	list_entry;
15	struct kref		ref;
16	void			(*release)(struct kref *arg);
17	struct efc_node		*node;
18	void			*cb;
19	u32			els_retries_remaining;
20	bool			els_req_free;
21	struct timer_list       delay_timer;
22
23	const char		*display_name;
24
25	struct efc_disc_io	io;
26};
27
28typedef int(*efc_hw_srrs_cb_t)(void *arg, u32 length, int status,
29			       u32 ext_status);
30
31void _efc_els_io_free(struct kref *arg);
32struct efc_els_io_req *
33efc_els_io_alloc(struct efc_node *node, u32 reqlen);
34struct efc_els_io_req *
35efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen);
36void efc_els_io_free(struct efc_els_io_req *els);
37
38/* ELS command send */
39typedef void (*els_cb_t)(struct efc_node *node,
40			 struct efc_node_cb *cbdata, void *arg);
41int
42efc_send_plogi(struct efc_node *node);
43int
44efc_send_flogi(struct efc_node *node);
45int
46efc_send_fdisc(struct efc_node *node);
47int
48efc_send_prli(struct efc_node *node);
49int
50efc_send_prlo(struct efc_node *node);
51int
52efc_send_logo(struct efc_node *node);
53int
54efc_send_adisc(struct efc_node *node);
55int
56efc_send_pdisc(struct efc_node *node);
57int
58efc_send_scr(struct efc_node *node);
59int
60efc_ns_send_rftid(struct efc_node *node);
61int
62efc_ns_send_rffid(struct efc_node *node);
63int
64efc_ns_send_gidpt(struct efc_node *node);
65void
66efc_els_io_cleanup(struct efc_els_io_req *els, int evt, void *arg);
67
68/* ELS acc send */
69int
70efc_send_ls_acc(struct efc_node *node, u32 ox_id);
71int
72efc_send_ls_rjt(struct efc_node *node, u32 ox_id, u32 reason_cod,
73		u32 reason_code_expl, u32 vendor_unique);
74int
75efc_send_flogi_p2p_acc(struct efc_node *node, u32 ox_id, u32 s_id);
76int
77efc_send_flogi_acc(struct efc_node *node, u32 ox_id, u32 is_fport);
78int
79efc_send_plogi_acc(struct efc_node *node, u32 ox_id);
80int
81efc_send_prli_acc(struct efc_node *node, u32 ox_id);
82int
83efc_send_logo_acc(struct efc_node *node, u32 ox_id);
84int
85efc_send_prlo_acc(struct efc_node *node, u32 ox_id);
86int
87efc_send_adisc_acc(struct efc_node *node, u32 ox_id);
88
89int
90efc_bls_send_acc_hdr(struct efc *efc, struct efc_node *node,
91		     struct fc_frame_header *hdr);
92int
93efc_bls_send_rjt_hdr(struct efc_els_io_req *io, struct fc_frame_header *hdr);
94
95int
96efc_els_io_list_empty(struct efc_node *node, struct list_head *list);
97
98/* CT */
99int
100efc_send_ct_rsp(struct efc *efc, struct efc_node *node, u16 ox_id,
101		struct fc_ct_hdr *ct_hdr, u32 cmd_rsp_code, u32 reason_code,
102		u32 reason_code_explanation);
103
104int
105efc_send_bls_acc(struct efc_node *node, struct fc_frame_header *hdr);
106
107#endif /* __EFC_ELS_H__ */
108