diff options
Diffstat (limited to 'include/scsi')
| -rw-r--r-- | include/scsi/fc/fc_fip.h | 237 | ||||
| -rw-r--r-- | include/scsi/fc/fc_fs.h | 1 | ||||
| -rw-r--r-- | include/scsi/fc_transport_fcoe.h | 54 | ||||
| -rw-r--r-- | include/scsi/libfc.h | 46 | ||||
| -rw-r--r-- | include/scsi/libfcoe.h | 227 | ||||
| -rw-r--r-- | include/scsi/libiscsi.h | 2 | ||||
| -rw-r--r-- | include/scsi/osd_protocol.h | 96 | ||||
| -rw-r--r-- | include/scsi/scsi_scan.h | 11 | ||||
| -rw-r--r-- | include/scsi/scsi_transport_fc.h | 4 |
9 files changed, 483 insertions, 195 deletions
diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h new file mode 100644 index 000000000000..0627a9ae6347 --- /dev/null +++ b/include/scsi/fc/fc_fip.h | |||
| @@ -0,0 +1,237 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2008 Cisco Systems, Inc. All rights reserved. | ||
| 3 | * | ||
| 4 | * This program is free software; you may redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation; version 2 of the License. | ||
| 7 | * | ||
| 8 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| 9 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 10 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| 11 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
| 12 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
| 13 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 15 | * SOFTWARE. | ||
| 16 | */ | ||
| 17 | #ifndef _FC_FIP_H_ | ||
| 18 | #define _FC_FIP_H_ | ||
| 19 | |||
| 20 | /* | ||
| 21 | * This version is based on: | ||
| 22 | * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf | ||
| 23 | */ | ||
| 24 | |||
| 25 | /* | ||
| 26 | * The FIP ethertype eventually goes in net/if_ether.h. | ||
| 27 | */ | ||
| 28 | #ifndef ETH_P_FIP | ||
| 29 | #define ETH_P_FIP 0x8914 /* FIP Ethertype */ | ||
| 30 | #endif | ||
| 31 | |||
| 32 | #define FIP_DEF_PRI 128 /* default selection priority */ | ||
| 33 | #define FIP_DEF_FC_MAP 0x0efc00 /* default FCoE MAP (MAC OUI) value */ | ||
| 34 | #define FIP_DEF_FKA 8000 /* default FCF keep-alive/advert period (mS) */ | ||
| 35 | #define FIP_VN_KA_PERIOD 90000 /* required VN_port keep-alive period (mS) */ | ||
| 36 | #define FIP_FCF_FUZZ 100 /* random time added by FCF (mS) */ | ||
| 37 | |||
| 38 | /* | ||
| 39 | * Multicast MAC addresses. T11-adopted. | ||
| 40 | */ | ||
| 41 | #define FIP_ALL_FCOE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 0 }) | ||
| 42 | #define FIP_ALL_ENODE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 1 }) | ||
| 43 | #define FIP_ALL_FCF_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 2 }) | ||
| 44 | |||
| 45 | #define FIP_VER 1 /* version for fip_header */ | ||
| 46 | |||
| 47 | struct fip_header { | ||
| 48 | __u8 fip_ver; /* upper 4 bits are the version */ | ||
| 49 | __u8 fip_resv1; /* reserved */ | ||
| 50 | __be16 fip_op; /* operation code */ | ||
| 51 | __u8 fip_resv2; /* reserved */ | ||
| 52 | __u8 fip_subcode; /* lower 4 bits are sub-code */ | ||
| 53 | __be16 fip_dl_len; /* length of descriptors in words */ | ||
| 54 | __be16 fip_flags; /* header flags */ | ||
| 55 | } __attribute__((packed)); | ||
| 56 | |||
| 57 | #define FIP_VER_SHIFT 4 | ||
| 58 | #define FIP_VER_ENCAPS(v) ((v) << FIP_VER_SHIFT) | ||
| 59 | #define FIP_VER_DECAPS(v) ((v) >> FIP_VER_SHIFT) | ||
| 60 | #define FIP_BPW 4 /* bytes per word for lengths */ | ||
| 61 | |||
| 62 | /* | ||
| 63 | * fip_op. | ||
| 64 | */ | ||
| 65 | enum fip_opcode { | ||
| 66 | FIP_OP_DISC = 1, /* discovery, advertisement, etc. */ | ||
| 67 | FIP_OP_LS = 2, /* Link Service request or reply */ | ||
| 68 | FIP_OP_CTRL = 3, /* Keep Alive / Link Reset */ | ||
| 69 | FIP_OP_VLAN = 4, /* VLAN discovery */ | ||
| 70 | FIP_OP_VENDOR_MIN = 0xfff8, /* min vendor-specific opcode */ | ||
| 71 | FIP_OP_VENDOR_MAX = 0xfffe, /* max vendor-specific opcode */ | ||
| 72 | }; | ||
| 73 | |||
| 74 | /* | ||
| 75 | * Subcodes for FIP_OP_DISC. | ||
| 76 | */ | ||
| 77 | enum fip_disc_subcode { | ||
| 78 | FIP_SC_SOL = 1, /* solicitation */ | ||
| 79 | FIP_SC_ADV = 2, /* advertisement */ | ||
| 80 | }; | ||
| 81 | |||
| 82 | /* | ||
| 83 | * Subcodes for FIP_OP_LS. | ||
| 84 | */ | ||
| 85 | enum fip_trans_subcode { | ||
| 86 | FIP_SC_REQ = 1, /* request */ | ||
| 87 | FIP_SC_REP = 2, /* reply */ | ||
| 88 | }; | ||
| 89 | |||
| 90 | /* | ||
| 91 | * Subcodes for FIP_OP_RESET. | ||
| 92 | */ | ||
| 93 | enum fip_reset_subcode { | ||
| 94 | FIP_SC_KEEP_ALIVE = 1, /* keep-alive from VN_Port */ | ||
| 95 | FIP_SC_CLR_VLINK = 2, /* clear virtual link from VF_Port */ | ||
| 96 | }; | ||
| 97 | |||
| 98 | /* | ||
| 99 | * Subcodes for FIP_OP_VLAN. | ||
| 100 | */ | ||
| 101 | enum fip_vlan_subcode { | ||
| 102 | FIP_SC_VL_REQ = 1, /* request */ | ||
| 103 | FIP_SC_VL_REP = 2, /* reply */ | ||
| 104 | }; | ||
| 105 | |||
| 106 | /* | ||
| 107 | * flags in header fip_flags. | ||
| 108 | */ | ||
| 109 | enum fip_flag { | ||
| 110 | FIP_FL_FPMA = 0x8000, /* supports FPMA fabric-provided MACs */ | ||
| 111 | FIP_FL_SPMA = 0x4000, /* supports SPMA server-provided MACs */ | ||
| 112 | FIP_FL_AVAIL = 0x0004, /* available for FLOGI/ELP */ | ||
| 113 | FIP_FL_SOL = 0x0002, /* this is a solicited message */ | ||
| 114 | FIP_FL_FPORT = 0x0001, /* sent from an F port */ | ||
| 115 | }; | ||
| 116 | |||
| 117 | /* | ||
| 118 | * Common descriptor header format. | ||
| 119 | */ | ||
| 120 | struct fip_desc { | ||
| 121 | __u8 fip_dtype; /* type - see below */ | ||
| 122 | __u8 fip_dlen; /* length - in 32-bit words */ | ||
| 123 | }; | ||
| 124 | |||
| 125 | enum fip_desc_type { | ||
| 126 | FIP_DT_PRI = 1, /* priority for forwarder selection */ | ||
| 127 | FIP_DT_MAC = 2, /* MAC address */ | ||
| 128 | FIP_DT_MAP_OUI = 3, /* FC-MAP OUI */ | ||
| 129 | FIP_DT_NAME = 4, /* switch name or node name */ | ||
| 130 | FIP_DT_FAB = 5, /* fabric descriptor */ | ||
| 131 | FIP_DT_FCOE_SIZE = 6, /* max FCoE frame size */ | ||
| 132 | FIP_DT_FLOGI = 7, /* FLOGI request or response */ | ||
| 133 | FIP_DT_FDISC = 8, /* FDISC request or response */ | ||
| 134 | FIP_DT_LOGO = 9, /* LOGO request or response */ | ||
| 135 | FIP_DT_ELP = 10, /* ELP request or response */ | ||
| 136 | FIP_DT_VN_ID = 11, /* VN_Node Identifier */ | ||
| 137 | FIP_DT_FKA = 12, /* advertisement keep-alive period */ | ||
| 138 | FIP_DT_VENDOR = 13, /* vendor ID */ | ||
| 139 | FIP_DT_VLAN = 14, /* vlan number */ | ||
| 140 | FIP_DT_LIMIT, /* max defined desc_type + 1 */ | ||
| 141 | FIP_DT_VENDOR_BASE = 128, /* first vendor-specific desc_type */ | ||
| 142 | }; | ||
| 143 | |||
| 144 | /* | ||
| 145 | * FIP_DT_PRI - priority descriptor. | ||
| 146 | */ | ||
| 147 | struct fip_pri_desc { | ||
| 148 | struct fip_desc fd_desc; | ||
| 149 | __u8 fd_resvd; | ||
| 150 | __u8 fd_pri; /* FCF priority: higher is better */ | ||
| 151 | } __attribute__((packed)); | ||
| 152 | |||
| 153 | /* | ||
| 154 | * FIP_DT_MAC - MAC address descriptor. | ||
| 155 | */ | ||
| 156 | struct fip_mac_desc { | ||
| 157 | struct fip_desc fd_desc; | ||
| 158 | __u8 fd_mac[ETH_ALEN]; | ||
| 159 | } __attribute__((packed)); | ||
| 160 | |||
| 161 | /* | ||
| 162 | * FIP_DT_MAP - descriptor. | ||
| 163 | */ | ||
| 164 | struct fip_map_desc { | ||
| 165 | struct fip_desc fd_desc; | ||
| 166 | __u8 fd_resvd[3]; | ||
| 167 | __u8 fd_map[3]; | ||
| 168 | } __attribute__((packed)); | ||
| 169 | |||
| 170 | /* | ||
| 171 | * FIP_DT_NAME descriptor. | ||
| 172 | */ | ||
| 173 | struct fip_wwn_desc { | ||
| 174 | struct fip_desc fd_desc; | ||
| 175 | __u8 fd_resvd[2]; | ||
| 176 | __be64 fd_wwn; /* 64-bit WWN, unaligned */ | ||
| 177 | } __attribute__((packed)); | ||
| 178 | |||
| 179 | /* | ||
| 180 | * FIP_DT_FAB descriptor. | ||
| 181 | */ | ||
| 182 | struct fip_fab_desc { | ||
| 183 | struct fip_desc fd_desc; | ||
| 184 | __be16 fd_vfid; /* virtual fabric ID */ | ||
| 185 | __u8 fd_resvd; | ||
| 186 | __u8 fd_map[3]; /* FC-MAP value */ | ||
| 187 | __be64 fd_wwn; /* fabric name, unaligned */ | ||
| 188 | } __attribute__((packed)); | ||
| 189 | |||
| 190 | /* | ||
| 191 | * FIP_DT_FCOE_SIZE descriptor. | ||
| 192 | */ | ||
| 193 | struct fip_size_desc { | ||
| 194 | struct fip_desc fd_desc; | ||
| 195 | __be16 fd_size; | ||
| 196 | } __attribute__((packed)); | ||
| 197 | |||
| 198 | /* | ||
| 199 | * Descriptor that encapsulates an ELS or ILS frame. | ||
| 200 | * The encapsulated frame immediately follows this header, without | ||
| 201 | * SOF, EOF, or CRC. | ||
| 202 | */ | ||
| 203 | struct fip_encaps { | ||
| 204 | struct fip_desc fd_desc; | ||
| 205 | __u8 fd_resvd[2]; | ||
| 206 | } __attribute__((packed)); | ||
| 207 | |||
| 208 | /* | ||
| 209 | * FIP_DT_VN_ID - VN_Node Identifier descriptor. | ||
| 210 | */ | ||
| 211 | struct fip_vn_desc { | ||
| 212 | struct fip_desc fd_desc; | ||
| 213 | __u8 fd_mac[ETH_ALEN]; | ||
| 214 | __u8 fd_resvd; | ||
| 215 | __u8 fd_fc_id[3]; | ||
| 216 | __be64 fd_wwpn; /* port name, unaligned */ | ||
| 217 | } __attribute__((packed)); | ||
| 218 | |||
| 219 | /* | ||
| 220 | * FIP_DT_FKA - Advertisement keep-alive period. | ||
| 221 | */ | ||
| 222 | struct fip_fka_desc { | ||
| 223 | struct fip_desc fd_desc; | ||
| 224 | __u8 fd_resvd[2]; | ||
| 225 | __be32 fd_fka_period; /* adv./keep-alive period in mS */ | ||
| 226 | } __attribute__((packed)); | ||
| 227 | |||
| 228 | /* | ||
| 229 | * FIP_DT_VENDOR descriptor. | ||
| 230 | */ | ||
| 231 | struct fip_vendor_desc { | ||
| 232 | struct fip_desc fd_desc; | ||
| 233 | __u8 fd_resvd[2]; | ||
| 234 | __u8 fd_vendor_id[8]; | ||
| 235 | } __attribute__((packed)); | ||
| 236 | |||
| 237 | #endif /* _FC_FIP_H_ */ | ||
diff --git a/include/scsi/fc/fc_fs.h b/include/scsi/fc/fc_fs.h index 1b7af3a64c7c..ac4cd38c860e 100644 --- a/include/scsi/fc/fc_fs.h +++ b/include/scsi/fc/fc_fs.h | |||
| @@ -149,6 +149,7 @@ enum fc_rctl { | |||
| 149 | * Well-known fabric addresses. | 149 | * Well-known fabric addresses. |
| 150 | */ | 150 | */ |
| 151 | enum fc_well_known_fid { | 151 | enum fc_well_known_fid { |
| 152 | FC_FID_NONE = 0x000000, /* No destination */ | ||
| 152 | FC_FID_BCAST = 0xffffff, /* broadcast */ | 153 | FC_FID_BCAST = 0xffffff, /* broadcast */ |
| 153 | FC_FID_FLOGI = 0xfffffe, /* fabric login */ | 154 | FC_FID_FLOGI = 0xfffffe, /* fabric login */ |
| 154 | FC_FID_FCTRL = 0xfffffd, /* fabric controller */ | 155 | FC_FID_FCTRL = 0xfffffd, /* fabric controller */ |
diff --git a/include/scsi/fc_transport_fcoe.h b/include/scsi/fc_transport_fcoe.h deleted file mode 100644 index 8dca2af14ffc..000000000000 --- a/include/scsi/fc_transport_fcoe.h +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | #ifndef FC_TRANSPORT_FCOE_H | ||
| 2 | #define FC_TRANSPORT_FCOE_H | ||
| 3 | |||
| 4 | #include <linux/device.h> | ||
| 5 | #include <linux/netdevice.h> | ||
| 6 | #include <scsi/scsi_host.h> | ||
| 7 | #include <scsi/libfc.h> | ||
| 8 | |||
| 9 | /** | ||
| 10 | * struct fcoe_transport - FCoE transport struct for generic transport | ||
| 11 | * for Ethernet devices as well as pure HBAs | ||
| 12 | * | ||
| 13 | * @name: name for thsi transport | ||
| 14 | * @bus: physical bus type (pci_bus_type) | ||
| 15 | * @driver: physical bus driver for network device | ||
| 16 | * @create: entry create function | ||
| 17 | * @destroy: exit destroy function | ||
| 18 | * @list: list of transports | ||
| 19 | */ | ||
| 20 | struct fcoe_transport { | ||
| 21 | char *name; | ||
| 22 | unsigned short vendor; | ||
| 23 | unsigned short device; | ||
| 24 | struct bus_type *bus; | ||
| 25 | struct device_driver *driver; | ||
| 26 | int (*create)(struct net_device *device); | ||
| 27 | int (*destroy)(struct net_device *device); | ||
| 28 | bool (*match)(struct net_device *device); | ||
| 29 | struct list_head list; | ||
| 30 | struct list_head devlist; | ||
| 31 | struct mutex devlock; | ||
| 32 | }; | ||
| 33 | |||
| 34 | /** | ||
| 35 | * MODULE_ALIAS_FCOE_PCI | ||
| 36 | * | ||
| 37 | * some care must be taken with this, vendor and device MUST be a hex value | ||
| 38 | * preceded with 0x and with letters in lower case (0x12ab, not 0x12AB or 12AB) | ||
| 39 | */ | ||
| 40 | #define MODULE_ALIAS_FCOE_PCI(vendor, device) \ | ||
| 41 | MODULE_ALIAS("fcoe-pci-" __stringify(vendor) "-" __stringify(device)) | ||
| 42 | |||
| 43 | /* exported funcs */ | ||
| 44 | int fcoe_transport_attach(struct net_device *netdev); | ||
| 45 | int fcoe_transport_release(struct net_device *netdev); | ||
| 46 | int fcoe_transport_register(struct fcoe_transport *t); | ||
| 47 | int fcoe_transport_unregister(struct fcoe_transport *t); | ||
| 48 | int fcoe_load_transport_driver(struct net_device *netdev); | ||
| 49 | int __init fcoe_transport_init(void); | ||
| 50 | int __exit fcoe_transport_exit(void); | ||
| 51 | |||
| 52 | /* fcow_sw is the default transport */ | ||
| 53 | extern struct fcoe_transport fcoe_sw_transport; | ||
| 54 | #endif /* FC_TRANSPORT_FCOE_H */ | ||
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index a70eafaad084..45f9cc642c46 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | #include <linux/timer.h> | 23 | #include <linux/timer.h> |
| 24 | #include <linux/if.h> | 24 | #include <linux/if.h> |
| 25 | #include <linux/percpu.h> | ||
| 25 | 26 | ||
| 26 | #include <scsi/scsi_transport.h> | 27 | #include <scsi/scsi_transport.h> |
| 27 | #include <scsi/scsi_transport_fc.h> | 28 | #include <scsi/scsi_transport_fc.h> |
| @@ -636,6 +637,7 @@ struct fc_disc { | |||
| 636 | enum fc_disc_event); | 637 | enum fc_disc_event); |
| 637 | 638 | ||
| 638 | struct list_head rports; | 639 | struct list_head rports; |
| 640 | struct list_head rogue_rports; | ||
| 639 | struct fc_lport *lport; | 641 | struct fc_lport *lport; |
| 640 | struct mutex disc_mutex; | 642 | struct mutex disc_mutex; |
| 641 | struct fc_gpn_ft_resp partial_buf; /* partial name buffer */ | 643 | struct fc_gpn_ft_resp partial_buf; /* partial name buffer */ |
| @@ -661,7 +663,8 @@ struct fc_lport { | |||
| 661 | unsigned long boot_time; | 663 | unsigned long boot_time; |
| 662 | 664 | ||
| 663 | struct fc_host_statistics host_stats; | 665 | struct fc_host_statistics host_stats; |
| 664 | struct fcoe_dev_stats *dev_stats[NR_CPUS]; | 666 | struct fcoe_dev_stats *dev_stats; |
| 667 | |||
| 665 | u64 wwpn; | 668 | u64 wwpn; |
| 666 | u64 wwnn; | 669 | u64 wwnn; |
| 667 | u8 retry_count; | 670 | u8 retry_count; |
| @@ -694,11 +697,6 @@ struct fc_lport { | |||
| 694 | /* | 697 | /* |
| 695 | * FC_LPORT HELPER FUNCTIONS | 698 | * FC_LPORT HELPER FUNCTIONS |
| 696 | *****************************/ | 699 | *****************************/ |
| 697 | static inline void *lport_priv(const struct fc_lport *lp) | ||
| 698 | { | ||
| 699 | return (void *)(lp + 1); | ||
| 700 | } | ||
| 701 | |||
| 702 | static inline int fc_lport_test_ready(struct fc_lport *lp) | 700 | static inline int fc_lport_test_ready(struct fc_lport *lp) |
| 703 | { | 701 | { |
| 704 | return lp->state == LPORT_ST_READY; | 702 | return lp->state == LPORT_ST_READY; |
| @@ -722,6 +720,42 @@ static inline void fc_lport_state_enter(struct fc_lport *lp, | |||
| 722 | lp->state = state; | 720 | lp->state = state; |
| 723 | } | 721 | } |
| 724 | 722 | ||
| 723 | static inline int fc_lport_init_stats(struct fc_lport *lp) | ||
| 724 | { | ||
| 725 | /* allocate per cpu stats block */ | ||
| 726 | lp->dev_stats = alloc_percpu(struct fcoe_dev_stats); | ||
| 727 | if (!lp->dev_stats) | ||
| 728 | return -ENOMEM; | ||
| 729 | return 0; | ||
| 730 | } | ||
| 731 | |||
| 732 | static inline void fc_lport_free_stats(struct fc_lport *lp) | ||
| 733 | { | ||
| 734 | free_percpu(lp->dev_stats); | ||
| 735 | } | ||
| 736 | |||
| 737 | static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lp) | ||
| 738 | { | ||
| 739 | return per_cpu_ptr(lp->dev_stats, smp_processor_id()); | ||
| 740 | } | ||
| 741 | |||
| 742 | static inline void *lport_priv(const struct fc_lport *lp) | ||
| 743 | { | ||
| 744 | return (void *)(lp + 1); | ||
| 745 | } | ||
| 746 | |||
| 747 | /** | ||
| 748 | * libfc_host_alloc() - Allocate a Scsi_Host with room for the fc_lport | ||
| 749 | * @sht: ptr to the scsi host templ | ||
| 750 | * @priv_size: size of private data after fc_lport | ||
| 751 | * | ||
| 752 | * Returns: ptr to Scsi_Host | ||
| 753 | */ | ||
| 754 | static inline struct Scsi_Host * | ||
| 755 | libfc_host_alloc(struct scsi_host_template *sht, int priv_size) | ||
| 756 | { | ||
| 757 | return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size); | ||
| 758 | } | ||
| 725 | 759 | ||
| 726 | /* | 760 | /* |
| 727 | * LOCAL PORT LAYER | 761 | * LOCAL PORT LAYER |
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index c41f7d0c6efc..666cc131732e 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright(c) 2007 - 2008 Intel Corporation. All rights reserved. | 2 | * Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved. |
| 3 | * Copyright (c) 2007-2008 Intel Corporation. All rights reserved. | ||
| 3 | * | 4 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it | 5 | * 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 | * under the terms and conditions of the GNU General Public License, |
| @@ -20,134 +21,144 @@ | |||
| 20 | #ifndef _LIBFCOE_H | 21 | #ifndef _LIBFCOE_H |
| 21 | #define _LIBFCOE_H | 22 | #define _LIBFCOE_H |
| 22 | 23 | ||
| 24 | #include <linux/etherdevice.h> | ||
| 25 | #include <linux/if_ether.h> | ||
| 23 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
| 24 | #include <linux/skbuff.h> | 27 | #include <linux/skbuff.h> |
| 28 | #include <linux/workqueue.h> | ||
| 25 | #include <scsi/fc/fc_fcoe.h> | 29 | #include <scsi/fc/fc_fcoe.h> |
| 26 | #include <scsi/libfc.h> | 30 | #include <scsi/libfc.h> |
| 27 | 31 | ||
| 28 | /* | 32 | /* |
| 29 | * this percpu struct for fcoe | 33 | * FIP tunable parameters. |
| 30 | */ | 34 | */ |
| 31 | struct fcoe_percpu_s { | 35 | #define FCOE_CTLR_START_DELAY 2000 /* mS after first adv. to choose FCF */ |
| 32 | int cpu; | 36 | #define FCOE_CTRL_SOL_TOV 2000 /* min. solicitation interval (mS) */ |
| 33 | struct task_struct *thread; | 37 | #define FCOE_CTLR_FCF_LIMIT 20 /* max. number of FCF entries */ |
| 34 | struct sk_buff_head fcoe_rx_list; | 38 | |
| 35 | struct page *crc_eof_page; | 39 | /** |
| 36 | int crc_eof_offset; | 40 | * enum fip_state - internal state of FCoE controller. |
| 41 | * @FIP_ST_DISABLED: controller has been disabled or not yet enabled. | ||
| 42 | * @FIP_ST_LINK_WAIT: the physical link is down or unusable. | ||
| 43 | * @FIP_ST_AUTO: determining whether to use FIP or non-FIP mode. | ||
| 44 | * @FIP_ST_NON_FIP: non-FIP mode selected. | ||
| 45 | * @FIP_ST_ENABLED: FIP mode selected. | ||
| 46 | */ | ||
| 47 | enum fip_state { | ||
| 48 | FIP_ST_DISABLED, | ||
| 49 | FIP_ST_LINK_WAIT, | ||
| 50 | FIP_ST_AUTO, | ||
| 51 | FIP_ST_NON_FIP, | ||
| 52 | FIP_ST_ENABLED, | ||
| 37 | }; | 53 | }; |
| 38 | 54 | ||
| 39 | /* | 55 | /** |
| 40 | * the fcoe sw transport private data | 56 | * struct fcoe_ctlr - FCoE Controller and FIP state. |
| 57 | * @state: internal FIP state for network link and FIP or non-FIP mode. | ||
| 58 | * @lp: &fc_lport: libfc local port. | ||
| 59 | * @sel_fcf: currently selected FCF, or NULL. | ||
| 60 | * @fcfs: list of discovered FCFs. | ||
| 61 | * @fcf_count: number of discovered FCF entries. | ||
| 62 | * @sol_time: time when a multicast solicitation was last sent. | ||
| 63 | * @sel_time: time after which to select an FCF. | ||
| 64 | * @port_ka_time: time of next port keep-alive. | ||
| 65 | * @ctlr_ka_time: time of next controller keep-alive. | ||
| 66 | * @timer: timer struct used for all delayed events. | ||
| 67 | * @link_work: &work_struct for doing FCF selection. | ||
| 68 | * @recv_work: &work_struct for receiving FIP frames. | ||
| 69 | * @fip_recv_list: list of received FIP frames. | ||
| 70 | * @user_mfs: configured maximum FC frame size, including FC header. | ||
| 71 | * @flogi_oxid: exchange ID of most recent fabric login. | ||
| 72 | * @flogi_count: number of FLOGI attempts in AUTO mode. | ||
| 73 | * @link: current link status for libfc. | ||
| 74 | * @last_link: last link state reported to libfc. | ||
| 75 | * @map_dest: use the FC_MAP mode for destination MAC addresses. | ||
| 76 | * @dest_addr: MAC address of the selected FC forwarder. | ||
| 77 | * @ctl_src_addr: the native MAC address of our local port. | ||
| 78 | * @data_src_addr: the assigned MAC address for the local port after FLOGI. | ||
| 79 | * @send: LLD-supplied function to handle sending of FIP Ethernet frames. | ||
| 80 | * @update_mac: LLD-supplied function to handle changes to MAC addresses. | ||
| 81 | * @lock: lock protecting this structure. | ||
| 82 | * | ||
| 83 | * This structure is used by all FCoE drivers. It contains information | ||
| 84 | * needed by all FCoE low-level drivers (LLDs) as well as internal state | ||
| 85 | * for FIP, and fields shared with the LLDS. | ||
| 41 | */ | 86 | */ |
| 42 | struct fcoe_softc { | 87 | struct fcoe_ctlr { |
| 43 | struct list_head list; | 88 | enum fip_state state; |
| 44 | struct fc_lport *lp; | 89 | struct fc_lport *lp; |
| 45 | struct net_device *real_dev; | 90 | struct fcoe_fcf *sel_fcf; |
| 46 | struct net_device *phys_dev; /* device with ethtool_ops */ | 91 | struct list_head fcfs; |
| 47 | struct packet_type fcoe_packet_type; | 92 | u16 fcf_count; |
| 48 | struct sk_buff_head fcoe_pending_queue; | 93 | unsigned long sol_time; |
| 49 | u8 fcoe_pending_queue_active; | 94 | unsigned long sel_time; |
| 50 | 95 | unsigned long port_ka_time; | |
| 96 | unsigned long ctlr_ka_time; | ||
| 97 | struct timer_list timer; | ||
| 98 | struct work_struct link_work; | ||
| 99 | struct work_struct recv_work; | ||
| 100 | struct sk_buff_head fip_recv_list; | ||
| 101 | u16 user_mfs; | ||
| 102 | u16 flogi_oxid; | ||
| 103 | u8 flogi_count; | ||
| 104 | u8 link; | ||
| 105 | u8 last_link; | ||
| 106 | u8 map_dest; | ||
| 51 | u8 dest_addr[ETH_ALEN]; | 107 | u8 dest_addr[ETH_ALEN]; |
| 52 | u8 ctl_src_addr[ETH_ALEN]; | 108 | u8 ctl_src_addr[ETH_ALEN]; |
| 53 | u8 data_src_addr[ETH_ALEN]; | 109 | u8 data_src_addr[ETH_ALEN]; |
| 54 | /* | ||
| 55 | * fcoe protocol address learning related stuff | ||
| 56 | */ | ||
| 57 | u16 flogi_oxid; | ||
| 58 | u8 flogi_progress; | ||
| 59 | u8 address_mode; | ||
| 60 | }; | ||
| 61 | |||
| 62 | static inline struct net_device *fcoe_netdev( | ||
| 63 | const struct fc_lport *lp) | ||
| 64 | { | ||
| 65 | return ((struct fcoe_softc *)lport_priv(lp))->real_dev; | ||
| 66 | } | ||
| 67 | |||
| 68 | static inline struct fcoe_hdr *skb_fcoe_header(const struct sk_buff *skb) | ||
| 69 | { | ||
| 70 | return (struct fcoe_hdr *)skb_network_header(skb); | ||
| 71 | } | ||
| 72 | |||
| 73 | static inline int skb_fcoe_offset(const struct sk_buff *skb) | ||
| 74 | { | ||
| 75 | return skb_network_offset(skb); | ||
| 76 | } | ||
| 77 | |||
| 78 | static inline struct fc_frame_header *skb_fc_header(const struct sk_buff *skb) | ||
| 79 | { | ||
| 80 | return (struct fc_frame_header *)skb_transport_header(skb); | ||
| 81 | } | ||
| 82 | |||
| 83 | static inline int skb_fc_offset(const struct sk_buff *skb) | ||
| 84 | { | ||
| 85 | return skb_transport_offset(skb); | ||
| 86 | } | ||
| 87 | 110 | ||
| 88 | static inline void skb_reset_fc_header(struct sk_buff *skb) | 111 | void (*send)(struct fcoe_ctlr *, struct sk_buff *); |
| 89 | { | 112 | void (*update_mac)(struct fcoe_ctlr *, u8 *old, u8 *new); |
| 90 | skb_reset_network_header(skb); | 113 | spinlock_t lock; |
| 91 | skb_set_transport_header(skb, skb_network_offset(skb) + | 114 | }; |
| 92 | sizeof(struct fcoe_hdr)); | ||
| 93 | } | ||
| 94 | |||
| 95 | static inline bool skb_fc_is_data(const struct sk_buff *skb) | ||
| 96 | { | ||
| 97 | return skb_fc_header(skb)->fh_r_ctl == FC_RCTL_DD_SOL_DATA; | ||
| 98 | } | ||
| 99 | |||
| 100 | static inline bool skb_fc_is_cmd(const struct sk_buff *skb) | ||
| 101 | { | ||
| 102 | return skb_fc_header(skb)->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD; | ||
| 103 | } | ||
| 104 | 115 | ||
| 105 | static inline bool skb_fc_has_exthdr(const struct sk_buff *skb) | 116 | /* |
| 106 | { | 117 | * struct fcoe_fcf - Fibre-Channel Forwarder. |
| 107 | return (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_VFTH) || | 118 | * @list: list linkage. |
| 108 | (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_IFRH) || | 119 | * @time: system time (jiffies) when an advertisement was last received. |
| 109 | (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_ENCH); | 120 | * @switch_name: WWN of switch from advertisement. |
| 110 | } | 121 | * @fabric_name: WWN of fabric from advertisement. |
| 122 | * @fc_map: FC_MAP value from advertisement. | ||
| 123 | * @fcf_mac: Ethernet address of the FCF. | ||
| 124 | * @vfid: virtual fabric ID. | ||
| 125 | * @pri: seletion priority, smaller values are better. | ||
| 126 | * @flags: flags received from advertisement. | ||
| 127 | * @fka_period: keep-alive period, in jiffies. | ||
| 128 | * | ||
| 129 | * A Fibre-Channel Forwarder (FCF) is the entity on the Ethernet that | ||
| 130 | * passes FCoE frames on to an FC fabric. This structure represents | ||
| 131 | * one FCF from which advertisements have been received. | ||
| 132 | * | ||
| 133 | * When looking up an FCF, @switch_name, @fabric_name, @fc_map, @vfid, and | ||
| 134 | * @fcf_mac together form the lookup key. | ||
| 135 | */ | ||
| 136 | struct fcoe_fcf { | ||
| 137 | struct list_head list; | ||
| 138 | unsigned long time; | ||
| 111 | 139 | ||
| 112 | static inline bool skb_fc_is_roff(const struct sk_buff *skb) | 140 | u64 switch_name; |
| 113 | { | 141 | u64 fabric_name; |
| 114 | return skb_fc_header(skb)->fh_f_ctl[2] & FC_FC_REL_OFF; | 142 | u32 fc_map; |
| 115 | } | 143 | u16 vfid; |
| 144 | u8 fcf_mac[ETH_ALEN]; | ||
| 116 | 145 | ||
| 117 | static inline u16 skb_fc_oxid(const struct sk_buff *skb) | 146 | u8 pri; |
| 118 | { | 147 | u16 flags; |
| 119 | return be16_to_cpu(skb_fc_header(skb)->fh_ox_id); | 148 | u32 fka_period; |
| 120 | } | 149 | }; |
| 121 | 150 | ||
| 122 | static inline u16 skb_fc_rxid(const struct sk_buff *skb) | 151 | /* FIP API functions */ |
| 123 | { | 152 | void fcoe_ctlr_init(struct fcoe_ctlr *); |
| 124 | return be16_to_cpu(skb_fc_header(skb)->fh_rx_id); | 153 | void fcoe_ctlr_destroy(struct fcoe_ctlr *); |
| 125 | } | 154 | void fcoe_ctlr_link_up(struct fcoe_ctlr *); |
| 155 | int fcoe_ctlr_link_down(struct fcoe_ctlr *); | ||
| 156 | int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct sk_buff *); | ||
| 157 | void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *); | ||
| 158 | int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_frame *fp, u8 *sa); | ||
| 126 | 159 | ||
| 127 | /* libfcoe funcs */ | 160 | /* libfcoe funcs */ |
| 128 | int fcoe_reset(struct Scsi_Host *shost); | 161 | u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); |
| 129 | u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN], | ||
| 130 | unsigned int scheme, unsigned int port); | ||
| 131 | |||
| 132 | u32 fcoe_fc_crc(struct fc_frame *fp); | ||
| 133 | int fcoe_xmit(struct fc_lport *, struct fc_frame *); | ||
| 134 | int fcoe_rcv(struct sk_buff *, struct net_device *, | ||
| 135 | struct packet_type *, struct net_device *); | ||
| 136 | |||
| 137 | int fcoe_percpu_receive_thread(void *arg); | ||
| 138 | void fcoe_clean_pending_queue(struct fc_lport *lp); | ||
| 139 | void fcoe_percpu_clean(struct fc_lport *lp); | ||
| 140 | void fcoe_watchdog(ulong vp); | ||
| 141 | int fcoe_link_ok(struct fc_lport *lp); | ||
| 142 | |||
| 143 | struct fc_lport *fcoe_hostlist_lookup(const struct net_device *); | ||
| 144 | int fcoe_hostlist_add(const struct fc_lport *); | ||
| 145 | int fcoe_hostlist_remove(const struct fc_lport *); | ||
| 146 | |||
| 147 | struct Scsi_Host *fcoe_host_alloc(struct scsi_host_template *, int); | ||
| 148 | int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *); | 162 | int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *); |
| 149 | 163 | ||
| 150 | /* fcoe sw hba */ | ||
| 151 | int __init fcoe_sw_init(void); | ||
| 152 | int __exit fcoe_sw_exit(void); | ||
| 153 | #endif /* _LIBFCOE_H */ | 164 | #endif /* _LIBFCOE_H */ |
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 7ffaed2f94dd..0289f5745fb9 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
| @@ -36,6 +36,7 @@ struct scsi_transport_template; | |||
| 36 | struct scsi_host_template; | 36 | struct scsi_host_template; |
| 37 | struct scsi_device; | 37 | struct scsi_device; |
| 38 | struct Scsi_Host; | 38 | struct Scsi_Host; |
| 39 | struct scsi_target; | ||
| 39 | struct scsi_cmnd; | 40 | struct scsi_cmnd; |
| 40 | struct socket; | 41 | struct socket; |
| 41 | struct iscsi_transport; | 42 | struct iscsi_transport; |
| @@ -350,6 +351,7 @@ extern struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht, | |||
| 350 | bool xmit_can_sleep); | 351 | bool xmit_can_sleep); |
| 351 | extern void iscsi_host_remove(struct Scsi_Host *shost); | 352 | extern void iscsi_host_remove(struct Scsi_Host *shost); |
| 352 | extern void iscsi_host_free(struct Scsi_Host *shost); | 353 | extern void iscsi_host_free(struct Scsi_Host *shost); |
| 354 | extern int iscsi_target_alloc(struct scsi_target *starget); | ||
| 353 | 355 | ||
| 354 | /* | 356 | /* |
| 355 | * session management | 357 | * session management |
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h index cd3cbf764650..62b2ab8c69d4 100644 --- a/include/scsi/osd_protocol.h +++ b/include/scsi/osd_protocol.h | |||
| @@ -24,17 +24,18 @@ enum { | |||
| 24 | OSDv1_ADDITIONAL_CDB_LENGTH = 192, | 24 | OSDv1_ADDITIONAL_CDB_LENGTH = 192, |
| 25 | OSDv1_TOTAL_CDB_LEN = OSDv1_ADDITIONAL_CDB_LENGTH + 8, | 25 | OSDv1_TOTAL_CDB_LEN = OSDv1_ADDITIONAL_CDB_LENGTH + 8, |
| 26 | OSDv1_CAP_LEN = 80, | 26 | OSDv1_CAP_LEN = 80, |
| 27 | |||
| 27 | /* Latest supported version */ | 28 | /* Latest supported version */ |
| 28 | /* OSD_ADDITIONAL_CDB_LENGTH = 216,*/ | 29 | OSDv2_ADDITIONAL_CDB_LENGTH = 228, |
| 29 | OSD_ADDITIONAL_CDB_LENGTH = | 30 | OSD_ADDITIONAL_CDB_LENGTH = |
| 30 | OSDv1_ADDITIONAL_CDB_LENGTH, /* FIXME: Pete rev-001 sup */ | 31 | OSDv2_ADDITIONAL_CDB_LENGTH, |
| 31 | OSD_TOTAL_CDB_LEN = OSD_ADDITIONAL_CDB_LENGTH + 8, | 32 | OSD_TOTAL_CDB_LEN = OSD_ADDITIONAL_CDB_LENGTH + 8, |
| 32 | /* OSD_CAP_LEN = 104,*/ | 33 | OSD_CAP_LEN = 104, |
| 33 | OSD_CAP_LEN = OSDv1_CAP_LEN,/* FIXME: Pete rev-001 sup */ | ||
| 34 | 34 | ||
| 35 | OSD_SYSTEMID_LEN = 20, | 35 | OSD_SYSTEMID_LEN = 20, |
| 36 | OSD_CRYPTO_KEYID_SIZE = 20, | 36 | OSDv1_CRYPTO_KEYID_SIZE = 20, |
| 37 | /*FIXME: OSDv2_CRYPTO_KEYID_SIZE = 32,*/ | 37 | OSDv2_CRYPTO_KEYID_SIZE = 32, |
| 38 | OSD_CRYPTO_KEYID_SIZE = OSDv2_CRYPTO_KEYID_SIZE, | ||
| 38 | OSD_CRYPTO_SEED_SIZE = 4, | 39 | OSD_CRYPTO_SEED_SIZE = 4, |
| 39 | OSD_CRYPTO_NONCE_SIZE = 12, | 40 | OSD_CRYPTO_NONCE_SIZE = 12, |
| 40 | OSD_MAX_SENSE_LEN = 252, /* from SPC-3 */ | 41 | OSD_MAX_SENSE_LEN = 252, /* from SPC-3 */ |
| @@ -164,7 +165,11 @@ struct osd_cdb_head { | |||
| 164 | /* called allocation_length in some commands */ | 165 | /* called allocation_length in some commands */ |
| 165 | /*32*/ __be64 length; | 166 | /*32*/ __be64 length; |
| 166 | /*40*/ __be64 start_address; | 167 | /*40*/ __be64 start_address; |
| 167 | /*48*/ __be32 list_identifier;/* Rarely used */ | 168 | union { |
| 169 | /*48*/ __be32 list_identifier;/* Rarely used */ | ||
| 170 | /* OSD2r05 5.2.5 CDB continuation length */ | ||
| 171 | /*48*/ __be32 cdb_continuation_length; | ||
| 172 | }; | ||
| 168 | } __packed v2; | 173 | } __packed v2; |
| 169 | }; | 174 | }; |
| 170 | /*52*/ union { /* selected attributes mode Page/List/Single */ | 175 | /*52*/ union { /* selected attributes mode Page/List/Single */ |
| @@ -204,29 +209,40 @@ struct osd_cdb_head { | |||
| 204 | /*80*/ | 209 | /*80*/ |
| 205 | 210 | ||
| 206 | /*160 v1*/ | 211 | /*160 v1*/ |
| 207 | /*184 v2*/ | 212 | struct osdv1_security_parameters { |
| 208 | struct osd_security_parameters { | 213 | /*160*/u8 integrity_check_value[OSDv1_CRYPTO_KEYID_SIZE]; |
| 209 | /*160*/u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE]; | ||
| 210 | /*180*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE]; | 214 | /*180*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE]; |
| 211 | /*192*/osd_cdb_offset data_in_integrity_check_offset; | 215 | /*192*/osd_cdb_offset data_in_integrity_check_offset; |
| 212 | /*196*/osd_cdb_offset data_out_integrity_check_offset; | 216 | /*196*/osd_cdb_offset data_out_integrity_check_offset; |
| 213 | } __packed; | 217 | } __packed; |
| 214 | /*200 v1*/ | 218 | /*200 v1*/ |
| 215 | /*224 v2*/ | ||
| 216 | 219 | ||
| 217 | /* FIXME: osdv2_security_parameters */ | 220 | /*184 v2*/ |
| 221 | struct osdv2_security_parameters { | ||
| 222 | /*184*/u8 integrity_check_value[OSDv2_CRYPTO_KEYID_SIZE]; | ||
| 223 | /*216*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE]; | ||
| 224 | /*228*/osd_cdb_offset data_in_integrity_check_offset; | ||
| 225 | /*232*/osd_cdb_offset data_out_integrity_check_offset; | ||
| 226 | } __packed; | ||
| 227 | /*236 v2*/ | ||
| 228 | |||
| 229 | struct osd_security_parameters { | ||
| 230 | union { | ||
| 231 | struct osdv1_security_parameters v1; | ||
| 232 | struct osdv2_security_parameters v2; | ||
| 233 | }; | ||
| 234 | }; | ||
| 218 | 235 | ||
| 219 | struct osdv1_cdb { | 236 | struct osdv1_cdb { |
| 220 | struct osd_cdb_head h; | 237 | struct osd_cdb_head h; |
| 221 | u8 caps[OSDv1_CAP_LEN]; | 238 | u8 caps[OSDv1_CAP_LEN]; |
| 222 | struct osd_security_parameters sec_params; | 239 | struct osdv1_security_parameters sec_params; |
| 223 | } __packed; | 240 | } __packed; |
| 224 | 241 | ||
| 225 | struct osdv2_cdb { | 242 | struct osdv2_cdb { |
| 226 | struct osd_cdb_head h; | 243 | struct osd_cdb_head h; |
| 227 | u8 caps[OSD_CAP_LEN]; | 244 | u8 caps[OSD_CAP_LEN]; |
| 228 | struct osd_security_parameters sec_params; | 245 | struct osdv2_security_parameters sec_params; |
| 229 | /* FIXME: osdv2_security_parameters */ | ||
| 230 | } __packed; | 246 | } __packed; |
| 231 | 247 | ||
| 232 | struct osd_cdb { | 248 | struct osd_cdb { |
| @@ -301,14 +317,25 @@ struct osd_attributes_list_attrid { | |||
| 301 | } __packed; | 317 | } __packed; |
| 302 | 318 | ||
| 303 | /* | 319 | /* |
| 320 | * NOTE: v1: is not aligned. | ||
| 321 | */ | ||
| 322 | struct osdv1_attributes_list_element { | ||
| 323 | __be32 attr_page; | ||
| 324 | __be32 attr_id; | ||
| 325 | __be16 attr_bytes; /* valid bytes at attr_val without padding */ | ||
| 326 | u8 attr_val[0]; | ||
| 327 | } __packed; | ||
| 328 | |||
| 329 | /* | ||
| 304 | * osd2r03: 7.1.3.3 List entry format for retrieved attributes and | 330 | * osd2r03: 7.1.3.3 List entry format for retrieved attributes and |
| 305 | * for setting attributes | 331 | * for setting attributes |
| 306 | * NOTE: v2 is 8-bytes aligned, v1 is not aligned. | 332 | * NOTE: v2 is 8-bytes aligned |
| 307 | */ | 333 | */ |
| 308 | struct osd_attributes_list_element { | 334 | struct osdv2_attributes_list_element { |
| 309 | __be32 attr_page; | 335 | __be32 attr_page; |
| 310 | __be32 attr_id; | 336 | __be32 attr_id; |
| 311 | __be16 attr_bytes; | 337 | u8 reserved[6]; |
| 338 | __be16 attr_bytes; /* valid bytes at attr_val without padding */ | ||
| 312 | u8 attr_val[0]; | 339 | u8 attr_val[0]; |
| 313 | } __packed; | 340 | } __packed; |
| 314 | 341 | ||
| @@ -324,13 +351,13 @@ enum { | |||
| 324 | 351 | ||
| 325 | static inline unsigned osdv1_attr_list_elem_size(unsigned len) | 352 | static inline unsigned osdv1_attr_list_elem_size(unsigned len) |
| 326 | { | 353 | { |
| 327 | return ALIGN(len + sizeof(struct osd_attributes_list_element), | 354 | return ALIGN(len + sizeof(struct osdv1_attributes_list_element), |
| 328 | OSDv1_ATTRIBUTES_ELEM_ALIGN); | 355 | OSDv1_ATTRIBUTES_ELEM_ALIGN); |
| 329 | } | 356 | } |
| 330 | 357 | ||
| 331 | static inline unsigned osdv2_attr_list_elem_size(unsigned len) | 358 | static inline unsigned osdv2_attr_list_elem_size(unsigned len) |
| 332 | { | 359 | { |
| 333 | return ALIGN(len + sizeof(struct osd_attributes_list_element), | 360 | return ALIGN(len + sizeof(struct osdv2_attributes_list_element), |
| 334 | OSD_ATTRIBUTES_ELEM_ALIGN); | 361 | OSD_ATTRIBUTES_ELEM_ALIGN); |
| 335 | } | 362 | } |
| 336 | 363 | ||
| @@ -419,15 +446,35 @@ struct osd_data_out_integrity_info { | |||
| 419 | __be64 data_bytes; | 446 | __be64 data_bytes; |
| 420 | __be64 set_attributes_bytes; | 447 | __be64 set_attributes_bytes; |
| 421 | __be64 get_attributes_bytes; | 448 | __be64 get_attributes_bytes; |
| 422 | __be64 integrity_check_value; | 449 | __u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE]; |
| 423 | } __packed; | 450 | } __packed; |
| 424 | 451 | ||
| 452 | /* Same osd_data_out_integrity_info is used for OSD2/OSD1. The only difference | ||
| 453 | * Is the sizeof the structure since in OSD1 the last array is smaller. Use | ||
| 454 | * below for version independent handling of this structure | ||
| 455 | */ | ||
| 456 | static inline int osd_data_out_integrity_info_sizeof(bool is_ver1) | ||
| 457 | { | ||
| 458 | return sizeof(struct osd_data_out_integrity_info) - | ||
| 459 | (is_ver1 * (OSDv2_CRYPTO_KEYID_SIZE - OSDv1_CRYPTO_KEYID_SIZE)); | ||
| 460 | } | ||
| 461 | |||
| 425 | struct osd_data_in_integrity_info { | 462 | struct osd_data_in_integrity_info { |
| 426 | __be64 data_bytes; | 463 | __be64 data_bytes; |
| 427 | __be64 retrieved_attributes_bytes; | 464 | __be64 retrieved_attributes_bytes; |
| 428 | __be64 integrity_check_value; | 465 | __u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE]; |
| 429 | } __packed; | 466 | } __packed; |
| 430 | 467 | ||
| 468 | /* Same osd_data_in_integrity_info is used for OSD2/OSD1. The only difference | ||
| 469 | * Is the sizeof the structure since in OSD1 the last array is smaller. Use | ||
| 470 | * below for version independent handling of this structure | ||
| 471 | */ | ||
| 472 | static inline int osd_data_in_integrity_info_sizeof(bool is_ver1) | ||
| 473 | { | ||
| 474 | return sizeof(struct osd_data_in_integrity_info) - | ||
| 475 | (is_ver1 * (OSDv2_CRYPTO_KEYID_SIZE - OSDv1_CRYPTO_KEYID_SIZE)); | ||
| 476 | } | ||
| 477 | |||
| 431 | struct osd_timestamp { | 478 | struct osd_timestamp { |
| 432 | u8 time[6]; /* number of milliseconds since 1/1/1970 UT (big endian) */ | 479 | u8 time[6]; /* number of milliseconds since 1/1/1970 UT (big endian) */ |
| 433 | } __packed; | 480 | } __packed; |
| @@ -477,7 +524,7 @@ enum osd_capability_bit_masks { | |||
| 477 | 524 | ||
| 478 | OSD_SEC_CAP_NONE1 = BIT(8), | 525 | OSD_SEC_CAP_NONE1 = BIT(8), |
| 479 | OSD_SEC_CAP_NONE2 = BIT(9), | 526 | OSD_SEC_CAP_NONE2 = BIT(9), |
| 480 | OSD_SEC_CAP_NONE3 = BIT(10), | 527 | OSD_SEC_GBL_REM = BIT(10), /*v2 only*/ |
| 481 | OSD_SEC_CAP_QUERY = BIT(11), /*v2 only*/ | 528 | OSD_SEC_CAP_QUERY = BIT(11), /*v2 only*/ |
| 482 | OSD_SEC_CAP_M_OBJECT = BIT(12), /*v2 only*/ | 529 | OSD_SEC_CAP_M_OBJECT = BIT(12), /*v2 only*/ |
| 483 | OSD_SEC_CAP_POL_SEC = BIT(13), | 530 | OSD_SEC_CAP_POL_SEC = BIT(13), |
| @@ -552,8 +599,7 @@ struct osdv1_capability { | |||
| 552 | 599 | ||
| 553 | struct osd_capability { | 600 | struct osd_capability { |
| 554 | struct osd_capability_head h; | 601 | struct osd_capability_head h; |
| 555 | /* struct osd_cap_object_descriptor od;*/ | 602 | struct osd_cap_object_descriptor od; |
| 556 | struct osdv1_cap_object_descriptor od; /* FIXME: Pete rev-001 sup */ | ||
| 557 | } __packed; | 603 | } __packed; |
| 558 | 604 | ||
| 559 | /** | 605 | /** |
diff --git a/include/scsi/scsi_scan.h b/include/scsi/scsi_scan.h new file mode 100644 index 000000000000..78898889243d --- /dev/null +++ b/include/scsi/scsi_scan.h | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #ifndef _SCSI_SCSI_SCAN_H | ||
| 2 | #define _SCSI_SCSI_SCAN_H | ||
| 3 | |||
| 4 | #ifdef CONFIG_SCSI | ||
| 5 | /* drivers/scsi/scsi_scan.c */ | ||
| 6 | extern int scsi_complete_async_scans(void); | ||
| 7 | #else | ||
| 8 | static inline int scsi_complete_async_scans(void) { return 0; } | ||
| 9 | #endif | ||
| 10 | |||
| 11 | #endif /* _SCSI_SCSI_SCAN_H */ | ||
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index c9184f756cad..68a8d873bbd9 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h | |||
| @@ -680,7 +680,7 @@ fc_remote_port_chkready(struct fc_rport *rport) | |||
| 680 | if (rport->roles & FC_PORT_ROLE_FCP_TARGET) | 680 | if (rport->roles & FC_PORT_ROLE_FCP_TARGET) |
| 681 | result = 0; | 681 | result = 0; |
| 682 | else if (rport->flags & FC_RPORT_DEVLOSS_PENDING) | 682 | else if (rport->flags & FC_RPORT_DEVLOSS_PENDING) |
| 683 | result = DID_TRANSPORT_DISRUPTED << 16; | 683 | result = DID_IMM_RETRY << 16; |
| 684 | else | 684 | else |
| 685 | result = DID_NO_CONNECT << 16; | 685 | result = DID_NO_CONNECT << 16; |
| 686 | break; | 686 | break; |
| @@ -688,7 +688,7 @@ fc_remote_port_chkready(struct fc_rport *rport) | |||
| 688 | if (rport->flags & FC_RPORT_FAST_FAIL_TIMEDOUT) | 688 | if (rport->flags & FC_RPORT_FAST_FAIL_TIMEDOUT) |
| 689 | result = DID_TRANSPORT_FAILFAST << 16; | 689 | result = DID_TRANSPORT_FAILFAST << 16; |
| 690 | else | 690 | else |
| 691 | result = DID_TRANSPORT_DISRUPTED << 16; | 691 | result = DID_IMM_RETRY << 16; |
| 692 | break; | 692 | break; |
| 693 | default: | 693 | default: |
| 694 | result = DID_NO_CONNECT << 16; | 694 | result = DID_NO_CONNECT << 16; |
