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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _TGTFCHBAPORT_H
#define _TGTFCHBAPORT_H
#include <Lockable.h>
#include <HBAPort.h>
#include <Exceptions.h>
#include <string>
#include <hbaapi.h>
#include <sys/fctio.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Represents a single HBA port
*/
class TgtFCHBAPort : public HBAPort {
public:
TgtFCHBAPort(std::string path);
virtual std::string getPath()
{ return path; }
virtual uint64_t getNodeWWN()
{ return nodeWWN; }
virtual uint64_t getPortWWN()
{ return portWWN; }
virtual HBA_PORTATTRIBUTES getPortAttributes(
uint64_t &stateChange);
virtual HBA_PORTATTRIBUTES getDiscoveredAttributes(
HBA_UINT32 discoveredport,
uint64_t &stateChange);
virtual HBA_PORTATTRIBUTES getDiscoveredAttributes(
uint64_t wwn,
uint64_t &stateChange);
virtual void validatePresent();
virtual void getTargetMappings(
PHBA_FCPTARGETMAPPINGV2 userMappings) {
throw NotSupportedException(); }
virtual void getRNIDMgmtInfo(PHBA_MGMTINFO info) {
throw NotSupportedException(); }
virtual void sendCTPassThru(void *requestBuffer,
HBA_UINT32 requestSize,
void *responseBuffer,
HBA_UINT32 *responseSize) {
throw NotSupportedException(); }
virtual void sendRLS(uint64_t destWWN,
void *pRspBuffer,
HBA_UINT32 *pRspBufferSize);
virtual void sendRPL(uint64_t destWWN,
HBA_UINT32 agent_domain,
HBA_UINT32 port_index,
void *pRspBuffer,
HBA_UINT32 *pRspBufferSize) {
throw NotSupportedException(); }
virtual void sendRPS(uint64_t agentWWN,
HBA_UINT32 agentDomain,
uint64_t objectWWN,
HBA_UINT32 objectPortNum,
void *pRspBuffer,
HBA_UINT32 *pRspBufferSize) {
throw NotSupportedException(); }
virtual void sendSRL(uint64_t destWWN,
HBA_UINT32 agent_domain,
void *pRspBuffer,
HBA_UINT32 *pRspBufferSize) {
throw NotSupportedException(); }
virtual void sendLIRR(uint64_t destWWN,
HBA_UINT8 function,
HBA_UINT8 type,
void *pRspBuffer,
HBA_UINT32 *pRspBufferSize) {
throw NotSupportedException(); }
virtual void sendReportLUNs(uint64_t wwn,
void *responseBuffer, HBA_UINT32 *responseSize,
HBA_UINT8 *scsiStatus,
void *senseBuffer, HBA_UINT32 *senseSize) {
throw NotSupportedException(); }
virtual void sendScsiInquiry(uint64_t wwn, HBA_UINT64 fcLun,
HBA_UINT8 cdb1, HBA_UINT8 cdb2,
void *responseBuffer, HBA_UINT32 *responseSize,
HBA_UINT8 *scsiStatus, void *senseBuffer,
HBA_UINT32 *senseSize) {
throw NotSupportedException(); }
virtual void sendReadCapacity(uint64_t pwwn,
HBA_UINT64 fcLun, void *responseBuffer,
HBA_UINT32 *responseSize, HBA_UINT8 *scsiStatus,
void *senseBuffer, HBA_UINT32 *senseSize) {
throw NotSupportedException(); }
virtual void sendRNID(uint64_t destwwn, HBA_UINT32 destfcid,
HBA_UINT32 nodeIdDataFormat, void *pRspBuffer,
HBA_UINT32 *RspBufferSize) {
throw NotSupportedException(); }
virtual void setRNID(HBA_MGMTINFO info) {
throw NotSupportedException(); }
virtual HBA_PORTNPIVATTRIBUTES getPortNPIVAttributes(
uint64_t &stateChange) {
throw NotSupportedException(); }
virtual uint32_t createNPIVPort(
uint64_t vnodewwn,
uint64_t vportwwn,
uint32_t vindex) {
throw NotSupportedException(); }
virtual uint32_t deleteNPIVPort(
uint64_t vportwwn) {
throw NotSupportedException(); }
private:
std::string path;
uint64_t portWWN;
uint64_t nodeWWN;
uint32_t instanceNumber;
int controllerNumber;
static const std::string FCT_DRIVER_PATH;
static const int MAX_FCTIO_MSG_LEN;
static void transportError(uint32_t fcio_errno, char *message);
// Wrapper routines to handle error cases
static void fct_ioctl(int cmd, fctio_t *arg);
};
#ifdef __cplusplus
}
#endif
#endif /* _TGTFCHBAPORT_H */
|