ctl_frontend.h (268688) | ctl_frontend.h (268692) |
---|---|
1/*- 2 * Copyright (c) 2003 Silicon Graphics International Corp. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGES. 29 * 30 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_frontend.h#2 $ | 1/*- 2 * Copyright (c) 2003 Silicon Graphics International Corp. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGES. 29 * 30 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_frontend.h#2 $ |
31 * $FreeBSD: stable/10/sys/cam/ctl/ctl_frontend.h 268688 2014-07-15 17:10:48Z mav $ | 31 * $FreeBSD: stable/10/sys/cam/ctl/ctl_frontend.h 268692 2014-07-15 17:14:53Z mav $ |
32 */ 33/* 34 * CAM Target Layer front end registration hooks 35 * 36 * Author: Ken Merry <ken@FreeBSD.org> 37 */ 38 39#ifndef _CTL_FRONTEND_H_ --- 35 unchanged lines hidden (view full) --- 75 #name, \ 76 name ## _modevent, \ 77 (void *)&driver \ 78 }; \ 79 DECLARE_MODULE(name, name ## _mod, SI_SUB_CONFIGURE, SI_ORDER_FOURTH); \ 80 MODULE_DEPEND(name, ctl, 1, 1, 1); \ 81 MODULE_DEPEND(name, cam, 1, 1, 1) 82 | 32 */ 33/* 34 * CAM Target Layer front end registration hooks 35 * 36 * Author: Ken Merry <ken@FreeBSD.org> 37 */ 38 39#ifndef _CTL_FRONTEND_H_ --- 35 unchanged lines hidden (view full) --- 75 #name, \ 76 name ## _modevent, \ 77 (void *)&driver \ 78 }; \ 79 DECLARE_MODULE(name, name ## _mod, SI_SUB_CONFIGURE, SI_ORDER_FOURTH); \ 80 MODULE_DEPEND(name, ctl, 1, 1, 1); \ 81 MODULE_DEPEND(name, cam, 1, 1, 1) 82 |
83struct ctl_wwpn_iid { 84 int in_use; 85 time_t last_use; 86 uint64_t wwpn; 87 char *name; 88}; 89 |
|
83/* 84 * The ctl_frontend structure is the registration mechanism between a FETD 85 * (Front End Target Driver) and the CTL layer. Here is a description of 86 * the fields: 87 * 88 * port_type: This field tells CTL what kind of front end it is 89 * dealing with. This field serves two purposes. 90 * The first is to let CTL know whether the frontend --- 132 unchanged lines hidden (view full) --- 223 void *targ_lun_arg; /* passed to CTL */ 224 void (*fe_datamove)(union ctl_io *io); /* passed to CTL */ 225 void (*fe_done)(union ctl_io *io); /* passed to CTL */ 226 int max_targets; /* passed to CTL */ 227 int max_target_id; /* passed to CTL */ 228 int32_t targ_port; /* passed back to FETD */ 229 void *ctl_pool_ref; /* passed back to FETD */ 230 uint32_t max_initiators; /* passed back to FETD */ | 90/* 91 * The ctl_frontend structure is the registration mechanism between a FETD 92 * (Front End Target Driver) and the CTL layer. Here is a description of 93 * the fields: 94 * 95 * port_type: This field tells CTL what kind of front end it is 96 * dealing with. This field serves two purposes. 97 * The first is to let CTL know whether the frontend --- 132 unchanged lines hidden (view full) --- 230 void *targ_lun_arg; /* passed to CTL */ 231 void (*fe_datamove)(union ctl_io *io); /* passed to CTL */ 232 void (*fe_done)(union ctl_io *io); /* passed to CTL */ 233 int max_targets; /* passed to CTL */ 234 int max_target_id; /* passed to CTL */ 235 int32_t targ_port; /* passed back to FETD */ 236 void *ctl_pool_ref; /* passed back to FETD */ 237 uint32_t max_initiators; /* passed back to FETD */ |
238 struct ctl_wwpn_iid *wwpn_iid; /* used by CTL */ |
|
231 uint64_t wwnn; /* set by CTL before online */ 232 uint64_t wwpn; /* set by CTL before online */ 233 ctl_port_status status; /* used by CTL */ 234 ctl_options_t options; /* passed to CTL */ 235 struct ctl_devid *port_devid; /* passed to CTL */ 236 struct ctl_devid *target_devid; /* passed to CTL */ 237 STAILQ_ENTRY(ctl_port) fe_links; /* used by CTL */ 238 STAILQ_ENTRY(ctl_port) links; /* used by CTL */ --- 25 unchanged lines hidden (view full) --- 264 * Find the frontend by its name. Returns NULL if not found. 265 */ 266struct ctl_frontend * ctl_frontend_find(char *frontend_name); 267 268/* 269 * This may block until resources are allocated. Called at FETD module load 270 * time. Returns 0 for success, non-zero for failure. 271 */ | 239 uint64_t wwnn; /* set by CTL before online */ 240 uint64_t wwpn; /* set by CTL before online */ 241 ctl_port_status status; /* used by CTL */ 242 ctl_options_t options; /* passed to CTL */ 243 struct ctl_devid *port_devid; /* passed to CTL */ 244 struct ctl_devid *target_devid; /* passed to CTL */ 245 STAILQ_ENTRY(ctl_port) fe_links; /* used by CTL */ 246 STAILQ_ENTRY(ctl_port) links; /* used by CTL */ --- 25 unchanged lines hidden (view full) --- 272 * Find the frontend by its name. Returns NULL if not found. 273 */ 274struct ctl_frontend * ctl_frontend_find(char *frontend_name); 275 276/* 277 * This may block until resources are allocated. Called at FETD module load 278 * time. Returns 0 for success, non-zero for failure. 279 */ |
272int ctl_port_register(struct ctl_port *fe, int master_SC); | 280int ctl_port_register(struct ctl_port *port, int master_SC); |
273 274/* 275 * Called at FETD module unload time. 276 * Returns 0 for success, non-zero for failure. 277 */ | 281 282/* 283 * Called at FETD module unload time. 284 * Returns 0 for success, non-zero for failure. 285 */ |
278int ctl_port_deregister(struct ctl_port *fe); | 286int ctl_port_deregister(struct ctl_port *port); |
279 280/* 281 * Called to set the WWNN and WWPN for a particular frontend. 282 */ 283void ctl_port_set_wwns(struct ctl_port *port, int wwnn_valid, 284 uint64_t wwnn, int wwpn_valid, uint64_t wwpn); 285 286/* --- 20 unchanged lines hidden (view full) --- 307 * called BEFORE any request sense can get queued to the CTL layer -- I 308 * need it in the queue in order to service the request. The scsiio 309 * structure passed in here will be freed by the CTL layer when sense is 310 * retrieved by the initiator. Returns 0 for success, non-zero for failure. 311 */ 312int ctl_queue_sense(union ctl_io *io); 313 314/* | 287 288/* 289 * Called to set the WWNN and WWPN for a particular frontend. 290 */ 291void ctl_port_set_wwns(struct ctl_port *port, int wwnn_valid, 292 uint64_t wwnn, int wwpn_valid, uint64_t wwpn); 293 294/* --- 20 unchanged lines hidden (view full) --- 315 * called BEFORE any request sense can get queued to the CTL layer -- I 316 * need it in the queue in order to service the request. The scsiio 317 * structure passed in here will be freed by the CTL layer when sense is 318 * retrieved by the initiator. Returns 0 for success, non-zero for failure. 319 */ 320int ctl_queue_sense(union ctl_io *io); 321 322/* |
315 * This routine adds an initiator to CTL's port database. The WWPN should 316 * be the FC WWPN, if available. The targ_port field should be the same as 317 * the targ_port passed back from CTL in the ctl_frontend structure above. | 323 * This routine adds an initiator to CTL's port database. |
318 * The iid field should be the same as the iid passed in the nexus of each 319 * ctl_io from this initiator. | 324 * The iid field should be the same as the iid passed in the nexus of each 325 * ctl_io from this initiator. |
326 * The WWPN should be the FC WWPN, if available. |
|
320 */ | 327 */ |
321int ctl_add_initiator(uint64_t wwpn, int32_t targ_port, uint32_t iid); | 328int ctl_add_initiator(struct ctl_port *port, int iid, uint64_t wwpn, char *name); |
322 323/* | 329 330/* |
324 * This routine will remove an initiator from CTL's port database. The 325 * targ_port field should be the same as the targ_port passed back in the 326 * ctl_frontend structure above. The iid field should be the same as the 327 * iid passed in the nexus of each ctl_io from this initiator. | 331 * This routine will remove an initiator from CTL's port database. 332 * The iid field should be the same as the iid passed in the nexus of each 333 * ctl_io from this initiator. |
328 */ | 334 */ |
329int 330ctl_remove_initiator(int32_t targ_port, uint32_t iid); | 335int ctl_remove_initiator(struct ctl_port *port, int iid); |
331 332#endif /* _CTL_FRONTEND_H_ */ | 336 337#endif /* _CTL_FRONTEND_H_ */ |