1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright 2014 Cisco Systems, Inc. All rights reserved. */
7 #include "snic_fwint.h"
18 struct list_head tgt_list
;
19 enum snic_disc_state state
;
26 struct delayed_work disc_timeout
;
27 void (*cb
)(struct snic
*);
30 #define SNIC_TGT_NAM_LEN 16
35 SNIC_TGT_STAT_ONLINE
, /* Target is Online */
36 SNIC_TGT_STAT_OFFLINE
, /* Target is Offline */
40 struct snic_tgt_priv
{
41 struct list_head list
;
42 enum snic_tgt_type typ
;
44 char *name
[SNIC_TGT_NAM_LEN
];
47 /*DAS Target specific info */
48 /*SAN Target specific info */
54 #define SNIC_TGT_SCAN_PENDING 0x01
57 struct list_head list
;
62 enum snic_tgt_state state
;
64 struct work_struct scan_work
;
65 struct work_struct del_work
;
66 struct snic_tgt_priv tdata
;
72 void snic_disc_init(struct snic_disc
*);
73 int snic_disc_start(struct snic
*);
74 void snic_disc_term(struct snic
*);
75 int snic_report_tgt_cmpl_handler(struct snic
*, struct snic_fw_req
*);
76 int snic_tgtinfo_cmpl_handler(struct snic
*snic
, struct snic_fw_req
*fwreq
);
77 void snic_process_report_tgts_rsp(struct work_struct
*);
78 void snic_handle_tgt_disc(struct work_struct
*);
79 void snic_handle_disc(struct work_struct
*);
80 void snic_tgt_dev_release(struct device
*);
81 void snic_tgt_del_all(struct snic
*);
83 #define dev_to_tgt(d) \
84 container_of(d, struct snic_tgt, dev)
87 is_snic_target(struct device
*dev
)
89 return dev
->release
== snic_tgt_dev_release
;
92 #define starget_to_tgt(st) \
93 (is_snic_target(((struct scsi_target *) st)->dev.parent) ? \
94 dev_to_tgt(st->dev.parent) : NULL)
96 #define snic_tgt_to_shost(t) \
97 dev_to_shost(t->dev.parent)
100 snic_tgt_chkready(struct snic_tgt
*tgt
)
102 if (tgt
->state
== SNIC_TGT_STAT_ONLINE
)
105 return DID_NO_CONNECT
<< 16;
108 const char *snic_tgt_state_to_str(int);
109 int snic_tgt_scsi_abort_io(struct snic_tgt
*);
110 #endif /* end of __SNIC_DISC_H */