Use pass through interface for sendtargets (take4) Currenly offload cards like bnx2i...
[open-iscsi.git] / usr / transport.c
blob7a0cde1260ed3f9c982cb93e1f9b24149b0efe5e
1 /*
2 * iSCSI transport
4 * Copyright (C) 2006 Mike Christie
5 * Copyright (C) 2006 Red Hat, Inc. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
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.
17 #include <stdlib.h>
18 #include <string.h>
19 #include <stdio.h>
20 #include <unistd.h>
21 #include <errno.h>
23 #include "initiator.h"
24 #include "transport.h"
25 #include "log.h"
26 #include "iscsi_util.h"
27 #include "iscsi_sysfs.h"
28 #include "cxgbi.h"
29 #include "be2iscsi.h"
31 struct iscsi_transport_template iscsi_tcp = {
32 .name = "tcp",
33 .ep_connect = iscsi_io_tcp_connect,
34 .ep_poll = iscsi_io_tcp_poll,
35 .ep_disconnect = iscsi_io_tcp_disconnect,
38 struct iscsi_transport_template iscsi_iser = {
39 .name = "iser",
40 .rdma = 1,
41 .ep_connect = ktransport_ep_connect,
42 .ep_poll = ktransport_ep_poll,
43 .ep_disconnect = ktransport_ep_disconnect,
46 struct iscsi_transport_template cxgb3i = {
47 .name = "cxgb3i",
48 .set_host_ip = 1,
49 .ep_connect = ktransport_ep_connect,
50 .ep_poll = ktransport_ep_poll,
51 .ep_disconnect = ktransport_ep_disconnect,
52 .create_conn = cxgbi_create_conn,
55 struct iscsi_transport_template cxgb4i = {
56 .name = "cxgb4i",
57 .set_host_ip = 1,
58 .ep_connect = ktransport_ep_connect,
59 .ep_poll = ktransport_ep_poll,
60 .ep_disconnect = ktransport_ep_disconnect,
61 .create_conn = cxgbi_create_conn,
64 struct iscsi_transport_template bnx2i = {
65 .name = "bnx2i",
66 .set_host_ip = 1,
67 .ep_connect = ktransport_ep_connect,
68 .ep_poll = ktransport_ep_poll,
69 .ep_disconnect = ktransport_ep_disconnect,
72 struct iscsi_transport_template be2iscsi = {
73 .name = "be2iscsi",
74 .create_conn = be2iscsi_create_conn,
75 .ep_connect = ktransport_ep_connect,
76 .ep_poll = ktransport_ep_poll,
77 .ep_disconnect = ktransport_ep_disconnect,
80 struct iscsi_transport_template qla4xxx = {
81 .name = "qla4xxx",
84 static struct iscsi_transport_template *iscsi_transport_templates[] = {
85 &iscsi_tcp,
86 &iscsi_iser,
87 &cxgb3i,
88 &cxgb4i,
89 &bnx2i,
90 &qla4xxx,
91 &be2iscsi,
92 NULL
95 int set_transport_template(struct iscsi_transport *t)
97 struct iscsi_transport_template *tmpl;
98 int j;
100 for (j = 0; iscsi_transport_templates[j] != NULL; j++) {
101 tmpl = iscsi_transport_templates[j];
103 if (!strcmp(tmpl->name, t->name)) {
104 t->template = tmpl;
105 log_debug(3, "Matched transport %s\n", t->name);
106 return 0;
110 log_error("Could not find template for %s. An updated iscsiadm "
111 "is probably needed.\n", t->name);
112 return ENOSYS;