PageRenderTime 36ms CodeModel.GetById 24ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/scsi/bfa/bfad_im.h

https://bitbucket.org/wisechild/galaxy-nexus
C++ Header | 144 lines | 103 code | 19 blank | 22 comment | 0 complexity | c9c6a01e9ea3a33b49c590cdc2daf2ab MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1/*
  2 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
  3 * All rights reserved
  4 * www.brocade.com
  5 *
  6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7 *
  8 * This program is free software; you can redistribute it and/or modify it
  9 * under the terms of the GNU General Public License (GPL) Version 2 as
 10 * published by the Free Software Foundation
 11 *
 12 * This program is distributed in the hope that it will be useful, but
 13 * WITHOUT ANY WARRANTY; without even the implied warranty of
 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 15 * General Public License for more details.
 16 */
 17
 18#ifndef __BFAD_IM_H__
 19#define __BFAD_IM_H__
 20
 21#include "bfa_fcs.h"
 22
 23#define FCPI_NAME " fcpim"
 24
 25#ifndef KOBJ_NAME_LEN
 26#define KOBJ_NAME_LEN           20
 27#endif
 28
 29bfa_status_t bfad_im_module_init(void);
 30void bfad_im_module_exit(void);
 31bfa_status_t bfad_im_probe(struct bfad_s *bfad);
 32void bfad_im_probe_undo(struct bfad_s *bfad);
 33bfa_status_t bfad_im_port_new(struct bfad_s *bfad, struct bfad_port_s *port);
 34void bfad_im_port_delete(struct bfad_s *bfad, struct bfad_port_s *port);
 35void bfad_im_port_clean(struct bfad_im_port_s *im_port);
 36int  bfad_im_scsi_host_alloc(struct bfad_s *bfad,
 37		struct bfad_im_port_s *im_port, struct device *dev);
 38void bfad_im_scsi_host_free(struct bfad_s *bfad,
 39				struct bfad_im_port_s *im_port);
 40
 41#define MAX_FCP_TARGET 1024
 42#define MAX_FCP_LUN 16384
 43#define BFAD_TARGET_RESET_TMO 60
 44#define BFAD_LUN_RESET_TMO 60
 45#define ScsiResult(host_code, scsi_code) (((host_code) << 16) | scsi_code)
 46#define BFA_QUEUE_FULL_RAMP_UP_TIME 120
 47
 48/*
 49 * itnim flags
 50 */
 51#define IO_DONE_BIT			0
 52
 53struct bfad_itnim_data_s {
 54	struct bfad_itnim_s *itnim;
 55};
 56
 57struct bfad_im_port_s {
 58	struct bfad_s         *bfad;
 59	struct bfad_port_s    *port;
 60	struct work_struct port_delete_work;
 61	int             idr_id;
 62	u16        cur_scsi_id;
 63	u16	flags;
 64	struct list_head binding_list;
 65	struct Scsi_Host *shost;
 66	struct list_head itnim_mapped_list;
 67	struct fc_vport *fc_vport;
 68};
 69
 70enum bfad_itnim_state {
 71	ITNIM_STATE_NONE,
 72	ITNIM_STATE_ONLINE,
 73	ITNIM_STATE_OFFLINE_PENDING,
 74	ITNIM_STATE_OFFLINE,
 75	ITNIM_STATE_TIMEOUT,
 76	ITNIM_STATE_FREE,
 77};
 78
 79/*
 80 * Per itnim data structure
 81 */
 82struct bfad_itnim_s {
 83	struct list_head list_entry;
 84	struct bfa_fcs_itnim_s fcs_itnim;
 85	struct work_struct itnim_work;
 86	u32        flags;
 87	enum bfad_itnim_state state;
 88	struct bfad_im_s *im;
 89	struct bfad_im_port_s *im_port;
 90	struct bfad_rport_s *drv_rport;
 91	struct fc_rport *fc_rport;
 92	struct bfa_itnim_s *bfa_itnim;
 93	u16        scsi_tgt_id;
 94	u16        queue_work;
 95	unsigned long	last_ramp_up_time;
 96	unsigned long	last_queue_full_time;
 97};
 98
 99enum bfad_binding_type {
100	FCP_PWWN_BINDING = 0x1,
101	FCP_NWWN_BINDING = 0x2,
102	FCP_FCID_BINDING = 0x3,
103};
104
105struct bfad_fcp_binding {
106	struct list_head list_entry;
107	enum bfad_binding_type binding_type;
108	u16        scsi_target_id;
109	u32        fc_id;
110	wwn_t           nwwn;
111	wwn_t           pwwn;
112};
113
114struct bfad_im_s {
115	struct bfad_s         *bfad;
116	struct workqueue_struct *drv_workq;
117	char            drv_workq_name[KOBJ_NAME_LEN];
118};
119
120struct Scsi_Host *bfad_scsi_host_alloc(struct bfad_im_port_s *im_port,
121				struct bfad_s *);
122bfa_status_t bfad_thread_workq(struct bfad_s *bfad);
123void bfad_destroy_workq(struct bfad_im_s *im);
124void bfad_fc_host_init(struct bfad_im_port_s *im_port);
125void bfad_scsi_host_free(struct bfad_s *bfad,
126				 struct bfad_im_port_s *im_port);
127void bfad_ramp_up_qdepth(struct bfad_itnim_s *itnim,
128				 struct scsi_device *sdev);
129void bfad_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev);
130struct bfad_itnim_s *bfad_get_itnim(struct bfad_im_port_s *im_port, int id);
131
132extern struct scsi_host_template bfad_im_scsi_host_template;
133extern struct scsi_host_template bfad_im_vport_template;
134extern struct fc_function_template bfad_im_fc_function_template;
135extern struct fc_function_template bfad_im_vport_fc_function_template;
136extern struct scsi_transport_template *bfad_im_scsi_transport_template;
137extern struct scsi_transport_template *bfad_im_scsi_vport_transport_template;
138
139extern struct device_attribute *bfad_im_host_attrs[];
140extern struct device_attribute *bfad_im_vport_attrs[];
141
142irqreturn_t bfad_intx(int irq, void *dev_id);
143
144#endif