2 * Copyright 2014 Cisco Systems, Inc. All rights reserved.
4 * This program is free software; you may redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
11 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
12 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
13 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 #include "snic_fwint.h"
23 enum snic_disc_state {
32 struct list_head tgt_list;
33 enum snic_disc_state state;
40 struct delayed_work disc_timeout;
41 void (*cb)(struct snic *);
44 #define SNIC_TGT_NAM_LEN 16
49 SNIC_TGT_STAT_ONLINE, /* Target is Online */
50 SNIC_TGT_STAT_OFFLINE, /* Target is Offline */
54 struct snic_tgt_priv {
55 struct list_head list;
56 enum snic_tgt_type typ;
58 char *name[SNIC_TGT_NAM_LEN];
61 /*DAS Target specific info */
62 /*SAN Target specific info */
68 #define SNIC_TGT_SCAN_PENDING 0x01
71 struct list_head list;
76 enum snic_tgt_state state;
78 struct work_struct scan_work;
79 struct work_struct del_work;
80 struct snic_tgt_priv tdata;
86 void snic_disc_init(struct snic_disc *);
87 int snic_disc_start(struct snic *);
88 void snic_disc_term(struct snic *);
89 int snic_report_tgt_cmpl_handler(struct snic *, struct snic_fw_req *);
90 int snic_tgtinfo_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq);
91 void snic_process_report_tgts_rsp(struct work_struct *);
92 void snic_handle_tgt_disc(struct work_struct *);
93 void snic_handle_disc(struct work_struct *);
94 void snic_tgt_dev_release(struct device *);
95 void snic_tgt_del_all(struct snic *);
97 #define dev_to_tgt(d) \
98 container_of(d, struct snic_tgt, dev)
101 is_snic_target(struct device *dev)
103 return dev->release == snic_tgt_dev_release;
106 #define starget_to_tgt(st) \
107 (is_snic_target(((struct scsi_target *) st)->dev.parent) ? \
108 dev_to_tgt(st->dev.parent) : NULL)
110 #define snic_tgt_to_shost(t) \
111 dev_to_shost(t->dev.parent)
114 snic_tgt_chkready(struct snic_tgt *tgt)
116 if (tgt->state == SNIC_TGT_STAT_ONLINE)
119 return DID_NO_CONNECT << 16;
122 const char *snic_tgt_state_to_str(int);
123 int snic_tgt_scsi_abort_io(struct snic_tgt *);
124 #endif /* end of __SNIC_DISC_H */