xref: /openbmc/linux/drivers/scsi/elx/libefc/efc_els.h (revision 9659281c)
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 
13 struct 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 
28 typedef int(*efc_hw_srrs_cb_t)(void *arg, u32 length, int status,
29 			       u32 ext_status);
30 
31 void _efc_els_io_free(struct kref *arg);
32 struct efc_els_io_req *
33 efc_els_io_alloc(struct efc_node *node, u32 reqlen);
34 struct efc_els_io_req *
35 efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen);
36 void efc_els_io_free(struct efc_els_io_req *els);
37 
38 /* ELS command send */
39 typedef void (*els_cb_t)(struct efc_node *node,
40 			 struct efc_node_cb *cbdata, void *arg);
41 int
42 efc_send_plogi(struct efc_node *node);
43 int
44 efc_send_flogi(struct efc_node *node);
45 int
46 efc_send_fdisc(struct efc_node *node);
47 int
48 efc_send_prli(struct efc_node *node);
49 int
50 efc_send_prlo(struct efc_node *node);
51 int
52 efc_send_logo(struct efc_node *node);
53 int
54 efc_send_adisc(struct efc_node *node);
55 int
56 efc_send_pdisc(struct efc_node *node);
57 int
58 efc_send_scr(struct efc_node *node);
59 int
60 efc_ns_send_rftid(struct efc_node *node);
61 int
62 efc_ns_send_rffid(struct efc_node *node);
63 int
64 efc_ns_send_gidpt(struct efc_node *node);
65 void
66 efc_els_io_cleanup(struct efc_els_io_req *els, int evt, void *arg);
67 
68 /* ELS acc send */
69 int
70 efc_send_ls_acc(struct efc_node *node, u32 ox_id);
71 int
72 efc_send_ls_rjt(struct efc_node *node, u32 ox_id, u32 reason_cod,
73 		u32 reason_code_expl, u32 vendor_unique);
74 int
75 efc_send_flogi_p2p_acc(struct efc_node *node, u32 ox_id, u32 s_id);
76 int
77 efc_send_flogi_acc(struct efc_node *node, u32 ox_id, u32 is_fport);
78 int
79 efc_send_plogi_acc(struct efc_node *node, u32 ox_id);
80 int
81 efc_send_prli_acc(struct efc_node *node, u32 ox_id);
82 int
83 efc_send_logo_acc(struct efc_node *node, u32 ox_id);
84 int
85 efc_send_prlo_acc(struct efc_node *node, u32 ox_id);
86 int
87 efc_send_adisc_acc(struct efc_node *node, u32 ox_id);
88 
89 int
90 efc_bls_send_acc_hdr(struct efc *efc, struct efc_node *node,
91 		     struct fc_frame_header *hdr);
92 int
93 efc_bls_send_rjt_hdr(struct efc_els_io_req *io, struct fc_frame_header *hdr);
94 
95 int
96 efc_els_io_list_empty(struct efc_node *node, struct list_head *list);
97 
98 /* CT */
99 int
100 efc_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 
104 int
105 efc_send_bls_acc(struct efc_node *node, struct fc_frame_header *hdr);
106 
107 #endif /* __EFC_ELS_H__ */
108