2 * Copyright(c) 2008 Intel Corporation. All rights reserved.
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.
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
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.
17 * Maintained at www.Open-FCoE.org
21 * Provide interface to send ELS/CT FC frames
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>
32 * fc_elsct_send - sends ELS/CT frame
34 static struct fc_seq *fc_elsct_send(struct fc_lport *lport,
35 struct fc_rport *rport,
38 void (*resp)(struct fc_seq *,
41 void *arg, u32 timer_msec)
45 enum fc_fh_type fh_type;
49 if ((op >= ELS_LS_RJT) && (op <= ELS_AUTH_ELS))
50 rc = fc_els_fill(lport, rport, fp, op, &r_ctl, &did, &fh_type);
53 rc = fc_ct_fill(lport, fp, op, &r_ctl, &did, &fh_type);
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);
61 return lport->tt.exch_seq_send(lport, fp, resp, NULL, arg, timer_msec);
64 int fc_elsct_init(struct fc_lport *lport)
66 if (!lport->tt.elsct_send)
67 lport->tt.elsct_send = fc_elsct_send;
71 EXPORT_SYMBOL(fc_elsct_init);