1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
/*
* iSCSI transport
*
* Copyright (C) 2006 Mike Christie
* Copyright (C) 2006 Red Hat, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include "initiator.h"
#include "transport.h"
#include "log.h"
#include "iscsi_util.h"
#include "iscsi_sysfs.h"
#include "cxgbi.h"
#include "be2iscsi.h"
struct iscsi_transport_template iscsi_tcp = {
.name = "tcp",
.ep_connect = iscsi_io_tcp_connect,
.ep_poll = iscsi_io_tcp_poll,
.ep_disconnect = iscsi_io_tcp_disconnect,
};
struct iscsi_transport_template iscsi_iser = {
.name = "iser",
.rdma = 1,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
};
struct iscsi_transport_template cxgb3i = {
.name = "cxgb3i",
.set_host_ip = 1,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
.create_conn = cxgbi_create_conn,
};
struct iscsi_transport_template cxgb4i = {
.name = "cxgb4i",
.set_host_ip = 1,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
.create_conn = cxgbi_create_conn,
};
struct iscsi_transport_template bnx2i = {
.name = "bnx2i",
.set_host_ip = 1,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
};
struct iscsi_transport_template be2iscsi = {
.name = "be2iscsi",
.create_conn = be2iscsi_create_conn,
.ep_connect = ktransport_ep_connect,
.ep_poll = ktransport_ep_poll,
.ep_disconnect = ktransport_ep_disconnect,
};
struct iscsi_transport_template qla4xxx = {
.name = "qla4xxx",
};
static struct iscsi_transport_template *iscsi_transport_templates[] = {
&iscsi_tcp,
&iscsi_iser,
&cxgb3i,
&cxgb4i,
&bnx2i,
&qla4xxx,
&be2iscsi,
NULL
};
int set_transport_template(struct iscsi_transport *t)
{
struct iscsi_transport_template *tmpl;
int j;
for (j = 0; iscsi_transport_templates[j] != NULL; j++) {
tmpl = iscsi_transport_templates[j];
if (!strcmp(tmpl->name, t->name)) {
t->template = tmpl;
log_debug(3, "Matched transport %s\n", t->name);
return 0;
}
}
log_error("Could not find uspace transport for %s\n", t->name);
return ENOSYS;
}
|