aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/libfc.h
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2010-08-15 01:06:31 -0400
committerLen Brown <len.brown@intel.com>2010-08-15 01:06:31 -0400
commit95ee46aa8698f2000647dfb362400fadbb5807cf (patch)
treee5a05c7297f997e191c73091934e42e3195c0e40 /include/scsi/libfc.h
parentcfa806f059801dbe7e435745eb2e187c8bfe1e7f (diff)
parent92fa5bd9a946b6e7aab6764e7312e4e3d9bed295 (diff)
Merge branch 'linus' into release
Conflicts: drivers/acpi/debug.c Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'include/scsi/libfc.h')
-rw-r--r--include/scsi/libfc.h75
1 files changed, 39 insertions, 36 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 7495c0ba67ee..14be49b44e84 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -42,24 +42,6 @@
42#define FC_EX_TIMEOUT 1 /* Exchange timeout */ 42#define FC_EX_TIMEOUT 1 /* Exchange timeout */
43#define FC_EX_CLOSED 2 /* Exchange closed */ 43#define FC_EX_CLOSED 2 /* Exchange closed */
44 44
45/* some helpful macros */
46
47#define ntohll(x) be64_to_cpu(x)
48#define htonll(x) cpu_to_be64(x)
49
50
51static inline u32 ntoh24(const u8 *p)
52{
53 return (p[0] << 16) | (p[1] << 8) | p[2];
54}
55
56static inline void hton24(u8 *p, u32 v)
57{
58 p[0] = (v >> 16) & 0xff;
59 p[1] = (v >> 8) & 0xff;
60 p[2] = v & 0xff;
61}
62
63/** 45/**
64 * enum fc_lport_state - Local port states 46 * enum fc_lport_state - Local port states
65 * @LPORT_ST_DISABLED: Disabled 47 * @LPORT_ST_DISABLED: Disabled
@@ -97,25 +79,25 @@ enum fc_disc_event {
97/** 79/**
98 * enum fc_rport_state - Remote port states 80 * enum fc_rport_state - Remote port states
99 * @RPORT_ST_INIT: Initialized 81 * @RPORT_ST_INIT: Initialized
82 * @RPORT_ST_FLOGI: Waiting for FLOGI completion for point-to-multipoint
83 * @RPORT_ST_PLOGI_WAIT: Waiting for peer to login for point-to-multipoint
100 * @RPORT_ST_PLOGI: Waiting for PLOGI completion 84 * @RPORT_ST_PLOGI: Waiting for PLOGI completion
101 * @RPORT_ST_PRLI: Waiting for PRLI completion 85 * @RPORT_ST_PRLI: Waiting for PRLI completion
102 * @RPORT_ST_RTV: Waiting for RTV completion 86 * @RPORT_ST_RTV: Waiting for RTV completion
103 * @RPORT_ST_READY: Ready for use 87 * @RPORT_ST_READY: Ready for use
104 * @RPORT_ST_LOGO: Remote port logout (LOGO) sent
105 * @RPORT_ST_ADISC: Discover Address sent 88 * @RPORT_ST_ADISC: Discover Address sent
106 * @RPORT_ST_DELETE: Remote port being deleted 89 * @RPORT_ST_DELETE: Remote port being deleted
107 * @RPORT_ST_RESTART: Remote port being deleted and will restart
108*/ 90*/
109enum fc_rport_state { 91enum fc_rport_state {
110 RPORT_ST_INIT, 92 RPORT_ST_INIT,
93 RPORT_ST_FLOGI,
94 RPORT_ST_PLOGI_WAIT,
111 RPORT_ST_PLOGI, 95 RPORT_ST_PLOGI,
112 RPORT_ST_PRLI, 96 RPORT_ST_PRLI,
113 RPORT_ST_RTV, 97 RPORT_ST_RTV,
114 RPORT_ST_READY, 98 RPORT_ST_READY,
115 RPORT_ST_LOGO,
116 RPORT_ST_ADISC, 99 RPORT_ST_ADISC,
117 RPORT_ST_DELETE, 100 RPORT_ST_DELETE,
118 RPORT_ST_RESTART,
119}; 101};
120 102
121/** 103/**
@@ -173,6 +155,7 @@ struct fc_rport_libfc_priv {
173 u16 flags; 155 u16 flags;
174 #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0) 156 #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0)
175 #define FC_RP_FLAGS_RETRY (1 << 1) 157 #define FC_RP_FLAGS_RETRY (1 << 1)
158 #define FC_RP_STARTED (1 << 2)
176 unsigned int e_d_tov; 159 unsigned int e_d_tov;
177 unsigned int r_a_tov; 160 unsigned int r_a_tov;
178}; 161};
@@ -185,16 +168,18 @@ struct fc_rport_libfc_priv {
185 * @rp_state: Enumeration that tracks progress of PLOGI, PRLI, 168 * @rp_state: Enumeration that tracks progress of PLOGI, PRLI,
186 * and RTV exchanges 169 * and RTV exchanges
187 * @ids: The remote port identifiers and roles 170 * @ids: The remote port identifiers and roles
188 * @flags: REC and RETRY supported flags 171 * @flags: STARTED, REC and RETRY_SUPPORTED flags
189 * @max_seq: Maximum number of concurrent sequences 172 * @max_seq: Maximum number of concurrent sequences
190 * @disc_id: The discovery identifier 173 * @disc_id: The discovery identifier
191 * @maxframe_size: The maximum frame size 174 * @maxframe_size: The maximum frame size
192 * @retries: The retry count for the current state 175 * @retries: The retry count for the current state
176 * @major_retries: The retry count for the entire PLOGI/PRLI state machine
193 * @e_d_tov: Error detect timeout value (in msec) 177 * @e_d_tov: Error detect timeout value (in msec)
194 * @r_a_tov: Resource allocation timeout value (in msec) 178 * @r_a_tov: Resource allocation timeout value (in msec)
195 * @rp_mutex: The mutex that protects the remote port 179 * @rp_mutex: The mutex that protects the remote port
196 * @retry_work: Handle for retries 180 * @retry_work: Handle for retries
197 * @event_callback: Callback when READY, FAILED or LOGO states complete 181 * @event_callback: Callback when READY, FAILED or LOGO states complete
182 * @rcu: Structure used for freeing in an RCU-safe manner
198 */ 183 */
199struct fc_rport_priv { 184struct fc_rport_priv {
200 struct fc_lport *local_port; 185 struct fc_lport *local_port;
@@ -207,6 +192,7 @@ struct fc_rport_priv {
207 u16 disc_id; 192 u16 disc_id;
208 u16 maxframe_size; 193 u16 maxframe_size;
209 unsigned int retries; 194 unsigned int retries;
195 unsigned int major_retries;
210 unsigned int e_d_tov; 196 unsigned int e_d_tov;
211 unsigned int r_a_tov; 197 unsigned int r_a_tov;
212 struct mutex rp_mutex; 198 struct mutex rp_mutex;
@@ -216,6 +202,7 @@ struct fc_rport_priv {
216 struct list_head peers; 202 struct list_head peers;
217 struct work_struct event_work; 203 struct work_struct event_work;
218 u32 supported_classes; 204 u32 supported_classes;
205 struct rcu_head rcu;
219}; 206};
220 207
221/** 208/**
@@ -262,14 +249,12 @@ struct fcoe_dev_stats {
262 249
263/** 250/**
264 * struct fc_seq_els_data - ELS data used for passing ELS specific responses 251 * struct fc_seq_els_data - ELS data used for passing ELS specific responses
265 * @fp: The ELS frame
266 * @reason: The reason for rejection 252 * @reason: The reason for rejection
267 * @explan: The explaination of the rejection 253 * @explan: The explaination of the rejection
268 * 254 *
269 * Mainly used by the exchange manager layer. 255 * Mainly used by the exchange manager layer.
270 */ 256 */
271struct fc_seq_els_data { 257struct fc_seq_els_data {
272 struct fc_frame *fp;
273 enum fc_els_rjt_reason reason; 258 enum fc_els_rjt_reason reason;
274 enum fc_els_rjt_explan explan; 259 enum fc_els_rjt_explan explan;
275}; 260};
@@ -405,6 +390,7 @@ struct fc_seq {
405 * @esb_stat: ESB exchange status 390 * @esb_stat: ESB exchange status
406 * @r_a_tov: Resouce allocation time out value (in msecs) 391 * @r_a_tov: Resouce allocation time out value (in msecs)
407 * @seq_id: The next sequence ID to use 392 * @seq_id: The next sequence ID to use
393 * @encaps: encapsulation information for lower-level driver
408 * @f_ctl: F_CTL flags for the sequence 394 * @f_ctl: F_CTL flags for the sequence
409 * @fh_type: The frame type 395 * @fh_type: The frame type
410 * @class: The class of service 396 * @class: The class of service
@@ -436,6 +422,7 @@ struct fc_exch {
436 u32 esb_stat; 422 u32 esb_stat;
437 u32 r_a_tov; 423 u32 r_a_tov;
438 u8 seq_id; 424 u8 seq_id;
425 u8 encaps;
439 u32 f_ctl; 426 u32 f_ctl;
440 u8 fh_type; 427 u8 fh_type;
441 enum fc_class class; 428 enum fc_class class;
@@ -530,12 +517,11 @@ struct libfc_function_template {
530 struct fc_frame *); 517 struct fc_frame *);
531 518
532 /* 519 /*
533 * Send an ELS response using infomation from a previous 520 * Send an ELS response using infomation from the received frame.
534 * exchange and sequence.
535 * 521 *
536 * STATUS: OPTIONAL 522 * STATUS: OPTIONAL
537 */ 523 */
538 void (*seq_els_rsp_send)(struct fc_seq *, enum fc_els_cmd, 524 void (*seq_els_rsp_send)(struct fc_frame *, enum fc_els_cmd,
539 struct fc_seq_els_data *); 525 struct fc_seq_els_data *);
540 526
541 /* 527 /*
@@ -567,6 +553,13 @@ struct libfc_function_template {
567 struct fc_seq *(*seq_start_next)(struct fc_seq *); 553 struct fc_seq *(*seq_start_next)(struct fc_seq *);
568 554
569 /* 555 /*
556 * Assign a sequence for an incoming request frame.
557 *
558 * STATUS: OPTIONAL
559 */
560 struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *);
561
562 /*
570 * Reset an exchange manager, completing all sequences and exchanges. 563 * Reset an exchange manager, completing all sequences and exchanges.
571 * If s_id is non-zero, reset only exchanges originating from that FID. 564 * If s_id is non-zero, reset only exchanges originating from that FID.
572 * If d_id is non-zero, reset only exchanges sending to that FID. 565 * If d_id is non-zero, reset only exchanges sending to that FID.
@@ -587,8 +580,7 @@ struct libfc_function_template {
587 * 580 *
588 * STATUS: OPTIONAL 581 * STATUS: OPTIONAL
589 */ 582 */
590 void (*lport_recv)(struct fc_lport *, struct fc_seq *, 583 void (*lport_recv)(struct fc_lport *, struct fc_frame *);
591 struct fc_frame *);
592 584
593 /* 585 /*
594 * Reset the local port. 586 * Reset the local port.
@@ -650,8 +642,7 @@ struct libfc_function_template {
650 * 642 *
651 * STATUS: OPTIONAL 643 * STATUS: OPTIONAL
652 */ 644 */
653 void (*rport_recv_req)(struct fc_seq *, struct fc_frame *, 645 void (*rport_recv_req)(struct fc_lport *, struct fc_frame *);
654 struct fc_lport *);
655 646
656 /* 647 /*
657 * lookup an rport by it's port ID. 648 * lookup an rport by it's port ID.
@@ -697,8 +688,7 @@ struct libfc_function_template {
697 * 688 *
698 * STATUS: OPTIONAL 689 * STATUS: OPTIONAL
699 */ 690 */
700 void (*disc_recv_req)(struct fc_seq *, struct fc_frame *, 691 void (*disc_recv_req)(struct fc_lport *, struct fc_frame *);
701 struct fc_lport *);
702 692
703 /* 693 /*
704 * Start discovery for a local port. 694 * Start discovery for a local port.
@@ -736,7 +726,7 @@ struct libfc_function_template {
736 * @buf_len: Length of the discovery buffer 726 * @buf_len: Length of the discovery buffer
737 * @disc_id: Discovery ID 727 * @disc_id: Discovery ID
738 * @rports: List of discovered remote ports 728 * @rports: List of discovered remote ports
739 * @lport: The local port that discovery is for 729 * @priv: Private pointer for use by discovery code
740 * @disc_mutex: Mutex that protects the discovery context 730 * @disc_mutex: Mutex that protects the discovery context
741 * @partial_buf: Partial name buffer (if names are returned 731 * @partial_buf: Partial name buffer (if names are returned
742 * in multiple frames) 732 * in multiple frames)
@@ -752,7 +742,7 @@ struct fc_disc {
752 u16 disc_id; 742 u16 disc_id;
753 743
754 struct list_head rports; 744 struct list_head rports;
755 struct fc_lport *lport; 745 void *priv;
756 struct mutex disc_mutex; 746 struct mutex disc_mutex;
757 struct fc_gpn_ft_resp partial_buf; 747 struct fc_gpn_ft_resp partial_buf;
758 struct delayed_work disc_work; 748 struct delayed_work disc_work;
@@ -796,6 +786,7 @@ struct fc_disc {
796 * @mfs: The maximum Fibre Channel payload size 786 * @mfs: The maximum Fibre Channel payload size
797 * @max_retry_count: The maximum retry attempts 787 * @max_retry_count: The maximum retry attempts
798 * @max_rport_retry_count: The maximum remote port retry attempts 788 * @max_rport_retry_count: The maximum remote port retry attempts
789 * @rport_priv_size: Size needed by driver after struct fc_rport_priv
799 * @lro_xid: The maximum XID for LRO 790 * @lro_xid: The maximum XID for LRO
800 * @lso_max: The maximum large offload send size 791 * @lso_max: The maximum large offload send size
801 * @fcts: FC-4 type mask 792 * @fcts: FC-4 type mask
@@ -842,9 +833,11 @@ struct fc_lport {
842 u32 lro_enabled:1; 833 u32 lro_enabled:1;
843 u32 does_npiv:1; 834 u32 does_npiv:1;
844 u32 npiv_enabled:1; 835 u32 npiv_enabled:1;
836 u32 point_to_multipoint:1;
845 u32 mfs; 837 u32 mfs;
846 u8 max_retry_count; 838 u8 max_retry_count;
847 u8 max_rport_retry_count; 839 u8 max_rport_retry_count;
840 u16 rport_priv_size;
848 u16 link_speed; 841 u16 link_speed;
849 u16 link_supported_speeds; 842 u16 link_supported_speeds;
850 u16 lro_xid; 843 u16 lro_xid;
@@ -986,6 +979,7 @@ int fc_set_mfs(struct fc_lport *, u32 mfs);
986struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize); 979struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize);
987struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id); 980struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id);
988int fc_lport_bsg_request(struct fc_bsg_job *); 981int fc_lport_bsg_request(struct fc_bsg_job *);
982void fc_lport_set_local_id(struct fc_lport *, u32 port_id);
989 983
990/* 984/*
991 * REMOTE PORT LAYER 985 * REMOTE PORT LAYER
@@ -998,6 +992,11 @@ void fc_rport_terminate_io(struct fc_rport *);
998 *****************************/ 992 *****************************/
999int fc_disc_init(struct fc_lport *); 993int fc_disc_init(struct fc_lport *);
1000 994
995static inline struct fc_lport *fc_disc_lport(struct fc_disc *disc)
996{
997 return container_of(disc, struct fc_lport, disc);
998}
999
1001/* 1000/*
1002 * FCP LAYER 1001 * FCP LAYER
1003 *****************************/ 1002 *****************************/
@@ -1029,6 +1028,10 @@ struct fc_seq *fc_elsct_send(struct fc_lport *, u32 did,
1029 void *arg, u32 timer_msec); 1028 void *arg, u32 timer_msec);
1030void fc_lport_flogi_resp(struct fc_seq *, struct fc_frame *, void *); 1029void fc_lport_flogi_resp(struct fc_seq *, struct fc_frame *, void *);
1031void fc_lport_logo_resp(struct fc_seq *, struct fc_frame *, void *); 1030void fc_lport_logo_resp(struct fc_seq *, struct fc_frame *, void *);
1031void fc_fill_reply_hdr(struct fc_frame *, const struct fc_frame *,
1032 enum fc_rctl, u32 parm_offset);
1033void fc_fill_hdr(struct fc_frame *, const struct fc_frame *,
1034 enum fc_rctl, u32 f_ctl, u16 seq_cnt, u32 parm_offset);
1032 1035
1033 1036
1034/* 1037/*