diff options
author | James Smart <James.Smart@Emulex.Com> | 2007-06-17 20:56:38 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-06-17 23:27:39 -0400 |
commit | 92d7f7b0cde3ad2260e7462b40867b57efd49851 (patch) | |
tree | fadb1d8f1a817c2f85937b5e9c3b830bdecb5555 /drivers/scsi/lpfc/lpfc_vport.h | |
parent | ed957684294618602b48f1950b0c9bbcb036583f (diff) |
[SCSI] lpfc: NPIV: add NPIV support on top of SLI-3
NPIV support is added to the driver. It utilizes the interfaces of
the fc transport for the creation and deletion of vports. Within the
driver, a new Scsi_Host is created for each NPIV instance, and is
paired with a new instance of a FC port. This allows N FC Port
elements to share a single Adapter.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_vport.h')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_vport.h | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_vport.h b/drivers/scsi/lpfc/lpfc_vport.h new file mode 100644 index 000000000000..f223550f8cba --- /dev/null +++ b/drivers/scsi/lpfc/lpfc_vport.h | |||
@@ -0,0 +1,113 @@ | |||
1 | /******************************************************************* | ||
2 | * This file is part of the Emulex Linux Device Driver for * | ||
3 | * Fibre Channel Host Bus Adapters. * | ||
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | ||
5 | * EMULEX and SLI are trademarks of Emulex. * | ||
6 | * www.emulex.com * | ||
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | ||
8 | * * | ||
9 | * This program is free software; you can redistribute it and/or * | ||
10 | * modify it under the terms of version 2 of the GNU General * | ||
11 | * Public License as published by the Free Software Foundation. * | ||
12 | * This program is distributed in the hope that it will be useful. * | ||
13 | * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND * | ||
14 | * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, * | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE * | ||
16 | * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD * | ||
17 | * TO BE LEGALLY INVALID. See the GNU General Public License for * | ||
18 | * more details, a copy of which can be found in the file COPYING * | ||
19 | * included with this package. * | ||
20 | *******************************************************************/ | ||
21 | |||
22 | #ifndef _H_LPFC_VPORT | ||
23 | #define _H_LPFC_VPORT | ||
24 | |||
25 | /* API version values (each will be an individual bit) */ | ||
26 | #define VPORT_API_VERSION_1 0x01 | ||
27 | |||
28 | /* Values returned via lpfc_vport_getinfo() */ | ||
29 | struct vport_info { | ||
30 | |||
31 | uint32_t api_versions; | ||
32 | uint8_t linktype; | ||
33 | #define VPORT_TYPE_PHYSICAL 0 | ||
34 | #define VPORT_TYPE_VIRTUAL 1 | ||
35 | |||
36 | uint8_t state; | ||
37 | #define VPORT_STATE_OFFLINE 0 | ||
38 | #define VPORT_STATE_ACTIVE 1 | ||
39 | #define VPORT_STATE_FAILED 2 | ||
40 | |||
41 | uint8_t fail_reason; | ||
42 | uint8_t prev_fail_reason; | ||
43 | #define VPORT_FAIL_UNKNOWN 0 | ||
44 | #define VPORT_FAIL_LINKDOWN 1 | ||
45 | #define VPORT_FAIL_FAB_UNSUPPORTED 2 | ||
46 | #define VPORT_FAIL_FAB_NORESOURCES 3 | ||
47 | #define VPORT_FAIL_FAB_LOGOUT 4 | ||
48 | #define VPORT_FAIL_ADAP_NORESOURCES 5 | ||
49 | |||
50 | uint8_t node_name[8]; /* WWNN */ | ||
51 | uint8_t port_name[8]; /* WWPN */ | ||
52 | |||
53 | struct Scsi_Host *shost; | ||
54 | |||
55 | /* Following values are valid only on physical links */ | ||
56 | uint32_t vports_max; | ||
57 | uint32_t vports_inuse; | ||
58 | uint32_t rpi_max; | ||
59 | uint32_t rpi_inuse; | ||
60 | #define VPORT_CNT_INVALID 0xFFFFFFFF | ||
61 | }; | ||
62 | |||
63 | /* data used in link creation */ | ||
64 | struct vport_data { | ||
65 | uint32_t api_version; | ||
66 | |||
67 | uint32_t options; | ||
68 | #define VPORT_OPT_AUTORETRY 0x01 | ||
69 | |||
70 | uint8_t node_name[8]; /* WWNN */ | ||
71 | uint8_t port_name[8]; /* WWPN */ | ||
72 | |||
73 | /* | ||
74 | * Upon successful creation, vport_shost will point to the new Scsi_Host | ||
75 | * structure for the new virtual link. | ||
76 | */ | ||
77 | struct Scsi_Host *vport_shost; | ||
78 | }; | ||
79 | |||
80 | /* API function return codes */ | ||
81 | #define VPORT_OK 0 | ||
82 | #define VPORT_ERROR -1 | ||
83 | #define VPORT_INVAL -2 | ||
84 | #define VPORT_NOMEM -3 | ||
85 | #define VPORT_NORESOURCES -4 | ||
86 | |||
87 | int lpfc_vport_create(struct fc_vport *, bool); | ||
88 | int lpfc_vport_delete(struct fc_vport *); | ||
89 | int lpfc_vport_getinfo(struct Scsi_Host *, struct vport_info *); | ||
90 | int lpfc_vport_tgt_remove(struct Scsi_Host *, uint, uint); | ||
91 | |||
92 | /* | ||
93 | * queuecommand VPORT-specific return codes. Specified in the host byte code. | ||
94 | * Returned when the virtual link has failed or is not active. | ||
95 | */ | ||
96 | #define DID_VPORT_ERROR 0x0f | ||
97 | |||
98 | #define VPORT_INFO 0x1 | ||
99 | #define VPORT_CREATE 0x2 | ||
100 | #define VPORT_DELETE 0x4 | ||
101 | |||
102 | struct vport_cmd_tag { | ||
103 | uint32_t cmd; | ||
104 | struct vport_data cdata; | ||
105 | struct vport_info cinfo; | ||
106 | void *vport; | ||
107 | int vport_num; | ||
108 | }; | ||
109 | |||
110 | void lpfc_vport_set_state(struct lpfc_vport *vport, | ||
111 | enum fc_vport_state new_state); | ||
112 | |||
113 | #endif /* H_LPFC_VPORT */ | ||