summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/scsi/snic/snic_disc.h
blob: 97fa3f5c5bb4dae6b2ef7ce15a39b53b255ac524 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color
/*
 * Copyright 2014 Cisco Systems, Inc.  All rights reserved.
 *
 * This program is free software; you may redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#ifndef __SNIC_DISC_H
#define __SNIC_DISC_H

#include "snic_fwint.h"

enum snic_disc_state {
	SNIC_DISC_NONE,
	SNIC_DISC_INIT,
	SNIC_DISC_PENDING,
	SNIC_DISC_DONE
};

struct snic;
struct snic_disc {
	struct list_head tgt_list;
	enum snic_disc_state state;
	struct mutex mutex;
	u16	disc_id;
	u8	req_cnt;
	u32	nxt_tgt_id;
	u32	rtgt_cnt;
	u8	*rtgt_info;
	struct delayed_work disc_timeout;
	void (*cb)(struct snic *);
};

#define SNIC_TGT_NAM_LEN	16

enum snic_tgt_state {
	SNIC_TGT_STAT_NONE,
	SNIC_TGT_STAT_INIT,
	SNIC_TGT_STAT_ONLINE,	/* Target is Online */
	SNIC_TGT_STAT_OFFLINE,	/* Target is Offline */
	SNIC_TGT_STAT_DEL,
};

struct snic_tgt_priv {
	struct list_head list;
	enum snic_tgt_type typ;
	u16 disc_id;
	char *name[SNIC_TGT_NAM_LEN];

	union {
		/*DAS Target specific info */
		/*SAN Target specific info */
		u8 dummmy;
	} u;
};

/* snic tgt flags */
#define SNIC_TGT_SCAN_PENDING	0x01

struct snic_tgt {
	struct list_head list;
	u16	id;
	u16	channel;
	u32	flags;
	u32	scsi_tgt_id;
	enum snic_tgt_state state;
	struct device dev;
	struct work_struct scan_work;
	struct work_struct del_work;
	struct snic_tgt_priv tdata;
};


struct snic_fw_req;

void snic_disc_init(struct snic_disc *);
int snic_disc_start(struct snic *);
void snic_disc_term(struct snic *);
int snic_report_tgt_cmpl_handler(struct snic *, struct snic_fw_req *);
int snic_tgtinfo_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq);
void snic_process_report_tgts_rsp(struct work_struct *);
void snic_handle_tgt_disc(struct work_struct *);
void snic_handle_disc(struct work_struct *);
void snic_tgt_dev_release(struct device *);
void snic_tgt_del_all(struct snic *);

#define dev_to_tgt(d) \
	container_of(d, struct snic_tgt, dev)

static inline int
is_snic_target(struct device *dev)
{
	return dev->release == snic_tgt_dev_release;
}

#define starget_to_tgt(st)	\
	(is_snic_target(((struct scsi_target *) st)->dev.parent) ? \
		dev_to_tgt(st->dev.parent) : NULL)

#define snic_tgt_to_shost(t)	\
	dev_to_shost(t->dev.parent)

static inline int
snic_tgt_chkready(struct snic_tgt *tgt)
{
	if (tgt->state == SNIC_TGT_STAT_ONLINE)
		return 0;
	else
		return DID_NO_CONNECT << 16;
}

const char *snic_tgt_state_to_str(int);
int snic_tgt_scsi_abort_io(struct snic_tgt *);
#endif /* end of  __SNIC_DISC_H */