aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_elsct.c
diff options
context:
space:
mode:
authorRobert Love <robert.w.love@intel.com>2008-12-09 18:10:17 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-12-29 12:24:33 -0500
commit42e9a92fe6a9095bd68a379aaec7ad2be0337f7a (patch)
tree344f8d9f72a3d926d652632abb8d319f8e32343a /drivers/scsi/libfc/fc_elsct.c
parentf032c2f7cdaae0e8907cd3b26426fc651dc5c275 (diff)
[SCSI] libfc: A modular Fibre Channel library
libFC is composed of 4 blocks supported by an exchange manager and a framing library. The upper 4 layers are fc_lport, fc_disc, fc_rport and fc_fcp. A LLD that uses libfc could choose to either use libfc's block, or using the transport template defined in libfc.h, override one or more blocks with its own implementation. The EM (Exchange Manager) manages exhcanges/sequences for all commands- ELS, CT and FCP. The framing library frames ELS and CT commands. The fc_lport block manages the library's representation of the host's FC enabled ports. The fc_disc block manages discovery of targets as well as handling changes that occur in the FC fabric (via. RSCN events). The fc_rport block manages the library's representation of other entities in the FC fabric. Currently the library uses this block for targets, its peer when in point-to-point mode and the directory server, but can be extended for other entities if needed. The fc_fcp block interacts with the scsi-ml and handles all I/O. Signed-off-by: Robert Love <robert.w.love@intel.com> [jejb: added include of delay.h to fix ppc64 compile prob spotted by sfr] Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/libfc/fc_elsct.c')
-rw-r--r--drivers/scsi/libfc/fc_elsct.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/drivers/scsi/libfc/fc_elsct.c b/drivers/scsi/libfc/fc_elsct.c
new file mode 100644
index 000000000000..dd47fe619d1e
--- /dev/null
+++ b/drivers/scsi/libfc/fc_elsct.c
@@ -0,0 +1,71 @@
1/*
2 * Copyright(c) 2008 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20/*
21 * Provide interface to send ELS/CT FC frames
22 */
23
24#include <asm/unaligned.h>
25#include <scsi/fc/fc_gs.h>
26#include <scsi/fc/fc_ns.h>
27#include <scsi/fc/fc_els.h>
28#include <scsi/libfc.h>
29#include <scsi/fc_encode.h>
30
31/*
32 * fc_elsct_send - sends ELS/CT frame
33 */
34static struct fc_seq *fc_elsct_send(struct fc_lport *lport,
35 struct fc_rport *rport,
36 struct fc_frame *fp,
37 unsigned int op,
38 void (*resp)(struct fc_seq *,
39 struct fc_frame *fp,
40 void *arg),
41 void *arg, u32 timer_msec)
42{
43 enum fc_rctl r_ctl;
44 u32 did;
45 enum fc_fh_type fh_type;
46 int rc;
47
48 /* ELS requests */
49 if ((op >= ELS_LS_RJT) && (op <= ELS_AUTH_ELS))
50 rc = fc_els_fill(lport, rport, fp, op, &r_ctl, &did, &fh_type);
51 else
52 /* CT requests */
53 rc = fc_ct_fill(lport, fp, op, &r_ctl, &did, &fh_type);
54
55 if (rc)
56 return NULL;
57
58 fc_fill_fc_hdr(fp, r_ctl, did, fc_host_port_id(lport->host), fh_type,
59 FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);
60
61 return lport->tt.exch_seq_send(lport, fp, resp, NULL, arg, timer_msec);
62}
63
64int fc_elsct_init(struct fc_lport *lport)
65{
66 if (!lport->tt.elsct_send)
67 lport->tt.elsct_send = fc_elsct_send;
68
69 return 0;
70}
71EXPORT_SYMBOL(fc_elsct_init);