1<?xml version="1.0" encoding="UTF-8"?> 2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> 4 5<book id="scsimid"> 6 <bookinfo> 7 <title>SCSI Interfaces Guide</title> 8 9 <authorgroup> 10 <author> 11 <firstname>James</firstname> 12 <surname>Bottomley</surname> 13 <affiliation> 14 <address> 15 <email>James.Bottomley@hansenpartnership.com</email> 16 </address> 17 </affiliation> 18 </author> 19 20 <author> 21 <firstname>Rob</firstname> 22 <surname>Landley</surname> 23 <affiliation> 24 <address> 25 <email>rob@landley.net</email> 26 </address> 27 </affiliation> 28 </author> 29 30 </authorgroup> 31 32 <copyright> 33 <year>2007</year> 34 <holder>Linux Foundation</holder> 35 </copyright> 36 37 <legalnotice> 38 <para> 39 This documentation is free software; you can redistribute 40 it and/or modify it under the terms of the GNU General Public 41 License version 2. 42 </para> 43 44 <para> 45 This program is distributed in the hope that it will be 46 useful, but WITHOUT ANY WARRANTY; without even the implied 47 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 48 For more details see the file COPYING in the source 49 distribution of Linux. 50 </para> 51 </legalnotice> 52 </bookinfo> 53 54 <toc></toc> 55 56 <chapter id="intro"> 57 <title>Introduction</title> 58 <sect1 id="protocol_vs_bus"> 59 <title>Protocol vs bus</title> 60 <para> 61 Once upon a time, the Small Computer Systems Interface defined both 62 a parallel I/O bus and a data protocol to connect a wide variety of 63 peripherals (disk drives, tape drives, modems, printers, scanners, 64 optical drives, test equipment, and medical devices) to a host 65 computer. 66 </para> 67 <para> 68 Although the old parallel (fast/wide/ultra) SCSI bus has largely 69 fallen out of use, the SCSI command set is more widely used than ever 70 to communicate with devices over a number of different busses. 71 </para> 72 <para> 73 The <ulink url='http://www.t10.org/scsi-3.htm'>SCSI protocol</ulink> 74 is a big-endian peer-to-peer packet based protocol. SCSI commands 75 are 6, 10, 12, or 16 bytes long, often followed by an associated data 76 payload. 77 </para> 78 <para> 79 SCSI commands can be transported over just about any kind of bus, and 80 are the default protocol for storage devices attached to USB, SATA, 81 SAS, Fibre Channel, FireWire, and ATAPI devices. SCSI packets are 82 also commonly exchanged over Infiniband, 83 <ulink url='http://i2o.shadowconnect.com/faq.php'>I20</ulink>, TCP/IP 84 (<ulink url='http://en.wikipedia.org/wiki/ISCSI'>iSCSI</ulink>), even 85 <ulink url='http://cyberelk.net/tim/parport/parscsi.html'>Parallel 86 ports</ulink>. 87 </para> 88 </sect1> 89 <sect1 id="subsystem_design"> 90 <title>Design of the Linux SCSI subsystem</title> 91 <para> 92 The SCSI subsystem uses a three layer design, with upper, mid, and low 93 layers. Every operation involving the SCSI subsystem (such as reading 94 a sector from a disk) uses one driver at each of the 3 levels: one 95 upper layer driver, one lower layer driver, and the SCSI midlayer. 96 </para> 97 <para> 98 The SCSI upper layer provides the interface between userspace and the 99 kernel, in the form of block and char device nodes for I/O and 100 ioctl(). The SCSI lower layer contains drivers for specific hardware 101 devices. 102 </para> 103 <para> 104 In between is the SCSI mid-layer, analogous to a network routing 105 layer such as the IPv4 stack. The SCSI mid-layer routes a packet 106 based data protocol between the upper layer's /dev nodes and the 107 corresponding devices in the lower layer. It manages command queues, 108 provides error handling and power management functions, and responds 109 to ioctl() requests. 110 </para> 111 </sect1> 112 </chapter> 113 114 <chapter id="upper_layer"> 115 <title>SCSI upper layer</title> 116 <para> 117 The upper layer supports the user-kernel interface by providing 118 device nodes. 119 </para> 120 <sect1 id="sd"> 121 <title>sd (SCSI Disk)</title> 122 <para>sd (sd_mod.o)</para> 123<!-- !Idrivers/scsi/sd.c --> 124 </sect1> 125 <sect1 id="sr"> 126 <title>sr (SCSI CD-ROM)</title> 127 <para>sr (sr_mod.o)</para> 128 </sect1> 129 <sect1 id="st"> 130 <title>st (SCSI Tape)</title> 131 <para>st (st.o)</para> 132 </sect1> 133 <sect1 id="sg"> 134 <title>sg (SCSI Generic)</title> 135 <para>sg (sg.o)</para> 136 </sect1> 137 <sect1 id="ch"> 138 <title>ch (SCSI Media Changer)</title> 139 <para>ch (ch.c)</para> 140 </sect1> 141 </chapter> 142 143 <chapter id="mid_layer"> 144 <title>SCSI mid layer</title> 145 146 <sect1 id="midlayer_implementation"> 147 <title>SCSI midlayer implementation</title> 148 <sect2 id="scsi_device.h"> 149 <title>include/scsi/scsi_device.h</title> 150 <para> 151 </para> 152<!-- include/scsi/scsi_device.h --> 153<refentry id="API-shost-for-each-device"> 154<refentryinfo> 155 <title>LINUX</title> 156 <productname>Kernel Hackers Manual</productname> 157 <date>July 2017</date> 158</refentryinfo> 159<refmeta> 160 <refentrytitle><phrase>shost_for_each_device</phrase></refentrytitle> 161 <manvolnum>9</manvolnum> 162 <refmiscinfo class="version">4.1.27</refmiscinfo> 163</refmeta> 164<refnamediv> 165 <refname>shost_for_each_device</refname> 166 <refpurpose> 167 iterate over all devices of a host 168 </refpurpose> 169</refnamediv> 170<refsynopsisdiv> 171 <title>Synopsis</title> 172 <funcsynopsis><funcprototype> 173 <funcdef> <function>shost_for_each_device </function></funcdef> 174 <paramdef> <parameter>sdev</parameter></paramdef> 175 <paramdef> <parameter>shost</parameter></paramdef> 176 </funcprototype></funcsynopsis> 177</refsynopsisdiv> 178<refsect1> 179 <title>Arguments</title> 180 <variablelist> 181 <varlistentry> 182 <term><parameter>sdev</parameter></term> 183 <listitem> 184 <para> 185 the <structname>struct scsi_device</structname> to use as a cursor 186 </para> 187 </listitem> 188 </varlistentry> 189 <varlistentry> 190 <term><parameter>shost</parameter></term> 191 <listitem> 192 <para> 193 the <structname>struct scsi_host</structname> to iterate over 194 </para> 195 </listitem> 196 </varlistentry> 197 </variablelist> 198</refsect1> 199<refsect1> 200<title>Description</title> 201<para> 202 Iterator that returns each device attached to <parameter>shost</parameter>. This loop 203 takes a reference on each device and releases it at the end. If 204 you break out of the loop, you must call scsi_device_put(sdev). 205</para> 206</refsect1> 207</refentry> 208 209<refentry id="API---shost-for-each-device"> 210<refentryinfo> 211 <title>LINUX</title> 212 <productname>Kernel Hackers Manual</productname> 213 <date>July 2017</date> 214</refentryinfo> 215<refmeta> 216 <refentrytitle><phrase>__shost_for_each_device</phrase></refentrytitle> 217 <manvolnum>9</manvolnum> 218 <refmiscinfo class="version">4.1.27</refmiscinfo> 219</refmeta> 220<refnamediv> 221 <refname>__shost_for_each_device</refname> 222 <refpurpose> 223 iterate over all devices of a host (UNLOCKED) 224 </refpurpose> 225</refnamediv> 226<refsynopsisdiv> 227 <title>Synopsis</title> 228 <funcsynopsis><funcprototype> 229 <funcdef> <function>__shost_for_each_device </function></funcdef> 230 <paramdef> <parameter>sdev</parameter></paramdef> 231 <paramdef> <parameter>shost</parameter></paramdef> 232 </funcprototype></funcsynopsis> 233</refsynopsisdiv> 234<refsect1> 235 <title>Arguments</title> 236 <variablelist> 237 <varlistentry> 238 <term><parameter>sdev</parameter></term> 239 <listitem> 240 <para> 241 the <structname>struct scsi_device</structname> to use as a cursor 242 </para> 243 </listitem> 244 </varlistentry> 245 <varlistentry> 246 <term><parameter>shost</parameter></term> 247 <listitem> 248 <para> 249 the <structname>struct scsi_host</structname> to iterate over 250 </para> 251 </listitem> 252 </varlistentry> 253 </variablelist> 254</refsect1> 255<refsect1> 256<title>Description</title> 257<para> 258 Iterator that returns each device attached to <parameter>shost</parameter>. It does _not_ 259 take a reference on the scsi_device, so the whole loop must be 260 protected by shost->host_lock. 261</para> 262</refsect1> 263<refsect1> 264<title>Note</title> 265<para> 266 The only reason to use this is because you need to access the 267 device list in interrupt context. Otherwise you really want to use 268 shost_for_each_device instead. 269</para> 270</refsect1> 271</refentry> 272 273 </sect2> 274 275 <sect2 id="scsi.c"> 276 <title>drivers/scsi/scsi.c</title> 277 <para>Main file for the SCSI midlayer.</para> 278<!-- drivers/scsi/scsi.c --> 279<refentry id="API-scsi-device-type"> 280<refentryinfo> 281 <title>LINUX</title> 282 <productname>Kernel Hackers Manual</productname> 283 <date>July 2017</date> 284</refentryinfo> 285<refmeta> 286 <refentrytitle><phrase>scsi_device_type</phrase></refentrytitle> 287 <manvolnum>9</manvolnum> 288 <refmiscinfo class="version">4.1.27</refmiscinfo> 289</refmeta> 290<refnamediv> 291 <refname>scsi_device_type</refname> 292 <refpurpose> 293 Return 17 char string indicating device type. 294 </refpurpose> 295</refnamediv> 296<refsynopsisdiv> 297 <title>Synopsis</title> 298 <funcsynopsis><funcprototype> 299 <funcdef>const char * <function>scsi_device_type </function></funcdef> 300 <paramdef>unsigned <parameter>type</parameter></paramdef> 301 </funcprototype></funcsynopsis> 302</refsynopsisdiv> 303<refsect1> 304 <title>Arguments</title> 305 <variablelist> 306 <varlistentry> 307 <term><parameter>type</parameter></term> 308 <listitem> 309 <para> 310 type number to look up 311 </para> 312 </listitem> 313 </varlistentry> 314 </variablelist> 315</refsect1> 316</refentry> 317 318<refentry id="API-scsi-cmd-get-serial"> 319<refentryinfo> 320 <title>LINUX</title> 321 <productname>Kernel Hackers Manual</productname> 322 <date>July 2017</date> 323</refentryinfo> 324<refmeta> 325 <refentrytitle><phrase>scsi_cmd_get_serial</phrase></refentrytitle> 326 <manvolnum>9</manvolnum> 327 <refmiscinfo class="version">4.1.27</refmiscinfo> 328</refmeta> 329<refnamediv> 330 <refname>scsi_cmd_get_serial</refname> 331 <refpurpose> 332 Assign a serial number to a command 333 </refpurpose> 334</refnamediv> 335<refsynopsisdiv> 336 <title>Synopsis</title> 337 <funcsynopsis><funcprototype> 338 <funcdef>void <function>scsi_cmd_get_serial </function></funcdef> 339 <paramdef>struct Scsi_Host * <parameter>host</parameter></paramdef> 340 <paramdef>struct scsi_cmnd * <parameter>cmd</parameter></paramdef> 341 </funcprototype></funcsynopsis> 342</refsynopsisdiv> 343<refsect1> 344 <title>Arguments</title> 345 <variablelist> 346 <varlistentry> 347 <term><parameter>host</parameter></term> 348 <listitem> 349 <para> 350 the scsi host 351 </para> 352 </listitem> 353 </varlistentry> 354 <varlistentry> 355 <term><parameter>cmd</parameter></term> 356 <listitem> 357 <para> 358 command to assign serial number to 359 </para> 360 </listitem> 361 </varlistentry> 362 </variablelist> 363</refsect1> 364<refsect1> 365<title>Description</title> 366<para> 367 a serial number identifies a request for error recovery 368 and debugging purposes. Protected by the Host_Lock of host. 369</para> 370</refsect1> 371</refentry> 372 373<refentry id="API-scsi-change-queue-depth"> 374<refentryinfo> 375 <title>LINUX</title> 376 <productname>Kernel Hackers Manual</productname> 377 <date>July 2017</date> 378</refentryinfo> 379<refmeta> 380 <refentrytitle><phrase>scsi_change_queue_depth</phrase></refentrytitle> 381 <manvolnum>9</manvolnum> 382 <refmiscinfo class="version">4.1.27</refmiscinfo> 383</refmeta> 384<refnamediv> 385 <refname>scsi_change_queue_depth</refname> 386 <refpurpose> 387 change a device's queue depth 388 </refpurpose> 389</refnamediv> 390<refsynopsisdiv> 391 <title>Synopsis</title> 392 <funcsynopsis><funcprototype> 393 <funcdef>int <function>scsi_change_queue_depth </function></funcdef> 394 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 395 <paramdef>int <parameter>depth</parameter></paramdef> 396 </funcprototype></funcsynopsis> 397</refsynopsisdiv> 398<refsect1> 399 <title>Arguments</title> 400 <variablelist> 401 <varlistentry> 402 <term><parameter>sdev</parameter></term> 403 <listitem> 404 <para> 405 SCSI Device in question 406 </para> 407 </listitem> 408 </varlistentry> 409 <varlistentry> 410 <term><parameter>depth</parameter></term> 411 <listitem> 412 <para> 413 number of commands allowed to be queued to the driver 414 </para> 415 </listitem> 416 </varlistentry> 417 </variablelist> 418</refsect1> 419<refsect1> 420<title>Description</title> 421<para> 422 Sets the device queue depth and returns the new value. 423</para> 424</refsect1> 425</refentry> 426 427<refentry id="API-scsi-track-queue-full"> 428<refentryinfo> 429 <title>LINUX</title> 430 <productname>Kernel Hackers Manual</productname> 431 <date>July 2017</date> 432</refentryinfo> 433<refmeta> 434 <refentrytitle><phrase>scsi_track_queue_full</phrase></refentrytitle> 435 <manvolnum>9</manvolnum> 436 <refmiscinfo class="version">4.1.27</refmiscinfo> 437</refmeta> 438<refnamediv> 439 <refname>scsi_track_queue_full</refname> 440 <refpurpose> 441 track QUEUE_FULL events to adjust queue depth 442 </refpurpose> 443</refnamediv> 444<refsynopsisdiv> 445 <title>Synopsis</title> 446 <funcsynopsis><funcprototype> 447 <funcdef>int <function>scsi_track_queue_full </function></funcdef> 448 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 449 <paramdef>int <parameter>depth</parameter></paramdef> 450 </funcprototype></funcsynopsis> 451</refsynopsisdiv> 452<refsect1> 453 <title>Arguments</title> 454 <variablelist> 455 <varlistentry> 456 <term><parameter>sdev</parameter></term> 457 <listitem> 458 <para> 459 SCSI Device in question 460 </para> 461 </listitem> 462 </varlistentry> 463 <varlistentry> 464 <term><parameter>depth</parameter></term> 465 <listitem> 466 <para> 467 Current number of outstanding SCSI commands on this device, 468 not counting the one returned as QUEUE_FULL. 469 </para> 470 </listitem> 471 </varlistentry> 472 </variablelist> 473</refsect1> 474<refsect1> 475<title>Description</title> 476<para> 477 This function will track successive QUEUE_FULL events on a 478 specific SCSI device to determine if and when there is a 479 need to adjust the queue depth on the device. 480</para> 481</refsect1> 482<refsect1> 483<title>Returns</title> 484<para> 485 0 - No change needed, >0 - Adjust queue depth to this new depth, 486 -1 - Drop back to untagged operation using host->cmd_per_lun 487 as the untagged command depth 488</para> 489</refsect1> 490<refsect1> 491<title>Lock Status</title> 492<para> 493 None held on entry 494</para> 495</refsect1> 496<refsect1> 497<title>Notes</title> 498<para> 499 Low level drivers may call this at any time and we will do 500 <quote>The Right Thing.</quote> We are interrupt context safe. 501</para> 502</refsect1> 503</refentry> 504 505<refentry id="API-scsi-get-vpd-page"> 506<refentryinfo> 507 <title>LINUX</title> 508 <productname>Kernel Hackers Manual</productname> 509 <date>July 2017</date> 510</refentryinfo> 511<refmeta> 512 <refentrytitle><phrase>scsi_get_vpd_page</phrase></refentrytitle> 513 <manvolnum>9</manvolnum> 514 <refmiscinfo class="version">4.1.27</refmiscinfo> 515</refmeta> 516<refnamediv> 517 <refname>scsi_get_vpd_page</refname> 518 <refpurpose> 519 Get Vital Product Data from a SCSI device 520 </refpurpose> 521</refnamediv> 522<refsynopsisdiv> 523 <title>Synopsis</title> 524 <funcsynopsis><funcprototype> 525 <funcdef>int <function>scsi_get_vpd_page </function></funcdef> 526 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 527 <paramdef>u8 <parameter>page</parameter></paramdef> 528 <paramdef>unsigned char * <parameter>buf</parameter></paramdef> 529 <paramdef>int <parameter>buf_len</parameter></paramdef> 530 </funcprototype></funcsynopsis> 531</refsynopsisdiv> 532<refsect1> 533 <title>Arguments</title> 534 <variablelist> 535 <varlistentry> 536 <term><parameter>sdev</parameter></term> 537 <listitem> 538 <para> 539 The device to ask 540 </para> 541 </listitem> 542 </varlistentry> 543 <varlistentry> 544 <term><parameter>page</parameter></term> 545 <listitem> 546 <para> 547 Which Vital Product Data to return 548 </para> 549 </listitem> 550 </varlistentry> 551 <varlistentry> 552 <term><parameter>buf</parameter></term> 553 <listitem> 554 <para> 555 where to store the VPD 556 </para> 557 </listitem> 558 </varlistentry> 559 <varlistentry> 560 <term><parameter>buf_len</parameter></term> 561 <listitem> 562 <para> 563 number of bytes in the VPD buffer area 564 </para> 565 </listitem> 566 </varlistentry> 567 </variablelist> 568</refsect1> 569<refsect1> 570<title>Description</title> 571<para> 572 SCSI devices may optionally supply Vital Product Data. Each 'page' 573 of VPD is defined in the appropriate SCSI document (eg SPC, SBC). 574 If the device supports this VPD page, this routine returns a pointer 575 to a buffer containing the data from that page. The caller is 576 responsible for calling <function>kfree</function> on this pointer when it is no longer 577 needed. If we cannot retrieve the VPD page this routine returns <constant>NULL</constant>. 578</para> 579</refsect1> 580</refentry> 581 582<refentry id="API-scsi-report-opcode"> 583<refentryinfo> 584 <title>LINUX</title> 585 <productname>Kernel Hackers Manual</productname> 586 <date>July 2017</date> 587</refentryinfo> 588<refmeta> 589 <refentrytitle><phrase>scsi_report_opcode</phrase></refentrytitle> 590 <manvolnum>9</manvolnum> 591 <refmiscinfo class="version">4.1.27</refmiscinfo> 592</refmeta> 593<refnamediv> 594 <refname>scsi_report_opcode</refname> 595 <refpurpose> 596 Find out if a given command opcode is supported 597 </refpurpose> 598</refnamediv> 599<refsynopsisdiv> 600 <title>Synopsis</title> 601 <funcsynopsis><funcprototype> 602 <funcdef>int <function>scsi_report_opcode </function></funcdef> 603 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 604 <paramdef>unsigned char * <parameter>buffer</parameter></paramdef> 605 <paramdef>unsigned int <parameter>len</parameter></paramdef> 606 <paramdef>unsigned char <parameter>opcode</parameter></paramdef> 607 </funcprototype></funcsynopsis> 608</refsynopsisdiv> 609<refsect1> 610 <title>Arguments</title> 611 <variablelist> 612 <varlistentry> 613 <term><parameter>sdev</parameter></term> 614 <listitem> 615 <para> 616 scsi device to query 617 </para> 618 </listitem> 619 </varlistentry> 620 <varlistentry> 621 <term><parameter>buffer</parameter></term> 622 <listitem> 623 <para> 624 scratch buffer (must be at least 20 bytes long) 625 </para> 626 </listitem> 627 </varlistentry> 628 <varlistentry> 629 <term><parameter>len</parameter></term> 630 <listitem> 631 <para> 632 length of buffer 633 </para> 634 </listitem> 635 </varlistentry> 636 <varlistentry> 637 <term><parameter>opcode</parameter></term> 638 <listitem> 639 <para> 640 opcode for command to look up 641 </para> 642 </listitem> 643 </varlistentry> 644 </variablelist> 645</refsect1> 646<refsect1> 647<title>Description</title> 648<para> 649 Uses the REPORT SUPPORTED OPERATION CODES to look up the given 650 opcode. Returns -EINVAL if RSOC fails, 0 if the command opcode is 651 unsupported and 1 if the device claims to support the command. 652</para> 653</refsect1> 654</refentry> 655 656<refentry id="API-scsi-device-get"> 657<refentryinfo> 658 <title>LINUX</title> 659 <productname>Kernel Hackers Manual</productname> 660 <date>July 2017</date> 661</refentryinfo> 662<refmeta> 663 <refentrytitle><phrase>scsi_device_get</phrase></refentrytitle> 664 <manvolnum>9</manvolnum> 665 <refmiscinfo class="version">4.1.27</refmiscinfo> 666</refmeta> 667<refnamediv> 668 <refname>scsi_device_get</refname> 669 <refpurpose> 670 get an additional reference to a scsi_device 671 </refpurpose> 672</refnamediv> 673<refsynopsisdiv> 674 <title>Synopsis</title> 675 <funcsynopsis><funcprototype> 676 <funcdef>int <function>scsi_device_get </function></funcdef> 677 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 678 </funcprototype></funcsynopsis> 679</refsynopsisdiv> 680<refsect1> 681 <title>Arguments</title> 682 <variablelist> 683 <varlistentry> 684 <term><parameter>sdev</parameter></term> 685 <listitem> 686 <para> 687 device to get a reference to 688 </para> 689 </listitem> 690 </varlistentry> 691 </variablelist> 692</refsect1> 693<refsect1> 694<title>Description</title> 695<para> 696 Gets a reference to the scsi_device and increments the use count 697 of the underlying LLDD module. You must hold host_lock of the 698 parent Scsi_Host or already have a reference when calling this. 699 </para><para> 700 701 This will fail if a device is deleted or cancelled, or when the LLD module 702 is in the process of being unloaded. 703</para> 704</refsect1> 705</refentry> 706 707<refentry id="API-scsi-device-put"> 708<refentryinfo> 709 <title>LINUX</title> 710 <productname>Kernel Hackers Manual</productname> 711 <date>July 2017</date> 712</refentryinfo> 713<refmeta> 714 <refentrytitle><phrase>scsi_device_put</phrase></refentrytitle> 715 <manvolnum>9</manvolnum> 716 <refmiscinfo class="version">4.1.27</refmiscinfo> 717</refmeta> 718<refnamediv> 719 <refname>scsi_device_put</refname> 720 <refpurpose> 721 release a reference to a scsi_device 722 </refpurpose> 723</refnamediv> 724<refsynopsisdiv> 725 <title>Synopsis</title> 726 <funcsynopsis><funcprototype> 727 <funcdef>void <function>scsi_device_put </function></funcdef> 728 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 729 </funcprototype></funcsynopsis> 730</refsynopsisdiv> 731<refsect1> 732 <title>Arguments</title> 733 <variablelist> 734 <varlistentry> 735 <term><parameter>sdev</parameter></term> 736 <listitem> 737 <para> 738 device to release a reference on. 739 </para> 740 </listitem> 741 </varlistentry> 742 </variablelist> 743</refsect1> 744<refsect1> 745<title>Description</title> 746<para> 747 Release a reference to the scsi_device and decrements the use 748 count of the underlying LLDD module. The device is freed once the last 749 user vanishes. 750</para> 751</refsect1> 752</refentry> 753 754<refentry id="API-starget-for-each-device"> 755<refentryinfo> 756 <title>LINUX</title> 757 <productname>Kernel Hackers Manual</productname> 758 <date>July 2017</date> 759</refentryinfo> 760<refmeta> 761 <refentrytitle><phrase>starget_for_each_device</phrase></refentrytitle> 762 <manvolnum>9</manvolnum> 763 <refmiscinfo class="version">4.1.27</refmiscinfo> 764</refmeta> 765<refnamediv> 766 <refname>starget_for_each_device</refname> 767 <refpurpose> 768 helper to walk all devices of a target 769 </refpurpose> 770</refnamediv> 771<refsynopsisdiv> 772 <title>Synopsis</title> 773 <funcsynopsis><funcprototype> 774 <funcdef>void <function>starget_for_each_device </function></funcdef> 775 <paramdef>struct scsi_target * <parameter>starget</parameter></paramdef> 776 <paramdef>void * <parameter>data</parameter></paramdef> 777 <paramdef>void (*<parameter>fn</parameter>) 778 <funcparams>struct scsi_device *, void *</funcparams></paramdef> 779 </funcprototype></funcsynopsis> 780</refsynopsisdiv> 781<refsect1> 782 <title>Arguments</title> 783 <variablelist> 784 <varlistentry> 785 <term><parameter>starget</parameter></term> 786 <listitem> 787 <para> 788 target whose devices we want to iterate over. 789 </para> 790 </listitem> 791 </varlistentry> 792 <varlistentry> 793 <term><parameter>data</parameter></term> 794 <listitem> 795 <para> 796 Opaque passed to each function call. 797 </para> 798 </listitem> 799 </varlistentry> 800 <varlistentry> 801 <term><parameter>fn</parameter></term> 802 <listitem> 803 <para> 804 Function to call on each device 805 </para> 806 </listitem> 807 </varlistentry> 808 </variablelist> 809</refsect1> 810<refsect1> 811<title>Description</title> 812<para> 813 This traverses over each device of <parameter>starget</parameter>. The devices have 814 a reference that must be released by scsi_host_put when breaking 815 out of the loop. 816</para> 817</refsect1> 818</refentry> 819 820<refentry id="API---starget-for-each-device"> 821<refentryinfo> 822 <title>LINUX</title> 823 <productname>Kernel Hackers Manual</productname> 824 <date>July 2017</date> 825</refentryinfo> 826<refmeta> 827 <refentrytitle><phrase>__starget_for_each_device</phrase></refentrytitle> 828 <manvolnum>9</manvolnum> 829 <refmiscinfo class="version">4.1.27</refmiscinfo> 830</refmeta> 831<refnamediv> 832 <refname>__starget_for_each_device</refname> 833 <refpurpose> 834 helper to walk all devices of a target (UNLOCKED) 835 </refpurpose> 836</refnamediv> 837<refsynopsisdiv> 838 <title>Synopsis</title> 839 <funcsynopsis><funcprototype> 840 <funcdef>void <function>__starget_for_each_device </function></funcdef> 841 <paramdef>struct scsi_target * <parameter>starget</parameter></paramdef> 842 <paramdef>void * <parameter>data</parameter></paramdef> 843 <paramdef>void (*<parameter>fn</parameter>) 844 <funcparams>struct scsi_device *, void *</funcparams></paramdef> 845 </funcprototype></funcsynopsis> 846</refsynopsisdiv> 847<refsect1> 848 <title>Arguments</title> 849 <variablelist> 850 <varlistentry> 851 <term><parameter>starget</parameter></term> 852 <listitem> 853 <para> 854 target whose devices we want to iterate over. 855 </para> 856 </listitem> 857 </varlistentry> 858 <varlistentry> 859 <term><parameter>data</parameter></term> 860 <listitem> 861 <para> 862 parameter for callback <parameter>fn</parameter>() 863 </para> 864 </listitem> 865 </varlistentry> 866 <varlistentry> 867 <term><parameter>fn</parameter></term> 868 <listitem> 869 <para> 870 callback function that is invoked for each device 871 </para> 872 </listitem> 873 </varlistentry> 874 </variablelist> 875</refsect1> 876<refsect1> 877<title>Description</title> 878<para> 879 This traverses over each device of <parameter>starget</parameter>. It does _not_ 880 take a reference on the scsi_device, so the whole loop must be 881 protected by shost->host_lock. 882</para> 883</refsect1> 884<refsect1> 885<title>Note</title> 886<para> 887 The only reason why drivers would want to use this is because 888 they need to access the device list in irq context. Otherwise you 889 really want to use starget_for_each_device instead. 890</para> 891</refsect1> 892</refentry> 893 894<refentry id="API---scsi-device-lookup-by-target"> 895<refentryinfo> 896 <title>LINUX</title> 897 <productname>Kernel Hackers Manual</productname> 898 <date>July 2017</date> 899</refentryinfo> 900<refmeta> 901 <refentrytitle><phrase>__scsi_device_lookup_by_target</phrase></refentrytitle> 902 <manvolnum>9</manvolnum> 903 <refmiscinfo class="version">4.1.27</refmiscinfo> 904</refmeta> 905<refnamediv> 906 <refname>__scsi_device_lookup_by_target</refname> 907 <refpurpose> 908 find a device given the target (UNLOCKED) 909 </refpurpose> 910</refnamediv> 911<refsynopsisdiv> 912 <title>Synopsis</title> 913 <funcsynopsis><funcprototype> 914 <funcdef>struct scsi_device * <function>__scsi_device_lookup_by_target </function></funcdef> 915 <paramdef>struct scsi_target * <parameter>starget</parameter></paramdef> 916 <paramdef>u64 <parameter>lun</parameter></paramdef> 917 </funcprototype></funcsynopsis> 918</refsynopsisdiv> 919<refsect1> 920 <title>Arguments</title> 921 <variablelist> 922 <varlistentry> 923 <term><parameter>starget</parameter></term> 924 <listitem> 925 <para> 926 SCSI target pointer 927 </para> 928 </listitem> 929 </varlistentry> 930 <varlistentry> 931 <term><parameter>lun</parameter></term> 932 <listitem> 933 <para> 934 SCSI Logical Unit Number 935 </para> 936 </listitem> 937 </varlistentry> 938 </variablelist> 939</refsect1> 940<refsect1> 941<title>Description</title> 942<para> 943 Looks up the scsi_device with the specified <parameter>lun</parameter> for a given 944 <parameter>starget</parameter>. The returned scsi_device does not have an additional 945 reference. You must hold the host's host_lock over this call and 946 any access to the returned scsi_device. A scsi_device in state 947 SDEV_DEL is skipped. 948</para> 949</refsect1> 950<refsect1> 951<title>Note</title> 952<para> 953 The only reason why drivers should use this is because 954 they need to access the device list in irq context. Otherwise you 955 really want to use scsi_device_lookup_by_target instead. 956</para> 957</refsect1> 958</refentry> 959 960<refentry id="API-scsi-device-lookup-by-target"> 961<refentryinfo> 962 <title>LINUX</title> 963 <productname>Kernel Hackers Manual</productname> 964 <date>July 2017</date> 965</refentryinfo> 966<refmeta> 967 <refentrytitle><phrase>scsi_device_lookup_by_target</phrase></refentrytitle> 968 <manvolnum>9</manvolnum> 969 <refmiscinfo class="version">4.1.27</refmiscinfo> 970</refmeta> 971<refnamediv> 972 <refname>scsi_device_lookup_by_target</refname> 973 <refpurpose> 974 find a device given the target 975 </refpurpose> 976</refnamediv> 977<refsynopsisdiv> 978 <title>Synopsis</title> 979 <funcsynopsis><funcprototype> 980 <funcdef>struct scsi_device * <function>scsi_device_lookup_by_target </function></funcdef> 981 <paramdef>struct scsi_target * <parameter>starget</parameter></paramdef> 982 <paramdef>u64 <parameter>lun</parameter></paramdef> 983 </funcprototype></funcsynopsis> 984</refsynopsisdiv> 985<refsect1> 986 <title>Arguments</title> 987 <variablelist> 988 <varlistentry> 989 <term><parameter>starget</parameter></term> 990 <listitem> 991 <para> 992 SCSI target pointer 993 </para> 994 </listitem> 995 </varlistentry> 996 <varlistentry> 997 <term><parameter>lun</parameter></term> 998 <listitem> 999 <para> 1000 SCSI Logical Unit Number 1001 </para> 1002 </listitem> 1003 </varlistentry> 1004 </variablelist> 1005</refsect1> 1006<refsect1> 1007<title>Description</title> 1008<para> 1009 Looks up the scsi_device with the specified <parameter>lun</parameter> for a given 1010 <parameter>starget</parameter>. The returned scsi_device has an additional reference that 1011 needs to be released with scsi_device_put once you're done with it. 1012</para> 1013</refsect1> 1014</refentry> 1015 1016<refentry id="API---scsi-device-lookup"> 1017<refentryinfo> 1018 <title>LINUX</title> 1019 <productname>Kernel Hackers Manual</productname> 1020 <date>July 2017</date> 1021</refentryinfo> 1022<refmeta> 1023 <refentrytitle><phrase>__scsi_device_lookup</phrase></refentrytitle> 1024 <manvolnum>9</manvolnum> 1025 <refmiscinfo class="version">4.1.27</refmiscinfo> 1026</refmeta> 1027<refnamediv> 1028 <refname>__scsi_device_lookup</refname> 1029 <refpurpose> 1030 find a device given the host (UNLOCKED) 1031 </refpurpose> 1032</refnamediv> 1033<refsynopsisdiv> 1034 <title>Synopsis</title> 1035 <funcsynopsis><funcprototype> 1036 <funcdef>struct scsi_device * <function>__scsi_device_lookup </function></funcdef> 1037 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 1038 <paramdef>uint <parameter>channel</parameter></paramdef> 1039 <paramdef>uint <parameter>id</parameter></paramdef> 1040 <paramdef>u64 <parameter>lun</parameter></paramdef> 1041 </funcprototype></funcsynopsis> 1042</refsynopsisdiv> 1043<refsect1> 1044 <title>Arguments</title> 1045 <variablelist> 1046 <varlistentry> 1047 <term><parameter>shost</parameter></term> 1048 <listitem> 1049 <para> 1050 SCSI host pointer 1051 </para> 1052 </listitem> 1053 </varlistentry> 1054 <varlistentry> 1055 <term><parameter>channel</parameter></term> 1056 <listitem> 1057 <para> 1058 SCSI channel (zero if only one channel) 1059 </para> 1060 </listitem> 1061 </varlistentry> 1062 <varlistentry> 1063 <term><parameter>id</parameter></term> 1064 <listitem> 1065 <para> 1066 SCSI target number (physical unit number) 1067 </para> 1068 </listitem> 1069 </varlistentry> 1070 <varlistentry> 1071 <term><parameter>lun</parameter></term> 1072 <listitem> 1073 <para> 1074 SCSI Logical Unit Number 1075 </para> 1076 </listitem> 1077 </varlistentry> 1078 </variablelist> 1079</refsect1> 1080<refsect1> 1081<title>Description</title> 1082<para> 1083 Looks up the scsi_device with the specified <parameter>channel</parameter>, <parameter>id</parameter>, <parameter>lun</parameter> 1084 for a given host. The returned scsi_device does not have an additional 1085 reference. You must hold the host's host_lock over this call and any access 1086 to the returned scsi_device. 1087</para> 1088</refsect1> 1089<refsect1> 1090<title>Note</title> 1091<para> 1092 The only reason why drivers would want to use this is because 1093 they need to access the device list in irq context. Otherwise you 1094 really want to use scsi_device_lookup instead. 1095</para> 1096</refsect1> 1097</refentry> 1098 1099<refentry id="API-scsi-device-lookup"> 1100<refentryinfo> 1101 <title>LINUX</title> 1102 <productname>Kernel Hackers Manual</productname> 1103 <date>July 2017</date> 1104</refentryinfo> 1105<refmeta> 1106 <refentrytitle><phrase>scsi_device_lookup</phrase></refentrytitle> 1107 <manvolnum>9</manvolnum> 1108 <refmiscinfo class="version">4.1.27</refmiscinfo> 1109</refmeta> 1110<refnamediv> 1111 <refname>scsi_device_lookup</refname> 1112 <refpurpose> 1113 find a device given the host 1114 </refpurpose> 1115</refnamediv> 1116<refsynopsisdiv> 1117 <title>Synopsis</title> 1118 <funcsynopsis><funcprototype> 1119 <funcdef>struct scsi_device * <function>scsi_device_lookup </function></funcdef> 1120 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 1121 <paramdef>uint <parameter>channel</parameter></paramdef> 1122 <paramdef>uint <parameter>id</parameter></paramdef> 1123 <paramdef>u64 <parameter>lun</parameter></paramdef> 1124 </funcprototype></funcsynopsis> 1125</refsynopsisdiv> 1126<refsect1> 1127 <title>Arguments</title> 1128 <variablelist> 1129 <varlistentry> 1130 <term><parameter>shost</parameter></term> 1131 <listitem> 1132 <para> 1133 SCSI host pointer 1134 </para> 1135 </listitem> 1136 </varlistentry> 1137 <varlistentry> 1138 <term><parameter>channel</parameter></term> 1139 <listitem> 1140 <para> 1141 SCSI channel (zero if only one channel) 1142 </para> 1143 </listitem> 1144 </varlistentry> 1145 <varlistentry> 1146 <term><parameter>id</parameter></term> 1147 <listitem> 1148 <para> 1149 SCSI target number (physical unit number) 1150 </para> 1151 </listitem> 1152 </varlistentry> 1153 <varlistentry> 1154 <term><parameter>lun</parameter></term> 1155 <listitem> 1156 <para> 1157 SCSI Logical Unit Number 1158 </para> 1159 </listitem> 1160 </varlistentry> 1161 </variablelist> 1162</refsect1> 1163<refsect1> 1164<title>Description</title> 1165<para> 1166 Looks up the scsi_device with the specified <parameter>channel</parameter>, <parameter>id</parameter>, <parameter>lun</parameter> 1167 for a given host. The returned scsi_device has an additional reference that 1168 needs to be released with scsi_device_put once you're done with it. 1169</para> 1170</refsect1> 1171</refentry> 1172 1173 </sect2> 1174 <sect2 id="scsicam.c"> 1175 <title>drivers/scsi/scsicam.c</title> 1176 <para> 1177 <ulink url='http://www.t10.org/ftp/t10/drafts/cam/cam-r12b.pdf'>SCSI 1178 Common Access Method</ulink> support functions, for use with 1179 HDIO_GETGEO, etc. 1180 </para> 1181<!-- drivers/scsi/scsicam.c --> 1182<refentry id="API-scsi-bios-ptable"> 1183<refentryinfo> 1184 <title>LINUX</title> 1185 <productname>Kernel Hackers Manual</productname> 1186 <date>July 2017</date> 1187</refentryinfo> 1188<refmeta> 1189 <refentrytitle><phrase>scsi_bios_ptable</phrase></refentrytitle> 1190 <manvolnum>9</manvolnum> 1191 <refmiscinfo class="version">4.1.27</refmiscinfo> 1192</refmeta> 1193<refnamediv> 1194 <refname>scsi_bios_ptable</refname> 1195 <refpurpose> 1196 Read PC partition table out of first sector of device. 1197 </refpurpose> 1198</refnamediv> 1199<refsynopsisdiv> 1200 <title>Synopsis</title> 1201 <funcsynopsis><funcprototype> 1202 <funcdef>unsigned char * <function>scsi_bios_ptable </function></funcdef> 1203 <paramdef>struct block_device * <parameter>dev</parameter></paramdef> 1204 </funcprototype></funcsynopsis> 1205</refsynopsisdiv> 1206<refsect1> 1207 <title>Arguments</title> 1208 <variablelist> 1209 <varlistentry> 1210 <term><parameter>dev</parameter></term> 1211 <listitem> 1212 <para> 1213 from this device 1214 </para> 1215 </listitem> 1216 </varlistentry> 1217 </variablelist> 1218</refsect1> 1219<refsect1> 1220<title>Description</title> 1221<para> 1222 Reads the first sector from the device and returns <constant>0x42</constant> bytes 1223 starting at offset <constant>0x1be</constant>. 1224</para> 1225</refsect1> 1226<refsect1> 1227<title>Returns</title> 1228<para> 1229 partition table in kmalloc(GFP_KERNEL) memory, or NULL on error. 1230</para> 1231</refsect1> 1232</refentry> 1233 1234<refentry id="API-scsicam-bios-param"> 1235<refentryinfo> 1236 <title>LINUX</title> 1237 <productname>Kernel Hackers Manual</productname> 1238 <date>July 2017</date> 1239</refentryinfo> 1240<refmeta> 1241 <refentrytitle><phrase>scsicam_bios_param</phrase></refentrytitle> 1242 <manvolnum>9</manvolnum> 1243 <refmiscinfo class="version">4.1.27</refmiscinfo> 1244</refmeta> 1245<refnamediv> 1246 <refname>scsicam_bios_param</refname> 1247 <refpurpose> 1248 Determine geometry of a disk in cylinders/heads/sectors. 1249 </refpurpose> 1250</refnamediv> 1251<refsynopsisdiv> 1252 <title>Synopsis</title> 1253 <funcsynopsis><funcprototype> 1254 <funcdef>int <function>scsicam_bios_param </function></funcdef> 1255 <paramdef>struct block_device * <parameter>bdev</parameter></paramdef> 1256 <paramdef>sector_t <parameter>capacity</parameter></paramdef> 1257 <paramdef>int * <parameter>ip</parameter></paramdef> 1258 </funcprototype></funcsynopsis> 1259</refsynopsisdiv> 1260<refsect1> 1261 <title>Arguments</title> 1262 <variablelist> 1263 <varlistentry> 1264 <term><parameter>bdev</parameter></term> 1265 <listitem> 1266 <para> 1267 which device 1268 </para> 1269 </listitem> 1270 </varlistentry> 1271 <varlistentry> 1272 <term><parameter>capacity</parameter></term> 1273 <listitem> 1274 <para> 1275 size of the disk in sectors 1276 </para> 1277 </listitem> 1278 </varlistentry> 1279 <varlistentry> 1280 <term><parameter>ip</parameter></term> 1281 <listitem> 1282 <para> 1283 return value: ip[0]=heads, ip[1]=sectors, ip[2]=cylinders 1284 </para> 1285 </listitem> 1286 </varlistentry> 1287 </variablelist> 1288</refsect1> 1289<refsect1> 1290<title>Description </title> 1291<para> 1292 determine the BIOS mapping/geometry used for a drive in a 1293 SCSI-CAM system, storing the results in ip as required 1294 by the HDIO_GETGEO <function>ioctl</function>. 1295</para> 1296</refsect1> 1297<refsect1> 1298<title>Returns </title> 1299<para> 1300 -1 on failure, 0 on success. 1301</para> 1302</refsect1> 1303</refentry> 1304 1305<refentry id="API-scsi-partsize"> 1306<refentryinfo> 1307 <title>LINUX</title> 1308 <productname>Kernel Hackers Manual</productname> 1309 <date>July 2017</date> 1310</refentryinfo> 1311<refmeta> 1312 <refentrytitle><phrase>scsi_partsize</phrase></refentrytitle> 1313 <manvolnum>9</manvolnum> 1314 <refmiscinfo class="version">4.1.27</refmiscinfo> 1315</refmeta> 1316<refnamediv> 1317 <refname>scsi_partsize</refname> 1318 <refpurpose> 1319 Parse cylinders/heads/sectors from PC partition table 1320 </refpurpose> 1321</refnamediv> 1322<refsynopsisdiv> 1323 <title>Synopsis</title> 1324 <funcsynopsis><funcprototype> 1325 <funcdef>int <function>scsi_partsize </function></funcdef> 1326 <paramdef>unsigned char * <parameter>buf</parameter></paramdef> 1327 <paramdef>unsigned long <parameter>capacity</parameter></paramdef> 1328 <paramdef>unsigned int * <parameter>cyls</parameter></paramdef> 1329 <paramdef>unsigned int * <parameter>hds</parameter></paramdef> 1330 <paramdef>unsigned int * <parameter>secs</parameter></paramdef> 1331 </funcprototype></funcsynopsis> 1332</refsynopsisdiv> 1333<refsect1> 1334 <title>Arguments</title> 1335 <variablelist> 1336 <varlistentry> 1337 <term><parameter>buf</parameter></term> 1338 <listitem> 1339 <para> 1340 partition table, see <function>scsi_bios_ptable</function> 1341 </para> 1342 </listitem> 1343 </varlistentry> 1344 <varlistentry> 1345 <term><parameter>capacity</parameter></term> 1346 <listitem> 1347 <para> 1348 size of the disk in sectors 1349 </para> 1350 </listitem> 1351 </varlistentry> 1352 <varlistentry> 1353 <term><parameter>cyls</parameter></term> 1354 <listitem> 1355 <para> 1356 put cylinders here 1357 </para> 1358 </listitem> 1359 </varlistentry> 1360 <varlistentry> 1361 <term><parameter>hds</parameter></term> 1362 <listitem> 1363 <para> 1364 put heads here 1365 </para> 1366 </listitem> 1367 </varlistentry> 1368 <varlistentry> 1369 <term><parameter>secs</parameter></term> 1370 <listitem> 1371 <para> 1372 put sectors here 1373 </para> 1374 </listitem> 1375 </varlistentry> 1376 </variablelist> 1377</refsect1> 1378<refsect1> 1379<title>Description</title> 1380<para> 1381 determine the BIOS mapping/geometry used to create the partition 1382 table, storing the results in *cyls, *hds, and *secs 1383</para> 1384</refsect1> 1385<refsect1> 1386<title>Returns</title> 1387<para> 1388 -1 on failure, 0 on success. 1389</para> 1390</refsect1> 1391</refentry> 1392 1393 </sect2> 1394 <sect2 id="scsi_error.c"> 1395 <title>drivers/scsi/scsi_error.c</title> 1396 <para>Common SCSI error/timeout handling routines.</para> 1397<!-- drivers/scsi/scsi_error.c --> 1398<refentry id="API-scsi-schedule-eh"> 1399<refentryinfo> 1400 <title>LINUX</title> 1401 <productname>Kernel Hackers Manual</productname> 1402 <date>July 2017</date> 1403</refentryinfo> 1404<refmeta> 1405 <refentrytitle><phrase>scsi_schedule_eh</phrase></refentrytitle> 1406 <manvolnum>9</manvolnum> 1407 <refmiscinfo class="version">4.1.27</refmiscinfo> 1408</refmeta> 1409<refnamediv> 1410 <refname>scsi_schedule_eh</refname> 1411 <refpurpose> 1412 schedule EH for SCSI host 1413 </refpurpose> 1414</refnamediv> 1415<refsynopsisdiv> 1416 <title>Synopsis</title> 1417 <funcsynopsis><funcprototype> 1418 <funcdef>void <function>scsi_schedule_eh </function></funcdef> 1419 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 1420 </funcprototype></funcsynopsis> 1421</refsynopsisdiv> 1422<refsect1> 1423 <title>Arguments</title> 1424 <variablelist> 1425 <varlistentry> 1426 <term><parameter>shost</parameter></term> 1427 <listitem> 1428 <para> 1429 SCSI host to invoke error handling on. 1430 </para> 1431 </listitem> 1432 </varlistentry> 1433 </variablelist> 1434</refsect1> 1435<refsect1> 1436<title>Description</title> 1437<para> 1438 Schedule SCSI EH without scmd. 1439</para> 1440</refsect1> 1441</refentry> 1442 1443<refentry id="API-scsi-block-when-processing-errors"> 1444<refentryinfo> 1445 <title>LINUX</title> 1446 <productname>Kernel Hackers Manual</productname> 1447 <date>July 2017</date> 1448</refentryinfo> 1449<refmeta> 1450 <refentrytitle><phrase>scsi_block_when_processing_errors</phrase></refentrytitle> 1451 <manvolnum>9</manvolnum> 1452 <refmiscinfo class="version">4.1.27</refmiscinfo> 1453</refmeta> 1454<refnamediv> 1455 <refname>scsi_block_when_processing_errors</refname> 1456 <refpurpose> 1457 Prevent cmds from being queued. 1458 </refpurpose> 1459</refnamediv> 1460<refsynopsisdiv> 1461 <title>Synopsis</title> 1462 <funcsynopsis><funcprototype> 1463 <funcdef>int <function>scsi_block_when_processing_errors </function></funcdef> 1464 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 1465 </funcprototype></funcsynopsis> 1466</refsynopsisdiv> 1467<refsect1> 1468 <title>Arguments</title> 1469 <variablelist> 1470 <varlistentry> 1471 <term><parameter>sdev</parameter></term> 1472 <listitem> 1473 <para> 1474 Device on which we are performing recovery. 1475 </para> 1476 </listitem> 1477 </varlistentry> 1478 </variablelist> 1479</refsect1> 1480<refsect1> 1481<title>Description</title> 1482<para> 1483 We block until the host is out of error recovery, and then check to 1484 see whether the host or the device is offline. 1485</para> 1486</refsect1> 1487<refsect1> 1488<title>Return value</title> 1489<para> 1490 0 when dev was taken offline by error recovery. 1 OK to proceed. 1491</para> 1492</refsect1> 1493</refentry> 1494 1495<refentry id="API-scsi-eh-prep-cmnd"> 1496<refentryinfo> 1497 <title>LINUX</title> 1498 <productname>Kernel Hackers Manual</productname> 1499 <date>July 2017</date> 1500</refentryinfo> 1501<refmeta> 1502 <refentrytitle><phrase>scsi_eh_prep_cmnd</phrase></refentrytitle> 1503 <manvolnum>9</manvolnum> 1504 <refmiscinfo class="version">4.1.27</refmiscinfo> 1505</refmeta> 1506<refnamediv> 1507 <refname>scsi_eh_prep_cmnd</refname> 1508 <refpurpose> 1509 Save a scsi command info as part of error recovery 1510 </refpurpose> 1511</refnamediv> 1512<refsynopsisdiv> 1513 <title>Synopsis</title> 1514 <funcsynopsis><funcprototype> 1515 <funcdef>void <function>scsi_eh_prep_cmnd </function></funcdef> 1516 <paramdef>struct scsi_cmnd * <parameter>scmd</parameter></paramdef> 1517 <paramdef>struct scsi_eh_save * <parameter>ses</parameter></paramdef> 1518 <paramdef>unsigned char * <parameter>cmnd</parameter></paramdef> 1519 <paramdef>int <parameter>cmnd_size</parameter></paramdef> 1520 <paramdef>unsigned <parameter>sense_bytes</parameter></paramdef> 1521 </funcprototype></funcsynopsis> 1522</refsynopsisdiv> 1523<refsect1> 1524 <title>Arguments</title> 1525 <variablelist> 1526 <varlistentry> 1527 <term><parameter>scmd</parameter></term> 1528 <listitem> 1529 <para> 1530 SCSI command structure to hijack 1531 </para> 1532 </listitem> 1533 </varlistentry> 1534 <varlistentry> 1535 <term><parameter>ses</parameter></term> 1536 <listitem> 1537 <para> 1538 structure to save restore information 1539 </para> 1540 </listitem> 1541 </varlistentry> 1542 <varlistentry> 1543 <term><parameter>cmnd</parameter></term> 1544 <listitem> 1545 <para> 1546 CDB to send. Can be NULL if no new cmnd is needed 1547 </para> 1548 </listitem> 1549 </varlistentry> 1550 <varlistentry> 1551 <term><parameter>cmnd_size</parameter></term> 1552 <listitem> 1553 <para> 1554 size in bytes of <parameter>cmnd</parameter> (must be <= BLK_MAX_CDB) 1555 </para> 1556 </listitem> 1557 </varlistentry> 1558 <varlistentry> 1559 <term><parameter>sense_bytes</parameter></term> 1560 <listitem> 1561 <para> 1562 size of sense data to copy. or 0 (if != 0 <parameter>cmnd</parameter> is ignored) 1563 </para> 1564 </listitem> 1565 </varlistentry> 1566 </variablelist> 1567</refsect1> 1568<refsect1> 1569<title>Description</title> 1570<para> 1571 This function is used to save a scsi command information before re-execution 1572 as part of the error recovery process. If <parameter>sense_bytes</parameter> is 0 the command 1573 sent must be one that does not transfer any data. If <parameter>sense_bytes</parameter> != 0 1574 <parameter>cmnd</parameter> is ignored and this functions sets up a REQUEST_SENSE command 1575 and cmnd buffers to read <parameter>sense_bytes</parameter> into <parameter>scmd</parameter>->sense_buffer. 1576</para> 1577</refsect1> 1578</refentry> 1579 1580<refentry id="API-scsi-eh-restore-cmnd"> 1581<refentryinfo> 1582 <title>LINUX</title> 1583 <productname>Kernel Hackers Manual</productname> 1584 <date>July 2017</date> 1585</refentryinfo> 1586<refmeta> 1587 <refentrytitle><phrase>scsi_eh_restore_cmnd</phrase></refentrytitle> 1588 <manvolnum>9</manvolnum> 1589 <refmiscinfo class="version">4.1.27</refmiscinfo> 1590</refmeta> 1591<refnamediv> 1592 <refname>scsi_eh_restore_cmnd</refname> 1593 <refpurpose> 1594 Restore a scsi command info as part of error recovery 1595 </refpurpose> 1596</refnamediv> 1597<refsynopsisdiv> 1598 <title>Synopsis</title> 1599 <funcsynopsis><funcprototype> 1600 <funcdef>void <function>scsi_eh_restore_cmnd </function></funcdef> 1601 <paramdef>struct scsi_cmnd * <parameter>scmd</parameter></paramdef> 1602 <paramdef>struct scsi_eh_save * <parameter>ses</parameter></paramdef> 1603 </funcprototype></funcsynopsis> 1604</refsynopsisdiv> 1605<refsect1> 1606 <title>Arguments</title> 1607 <variablelist> 1608 <varlistentry> 1609 <term><parameter>scmd</parameter></term> 1610 <listitem> 1611 <para> 1612 SCSI command structure to restore 1613 </para> 1614 </listitem> 1615 </varlistentry> 1616 <varlistentry> 1617 <term><parameter>ses</parameter></term> 1618 <listitem> 1619 <para> 1620 saved information from a coresponding call to scsi_eh_prep_cmnd 1621 </para> 1622 </listitem> 1623 </varlistentry> 1624 </variablelist> 1625</refsect1> 1626<refsect1> 1627<title>Description</title> 1628<para> 1629 Undo any damage done by above <function>scsi_eh_prep_cmnd</function>. 1630</para> 1631</refsect1> 1632</refentry> 1633 1634<refentry id="API-scsi-eh-finish-cmd"> 1635<refentryinfo> 1636 <title>LINUX</title> 1637 <productname>Kernel Hackers Manual</productname> 1638 <date>July 2017</date> 1639</refentryinfo> 1640<refmeta> 1641 <refentrytitle><phrase>scsi_eh_finish_cmd</phrase></refentrytitle> 1642 <manvolnum>9</manvolnum> 1643 <refmiscinfo class="version">4.1.27</refmiscinfo> 1644</refmeta> 1645<refnamediv> 1646 <refname>scsi_eh_finish_cmd</refname> 1647 <refpurpose> 1648 Handle a cmd that eh is finished with. 1649 </refpurpose> 1650</refnamediv> 1651<refsynopsisdiv> 1652 <title>Synopsis</title> 1653 <funcsynopsis><funcprototype> 1654 <funcdef>void <function>scsi_eh_finish_cmd </function></funcdef> 1655 <paramdef>struct scsi_cmnd * <parameter>scmd</parameter></paramdef> 1656 <paramdef>struct list_head * <parameter>done_q</parameter></paramdef> 1657 </funcprototype></funcsynopsis> 1658</refsynopsisdiv> 1659<refsect1> 1660 <title>Arguments</title> 1661 <variablelist> 1662 <varlistentry> 1663 <term><parameter>scmd</parameter></term> 1664 <listitem> 1665 <para> 1666 Original SCSI cmd that eh has finished. 1667 </para> 1668 </listitem> 1669 </varlistentry> 1670 <varlistentry> 1671 <term><parameter>done_q</parameter></term> 1672 <listitem> 1673 <para> 1674 Queue for processed commands. 1675 </para> 1676 </listitem> 1677 </varlistentry> 1678 </variablelist> 1679</refsect1> 1680<refsect1> 1681<title>Notes</title> 1682<para> 1683 We don't want to use the normal command completion while we are are 1684 still handling errors - it may cause other commands to be queued, 1685 and that would disturb what we are doing. Thus we really want to 1686 keep a list of pending commands for final completion, and once we 1687 are ready to leave error handling we handle completion for real. 1688</para> 1689</refsect1> 1690</refentry> 1691 1692<refentry id="API-scsi-eh-get-sense"> 1693<refentryinfo> 1694 <title>LINUX</title> 1695 <productname>Kernel Hackers Manual</productname> 1696 <date>July 2017</date> 1697</refentryinfo> 1698<refmeta> 1699 <refentrytitle><phrase>scsi_eh_get_sense</phrase></refentrytitle> 1700 <manvolnum>9</manvolnum> 1701 <refmiscinfo class="version">4.1.27</refmiscinfo> 1702</refmeta> 1703<refnamediv> 1704 <refname>scsi_eh_get_sense</refname> 1705 <refpurpose> 1706 Get device sense data. 1707 </refpurpose> 1708</refnamediv> 1709<refsynopsisdiv> 1710 <title>Synopsis</title> 1711 <funcsynopsis><funcprototype> 1712 <funcdef>int <function>scsi_eh_get_sense </function></funcdef> 1713 <paramdef>struct list_head * <parameter>work_q</parameter></paramdef> 1714 <paramdef>struct list_head * <parameter>done_q</parameter></paramdef> 1715 </funcprototype></funcsynopsis> 1716</refsynopsisdiv> 1717<refsect1> 1718 <title>Arguments</title> 1719 <variablelist> 1720 <varlistentry> 1721 <term><parameter>work_q</parameter></term> 1722 <listitem> 1723 <para> 1724 Queue of commands to process. 1725 </para> 1726 </listitem> 1727 </varlistentry> 1728 <varlistentry> 1729 <term><parameter>done_q</parameter></term> 1730 <listitem> 1731 <para> 1732 Queue of processed commands. 1733 </para> 1734 </listitem> 1735 </varlistentry> 1736 </variablelist> 1737</refsect1> 1738<refsect1> 1739<title>Description</title> 1740<para> 1741 See if we need to request sense information. if so, then get it 1742 now, so we have a better idea of what to do. 1743</para> 1744</refsect1> 1745<refsect1> 1746<title>Notes</title> 1747<para> 1748 This has the unfortunate side effect that if a shost adapter does 1749 not automatically request sense information, we end up shutting 1750 it down before we request it. 1751 </para><para> 1752 1753 All drivers should request sense information internally these days, 1754 so for now all I have to say is tough noogies if you end up in here. 1755</para> 1756</refsect1> 1757<refsect1> 1758<title>XXX</title> 1759<para> 1760 Long term this code should go away, but that needs an audit of 1761 all LLDDs first. 1762</para> 1763</refsect1> 1764</refentry> 1765 1766<refentry id="API-scsi-eh-ready-devs"> 1767<refentryinfo> 1768 <title>LINUX</title> 1769 <productname>Kernel Hackers Manual</productname> 1770 <date>July 2017</date> 1771</refentryinfo> 1772<refmeta> 1773 <refentrytitle><phrase>scsi_eh_ready_devs</phrase></refentrytitle> 1774 <manvolnum>9</manvolnum> 1775 <refmiscinfo class="version">4.1.27</refmiscinfo> 1776</refmeta> 1777<refnamediv> 1778 <refname>scsi_eh_ready_devs</refname> 1779 <refpurpose> 1780 check device ready state and recover if not. 1781 </refpurpose> 1782</refnamediv> 1783<refsynopsisdiv> 1784 <title>Synopsis</title> 1785 <funcsynopsis><funcprototype> 1786 <funcdef>void <function>scsi_eh_ready_devs </function></funcdef> 1787 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 1788 <paramdef>struct list_head * <parameter>work_q</parameter></paramdef> 1789 <paramdef>struct list_head * <parameter>done_q</parameter></paramdef> 1790 </funcprototype></funcsynopsis> 1791</refsynopsisdiv> 1792<refsect1> 1793 <title>Arguments</title> 1794 <variablelist> 1795 <varlistentry> 1796 <term><parameter>shost</parameter></term> 1797 <listitem> 1798 <para> 1799 host to be recovered. 1800 </para> 1801 </listitem> 1802 </varlistentry> 1803 <varlistentry> 1804 <term><parameter>work_q</parameter></term> 1805 <listitem> 1806 <para> 1807 <structname>list_head</structname> for pending commands. 1808 </para> 1809 </listitem> 1810 </varlistentry> 1811 <varlistentry> 1812 <term><parameter>done_q</parameter></term> 1813 <listitem> 1814 <para> 1815 <structname>list_head</structname> for processed commands. 1816 </para> 1817 </listitem> 1818 </varlistentry> 1819 </variablelist> 1820</refsect1> 1821</refentry> 1822 1823<refentry id="API-scsi-eh-flush-done-q"> 1824<refentryinfo> 1825 <title>LINUX</title> 1826 <productname>Kernel Hackers Manual</productname> 1827 <date>July 2017</date> 1828</refentryinfo> 1829<refmeta> 1830 <refentrytitle><phrase>scsi_eh_flush_done_q</phrase></refentrytitle> 1831 <manvolnum>9</manvolnum> 1832 <refmiscinfo class="version">4.1.27</refmiscinfo> 1833</refmeta> 1834<refnamediv> 1835 <refname>scsi_eh_flush_done_q</refname> 1836 <refpurpose> 1837 finish processed commands or retry them. 1838 </refpurpose> 1839</refnamediv> 1840<refsynopsisdiv> 1841 <title>Synopsis</title> 1842 <funcsynopsis><funcprototype> 1843 <funcdef>void <function>scsi_eh_flush_done_q </function></funcdef> 1844 <paramdef>struct list_head * <parameter>done_q</parameter></paramdef> 1845 </funcprototype></funcsynopsis> 1846</refsynopsisdiv> 1847<refsect1> 1848 <title>Arguments</title> 1849 <variablelist> 1850 <varlistentry> 1851 <term><parameter>done_q</parameter></term> 1852 <listitem> 1853 <para> 1854 list_head of processed commands. 1855 </para> 1856 </listitem> 1857 </varlistentry> 1858 </variablelist> 1859</refsect1> 1860</refentry> 1861 1862<refentry id="API-scsi-ioctl-reset"> 1863<refentryinfo> 1864 <title>LINUX</title> 1865 <productname>Kernel Hackers Manual</productname> 1866 <date>July 2017</date> 1867</refentryinfo> 1868<refmeta> 1869 <refentrytitle><phrase>scsi_ioctl_reset</phrase></refentrytitle> 1870 <manvolnum>9</manvolnum> 1871 <refmiscinfo class="version">4.1.27</refmiscinfo> 1872</refmeta> 1873<refnamediv> 1874 <refname>scsi_ioctl_reset</refname> 1875 <refpurpose> 1876 </refpurpose> 1877</refnamediv> 1878<refsynopsisdiv> 1879 <title>Synopsis</title> 1880 <funcsynopsis><funcprototype> 1881 <funcdef>int <function>scsi_ioctl_reset </function></funcdef> 1882 <paramdef>struct scsi_device * <parameter>dev</parameter></paramdef> 1883 <paramdef>int __user * <parameter>arg</parameter></paramdef> 1884 </funcprototype></funcsynopsis> 1885</refsynopsisdiv> 1886<refsect1> 1887 <title>Arguments</title> 1888 <variablelist> 1889 <varlistentry> 1890 <term><parameter>dev</parameter></term> 1891 <listitem> 1892 <para> 1893 scsi_device to operate on 1894 </para> 1895 </listitem> 1896 </varlistentry> 1897 <varlistentry> 1898 <term><parameter>arg</parameter></term> 1899 <listitem> 1900 <para> 1901 reset type (see sg.h) 1902 </para> 1903 </listitem> 1904 </varlistentry> 1905 </variablelist> 1906</refsect1> 1907</refentry> 1908 1909<refentry id="API-scsi-normalize-sense"> 1910<refentryinfo> 1911 <title>LINUX</title> 1912 <productname>Kernel Hackers Manual</productname> 1913 <date>July 2017</date> 1914</refentryinfo> 1915<refmeta> 1916 <refentrytitle><phrase>scsi_normalize_sense</phrase></refentrytitle> 1917 <manvolnum>9</manvolnum> 1918 <refmiscinfo class="version">4.1.27</refmiscinfo> 1919</refmeta> 1920<refnamediv> 1921 <refname>scsi_normalize_sense</refname> 1922 <refpurpose> 1923 normalize main elements from either fixed or descriptor sense data format into a common format. 1924 </refpurpose> 1925</refnamediv> 1926<refsynopsisdiv> 1927 <title>Synopsis</title> 1928 <funcsynopsis><funcprototype> 1929 <funcdef>bool <function>scsi_normalize_sense </function></funcdef> 1930 <paramdef>const u8 * <parameter>sense_buffer</parameter></paramdef> 1931 <paramdef>int <parameter>sb_len</parameter></paramdef> 1932 <paramdef>struct scsi_sense_hdr * <parameter>sshdr</parameter></paramdef> 1933 </funcprototype></funcsynopsis> 1934</refsynopsisdiv> 1935<refsect1> 1936 <title>Arguments</title> 1937 <variablelist> 1938 <varlistentry> 1939 <term><parameter>sense_buffer</parameter></term> 1940 <listitem> 1941 <para> 1942 byte array containing sense data returned by device 1943 </para> 1944 </listitem> 1945 </varlistentry> 1946 <varlistentry> 1947 <term><parameter>sb_len</parameter></term> 1948 <listitem> 1949 <para> 1950 number of valid bytes in sense_buffer 1951 </para> 1952 </listitem> 1953 </varlistentry> 1954 <varlistentry> 1955 <term><parameter>sshdr</parameter></term> 1956 <listitem> 1957 <para> 1958 pointer to instance of structure that common 1959 elements are written to. 1960 </para> 1961 </listitem> 1962 </varlistentry> 1963 </variablelist> 1964</refsect1> 1965<refsect1> 1966<title>Notes</title> 1967<para> 1968 The <quote>main elements</quote> from sense data are: response_code, sense_key, 1969 asc, ascq and additional_length (only for descriptor format). 1970 </para><para> 1971 1972 Typically this function can be called after a device has 1973 responded to a SCSI command with the CHECK_CONDITION status. 1974</para> 1975</refsect1> 1976<refsect1> 1977<title>Return value</title> 1978<para> 1979 true if valid sense data information found, else false; 1980</para> 1981</refsect1> 1982</refentry> 1983 1984<refentry id="API-scsi-sense-desc-find"> 1985<refentryinfo> 1986 <title>LINUX</title> 1987 <productname>Kernel Hackers Manual</productname> 1988 <date>July 2017</date> 1989</refentryinfo> 1990<refmeta> 1991 <refentrytitle><phrase>scsi_sense_desc_find</phrase></refentrytitle> 1992 <manvolnum>9</manvolnum> 1993 <refmiscinfo class="version">4.1.27</refmiscinfo> 1994</refmeta> 1995<refnamediv> 1996 <refname>scsi_sense_desc_find</refname> 1997 <refpurpose> 1998 search for a given descriptor type in descriptor sense data format. 1999 </refpurpose> 2000</refnamediv> 2001<refsynopsisdiv> 2002 <title>Synopsis</title> 2003 <funcsynopsis><funcprototype> 2004 <funcdef>const u8 * <function>scsi_sense_desc_find </function></funcdef> 2005 <paramdef>const u8 * <parameter>sense_buffer</parameter></paramdef> 2006 <paramdef>int <parameter>sb_len</parameter></paramdef> 2007 <paramdef>int <parameter>desc_type</parameter></paramdef> 2008 </funcprototype></funcsynopsis> 2009</refsynopsisdiv> 2010<refsect1> 2011 <title>Arguments</title> 2012 <variablelist> 2013 <varlistentry> 2014 <term><parameter>sense_buffer</parameter></term> 2015 <listitem> 2016 <para> 2017 byte array of descriptor format sense data 2018 </para> 2019 </listitem> 2020 </varlistentry> 2021 <varlistentry> 2022 <term><parameter>sb_len</parameter></term> 2023 <listitem> 2024 <para> 2025 number of valid bytes in sense_buffer 2026 </para> 2027 </listitem> 2028 </varlistentry> 2029 <varlistentry> 2030 <term><parameter>desc_type</parameter></term> 2031 <listitem> 2032 <para> 2033 value of descriptor type to find 2034 (e.g. 0 -> information) 2035 </para> 2036 </listitem> 2037 </varlistentry> 2038 </variablelist> 2039</refsect1> 2040<refsect1> 2041<title>Notes</title> 2042<para> 2043 only valid when sense data is in descriptor format 2044</para> 2045</refsect1> 2046<refsect1> 2047<title>Return value</title> 2048<para> 2049 pointer to start of (first) descriptor if found else NULL 2050</para> 2051</refsect1> 2052</refentry> 2053 2054<refentry id="API-scsi-get-sense-info-fld"> 2055<refentryinfo> 2056 <title>LINUX</title> 2057 <productname>Kernel Hackers Manual</productname> 2058 <date>July 2017</date> 2059</refentryinfo> 2060<refmeta> 2061 <refentrytitle><phrase>scsi_get_sense_info_fld</phrase></refentrytitle> 2062 <manvolnum>9</manvolnum> 2063 <refmiscinfo class="version">4.1.27</refmiscinfo> 2064</refmeta> 2065<refnamediv> 2066 <refname>scsi_get_sense_info_fld</refname> 2067 <refpurpose> 2068 get information field from sense data (either fixed or descriptor format) 2069 </refpurpose> 2070</refnamediv> 2071<refsynopsisdiv> 2072 <title>Synopsis</title> 2073 <funcsynopsis><funcprototype> 2074 <funcdef>int <function>scsi_get_sense_info_fld </function></funcdef> 2075 <paramdef>const u8 * <parameter>sense_buffer</parameter></paramdef> 2076 <paramdef>int <parameter>sb_len</parameter></paramdef> 2077 <paramdef>u64 * <parameter>info_out</parameter></paramdef> 2078 </funcprototype></funcsynopsis> 2079</refsynopsisdiv> 2080<refsect1> 2081 <title>Arguments</title> 2082 <variablelist> 2083 <varlistentry> 2084 <term><parameter>sense_buffer</parameter></term> 2085 <listitem> 2086 <para> 2087 byte array of sense data 2088 </para> 2089 </listitem> 2090 </varlistentry> 2091 <varlistentry> 2092 <term><parameter>sb_len</parameter></term> 2093 <listitem> 2094 <para> 2095 number of valid bytes in sense_buffer 2096 </para> 2097 </listitem> 2098 </varlistentry> 2099 <varlistentry> 2100 <term><parameter>info_out</parameter></term> 2101 <listitem> 2102 <para> 2103 pointer to 64 integer where 8 or 4 byte information 2104 field will be placed if found. 2105 </para> 2106 </listitem> 2107 </varlistentry> 2108 </variablelist> 2109</refsect1> 2110<refsect1> 2111<title>Return value</title> 2112<para> 2113 1 if information field found, 0 if not found. 2114</para> 2115</refsect1> 2116</refentry> 2117 2118<refentry id="API-scsi-build-sense-buffer"> 2119<refentryinfo> 2120 <title>LINUX</title> 2121 <productname>Kernel Hackers Manual</productname> 2122 <date>July 2017</date> 2123</refentryinfo> 2124<refmeta> 2125 <refentrytitle><phrase>scsi_build_sense_buffer</phrase></refentrytitle> 2126 <manvolnum>9</manvolnum> 2127 <refmiscinfo class="version">4.1.27</refmiscinfo> 2128</refmeta> 2129<refnamediv> 2130 <refname>scsi_build_sense_buffer</refname> 2131 <refpurpose> 2132 build sense data in a buffer 2133 </refpurpose> 2134</refnamediv> 2135<refsynopsisdiv> 2136 <title>Synopsis</title> 2137 <funcsynopsis><funcprototype> 2138 <funcdef>void <function>scsi_build_sense_buffer </function></funcdef> 2139 <paramdef>int <parameter>desc</parameter></paramdef> 2140 <paramdef>u8 * <parameter>buf</parameter></paramdef> 2141 <paramdef>u8 <parameter>key</parameter></paramdef> 2142 <paramdef>u8 <parameter>asc</parameter></paramdef> 2143 <paramdef>u8 <parameter>ascq</parameter></paramdef> 2144 </funcprototype></funcsynopsis> 2145</refsynopsisdiv> 2146<refsect1> 2147 <title>Arguments</title> 2148 <variablelist> 2149 <varlistentry> 2150 <term><parameter>desc</parameter></term> 2151 <listitem> 2152 <para> 2153 Sense format (non zero == descriptor format, 2154 0 == fixed format) 2155 </para> 2156 </listitem> 2157 </varlistentry> 2158 <varlistentry> 2159 <term><parameter>buf</parameter></term> 2160 <listitem> 2161 <para> 2162 Where to build sense data 2163 </para> 2164 </listitem> 2165 </varlistentry> 2166 <varlistentry> 2167 <term><parameter>key</parameter></term> 2168 <listitem> 2169 <para> 2170 Sense key 2171 </para> 2172 </listitem> 2173 </varlistentry> 2174 <varlistentry> 2175 <term><parameter>asc</parameter></term> 2176 <listitem> 2177 <para> 2178 Additional sense code 2179 </para> 2180 </listitem> 2181 </varlistentry> 2182 <varlistentry> 2183 <term><parameter>ascq</parameter></term> 2184 <listitem> 2185 <para> 2186 Additional sense code qualifier 2187 </para> 2188 </listitem> 2189 </varlistentry> 2190 </variablelist> 2191</refsect1> 2192</refentry> 2193 2194 </sect2> 2195 <sect2 id="scsi_devinfo.c"> 2196 <title>drivers/scsi/scsi_devinfo.c</title> 2197 <para> 2198 Manage scsi_dev_info_list, which tracks blacklisted and whitelisted 2199 devices. 2200 </para> 2201<!-- drivers/scsi/scsi_devinfo.c --> 2202<refentry id="API-scsi-dev-info-list-add"> 2203<refentryinfo> 2204 <title>LINUX</title> 2205 <productname>Kernel Hackers Manual</productname> 2206 <date>July 2017</date> 2207</refentryinfo> 2208<refmeta> 2209 <refentrytitle><phrase>scsi_dev_info_list_add</phrase></refentrytitle> 2210 <manvolnum>9</manvolnum> 2211 <refmiscinfo class="version">4.1.27</refmiscinfo> 2212</refmeta> 2213<refnamediv> 2214 <refname>scsi_dev_info_list_add</refname> 2215 <refpurpose> 2216 add one dev_info list entry. 2217 </refpurpose> 2218</refnamediv> 2219<refsynopsisdiv> 2220 <title>Synopsis</title> 2221 <funcsynopsis><funcprototype> 2222 <funcdef>int <function>scsi_dev_info_list_add </function></funcdef> 2223 <paramdef>int <parameter>compatible</parameter></paramdef> 2224 <paramdef>char * <parameter>vendor</parameter></paramdef> 2225 <paramdef>char * <parameter>model</parameter></paramdef> 2226 <paramdef>char * <parameter>strflags</parameter></paramdef> 2227 <paramdef>int <parameter>flags</parameter></paramdef> 2228 </funcprototype></funcsynopsis> 2229</refsynopsisdiv> 2230<refsect1> 2231 <title>Arguments</title> 2232 <variablelist> 2233 <varlistentry> 2234 <term><parameter>compatible</parameter></term> 2235 <listitem> 2236 <para> 2237 if true, null terminate short strings. Otherwise space pad. 2238 </para> 2239 </listitem> 2240 </varlistentry> 2241 <varlistentry> 2242 <term><parameter>vendor</parameter></term> 2243 <listitem> 2244 <para> 2245 vendor string 2246 </para> 2247 </listitem> 2248 </varlistentry> 2249 <varlistentry> 2250 <term><parameter>model</parameter></term> 2251 <listitem> 2252 <para> 2253 model (product) string 2254 </para> 2255 </listitem> 2256 </varlistentry> 2257 <varlistentry> 2258 <term><parameter>strflags</parameter></term> 2259 <listitem> 2260 <para> 2261 integer string 2262 </para> 2263 </listitem> 2264 </varlistentry> 2265 <varlistentry> 2266 <term><parameter>flags</parameter></term> 2267 <listitem> 2268 <para> 2269 if strflags NULL, use this flag value 2270 </para> 2271 </listitem> 2272 </varlistentry> 2273 </variablelist> 2274</refsect1> 2275<refsect1> 2276<title>Description</title> 2277<para> 2278 Create and add one dev_info entry for <parameter>vendor</parameter>, <parameter>model</parameter>, <parameter>strflags</parameter> or 2279 <parameter>flag</parameter>. If <parameter>compatible</parameter>, add to the tail of the list, do not space 2280 pad, and set devinfo->compatible. The scsi_static_device_list entries 2281 are added with <parameter>compatible</parameter> 1 and <parameter>clfags</parameter> NULL. 2282</para> 2283</refsect1> 2284<refsect1> 2285<title>Returns</title> 2286<para> 2287 0 OK, -error on failure. 2288</para> 2289</refsect1> 2290</refentry> 2291 2292<refentry id="API-scsi-dev-info-list-add-str"> 2293<refentryinfo> 2294 <title>LINUX</title> 2295 <productname>Kernel Hackers Manual</productname> 2296 <date>July 2017</date> 2297</refentryinfo> 2298<refmeta> 2299 <refentrytitle><phrase>scsi_dev_info_list_add_str</phrase></refentrytitle> 2300 <manvolnum>9</manvolnum> 2301 <refmiscinfo class="version">4.1.27</refmiscinfo> 2302</refmeta> 2303<refnamediv> 2304 <refname>scsi_dev_info_list_add_str</refname> 2305 <refpurpose> 2306 parse dev_list and add to the scsi_dev_info_list. 2307 </refpurpose> 2308</refnamediv> 2309<refsynopsisdiv> 2310 <title>Synopsis</title> 2311 <funcsynopsis><funcprototype> 2312 <funcdef>int <function>scsi_dev_info_list_add_str </function></funcdef> 2313 <paramdef>char * <parameter>dev_list</parameter></paramdef> 2314 </funcprototype></funcsynopsis> 2315</refsynopsisdiv> 2316<refsect1> 2317 <title>Arguments</title> 2318 <variablelist> 2319 <varlistentry> 2320 <term><parameter>dev_list</parameter></term> 2321 <listitem> 2322 <para> 2323 string of device flags to add 2324 </para> 2325 </listitem> 2326 </varlistentry> 2327 </variablelist> 2328</refsect1> 2329<refsect1> 2330<title>Description</title> 2331<para> 2332 Parse dev_list, and add entries to the scsi_dev_info_list. 2333 dev_list is of the form <quote>vendor:product:flag,vendor:product:flag</quote>. 2334 dev_list is modified via strsep. Can be called for command line 2335 addition, for proc or mabye a sysfs interface. 2336</para> 2337</refsect1> 2338<refsect1> 2339<title>Returns</title> 2340<para> 2341 0 if OK, -error on failure. 2342</para> 2343</refsect1> 2344</refentry> 2345 2346<refentry id="API-scsi-get-device-flags"> 2347<refentryinfo> 2348 <title>LINUX</title> 2349 <productname>Kernel Hackers Manual</productname> 2350 <date>July 2017</date> 2351</refentryinfo> 2352<refmeta> 2353 <refentrytitle><phrase>scsi_get_device_flags</phrase></refentrytitle> 2354 <manvolnum>9</manvolnum> 2355 <refmiscinfo class="version">4.1.27</refmiscinfo> 2356</refmeta> 2357<refnamediv> 2358 <refname>scsi_get_device_flags</refname> 2359 <refpurpose> 2360 get device specific flags from the dynamic device list. 2361 </refpurpose> 2362</refnamediv> 2363<refsynopsisdiv> 2364 <title>Synopsis</title> 2365 <funcsynopsis><funcprototype> 2366 <funcdef>int <function>scsi_get_device_flags </function></funcdef> 2367 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 2368 <paramdef>const unsigned char * <parameter>vendor</parameter></paramdef> 2369 <paramdef>const unsigned char * <parameter>model</parameter></paramdef> 2370 </funcprototype></funcsynopsis> 2371</refsynopsisdiv> 2372<refsect1> 2373 <title>Arguments</title> 2374 <variablelist> 2375 <varlistentry> 2376 <term><parameter>sdev</parameter></term> 2377 <listitem> 2378 <para> 2379 <structname>scsi_device</structname> to get flags for 2380 </para> 2381 </listitem> 2382 </varlistentry> 2383 <varlistentry> 2384 <term><parameter>vendor</parameter></term> 2385 <listitem> 2386 <para> 2387 vendor name 2388 </para> 2389 </listitem> 2390 </varlistentry> 2391 <varlistentry> 2392 <term><parameter>model</parameter></term> 2393 <listitem> 2394 <para> 2395 model name 2396 </para> 2397 </listitem> 2398 </varlistentry> 2399 </variablelist> 2400</refsect1> 2401<refsect1> 2402<title>Description</title> 2403<para> 2404 Search the global scsi_dev_info_list (specified by list zero) 2405 for an entry matching <parameter>vendor</parameter> and <parameter>model</parameter>, if found, return the 2406 matching flags value, else return the host or global default 2407 settings. Called during scan time. 2408</para> 2409</refsect1> 2410</refentry> 2411 2412<refentry id="API-scsi-exit-devinfo"> 2413<refentryinfo> 2414 <title>LINUX</title> 2415 <productname>Kernel Hackers Manual</productname> 2416 <date>July 2017</date> 2417</refentryinfo> 2418<refmeta> 2419 <refentrytitle><phrase>scsi_exit_devinfo</phrase></refentrytitle> 2420 <manvolnum>9</manvolnum> 2421 <refmiscinfo class="version">4.1.27</refmiscinfo> 2422</refmeta> 2423<refnamediv> 2424 <refname>scsi_exit_devinfo</refname> 2425 <refpurpose> 2426 remove /proc/scsi/device_info & the scsi_dev_info_list 2427 </refpurpose> 2428</refnamediv> 2429<refsynopsisdiv> 2430 <title>Synopsis</title> 2431 <funcsynopsis><funcprototype> 2432 <funcdef>void <function>scsi_exit_devinfo </function></funcdef> 2433 <paramdef> <parameter>void</parameter></paramdef> 2434 </funcprototype></funcsynopsis> 2435</refsynopsisdiv> 2436<refsect1> 2437 <title>Arguments</title> 2438 <variablelist> 2439 <varlistentry> 2440 <term><parameter>void</parameter></term> 2441 <listitem> 2442 <para> 2443 no arguments 2444 </para> 2445 </listitem> 2446 </varlistentry> 2447 </variablelist> 2448</refsect1> 2449</refentry> 2450 2451<refentry id="API-scsi-init-devinfo"> 2452<refentryinfo> 2453 <title>LINUX</title> 2454 <productname>Kernel Hackers Manual</productname> 2455 <date>July 2017</date> 2456</refentryinfo> 2457<refmeta> 2458 <refentrytitle><phrase>scsi_init_devinfo</phrase></refentrytitle> 2459 <manvolnum>9</manvolnum> 2460 <refmiscinfo class="version">4.1.27</refmiscinfo> 2461</refmeta> 2462<refnamediv> 2463 <refname>scsi_init_devinfo</refname> 2464 <refpurpose> 2465 set up the dynamic device list. 2466 </refpurpose> 2467</refnamediv> 2468<refsynopsisdiv> 2469 <title>Synopsis</title> 2470 <funcsynopsis><funcprototype> 2471 <funcdef>int <function>scsi_init_devinfo </function></funcdef> 2472 <paramdef> <parameter>void</parameter></paramdef> 2473 </funcprototype></funcsynopsis> 2474</refsynopsisdiv> 2475<refsect1> 2476 <title>Arguments</title> 2477 <variablelist> 2478 <varlistentry> 2479 <term><parameter>void</parameter></term> 2480 <listitem> 2481 <para> 2482 no arguments 2483 </para> 2484 </listitem> 2485 </varlistentry> 2486 </variablelist> 2487</refsect1> 2488<refsect1> 2489<title>Description</title> 2490<para> 2491 Add command line entries from scsi_dev_flags, then add 2492 scsi_static_device_list entries to the scsi device info list. 2493</para> 2494</refsect1> 2495</refentry> 2496 2497 </sect2> 2498 <sect2 id="scsi_ioctl.c"> 2499 <title>drivers/scsi/scsi_ioctl.c</title> 2500 <para> 2501 Handle ioctl() calls for SCSI devices. 2502 </para> 2503<!-- drivers/scsi/scsi_ioctl.c --> 2504<refentry id="API-scsi-ioctl"> 2505<refentryinfo> 2506 <title>LINUX</title> 2507 <productname>Kernel Hackers Manual</productname> 2508 <date>July 2017</date> 2509</refentryinfo> 2510<refmeta> 2511 <refentrytitle><phrase>scsi_ioctl</phrase></refentrytitle> 2512 <manvolnum>9</manvolnum> 2513 <refmiscinfo class="version">4.1.27</refmiscinfo> 2514</refmeta> 2515<refnamediv> 2516 <refname>scsi_ioctl</refname> 2517 <refpurpose> 2518 Dispatch ioctl to scsi device 2519 </refpurpose> 2520</refnamediv> 2521<refsynopsisdiv> 2522 <title>Synopsis</title> 2523 <funcsynopsis><funcprototype> 2524 <funcdef>int <function>scsi_ioctl </function></funcdef> 2525 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 2526 <paramdef>int <parameter>cmd</parameter></paramdef> 2527 <paramdef>void __user * <parameter>arg</parameter></paramdef> 2528 </funcprototype></funcsynopsis> 2529</refsynopsisdiv> 2530<refsect1> 2531 <title>Arguments</title> 2532 <variablelist> 2533 <varlistentry> 2534 <term><parameter>sdev</parameter></term> 2535 <listitem> 2536 <para> 2537 scsi device receiving ioctl 2538 </para> 2539 </listitem> 2540 </varlistentry> 2541 <varlistentry> 2542 <term><parameter>cmd</parameter></term> 2543 <listitem> 2544 <para> 2545 which ioctl is it 2546 </para> 2547 </listitem> 2548 </varlistentry> 2549 <varlistentry> 2550 <term><parameter>arg</parameter></term> 2551 <listitem> 2552 <para> 2553 data associated with ioctl 2554 </para> 2555 </listitem> 2556 </varlistentry> 2557 </variablelist> 2558</refsect1> 2559<refsect1> 2560<title>Description</title> 2561<para> 2562 The <function>scsi_ioctl</function> function differs from most ioctls in that it 2563 does not take a major/minor number as the dev field. Rather, it takes 2564 a pointer to a <structname>struct scsi_device</structname>. 2565</para> 2566</refsect1> 2567</refentry> 2568 2569 </sect2> 2570 <sect2 id="scsi_lib.c"> 2571 <title>drivers/scsi/scsi_lib.c</title> 2572 <para> 2573 SCSI queuing library. 2574 </para> 2575<!-- drivers/scsi/scsi_lib.c --> 2576<refentry id="API-scsi-execute"> 2577<refentryinfo> 2578 <title>LINUX</title> 2579 <productname>Kernel Hackers Manual</productname> 2580 <date>July 2017</date> 2581</refentryinfo> 2582<refmeta> 2583 <refentrytitle><phrase>scsi_execute</phrase></refentrytitle> 2584 <manvolnum>9</manvolnum> 2585 <refmiscinfo class="version">4.1.27</refmiscinfo> 2586</refmeta> 2587<refnamediv> 2588 <refname>scsi_execute</refname> 2589 <refpurpose> 2590 insert request and wait for the result 2591 </refpurpose> 2592</refnamediv> 2593<refsynopsisdiv> 2594 <title>Synopsis</title> 2595 <funcsynopsis><funcprototype> 2596 <funcdef>int <function>scsi_execute </function></funcdef> 2597 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 2598 <paramdef>const unsigned char * <parameter>cmd</parameter></paramdef> 2599 <paramdef>int <parameter>data_direction</parameter></paramdef> 2600 <paramdef>void * <parameter>buffer</parameter></paramdef> 2601 <paramdef>unsigned <parameter>bufflen</parameter></paramdef> 2602 <paramdef>unsigned char * <parameter>sense</parameter></paramdef> 2603 <paramdef>int <parameter>timeout</parameter></paramdef> 2604 <paramdef>int <parameter>retries</parameter></paramdef> 2605 <paramdef>u64 <parameter>flags</parameter></paramdef> 2606 <paramdef>int * <parameter>resid</parameter></paramdef> 2607 </funcprototype></funcsynopsis> 2608</refsynopsisdiv> 2609<refsect1> 2610 <title>Arguments</title> 2611 <variablelist> 2612 <varlistentry> 2613 <term><parameter>sdev</parameter></term> 2614 <listitem> 2615 <para> 2616 scsi device 2617 </para> 2618 </listitem> 2619 </varlistentry> 2620 <varlistentry> 2621 <term><parameter>cmd</parameter></term> 2622 <listitem> 2623 <para> 2624 scsi command 2625 </para> 2626 </listitem> 2627 </varlistentry> 2628 <varlistentry> 2629 <term><parameter>data_direction</parameter></term> 2630 <listitem> 2631 <para> 2632 data direction 2633 </para> 2634 </listitem> 2635 </varlistentry> 2636 <varlistentry> 2637 <term><parameter>buffer</parameter></term> 2638 <listitem> 2639 <para> 2640 data buffer 2641 </para> 2642 </listitem> 2643 </varlistentry> 2644 <varlistentry> 2645 <term><parameter>bufflen</parameter></term> 2646 <listitem> 2647 <para> 2648 len of buffer 2649 </para> 2650 </listitem> 2651 </varlistentry> 2652 <varlistentry> 2653 <term><parameter>sense</parameter></term> 2654 <listitem> 2655 <para> 2656 optional sense buffer 2657 </para> 2658 </listitem> 2659 </varlistentry> 2660 <varlistentry> 2661 <term><parameter>timeout</parameter></term> 2662 <listitem> 2663 <para> 2664 request timeout in seconds 2665 </para> 2666 </listitem> 2667 </varlistentry> 2668 <varlistentry> 2669 <term><parameter>retries</parameter></term> 2670 <listitem> 2671 <para> 2672 number of times to retry request 2673 </para> 2674 </listitem> 2675 </varlistentry> 2676 <varlistentry> 2677 <term><parameter>flags</parameter></term> 2678 <listitem> 2679 <para> 2680 or into request flags; 2681 </para> 2682 </listitem> 2683 </varlistentry> 2684 <varlistentry> 2685 <term><parameter>resid</parameter></term> 2686 <listitem> 2687 <para> 2688 optional residual length 2689 </para> 2690 </listitem> 2691 </varlistentry> 2692 </variablelist> 2693</refsect1> 2694<refsect1> 2695<title>Description</title> 2696<para> 2697 returns the req->errors value which is the scsi_cmnd result 2698 field. 2699</para> 2700</refsect1> 2701</refentry> 2702 2703<refentry id="API-scsi-mode-select"> 2704<refentryinfo> 2705 <title>LINUX</title> 2706 <productname>Kernel Hackers Manual</productname> 2707 <date>July 2017</date> 2708</refentryinfo> 2709<refmeta> 2710 <refentrytitle><phrase>scsi_mode_select</phrase></refentrytitle> 2711 <manvolnum>9</manvolnum> 2712 <refmiscinfo class="version">4.1.27</refmiscinfo> 2713</refmeta> 2714<refnamediv> 2715 <refname>scsi_mode_select</refname> 2716 <refpurpose> 2717 issue a mode select 2718 </refpurpose> 2719</refnamediv> 2720<refsynopsisdiv> 2721 <title>Synopsis</title> 2722 <funcsynopsis><funcprototype> 2723 <funcdef>int <function>scsi_mode_select </function></funcdef> 2724 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 2725 <paramdef>int <parameter>pf</parameter></paramdef> 2726 <paramdef>int <parameter>sp</parameter></paramdef> 2727 <paramdef>int <parameter>modepage</parameter></paramdef> 2728 <paramdef>unsigned char * <parameter>buffer</parameter></paramdef> 2729 <paramdef>int <parameter>len</parameter></paramdef> 2730 <paramdef>int <parameter>timeout</parameter></paramdef> 2731 <paramdef>int <parameter>retries</parameter></paramdef> 2732 <paramdef>struct scsi_mode_data * <parameter>data</parameter></paramdef> 2733 <paramdef>struct scsi_sense_hdr * <parameter>sshdr</parameter></paramdef> 2734 </funcprototype></funcsynopsis> 2735</refsynopsisdiv> 2736<refsect1> 2737 <title>Arguments</title> 2738 <variablelist> 2739 <varlistentry> 2740 <term><parameter>sdev</parameter></term> 2741 <listitem> 2742 <para> 2743 SCSI device to be queried 2744 </para> 2745 </listitem> 2746 </varlistentry> 2747 <varlistentry> 2748 <term><parameter>pf</parameter></term> 2749 <listitem> 2750 <para> 2751 Page format bit (1 == standard, 0 == vendor specific) 2752 </para> 2753 </listitem> 2754 </varlistentry> 2755 <varlistentry> 2756 <term><parameter>sp</parameter></term> 2757 <listitem> 2758 <para> 2759 Save page bit (0 == don't save, 1 == save) 2760 </para> 2761 </listitem> 2762 </varlistentry> 2763 <varlistentry> 2764 <term><parameter>modepage</parameter></term> 2765 <listitem> 2766 <para> 2767 mode page being requested 2768 </para> 2769 </listitem> 2770 </varlistentry> 2771 <varlistentry> 2772 <term><parameter>buffer</parameter></term> 2773 <listitem> 2774 <para> 2775 request buffer (may not be smaller than eight bytes) 2776 </para> 2777 </listitem> 2778 </varlistentry> 2779 <varlistentry> 2780 <term><parameter>len</parameter></term> 2781 <listitem> 2782 <para> 2783 length of request buffer. 2784 </para> 2785 </listitem> 2786 </varlistentry> 2787 <varlistentry> 2788 <term><parameter>timeout</parameter></term> 2789 <listitem> 2790 <para> 2791 command timeout 2792 </para> 2793 </listitem> 2794 </varlistentry> 2795 <varlistentry> 2796 <term><parameter>retries</parameter></term> 2797 <listitem> 2798 <para> 2799 number of retries before failing 2800 </para> 2801 </listitem> 2802 </varlistentry> 2803 <varlistentry> 2804 <term><parameter>data</parameter></term> 2805 <listitem> 2806 <para> 2807 returns a structure abstracting the mode header data 2808 </para> 2809 </listitem> 2810 </varlistentry> 2811 <varlistentry> 2812 <term><parameter>sshdr</parameter></term> 2813 <listitem> 2814 <para> 2815 place to put sense data (or NULL if no sense to be collected). 2816 must be SCSI_SENSE_BUFFERSIZE big. 2817 </para> 2818 </listitem> 2819 </varlistentry> 2820 </variablelist> 2821</refsect1> 2822<refsect1> 2823<title>Description</title> 2824<para> 2825 Returns zero if successful; negative error number or scsi 2826 status on error 2827</para> 2828</refsect1> 2829</refentry> 2830 2831<refentry id="API-scsi-mode-sense"> 2832<refentryinfo> 2833 <title>LINUX</title> 2834 <productname>Kernel Hackers Manual</productname> 2835 <date>July 2017</date> 2836</refentryinfo> 2837<refmeta> 2838 <refentrytitle><phrase>scsi_mode_sense</phrase></refentrytitle> 2839 <manvolnum>9</manvolnum> 2840 <refmiscinfo class="version">4.1.27</refmiscinfo> 2841</refmeta> 2842<refnamediv> 2843 <refname>scsi_mode_sense</refname> 2844 <refpurpose> 2845 issue a mode sense, falling back from 10 to six bytes if necessary. 2846 </refpurpose> 2847</refnamediv> 2848<refsynopsisdiv> 2849 <title>Synopsis</title> 2850 <funcsynopsis><funcprototype> 2851 <funcdef>int <function>scsi_mode_sense </function></funcdef> 2852 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 2853 <paramdef>int <parameter>dbd</parameter></paramdef> 2854 <paramdef>int <parameter>modepage</parameter></paramdef> 2855 <paramdef>unsigned char * <parameter>buffer</parameter></paramdef> 2856 <paramdef>int <parameter>len</parameter></paramdef> 2857 <paramdef>int <parameter>timeout</parameter></paramdef> 2858 <paramdef>int <parameter>retries</parameter></paramdef> 2859 <paramdef>struct scsi_mode_data * <parameter>data</parameter></paramdef> 2860 <paramdef>struct scsi_sense_hdr * <parameter>sshdr</parameter></paramdef> 2861 </funcprototype></funcsynopsis> 2862</refsynopsisdiv> 2863<refsect1> 2864 <title>Arguments</title> 2865 <variablelist> 2866 <varlistentry> 2867 <term><parameter>sdev</parameter></term> 2868 <listitem> 2869 <para> 2870 SCSI device to be queried 2871 </para> 2872 </listitem> 2873 </varlistentry> 2874 <varlistentry> 2875 <term><parameter>dbd</parameter></term> 2876 <listitem> 2877 <para> 2878 set if mode sense will allow block descriptors to be returned 2879 </para> 2880 </listitem> 2881 </varlistentry> 2882 <varlistentry> 2883 <term><parameter>modepage</parameter></term> 2884 <listitem> 2885 <para> 2886 mode page being requested 2887 </para> 2888 </listitem> 2889 </varlistentry> 2890 <varlistentry> 2891 <term><parameter>buffer</parameter></term> 2892 <listitem> 2893 <para> 2894 request buffer (may not be smaller than eight bytes) 2895 </para> 2896 </listitem> 2897 </varlistentry> 2898 <varlistentry> 2899 <term><parameter>len</parameter></term> 2900 <listitem> 2901 <para> 2902 length of request buffer. 2903 </para> 2904 </listitem> 2905 </varlistentry> 2906 <varlistentry> 2907 <term><parameter>timeout</parameter></term> 2908 <listitem> 2909 <para> 2910 command timeout 2911 </para> 2912 </listitem> 2913 </varlistentry> 2914 <varlistentry> 2915 <term><parameter>retries</parameter></term> 2916 <listitem> 2917 <para> 2918 number of retries before failing 2919 </para> 2920 </listitem> 2921 </varlistentry> 2922 <varlistentry> 2923 <term><parameter>data</parameter></term> 2924 <listitem> 2925 <para> 2926 returns a structure abstracting the mode header data 2927 </para> 2928 </listitem> 2929 </varlistentry> 2930 <varlistentry> 2931 <term><parameter>sshdr</parameter></term> 2932 <listitem> 2933 <para> 2934 place to put sense data (or NULL if no sense to be collected). 2935 must be SCSI_SENSE_BUFFERSIZE big. 2936 </para> 2937 </listitem> 2938 </varlistentry> 2939 </variablelist> 2940</refsect1> 2941<refsect1> 2942<title>Description</title> 2943<para> 2944 Returns zero if unsuccessful, or the header offset (either 4 2945 or 8 depending on whether a six or ten byte command was 2946 issued) if successful. 2947</para> 2948</refsect1> 2949</refentry> 2950 2951<refentry id="API-scsi-test-unit-ready"> 2952<refentryinfo> 2953 <title>LINUX</title> 2954 <productname>Kernel Hackers Manual</productname> 2955 <date>July 2017</date> 2956</refentryinfo> 2957<refmeta> 2958 <refentrytitle><phrase>scsi_test_unit_ready</phrase></refentrytitle> 2959 <manvolnum>9</manvolnum> 2960 <refmiscinfo class="version">4.1.27</refmiscinfo> 2961</refmeta> 2962<refnamediv> 2963 <refname>scsi_test_unit_ready</refname> 2964 <refpurpose> 2965 test if unit is ready 2966 </refpurpose> 2967</refnamediv> 2968<refsynopsisdiv> 2969 <title>Synopsis</title> 2970 <funcsynopsis><funcprototype> 2971 <funcdef>int <function>scsi_test_unit_ready </function></funcdef> 2972 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 2973 <paramdef>int <parameter>timeout</parameter></paramdef> 2974 <paramdef>int <parameter>retries</parameter></paramdef> 2975 <paramdef>struct scsi_sense_hdr * <parameter>sshdr_external</parameter></paramdef> 2976 </funcprototype></funcsynopsis> 2977</refsynopsisdiv> 2978<refsect1> 2979 <title>Arguments</title> 2980 <variablelist> 2981 <varlistentry> 2982 <term><parameter>sdev</parameter></term> 2983 <listitem> 2984 <para> 2985 scsi device to change the state of. 2986 </para> 2987 </listitem> 2988 </varlistentry> 2989 <varlistentry> 2990 <term><parameter>timeout</parameter></term> 2991 <listitem> 2992 <para> 2993 command timeout 2994 </para> 2995 </listitem> 2996 </varlistentry> 2997 <varlistentry> 2998 <term><parameter>retries</parameter></term> 2999 <listitem> 3000 <para> 3001 number of retries before failing 3002 </para> 3003 </listitem> 3004 </varlistentry> 3005 <varlistentry> 3006 <term><parameter>sshdr_external</parameter></term> 3007 <listitem> 3008 <para> 3009 Optional pointer to struct scsi_sense_hdr for 3010 returning sense. Make sure that this is cleared before passing 3011 in. 3012 </para> 3013 </listitem> 3014 </varlistentry> 3015 </variablelist> 3016</refsect1> 3017<refsect1> 3018<title>Description</title> 3019<para> 3020 Returns zero if unsuccessful or an error if TUR failed. For 3021 removable media, UNIT_ATTENTION sets ->changed flag. 3022</para> 3023</refsect1> 3024</refentry> 3025 3026<refentry id="API-scsi-device-set-state"> 3027<refentryinfo> 3028 <title>LINUX</title> 3029 <productname>Kernel Hackers Manual</productname> 3030 <date>July 2017</date> 3031</refentryinfo> 3032<refmeta> 3033 <refentrytitle><phrase>scsi_device_set_state</phrase></refentrytitle> 3034 <manvolnum>9</manvolnum> 3035 <refmiscinfo class="version">4.1.27</refmiscinfo> 3036</refmeta> 3037<refnamediv> 3038 <refname>scsi_device_set_state</refname> 3039 <refpurpose> 3040 Take the given device through the device state model. 3041 </refpurpose> 3042</refnamediv> 3043<refsynopsisdiv> 3044 <title>Synopsis</title> 3045 <funcsynopsis><funcprototype> 3046 <funcdef>int <function>scsi_device_set_state </function></funcdef> 3047 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 3048 <paramdef>enum scsi_device_state <parameter>state</parameter></paramdef> 3049 </funcprototype></funcsynopsis> 3050</refsynopsisdiv> 3051<refsect1> 3052 <title>Arguments</title> 3053 <variablelist> 3054 <varlistentry> 3055 <term><parameter>sdev</parameter></term> 3056 <listitem> 3057 <para> 3058 scsi device to change the state of. 3059 </para> 3060 </listitem> 3061 </varlistentry> 3062 <varlistentry> 3063 <term><parameter>state</parameter></term> 3064 <listitem> 3065 <para> 3066 state to change to. 3067 </para> 3068 </listitem> 3069 </varlistentry> 3070 </variablelist> 3071</refsect1> 3072<refsect1> 3073<title>Description</title> 3074<para> 3075 Returns zero if unsuccessful or an error if the requested 3076 transition is illegal. 3077</para> 3078</refsect1> 3079</refentry> 3080 3081<refentry id="API-sdev-evt-send"> 3082<refentryinfo> 3083 <title>LINUX</title> 3084 <productname>Kernel Hackers Manual</productname> 3085 <date>July 2017</date> 3086</refentryinfo> 3087<refmeta> 3088 <refentrytitle><phrase>sdev_evt_send</phrase></refentrytitle> 3089 <manvolnum>9</manvolnum> 3090 <refmiscinfo class="version">4.1.27</refmiscinfo> 3091</refmeta> 3092<refnamediv> 3093 <refname>sdev_evt_send</refname> 3094 <refpurpose> 3095 send asserted event to uevent thread 3096 </refpurpose> 3097</refnamediv> 3098<refsynopsisdiv> 3099 <title>Synopsis</title> 3100 <funcsynopsis><funcprototype> 3101 <funcdef>void <function>sdev_evt_send </function></funcdef> 3102 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 3103 <paramdef>struct scsi_event * <parameter>evt</parameter></paramdef> 3104 </funcprototype></funcsynopsis> 3105</refsynopsisdiv> 3106<refsect1> 3107 <title>Arguments</title> 3108 <variablelist> 3109 <varlistentry> 3110 <term><parameter>sdev</parameter></term> 3111 <listitem> 3112 <para> 3113 scsi_device event occurred on 3114 </para> 3115 </listitem> 3116 </varlistentry> 3117 <varlistentry> 3118 <term><parameter>evt</parameter></term> 3119 <listitem> 3120 <para> 3121 event to send 3122 </para> 3123 </listitem> 3124 </varlistentry> 3125 </variablelist> 3126</refsect1> 3127<refsect1> 3128<title>Description</title> 3129<para> 3130 Assert scsi device event asynchronously. 3131</para> 3132</refsect1> 3133</refentry> 3134 3135<refentry id="API-sdev-evt-alloc"> 3136<refentryinfo> 3137 <title>LINUX</title> 3138 <productname>Kernel Hackers Manual</productname> 3139 <date>July 2017</date> 3140</refentryinfo> 3141<refmeta> 3142 <refentrytitle><phrase>sdev_evt_alloc</phrase></refentrytitle> 3143 <manvolnum>9</manvolnum> 3144 <refmiscinfo class="version">4.1.27</refmiscinfo> 3145</refmeta> 3146<refnamediv> 3147 <refname>sdev_evt_alloc</refname> 3148 <refpurpose> 3149 allocate a new scsi event 3150 </refpurpose> 3151</refnamediv> 3152<refsynopsisdiv> 3153 <title>Synopsis</title> 3154 <funcsynopsis><funcprototype> 3155 <funcdef>struct scsi_event * <function>sdev_evt_alloc </function></funcdef> 3156 <paramdef>enum scsi_device_event <parameter>evt_type</parameter></paramdef> 3157 <paramdef>gfp_t <parameter>gfpflags</parameter></paramdef> 3158 </funcprototype></funcsynopsis> 3159</refsynopsisdiv> 3160<refsect1> 3161 <title>Arguments</title> 3162 <variablelist> 3163 <varlistentry> 3164 <term><parameter>evt_type</parameter></term> 3165 <listitem> 3166 <para> 3167 type of event to allocate 3168 </para> 3169 </listitem> 3170 </varlistentry> 3171 <varlistentry> 3172 <term><parameter>gfpflags</parameter></term> 3173 <listitem> 3174 <para> 3175 GFP flags for allocation 3176 </para> 3177 </listitem> 3178 </varlistentry> 3179 </variablelist> 3180</refsect1> 3181<refsect1> 3182<title>Description</title> 3183<para> 3184 Allocates and returns a new scsi_event. 3185</para> 3186</refsect1> 3187</refentry> 3188 3189<refentry id="API-sdev-evt-send-simple"> 3190<refentryinfo> 3191 <title>LINUX</title> 3192 <productname>Kernel Hackers Manual</productname> 3193 <date>July 2017</date> 3194</refentryinfo> 3195<refmeta> 3196 <refentrytitle><phrase>sdev_evt_send_simple</phrase></refentrytitle> 3197 <manvolnum>9</manvolnum> 3198 <refmiscinfo class="version">4.1.27</refmiscinfo> 3199</refmeta> 3200<refnamediv> 3201 <refname>sdev_evt_send_simple</refname> 3202 <refpurpose> 3203 send asserted event to uevent thread 3204 </refpurpose> 3205</refnamediv> 3206<refsynopsisdiv> 3207 <title>Synopsis</title> 3208 <funcsynopsis><funcprototype> 3209 <funcdef>void <function>sdev_evt_send_simple </function></funcdef> 3210 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 3211 <paramdef>enum scsi_device_event <parameter>evt_type</parameter></paramdef> 3212 <paramdef>gfp_t <parameter>gfpflags</parameter></paramdef> 3213 </funcprototype></funcsynopsis> 3214</refsynopsisdiv> 3215<refsect1> 3216 <title>Arguments</title> 3217 <variablelist> 3218 <varlistentry> 3219 <term><parameter>sdev</parameter></term> 3220 <listitem> 3221 <para> 3222 scsi_device event occurred on 3223 </para> 3224 </listitem> 3225 </varlistentry> 3226 <varlistentry> 3227 <term><parameter>evt_type</parameter></term> 3228 <listitem> 3229 <para> 3230 type of event to send 3231 </para> 3232 </listitem> 3233 </varlistentry> 3234 <varlistentry> 3235 <term><parameter>gfpflags</parameter></term> 3236 <listitem> 3237 <para> 3238 GFP flags for allocation 3239 </para> 3240 </listitem> 3241 </varlistentry> 3242 </variablelist> 3243</refsect1> 3244<refsect1> 3245<title>Description</title> 3246<para> 3247 Assert scsi device event asynchronously, given an event type. 3248</para> 3249</refsect1> 3250</refentry> 3251 3252<refentry id="API-scsi-device-quiesce"> 3253<refentryinfo> 3254 <title>LINUX</title> 3255 <productname>Kernel Hackers Manual</productname> 3256 <date>July 2017</date> 3257</refentryinfo> 3258<refmeta> 3259 <refentrytitle><phrase>scsi_device_quiesce</phrase></refentrytitle> 3260 <manvolnum>9</manvolnum> 3261 <refmiscinfo class="version">4.1.27</refmiscinfo> 3262</refmeta> 3263<refnamediv> 3264 <refname>scsi_device_quiesce</refname> 3265 <refpurpose> 3266 Block user issued commands. 3267 </refpurpose> 3268</refnamediv> 3269<refsynopsisdiv> 3270 <title>Synopsis</title> 3271 <funcsynopsis><funcprototype> 3272 <funcdef>int <function>scsi_device_quiesce </function></funcdef> 3273 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 3274 </funcprototype></funcsynopsis> 3275</refsynopsisdiv> 3276<refsect1> 3277 <title>Arguments</title> 3278 <variablelist> 3279 <varlistentry> 3280 <term><parameter>sdev</parameter></term> 3281 <listitem> 3282 <para> 3283 scsi device to quiesce. 3284 </para> 3285 </listitem> 3286 </varlistentry> 3287 </variablelist> 3288</refsect1> 3289<refsect1> 3290<title>Description</title> 3291<para> 3292 This works by trying to transition to the SDEV_QUIESCE state 3293 (which must be a legal transition). When the device is in this 3294 state, only special requests will be accepted, all others will 3295 be deferred. Since special requests may also be requeued requests, 3296 a successful return doesn't guarantee the device will be 3297 totally quiescent. 3298 </para><para> 3299 3300 Must be called with user context, may sleep. 3301 </para><para> 3302 3303 Returns zero if unsuccessful or an error if not. 3304</para> 3305</refsect1> 3306</refentry> 3307 3308<refentry id="API-scsi-device-resume"> 3309<refentryinfo> 3310 <title>LINUX</title> 3311 <productname>Kernel Hackers Manual</productname> 3312 <date>July 2017</date> 3313</refentryinfo> 3314<refmeta> 3315 <refentrytitle><phrase>scsi_device_resume</phrase></refentrytitle> 3316 <manvolnum>9</manvolnum> 3317 <refmiscinfo class="version">4.1.27</refmiscinfo> 3318</refmeta> 3319<refnamediv> 3320 <refname>scsi_device_resume</refname> 3321 <refpurpose> 3322 Restart user issued commands to a quiesced device. 3323 </refpurpose> 3324</refnamediv> 3325<refsynopsisdiv> 3326 <title>Synopsis</title> 3327 <funcsynopsis><funcprototype> 3328 <funcdef>void <function>scsi_device_resume </function></funcdef> 3329 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 3330 </funcprototype></funcsynopsis> 3331</refsynopsisdiv> 3332<refsect1> 3333 <title>Arguments</title> 3334 <variablelist> 3335 <varlistentry> 3336 <term><parameter>sdev</parameter></term> 3337 <listitem> 3338 <para> 3339 scsi device to resume. 3340 </para> 3341 </listitem> 3342 </varlistentry> 3343 </variablelist> 3344</refsect1> 3345<refsect1> 3346<title>Description</title> 3347<para> 3348 Moves the device from quiesced back to running and restarts the 3349 queues. 3350 </para><para> 3351 3352 Must be called with user context, may sleep. 3353</para> 3354</refsect1> 3355</refentry> 3356 3357<refentry id="API-scsi-internal-device-block"> 3358<refentryinfo> 3359 <title>LINUX</title> 3360 <productname>Kernel Hackers Manual</productname> 3361 <date>July 2017</date> 3362</refentryinfo> 3363<refmeta> 3364 <refentrytitle><phrase>scsi_internal_device_block</phrase></refentrytitle> 3365 <manvolnum>9</manvolnum> 3366 <refmiscinfo class="version">4.1.27</refmiscinfo> 3367</refmeta> 3368<refnamediv> 3369 <refname>scsi_internal_device_block</refname> 3370 <refpurpose> 3371 internal function to put a device temporarily into the SDEV_BLOCK state 3372 </refpurpose> 3373</refnamediv> 3374<refsynopsisdiv> 3375 <title>Synopsis</title> 3376 <funcsynopsis><funcprototype> 3377 <funcdef>int <function>scsi_internal_device_block </function></funcdef> 3378 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 3379 </funcprototype></funcsynopsis> 3380</refsynopsisdiv> 3381<refsect1> 3382 <title>Arguments</title> 3383 <variablelist> 3384 <varlistentry> 3385 <term><parameter>sdev</parameter></term> 3386 <listitem> 3387 <para> 3388 device to block 3389 </para> 3390 </listitem> 3391 </varlistentry> 3392 </variablelist> 3393</refsect1> 3394<refsect1> 3395<title>Description</title> 3396<para> 3397 Block request made by scsi lld's to temporarily stop all 3398 scsi commands on the specified device. Called from interrupt 3399 or normal process context. 3400 </para><para> 3401 3402 Returns zero if successful or error if not 3403</para> 3404</refsect1> 3405<refsect1> 3406<title>Notes</title> 3407<para> 3408 </para><para> 3409 3410 This routine transitions the device to the SDEV_BLOCK state 3411 (which must be a legal transition). When the device is in this 3412 state, all commands are deferred until the scsi lld reenables 3413 the device with scsi_device_unblock or device_block_tmo fires. 3414</para> 3415</refsect1> 3416</refentry> 3417 3418<refentry id="API-scsi-internal-device-unblock"> 3419<refentryinfo> 3420 <title>LINUX</title> 3421 <productname>Kernel Hackers Manual</productname> 3422 <date>July 2017</date> 3423</refentryinfo> 3424<refmeta> 3425 <refentrytitle><phrase>scsi_internal_device_unblock</phrase></refentrytitle> 3426 <manvolnum>9</manvolnum> 3427 <refmiscinfo class="version">4.1.27</refmiscinfo> 3428</refmeta> 3429<refnamediv> 3430 <refname>scsi_internal_device_unblock</refname> 3431 <refpurpose> 3432 resume a device after a block request 3433 </refpurpose> 3434</refnamediv> 3435<refsynopsisdiv> 3436 <title>Synopsis</title> 3437 <funcsynopsis><funcprototype> 3438 <funcdef>int <function>scsi_internal_device_unblock </function></funcdef> 3439 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 3440 <paramdef>enum scsi_device_state <parameter>new_state</parameter></paramdef> 3441 </funcprototype></funcsynopsis> 3442</refsynopsisdiv> 3443<refsect1> 3444 <title>Arguments</title> 3445 <variablelist> 3446 <varlistentry> 3447 <term><parameter>sdev</parameter></term> 3448 <listitem> 3449 <para> 3450 device to resume 3451 </para> 3452 </listitem> 3453 </varlistentry> 3454 <varlistentry> 3455 <term><parameter>new_state</parameter></term> 3456 <listitem> 3457 <para> 3458 state to set devices to after unblocking 3459 </para> 3460 </listitem> 3461 </varlistentry> 3462 </variablelist> 3463</refsect1> 3464<refsect1> 3465<title>Description</title> 3466<para> 3467 Called by scsi lld's or the midlayer to restart the device queue 3468 for the previously suspended scsi device. Called from interrupt or 3469 normal process context. 3470 </para><para> 3471 3472 Returns zero if successful or error if not. 3473</para> 3474</refsect1> 3475<refsect1> 3476<title>Notes</title> 3477<para> 3478 </para><para> 3479 3480 This routine transitions the device to the SDEV_RUNNING state 3481 or to one of the offline states (which must be a legal transition) 3482 allowing the midlayer to goose the queue for this device. 3483</para> 3484</refsect1> 3485</refentry> 3486 3487<refentry id="API-scsi-kmap-atomic-sg"> 3488<refentryinfo> 3489 <title>LINUX</title> 3490 <productname>Kernel Hackers Manual</productname> 3491 <date>July 2017</date> 3492</refentryinfo> 3493<refmeta> 3494 <refentrytitle><phrase>scsi_kmap_atomic_sg</phrase></refentrytitle> 3495 <manvolnum>9</manvolnum> 3496 <refmiscinfo class="version">4.1.27</refmiscinfo> 3497</refmeta> 3498<refnamediv> 3499 <refname>scsi_kmap_atomic_sg</refname> 3500 <refpurpose> 3501 find and atomically map an sg-elemnt 3502 </refpurpose> 3503</refnamediv> 3504<refsynopsisdiv> 3505 <title>Synopsis</title> 3506 <funcsynopsis><funcprototype> 3507 <funcdef>void * <function>scsi_kmap_atomic_sg </function></funcdef> 3508 <paramdef>struct scatterlist * <parameter>sgl</parameter></paramdef> 3509 <paramdef>int <parameter>sg_count</parameter></paramdef> 3510 <paramdef>size_t * <parameter>offset</parameter></paramdef> 3511 <paramdef>size_t * <parameter>len</parameter></paramdef> 3512 </funcprototype></funcsynopsis> 3513</refsynopsisdiv> 3514<refsect1> 3515 <title>Arguments</title> 3516 <variablelist> 3517 <varlistentry> 3518 <term><parameter>sgl</parameter></term> 3519 <listitem> 3520 <para> 3521 scatter-gather list 3522 </para> 3523 </listitem> 3524 </varlistentry> 3525 <varlistentry> 3526 <term><parameter>sg_count</parameter></term> 3527 <listitem> 3528 <para> 3529 number of segments in sg 3530 </para> 3531 </listitem> 3532 </varlistentry> 3533 <varlistentry> 3534 <term><parameter>offset</parameter></term> 3535 <listitem> 3536 <para> 3537 offset in bytes into sg, on return offset into the mapped area 3538 </para> 3539 </listitem> 3540 </varlistentry> 3541 <varlistentry> 3542 <term><parameter>len</parameter></term> 3543 <listitem> 3544 <para> 3545 bytes to map, on return number of bytes mapped 3546 </para> 3547 </listitem> 3548 </varlistentry> 3549 </variablelist> 3550</refsect1> 3551<refsect1> 3552<title>Description</title> 3553<para> 3554 Returns virtual address of the start of the mapped page 3555</para> 3556</refsect1> 3557</refentry> 3558 3559<refentry id="API-scsi-kunmap-atomic-sg"> 3560<refentryinfo> 3561 <title>LINUX</title> 3562 <productname>Kernel Hackers Manual</productname> 3563 <date>July 2017</date> 3564</refentryinfo> 3565<refmeta> 3566 <refentrytitle><phrase>scsi_kunmap_atomic_sg</phrase></refentrytitle> 3567 <manvolnum>9</manvolnum> 3568 <refmiscinfo class="version">4.1.27</refmiscinfo> 3569</refmeta> 3570<refnamediv> 3571 <refname>scsi_kunmap_atomic_sg</refname> 3572 <refpurpose> 3573 atomically unmap a virtual address, previously mapped with scsi_kmap_atomic_sg 3574 </refpurpose> 3575</refnamediv> 3576<refsynopsisdiv> 3577 <title>Synopsis</title> 3578 <funcsynopsis><funcprototype> 3579 <funcdef>void <function>scsi_kunmap_atomic_sg </function></funcdef> 3580 <paramdef>void * <parameter>virt</parameter></paramdef> 3581 </funcprototype></funcsynopsis> 3582</refsynopsisdiv> 3583<refsect1> 3584 <title>Arguments</title> 3585 <variablelist> 3586 <varlistentry> 3587 <term><parameter>virt</parameter></term> 3588 <listitem> 3589 <para> 3590 virtual address to be unmapped 3591 </para> 3592 </listitem> 3593 </varlistentry> 3594 </variablelist> 3595</refsect1> 3596</refentry> 3597 3598 </sect2> 3599 <sect2 id="scsi_lib_dma.c"> 3600 <title>drivers/scsi/scsi_lib_dma.c</title> 3601 <para> 3602 SCSI library functions depending on DMA 3603 (map and unmap scatter-gather lists). 3604 </para> 3605<!-- drivers/scsi/scsi_lib_dma.c --> 3606<refentry id="API-scsi-dma-map"> 3607<refentryinfo> 3608 <title>LINUX</title> 3609 <productname>Kernel Hackers Manual</productname> 3610 <date>July 2017</date> 3611</refentryinfo> 3612<refmeta> 3613 <refentrytitle><phrase>scsi_dma_map</phrase></refentrytitle> 3614 <manvolnum>9</manvolnum> 3615 <refmiscinfo class="version">4.1.27</refmiscinfo> 3616</refmeta> 3617<refnamediv> 3618 <refname>scsi_dma_map</refname> 3619 <refpurpose> 3620 perform DMA mapping against command's sg lists 3621 </refpurpose> 3622</refnamediv> 3623<refsynopsisdiv> 3624 <title>Synopsis</title> 3625 <funcsynopsis><funcprototype> 3626 <funcdef>int <function>scsi_dma_map </function></funcdef> 3627 <paramdef>struct scsi_cmnd * <parameter>cmd</parameter></paramdef> 3628 </funcprototype></funcsynopsis> 3629</refsynopsisdiv> 3630<refsect1> 3631 <title>Arguments</title> 3632 <variablelist> 3633 <varlistentry> 3634 <term><parameter>cmd</parameter></term> 3635 <listitem> 3636 <para> 3637 scsi command 3638 </para> 3639 </listitem> 3640 </varlistentry> 3641 </variablelist> 3642</refsect1> 3643<refsect1> 3644<title>Description</title> 3645<para> 3646 Returns the number of sg lists actually used, zero if the sg lists 3647 is NULL, or -ENOMEM if the mapping failed. 3648</para> 3649</refsect1> 3650</refentry> 3651 3652<refentry id="API-scsi-dma-unmap"> 3653<refentryinfo> 3654 <title>LINUX</title> 3655 <productname>Kernel Hackers Manual</productname> 3656 <date>July 2017</date> 3657</refentryinfo> 3658<refmeta> 3659 <refentrytitle><phrase>scsi_dma_unmap</phrase></refentrytitle> 3660 <manvolnum>9</manvolnum> 3661 <refmiscinfo class="version">4.1.27</refmiscinfo> 3662</refmeta> 3663<refnamediv> 3664 <refname>scsi_dma_unmap</refname> 3665 <refpurpose> 3666 unmap command's sg lists mapped by scsi_dma_map 3667 </refpurpose> 3668</refnamediv> 3669<refsynopsisdiv> 3670 <title>Synopsis</title> 3671 <funcsynopsis><funcprototype> 3672 <funcdef>void <function>scsi_dma_unmap </function></funcdef> 3673 <paramdef>struct scsi_cmnd * <parameter>cmd</parameter></paramdef> 3674 </funcprototype></funcsynopsis> 3675</refsynopsisdiv> 3676<refsect1> 3677 <title>Arguments</title> 3678 <variablelist> 3679 <varlistentry> 3680 <term><parameter>cmd</parameter></term> 3681 <listitem> 3682 <para> 3683 scsi command 3684 </para> 3685 </listitem> 3686 </varlistentry> 3687 </variablelist> 3688</refsect1> 3689</refentry> 3690 3691 </sect2> 3692 <sect2 id="scsi_module.c"> 3693 <title>drivers/scsi/scsi_module.c</title> 3694 <para> 3695 The file drivers/scsi/scsi_module.c contains legacy support for 3696 old-style host templates. It should never be used by any new driver. 3697 </para> 3698 </sect2> 3699 <sect2 id="scsi_proc.c"> 3700 <title>drivers/scsi/scsi_proc.c</title> 3701 <para> 3702 The functions in this file provide an interface between 3703 the PROC file system and the SCSI device drivers 3704 It is mainly used for debugging, statistics and to pass 3705 information directly to the lowlevel driver. 3706 3707 I.E. plumbing to manage /proc/scsi/* 3708 </para> 3709<!-- drivers/scsi/scsi_proc.c --> 3710<refentry id="API-scsi-proc-hostdir-add"> 3711<refentryinfo> 3712 <title>LINUX</title> 3713 <productname>Kernel Hackers Manual</productname> 3714 <date>July 2017</date> 3715</refentryinfo> 3716<refmeta> 3717 <refentrytitle><phrase>scsi_proc_hostdir_add</phrase></refentrytitle> 3718 <manvolnum>9</manvolnum> 3719 <refmiscinfo class="version">4.1.27</refmiscinfo> 3720</refmeta> 3721<refnamediv> 3722 <refname>scsi_proc_hostdir_add</refname> 3723 <refpurpose> 3724 Create directory in /proc for a scsi host 3725 </refpurpose> 3726</refnamediv> 3727<refsynopsisdiv> 3728 <title>Synopsis</title> 3729 <funcsynopsis><funcprototype> 3730 <funcdef>void <function>scsi_proc_hostdir_add </function></funcdef> 3731 <paramdef>struct scsi_host_template * <parameter>sht</parameter></paramdef> 3732 </funcprototype></funcsynopsis> 3733</refsynopsisdiv> 3734<refsect1> 3735 <title>Arguments</title> 3736 <variablelist> 3737 <varlistentry> 3738 <term><parameter>sht</parameter></term> 3739 <listitem> 3740 <para> 3741 owner of this directory 3742 </para> 3743 </listitem> 3744 </varlistentry> 3745 </variablelist> 3746</refsect1> 3747<refsect1> 3748<title>Description</title> 3749<para> 3750 Sets sht->proc_dir to the new directory. 3751</para> 3752</refsect1> 3753</refentry> 3754 3755<refentry id="API-scsi-proc-hostdir-rm"> 3756<refentryinfo> 3757 <title>LINUX</title> 3758 <productname>Kernel Hackers Manual</productname> 3759 <date>July 2017</date> 3760</refentryinfo> 3761<refmeta> 3762 <refentrytitle><phrase>scsi_proc_hostdir_rm</phrase></refentrytitle> 3763 <manvolnum>9</manvolnum> 3764 <refmiscinfo class="version">4.1.27</refmiscinfo> 3765</refmeta> 3766<refnamediv> 3767 <refname>scsi_proc_hostdir_rm</refname> 3768 <refpurpose> 3769 remove directory in /proc for a scsi host 3770 </refpurpose> 3771</refnamediv> 3772<refsynopsisdiv> 3773 <title>Synopsis</title> 3774 <funcsynopsis><funcprototype> 3775 <funcdef>void <function>scsi_proc_hostdir_rm </function></funcdef> 3776 <paramdef>struct scsi_host_template * <parameter>sht</parameter></paramdef> 3777 </funcprototype></funcsynopsis> 3778</refsynopsisdiv> 3779<refsect1> 3780 <title>Arguments</title> 3781 <variablelist> 3782 <varlistentry> 3783 <term><parameter>sht</parameter></term> 3784 <listitem> 3785 <para> 3786 owner of directory 3787 </para> 3788 </listitem> 3789 </varlistentry> 3790 </variablelist> 3791</refsect1> 3792</refentry> 3793 3794<refentry id="API-scsi-proc-host-add"> 3795<refentryinfo> 3796 <title>LINUX</title> 3797 <productname>Kernel Hackers Manual</productname> 3798 <date>July 2017</date> 3799</refentryinfo> 3800<refmeta> 3801 <refentrytitle><phrase>scsi_proc_host_add</phrase></refentrytitle> 3802 <manvolnum>9</manvolnum> 3803 <refmiscinfo class="version">4.1.27</refmiscinfo> 3804</refmeta> 3805<refnamediv> 3806 <refname>scsi_proc_host_add</refname> 3807 <refpurpose> 3808 Add entry for this host to appropriate /proc dir 3809 </refpurpose> 3810</refnamediv> 3811<refsynopsisdiv> 3812 <title>Synopsis</title> 3813 <funcsynopsis><funcprototype> 3814 <funcdef>void <function>scsi_proc_host_add </function></funcdef> 3815 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 3816 </funcprototype></funcsynopsis> 3817</refsynopsisdiv> 3818<refsect1> 3819 <title>Arguments</title> 3820 <variablelist> 3821 <varlistentry> 3822 <term><parameter>shost</parameter></term> 3823 <listitem> 3824 <para> 3825 host to add 3826 </para> 3827 </listitem> 3828 </varlistentry> 3829 </variablelist> 3830</refsect1> 3831</refentry> 3832 3833<refentry id="API-scsi-proc-host-rm"> 3834<refentryinfo> 3835 <title>LINUX</title> 3836 <productname>Kernel Hackers Manual</productname> 3837 <date>July 2017</date> 3838</refentryinfo> 3839<refmeta> 3840 <refentrytitle><phrase>scsi_proc_host_rm</phrase></refentrytitle> 3841 <manvolnum>9</manvolnum> 3842 <refmiscinfo class="version">4.1.27</refmiscinfo> 3843</refmeta> 3844<refnamediv> 3845 <refname>scsi_proc_host_rm</refname> 3846 <refpurpose> 3847 remove this host's entry from /proc 3848 </refpurpose> 3849</refnamediv> 3850<refsynopsisdiv> 3851 <title>Synopsis</title> 3852 <funcsynopsis><funcprototype> 3853 <funcdef>void <function>scsi_proc_host_rm </function></funcdef> 3854 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 3855 </funcprototype></funcsynopsis> 3856</refsynopsisdiv> 3857<refsect1> 3858 <title>Arguments</title> 3859 <variablelist> 3860 <varlistentry> 3861 <term><parameter>shost</parameter></term> 3862 <listitem> 3863 <para> 3864 which host 3865 </para> 3866 </listitem> 3867 </varlistentry> 3868 </variablelist> 3869</refsect1> 3870</refentry> 3871 3872<refentry id="API-proc-print-scsidevice"> 3873<refentryinfo> 3874 <title>LINUX</title> 3875 <productname>Kernel Hackers Manual</productname> 3876 <date>July 2017</date> 3877</refentryinfo> 3878<refmeta> 3879 <refentrytitle><phrase>proc_print_scsidevice</phrase></refentrytitle> 3880 <manvolnum>9</manvolnum> 3881 <refmiscinfo class="version">4.1.27</refmiscinfo> 3882</refmeta> 3883<refnamediv> 3884 <refname>proc_print_scsidevice</refname> 3885 <refpurpose> 3886 return data about this host 3887 </refpurpose> 3888</refnamediv> 3889<refsynopsisdiv> 3890 <title>Synopsis</title> 3891 <funcsynopsis><funcprototype> 3892 <funcdef>int <function>proc_print_scsidevice </function></funcdef> 3893 <paramdef>struct device * <parameter>dev</parameter></paramdef> 3894 <paramdef>void * <parameter>data</parameter></paramdef> 3895 </funcprototype></funcsynopsis> 3896</refsynopsisdiv> 3897<refsect1> 3898 <title>Arguments</title> 3899 <variablelist> 3900 <varlistentry> 3901 <term><parameter>dev</parameter></term> 3902 <listitem> 3903 <para> 3904 A scsi device 3905 </para> 3906 </listitem> 3907 </varlistentry> 3908 <varlistentry> 3909 <term><parameter>data</parameter></term> 3910 <listitem> 3911 <para> 3912 <structname>struct seq_file</structname> to output to. 3913 </para> 3914 </listitem> 3915 </varlistentry> 3916 </variablelist> 3917</refsect1> 3918<refsect1> 3919<title>Description</title> 3920<para> 3921 prints Host, Channel, Id, Lun, Vendor, Model, Rev, Type, 3922 and revision. 3923</para> 3924</refsect1> 3925</refentry> 3926 3927<refentry id="API-scsi-add-single-device"> 3928<refentryinfo> 3929 <title>LINUX</title> 3930 <productname>Kernel Hackers Manual</productname> 3931 <date>July 2017</date> 3932</refentryinfo> 3933<refmeta> 3934 <refentrytitle><phrase>scsi_add_single_device</phrase></refentrytitle> 3935 <manvolnum>9</manvolnum> 3936 <refmiscinfo class="version">4.1.27</refmiscinfo> 3937</refmeta> 3938<refnamediv> 3939 <refname>scsi_add_single_device</refname> 3940 <refpurpose> 3941 Respond to user request to probe for/add device 3942 </refpurpose> 3943</refnamediv> 3944<refsynopsisdiv> 3945 <title>Synopsis</title> 3946 <funcsynopsis><funcprototype> 3947 <funcdef>int <function>scsi_add_single_device </function></funcdef> 3948 <paramdef>uint <parameter>host</parameter></paramdef> 3949 <paramdef>uint <parameter>channel</parameter></paramdef> 3950 <paramdef>uint <parameter>id</parameter></paramdef> 3951 <paramdef>uint <parameter>lun</parameter></paramdef> 3952 </funcprototype></funcsynopsis> 3953</refsynopsisdiv> 3954<refsect1> 3955 <title>Arguments</title> 3956 <variablelist> 3957 <varlistentry> 3958 <term><parameter>host</parameter></term> 3959 <listitem> 3960 <para> 3961 user-supplied decimal integer 3962 </para> 3963 </listitem> 3964 </varlistentry> 3965 <varlistentry> 3966 <term><parameter>channel</parameter></term> 3967 <listitem> 3968 <para> 3969 user-supplied decimal integer 3970 </para> 3971 </listitem> 3972 </varlistentry> 3973 <varlistentry> 3974 <term><parameter>id</parameter></term> 3975 <listitem> 3976 <para> 3977 user-supplied decimal integer 3978 </para> 3979 </listitem> 3980 </varlistentry> 3981 <varlistentry> 3982 <term><parameter>lun</parameter></term> 3983 <listitem> 3984 <para> 3985 user-supplied decimal integer 3986 </para> 3987 </listitem> 3988 </varlistentry> 3989 </variablelist> 3990</refsect1> 3991<refsect1> 3992<title>Description</title> 3993<para> 3994 called by writing <quote>scsi add-single-device</quote> to /proc/scsi/scsi. 3995 </para><para> 3996 3997 does <function>scsi_host_lookup</function> and either <function>user_scan</function> if that transport 3998 type supports it, or else <function>scsi_scan_host_selected</function> 3999</para> 4000</refsect1> 4001<refsect1> 4002<title>Note</title> 4003<para> 4004 this seems to be aimed exclusively at SCSI parallel busses. 4005</para> 4006</refsect1> 4007</refentry> 4008 4009<refentry id="API-scsi-remove-single-device"> 4010<refentryinfo> 4011 <title>LINUX</title> 4012 <productname>Kernel Hackers Manual</productname> 4013 <date>July 2017</date> 4014</refentryinfo> 4015<refmeta> 4016 <refentrytitle><phrase>scsi_remove_single_device</phrase></refentrytitle> 4017 <manvolnum>9</manvolnum> 4018 <refmiscinfo class="version">4.1.27</refmiscinfo> 4019</refmeta> 4020<refnamediv> 4021 <refname>scsi_remove_single_device</refname> 4022 <refpurpose> 4023 Respond to user request to remove a device 4024 </refpurpose> 4025</refnamediv> 4026<refsynopsisdiv> 4027 <title>Synopsis</title> 4028 <funcsynopsis><funcprototype> 4029 <funcdef>int <function>scsi_remove_single_device </function></funcdef> 4030 <paramdef>uint <parameter>host</parameter></paramdef> 4031 <paramdef>uint <parameter>channel</parameter></paramdef> 4032 <paramdef>uint <parameter>id</parameter></paramdef> 4033 <paramdef>uint <parameter>lun</parameter></paramdef> 4034 </funcprototype></funcsynopsis> 4035</refsynopsisdiv> 4036<refsect1> 4037 <title>Arguments</title> 4038 <variablelist> 4039 <varlistentry> 4040 <term><parameter>host</parameter></term> 4041 <listitem> 4042 <para> 4043 user-supplied decimal integer 4044 </para> 4045 </listitem> 4046 </varlistentry> 4047 <varlistentry> 4048 <term><parameter>channel</parameter></term> 4049 <listitem> 4050 <para> 4051 user-supplied decimal integer 4052 </para> 4053 </listitem> 4054 </varlistentry> 4055 <varlistentry> 4056 <term><parameter>id</parameter></term> 4057 <listitem> 4058 <para> 4059 user-supplied decimal integer 4060 </para> 4061 </listitem> 4062 </varlistentry> 4063 <varlistentry> 4064 <term><parameter>lun</parameter></term> 4065 <listitem> 4066 <para> 4067 user-supplied decimal integer 4068 </para> 4069 </listitem> 4070 </varlistentry> 4071 </variablelist> 4072</refsect1> 4073<refsect1> 4074<title>Description</title> 4075<para> 4076 called by writing <quote>scsi remove-single-device</quote> to 4077 /proc/scsi/scsi. Does a <function>scsi_device_lookup</function> and <function>scsi_remove_device</function> 4078</para> 4079</refsect1> 4080</refentry> 4081 4082<refentry id="API-proc-scsi-write"> 4083<refentryinfo> 4084 <title>LINUX</title> 4085 <productname>Kernel Hackers Manual</productname> 4086 <date>July 2017</date> 4087</refentryinfo> 4088<refmeta> 4089 <refentrytitle><phrase>proc_scsi_write</phrase></refentrytitle> 4090 <manvolnum>9</manvolnum> 4091 <refmiscinfo class="version">4.1.27</refmiscinfo> 4092</refmeta> 4093<refnamediv> 4094 <refname>proc_scsi_write</refname> 4095 <refpurpose> 4096 handle writes to /proc/scsi/scsi 4097 </refpurpose> 4098</refnamediv> 4099<refsynopsisdiv> 4100 <title>Synopsis</title> 4101 <funcsynopsis><funcprototype> 4102 <funcdef>ssize_t <function>proc_scsi_write </function></funcdef> 4103 <paramdef>struct file * <parameter>file</parameter></paramdef> 4104 <paramdef>const char __user * <parameter>buf</parameter></paramdef> 4105 <paramdef>size_t <parameter>length</parameter></paramdef> 4106 <paramdef>loff_t * <parameter>ppos</parameter></paramdef> 4107 </funcprototype></funcsynopsis> 4108</refsynopsisdiv> 4109<refsect1> 4110 <title>Arguments</title> 4111 <variablelist> 4112 <varlistentry> 4113 <term><parameter>file</parameter></term> 4114 <listitem> 4115 <para> 4116 not used 4117 </para> 4118 </listitem> 4119 </varlistentry> 4120 <varlistentry> 4121 <term><parameter>buf</parameter></term> 4122 <listitem> 4123 <para> 4124 buffer to write 4125 </para> 4126 </listitem> 4127 </varlistentry> 4128 <varlistentry> 4129 <term><parameter>length</parameter></term> 4130 <listitem> 4131 <para> 4132 length of buf, at most PAGE_SIZE 4133 </para> 4134 </listitem> 4135 </varlistentry> 4136 <varlistentry> 4137 <term><parameter>ppos</parameter></term> 4138 <listitem> 4139 <para> 4140 not used 4141 </para> 4142 </listitem> 4143 </varlistentry> 4144 </variablelist> 4145</refsect1> 4146<refsect1> 4147<title>Description</title> 4148<para> 4149 this provides a legacy mechanism to add or remove devices by 4150 Host, Channel, ID, and Lun. To use, 4151 <quote>echo 'scsi add-single-device 0 1 2 3' > /proc/scsi/scsi</quote> or 4152 <quote>echo 'scsi remove-single-device 0 1 2 3' > /proc/scsi/scsi</quote> with 4153 <quote>0 1 2 3</quote> replaced by the Host, Channel, Id, and Lun. 4154</para> 4155</refsect1> 4156<refsect1> 4157<title>Note</title> 4158<para> 4159 this seems to be aimed at parallel SCSI. Most modern busses (USB, 4160 SATA, Firewire, Fibre Channel, etc) dynamically assign these values to 4161 provide a unique identifier and nothing more. 4162</para> 4163</refsect1> 4164</refentry> 4165 4166<refentry id="API-proc-scsi-open"> 4167<refentryinfo> 4168 <title>LINUX</title> 4169 <productname>Kernel Hackers Manual</productname> 4170 <date>July 2017</date> 4171</refentryinfo> 4172<refmeta> 4173 <refentrytitle><phrase>proc_scsi_open</phrase></refentrytitle> 4174 <manvolnum>9</manvolnum> 4175 <refmiscinfo class="version">4.1.27</refmiscinfo> 4176</refmeta> 4177<refnamediv> 4178 <refname>proc_scsi_open</refname> 4179 <refpurpose> 4180 glue function 4181 </refpurpose> 4182</refnamediv> 4183<refsynopsisdiv> 4184 <title>Synopsis</title> 4185 <funcsynopsis><funcprototype> 4186 <funcdef>int <function>proc_scsi_open </function></funcdef> 4187 <paramdef>struct inode * <parameter>inode</parameter></paramdef> 4188 <paramdef>struct file * <parameter>file</parameter></paramdef> 4189 </funcprototype></funcsynopsis> 4190</refsynopsisdiv> 4191<refsect1> 4192 <title>Arguments</title> 4193 <variablelist> 4194 <varlistentry> 4195 <term><parameter>inode</parameter></term> 4196 <listitem> 4197 <para> 4198 not used 4199 </para> 4200 </listitem> 4201 </varlistentry> 4202 <varlistentry> 4203 <term><parameter>file</parameter></term> 4204 <listitem> 4205 <para> 4206 passed to <function>single_open</function> 4207 </para> 4208 </listitem> 4209 </varlistentry> 4210 </variablelist> 4211</refsect1> 4212<refsect1> 4213<title>Description</title> 4214<para> 4215 Associates proc_scsi_show with this file 4216</para> 4217</refsect1> 4218</refentry> 4219 4220<refentry id="API-scsi-init-procfs"> 4221<refentryinfo> 4222 <title>LINUX</title> 4223 <productname>Kernel Hackers Manual</productname> 4224 <date>July 2017</date> 4225</refentryinfo> 4226<refmeta> 4227 <refentrytitle><phrase>scsi_init_procfs</phrase></refentrytitle> 4228 <manvolnum>9</manvolnum> 4229 <refmiscinfo class="version">4.1.27</refmiscinfo> 4230</refmeta> 4231<refnamediv> 4232 <refname>scsi_init_procfs</refname> 4233 <refpurpose> 4234 create scsi and scsi/scsi in procfs 4235 </refpurpose> 4236</refnamediv> 4237<refsynopsisdiv> 4238 <title>Synopsis</title> 4239 <funcsynopsis><funcprototype> 4240 <funcdef>int <function>scsi_init_procfs </function></funcdef> 4241 <paramdef> <parameter>void</parameter></paramdef> 4242 </funcprototype></funcsynopsis> 4243</refsynopsisdiv> 4244<refsect1> 4245 <title>Arguments</title> 4246 <variablelist> 4247 <varlistentry> 4248 <term><parameter>void</parameter></term> 4249 <listitem> 4250 <para> 4251 no arguments 4252 </para> 4253 </listitem> 4254 </varlistentry> 4255 </variablelist> 4256</refsect1> 4257</refentry> 4258 4259<refentry id="API-scsi-exit-procfs"> 4260<refentryinfo> 4261 <title>LINUX</title> 4262 <productname>Kernel Hackers Manual</productname> 4263 <date>July 2017</date> 4264</refentryinfo> 4265<refmeta> 4266 <refentrytitle><phrase>scsi_exit_procfs</phrase></refentrytitle> 4267 <manvolnum>9</manvolnum> 4268 <refmiscinfo class="version">4.1.27</refmiscinfo> 4269</refmeta> 4270<refnamediv> 4271 <refname>scsi_exit_procfs</refname> 4272 <refpurpose> 4273 Remove scsi/scsi and scsi from procfs 4274 </refpurpose> 4275</refnamediv> 4276<refsynopsisdiv> 4277 <title>Synopsis</title> 4278 <funcsynopsis><funcprototype> 4279 <funcdef>void <function>scsi_exit_procfs </function></funcdef> 4280 <paramdef> <parameter>void</parameter></paramdef> 4281 </funcprototype></funcsynopsis> 4282</refsynopsisdiv> 4283<refsect1> 4284 <title>Arguments</title> 4285 <variablelist> 4286 <varlistentry> 4287 <term><parameter>void</parameter></term> 4288 <listitem> 4289 <para> 4290 no arguments 4291 </para> 4292 </listitem> 4293 </varlistentry> 4294 </variablelist> 4295</refsect1> 4296</refentry> 4297 4298 </sect2> 4299 <sect2 id="scsi_netlink.c"> 4300 <title>drivers/scsi/scsi_netlink.c</title> 4301 <para> 4302 Infrastructure to provide async events from transports to userspace 4303 via netlink, using a single NETLINK_SCSITRANSPORT protocol for all 4304 transports. 4305 4306 See <ulink url='http://marc.info/?l=linux-scsi&m=115507374832500&w=2'>the 4307 original patch submission</ulink> for more details. 4308 </para> 4309<!-- drivers/scsi/scsi_netlink.c --> 4310<refentry id="API-scsi-nl-rcv-msg"> 4311<refentryinfo> 4312 <title>LINUX</title> 4313 <productname>Kernel Hackers Manual</productname> 4314 <date>July 2017</date> 4315</refentryinfo> 4316<refmeta> 4317 <refentrytitle><phrase>scsi_nl_rcv_msg</phrase></refentrytitle> 4318 <manvolnum>9</manvolnum> 4319 <refmiscinfo class="version">4.1.27</refmiscinfo> 4320</refmeta> 4321<refnamediv> 4322 <refname>scsi_nl_rcv_msg</refname> 4323 <refpurpose> 4324 Receive message handler. 4325 </refpurpose> 4326</refnamediv> 4327<refsynopsisdiv> 4328 <title>Synopsis</title> 4329 <funcsynopsis><funcprototype> 4330 <funcdef>void <function>scsi_nl_rcv_msg </function></funcdef> 4331 <paramdef>struct sk_buff * <parameter>skb</parameter></paramdef> 4332 </funcprototype></funcsynopsis> 4333</refsynopsisdiv> 4334<refsect1> 4335 <title>Arguments</title> 4336 <variablelist> 4337 <varlistentry> 4338 <term><parameter>skb</parameter></term> 4339 <listitem> 4340 <para> 4341 socket receive buffer 4342 </para> 4343 </listitem> 4344 </varlistentry> 4345 </variablelist> 4346</refsect1> 4347<refsect1> 4348<title>Description</title> 4349<para> 4350 Extracts message from a receive buffer. 4351 Validates message header and calls appropriate transport message handler 4352</para> 4353</refsect1> 4354</refentry> 4355 4356<refentry id="API-scsi-netlink-init"> 4357<refentryinfo> 4358 <title>LINUX</title> 4359 <productname>Kernel Hackers Manual</productname> 4360 <date>July 2017</date> 4361</refentryinfo> 4362<refmeta> 4363 <refentrytitle><phrase>scsi_netlink_init</phrase></refentrytitle> 4364 <manvolnum>9</manvolnum> 4365 <refmiscinfo class="version">4.1.27</refmiscinfo> 4366</refmeta> 4367<refnamediv> 4368 <refname>scsi_netlink_init</refname> 4369 <refpurpose> 4370 Called by SCSI subsystem to initialize the SCSI transport netlink interface 4371 </refpurpose> 4372</refnamediv> 4373<refsynopsisdiv> 4374 <title>Synopsis</title> 4375 <funcsynopsis><funcprototype> 4376 <funcdef>void <function>scsi_netlink_init </function></funcdef> 4377 <paramdef> <parameter>void</parameter></paramdef> 4378 </funcprototype></funcsynopsis> 4379</refsynopsisdiv> 4380<refsect1> 4381 <title>Arguments</title> 4382 <variablelist> 4383 <varlistentry> 4384 <term><parameter>void</parameter></term> 4385 <listitem> 4386 <para> 4387 no arguments 4388 </para> 4389 </listitem> 4390 </varlistentry> 4391 </variablelist> 4392</refsect1> 4393</refentry> 4394 4395<refentry id="API-scsi-netlink-exit"> 4396<refentryinfo> 4397 <title>LINUX</title> 4398 <productname>Kernel Hackers Manual</productname> 4399 <date>July 2017</date> 4400</refentryinfo> 4401<refmeta> 4402 <refentrytitle><phrase>scsi_netlink_exit</phrase></refentrytitle> 4403 <manvolnum>9</manvolnum> 4404 <refmiscinfo class="version">4.1.27</refmiscinfo> 4405</refmeta> 4406<refnamediv> 4407 <refname>scsi_netlink_exit</refname> 4408 <refpurpose> 4409 Called by SCSI subsystem to disable the SCSI transport netlink interface 4410 </refpurpose> 4411</refnamediv> 4412<refsynopsisdiv> 4413 <title>Synopsis</title> 4414 <funcsynopsis><funcprototype> 4415 <funcdef>void <function>scsi_netlink_exit </function></funcdef> 4416 <paramdef> <parameter>void</parameter></paramdef> 4417 </funcprototype></funcsynopsis> 4418</refsynopsisdiv> 4419<refsect1> 4420 <title>Arguments</title> 4421 <variablelist> 4422 <varlistentry> 4423 <term><parameter>void</parameter></term> 4424 <listitem> 4425 <para> 4426 no arguments 4427 </para> 4428 </listitem> 4429 </varlistentry> 4430 </variablelist> 4431</refsect1> 4432<refsect1> 4433<title>Description</title> 4434<para> 4435</para> 4436</refsect1> 4437</refentry> 4438 4439 </sect2> 4440 <sect2 id="scsi_scan.c"> 4441 <title>drivers/scsi/scsi_scan.c</title> 4442 <para> 4443 Scan a host to determine which (if any) devices are attached. 4444 4445 The general scanning/probing algorithm is as follows, exceptions are 4446 made to it depending on device specific flags, compilation options, 4447 and global variable (boot or module load time) settings. 4448 4449 A specific LUN is scanned via an INQUIRY command; if the LUN has a 4450 device attached, a scsi_device is allocated and setup for it. 4451 4452 For every id of every channel on the given host, start by scanning 4453 LUN 0. Skip hosts that don't respond at all to a scan of LUN 0. 4454 Otherwise, if LUN 0 has a device attached, allocate and setup a 4455 scsi_device for it. If target is SCSI-3 or up, issue a REPORT LUN, 4456 and scan all of the LUNs returned by the REPORT LUN; else, 4457 sequentially scan LUNs up until some maximum is reached, or a LUN is 4458 seen that cannot have a device attached to it. 4459 </para> 4460<!-- drivers/scsi/scsi_scan.c --> 4461<refentry id="API-scsi-complete-async-scans"> 4462<refentryinfo> 4463 <title>LINUX</title> 4464 <productname>Kernel Hackers Manual</productname> 4465 <date>July 2017</date> 4466</refentryinfo> 4467<refmeta> 4468 <refentrytitle><phrase>scsi_complete_async_scans</phrase></refentrytitle> 4469 <manvolnum>9</manvolnum> 4470 <refmiscinfo class="version">4.1.27</refmiscinfo> 4471</refmeta> 4472<refnamediv> 4473 <refname>scsi_complete_async_scans</refname> 4474 <refpurpose> 4475 Wait for asynchronous scans to complete 4476 </refpurpose> 4477</refnamediv> 4478<refsynopsisdiv> 4479 <title>Synopsis</title> 4480 <funcsynopsis><funcprototype> 4481 <funcdef>int <function>scsi_complete_async_scans </function></funcdef> 4482 <paramdef> <parameter>void</parameter></paramdef> 4483 </funcprototype></funcsynopsis> 4484</refsynopsisdiv> 4485<refsect1> 4486 <title>Arguments</title> 4487 <variablelist> 4488 <varlistentry> 4489 <term><parameter>void</parameter></term> 4490 <listitem> 4491 <para> 4492 no arguments 4493 </para> 4494 </listitem> 4495 </varlistentry> 4496 </variablelist> 4497</refsect1> 4498<refsect1> 4499<title>Description</title> 4500<para> 4501 </para><para> 4502 4503 When this function returns, any host which started scanning before 4504 this function was called will have finished its scan. Hosts which 4505 started scanning after this function was called may or may not have 4506 finished. 4507</para> 4508</refsect1> 4509</refentry> 4510 4511<refentry id="API-scsi-unlock-floptical"> 4512<refentryinfo> 4513 <title>LINUX</title> 4514 <productname>Kernel Hackers Manual</productname> 4515 <date>July 2017</date> 4516</refentryinfo> 4517<refmeta> 4518 <refentrytitle><phrase>scsi_unlock_floptical</phrase></refentrytitle> 4519 <manvolnum>9</manvolnum> 4520 <refmiscinfo class="version">4.1.27</refmiscinfo> 4521</refmeta> 4522<refnamediv> 4523 <refname>scsi_unlock_floptical</refname> 4524 <refpurpose> 4525 unlock device via a special MODE SENSE command 4526 </refpurpose> 4527</refnamediv> 4528<refsynopsisdiv> 4529 <title>Synopsis</title> 4530 <funcsynopsis><funcprototype> 4531 <funcdef>void <function>scsi_unlock_floptical </function></funcdef> 4532 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 4533 <paramdef>unsigned char * <parameter>result</parameter></paramdef> 4534 </funcprototype></funcsynopsis> 4535</refsynopsisdiv> 4536<refsect1> 4537 <title>Arguments</title> 4538 <variablelist> 4539 <varlistentry> 4540 <term><parameter>sdev</parameter></term> 4541 <listitem> 4542 <para> 4543 scsi device to send command to 4544 </para> 4545 </listitem> 4546 </varlistentry> 4547 <varlistentry> 4548 <term><parameter>result</parameter></term> 4549 <listitem> 4550 <para> 4551 area to store the result of the MODE SENSE 4552 </para> 4553 </listitem> 4554 </varlistentry> 4555 </variablelist> 4556</refsect1> 4557<refsect1> 4558<title>Description</title> 4559<para> 4560 Send a vendor specific MODE SENSE (not a MODE SELECT) command. 4561 Called for BLIST_KEY devices. 4562</para> 4563</refsect1> 4564</refentry> 4565 4566<refentry id="API-scsi-alloc-sdev"> 4567<refentryinfo> 4568 <title>LINUX</title> 4569 <productname>Kernel Hackers Manual</productname> 4570 <date>July 2017</date> 4571</refentryinfo> 4572<refmeta> 4573 <refentrytitle><phrase>scsi_alloc_sdev</phrase></refentrytitle> 4574 <manvolnum>9</manvolnum> 4575 <refmiscinfo class="version">4.1.27</refmiscinfo> 4576</refmeta> 4577<refnamediv> 4578 <refname>scsi_alloc_sdev</refname> 4579 <refpurpose> 4580 allocate and setup a scsi_Device 4581 </refpurpose> 4582</refnamediv> 4583<refsynopsisdiv> 4584 <title>Synopsis</title> 4585 <funcsynopsis><funcprototype> 4586 <funcdef>struct scsi_device * <function>scsi_alloc_sdev </function></funcdef> 4587 <paramdef>struct scsi_target * <parameter>starget</parameter></paramdef> 4588 <paramdef>u64 <parameter>lun</parameter></paramdef> 4589 <paramdef>void * <parameter>hostdata</parameter></paramdef> 4590 </funcprototype></funcsynopsis> 4591</refsynopsisdiv> 4592<refsect1> 4593 <title>Arguments</title> 4594 <variablelist> 4595 <varlistentry> 4596 <term><parameter>starget</parameter></term> 4597 <listitem> 4598 <para> 4599 which target to allocate a <structname>scsi_device</structname> for 4600 </para> 4601 </listitem> 4602 </varlistentry> 4603 <varlistentry> 4604 <term><parameter>lun</parameter></term> 4605 <listitem> 4606 <para> 4607 which lun 4608 </para> 4609 </listitem> 4610 </varlistentry> 4611 <varlistentry> 4612 <term><parameter>hostdata</parameter></term> 4613 <listitem> 4614 <para> 4615 usually NULL and set by ->slave_alloc instead 4616 </para> 4617 </listitem> 4618 </varlistentry> 4619 </variablelist> 4620</refsect1> 4621<refsect1> 4622<title>Description</title> 4623<para> 4624 Allocate, initialize for io, and return a pointer to a scsi_Device. 4625 Stores the <parameter>shost</parameter>, <parameter>channel</parameter>, <parameter>id</parameter>, and <parameter>lun</parameter> in the scsi_Device, and 4626 adds scsi_Device to the appropriate list. 4627</para> 4628</refsect1> 4629<refsect1> 4630<title>Return value</title> 4631<para> 4632 scsi_Device pointer, or NULL on failure. 4633</para> 4634</refsect1> 4635</refentry> 4636 4637<refentry id="API-scsi-target-reap-ref-release"> 4638<refentryinfo> 4639 <title>LINUX</title> 4640 <productname>Kernel Hackers Manual</productname> 4641 <date>July 2017</date> 4642</refentryinfo> 4643<refmeta> 4644 <refentrytitle><phrase>scsi_target_reap_ref_release</phrase></refentrytitle> 4645 <manvolnum>9</manvolnum> 4646 <refmiscinfo class="version">4.1.27</refmiscinfo> 4647</refmeta> 4648<refnamediv> 4649 <refname>scsi_target_reap_ref_release</refname> 4650 <refpurpose> 4651 remove target from visibility 4652 </refpurpose> 4653</refnamediv> 4654<refsynopsisdiv> 4655 <title>Synopsis</title> 4656 <funcsynopsis><funcprototype> 4657 <funcdef>void <function>scsi_target_reap_ref_release </function></funcdef> 4658 <paramdef>struct kref * <parameter>kref</parameter></paramdef> 4659 </funcprototype></funcsynopsis> 4660</refsynopsisdiv> 4661<refsect1> 4662 <title>Arguments</title> 4663 <variablelist> 4664 <varlistentry> 4665 <term><parameter>kref</parameter></term> 4666 <listitem> 4667 <para> 4668 the reap_ref in the target being released 4669 </para> 4670 </listitem> 4671 </varlistentry> 4672 </variablelist> 4673</refsect1> 4674<refsect1> 4675<title>Description</title> 4676<para> 4677 Called on last put of reap_ref, which is the indication that no device 4678 under this target is visible anymore, so render the target invisible in 4679 sysfs. Note: we have to be in user context here because the target reaps 4680 should be done in places where the scsi device visibility is being removed. 4681</para> 4682</refsect1> 4683</refentry> 4684 4685<refentry id="API-scsi-alloc-target"> 4686<refentryinfo> 4687 <title>LINUX</title> 4688 <productname>Kernel Hackers Manual</productname> 4689 <date>July 2017</date> 4690</refentryinfo> 4691<refmeta> 4692 <refentrytitle><phrase>scsi_alloc_target</phrase></refentrytitle> 4693 <manvolnum>9</manvolnum> 4694 <refmiscinfo class="version">4.1.27</refmiscinfo> 4695</refmeta> 4696<refnamediv> 4697 <refname>scsi_alloc_target</refname> 4698 <refpurpose> 4699 allocate a new or find an existing target 4700 </refpurpose> 4701</refnamediv> 4702<refsynopsisdiv> 4703 <title>Synopsis</title> 4704 <funcsynopsis><funcprototype> 4705 <funcdef>struct scsi_target * <function>scsi_alloc_target </function></funcdef> 4706 <paramdef>struct device * <parameter>parent</parameter></paramdef> 4707 <paramdef>int <parameter>channel</parameter></paramdef> 4708 <paramdef>uint <parameter>id</parameter></paramdef> 4709 </funcprototype></funcsynopsis> 4710</refsynopsisdiv> 4711<refsect1> 4712 <title>Arguments</title> 4713 <variablelist> 4714 <varlistentry> 4715 <term><parameter>parent</parameter></term> 4716 <listitem> 4717 <para> 4718 parent of the target (need not be a scsi host) 4719 </para> 4720 </listitem> 4721 </varlistentry> 4722 <varlistentry> 4723 <term><parameter>channel</parameter></term> 4724 <listitem> 4725 <para> 4726 target channel number (zero if no channels) 4727 </para> 4728 </listitem> 4729 </varlistentry> 4730 <varlistentry> 4731 <term><parameter>id</parameter></term> 4732 <listitem> 4733 <para> 4734 target id number 4735 </para> 4736 </listitem> 4737 </varlistentry> 4738 </variablelist> 4739</refsect1> 4740<refsect1> 4741<title>Description</title> 4742<para> 4743 Return an existing target if one exists, provided it hasn't already 4744 gone into STARGET_DEL state, otherwise allocate a new target. 4745 </para><para> 4746 4747 The target is returned with an incremented reference, so the caller 4748 is responsible for both reaping and doing a last put 4749</para> 4750</refsect1> 4751</refentry> 4752 4753<refentry id="API-scsi-target-reap"> 4754<refentryinfo> 4755 <title>LINUX</title> 4756 <productname>Kernel Hackers Manual</productname> 4757 <date>July 2017</date> 4758</refentryinfo> 4759<refmeta> 4760 <refentrytitle><phrase>scsi_target_reap</phrase></refentrytitle> 4761 <manvolnum>9</manvolnum> 4762 <refmiscinfo class="version">4.1.27</refmiscinfo> 4763</refmeta> 4764<refnamediv> 4765 <refname>scsi_target_reap</refname> 4766 <refpurpose> 4767 check to see if target is in use and destroy if not 4768 </refpurpose> 4769</refnamediv> 4770<refsynopsisdiv> 4771 <title>Synopsis</title> 4772 <funcsynopsis><funcprototype> 4773 <funcdef>void <function>scsi_target_reap </function></funcdef> 4774 <paramdef>struct scsi_target * <parameter>starget</parameter></paramdef> 4775 </funcprototype></funcsynopsis> 4776</refsynopsisdiv> 4777<refsect1> 4778 <title>Arguments</title> 4779 <variablelist> 4780 <varlistentry> 4781 <term><parameter>starget</parameter></term> 4782 <listitem> 4783 <para> 4784 target to be checked 4785 </para> 4786 </listitem> 4787 </varlistentry> 4788 </variablelist> 4789</refsect1> 4790<refsect1> 4791<title>Description</title> 4792<para> 4793 This is used after removing a LUN or doing a last put of the target 4794 it checks atomically that nothing is using the target and removes 4795 it if so. 4796</para> 4797</refsect1> 4798</refentry> 4799 4800<refentry id="API-sanitize-inquiry-string"> 4801<refentryinfo> 4802 <title>LINUX</title> 4803 <productname>Kernel Hackers Manual</productname> 4804 <date>July 2017</date> 4805</refentryinfo> 4806<refmeta> 4807 <refentrytitle><phrase>sanitize_inquiry_string</phrase></refentrytitle> 4808 <manvolnum>9</manvolnum> 4809 <refmiscinfo class="version">4.1.27</refmiscinfo> 4810</refmeta> 4811<refnamediv> 4812 <refname>sanitize_inquiry_string</refname> 4813 <refpurpose> 4814 remove non-graphical chars from an INQUIRY result string 4815 </refpurpose> 4816</refnamediv> 4817<refsynopsisdiv> 4818 <title>Synopsis</title> 4819 <funcsynopsis><funcprototype> 4820 <funcdef>void <function>sanitize_inquiry_string </function></funcdef> 4821 <paramdef>unsigned char * <parameter>s</parameter></paramdef> 4822 <paramdef>int <parameter>len</parameter></paramdef> 4823 </funcprototype></funcsynopsis> 4824</refsynopsisdiv> 4825<refsect1> 4826 <title>Arguments</title> 4827 <variablelist> 4828 <varlistentry> 4829 <term><parameter>s</parameter></term> 4830 <listitem> 4831 <para> 4832 INQUIRY result string to sanitize 4833 </para> 4834 </listitem> 4835 </varlistentry> 4836 <varlistentry> 4837 <term><parameter>len</parameter></term> 4838 <listitem> 4839 <para> 4840 length of the string 4841 </para> 4842 </listitem> 4843 </varlistentry> 4844 </variablelist> 4845</refsect1> 4846<refsect1> 4847<title>Description</title> 4848<para> 4849 The SCSI spec says that INQUIRY vendor, product, and revision 4850 strings must consist entirely of graphic ASCII characters, 4851 padded on the right with spaces. Since not all devices obey 4852 this rule, we will replace non-graphic or non-ASCII characters 4853 with spaces. Exception: a NUL character is interpreted as a 4854 string terminator, so all the following characters are set to 4855 spaces. 4856</para> 4857</refsect1> 4858</refentry> 4859 4860<refentry id="API-scsi-probe-lun"> 4861<refentryinfo> 4862 <title>LINUX</title> 4863 <productname>Kernel Hackers Manual</productname> 4864 <date>July 2017</date> 4865</refentryinfo> 4866<refmeta> 4867 <refentrytitle><phrase>scsi_probe_lun</phrase></refentrytitle> 4868 <manvolnum>9</manvolnum> 4869 <refmiscinfo class="version">4.1.27</refmiscinfo> 4870</refmeta> 4871<refnamediv> 4872 <refname>scsi_probe_lun</refname> 4873 <refpurpose> 4874 probe a single LUN using a SCSI INQUIRY 4875 </refpurpose> 4876</refnamediv> 4877<refsynopsisdiv> 4878 <title>Synopsis</title> 4879 <funcsynopsis><funcprototype> 4880 <funcdef>int <function>scsi_probe_lun </function></funcdef> 4881 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 4882 <paramdef>unsigned char * <parameter>inq_result</parameter></paramdef> 4883 <paramdef>int <parameter>result_len</parameter></paramdef> 4884 <paramdef>int * <parameter>bflags</parameter></paramdef> 4885 </funcprototype></funcsynopsis> 4886</refsynopsisdiv> 4887<refsect1> 4888 <title>Arguments</title> 4889 <variablelist> 4890 <varlistentry> 4891 <term><parameter>sdev</parameter></term> 4892 <listitem> 4893 <para> 4894 scsi_device to probe 4895 </para> 4896 </listitem> 4897 </varlistentry> 4898 <varlistentry> 4899 <term><parameter>inq_result</parameter></term> 4900 <listitem> 4901 <para> 4902 area to store the INQUIRY result 4903 </para> 4904 </listitem> 4905 </varlistentry> 4906 <varlistentry> 4907 <term><parameter>result_len</parameter></term> 4908 <listitem> 4909 <para> 4910 len of inq_result 4911 </para> 4912 </listitem> 4913 </varlistentry> 4914 <varlistentry> 4915 <term><parameter>bflags</parameter></term> 4916 <listitem> 4917 <para> 4918 store any bflags found here 4919 </para> 4920 </listitem> 4921 </varlistentry> 4922 </variablelist> 4923</refsect1> 4924<refsect1> 4925<title>Description</title> 4926<para> 4927 Probe the lun associated with <parameter>req</parameter> using a standard SCSI INQUIRY; 4928 </para><para> 4929 4930 If the INQUIRY is successful, zero is returned and the 4931 INQUIRY data is in <parameter>inq_result</parameter>; the scsi_level and INQUIRY length 4932 are copied to the scsi_device any flags value is stored in *<parameter>bflags</parameter>. 4933</para> 4934</refsect1> 4935</refentry> 4936 4937<refentry id="API-scsi-add-lun"> 4938<refentryinfo> 4939 <title>LINUX</title> 4940 <productname>Kernel Hackers Manual</productname> 4941 <date>July 2017</date> 4942</refentryinfo> 4943<refmeta> 4944 <refentrytitle><phrase>scsi_add_lun</phrase></refentrytitle> 4945 <manvolnum>9</manvolnum> 4946 <refmiscinfo class="version">4.1.27</refmiscinfo> 4947</refmeta> 4948<refnamediv> 4949 <refname>scsi_add_lun</refname> 4950 <refpurpose> 4951 allocate and fully initialze a scsi_device 4952 </refpurpose> 4953</refnamediv> 4954<refsynopsisdiv> 4955 <title>Synopsis</title> 4956 <funcsynopsis><funcprototype> 4957 <funcdef>int <function>scsi_add_lun </function></funcdef> 4958 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 4959 <paramdef>unsigned char * <parameter>inq_result</parameter></paramdef> 4960 <paramdef>int * <parameter>bflags</parameter></paramdef> 4961 <paramdef>int <parameter>async</parameter></paramdef> 4962 </funcprototype></funcsynopsis> 4963</refsynopsisdiv> 4964<refsect1> 4965 <title>Arguments</title> 4966 <variablelist> 4967 <varlistentry> 4968 <term><parameter>sdev</parameter></term> 4969 <listitem> 4970 <para> 4971 holds information to be stored in the new scsi_device 4972 </para> 4973 </listitem> 4974 </varlistentry> 4975 <varlistentry> 4976 <term><parameter>inq_result</parameter></term> 4977 <listitem> 4978 <para> 4979 holds the result of a previous INQUIRY to the LUN 4980 </para> 4981 </listitem> 4982 </varlistentry> 4983 <varlistentry> 4984 <term><parameter>bflags</parameter></term> 4985 <listitem> 4986 <para> 4987 black/white list flag 4988 </para> 4989 </listitem> 4990 </varlistentry> 4991 <varlistentry> 4992 <term><parameter>async</parameter></term> 4993 <listitem> 4994 <para> 4995 1 if this device is being scanned asynchronously 4996 </para> 4997 </listitem> 4998 </varlistentry> 4999 </variablelist> 5000</refsect1> 5001<refsect1> 5002<title>Description</title> 5003<para> 5004 Initialize the scsi_device <parameter>sdev</parameter>. Optionally set fields based 5005 on values in *<parameter>bflags</parameter>. 5006</para> 5007</refsect1> 5008<refsect1> 5009<title>SCSI_SCAN_NO_RESPONSE</title> 5010<para> 5011 could not allocate or setup a scsi_device 5012</para> 5013</refsect1> 5014<refsect1> 5015<title>SCSI_SCAN_LUN_PRESENT</title> 5016<para> 5017 a new scsi_device was allocated and initialized 5018</para> 5019</refsect1> 5020</refentry> 5021 5022<refentry id="API-scsi-inq-str"> 5023<refentryinfo> 5024 <title>LINUX</title> 5025 <productname>Kernel Hackers Manual</productname> 5026 <date>July 2017</date> 5027</refentryinfo> 5028<refmeta> 5029 <refentrytitle><phrase>scsi_inq_str</phrase></refentrytitle> 5030 <manvolnum>9</manvolnum> 5031 <refmiscinfo class="version">4.1.27</refmiscinfo> 5032</refmeta> 5033<refnamediv> 5034 <refname>scsi_inq_str</refname> 5035 <refpurpose> 5036 print INQUIRY data from min to max index, strip trailing whitespace 5037 </refpurpose> 5038</refnamediv> 5039<refsynopsisdiv> 5040 <title>Synopsis</title> 5041 <funcsynopsis><funcprototype> 5042 <funcdef>unsigned char * <function>scsi_inq_str </function></funcdef> 5043 <paramdef>unsigned char * <parameter>buf</parameter></paramdef> 5044 <paramdef>unsigned char * <parameter>inq</parameter></paramdef> 5045 <paramdef>unsigned <parameter>first</parameter></paramdef> 5046 <paramdef>unsigned <parameter>end</parameter></paramdef> 5047 </funcprototype></funcsynopsis> 5048</refsynopsisdiv> 5049<refsect1> 5050 <title>Arguments</title> 5051 <variablelist> 5052 <varlistentry> 5053 <term><parameter>buf</parameter></term> 5054 <listitem> 5055 <para> 5056 Output buffer with at least end-first+1 bytes of space 5057 </para> 5058 </listitem> 5059 </varlistentry> 5060 <varlistentry> 5061 <term><parameter>inq</parameter></term> 5062 <listitem> 5063 <para> 5064 Inquiry buffer (input) 5065 </para> 5066 </listitem> 5067 </varlistentry> 5068 <varlistentry> 5069 <term><parameter>first</parameter></term> 5070 <listitem> 5071 <para> 5072 Offset of string into inq 5073 </para> 5074 </listitem> 5075 </varlistentry> 5076 <varlistentry> 5077 <term><parameter>end</parameter></term> 5078 <listitem> 5079 <para> 5080 Index after last character in inq 5081 </para> 5082 </listitem> 5083 </varlistentry> 5084 </variablelist> 5085</refsect1> 5086</refentry> 5087 5088<refentry id="API-scsi-probe-and-add-lun"> 5089<refentryinfo> 5090 <title>LINUX</title> 5091 <productname>Kernel Hackers Manual</productname> 5092 <date>July 2017</date> 5093</refentryinfo> 5094<refmeta> 5095 <refentrytitle><phrase>scsi_probe_and_add_lun</phrase></refentrytitle> 5096 <manvolnum>9</manvolnum> 5097 <refmiscinfo class="version">4.1.27</refmiscinfo> 5098</refmeta> 5099<refnamediv> 5100 <refname>scsi_probe_and_add_lun</refname> 5101 <refpurpose> 5102 probe a LUN, if a LUN is found add it 5103 </refpurpose> 5104</refnamediv> 5105<refsynopsisdiv> 5106 <title>Synopsis</title> 5107 <funcsynopsis><funcprototype> 5108 <funcdef>int <function>scsi_probe_and_add_lun </function></funcdef> 5109 <paramdef>struct scsi_target * <parameter>starget</parameter></paramdef> 5110 <paramdef>u64 <parameter>lun</parameter></paramdef> 5111 <paramdef>int * <parameter>bflagsp</parameter></paramdef> 5112 <paramdef>struct scsi_device ** <parameter>sdevp</parameter></paramdef> 5113 <paramdef>int <parameter>rescan</parameter></paramdef> 5114 <paramdef>void * <parameter>hostdata</parameter></paramdef> 5115 </funcprototype></funcsynopsis> 5116</refsynopsisdiv> 5117<refsect1> 5118 <title>Arguments</title> 5119 <variablelist> 5120 <varlistentry> 5121 <term><parameter>starget</parameter></term> 5122 <listitem> 5123 <para> 5124 pointer to target device structure 5125 </para> 5126 </listitem> 5127 </varlistentry> 5128 <varlistentry> 5129 <term><parameter>lun</parameter></term> 5130 <listitem> 5131 <para> 5132 LUN of target device 5133 </para> 5134 </listitem> 5135 </varlistentry> 5136 <varlistentry> 5137 <term><parameter>bflagsp</parameter></term> 5138 <listitem> 5139 <para> 5140 store bflags here if not NULL 5141 </para> 5142 </listitem> 5143 </varlistentry> 5144 <varlistentry> 5145 <term><parameter>sdevp</parameter></term> 5146 <listitem> 5147 <para> 5148 probe the LUN corresponding to this scsi_device 5149 </para> 5150 </listitem> 5151 </varlistentry> 5152 <varlistentry> 5153 <term><parameter>rescan</parameter></term> 5154 <listitem> 5155 <para> 5156 if nonzero skip some code only needed on first scan 5157 </para> 5158 </listitem> 5159 </varlistentry> 5160 <varlistentry> 5161 <term><parameter>hostdata</parameter></term> 5162 <listitem> 5163 <para> 5164 passed to <function>scsi_alloc_sdev</function> 5165 </para> 5166 </listitem> 5167 </varlistentry> 5168 </variablelist> 5169</refsect1> 5170<refsect1> 5171<title>Description</title> 5172<para> 5173 Call scsi_probe_lun, if a LUN with an attached device is found, 5174 allocate and set it up by calling scsi_add_lun. 5175</para> 5176</refsect1> 5177<refsect1> 5178<title>SCSI_SCAN_NO_RESPONSE</title> 5179<para> 5180 could not allocate or setup a scsi_device 5181</para> 5182</refsect1> 5183<refsect1> 5184<title>SCSI_SCAN_TARGET_PRESENT</title> 5185<para> 5186 target responded, but no device is 5187 attached at the LUN 5188</para> 5189</refsect1> 5190<refsect1> 5191<title>SCSI_SCAN_LUN_PRESENT</title> 5192<para> 5193 a new scsi_device was allocated and initialized 5194</para> 5195</refsect1> 5196</refentry> 5197 5198<refentry id="API-scsi-sequential-lun-scan"> 5199<refentryinfo> 5200 <title>LINUX</title> 5201 <productname>Kernel Hackers Manual</productname> 5202 <date>July 2017</date> 5203</refentryinfo> 5204<refmeta> 5205 <refentrytitle><phrase>scsi_sequential_lun_scan</phrase></refentrytitle> 5206 <manvolnum>9</manvolnum> 5207 <refmiscinfo class="version">4.1.27</refmiscinfo> 5208</refmeta> 5209<refnamediv> 5210 <refname>scsi_sequential_lun_scan</refname> 5211 <refpurpose> 5212 sequentially scan a SCSI target 5213 </refpurpose> 5214</refnamediv> 5215<refsynopsisdiv> 5216 <title>Synopsis</title> 5217 <funcsynopsis><funcprototype> 5218 <funcdef>void <function>scsi_sequential_lun_scan </function></funcdef> 5219 <paramdef>struct scsi_target * <parameter>starget</parameter></paramdef> 5220 <paramdef>int <parameter>bflags</parameter></paramdef> 5221 <paramdef>int <parameter>scsi_level</parameter></paramdef> 5222 <paramdef>int <parameter>rescan</parameter></paramdef> 5223 </funcprototype></funcsynopsis> 5224</refsynopsisdiv> 5225<refsect1> 5226 <title>Arguments</title> 5227 <variablelist> 5228 <varlistentry> 5229 <term><parameter>starget</parameter></term> 5230 <listitem> 5231 <para> 5232 pointer to target structure to scan 5233 </para> 5234 </listitem> 5235 </varlistentry> 5236 <varlistentry> 5237 <term><parameter>bflags</parameter></term> 5238 <listitem> 5239 <para> 5240 black/white list flag for LUN 0 5241 </para> 5242 </listitem> 5243 </varlistentry> 5244 <varlistentry> 5245 <term><parameter>scsi_level</parameter></term> 5246 <listitem> 5247 <para> 5248 Which version of the standard does this device adhere to 5249 </para> 5250 </listitem> 5251 </varlistentry> 5252 <varlistentry> 5253 <term><parameter>rescan</parameter></term> 5254 <listitem> 5255 <para> 5256 passed to <function>scsi_probe_add_lun</function> 5257 </para> 5258 </listitem> 5259 </varlistentry> 5260 </variablelist> 5261</refsect1> 5262<refsect1> 5263<title>Description</title> 5264<para> 5265 Generally, scan from LUN 1 (LUN 0 is assumed to already have been 5266 scanned) to some maximum lun until a LUN is found with no device 5267 attached. Use the bflags to figure out any oddities. 5268 </para><para> 5269 5270 Modifies sdevscan->lun. 5271</para> 5272</refsect1> 5273</refentry> 5274 5275<refentry id="API-scsi-report-lun-scan"> 5276<refentryinfo> 5277 <title>LINUX</title> 5278 <productname>Kernel Hackers Manual</productname> 5279 <date>July 2017</date> 5280</refentryinfo> 5281<refmeta> 5282 <refentrytitle><phrase>scsi_report_lun_scan</phrase></refentrytitle> 5283 <manvolnum>9</manvolnum> 5284 <refmiscinfo class="version">4.1.27</refmiscinfo> 5285</refmeta> 5286<refnamediv> 5287 <refname>scsi_report_lun_scan</refname> 5288 <refpurpose> 5289 Scan using SCSI REPORT LUN results 5290 </refpurpose> 5291</refnamediv> 5292<refsynopsisdiv> 5293 <title>Synopsis</title> 5294 <funcsynopsis><funcprototype> 5295 <funcdef>int <function>scsi_report_lun_scan </function></funcdef> 5296 <paramdef>struct scsi_target * <parameter>starget</parameter></paramdef> 5297 <paramdef>int <parameter>bflags</parameter></paramdef> 5298 <paramdef>int <parameter>rescan</parameter></paramdef> 5299 </funcprototype></funcsynopsis> 5300</refsynopsisdiv> 5301<refsect1> 5302 <title>Arguments</title> 5303 <variablelist> 5304 <varlistentry> 5305 <term><parameter>starget</parameter></term> 5306 <listitem> 5307 <para> 5308 which target 5309 </para> 5310 </listitem> 5311 </varlistentry> 5312 <varlistentry> 5313 <term><parameter>bflags</parameter></term> 5314 <listitem> 5315 <para> 5316 Zero or a mix of BLIST_NOLUN, BLIST_REPORTLUN2, or BLIST_NOREPORTLUN 5317 </para> 5318 </listitem> 5319 </varlistentry> 5320 <varlistentry> 5321 <term><parameter>rescan</parameter></term> 5322 <listitem> 5323 <para> 5324 nonzero if we can skip code only needed on first scan 5325 </para> 5326 </listitem> 5327 </varlistentry> 5328 </variablelist> 5329</refsect1> 5330<refsect1> 5331<title>Description</title> 5332<para> 5333 Fast scanning for modern (SCSI-3) devices by sending a REPORT LUN command. 5334 Scan the resulting list of LUNs by calling scsi_probe_and_add_lun. 5335 </para><para> 5336 5337 If BLINK_REPORTLUN2 is set, scan a target that supports more than 8 5338 LUNs even if it's older than SCSI-3. 5339 If BLIST_NOREPORTLUN is set, return 1 always. 5340 If BLIST_NOLUN is set, return 0 always. 5341 If starget->no_report_luns is set, return 1 always. 5342</para> 5343</refsect1> 5344<refsect1> 5345<title>0</title> 5346<para> 5347 scan completed (or no memory, so further scanning is futile) 5348</para> 5349</refsect1> 5350<refsect1> 5351<title>1</title> 5352<para> 5353 could not scan with REPORT LUN 5354</para> 5355</refsect1> 5356</refentry> 5357 5358<refentry id="API-scsi-prep-async-scan"> 5359<refentryinfo> 5360 <title>LINUX</title> 5361 <productname>Kernel Hackers Manual</productname> 5362 <date>July 2017</date> 5363</refentryinfo> 5364<refmeta> 5365 <refentrytitle><phrase>scsi_prep_async_scan</phrase></refentrytitle> 5366 <manvolnum>9</manvolnum> 5367 <refmiscinfo class="version">4.1.27</refmiscinfo> 5368</refmeta> 5369<refnamediv> 5370 <refname>scsi_prep_async_scan</refname> 5371 <refpurpose> 5372 prepare for an async scan 5373 </refpurpose> 5374</refnamediv> 5375<refsynopsisdiv> 5376 <title>Synopsis</title> 5377 <funcsynopsis><funcprototype> 5378 <funcdef>struct async_scan_data * <function>scsi_prep_async_scan </function></funcdef> 5379 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 5380 </funcprototype></funcsynopsis> 5381</refsynopsisdiv> 5382<refsect1> 5383 <title>Arguments</title> 5384 <variablelist> 5385 <varlistentry> 5386 <term><parameter>shost</parameter></term> 5387 <listitem> 5388 <para> 5389 the host which will be scanned 5390 </para> 5391 </listitem> 5392 </varlistentry> 5393 </variablelist> 5394</refsect1> 5395<refsect1> 5396<title>Returns</title> 5397<para> 5398 a cookie to be passed to <function>scsi_finish_async_scan</function> 5399 </para><para> 5400 5401 Tells the midlayer this host is going to do an asynchronous scan. 5402 It reserves the host's position in the scanning list and ensures 5403 that other asynchronous scans started after this one won't affect the 5404 ordering of the discovered devices. 5405</para> 5406</refsect1> 5407</refentry> 5408 5409<refentry id="API-scsi-finish-async-scan"> 5410<refentryinfo> 5411 <title>LINUX</title> 5412 <productname>Kernel Hackers Manual</productname> 5413 <date>July 2017</date> 5414</refentryinfo> 5415<refmeta> 5416 <refentrytitle><phrase>scsi_finish_async_scan</phrase></refentrytitle> 5417 <manvolnum>9</manvolnum> 5418 <refmiscinfo class="version">4.1.27</refmiscinfo> 5419</refmeta> 5420<refnamediv> 5421 <refname>scsi_finish_async_scan</refname> 5422 <refpurpose> 5423 asynchronous scan has finished 5424 </refpurpose> 5425</refnamediv> 5426<refsynopsisdiv> 5427 <title>Synopsis</title> 5428 <funcsynopsis><funcprototype> 5429 <funcdef>void <function>scsi_finish_async_scan </function></funcdef> 5430 <paramdef>struct async_scan_data * <parameter>data</parameter></paramdef> 5431 </funcprototype></funcsynopsis> 5432</refsynopsisdiv> 5433<refsect1> 5434 <title>Arguments</title> 5435 <variablelist> 5436 <varlistentry> 5437 <term><parameter>data</parameter></term> 5438 <listitem> 5439 <para> 5440 cookie returned from earlier call to <function>scsi_prep_async_scan</function> 5441 </para> 5442 </listitem> 5443 </varlistentry> 5444 </variablelist> 5445</refsect1> 5446<refsect1> 5447<title>Description</title> 5448<para> 5449 All the devices currently attached to this host have been found. 5450 This function announces all the devices it has found to the rest 5451 of the system. 5452</para> 5453</refsect1> 5454</refentry> 5455 5456 </sect2> 5457 <sect2 id="scsi_sysctl.c"> 5458 <title>drivers/scsi/scsi_sysctl.c</title> 5459 <para> 5460 Set up the sysctl entry: "/dev/scsi/logging_level" 5461 (DEV_SCSI_LOGGING_LEVEL) which sets/returns scsi_logging_level. 5462 </para> 5463 </sect2> 5464 <sect2 id="scsi_sysfs.c"> 5465 <title>drivers/scsi/scsi_sysfs.c</title> 5466 <para> 5467 SCSI sysfs interface routines. 5468 </para> 5469<!-- drivers/scsi/scsi_sysfs.c --> 5470<refentry id="API-scsi-remove-device"> 5471<refentryinfo> 5472 <title>LINUX</title> 5473 <productname>Kernel Hackers Manual</productname> 5474 <date>July 2017</date> 5475</refentryinfo> 5476<refmeta> 5477 <refentrytitle><phrase>scsi_remove_device</phrase></refentrytitle> 5478 <manvolnum>9</manvolnum> 5479 <refmiscinfo class="version">4.1.27</refmiscinfo> 5480</refmeta> 5481<refnamediv> 5482 <refname>scsi_remove_device</refname> 5483 <refpurpose> 5484 unregister a device from the scsi bus 5485 </refpurpose> 5486</refnamediv> 5487<refsynopsisdiv> 5488 <title>Synopsis</title> 5489 <funcsynopsis><funcprototype> 5490 <funcdef>void <function>scsi_remove_device </function></funcdef> 5491 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 5492 </funcprototype></funcsynopsis> 5493</refsynopsisdiv> 5494<refsect1> 5495 <title>Arguments</title> 5496 <variablelist> 5497 <varlistentry> 5498 <term><parameter>sdev</parameter></term> 5499 <listitem> 5500 <para> 5501 scsi_device to unregister 5502 </para> 5503 </listitem> 5504 </varlistentry> 5505 </variablelist> 5506</refsect1> 5507</refentry> 5508 5509<refentry id="API-scsi-remove-target"> 5510<refentryinfo> 5511 <title>LINUX</title> 5512 <productname>Kernel Hackers Manual</productname> 5513 <date>July 2017</date> 5514</refentryinfo> 5515<refmeta> 5516 <refentrytitle><phrase>scsi_remove_target</phrase></refentrytitle> 5517 <manvolnum>9</manvolnum> 5518 <refmiscinfo class="version">4.1.27</refmiscinfo> 5519</refmeta> 5520<refnamediv> 5521 <refname>scsi_remove_target</refname> 5522 <refpurpose> 5523 try to remove a target and all its devices 5524 </refpurpose> 5525</refnamediv> 5526<refsynopsisdiv> 5527 <title>Synopsis</title> 5528 <funcsynopsis><funcprototype> 5529 <funcdef>void <function>scsi_remove_target </function></funcdef> 5530 <paramdef>struct device * <parameter>dev</parameter></paramdef> 5531 </funcprototype></funcsynopsis> 5532</refsynopsisdiv> 5533<refsect1> 5534 <title>Arguments</title> 5535 <variablelist> 5536 <varlistentry> 5537 <term><parameter>dev</parameter></term> 5538 <listitem> 5539 <para> 5540 generic starget or parent of generic stargets to be removed 5541 </para> 5542 </listitem> 5543 </varlistentry> 5544 </variablelist> 5545</refsect1> 5546<refsect1> 5547<title>Note</title> 5548<para> 5549 This is slightly racy. It is possible that if the user 5550 requests the addition of another device then the target won't be 5551 removed. 5552</para> 5553</refsect1> 5554</refentry> 5555 5556 </sect2> 5557 <sect2 id="hosts.c"> 5558 <title>drivers/scsi/hosts.c</title> 5559 <para> 5560 mid to lowlevel SCSI driver interface 5561 </para> 5562<!-- drivers/scsi/hosts.c --> 5563<refentry id="API-scsi-host-set-state"> 5564<refentryinfo> 5565 <title>LINUX</title> 5566 <productname>Kernel Hackers Manual</productname> 5567 <date>July 2017</date> 5568</refentryinfo> 5569<refmeta> 5570 <refentrytitle><phrase>scsi_host_set_state</phrase></refentrytitle> 5571 <manvolnum>9</manvolnum> 5572 <refmiscinfo class="version">4.1.27</refmiscinfo> 5573</refmeta> 5574<refnamediv> 5575 <refname>scsi_host_set_state</refname> 5576 <refpurpose> 5577 Take the given host through the host state model. 5578 </refpurpose> 5579</refnamediv> 5580<refsynopsisdiv> 5581 <title>Synopsis</title> 5582 <funcsynopsis><funcprototype> 5583 <funcdef>int <function>scsi_host_set_state </function></funcdef> 5584 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 5585 <paramdef>enum scsi_host_state <parameter>state</parameter></paramdef> 5586 </funcprototype></funcsynopsis> 5587</refsynopsisdiv> 5588<refsect1> 5589 <title>Arguments</title> 5590 <variablelist> 5591 <varlistentry> 5592 <term><parameter>shost</parameter></term> 5593 <listitem> 5594 <para> 5595 scsi host to change the state of. 5596 </para> 5597 </listitem> 5598 </varlistentry> 5599 <varlistentry> 5600 <term><parameter>state</parameter></term> 5601 <listitem> 5602 <para> 5603 state to change to. 5604 </para> 5605 </listitem> 5606 </varlistentry> 5607 </variablelist> 5608</refsect1> 5609<refsect1> 5610<title>Description</title> 5611<para> 5612 Returns zero if unsuccessful or an error if the requested 5613 transition is illegal. 5614</para> 5615</refsect1> 5616</refentry> 5617 5618<refentry id="API-scsi-remove-host"> 5619<refentryinfo> 5620 <title>LINUX</title> 5621 <productname>Kernel Hackers Manual</productname> 5622 <date>July 2017</date> 5623</refentryinfo> 5624<refmeta> 5625 <refentrytitle><phrase>scsi_remove_host</phrase></refentrytitle> 5626 <manvolnum>9</manvolnum> 5627 <refmiscinfo class="version">4.1.27</refmiscinfo> 5628</refmeta> 5629<refnamediv> 5630 <refname>scsi_remove_host</refname> 5631 <refpurpose> 5632 remove a scsi host 5633 </refpurpose> 5634</refnamediv> 5635<refsynopsisdiv> 5636 <title>Synopsis</title> 5637 <funcsynopsis><funcprototype> 5638 <funcdef>void <function>scsi_remove_host </function></funcdef> 5639 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 5640 </funcprototype></funcsynopsis> 5641</refsynopsisdiv> 5642<refsect1> 5643 <title>Arguments</title> 5644 <variablelist> 5645 <varlistentry> 5646 <term><parameter>shost</parameter></term> 5647 <listitem> 5648 <para> 5649 a pointer to a scsi host to remove 5650 </para> 5651 </listitem> 5652 </varlistentry> 5653 </variablelist> 5654</refsect1> 5655</refentry> 5656 5657<refentry id="API-scsi-add-host-with-dma"> 5658<refentryinfo> 5659 <title>LINUX</title> 5660 <productname>Kernel Hackers Manual</productname> 5661 <date>July 2017</date> 5662</refentryinfo> 5663<refmeta> 5664 <refentrytitle><phrase>scsi_add_host_with_dma</phrase></refentrytitle> 5665 <manvolnum>9</manvolnum> 5666 <refmiscinfo class="version">4.1.27</refmiscinfo> 5667</refmeta> 5668<refnamediv> 5669 <refname>scsi_add_host_with_dma</refname> 5670 <refpurpose> 5671 add a scsi host with dma device 5672 </refpurpose> 5673</refnamediv> 5674<refsynopsisdiv> 5675 <title>Synopsis</title> 5676 <funcsynopsis><funcprototype> 5677 <funcdef>int <function>scsi_add_host_with_dma </function></funcdef> 5678 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 5679 <paramdef>struct device * <parameter>dev</parameter></paramdef> 5680 <paramdef>struct device * <parameter>dma_dev</parameter></paramdef> 5681 </funcprototype></funcsynopsis> 5682</refsynopsisdiv> 5683<refsect1> 5684 <title>Arguments</title> 5685 <variablelist> 5686 <varlistentry> 5687 <term><parameter>shost</parameter></term> 5688 <listitem> 5689 <para> 5690 scsi host pointer to add 5691 </para> 5692 </listitem> 5693 </varlistentry> 5694 <varlistentry> 5695 <term><parameter>dev</parameter></term> 5696 <listitem> 5697 <para> 5698 a struct device of type scsi class 5699 </para> 5700 </listitem> 5701 </varlistentry> 5702 <varlistentry> 5703 <term><parameter>dma_dev</parameter></term> 5704 <listitem> 5705 <para> 5706 dma device for the host 5707 </para> 5708 </listitem> 5709 </varlistentry> 5710 </variablelist> 5711</refsect1> 5712<refsect1> 5713<title>Note</title> 5714<para> 5715 You rarely need to worry about this unless you're in a 5716 virtualised host environments, so use the simpler <function>scsi_add_host</function> 5717 function instead. 5718</para> 5719</refsect1> 5720<refsect1> 5721<title>Return value</title> 5722<para> 5723 </para><para> 5724 5725 0 on success / != 0 for error 5726</para> 5727</refsect1> 5728</refentry> 5729 5730<refentry id="API-scsi-host-alloc"> 5731<refentryinfo> 5732 <title>LINUX</title> 5733 <productname>Kernel Hackers Manual</productname> 5734 <date>July 2017</date> 5735</refentryinfo> 5736<refmeta> 5737 <refentrytitle><phrase>scsi_host_alloc</phrase></refentrytitle> 5738 <manvolnum>9</manvolnum> 5739 <refmiscinfo class="version">4.1.27</refmiscinfo> 5740</refmeta> 5741<refnamediv> 5742 <refname>scsi_host_alloc</refname> 5743 <refpurpose> 5744 register a scsi host adapter instance. 5745 </refpurpose> 5746</refnamediv> 5747<refsynopsisdiv> 5748 <title>Synopsis</title> 5749 <funcsynopsis><funcprototype> 5750 <funcdef>struct Scsi_Host * <function>scsi_host_alloc </function></funcdef> 5751 <paramdef>struct scsi_host_template * <parameter>sht</parameter></paramdef> 5752 <paramdef>int <parameter>privsize</parameter></paramdef> 5753 </funcprototype></funcsynopsis> 5754</refsynopsisdiv> 5755<refsect1> 5756 <title>Arguments</title> 5757 <variablelist> 5758 <varlistentry> 5759 <term><parameter>sht</parameter></term> 5760 <listitem> 5761 <para> 5762 pointer to scsi host template 5763 </para> 5764 </listitem> 5765 </varlistentry> 5766 <varlistentry> 5767 <term><parameter>privsize</parameter></term> 5768 <listitem> 5769 <para> 5770 extra bytes to allocate for driver 5771 </para> 5772 </listitem> 5773 </varlistentry> 5774 </variablelist> 5775</refsect1> 5776<refsect1> 5777<title>Note</title> 5778<para> 5779 Allocate a new Scsi_Host and perform basic initialization. 5780 The host is not published to the scsi midlayer until scsi_add_host 5781 is called. 5782</para> 5783</refsect1> 5784<refsect1> 5785<title>Return value</title> 5786<para> 5787 Pointer to a new Scsi_Host 5788</para> 5789</refsect1> 5790</refentry> 5791 5792<refentry id="API-scsi-host-lookup"> 5793<refentryinfo> 5794 <title>LINUX</title> 5795 <productname>Kernel Hackers Manual</productname> 5796 <date>July 2017</date> 5797</refentryinfo> 5798<refmeta> 5799 <refentrytitle><phrase>scsi_host_lookup</phrase></refentrytitle> 5800 <manvolnum>9</manvolnum> 5801 <refmiscinfo class="version">4.1.27</refmiscinfo> 5802</refmeta> 5803<refnamediv> 5804 <refname>scsi_host_lookup</refname> 5805 <refpurpose> 5806 get a reference to a Scsi_Host by host no 5807 </refpurpose> 5808</refnamediv> 5809<refsynopsisdiv> 5810 <title>Synopsis</title> 5811 <funcsynopsis><funcprototype> 5812 <funcdef>struct Scsi_Host * <function>scsi_host_lookup </function></funcdef> 5813 <paramdef>unsigned short <parameter>hostnum</parameter></paramdef> 5814 </funcprototype></funcsynopsis> 5815</refsynopsisdiv> 5816<refsect1> 5817 <title>Arguments</title> 5818 <variablelist> 5819 <varlistentry> 5820 <term><parameter>hostnum</parameter></term> 5821 <listitem> 5822 <para> 5823 host number to locate 5824 </para> 5825 </listitem> 5826 </varlistentry> 5827 </variablelist> 5828</refsect1> 5829<refsect1> 5830<title>Return value</title> 5831<para> 5832 A pointer to located Scsi_Host or NULL. 5833 </para><para> 5834 5835 The caller must do a <function>scsi_host_put</function> to drop the reference 5836 that <function>scsi_host_get</function> took. The <function>put_device</function> below dropped 5837 the reference from <function>class_find_device</function>. 5838</para> 5839</refsect1> 5840</refentry> 5841 5842<refentry id="API-scsi-host-get"> 5843<refentryinfo> 5844 <title>LINUX</title> 5845 <productname>Kernel Hackers Manual</productname> 5846 <date>July 2017</date> 5847</refentryinfo> 5848<refmeta> 5849 <refentrytitle><phrase>scsi_host_get</phrase></refentrytitle> 5850 <manvolnum>9</manvolnum> 5851 <refmiscinfo class="version">4.1.27</refmiscinfo> 5852</refmeta> 5853<refnamediv> 5854 <refname>scsi_host_get</refname> 5855 <refpurpose> 5856 inc a Scsi_Host ref count 5857 </refpurpose> 5858</refnamediv> 5859<refsynopsisdiv> 5860 <title>Synopsis</title> 5861 <funcsynopsis><funcprototype> 5862 <funcdef>struct Scsi_Host * <function>scsi_host_get </function></funcdef> 5863 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 5864 </funcprototype></funcsynopsis> 5865</refsynopsisdiv> 5866<refsect1> 5867 <title>Arguments</title> 5868 <variablelist> 5869 <varlistentry> 5870 <term><parameter>shost</parameter></term> 5871 <listitem> 5872 <para> 5873 Pointer to Scsi_Host to inc. 5874 </para> 5875 </listitem> 5876 </varlistentry> 5877 </variablelist> 5878</refsect1> 5879</refentry> 5880 5881<refentry id="API-scsi-host-put"> 5882<refentryinfo> 5883 <title>LINUX</title> 5884 <productname>Kernel Hackers Manual</productname> 5885 <date>July 2017</date> 5886</refentryinfo> 5887<refmeta> 5888 <refentrytitle><phrase>scsi_host_put</phrase></refentrytitle> 5889 <manvolnum>9</manvolnum> 5890 <refmiscinfo class="version">4.1.27</refmiscinfo> 5891</refmeta> 5892<refnamediv> 5893 <refname>scsi_host_put</refname> 5894 <refpurpose> 5895 dec a Scsi_Host ref count 5896 </refpurpose> 5897</refnamediv> 5898<refsynopsisdiv> 5899 <title>Synopsis</title> 5900 <funcsynopsis><funcprototype> 5901 <funcdef>void <function>scsi_host_put </function></funcdef> 5902 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 5903 </funcprototype></funcsynopsis> 5904</refsynopsisdiv> 5905<refsect1> 5906 <title>Arguments</title> 5907 <variablelist> 5908 <varlistentry> 5909 <term><parameter>shost</parameter></term> 5910 <listitem> 5911 <para> 5912 Pointer to Scsi_Host to dec. 5913 </para> 5914 </listitem> 5915 </varlistentry> 5916 </variablelist> 5917</refsect1> 5918</refentry> 5919 5920<refentry id="API-scsi-queue-work"> 5921<refentryinfo> 5922 <title>LINUX</title> 5923 <productname>Kernel Hackers Manual</productname> 5924 <date>July 2017</date> 5925</refentryinfo> 5926<refmeta> 5927 <refentrytitle><phrase>scsi_queue_work</phrase></refentrytitle> 5928 <manvolnum>9</manvolnum> 5929 <refmiscinfo class="version">4.1.27</refmiscinfo> 5930</refmeta> 5931<refnamediv> 5932 <refname>scsi_queue_work</refname> 5933 <refpurpose> 5934 Queue work to the Scsi_Host workqueue. 5935 </refpurpose> 5936</refnamediv> 5937<refsynopsisdiv> 5938 <title>Synopsis</title> 5939 <funcsynopsis><funcprototype> 5940 <funcdef>int <function>scsi_queue_work </function></funcdef> 5941 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 5942 <paramdef>struct work_struct * <parameter>work</parameter></paramdef> 5943 </funcprototype></funcsynopsis> 5944</refsynopsisdiv> 5945<refsect1> 5946 <title>Arguments</title> 5947 <variablelist> 5948 <varlistentry> 5949 <term><parameter>shost</parameter></term> 5950 <listitem> 5951 <para> 5952 Pointer to Scsi_Host. 5953 </para> 5954 </listitem> 5955 </varlistentry> 5956 <varlistentry> 5957 <term><parameter>work</parameter></term> 5958 <listitem> 5959 <para> 5960 Work to queue for execution. 5961 </para> 5962 </listitem> 5963 </varlistentry> 5964 </variablelist> 5965</refsect1> 5966<refsect1> 5967<title>Return value</title> 5968<para> 5969 1 - work queued for execution 5970 0 - work is already queued 5971 -EINVAL - work queue doesn't exist 5972</para> 5973</refsect1> 5974</refentry> 5975 5976<refentry id="API-scsi-flush-work"> 5977<refentryinfo> 5978 <title>LINUX</title> 5979 <productname>Kernel Hackers Manual</productname> 5980 <date>July 2017</date> 5981</refentryinfo> 5982<refmeta> 5983 <refentrytitle><phrase>scsi_flush_work</phrase></refentrytitle> 5984 <manvolnum>9</manvolnum> 5985 <refmiscinfo class="version">4.1.27</refmiscinfo> 5986</refmeta> 5987<refnamediv> 5988 <refname>scsi_flush_work</refname> 5989 <refpurpose> 5990 Flush a Scsi_Host's workqueue. 5991 </refpurpose> 5992</refnamediv> 5993<refsynopsisdiv> 5994 <title>Synopsis</title> 5995 <funcsynopsis><funcprototype> 5996 <funcdef>void <function>scsi_flush_work </function></funcdef> 5997 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 5998 </funcprototype></funcsynopsis> 5999</refsynopsisdiv> 6000<refsect1> 6001 <title>Arguments</title> 6002 <variablelist> 6003 <varlistentry> 6004 <term><parameter>shost</parameter></term> 6005 <listitem> 6006 <para> 6007 Pointer to Scsi_Host. 6008 </para> 6009 </listitem> 6010 </varlistentry> 6011 </variablelist> 6012</refsect1> 6013</refentry> 6014 6015 </sect2> 6016 <sect2 id="constants.c"> 6017 <title>drivers/scsi/constants.c</title> 6018 <para> 6019 mid to lowlevel SCSI driver interface 6020 </para> 6021<!-- drivers/scsi/constants.c --> 6022<refentry> 6023 <refnamediv> 6024 <refname> 6025 .//drivers/scsi/constants.c 6026 </refname> 6027 <refpurpose> 6028 Document generation inconsistency 6029 </refpurpose> 6030 </refnamediv> 6031 <refsect1> 6032 <title> 6033 Oops 6034 </title> 6035 <warning> 6036 <para> 6037 The template for this document tried to insert 6038 the structured comment from the file 6039 <filename>.//drivers/scsi/constants.c</filename> at this point, 6040 but none was found. 6041 This dummy section is inserted to allow 6042 generation to continue. 6043 </para> 6044 </warning> 6045 </refsect1> 6046</refentry> 6047 </sect2> 6048 </sect1> 6049 6050 <sect1 id="Transport_classes"> 6051 <title>Transport classes</title> 6052 <para> 6053 Transport classes are service libraries for drivers in the SCSI 6054 lower layer, which expose transport attributes in sysfs. 6055 </para> 6056 <sect2 id="Fibre_Channel_transport"> 6057 <title>Fibre Channel transport</title> 6058 <para> 6059 The file drivers/scsi/scsi_transport_fc.c defines transport attributes 6060 for Fibre Channel. 6061 </para> 6062<!-- drivers/scsi/scsi_transport_fc.c --> 6063<refentry id="API-fc-get-event-number"> 6064<refentryinfo> 6065 <title>LINUX</title> 6066 <productname>Kernel Hackers Manual</productname> 6067 <date>July 2017</date> 6068</refentryinfo> 6069<refmeta> 6070 <refentrytitle><phrase>fc_get_event_number</phrase></refentrytitle> 6071 <manvolnum>9</manvolnum> 6072 <refmiscinfo class="version">4.1.27</refmiscinfo> 6073</refmeta> 6074<refnamediv> 6075 <refname>fc_get_event_number</refname> 6076 <refpurpose> 6077 Obtain the next sequential FC event number 6078 </refpurpose> 6079</refnamediv> 6080<refsynopsisdiv> 6081 <title>Synopsis</title> 6082 <funcsynopsis><funcprototype> 6083 <funcdef>u32 <function>fc_get_event_number </function></funcdef> 6084 <paramdef> <parameter>void</parameter></paramdef> 6085 </funcprototype></funcsynopsis> 6086</refsynopsisdiv> 6087<refsect1> 6088 <title>Arguments</title> 6089 <variablelist> 6090 <varlistentry> 6091 <term><parameter>void</parameter></term> 6092 <listitem> 6093 <para> 6094 no arguments 6095 </para> 6096 </listitem> 6097 </varlistentry> 6098 </variablelist> 6099</refsect1> 6100<refsect1> 6101<title>Notes</title> 6102<para> 6103 We could have inlined this, but it would have required fc_event_seq to 6104 be exposed. For now, live with the subroutine call. 6105 Atomic used to avoid lock/unlock... 6106</para> 6107</refsect1> 6108</refentry> 6109 6110<refentry id="API-fc-host-post-event"> 6111<refentryinfo> 6112 <title>LINUX</title> 6113 <productname>Kernel Hackers Manual</productname> 6114 <date>July 2017</date> 6115</refentryinfo> 6116<refmeta> 6117 <refentrytitle><phrase>fc_host_post_event</phrase></refentrytitle> 6118 <manvolnum>9</manvolnum> 6119 <refmiscinfo class="version">4.1.27</refmiscinfo> 6120</refmeta> 6121<refnamediv> 6122 <refname>fc_host_post_event</refname> 6123 <refpurpose> 6124 called to post an even on an fc_host. 6125 </refpurpose> 6126</refnamediv> 6127<refsynopsisdiv> 6128 <title>Synopsis</title> 6129 <funcsynopsis><funcprototype> 6130 <funcdef>void <function>fc_host_post_event </function></funcdef> 6131 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 6132 <paramdef>u32 <parameter>event_number</parameter></paramdef> 6133 <paramdef>enum fc_host_event_code <parameter>event_code</parameter></paramdef> 6134 <paramdef>u32 <parameter>event_data</parameter></paramdef> 6135 </funcprototype></funcsynopsis> 6136</refsynopsisdiv> 6137<refsect1> 6138 <title>Arguments</title> 6139 <variablelist> 6140 <varlistentry> 6141 <term><parameter>shost</parameter></term> 6142 <listitem> 6143 <para> 6144 host the event occurred on 6145 </para> 6146 </listitem> 6147 </varlistentry> 6148 <varlistentry> 6149 <term><parameter>event_number</parameter></term> 6150 <listitem> 6151 <para> 6152 fc event number obtained from <function>get_fc_event_number</function> 6153 </para> 6154 </listitem> 6155 </varlistentry> 6156 <varlistentry> 6157 <term><parameter>event_code</parameter></term> 6158 <listitem> 6159 <para> 6160 fc_host event being posted 6161 </para> 6162 </listitem> 6163 </varlistentry> 6164 <varlistentry> 6165 <term><parameter>event_data</parameter></term> 6166 <listitem> 6167 <para> 6168 32bits of data for the event being posted 6169 </para> 6170 </listitem> 6171 </varlistentry> 6172 </variablelist> 6173</refsect1> 6174<refsect1> 6175<title>Notes</title> 6176<para> 6177 This routine assumes no locks are held on entry. 6178</para> 6179</refsect1> 6180</refentry> 6181 6182<refentry id="API-fc-host-post-vendor-event"> 6183<refentryinfo> 6184 <title>LINUX</title> 6185 <productname>Kernel Hackers Manual</productname> 6186 <date>July 2017</date> 6187</refentryinfo> 6188<refmeta> 6189 <refentrytitle><phrase>fc_host_post_vendor_event</phrase></refentrytitle> 6190 <manvolnum>9</manvolnum> 6191 <refmiscinfo class="version">4.1.27</refmiscinfo> 6192</refmeta> 6193<refnamediv> 6194 <refname>fc_host_post_vendor_event</refname> 6195 <refpurpose> 6196 called to post a vendor unique event on an fc_host 6197 </refpurpose> 6198</refnamediv> 6199<refsynopsisdiv> 6200 <title>Synopsis</title> 6201 <funcsynopsis><funcprototype> 6202 <funcdef>void <function>fc_host_post_vendor_event </function></funcdef> 6203 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 6204 <paramdef>u32 <parameter>event_number</parameter></paramdef> 6205 <paramdef>u32 <parameter>data_len</parameter></paramdef> 6206 <paramdef>char * <parameter>data_buf</parameter></paramdef> 6207 <paramdef>u64 <parameter>vendor_id</parameter></paramdef> 6208 </funcprototype></funcsynopsis> 6209</refsynopsisdiv> 6210<refsect1> 6211 <title>Arguments</title> 6212 <variablelist> 6213 <varlistentry> 6214 <term><parameter>shost</parameter></term> 6215 <listitem> 6216 <para> 6217 host the event occurred on 6218 </para> 6219 </listitem> 6220 </varlistentry> 6221 <varlistentry> 6222 <term><parameter>event_number</parameter></term> 6223 <listitem> 6224 <para> 6225 fc event number obtained from <function>get_fc_event_number</function> 6226 </para> 6227 </listitem> 6228 </varlistentry> 6229 <varlistentry> 6230 <term><parameter>data_len</parameter></term> 6231 <listitem> 6232 <para> 6233 amount, in bytes, of vendor unique data 6234 </para> 6235 </listitem> 6236 </varlistentry> 6237 <varlistentry> 6238 <term><parameter>data_buf</parameter></term> 6239 <listitem> 6240 <para> 6241 pointer to vendor unique data 6242 </para> 6243 </listitem> 6244 </varlistentry> 6245 <varlistentry> 6246 <term><parameter>vendor_id</parameter></term> 6247 <listitem> 6248 <para> 6249 Vendor id 6250 </para> 6251 </listitem> 6252 </varlistentry> 6253 </variablelist> 6254</refsect1> 6255<refsect1> 6256<title>Notes</title> 6257<para> 6258 This routine assumes no locks are held on entry. 6259</para> 6260</refsect1> 6261</refentry> 6262 6263<refentry id="API-fc-remove-host"> 6264<refentryinfo> 6265 <title>LINUX</title> 6266 <productname>Kernel Hackers Manual</productname> 6267 <date>July 2017</date> 6268</refentryinfo> 6269<refmeta> 6270 <refentrytitle><phrase>fc_remove_host</phrase></refentrytitle> 6271 <manvolnum>9</manvolnum> 6272 <refmiscinfo class="version">4.1.27</refmiscinfo> 6273</refmeta> 6274<refnamediv> 6275 <refname>fc_remove_host</refname> 6276 <refpurpose> 6277 called to terminate any fc_transport-related elements for a scsi host. 6278 </refpurpose> 6279</refnamediv> 6280<refsynopsisdiv> 6281 <title>Synopsis</title> 6282 <funcsynopsis><funcprototype> 6283 <funcdef>void <function>fc_remove_host </function></funcdef> 6284 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 6285 </funcprototype></funcsynopsis> 6286</refsynopsisdiv> 6287<refsect1> 6288 <title>Arguments</title> 6289 <variablelist> 6290 <varlistentry> 6291 <term><parameter>shost</parameter></term> 6292 <listitem> 6293 <para> 6294 Which <structname>Scsi_Host</structname> 6295 </para> 6296 </listitem> 6297 </varlistentry> 6298 </variablelist> 6299</refsect1> 6300<refsect1> 6301<title>Description</title> 6302<para> 6303 This routine is expected to be called immediately preceding the 6304 a driver's call to <function>scsi_remove_host</function>. 6305</para> 6306</refsect1> 6307<refsect1> 6308<title>WARNING</title> 6309<para> 6310 A driver utilizing the fc_transport, which fails to call 6311 this routine prior to <function>scsi_remove_host</function>, will leave dangling 6312 objects in /sys/class/fc_remote_ports. Access to any of these 6313 objects can result in a system crash !!! 6314</para> 6315</refsect1> 6316<refsect1> 6317<title>Notes</title> 6318<para> 6319 This routine assumes no locks are held on entry. 6320</para> 6321</refsect1> 6322</refentry> 6323 6324<refentry id="API-fc-remote-port-add"> 6325<refentryinfo> 6326 <title>LINUX</title> 6327 <productname>Kernel Hackers Manual</productname> 6328 <date>July 2017</date> 6329</refentryinfo> 6330<refmeta> 6331 <refentrytitle><phrase>fc_remote_port_add</phrase></refentrytitle> 6332 <manvolnum>9</manvolnum> 6333 <refmiscinfo class="version">4.1.27</refmiscinfo> 6334</refmeta> 6335<refnamediv> 6336 <refname>fc_remote_port_add</refname> 6337 <refpurpose> 6338 notify fc transport of the existence of a remote FC port. 6339 </refpurpose> 6340</refnamediv> 6341<refsynopsisdiv> 6342 <title>Synopsis</title> 6343 <funcsynopsis><funcprototype> 6344 <funcdef>struct fc_rport * <function>fc_remote_port_add </function></funcdef> 6345 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 6346 <paramdef>int <parameter>channel</parameter></paramdef> 6347 <paramdef>struct fc_rport_identifiers * <parameter>ids</parameter></paramdef> 6348 </funcprototype></funcsynopsis> 6349</refsynopsisdiv> 6350<refsect1> 6351 <title>Arguments</title> 6352 <variablelist> 6353 <varlistentry> 6354 <term><parameter>shost</parameter></term> 6355 <listitem> 6356 <para> 6357 scsi host the remote port is connected to. 6358 </para> 6359 </listitem> 6360 </varlistentry> 6361 <varlistentry> 6362 <term><parameter>channel</parameter></term> 6363 <listitem> 6364 <para> 6365 Channel on shost port connected to. 6366 </para> 6367 </listitem> 6368 </varlistentry> 6369 <varlistentry> 6370 <term><parameter>ids</parameter></term> 6371 <listitem> 6372 <para> 6373 The world wide names, fc address, and FC4 port 6374 roles for the remote port. 6375 </para> 6376 </listitem> 6377 </varlistentry> 6378 </variablelist> 6379</refsect1> 6380<refsect1> 6381<title>Description</title> 6382<para> 6383 The LLDD calls this routine to notify the transport of the existence 6384 of a remote port. The LLDD provides the unique identifiers (wwpn,wwn) 6385 of the port, it's FC address (port_id), and the FC4 roles that are 6386 active for the port. 6387 </para><para> 6388 6389 For ports that are FCP targets (aka scsi targets), the FC transport 6390 maintains consistent target id bindings on behalf of the LLDD. 6391 A consistent target id binding is an assignment of a target id to 6392 a remote port identifier, which persists while the scsi host is 6393 attached. The remote port can disappear, then later reappear, and 6394 it's target id assignment remains the same. This allows for shifts 6395 in FC addressing (if binding by wwpn or wwnn) with no apparent 6396 changes to the scsi subsystem which is based on scsi host number and 6397 target id values. Bindings are only valid during the attachment of 6398 the scsi host. If the host detaches, then later re-attaches, target 6399 id bindings may change. 6400 </para><para> 6401 6402 This routine is responsible for returning a remote port structure. 6403 The routine will search the list of remote ports it maintains 6404 internally on behalf of consistent target id mappings. If found, the 6405 remote port structure will be reused. Otherwise, a new remote port 6406 structure will be allocated. 6407 </para><para> 6408 6409 Whenever a remote port is allocated, a new fc_remote_port class 6410 device is created. 6411 </para><para> 6412 6413 Should not be called from interrupt context. 6414</para> 6415</refsect1> 6416<refsect1> 6417<title>Notes</title> 6418<para> 6419 This routine assumes no locks are held on entry. 6420</para> 6421</refsect1> 6422</refentry> 6423 6424<refentry id="API-fc-remote-port-delete"> 6425<refentryinfo> 6426 <title>LINUX</title> 6427 <productname>Kernel Hackers Manual</productname> 6428 <date>July 2017</date> 6429</refentryinfo> 6430<refmeta> 6431 <refentrytitle><phrase>fc_remote_port_delete</phrase></refentrytitle> 6432 <manvolnum>9</manvolnum> 6433 <refmiscinfo class="version">4.1.27</refmiscinfo> 6434</refmeta> 6435<refnamediv> 6436 <refname>fc_remote_port_delete</refname> 6437 <refpurpose> 6438 notifies the fc transport that a remote port is no longer in existence. 6439 </refpurpose> 6440</refnamediv> 6441<refsynopsisdiv> 6442 <title>Synopsis</title> 6443 <funcsynopsis><funcprototype> 6444 <funcdef>void <function>fc_remote_port_delete </function></funcdef> 6445 <paramdef>struct fc_rport * <parameter>rport</parameter></paramdef> 6446 </funcprototype></funcsynopsis> 6447</refsynopsisdiv> 6448<refsect1> 6449 <title>Arguments</title> 6450 <variablelist> 6451 <varlistentry> 6452 <term><parameter>rport</parameter></term> 6453 <listitem> 6454 <para> 6455 The remote port that no longer exists 6456 </para> 6457 </listitem> 6458 </varlistentry> 6459 </variablelist> 6460</refsect1> 6461<refsect1> 6462<title>Description</title> 6463<para> 6464 The LLDD calls this routine to notify the transport that a remote 6465 port is no longer part of the topology. Note: Although a port 6466 may no longer be part of the topology, it may persist in the remote 6467 ports displayed by the fc_host. We do this under 2 conditions: 6468 1) If the port was a scsi target, we delay its deletion by <quote>blocking</quote> it. 6469 This allows the port to temporarily disappear, then reappear without 6470 disrupting the SCSI device tree attached to it. During the <quote>blocked</quote> 6471 period the port will still exist. 6472 2) If the port was a scsi target and disappears for longer than we 6473 expect, we'll delete the port and the tear down the SCSI device tree 6474 attached to it. However, we want to semi-persist the target id assigned 6475 to that port if it eventually does exist. The port structure will 6476 remain (although with minimal information) so that the target id 6477 bindings remails. 6478 </para><para> 6479 6480 If the remote port is not an FCP Target, it will be fully torn down 6481 and deallocated, including the fc_remote_port class device. 6482 </para><para> 6483 6484 If the remote port is an FCP Target, the port will be placed in a 6485 temporary blocked state. From the LLDD's perspective, the rport no 6486 longer exists. From the SCSI midlayer's perspective, the SCSI target 6487 exists, but all sdevs on it are blocked from further I/O. The following 6488 is then expected. 6489 </para><para> 6490 6491 If the remote port does not return (signaled by a LLDD call to 6492 <function>fc_remote_port_add</function>) within the dev_loss_tmo timeout, then the 6493 scsi target is removed - killing all outstanding i/o and removing the 6494 scsi devices attached ot it. The port structure will be marked Not 6495 Present and be partially cleared, leaving only enough information to 6496 recognize the remote port relative to the scsi target id binding if 6497 it later appears. The port will remain as long as there is a valid 6498 binding (e.g. until the user changes the binding type or unloads the 6499 scsi host with the binding). 6500 </para><para> 6501 6502 If the remote port returns within the dev_loss_tmo value (and matches 6503 according to the target id binding type), the port structure will be 6504 reused. If it is no longer a SCSI target, the target will be torn 6505 down. If it continues to be a SCSI target, then the target will be 6506 unblocked (allowing i/o to be resumed), and a scan will be activated 6507 to ensure that all luns are detected. 6508 </para><para> 6509 6510 Called from normal process context only - cannot be called from interrupt. 6511</para> 6512</refsect1> 6513<refsect1> 6514<title>Notes</title> 6515<para> 6516 This routine assumes no locks are held on entry. 6517</para> 6518</refsect1> 6519</refentry> 6520 6521<refentry id="API-fc-remote-port-rolechg"> 6522<refentryinfo> 6523 <title>LINUX</title> 6524 <productname>Kernel Hackers Manual</productname> 6525 <date>July 2017</date> 6526</refentryinfo> 6527<refmeta> 6528 <refentrytitle><phrase>fc_remote_port_rolechg</phrase></refentrytitle> 6529 <manvolnum>9</manvolnum> 6530 <refmiscinfo class="version">4.1.27</refmiscinfo> 6531</refmeta> 6532<refnamediv> 6533 <refname>fc_remote_port_rolechg</refname> 6534 <refpurpose> 6535 notifies the fc transport that the roles on a remote may have changed. 6536 </refpurpose> 6537</refnamediv> 6538<refsynopsisdiv> 6539 <title>Synopsis</title> 6540 <funcsynopsis><funcprototype> 6541 <funcdef>void <function>fc_remote_port_rolechg </function></funcdef> 6542 <paramdef>struct fc_rport * <parameter>rport</parameter></paramdef> 6543 <paramdef>u32 <parameter>roles</parameter></paramdef> 6544 </funcprototype></funcsynopsis> 6545</refsynopsisdiv> 6546<refsect1> 6547 <title>Arguments</title> 6548 <variablelist> 6549 <varlistentry> 6550 <term><parameter>rport</parameter></term> 6551 <listitem> 6552 <para> 6553 The remote port that changed. 6554 </para> 6555 </listitem> 6556 </varlistentry> 6557 <varlistentry> 6558 <term><parameter>roles</parameter></term> 6559 <listitem> 6560 <para> 6561 New roles for this port. 6562 </para> 6563 </listitem> 6564 </varlistentry> 6565 </variablelist> 6566</refsect1> 6567<refsect1> 6568<title>Description</title> 6569<para> 6570 The LLDD calls this routine to notify the transport that the 6571 roles on a remote port may have changed. The largest effect of this is 6572 if a port now becomes a FCP Target, it must be allocated a 6573 scsi target id. If the port is no longer a FCP target, any 6574 scsi target id value assigned to it will persist in case the 6575 role changes back to include FCP Target. No changes in the scsi 6576 midlayer will be invoked if the role changes (in the expectation 6577 that the role will be resumed. If it doesn't normal error processing 6578 will take place). 6579 </para><para> 6580 6581 Should not be called from interrupt context. 6582</para> 6583</refsect1> 6584<refsect1> 6585<title>Notes</title> 6586<para> 6587 This routine assumes no locks are held on entry. 6588</para> 6589</refsect1> 6590</refentry> 6591 6592<refentry id="API-fc-block-scsi-eh"> 6593<refentryinfo> 6594 <title>LINUX</title> 6595 <productname>Kernel Hackers Manual</productname> 6596 <date>July 2017</date> 6597</refentryinfo> 6598<refmeta> 6599 <refentrytitle><phrase>fc_block_scsi_eh</phrase></refentrytitle> 6600 <manvolnum>9</manvolnum> 6601 <refmiscinfo class="version">4.1.27</refmiscinfo> 6602</refmeta> 6603<refnamediv> 6604 <refname>fc_block_scsi_eh</refname> 6605 <refpurpose> 6606 Block SCSI eh thread for blocked fc_rport 6607 </refpurpose> 6608</refnamediv> 6609<refsynopsisdiv> 6610 <title>Synopsis</title> 6611 <funcsynopsis><funcprototype> 6612 <funcdef>int <function>fc_block_scsi_eh </function></funcdef> 6613 <paramdef>struct scsi_cmnd * <parameter>cmnd</parameter></paramdef> 6614 </funcprototype></funcsynopsis> 6615</refsynopsisdiv> 6616<refsect1> 6617 <title>Arguments</title> 6618 <variablelist> 6619 <varlistentry> 6620 <term><parameter>cmnd</parameter></term> 6621 <listitem> 6622 <para> 6623 SCSI command that scsi_eh is trying to recover 6624 </para> 6625 </listitem> 6626 </varlistentry> 6627 </variablelist> 6628</refsect1> 6629<refsect1> 6630<title>Description</title> 6631<para> 6632 This routine can be called from a FC LLD scsi_eh callback. It 6633 blocks the scsi_eh thread until the fc_rport leaves the 6634 FC_PORTSTATE_BLOCKED, or the fast_io_fail_tmo fires. This is 6635 necessary to avoid the scsi_eh failing recovery actions for blocked 6636 rports which would lead to offlined SCSI devices. 6637</para> 6638</refsect1> 6639<refsect1> 6640<title>Returns</title> 6641<para> 6642 0 if the fc_rport left the state FC_PORTSTATE_BLOCKED. 6643 FAST_IO_FAIL if the fast_io_fail_tmo fired, this should be 6644 passed back to scsi_eh. 6645</para> 6646</refsect1> 6647</refentry> 6648 6649<refentry id="API-fc-vport-create"> 6650<refentryinfo> 6651 <title>LINUX</title> 6652 <productname>Kernel Hackers Manual</productname> 6653 <date>July 2017</date> 6654</refentryinfo> 6655<refmeta> 6656 <refentrytitle><phrase>fc_vport_create</phrase></refentrytitle> 6657 <manvolnum>9</manvolnum> 6658 <refmiscinfo class="version">4.1.27</refmiscinfo> 6659</refmeta> 6660<refnamediv> 6661 <refname>fc_vport_create</refname> 6662 <refpurpose> 6663 Admin App or LLDD requests creation of a vport 6664 </refpurpose> 6665</refnamediv> 6666<refsynopsisdiv> 6667 <title>Synopsis</title> 6668 <funcsynopsis><funcprototype> 6669 <funcdef>struct fc_vport * <function>fc_vport_create </function></funcdef> 6670 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 6671 <paramdef>int <parameter>channel</parameter></paramdef> 6672 <paramdef>struct fc_vport_identifiers * <parameter>ids</parameter></paramdef> 6673 </funcprototype></funcsynopsis> 6674</refsynopsisdiv> 6675<refsect1> 6676 <title>Arguments</title> 6677 <variablelist> 6678 <varlistentry> 6679 <term><parameter>shost</parameter></term> 6680 <listitem> 6681 <para> 6682 scsi host the virtual port is connected to. 6683 </para> 6684 </listitem> 6685 </varlistentry> 6686 <varlistentry> 6687 <term><parameter>channel</parameter></term> 6688 <listitem> 6689 <para> 6690 channel on shost port connected to. 6691 </para> 6692 </listitem> 6693 </varlistentry> 6694 <varlistentry> 6695 <term><parameter>ids</parameter></term> 6696 <listitem> 6697 <para> 6698 The world wide names, FC4 port roles, etc for 6699 the virtual port. 6700 </para> 6701 </listitem> 6702 </varlistentry> 6703 </variablelist> 6704</refsect1> 6705<refsect1> 6706<title>Notes</title> 6707<para> 6708 This routine assumes no locks are held on entry. 6709</para> 6710</refsect1> 6711</refentry> 6712 6713<refentry id="API-fc-vport-terminate"> 6714<refentryinfo> 6715 <title>LINUX</title> 6716 <productname>Kernel Hackers Manual</productname> 6717 <date>July 2017</date> 6718</refentryinfo> 6719<refmeta> 6720 <refentrytitle><phrase>fc_vport_terminate</phrase></refentrytitle> 6721 <manvolnum>9</manvolnum> 6722 <refmiscinfo class="version">4.1.27</refmiscinfo> 6723</refmeta> 6724<refnamediv> 6725 <refname>fc_vport_terminate</refname> 6726 <refpurpose> 6727 Admin App or LLDD requests termination of a vport 6728 </refpurpose> 6729</refnamediv> 6730<refsynopsisdiv> 6731 <title>Synopsis</title> 6732 <funcsynopsis><funcprototype> 6733 <funcdef>int <function>fc_vport_terminate </function></funcdef> 6734 <paramdef>struct fc_vport * <parameter>vport</parameter></paramdef> 6735 </funcprototype></funcsynopsis> 6736</refsynopsisdiv> 6737<refsect1> 6738 <title>Arguments</title> 6739 <variablelist> 6740 <varlistentry> 6741 <term><parameter>vport</parameter></term> 6742 <listitem> 6743 <para> 6744 fc_vport to be terminated 6745 </para> 6746 </listitem> 6747 </varlistentry> 6748 </variablelist> 6749</refsect1> 6750<refsect1> 6751<title>Description</title> 6752<para> 6753 Calls the LLDD <function>vport_delete</function> function, then deallocates and removes 6754 the vport from the shost and object tree. 6755</para> 6756</refsect1> 6757<refsect1> 6758<title>Notes</title> 6759<para> 6760 This routine assumes no locks are held on entry. 6761</para> 6762</refsect1> 6763</refentry> 6764 6765 </sect2> 6766 <sect2 id="iSCSI_transport"> 6767 <title>iSCSI transport class</title> 6768 <para> 6769 The file drivers/scsi/scsi_transport_iscsi.c defines transport 6770 attributes for the iSCSI class, which sends SCSI packets over TCP/IP 6771 connections. 6772 </para> 6773<!-- drivers/scsi/scsi_transport_iscsi.c --> 6774<refentry id="API-iscsi-create-flashnode-sess"> 6775<refentryinfo> 6776 <title>LINUX</title> 6777 <productname>Kernel Hackers Manual</productname> 6778 <date>July 2017</date> 6779</refentryinfo> 6780<refmeta> 6781 <refentrytitle><phrase>iscsi_create_flashnode_sess</phrase></refentrytitle> 6782 <manvolnum>9</manvolnum> 6783 <refmiscinfo class="version">4.1.27</refmiscinfo> 6784</refmeta> 6785<refnamediv> 6786 <refname>iscsi_create_flashnode_sess</refname> 6787 <refpurpose> 6788 Add flashnode session entry in sysfs 6789 </refpurpose> 6790</refnamediv> 6791<refsynopsisdiv> 6792 <title>Synopsis</title> 6793 <funcsynopsis><funcprototype> 6794 <funcdef>struct iscsi_bus_flash_session * <function>iscsi_create_flashnode_sess </function></funcdef> 6795 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 6796 <paramdef>int <parameter>index</parameter></paramdef> 6797 <paramdef>struct iscsi_transport * <parameter>transport</parameter></paramdef> 6798 <paramdef>int <parameter>dd_size</parameter></paramdef> 6799 </funcprototype></funcsynopsis> 6800</refsynopsisdiv> 6801<refsect1> 6802 <title>Arguments</title> 6803 <variablelist> 6804 <varlistentry> 6805 <term><parameter>shost</parameter></term> 6806 <listitem> 6807 <para> 6808 pointer to host data 6809 </para> 6810 </listitem> 6811 </varlistentry> 6812 <varlistentry> 6813 <term><parameter>index</parameter></term> 6814 <listitem> 6815 <para> 6816 index of flashnode to add in sysfs 6817 </para> 6818 </listitem> 6819 </varlistentry> 6820 <varlistentry> 6821 <term><parameter>transport</parameter></term> 6822 <listitem> 6823 <para> 6824 pointer to transport data 6825 </para> 6826 </listitem> 6827 </varlistentry> 6828 <varlistentry> 6829 <term><parameter>dd_size</parameter></term> 6830 <listitem> 6831 <para> 6832 total size to allocate 6833 </para> 6834 </listitem> 6835 </varlistentry> 6836 </variablelist> 6837</refsect1> 6838<refsect1> 6839<title>Description</title> 6840<para> 6841 Adds a sysfs entry for the flashnode session attributes 6842</para> 6843</refsect1> 6844<refsect1> 6845<title>Returns</title> 6846<para> 6847 pointer to allocated flashnode sess on success 6848 <constant>NULL</constant> on failure 6849</para> 6850</refsect1> 6851</refentry> 6852 6853<refentry id="API-iscsi-create-flashnode-conn"> 6854<refentryinfo> 6855 <title>LINUX</title> 6856 <productname>Kernel Hackers Manual</productname> 6857 <date>July 2017</date> 6858</refentryinfo> 6859<refmeta> 6860 <refentrytitle><phrase>iscsi_create_flashnode_conn</phrase></refentrytitle> 6861 <manvolnum>9</manvolnum> 6862 <refmiscinfo class="version">4.1.27</refmiscinfo> 6863</refmeta> 6864<refnamediv> 6865 <refname>iscsi_create_flashnode_conn</refname> 6866 <refpurpose> 6867 Add flashnode conn entry in sysfs 6868 </refpurpose> 6869</refnamediv> 6870<refsynopsisdiv> 6871 <title>Synopsis</title> 6872 <funcsynopsis><funcprototype> 6873 <funcdef>struct iscsi_bus_flash_conn * <function>iscsi_create_flashnode_conn </function></funcdef> 6874 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 6875 <paramdef>struct iscsi_bus_flash_session * <parameter>fnode_sess</parameter></paramdef> 6876 <paramdef>struct iscsi_transport * <parameter>transport</parameter></paramdef> 6877 <paramdef>int <parameter>dd_size</parameter></paramdef> 6878 </funcprototype></funcsynopsis> 6879</refsynopsisdiv> 6880<refsect1> 6881 <title>Arguments</title> 6882 <variablelist> 6883 <varlistentry> 6884 <term><parameter>shost</parameter></term> 6885 <listitem> 6886 <para> 6887 pointer to host data 6888 </para> 6889 </listitem> 6890 </varlistentry> 6891 <varlistentry> 6892 <term><parameter>fnode_sess</parameter></term> 6893 <listitem> 6894 <para> 6895 pointer to the parent flashnode session entry 6896 </para> 6897 </listitem> 6898 </varlistentry> 6899 <varlistentry> 6900 <term><parameter>transport</parameter></term> 6901 <listitem> 6902 <para> 6903 pointer to transport data 6904 </para> 6905 </listitem> 6906 </varlistentry> 6907 <varlistentry> 6908 <term><parameter>dd_size</parameter></term> 6909 <listitem> 6910 <para> 6911 total size to allocate 6912 </para> 6913 </listitem> 6914 </varlistentry> 6915 </variablelist> 6916</refsect1> 6917<refsect1> 6918<title>Description</title> 6919<para> 6920 Adds a sysfs entry for the flashnode connection attributes 6921</para> 6922</refsect1> 6923<refsect1> 6924<title>Returns</title> 6925<para> 6926 pointer to allocated flashnode conn on success 6927 <constant>NULL</constant> on failure 6928</para> 6929</refsect1> 6930</refentry> 6931 6932<refentry id="API-iscsi-is-flashnode-conn-dev"> 6933<refentryinfo> 6934 <title>LINUX</title> 6935 <productname>Kernel Hackers Manual</productname> 6936 <date>July 2017</date> 6937</refentryinfo> 6938<refmeta> 6939 <refentrytitle><phrase>iscsi_is_flashnode_conn_dev</phrase></refentrytitle> 6940 <manvolnum>9</manvolnum> 6941 <refmiscinfo class="version">4.1.27</refmiscinfo> 6942</refmeta> 6943<refnamediv> 6944 <refname>iscsi_is_flashnode_conn_dev</refname> 6945 <refpurpose> 6946 verify passed device is to be flashnode conn 6947 </refpurpose> 6948</refnamediv> 6949<refsynopsisdiv> 6950 <title>Synopsis</title> 6951 <funcsynopsis><funcprototype> 6952 <funcdef>int <function>iscsi_is_flashnode_conn_dev </function></funcdef> 6953 <paramdef>struct device * <parameter>dev</parameter></paramdef> 6954 <paramdef>void * <parameter>data</parameter></paramdef> 6955 </funcprototype></funcsynopsis> 6956</refsynopsisdiv> 6957<refsect1> 6958 <title>Arguments</title> 6959 <variablelist> 6960 <varlistentry> 6961 <term><parameter>dev</parameter></term> 6962 <listitem> 6963 <para> 6964 device to verify 6965 </para> 6966 </listitem> 6967 </varlistentry> 6968 <varlistentry> 6969 <term><parameter>data</parameter></term> 6970 <listitem> 6971 <para> 6972 pointer to data containing value to use for verification 6973 </para> 6974 </listitem> 6975 </varlistentry> 6976 </variablelist> 6977</refsect1> 6978<refsect1> 6979<title>Description</title> 6980<para> 6981 Verifies if the passed device is flashnode conn device 6982</para> 6983</refsect1> 6984<refsect1> 6985<title>Returns</title> 6986<para> 6987 1 on success 6988 0 on failure 6989</para> 6990</refsect1> 6991</refentry> 6992 6993<refentry id="API-iscsi-find-flashnode-sess"> 6994<refentryinfo> 6995 <title>LINUX</title> 6996 <productname>Kernel Hackers Manual</productname> 6997 <date>July 2017</date> 6998</refentryinfo> 6999<refmeta> 7000 <refentrytitle><phrase>iscsi_find_flashnode_sess</phrase></refentrytitle> 7001 <manvolnum>9</manvolnum> 7002 <refmiscinfo class="version">4.1.27</refmiscinfo> 7003</refmeta> 7004<refnamediv> 7005 <refname>iscsi_find_flashnode_sess</refname> 7006 <refpurpose> 7007 finds flashnode session entry 7008 </refpurpose> 7009</refnamediv> 7010<refsynopsisdiv> 7011 <title>Synopsis</title> 7012 <funcsynopsis><funcprototype> 7013 <funcdef>struct device * <function>iscsi_find_flashnode_sess </function></funcdef> 7014 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 7015 <paramdef>void * <parameter>data</parameter></paramdef> 7016 <paramdef>int (*<parameter>fn</parameter>) 7017 <funcparams>struct device *dev, void *data</funcparams></paramdef> 7018 </funcprototype></funcsynopsis> 7019</refsynopsisdiv> 7020<refsect1> 7021 <title>Arguments</title> 7022 <variablelist> 7023 <varlistentry> 7024 <term><parameter>shost</parameter></term> 7025 <listitem> 7026 <para> 7027 pointer to host data 7028 </para> 7029 </listitem> 7030 </varlistentry> 7031 <varlistentry> 7032 <term><parameter>data</parameter></term> 7033 <listitem> 7034 <para> 7035 pointer to data containing value to use for comparison 7036 </para> 7037 </listitem> 7038 </varlistentry> 7039 <varlistentry> 7040 <term><parameter>fn</parameter></term> 7041 <listitem> 7042 <para> 7043 function pointer that does actual comparison 7044 </para> 7045 </listitem> 7046 </varlistentry> 7047 </variablelist> 7048</refsect1> 7049<refsect1> 7050<title>Description</title> 7051<para> 7052 Finds the flashnode session object comparing the data passed using logic 7053 defined in passed function pointer 7054</para> 7055</refsect1> 7056<refsect1> 7057<title>Returns</title> 7058<para> 7059 pointer to found flashnode session device object on success 7060 <constant>NULL</constant> on failure 7061</para> 7062</refsect1> 7063</refentry> 7064 7065<refentry id="API-iscsi-find-flashnode-conn"> 7066<refentryinfo> 7067 <title>LINUX</title> 7068 <productname>Kernel Hackers Manual</productname> 7069 <date>July 2017</date> 7070</refentryinfo> 7071<refmeta> 7072 <refentrytitle><phrase>iscsi_find_flashnode_conn</phrase></refentrytitle> 7073 <manvolnum>9</manvolnum> 7074 <refmiscinfo class="version">4.1.27</refmiscinfo> 7075</refmeta> 7076<refnamediv> 7077 <refname>iscsi_find_flashnode_conn</refname> 7078 <refpurpose> 7079 finds flashnode connection entry 7080 </refpurpose> 7081</refnamediv> 7082<refsynopsisdiv> 7083 <title>Synopsis</title> 7084 <funcsynopsis><funcprototype> 7085 <funcdef>struct device * <function>iscsi_find_flashnode_conn </function></funcdef> 7086 <paramdef>struct iscsi_bus_flash_session * <parameter>fnode_sess</parameter></paramdef> 7087 </funcprototype></funcsynopsis> 7088</refsynopsisdiv> 7089<refsect1> 7090 <title>Arguments</title> 7091 <variablelist> 7092 <varlistentry> 7093 <term><parameter>fnode_sess</parameter></term> 7094 <listitem> 7095 <para> 7096 pointer to parent flashnode session entry 7097 </para> 7098 </listitem> 7099 </varlistentry> 7100 </variablelist> 7101</refsect1> 7102<refsect1> 7103<title>Description</title> 7104<para> 7105 Finds the flashnode connection object comparing the data passed using logic 7106 defined in passed function pointer 7107</para> 7108</refsect1> 7109<refsect1> 7110<title>Returns</title> 7111<para> 7112 pointer to found flashnode connection device object on success 7113 <constant>NULL</constant> on failure 7114</para> 7115</refsect1> 7116</refentry> 7117 7118<refentry id="API-iscsi-destroy-flashnode-sess"> 7119<refentryinfo> 7120 <title>LINUX</title> 7121 <productname>Kernel Hackers Manual</productname> 7122 <date>July 2017</date> 7123</refentryinfo> 7124<refmeta> 7125 <refentrytitle><phrase>iscsi_destroy_flashnode_sess</phrase></refentrytitle> 7126 <manvolnum>9</manvolnum> 7127 <refmiscinfo class="version">4.1.27</refmiscinfo> 7128</refmeta> 7129<refnamediv> 7130 <refname>iscsi_destroy_flashnode_sess</refname> 7131 <refpurpose> 7132 destroy flashnode session entry 7133 </refpurpose> 7134</refnamediv> 7135<refsynopsisdiv> 7136 <title>Synopsis</title> 7137 <funcsynopsis><funcprototype> 7138 <funcdef>void <function>iscsi_destroy_flashnode_sess </function></funcdef> 7139 <paramdef>struct iscsi_bus_flash_session * <parameter>fnode_sess</parameter></paramdef> 7140 </funcprototype></funcsynopsis> 7141</refsynopsisdiv> 7142<refsect1> 7143 <title>Arguments</title> 7144 <variablelist> 7145 <varlistentry> 7146 <term><parameter>fnode_sess</parameter></term> 7147 <listitem> 7148 <para> 7149 pointer to flashnode session entry to be destroyed 7150 </para> 7151 </listitem> 7152 </varlistentry> 7153 </variablelist> 7154</refsect1> 7155<refsect1> 7156<title>Description</title> 7157<para> 7158 Deletes the flashnode session entry and all children flashnode connection 7159 entries from sysfs 7160</para> 7161</refsect1> 7162</refentry> 7163 7164<refentry id="API-iscsi-destroy-all-flashnode"> 7165<refentryinfo> 7166 <title>LINUX</title> 7167 <productname>Kernel Hackers Manual</productname> 7168 <date>July 2017</date> 7169</refentryinfo> 7170<refmeta> 7171 <refentrytitle><phrase>iscsi_destroy_all_flashnode</phrase></refentrytitle> 7172 <manvolnum>9</manvolnum> 7173 <refmiscinfo class="version">4.1.27</refmiscinfo> 7174</refmeta> 7175<refnamediv> 7176 <refname>iscsi_destroy_all_flashnode</refname> 7177 <refpurpose> 7178 destroy all flashnode session entries 7179 </refpurpose> 7180</refnamediv> 7181<refsynopsisdiv> 7182 <title>Synopsis</title> 7183 <funcsynopsis><funcprototype> 7184 <funcdef>void <function>iscsi_destroy_all_flashnode </function></funcdef> 7185 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 7186 </funcprototype></funcsynopsis> 7187</refsynopsisdiv> 7188<refsect1> 7189 <title>Arguments</title> 7190 <variablelist> 7191 <varlistentry> 7192 <term><parameter>shost</parameter></term> 7193 <listitem> 7194 <para> 7195 pointer to host data 7196 </para> 7197 </listitem> 7198 </varlistentry> 7199 </variablelist> 7200</refsect1> 7201<refsect1> 7202<title>Description</title> 7203<para> 7204 Destroys all the flashnode session entries and all corresponding children 7205 flashnode connection entries from sysfs 7206</para> 7207</refsect1> 7208</refentry> 7209 7210<refentry id="API-iscsi-scan-finished"> 7211<refentryinfo> 7212 <title>LINUX</title> 7213 <productname>Kernel Hackers Manual</productname> 7214 <date>July 2017</date> 7215</refentryinfo> 7216<refmeta> 7217 <refentrytitle><phrase>iscsi_scan_finished</phrase></refentrytitle> 7218 <manvolnum>9</manvolnum> 7219 <refmiscinfo class="version">4.1.27</refmiscinfo> 7220</refmeta> 7221<refnamediv> 7222 <refname>iscsi_scan_finished</refname> 7223 <refpurpose> 7224 helper to report when running scans are done 7225 </refpurpose> 7226</refnamediv> 7227<refsynopsisdiv> 7228 <title>Synopsis</title> 7229 <funcsynopsis><funcprototype> 7230 <funcdef>int <function>iscsi_scan_finished </function></funcdef> 7231 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 7232 <paramdef>unsigned long <parameter>time</parameter></paramdef> 7233 </funcprototype></funcsynopsis> 7234</refsynopsisdiv> 7235<refsect1> 7236 <title>Arguments</title> 7237 <variablelist> 7238 <varlistentry> 7239 <term><parameter>shost</parameter></term> 7240 <listitem> 7241 <para> 7242 scsi host 7243 </para> 7244 </listitem> 7245 </varlistentry> 7246 <varlistentry> 7247 <term><parameter>time</parameter></term> 7248 <listitem> 7249 <para> 7250 scan run time 7251 </para> 7252 </listitem> 7253 </varlistentry> 7254 </variablelist> 7255</refsect1> 7256<refsect1> 7257<title>Description</title> 7258<para> 7259 This function can be used by drives like qla4xxx to report to the scsi 7260 layer when the scans it kicked off at module load time are done. 7261</para> 7262</refsect1> 7263</refentry> 7264 7265<refentry id="API-iscsi-block-scsi-eh"> 7266<refentryinfo> 7267 <title>LINUX</title> 7268 <productname>Kernel Hackers Manual</productname> 7269 <date>July 2017</date> 7270</refentryinfo> 7271<refmeta> 7272 <refentrytitle><phrase>iscsi_block_scsi_eh</phrase></refentrytitle> 7273 <manvolnum>9</manvolnum> 7274 <refmiscinfo class="version">4.1.27</refmiscinfo> 7275</refmeta> 7276<refnamediv> 7277 <refname>iscsi_block_scsi_eh</refname> 7278 <refpurpose> 7279 block scsi eh until session state has transistioned 7280 </refpurpose> 7281</refnamediv> 7282<refsynopsisdiv> 7283 <title>Synopsis</title> 7284 <funcsynopsis><funcprototype> 7285 <funcdef>int <function>iscsi_block_scsi_eh </function></funcdef> 7286 <paramdef>struct scsi_cmnd * <parameter>cmd</parameter></paramdef> 7287 </funcprototype></funcsynopsis> 7288</refsynopsisdiv> 7289<refsect1> 7290 <title>Arguments</title> 7291 <variablelist> 7292 <varlistentry> 7293 <term><parameter>cmd</parameter></term> 7294 <listitem> 7295 <para> 7296 scsi cmd passed to scsi eh handler 7297 </para> 7298 </listitem> 7299 </varlistentry> 7300 </variablelist> 7301</refsect1> 7302<refsect1> 7303<title>Description</title> 7304<para> 7305 If the session is down this function will wait for the recovery 7306 timer to fire or for the session to be logged back in. If the 7307 recovery timer fires then FAST_IO_FAIL is returned. The caller 7308 should pass this error value to the scsi eh. 7309</para> 7310</refsect1> 7311</refentry> 7312 7313<refentry id="API-iscsi-unblock-session"> 7314<refentryinfo> 7315 <title>LINUX</title> 7316 <productname>Kernel Hackers Manual</productname> 7317 <date>July 2017</date> 7318</refentryinfo> 7319<refmeta> 7320 <refentrytitle><phrase>iscsi_unblock_session</phrase></refentrytitle> 7321 <manvolnum>9</manvolnum> 7322 <refmiscinfo class="version">4.1.27</refmiscinfo> 7323</refmeta> 7324<refnamediv> 7325 <refname>iscsi_unblock_session</refname> 7326 <refpurpose> 7327 set a session as logged in and start IO. 7328 </refpurpose> 7329</refnamediv> 7330<refsynopsisdiv> 7331 <title>Synopsis</title> 7332 <funcsynopsis><funcprototype> 7333 <funcdef>void <function>iscsi_unblock_session </function></funcdef> 7334 <paramdef>struct iscsi_cls_session * <parameter>session</parameter></paramdef> 7335 </funcprototype></funcsynopsis> 7336</refsynopsisdiv> 7337<refsect1> 7338 <title>Arguments</title> 7339 <variablelist> 7340 <varlistentry> 7341 <term><parameter>session</parameter></term> 7342 <listitem> 7343 <para> 7344 iscsi session 7345 </para> 7346 </listitem> 7347 </varlistentry> 7348 </variablelist> 7349</refsect1> 7350<refsect1> 7351<title>Description</title> 7352<para> 7353 Mark a session as ready to accept IO. 7354</para> 7355</refsect1> 7356</refentry> 7357 7358<refentry id="API-iscsi-create-session"> 7359<refentryinfo> 7360 <title>LINUX</title> 7361 <productname>Kernel Hackers Manual</productname> 7362 <date>July 2017</date> 7363</refentryinfo> 7364<refmeta> 7365 <refentrytitle><phrase>iscsi_create_session</phrase></refentrytitle> 7366 <manvolnum>9</manvolnum> 7367 <refmiscinfo class="version">4.1.27</refmiscinfo> 7368</refmeta> 7369<refnamediv> 7370 <refname>iscsi_create_session</refname> 7371 <refpurpose> 7372 create iscsi class session 7373 </refpurpose> 7374</refnamediv> 7375<refsynopsisdiv> 7376 <title>Synopsis</title> 7377 <funcsynopsis><funcprototype> 7378 <funcdef>struct iscsi_cls_session * <function>iscsi_create_session </function></funcdef> 7379 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 7380 <paramdef>struct iscsi_transport * <parameter>transport</parameter></paramdef> 7381 <paramdef>int <parameter>dd_size</parameter></paramdef> 7382 <paramdef>unsigned int <parameter>target_id</parameter></paramdef> 7383 </funcprototype></funcsynopsis> 7384</refsynopsisdiv> 7385<refsect1> 7386 <title>Arguments</title> 7387 <variablelist> 7388 <varlistentry> 7389 <term><parameter>shost</parameter></term> 7390 <listitem> 7391 <para> 7392 scsi host 7393 </para> 7394 </listitem> 7395 </varlistentry> 7396 <varlistentry> 7397 <term><parameter>transport</parameter></term> 7398 <listitem> 7399 <para> 7400 iscsi transport 7401 </para> 7402 </listitem> 7403 </varlistentry> 7404 <varlistentry> 7405 <term><parameter>dd_size</parameter></term> 7406 <listitem> 7407 <para> 7408 private driver data size 7409 </para> 7410 </listitem> 7411 </varlistentry> 7412 <varlistentry> 7413 <term><parameter>target_id</parameter></term> 7414 <listitem> 7415 <para> 7416 which target 7417 </para> 7418 </listitem> 7419 </varlistentry> 7420 </variablelist> 7421</refsect1> 7422<refsect1> 7423<title>Description</title> 7424<para> 7425 This can be called from a LLD or iscsi_transport. 7426</para> 7427</refsect1> 7428</refentry> 7429 7430<refentry id="API-iscsi-destroy-session"> 7431<refentryinfo> 7432 <title>LINUX</title> 7433 <productname>Kernel Hackers Manual</productname> 7434 <date>July 2017</date> 7435</refentryinfo> 7436<refmeta> 7437 <refentrytitle><phrase>iscsi_destroy_session</phrase></refentrytitle> 7438 <manvolnum>9</manvolnum> 7439 <refmiscinfo class="version">4.1.27</refmiscinfo> 7440</refmeta> 7441<refnamediv> 7442 <refname>iscsi_destroy_session</refname> 7443 <refpurpose> 7444 destroy iscsi session 7445 </refpurpose> 7446</refnamediv> 7447<refsynopsisdiv> 7448 <title>Synopsis</title> 7449 <funcsynopsis><funcprototype> 7450 <funcdef>int <function>iscsi_destroy_session </function></funcdef> 7451 <paramdef>struct iscsi_cls_session * <parameter>session</parameter></paramdef> 7452 </funcprototype></funcsynopsis> 7453</refsynopsisdiv> 7454<refsect1> 7455 <title>Arguments</title> 7456 <variablelist> 7457 <varlistentry> 7458 <term><parameter>session</parameter></term> 7459 <listitem> 7460 <para> 7461 iscsi_session 7462 </para> 7463 </listitem> 7464 </varlistentry> 7465 </variablelist> 7466</refsect1> 7467<refsect1> 7468<title>Description</title> 7469<para> 7470 Can be called by a LLD or iscsi_transport. There must not be 7471 any running connections. 7472</para> 7473</refsect1> 7474</refentry> 7475 7476<refentry id="API-iscsi-create-conn"> 7477<refentryinfo> 7478 <title>LINUX</title> 7479 <productname>Kernel Hackers Manual</productname> 7480 <date>July 2017</date> 7481</refentryinfo> 7482<refmeta> 7483 <refentrytitle><phrase>iscsi_create_conn</phrase></refentrytitle> 7484 <manvolnum>9</manvolnum> 7485 <refmiscinfo class="version">4.1.27</refmiscinfo> 7486</refmeta> 7487<refnamediv> 7488 <refname>iscsi_create_conn</refname> 7489 <refpurpose> 7490 create iscsi class connection 7491 </refpurpose> 7492</refnamediv> 7493<refsynopsisdiv> 7494 <title>Synopsis</title> 7495 <funcsynopsis><funcprototype> 7496 <funcdef>struct iscsi_cls_conn * <function>iscsi_create_conn </function></funcdef> 7497 <paramdef>struct iscsi_cls_session * <parameter>session</parameter></paramdef> 7498 <paramdef>int <parameter>dd_size</parameter></paramdef> 7499 <paramdef>uint32_t <parameter>cid</parameter></paramdef> 7500 </funcprototype></funcsynopsis> 7501</refsynopsisdiv> 7502<refsect1> 7503 <title>Arguments</title> 7504 <variablelist> 7505 <varlistentry> 7506 <term><parameter>session</parameter></term> 7507 <listitem> 7508 <para> 7509 iscsi cls session 7510 </para> 7511 </listitem> 7512 </varlistentry> 7513 <varlistentry> 7514 <term><parameter>dd_size</parameter></term> 7515 <listitem> 7516 <para> 7517 private driver data size 7518 </para> 7519 </listitem> 7520 </varlistentry> 7521 <varlistentry> 7522 <term><parameter>cid</parameter></term> 7523 <listitem> 7524 <para> 7525 connection id 7526 </para> 7527 </listitem> 7528 </varlistentry> 7529 </variablelist> 7530</refsect1> 7531<refsect1> 7532<title>Description</title> 7533<para> 7534 This can be called from a LLD or iscsi_transport. The connection 7535 is child of the session so cid must be unique for all connections 7536 on the session. 7537 </para><para> 7538 7539 Since we do not support MCS, cid will normally be zero. In some cases 7540 for software iscsi we could be trying to preallocate a connection struct 7541 in which case there could be two connection structs and cid would be 7542 non-zero. 7543</para> 7544</refsect1> 7545</refentry> 7546 7547<refentry id="API-iscsi-destroy-conn"> 7548<refentryinfo> 7549 <title>LINUX</title> 7550 <productname>Kernel Hackers Manual</productname> 7551 <date>July 2017</date> 7552</refentryinfo> 7553<refmeta> 7554 <refentrytitle><phrase>iscsi_destroy_conn</phrase></refentrytitle> 7555 <manvolnum>9</manvolnum> 7556 <refmiscinfo class="version">4.1.27</refmiscinfo> 7557</refmeta> 7558<refnamediv> 7559 <refname>iscsi_destroy_conn</refname> 7560 <refpurpose> 7561 destroy iscsi class connection 7562 </refpurpose> 7563</refnamediv> 7564<refsynopsisdiv> 7565 <title>Synopsis</title> 7566 <funcsynopsis><funcprototype> 7567 <funcdef>int <function>iscsi_destroy_conn </function></funcdef> 7568 <paramdef>struct iscsi_cls_conn * <parameter>conn</parameter></paramdef> 7569 </funcprototype></funcsynopsis> 7570</refsynopsisdiv> 7571<refsect1> 7572 <title>Arguments</title> 7573 <variablelist> 7574 <varlistentry> 7575 <term><parameter>conn</parameter></term> 7576 <listitem> 7577 <para> 7578 iscsi cls session 7579 </para> 7580 </listitem> 7581 </varlistentry> 7582 </variablelist> 7583</refsect1> 7584<refsect1> 7585<title>Description</title> 7586<para> 7587 This can be called from a LLD or iscsi_transport. 7588</para> 7589</refsect1> 7590</refentry> 7591 7592<refentry id="API-iscsi-session-event"> 7593<refentryinfo> 7594 <title>LINUX</title> 7595 <productname>Kernel Hackers Manual</productname> 7596 <date>July 2017</date> 7597</refentryinfo> 7598<refmeta> 7599 <refentrytitle><phrase>iscsi_session_event</phrase></refentrytitle> 7600 <manvolnum>9</manvolnum> 7601 <refmiscinfo class="version">4.1.27</refmiscinfo> 7602</refmeta> 7603<refnamediv> 7604 <refname>iscsi_session_event</refname> 7605 <refpurpose> 7606 send session destr. completion event 7607 </refpurpose> 7608</refnamediv> 7609<refsynopsisdiv> 7610 <title>Synopsis</title> 7611 <funcsynopsis><funcprototype> 7612 <funcdef>int <function>iscsi_session_event </function></funcdef> 7613 <paramdef>struct iscsi_cls_session * <parameter>session</parameter></paramdef> 7614 <paramdef>enum iscsi_uevent_e <parameter>event</parameter></paramdef> 7615 </funcprototype></funcsynopsis> 7616</refsynopsisdiv> 7617<refsect1> 7618 <title>Arguments</title> 7619 <variablelist> 7620 <varlistentry> 7621 <term><parameter>session</parameter></term> 7622 <listitem> 7623 <para> 7624 iscsi class session 7625 </para> 7626 </listitem> 7627 </varlistentry> 7628 <varlistentry> 7629 <term><parameter>event</parameter></term> 7630 <listitem> 7631 <para> 7632 type of event 7633 </para> 7634 </listitem> 7635 </varlistentry> 7636 </variablelist> 7637</refsect1> 7638</refentry> 7639 7640 </sect2> 7641 <sect2 id="SAS_transport"> 7642 <title>Serial Attached SCSI (SAS) transport class</title> 7643 <para> 7644 The file drivers/scsi/scsi_transport_sas.c defines transport 7645 attributes for Serial Attached SCSI, a variant of SATA aimed at 7646 large high-end systems. 7647 </para> 7648 <para> 7649 The SAS transport class contains common code to deal with SAS HBAs, 7650 an aproximated representation of SAS topologies in the driver model, 7651 and various sysfs attributes to expose these topologies and management 7652 interfaces to userspace. 7653 </para> 7654 <para> 7655 In addition to the basic SCSI core objects this transport class 7656 introduces two additional intermediate objects: The SAS PHY 7657 as represented by struct sas_phy defines an "outgoing" PHY on 7658 a SAS HBA or Expander, and the SAS remote PHY represented by 7659 struct sas_rphy defines an "incoming" PHY on a SAS Expander or 7660 end device. Note that this is purely a software concept, the 7661 underlying hardware for a PHY and a remote PHY is the exactly 7662 the same. 7663 </para> 7664 <para> 7665 There is no concept of a SAS port in this code, users can see 7666 what PHYs form a wide port based on the port_identifier attribute, 7667 which is the same for all PHYs in a port. 7668 </para> 7669<!-- drivers/scsi/scsi_transport_sas.c --> 7670<refentry id="API-sas-remove-children"> 7671<refentryinfo> 7672 <title>LINUX</title> 7673 <productname>Kernel Hackers Manual</productname> 7674 <date>July 2017</date> 7675</refentryinfo> 7676<refmeta> 7677 <refentrytitle><phrase>sas_remove_children</phrase></refentrytitle> 7678 <manvolnum>9</manvolnum> 7679 <refmiscinfo class="version">4.1.27</refmiscinfo> 7680</refmeta> 7681<refnamediv> 7682 <refname>sas_remove_children</refname> 7683 <refpurpose> 7684 tear down a devices SAS data structures 7685 </refpurpose> 7686</refnamediv> 7687<refsynopsisdiv> 7688 <title>Synopsis</title> 7689 <funcsynopsis><funcprototype> 7690 <funcdef>void <function>sas_remove_children </function></funcdef> 7691 <paramdef>struct device * <parameter>dev</parameter></paramdef> 7692 </funcprototype></funcsynopsis> 7693</refsynopsisdiv> 7694<refsect1> 7695 <title>Arguments</title> 7696 <variablelist> 7697 <varlistentry> 7698 <term><parameter>dev</parameter></term> 7699 <listitem> 7700 <para> 7701 device belonging to the sas object 7702 </para> 7703 </listitem> 7704 </varlistentry> 7705 </variablelist> 7706</refsect1> 7707<refsect1> 7708<title>Description</title> 7709<para> 7710 Removes all SAS PHYs and remote PHYs for a given object 7711</para> 7712</refsect1> 7713</refentry> 7714 7715<refentry id="API-sas-remove-host"> 7716<refentryinfo> 7717 <title>LINUX</title> 7718 <productname>Kernel Hackers Manual</productname> 7719 <date>July 2017</date> 7720</refentryinfo> 7721<refmeta> 7722 <refentrytitle><phrase>sas_remove_host</phrase></refentrytitle> 7723 <manvolnum>9</manvolnum> 7724 <refmiscinfo class="version">4.1.27</refmiscinfo> 7725</refmeta> 7726<refnamediv> 7727 <refname>sas_remove_host</refname> 7728 <refpurpose> 7729 tear down a Scsi_Host's SAS data structures 7730 </refpurpose> 7731</refnamediv> 7732<refsynopsisdiv> 7733 <title>Synopsis</title> 7734 <funcsynopsis><funcprototype> 7735 <funcdef>void <function>sas_remove_host </function></funcdef> 7736 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 7737 </funcprototype></funcsynopsis> 7738</refsynopsisdiv> 7739<refsect1> 7740 <title>Arguments</title> 7741 <variablelist> 7742 <varlistentry> 7743 <term><parameter>shost</parameter></term> 7744 <listitem> 7745 <para> 7746 Scsi Host that is torn down 7747 </para> 7748 </listitem> 7749 </varlistentry> 7750 </variablelist> 7751</refsect1> 7752<refsect1> 7753<title>Description</title> 7754<para> 7755 Removes all SAS PHYs and remote PHYs for a given Scsi_Host. 7756 Must be called just before scsi_remove_host for SAS HBAs. 7757</para> 7758</refsect1> 7759</refentry> 7760 7761<refentry id="API-sas-tlr-supported"> 7762<refentryinfo> 7763 <title>LINUX</title> 7764 <productname>Kernel Hackers Manual</productname> 7765 <date>July 2017</date> 7766</refentryinfo> 7767<refmeta> 7768 <refentrytitle><phrase>sas_tlr_supported</phrase></refentrytitle> 7769 <manvolnum>9</manvolnum> 7770 <refmiscinfo class="version">4.1.27</refmiscinfo> 7771</refmeta> 7772<refnamediv> 7773 <refname>sas_tlr_supported</refname> 7774 <refpurpose> 7775 checking TLR bit in vpd 0x90 7776 </refpurpose> 7777</refnamediv> 7778<refsynopsisdiv> 7779 <title>Synopsis</title> 7780 <funcsynopsis><funcprototype> 7781 <funcdef>unsigned int <function>sas_tlr_supported </function></funcdef> 7782 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 7783 </funcprototype></funcsynopsis> 7784</refsynopsisdiv> 7785<refsect1> 7786 <title>Arguments</title> 7787 <variablelist> 7788 <varlistentry> 7789 <term><parameter>sdev</parameter></term> 7790 <listitem> 7791 <para> 7792 scsi device struct 7793 </para> 7794 </listitem> 7795 </varlistentry> 7796 </variablelist> 7797</refsect1> 7798<refsect1> 7799<title>Description</title> 7800<para> 7801 Check Transport Layer Retries are supported or not. 7802 If vpd page 0x90 is present, TRL is supported. 7803</para> 7804</refsect1> 7805</refentry> 7806 7807<refentry id="API-sas-disable-tlr"> 7808<refentryinfo> 7809 <title>LINUX</title> 7810 <productname>Kernel Hackers Manual</productname> 7811 <date>July 2017</date> 7812</refentryinfo> 7813<refmeta> 7814 <refentrytitle><phrase>sas_disable_tlr</phrase></refentrytitle> 7815 <manvolnum>9</manvolnum> 7816 <refmiscinfo class="version">4.1.27</refmiscinfo> 7817</refmeta> 7818<refnamediv> 7819 <refname>sas_disable_tlr</refname> 7820 <refpurpose> 7821 setting TLR flags 7822 </refpurpose> 7823</refnamediv> 7824<refsynopsisdiv> 7825 <title>Synopsis</title> 7826 <funcsynopsis><funcprototype> 7827 <funcdef>void <function>sas_disable_tlr </function></funcdef> 7828 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 7829 </funcprototype></funcsynopsis> 7830</refsynopsisdiv> 7831<refsect1> 7832 <title>Arguments</title> 7833 <variablelist> 7834 <varlistentry> 7835 <term><parameter>sdev</parameter></term> 7836 <listitem> 7837 <para> 7838 scsi device struct 7839 </para> 7840 </listitem> 7841 </varlistentry> 7842 </variablelist> 7843</refsect1> 7844<refsect1> 7845<title>Description</title> 7846<para> 7847 Seting tlr_enabled flag to 0. 7848</para> 7849</refsect1> 7850</refentry> 7851 7852<refentry id="API-sas-enable-tlr"> 7853<refentryinfo> 7854 <title>LINUX</title> 7855 <productname>Kernel Hackers Manual</productname> 7856 <date>July 2017</date> 7857</refentryinfo> 7858<refmeta> 7859 <refentrytitle><phrase>sas_enable_tlr</phrase></refentrytitle> 7860 <manvolnum>9</manvolnum> 7861 <refmiscinfo class="version">4.1.27</refmiscinfo> 7862</refmeta> 7863<refnamediv> 7864 <refname>sas_enable_tlr</refname> 7865 <refpurpose> 7866 setting TLR flags 7867 </refpurpose> 7868</refnamediv> 7869<refsynopsisdiv> 7870 <title>Synopsis</title> 7871 <funcsynopsis><funcprototype> 7872 <funcdef>void <function>sas_enable_tlr </function></funcdef> 7873 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 7874 </funcprototype></funcsynopsis> 7875</refsynopsisdiv> 7876<refsect1> 7877 <title>Arguments</title> 7878 <variablelist> 7879 <varlistentry> 7880 <term><parameter>sdev</parameter></term> 7881 <listitem> 7882 <para> 7883 scsi device struct 7884 </para> 7885 </listitem> 7886 </varlistentry> 7887 </variablelist> 7888</refsect1> 7889<refsect1> 7890<title>Description</title> 7891<para> 7892 Seting tlr_enabled flag 1. 7893</para> 7894</refsect1> 7895</refentry> 7896 7897<refentry id="API-sas-phy-alloc"> 7898<refentryinfo> 7899 <title>LINUX</title> 7900 <productname>Kernel Hackers Manual</productname> 7901 <date>July 2017</date> 7902</refentryinfo> 7903<refmeta> 7904 <refentrytitle><phrase>sas_phy_alloc</phrase></refentrytitle> 7905 <manvolnum>9</manvolnum> 7906 <refmiscinfo class="version">4.1.27</refmiscinfo> 7907</refmeta> 7908<refnamediv> 7909 <refname>sas_phy_alloc</refname> 7910 <refpurpose> 7911 allocates and initialize a SAS PHY structure 7912 </refpurpose> 7913</refnamediv> 7914<refsynopsisdiv> 7915 <title>Synopsis</title> 7916 <funcsynopsis><funcprototype> 7917 <funcdef>struct sas_phy * <function>sas_phy_alloc </function></funcdef> 7918 <paramdef>struct device * <parameter>parent</parameter></paramdef> 7919 <paramdef>int <parameter>number</parameter></paramdef> 7920 </funcprototype></funcsynopsis> 7921</refsynopsisdiv> 7922<refsect1> 7923 <title>Arguments</title> 7924 <variablelist> 7925 <varlistentry> 7926 <term><parameter>parent</parameter></term> 7927 <listitem> 7928 <para> 7929 Parent device 7930 </para> 7931 </listitem> 7932 </varlistentry> 7933 <varlistentry> 7934 <term><parameter>number</parameter></term> 7935 <listitem> 7936 <para> 7937 Phy index 7938 </para> 7939 </listitem> 7940 </varlistentry> 7941 </variablelist> 7942</refsect1> 7943<refsect1> 7944<title>Description</title> 7945<para> 7946 Allocates an SAS PHY structure. It will be added in the device tree 7947 below the device specified by <parameter>parent</parameter>, which has to be either a Scsi_Host 7948 or sas_rphy. 7949</para> 7950</refsect1> 7951<refsect1> 7952<title>Returns</title> 7953<para> 7954 SAS PHY allocated or <constant>NULL</constant> if the allocation failed. 7955</para> 7956</refsect1> 7957</refentry> 7958 7959<refentry id="API-sas-phy-add"> 7960<refentryinfo> 7961 <title>LINUX</title> 7962 <productname>Kernel Hackers Manual</productname> 7963 <date>July 2017</date> 7964</refentryinfo> 7965<refmeta> 7966 <refentrytitle><phrase>sas_phy_add</phrase></refentrytitle> 7967 <manvolnum>9</manvolnum> 7968 <refmiscinfo class="version">4.1.27</refmiscinfo> 7969</refmeta> 7970<refnamediv> 7971 <refname>sas_phy_add</refname> 7972 <refpurpose> 7973 add a SAS PHY to the device hierarchy 7974 </refpurpose> 7975</refnamediv> 7976<refsynopsisdiv> 7977 <title>Synopsis</title> 7978 <funcsynopsis><funcprototype> 7979 <funcdef>int <function>sas_phy_add </function></funcdef> 7980 <paramdef>struct sas_phy * <parameter>phy</parameter></paramdef> 7981 </funcprototype></funcsynopsis> 7982</refsynopsisdiv> 7983<refsect1> 7984 <title>Arguments</title> 7985 <variablelist> 7986 <varlistentry> 7987 <term><parameter>phy</parameter></term> 7988 <listitem> 7989 <para> 7990 The PHY to be added 7991 </para> 7992 </listitem> 7993 </varlistentry> 7994 </variablelist> 7995</refsect1> 7996<refsect1> 7997<title>Description</title> 7998<para> 7999 Publishes a SAS PHY to the rest of the system. 8000</para> 8001</refsect1> 8002</refentry> 8003 8004<refentry id="API-sas-phy-free"> 8005<refentryinfo> 8006 <title>LINUX</title> 8007 <productname>Kernel Hackers Manual</productname> 8008 <date>July 2017</date> 8009</refentryinfo> 8010<refmeta> 8011 <refentrytitle><phrase>sas_phy_free</phrase></refentrytitle> 8012 <manvolnum>9</manvolnum> 8013 <refmiscinfo class="version">4.1.27</refmiscinfo> 8014</refmeta> 8015<refnamediv> 8016 <refname>sas_phy_free</refname> 8017 <refpurpose> 8018 free a SAS PHY 8019 </refpurpose> 8020</refnamediv> 8021<refsynopsisdiv> 8022 <title>Synopsis</title> 8023 <funcsynopsis><funcprototype> 8024 <funcdef>void <function>sas_phy_free </function></funcdef> 8025 <paramdef>struct sas_phy * <parameter>phy</parameter></paramdef> 8026 </funcprototype></funcsynopsis> 8027</refsynopsisdiv> 8028<refsect1> 8029 <title>Arguments</title> 8030 <variablelist> 8031 <varlistentry> 8032 <term><parameter>phy</parameter></term> 8033 <listitem> 8034 <para> 8035 SAS PHY to free 8036 </para> 8037 </listitem> 8038 </varlistentry> 8039 </variablelist> 8040</refsect1> 8041<refsect1> 8042<title>Description</title> 8043<para> 8044 Frees the specified SAS PHY. 8045</para> 8046</refsect1> 8047<refsect1> 8048<title>Note</title> 8049<para> 8050 This function must only be called on a PHY that has not 8051 successfully been added using <function>sas_phy_add</function>. 8052</para> 8053</refsect1> 8054</refentry> 8055 8056<refentry id="API-sas-phy-delete"> 8057<refentryinfo> 8058 <title>LINUX</title> 8059 <productname>Kernel Hackers Manual</productname> 8060 <date>July 2017</date> 8061</refentryinfo> 8062<refmeta> 8063 <refentrytitle><phrase>sas_phy_delete</phrase></refentrytitle> 8064 <manvolnum>9</manvolnum> 8065 <refmiscinfo class="version">4.1.27</refmiscinfo> 8066</refmeta> 8067<refnamediv> 8068 <refname>sas_phy_delete</refname> 8069 <refpurpose> 8070 remove SAS PHY 8071 </refpurpose> 8072</refnamediv> 8073<refsynopsisdiv> 8074 <title>Synopsis</title> 8075 <funcsynopsis><funcprototype> 8076 <funcdef>void <function>sas_phy_delete </function></funcdef> 8077 <paramdef>struct sas_phy * <parameter>phy</parameter></paramdef> 8078 </funcprototype></funcsynopsis> 8079</refsynopsisdiv> 8080<refsect1> 8081 <title>Arguments</title> 8082 <variablelist> 8083 <varlistentry> 8084 <term><parameter>phy</parameter></term> 8085 <listitem> 8086 <para> 8087 SAS PHY to remove 8088 </para> 8089 </listitem> 8090 </varlistentry> 8091 </variablelist> 8092</refsect1> 8093<refsect1> 8094<title>Description</title> 8095<para> 8096 Removes the specified SAS PHY. If the SAS PHY has an 8097 associated remote PHY it is removed before. 8098</para> 8099</refsect1> 8100</refentry> 8101 8102<refentry id="API-scsi-is-sas-phy"> 8103<refentryinfo> 8104 <title>LINUX</title> 8105 <productname>Kernel Hackers Manual</productname> 8106 <date>July 2017</date> 8107</refentryinfo> 8108<refmeta> 8109 <refentrytitle><phrase>scsi_is_sas_phy</phrase></refentrytitle> 8110 <manvolnum>9</manvolnum> 8111 <refmiscinfo class="version">4.1.27</refmiscinfo> 8112</refmeta> 8113<refnamediv> 8114 <refname>scsi_is_sas_phy</refname> 8115 <refpurpose> 8116 check if a struct device represents a SAS PHY 8117 </refpurpose> 8118</refnamediv> 8119<refsynopsisdiv> 8120 <title>Synopsis</title> 8121 <funcsynopsis><funcprototype> 8122 <funcdef>int <function>scsi_is_sas_phy </function></funcdef> 8123 <paramdef>const struct device * <parameter>dev</parameter></paramdef> 8124 </funcprototype></funcsynopsis> 8125</refsynopsisdiv> 8126<refsect1> 8127 <title>Arguments</title> 8128 <variablelist> 8129 <varlistentry> 8130 <term><parameter>dev</parameter></term> 8131 <listitem> 8132 <para> 8133 device to check 8134 </para> 8135 </listitem> 8136 </varlistentry> 8137 </variablelist> 8138</refsect1> 8139<refsect1> 8140<title>Returns</title> 8141<para> 8142 <constant>1</constant> if the device represents a SAS PHY, <constant>0</constant> else 8143</para> 8144</refsect1> 8145</refentry> 8146 8147<refentry id="API-sas-port-add"> 8148<refentryinfo> 8149 <title>LINUX</title> 8150 <productname>Kernel Hackers Manual</productname> 8151 <date>July 2017</date> 8152</refentryinfo> 8153<refmeta> 8154 <refentrytitle><phrase>sas_port_add</phrase></refentrytitle> 8155 <manvolnum>9</manvolnum> 8156 <refmiscinfo class="version">4.1.27</refmiscinfo> 8157</refmeta> 8158<refnamediv> 8159 <refname>sas_port_add</refname> 8160 <refpurpose> 8161 add a SAS port to the device hierarchy 8162 </refpurpose> 8163</refnamediv> 8164<refsynopsisdiv> 8165 <title>Synopsis</title> 8166 <funcsynopsis><funcprototype> 8167 <funcdef>int <function>sas_port_add </function></funcdef> 8168 <paramdef>struct sas_port * <parameter>port</parameter></paramdef> 8169 </funcprototype></funcsynopsis> 8170</refsynopsisdiv> 8171<refsect1> 8172 <title>Arguments</title> 8173 <variablelist> 8174 <varlistentry> 8175 <term><parameter>port</parameter></term> 8176 <listitem> 8177 <para> 8178 port to be added 8179 </para> 8180 </listitem> 8181 </varlistentry> 8182 </variablelist> 8183</refsect1> 8184<refsect1> 8185<title>Description</title> 8186<para> 8187 publishes a port to the rest of the system 8188</para> 8189</refsect1> 8190</refentry> 8191 8192<refentry id="API-sas-port-free"> 8193<refentryinfo> 8194 <title>LINUX</title> 8195 <productname>Kernel Hackers Manual</productname> 8196 <date>July 2017</date> 8197</refentryinfo> 8198<refmeta> 8199 <refentrytitle><phrase>sas_port_free</phrase></refentrytitle> 8200 <manvolnum>9</manvolnum> 8201 <refmiscinfo class="version">4.1.27</refmiscinfo> 8202</refmeta> 8203<refnamediv> 8204 <refname>sas_port_free</refname> 8205 <refpurpose> 8206 free a SAS PORT 8207 </refpurpose> 8208</refnamediv> 8209<refsynopsisdiv> 8210 <title>Synopsis</title> 8211 <funcsynopsis><funcprototype> 8212 <funcdef>void <function>sas_port_free </function></funcdef> 8213 <paramdef>struct sas_port * <parameter>port</parameter></paramdef> 8214 </funcprototype></funcsynopsis> 8215</refsynopsisdiv> 8216<refsect1> 8217 <title>Arguments</title> 8218 <variablelist> 8219 <varlistentry> 8220 <term><parameter>port</parameter></term> 8221 <listitem> 8222 <para> 8223 SAS PORT to free 8224 </para> 8225 </listitem> 8226 </varlistentry> 8227 </variablelist> 8228</refsect1> 8229<refsect1> 8230<title>Description</title> 8231<para> 8232 Frees the specified SAS PORT. 8233</para> 8234</refsect1> 8235<refsect1> 8236<title>Note</title> 8237<para> 8238 This function must only be called on a PORT that has not 8239 successfully been added using <function>sas_port_add</function>. 8240</para> 8241</refsect1> 8242</refentry> 8243 8244<refentry id="API-sas-port-delete"> 8245<refentryinfo> 8246 <title>LINUX</title> 8247 <productname>Kernel Hackers Manual</productname> 8248 <date>July 2017</date> 8249</refentryinfo> 8250<refmeta> 8251 <refentrytitle><phrase>sas_port_delete</phrase></refentrytitle> 8252 <manvolnum>9</manvolnum> 8253 <refmiscinfo class="version">4.1.27</refmiscinfo> 8254</refmeta> 8255<refnamediv> 8256 <refname>sas_port_delete</refname> 8257 <refpurpose> 8258 remove SAS PORT 8259 </refpurpose> 8260</refnamediv> 8261<refsynopsisdiv> 8262 <title>Synopsis</title> 8263 <funcsynopsis><funcprototype> 8264 <funcdef>void <function>sas_port_delete </function></funcdef> 8265 <paramdef>struct sas_port * <parameter>port</parameter></paramdef> 8266 </funcprototype></funcsynopsis> 8267</refsynopsisdiv> 8268<refsect1> 8269 <title>Arguments</title> 8270 <variablelist> 8271 <varlistentry> 8272 <term><parameter>port</parameter></term> 8273 <listitem> 8274 <para> 8275 SAS PORT to remove 8276 </para> 8277 </listitem> 8278 </varlistentry> 8279 </variablelist> 8280</refsect1> 8281<refsect1> 8282<title>Description</title> 8283<para> 8284 Removes the specified SAS PORT. If the SAS PORT has an 8285 associated phys, unlink them from the port as well. 8286</para> 8287</refsect1> 8288</refentry> 8289 8290<refentry id="API-scsi-is-sas-port"> 8291<refentryinfo> 8292 <title>LINUX</title> 8293 <productname>Kernel Hackers Manual</productname> 8294 <date>July 2017</date> 8295</refentryinfo> 8296<refmeta> 8297 <refentrytitle><phrase>scsi_is_sas_port</phrase></refentrytitle> 8298 <manvolnum>9</manvolnum> 8299 <refmiscinfo class="version">4.1.27</refmiscinfo> 8300</refmeta> 8301<refnamediv> 8302 <refname>scsi_is_sas_port</refname> 8303 <refpurpose> 8304 check if a struct device represents a SAS port 8305 </refpurpose> 8306</refnamediv> 8307<refsynopsisdiv> 8308 <title>Synopsis</title> 8309 <funcsynopsis><funcprototype> 8310 <funcdef>int <function>scsi_is_sas_port </function></funcdef> 8311 <paramdef>const struct device * <parameter>dev</parameter></paramdef> 8312 </funcprototype></funcsynopsis> 8313</refsynopsisdiv> 8314<refsect1> 8315 <title>Arguments</title> 8316 <variablelist> 8317 <varlistentry> 8318 <term><parameter>dev</parameter></term> 8319 <listitem> 8320 <para> 8321 device to check 8322 </para> 8323 </listitem> 8324 </varlistentry> 8325 </variablelist> 8326</refsect1> 8327<refsect1> 8328<title>Returns</title> 8329<para> 8330 <constant>1</constant> if the device represents a SAS Port, <constant>0</constant> else 8331</para> 8332</refsect1> 8333</refentry> 8334 8335<refentry id="API-sas-port-get-phy"> 8336<refentryinfo> 8337 <title>LINUX</title> 8338 <productname>Kernel Hackers Manual</productname> 8339 <date>July 2017</date> 8340</refentryinfo> 8341<refmeta> 8342 <refentrytitle><phrase>sas_port_get_phy</phrase></refentrytitle> 8343 <manvolnum>9</manvolnum> 8344 <refmiscinfo class="version">4.1.27</refmiscinfo> 8345</refmeta> 8346<refnamediv> 8347 <refname>sas_port_get_phy</refname> 8348 <refpurpose> 8349 try to take a reference on a port member 8350 </refpurpose> 8351</refnamediv> 8352<refsynopsisdiv> 8353 <title>Synopsis</title> 8354 <funcsynopsis><funcprototype> 8355 <funcdef>struct sas_phy * <function>sas_port_get_phy </function></funcdef> 8356 <paramdef>struct sas_port * <parameter>port</parameter></paramdef> 8357 </funcprototype></funcsynopsis> 8358</refsynopsisdiv> 8359<refsect1> 8360 <title>Arguments</title> 8361 <variablelist> 8362 <varlistentry> 8363 <term><parameter>port</parameter></term> 8364 <listitem> 8365 <para> 8366 port to check 8367 </para> 8368 </listitem> 8369 </varlistentry> 8370 </variablelist> 8371</refsect1> 8372</refentry> 8373 8374<refentry id="API-sas-port-add-phy"> 8375<refentryinfo> 8376 <title>LINUX</title> 8377 <productname>Kernel Hackers Manual</productname> 8378 <date>July 2017</date> 8379</refentryinfo> 8380<refmeta> 8381 <refentrytitle><phrase>sas_port_add_phy</phrase></refentrytitle> 8382 <manvolnum>9</manvolnum> 8383 <refmiscinfo class="version">4.1.27</refmiscinfo> 8384</refmeta> 8385<refnamediv> 8386 <refname>sas_port_add_phy</refname> 8387 <refpurpose> 8388 add another phy to a port to form a wide port 8389 </refpurpose> 8390</refnamediv> 8391<refsynopsisdiv> 8392 <title>Synopsis</title> 8393 <funcsynopsis><funcprototype> 8394 <funcdef>void <function>sas_port_add_phy </function></funcdef> 8395 <paramdef>struct sas_port * <parameter>port</parameter></paramdef> 8396 <paramdef>struct sas_phy * <parameter>phy</parameter></paramdef> 8397 </funcprototype></funcsynopsis> 8398</refsynopsisdiv> 8399<refsect1> 8400 <title>Arguments</title> 8401 <variablelist> 8402 <varlistentry> 8403 <term><parameter>port</parameter></term> 8404 <listitem> 8405 <para> 8406 port to add the phy to 8407 </para> 8408 </listitem> 8409 </varlistentry> 8410 <varlistentry> 8411 <term><parameter>phy</parameter></term> 8412 <listitem> 8413 <para> 8414 phy to add 8415 </para> 8416 </listitem> 8417 </varlistentry> 8418 </variablelist> 8419</refsect1> 8420<refsect1> 8421<title>Description</title> 8422<para> 8423 When a port is initially created, it is empty (has no phys). All 8424 ports must have at least one phy to operated, and all wide ports 8425 must have at least two. The current code makes no difference 8426 between ports and wide ports, but the only object that can be 8427 connected to a remote device is a port, so ports must be formed on 8428 all devices with phys if they're connected to anything. 8429</para> 8430</refsect1> 8431</refentry> 8432 8433<refentry id="API-sas-port-delete-phy"> 8434<refentryinfo> 8435 <title>LINUX</title> 8436 <productname>Kernel Hackers Manual</productname> 8437 <date>July 2017</date> 8438</refentryinfo> 8439<refmeta> 8440 <refentrytitle><phrase>sas_port_delete_phy</phrase></refentrytitle> 8441 <manvolnum>9</manvolnum> 8442 <refmiscinfo class="version">4.1.27</refmiscinfo> 8443</refmeta> 8444<refnamediv> 8445 <refname>sas_port_delete_phy</refname> 8446 <refpurpose> 8447 remove a phy from a port or wide port 8448 </refpurpose> 8449</refnamediv> 8450<refsynopsisdiv> 8451 <title>Synopsis</title> 8452 <funcsynopsis><funcprototype> 8453 <funcdef>void <function>sas_port_delete_phy </function></funcdef> 8454 <paramdef>struct sas_port * <parameter>port</parameter></paramdef> 8455 <paramdef>struct sas_phy * <parameter>phy</parameter></paramdef> 8456 </funcprototype></funcsynopsis> 8457</refsynopsisdiv> 8458<refsect1> 8459 <title>Arguments</title> 8460 <variablelist> 8461 <varlistentry> 8462 <term><parameter>port</parameter></term> 8463 <listitem> 8464 <para> 8465 port to remove the phy from 8466 </para> 8467 </listitem> 8468 </varlistentry> 8469 <varlistentry> 8470 <term><parameter>phy</parameter></term> 8471 <listitem> 8472 <para> 8473 phy to remove 8474 </para> 8475 </listitem> 8476 </varlistentry> 8477 </variablelist> 8478</refsect1> 8479<refsect1> 8480<title>Description</title> 8481<para> 8482 This operation is used for tearing down ports again. It must be 8483 done to every port or wide port before calling sas_port_delete. 8484</para> 8485</refsect1> 8486</refentry> 8487 8488<refentry id="API-sas-end-device-alloc"> 8489<refentryinfo> 8490 <title>LINUX</title> 8491 <productname>Kernel Hackers Manual</productname> 8492 <date>July 2017</date> 8493</refentryinfo> 8494<refmeta> 8495 <refentrytitle><phrase>sas_end_device_alloc</phrase></refentrytitle> 8496 <manvolnum>9</manvolnum> 8497 <refmiscinfo class="version">4.1.27</refmiscinfo> 8498</refmeta> 8499<refnamediv> 8500 <refname>sas_end_device_alloc</refname> 8501 <refpurpose> 8502 allocate an rphy for an end device 8503 </refpurpose> 8504</refnamediv> 8505<refsynopsisdiv> 8506 <title>Synopsis</title> 8507 <funcsynopsis><funcprototype> 8508 <funcdef>struct sas_rphy * <function>sas_end_device_alloc </function></funcdef> 8509 <paramdef>struct sas_port * <parameter>parent</parameter></paramdef> 8510 </funcprototype></funcsynopsis> 8511</refsynopsisdiv> 8512<refsect1> 8513 <title>Arguments</title> 8514 <variablelist> 8515 <varlistentry> 8516 <term><parameter>parent</parameter></term> 8517 <listitem> 8518 <para> 8519 which port 8520 </para> 8521 </listitem> 8522 </varlistentry> 8523 </variablelist> 8524</refsect1> 8525<refsect1> 8526<title>Description</title> 8527<para> 8528 Allocates an SAS remote PHY structure, connected to <parameter>parent</parameter>. 8529</para> 8530</refsect1> 8531<refsect1> 8532<title>Returns</title> 8533<para> 8534 SAS PHY allocated or <constant>NULL</constant> if the allocation failed. 8535</para> 8536</refsect1> 8537</refentry> 8538 8539<refentry id="API-sas-expander-alloc"> 8540<refentryinfo> 8541 <title>LINUX</title> 8542 <productname>Kernel Hackers Manual</productname> 8543 <date>July 2017</date> 8544</refentryinfo> 8545<refmeta> 8546 <refentrytitle><phrase>sas_expander_alloc</phrase></refentrytitle> 8547 <manvolnum>9</manvolnum> 8548 <refmiscinfo class="version">4.1.27</refmiscinfo> 8549</refmeta> 8550<refnamediv> 8551 <refname>sas_expander_alloc</refname> 8552 <refpurpose> 8553 allocate an rphy for an end device 8554 </refpurpose> 8555</refnamediv> 8556<refsynopsisdiv> 8557 <title>Synopsis</title> 8558 <funcsynopsis><funcprototype> 8559 <funcdef>struct sas_rphy * <function>sas_expander_alloc </function></funcdef> 8560 <paramdef>struct sas_port * <parameter>parent</parameter></paramdef> 8561 <paramdef>enum sas_device_type <parameter>type</parameter></paramdef> 8562 </funcprototype></funcsynopsis> 8563</refsynopsisdiv> 8564<refsect1> 8565 <title>Arguments</title> 8566 <variablelist> 8567 <varlistentry> 8568 <term><parameter>parent</parameter></term> 8569 <listitem> 8570 <para> 8571 which port 8572 </para> 8573 </listitem> 8574 </varlistentry> 8575 <varlistentry> 8576 <term><parameter>type</parameter></term> 8577 <listitem> 8578 <para> 8579 SAS_EDGE_EXPANDER_DEVICE or SAS_FANOUT_EXPANDER_DEVICE 8580 </para> 8581 </listitem> 8582 </varlistentry> 8583 </variablelist> 8584</refsect1> 8585<refsect1> 8586<title>Description</title> 8587<para> 8588 Allocates an SAS remote PHY structure, connected to <parameter>parent</parameter>. 8589</para> 8590</refsect1> 8591<refsect1> 8592<title>Returns</title> 8593<para> 8594 SAS PHY allocated or <constant>NULL</constant> if the allocation failed. 8595</para> 8596</refsect1> 8597</refentry> 8598 8599<refentry id="API-sas-rphy-add"> 8600<refentryinfo> 8601 <title>LINUX</title> 8602 <productname>Kernel Hackers Manual</productname> 8603 <date>July 2017</date> 8604</refentryinfo> 8605<refmeta> 8606 <refentrytitle><phrase>sas_rphy_add</phrase></refentrytitle> 8607 <manvolnum>9</manvolnum> 8608 <refmiscinfo class="version">4.1.27</refmiscinfo> 8609</refmeta> 8610<refnamediv> 8611 <refname>sas_rphy_add</refname> 8612 <refpurpose> 8613 add a SAS remote PHY to the device hierarchy 8614 </refpurpose> 8615</refnamediv> 8616<refsynopsisdiv> 8617 <title>Synopsis</title> 8618 <funcsynopsis><funcprototype> 8619 <funcdef>int <function>sas_rphy_add </function></funcdef> 8620 <paramdef>struct sas_rphy * <parameter>rphy</parameter></paramdef> 8621 </funcprototype></funcsynopsis> 8622</refsynopsisdiv> 8623<refsect1> 8624 <title>Arguments</title> 8625 <variablelist> 8626 <varlistentry> 8627 <term><parameter>rphy</parameter></term> 8628 <listitem> 8629 <para> 8630 The remote PHY to be added 8631 </para> 8632 </listitem> 8633 </varlistentry> 8634 </variablelist> 8635</refsect1> 8636<refsect1> 8637<title>Description</title> 8638<para> 8639 Publishes a SAS remote PHY to the rest of the system. 8640</para> 8641</refsect1> 8642</refentry> 8643 8644<refentry id="API-sas-rphy-free"> 8645<refentryinfo> 8646 <title>LINUX</title> 8647 <productname>Kernel Hackers Manual</productname> 8648 <date>July 2017</date> 8649</refentryinfo> 8650<refmeta> 8651 <refentrytitle><phrase>sas_rphy_free</phrase></refentrytitle> 8652 <manvolnum>9</manvolnum> 8653 <refmiscinfo class="version">4.1.27</refmiscinfo> 8654</refmeta> 8655<refnamediv> 8656 <refname>sas_rphy_free</refname> 8657 <refpurpose> 8658 free a SAS remote PHY 8659 </refpurpose> 8660</refnamediv> 8661<refsynopsisdiv> 8662 <title>Synopsis</title> 8663 <funcsynopsis><funcprototype> 8664 <funcdef>void <function>sas_rphy_free </function></funcdef> 8665 <paramdef>struct sas_rphy * <parameter>rphy</parameter></paramdef> 8666 </funcprototype></funcsynopsis> 8667</refsynopsisdiv> 8668<refsect1> 8669 <title>Arguments</title> 8670 <variablelist> 8671 <varlistentry> 8672 <term><parameter>rphy</parameter></term> 8673 <listitem> 8674 <para> 8675 SAS remote PHY to free 8676 </para> 8677 </listitem> 8678 </varlistentry> 8679 </variablelist> 8680</refsect1> 8681<refsect1> 8682<title>Description</title> 8683<para> 8684 Frees the specified SAS remote PHY. 8685</para> 8686</refsect1> 8687<refsect1> 8688<title>Note</title> 8689<para> 8690 This function must only be called on a remote 8691 PHY that has not successfully been added using 8692 <function>sas_rphy_add</function> (or has been <function>sas_rphy_remove</function>'d) 8693</para> 8694</refsect1> 8695</refentry> 8696 8697<refentry id="API-sas-rphy-delete"> 8698<refentryinfo> 8699 <title>LINUX</title> 8700 <productname>Kernel Hackers Manual</productname> 8701 <date>July 2017</date> 8702</refentryinfo> 8703<refmeta> 8704 <refentrytitle><phrase>sas_rphy_delete</phrase></refentrytitle> 8705 <manvolnum>9</manvolnum> 8706 <refmiscinfo class="version">4.1.27</refmiscinfo> 8707</refmeta> 8708<refnamediv> 8709 <refname>sas_rphy_delete</refname> 8710 <refpurpose> 8711 remove and free SAS remote PHY 8712 </refpurpose> 8713</refnamediv> 8714<refsynopsisdiv> 8715 <title>Synopsis</title> 8716 <funcsynopsis><funcprototype> 8717 <funcdef>void <function>sas_rphy_delete </function></funcdef> 8718 <paramdef>struct sas_rphy * <parameter>rphy</parameter></paramdef> 8719 </funcprototype></funcsynopsis> 8720</refsynopsisdiv> 8721<refsect1> 8722 <title>Arguments</title> 8723 <variablelist> 8724 <varlistentry> 8725 <term><parameter>rphy</parameter></term> 8726 <listitem> 8727 <para> 8728 SAS remote PHY to remove and free 8729 </para> 8730 </listitem> 8731 </varlistentry> 8732 </variablelist> 8733</refsect1> 8734<refsect1> 8735<title>Description</title> 8736<para> 8737 Removes the specified SAS remote PHY and frees it. 8738</para> 8739</refsect1> 8740</refentry> 8741 8742<refentry id="API-sas-rphy-unlink"> 8743<refentryinfo> 8744 <title>LINUX</title> 8745 <productname>Kernel Hackers Manual</productname> 8746 <date>July 2017</date> 8747</refentryinfo> 8748<refmeta> 8749 <refentrytitle><phrase>sas_rphy_unlink</phrase></refentrytitle> 8750 <manvolnum>9</manvolnum> 8751 <refmiscinfo class="version">4.1.27</refmiscinfo> 8752</refmeta> 8753<refnamediv> 8754 <refname>sas_rphy_unlink</refname> 8755 <refpurpose> 8756 unlink SAS remote PHY 8757 </refpurpose> 8758</refnamediv> 8759<refsynopsisdiv> 8760 <title>Synopsis</title> 8761 <funcsynopsis><funcprototype> 8762 <funcdef>void <function>sas_rphy_unlink </function></funcdef> 8763 <paramdef>struct sas_rphy * <parameter>rphy</parameter></paramdef> 8764 </funcprototype></funcsynopsis> 8765</refsynopsisdiv> 8766<refsect1> 8767 <title>Arguments</title> 8768 <variablelist> 8769 <varlistentry> 8770 <term><parameter>rphy</parameter></term> 8771 <listitem> 8772 <para> 8773 SAS remote phy to unlink from its parent port 8774 </para> 8775 </listitem> 8776 </varlistentry> 8777 </variablelist> 8778</refsect1> 8779<refsect1> 8780<title>Description</title> 8781<para> 8782 Removes port reference to an rphy 8783</para> 8784</refsect1> 8785</refentry> 8786 8787<refentry id="API-sas-rphy-remove"> 8788<refentryinfo> 8789 <title>LINUX</title> 8790 <productname>Kernel Hackers Manual</productname> 8791 <date>July 2017</date> 8792</refentryinfo> 8793<refmeta> 8794 <refentrytitle><phrase>sas_rphy_remove</phrase></refentrytitle> 8795 <manvolnum>9</manvolnum> 8796 <refmiscinfo class="version">4.1.27</refmiscinfo> 8797</refmeta> 8798<refnamediv> 8799 <refname>sas_rphy_remove</refname> 8800 <refpurpose> 8801 remove SAS remote PHY 8802 </refpurpose> 8803</refnamediv> 8804<refsynopsisdiv> 8805 <title>Synopsis</title> 8806 <funcsynopsis><funcprototype> 8807 <funcdef>void <function>sas_rphy_remove </function></funcdef> 8808 <paramdef>struct sas_rphy * <parameter>rphy</parameter></paramdef> 8809 </funcprototype></funcsynopsis> 8810</refsynopsisdiv> 8811<refsect1> 8812 <title>Arguments</title> 8813 <variablelist> 8814 <varlistentry> 8815 <term><parameter>rphy</parameter></term> 8816 <listitem> 8817 <para> 8818 SAS remote phy to remove 8819 </para> 8820 </listitem> 8821 </varlistentry> 8822 </variablelist> 8823</refsect1> 8824<refsect1> 8825<title>Description</title> 8826<para> 8827 Removes the specified SAS remote PHY. 8828</para> 8829</refsect1> 8830</refentry> 8831 8832<refentry id="API-scsi-is-sas-rphy"> 8833<refentryinfo> 8834 <title>LINUX</title> 8835 <productname>Kernel Hackers Manual</productname> 8836 <date>July 2017</date> 8837</refentryinfo> 8838<refmeta> 8839 <refentrytitle><phrase>scsi_is_sas_rphy</phrase></refentrytitle> 8840 <manvolnum>9</manvolnum> 8841 <refmiscinfo class="version">4.1.27</refmiscinfo> 8842</refmeta> 8843<refnamediv> 8844 <refname>scsi_is_sas_rphy</refname> 8845 <refpurpose> 8846 check if a struct device represents a SAS remote PHY 8847 </refpurpose> 8848</refnamediv> 8849<refsynopsisdiv> 8850 <title>Synopsis</title> 8851 <funcsynopsis><funcprototype> 8852 <funcdef>int <function>scsi_is_sas_rphy </function></funcdef> 8853 <paramdef>const struct device * <parameter>dev</parameter></paramdef> 8854 </funcprototype></funcsynopsis> 8855</refsynopsisdiv> 8856<refsect1> 8857 <title>Arguments</title> 8858 <variablelist> 8859 <varlistentry> 8860 <term><parameter>dev</parameter></term> 8861 <listitem> 8862 <para> 8863 device to check 8864 </para> 8865 </listitem> 8866 </varlistentry> 8867 </variablelist> 8868</refsect1> 8869<refsect1> 8870<title>Returns</title> 8871<para> 8872 <constant>1</constant> if the device represents a SAS remote PHY, <constant>0</constant> else 8873</para> 8874</refsect1> 8875</refentry> 8876 8877<refentry id="API-sas-attach-transport"> 8878<refentryinfo> 8879 <title>LINUX</title> 8880 <productname>Kernel Hackers Manual</productname> 8881 <date>July 2017</date> 8882</refentryinfo> 8883<refmeta> 8884 <refentrytitle><phrase>sas_attach_transport</phrase></refentrytitle> 8885 <manvolnum>9</manvolnum> 8886 <refmiscinfo class="version">4.1.27</refmiscinfo> 8887</refmeta> 8888<refnamediv> 8889 <refname>sas_attach_transport</refname> 8890 <refpurpose> 8891 instantiate SAS transport template 8892 </refpurpose> 8893</refnamediv> 8894<refsynopsisdiv> 8895 <title>Synopsis</title> 8896 <funcsynopsis><funcprototype> 8897 <funcdef>struct scsi_transport_template * <function>sas_attach_transport </function></funcdef> 8898 <paramdef>struct sas_function_template * <parameter>ft</parameter></paramdef> 8899 </funcprototype></funcsynopsis> 8900</refsynopsisdiv> 8901<refsect1> 8902 <title>Arguments</title> 8903 <variablelist> 8904 <varlistentry> 8905 <term><parameter>ft</parameter></term> 8906 <listitem> 8907 <para> 8908 SAS transport class function template 8909 </para> 8910 </listitem> 8911 </varlistentry> 8912 </variablelist> 8913</refsect1> 8914</refentry> 8915 8916<refentry id="API-sas-release-transport"> 8917<refentryinfo> 8918 <title>LINUX</title> 8919 <productname>Kernel Hackers Manual</productname> 8920 <date>July 2017</date> 8921</refentryinfo> 8922<refmeta> 8923 <refentrytitle><phrase>sas_release_transport</phrase></refentrytitle> 8924 <manvolnum>9</manvolnum> 8925 <refmiscinfo class="version">4.1.27</refmiscinfo> 8926</refmeta> 8927<refnamediv> 8928 <refname>sas_release_transport</refname> 8929 <refpurpose> 8930 release SAS transport template instance 8931 </refpurpose> 8932</refnamediv> 8933<refsynopsisdiv> 8934 <title>Synopsis</title> 8935 <funcsynopsis><funcprototype> 8936 <funcdef>void <function>sas_release_transport </function></funcdef> 8937 <paramdef>struct scsi_transport_template * <parameter>t</parameter></paramdef> 8938 </funcprototype></funcsynopsis> 8939</refsynopsisdiv> 8940<refsect1> 8941 <title>Arguments</title> 8942 <variablelist> 8943 <varlistentry> 8944 <term><parameter>t</parameter></term> 8945 <listitem> 8946 <para> 8947 transport template instance 8948 </para> 8949 </listitem> 8950 </varlistentry> 8951 </variablelist> 8952</refsect1> 8953</refentry> 8954 8955 </sect2> 8956 <sect2 id="SATA_transport"> 8957 <title>SATA transport class</title> 8958 <para> 8959 The SATA transport is handled by libata, which has its own book of 8960 documentation in this directory. 8961 </para> 8962 </sect2> 8963 <sect2 id="SPI_transport"> 8964 <title>Parallel SCSI (SPI) transport class</title> 8965 <para> 8966 The file drivers/scsi/scsi_transport_spi.c defines transport 8967 attributes for traditional (fast/wide/ultra) SCSI busses. 8968 </para> 8969<!-- drivers/scsi/scsi_transport_spi.c --> 8970<refentry id="API-spi-schedule-dv-device"> 8971<refentryinfo> 8972 <title>LINUX</title> 8973 <productname>Kernel Hackers Manual</productname> 8974 <date>July 2017</date> 8975</refentryinfo> 8976<refmeta> 8977 <refentrytitle><phrase>spi_schedule_dv_device</phrase></refentrytitle> 8978 <manvolnum>9</manvolnum> 8979 <refmiscinfo class="version">4.1.27</refmiscinfo> 8980</refmeta> 8981<refnamediv> 8982 <refname>spi_schedule_dv_device</refname> 8983 <refpurpose> 8984 schedule domain validation to occur on the device 8985 </refpurpose> 8986</refnamediv> 8987<refsynopsisdiv> 8988 <title>Synopsis</title> 8989 <funcsynopsis><funcprototype> 8990 <funcdef>void <function>spi_schedule_dv_device </function></funcdef> 8991 <paramdef>struct scsi_device * <parameter>sdev</parameter></paramdef> 8992 </funcprototype></funcsynopsis> 8993</refsynopsisdiv> 8994<refsect1> 8995 <title>Arguments</title> 8996 <variablelist> 8997 <varlistentry> 8998 <term><parameter>sdev</parameter></term> 8999 <listitem> 9000 <para> 9001 The device to validate 9002 </para> 9003 </listitem> 9004 </varlistentry> 9005 </variablelist> 9006</refsect1> 9007<refsect1> 9008<title>Description</title> 9009<para> 9010 Identical to <function>spi_dv_device</function> above, except that the DV will be 9011 scheduled to occur in a workqueue later. All memory allocations 9012 are atomic, so may be called from any context including those holding 9013 SCSI locks. 9014</para> 9015</refsect1> 9016</refentry> 9017 9018<refentry id="API-spi-display-xfer-agreement"> 9019<refentryinfo> 9020 <title>LINUX</title> 9021 <productname>Kernel Hackers Manual</productname> 9022 <date>July 2017</date> 9023</refentryinfo> 9024<refmeta> 9025 <refentrytitle><phrase>spi_display_xfer_agreement</phrase></refentrytitle> 9026 <manvolnum>9</manvolnum> 9027 <refmiscinfo class="version">4.1.27</refmiscinfo> 9028</refmeta> 9029<refnamediv> 9030 <refname>spi_display_xfer_agreement</refname> 9031 <refpurpose> 9032 Print the current target transfer agreement 9033 </refpurpose> 9034</refnamediv> 9035<refsynopsisdiv> 9036 <title>Synopsis</title> 9037 <funcsynopsis><funcprototype> 9038 <funcdef>void <function>spi_display_xfer_agreement </function></funcdef> 9039 <paramdef>struct scsi_target * <parameter>starget</parameter></paramdef> 9040 </funcprototype></funcsynopsis> 9041</refsynopsisdiv> 9042<refsect1> 9043 <title>Arguments</title> 9044 <variablelist> 9045 <varlistentry> 9046 <term><parameter>starget</parameter></term> 9047 <listitem> 9048 <para> 9049 The target for which to display the agreement 9050 </para> 9051 </listitem> 9052 </varlistentry> 9053 </variablelist> 9054</refsect1> 9055<refsect1> 9056<title>Description</title> 9057<para> 9058 Each SPI port is required to maintain a transfer agreement for each 9059 other port on the bus. This function prints a one-line summary of 9060 the current agreement; more detailed information is available in sysfs. 9061</para> 9062</refsect1> 9063</refentry> 9064 9065<refentry id="API-spi-populate-tag-msg"> 9066<refentryinfo> 9067 <title>LINUX</title> 9068 <productname>Kernel Hackers Manual</productname> 9069 <date>July 2017</date> 9070</refentryinfo> 9071<refmeta> 9072 <refentrytitle><phrase>spi_populate_tag_msg</phrase></refentrytitle> 9073 <manvolnum>9</manvolnum> 9074 <refmiscinfo class="version">4.1.27</refmiscinfo> 9075</refmeta> 9076<refnamediv> 9077 <refname>spi_populate_tag_msg</refname> 9078 <refpurpose> 9079 place a tag message in a buffer 9080 </refpurpose> 9081</refnamediv> 9082<refsynopsisdiv> 9083 <title>Synopsis</title> 9084 <funcsynopsis><funcprototype> 9085 <funcdef>int <function>spi_populate_tag_msg </function></funcdef> 9086 <paramdef>unsigned char * <parameter>msg</parameter></paramdef> 9087 <paramdef>struct scsi_cmnd * <parameter>cmd</parameter></paramdef> 9088 </funcprototype></funcsynopsis> 9089</refsynopsisdiv> 9090<refsect1> 9091 <title>Arguments</title> 9092 <variablelist> 9093 <varlistentry> 9094 <term><parameter>msg</parameter></term> 9095 <listitem> 9096 <para> 9097 pointer to the area to place the tag 9098 </para> 9099 </listitem> 9100 </varlistentry> 9101 <varlistentry> 9102 <term><parameter>cmd</parameter></term> 9103 <listitem> 9104 <para> 9105 pointer to the scsi command for the tag 9106 </para> 9107 </listitem> 9108 </varlistentry> 9109 </variablelist> 9110</refsect1> 9111<refsect1> 9112<title>Notes</title> 9113<para> 9114 designed to create the correct type of tag message for the 9115 particular request. Returns the size of the tag message. 9116 May return 0 if TCQ is disabled for this device. 9117</para> 9118</refsect1> 9119</refentry> 9120 9121 </sect2> 9122 <sect2 id="SRP_transport"> 9123 <title>SCSI RDMA (SRP) transport class</title> 9124 <para> 9125 The file drivers/scsi/scsi_transport_srp.c defines transport 9126 attributes for SCSI over Remote Direct Memory Access. 9127 </para> 9128<!-- drivers/scsi/scsi_transport_srp.c --> 9129<refentry id="API-srp-tmo-valid"> 9130<refentryinfo> 9131 <title>LINUX</title> 9132 <productname>Kernel Hackers Manual</productname> 9133 <date>July 2017</date> 9134</refentryinfo> 9135<refmeta> 9136 <refentrytitle><phrase>srp_tmo_valid</phrase></refentrytitle> 9137 <manvolnum>9</manvolnum> 9138 <refmiscinfo class="version">4.1.27</refmiscinfo> 9139</refmeta> 9140<refnamediv> 9141 <refname>srp_tmo_valid</refname> 9142 <refpurpose> 9143 check timeout combination validity 9144 </refpurpose> 9145</refnamediv> 9146<refsynopsisdiv> 9147 <title>Synopsis</title> 9148 <funcsynopsis><funcprototype> 9149 <funcdef>int <function>srp_tmo_valid </function></funcdef> 9150 <paramdef>int <parameter>reconnect_delay</parameter></paramdef> 9151 <paramdef>int <parameter>fast_io_fail_tmo</parameter></paramdef> 9152 <paramdef>int <parameter>dev_loss_tmo</parameter></paramdef> 9153 </funcprototype></funcsynopsis> 9154</refsynopsisdiv> 9155<refsect1> 9156 <title>Arguments</title> 9157 <variablelist> 9158 <varlistentry> 9159 <term><parameter>reconnect_delay</parameter></term> 9160 <listitem> 9161 <para> 9162 Reconnect delay in seconds. 9163 </para> 9164 </listitem> 9165 </varlistentry> 9166 <varlistentry> 9167 <term><parameter>fast_io_fail_tmo</parameter></term> 9168 <listitem> 9169 <para> 9170 Fast I/O fail timeout in seconds. 9171 </para> 9172 </listitem> 9173 </varlistentry> 9174 <varlistentry> 9175 <term><parameter>dev_loss_tmo</parameter></term> 9176 <listitem> 9177 <para> 9178 Device loss timeout in seconds. 9179 </para> 9180 </listitem> 9181 </varlistentry> 9182 </variablelist> 9183</refsect1> 9184<refsect1> 9185<title>Description</title> 9186<para> 9187 The combination of the timeout parameters must be such that SCSI commands 9188 are finished in a reasonable time. Hence do not allow the fast I/O fail 9189 timeout to exceed SCSI_DEVICE_BLOCK_MAX_TIMEOUT nor allow dev_loss_tmo to 9190 exceed that limit if failing I/O fast has been disabled. Furthermore, these 9191 parameters must be such that multipath can detect failed paths timely. 9192 Hence do not allow all three parameters to be disabled simultaneously. 9193</para> 9194</refsect1> 9195</refentry> 9196 9197<refentry id="API-srp-start-tl-fail-timers"> 9198<refentryinfo> 9199 <title>LINUX</title> 9200 <productname>Kernel Hackers Manual</productname> 9201 <date>July 2017</date> 9202</refentryinfo> 9203<refmeta> 9204 <refentrytitle><phrase>srp_start_tl_fail_timers</phrase></refentrytitle> 9205 <manvolnum>9</manvolnum> 9206 <refmiscinfo class="version">4.1.27</refmiscinfo> 9207</refmeta> 9208<refnamediv> 9209 <refname>srp_start_tl_fail_timers</refname> 9210 <refpurpose> 9211 start the transport layer failure timers 9212 </refpurpose> 9213</refnamediv> 9214<refsynopsisdiv> 9215 <title>Synopsis</title> 9216 <funcsynopsis><funcprototype> 9217 <funcdef>void <function>srp_start_tl_fail_timers </function></funcdef> 9218 <paramdef>struct srp_rport * <parameter>rport</parameter></paramdef> 9219 </funcprototype></funcsynopsis> 9220</refsynopsisdiv> 9221<refsect1> 9222 <title>Arguments</title> 9223 <variablelist> 9224 <varlistentry> 9225 <term><parameter>rport</parameter></term> 9226 <listitem> 9227 <para> 9228 SRP target port. 9229 </para> 9230 </listitem> 9231 </varlistentry> 9232 </variablelist> 9233</refsect1> 9234<refsect1> 9235<title>Description</title> 9236<para> 9237 Start the transport layer fast I/O failure and device loss timers. Do not 9238 modify a timer that was already started. 9239</para> 9240</refsect1> 9241</refentry> 9242 9243<refentry id="API-srp-reconnect-rport"> 9244<refentryinfo> 9245 <title>LINUX</title> 9246 <productname>Kernel Hackers Manual</productname> 9247 <date>July 2017</date> 9248</refentryinfo> 9249<refmeta> 9250 <refentrytitle><phrase>srp_reconnect_rport</phrase></refentrytitle> 9251 <manvolnum>9</manvolnum> 9252 <refmiscinfo class="version">4.1.27</refmiscinfo> 9253</refmeta> 9254<refnamediv> 9255 <refname>srp_reconnect_rport</refname> 9256 <refpurpose> 9257 reconnect to an SRP target port 9258 </refpurpose> 9259</refnamediv> 9260<refsynopsisdiv> 9261 <title>Synopsis</title> 9262 <funcsynopsis><funcprototype> 9263 <funcdef>int <function>srp_reconnect_rport </function></funcdef> 9264 <paramdef>struct srp_rport * <parameter>rport</parameter></paramdef> 9265 </funcprototype></funcsynopsis> 9266</refsynopsisdiv> 9267<refsect1> 9268 <title>Arguments</title> 9269 <variablelist> 9270 <varlistentry> 9271 <term><parameter>rport</parameter></term> 9272 <listitem> 9273 <para> 9274 SRP target port. 9275 </para> 9276 </listitem> 9277 </varlistentry> 9278 </variablelist> 9279</refsect1> 9280<refsect1> 9281<title>Description</title> 9282<para> 9283 Blocks SCSI command queueing before invoking <function>reconnect</function> such that 9284 <function>queuecommand</function> won't be invoked concurrently with <function>reconnect</function> from outside 9285 the SCSI EH. This is important since a <function>reconnect</function> implementation may 9286 reallocate resources needed by <function>queuecommand</function>. 9287</para> 9288</refsect1> 9289<refsect1> 9290<title>Notes</title> 9291<para> 9292 - This function neither waits until outstanding requests have finished nor 9293 tries to abort these. It is the responsibility of the <function>reconnect</function> 9294 function to finish outstanding commands before reconnecting to the target 9295 port. 9296 - It is the responsibility of the caller to ensure that the resources 9297 reallocated by the <function>reconnect</function> function won't be used while this function 9298 is in progress. One possible strategy is to invoke this function from 9299 the context of the SCSI EH thread only. Another possible strategy is to 9300 lock the rport mutex inside each SCSI LLD callback that can be invoked by 9301 the SCSI EH (the scsi_host_template.eh_*() functions and also the 9302 scsi_host_template.<function>queuecommand</function> function). 9303</para> 9304</refsect1> 9305</refentry> 9306 9307<refentry id="API-srp-rport-get"> 9308<refentryinfo> 9309 <title>LINUX</title> 9310 <productname>Kernel Hackers Manual</productname> 9311 <date>July 2017</date> 9312</refentryinfo> 9313<refmeta> 9314 <refentrytitle><phrase>srp_rport_get</phrase></refentrytitle> 9315 <manvolnum>9</manvolnum> 9316 <refmiscinfo class="version">4.1.27</refmiscinfo> 9317</refmeta> 9318<refnamediv> 9319 <refname>srp_rport_get</refname> 9320 <refpurpose> 9321 increment rport reference count 9322 </refpurpose> 9323</refnamediv> 9324<refsynopsisdiv> 9325 <title>Synopsis</title> 9326 <funcsynopsis><funcprototype> 9327 <funcdef>void <function>srp_rport_get </function></funcdef> 9328 <paramdef>struct srp_rport * <parameter>rport</parameter></paramdef> 9329 </funcprototype></funcsynopsis> 9330</refsynopsisdiv> 9331<refsect1> 9332 <title>Arguments</title> 9333 <variablelist> 9334 <varlistentry> 9335 <term><parameter>rport</parameter></term> 9336 <listitem> 9337 <para> 9338 SRP target port. 9339 </para> 9340 </listitem> 9341 </varlistentry> 9342 </variablelist> 9343</refsect1> 9344</refentry> 9345 9346<refentry id="API-srp-rport-put"> 9347<refentryinfo> 9348 <title>LINUX</title> 9349 <productname>Kernel Hackers Manual</productname> 9350 <date>July 2017</date> 9351</refentryinfo> 9352<refmeta> 9353 <refentrytitle><phrase>srp_rport_put</phrase></refentrytitle> 9354 <manvolnum>9</manvolnum> 9355 <refmiscinfo class="version">4.1.27</refmiscinfo> 9356</refmeta> 9357<refnamediv> 9358 <refname>srp_rport_put</refname> 9359 <refpurpose> 9360 decrement rport reference count 9361 </refpurpose> 9362</refnamediv> 9363<refsynopsisdiv> 9364 <title>Synopsis</title> 9365 <funcsynopsis><funcprototype> 9366 <funcdef>void <function>srp_rport_put </function></funcdef> 9367 <paramdef>struct srp_rport * <parameter>rport</parameter></paramdef> 9368 </funcprototype></funcsynopsis> 9369</refsynopsisdiv> 9370<refsect1> 9371 <title>Arguments</title> 9372 <variablelist> 9373 <varlistentry> 9374 <term><parameter>rport</parameter></term> 9375 <listitem> 9376 <para> 9377 SRP target port. 9378 </para> 9379 </listitem> 9380 </varlistentry> 9381 </variablelist> 9382</refsect1> 9383</refentry> 9384 9385<refentry id="API-srp-rport-add"> 9386<refentryinfo> 9387 <title>LINUX</title> 9388 <productname>Kernel Hackers Manual</productname> 9389 <date>July 2017</date> 9390</refentryinfo> 9391<refmeta> 9392 <refentrytitle><phrase>srp_rport_add</phrase></refentrytitle> 9393 <manvolnum>9</manvolnum> 9394 <refmiscinfo class="version">4.1.27</refmiscinfo> 9395</refmeta> 9396<refnamediv> 9397 <refname>srp_rport_add</refname> 9398 <refpurpose> 9399 add a SRP remote port to the device hierarchy 9400 </refpurpose> 9401</refnamediv> 9402<refsynopsisdiv> 9403 <title>Synopsis</title> 9404 <funcsynopsis><funcprototype> 9405 <funcdef>struct srp_rport * <function>srp_rport_add </function></funcdef> 9406 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 9407 <paramdef>struct srp_rport_identifiers * <parameter>ids</parameter></paramdef> 9408 </funcprototype></funcsynopsis> 9409</refsynopsisdiv> 9410<refsect1> 9411 <title>Arguments</title> 9412 <variablelist> 9413 <varlistentry> 9414 <term><parameter>shost</parameter></term> 9415 <listitem> 9416 <para> 9417 scsi host the remote port is connected to. 9418 </para> 9419 </listitem> 9420 </varlistentry> 9421 <varlistentry> 9422 <term><parameter>ids</parameter></term> 9423 <listitem> 9424 <para> 9425 The port id for the remote port. 9426 </para> 9427 </listitem> 9428 </varlistentry> 9429 </variablelist> 9430</refsect1> 9431<refsect1> 9432<title>Description</title> 9433<para> 9434 Publishes a port to the rest of the system. 9435</para> 9436</refsect1> 9437</refentry> 9438 9439<refentry id="API-srp-rport-del"> 9440<refentryinfo> 9441 <title>LINUX</title> 9442 <productname>Kernel Hackers Manual</productname> 9443 <date>July 2017</date> 9444</refentryinfo> 9445<refmeta> 9446 <refentrytitle><phrase>srp_rport_del</phrase></refentrytitle> 9447 <manvolnum>9</manvolnum> 9448 <refmiscinfo class="version">4.1.27</refmiscinfo> 9449</refmeta> 9450<refnamediv> 9451 <refname>srp_rport_del</refname> 9452 <refpurpose> 9453 remove a SRP remote port 9454 </refpurpose> 9455</refnamediv> 9456<refsynopsisdiv> 9457 <title>Synopsis</title> 9458 <funcsynopsis><funcprototype> 9459 <funcdef>void <function>srp_rport_del </function></funcdef> 9460 <paramdef>struct srp_rport * <parameter>rport</parameter></paramdef> 9461 </funcprototype></funcsynopsis> 9462</refsynopsisdiv> 9463<refsect1> 9464 <title>Arguments</title> 9465 <variablelist> 9466 <varlistentry> 9467 <term><parameter>rport</parameter></term> 9468 <listitem> 9469 <para> 9470 SRP remote port to remove 9471 </para> 9472 </listitem> 9473 </varlistentry> 9474 </variablelist> 9475</refsect1> 9476<refsect1> 9477<title>Description</title> 9478<para> 9479 Removes the specified SRP remote port. 9480</para> 9481</refsect1> 9482</refentry> 9483 9484<refentry id="API-srp-remove-host"> 9485<refentryinfo> 9486 <title>LINUX</title> 9487 <productname>Kernel Hackers Manual</productname> 9488 <date>July 2017</date> 9489</refentryinfo> 9490<refmeta> 9491 <refentrytitle><phrase>srp_remove_host</phrase></refentrytitle> 9492 <manvolnum>9</manvolnum> 9493 <refmiscinfo class="version">4.1.27</refmiscinfo> 9494</refmeta> 9495<refnamediv> 9496 <refname>srp_remove_host</refname> 9497 <refpurpose> 9498 tear down a Scsi_Host's SRP data structures 9499 </refpurpose> 9500</refnamediv> 9501<refsynopsisdiv> 9502 <title>Synopsis</title> 9503 <funcsynopsis><funcprototype> 9504 <funcdef>void <function>srp_remove_host </function></funcdef> 9505 <paramdef>struct Scsi_Host * <parameter>shost</parameter></paramdef> 9506 </funcprototype></funcsynopsis> 9507</refsynopsisdiv> 9508<refsect1> 9509 <title>Arguments</title> 9510 <variablelist> 9511 <varlistentry> 9512 <term><parameter>shost</parameter></term> 9513 <listitem> 9514 <para> 9515 Scsi Host that is torn down 9516 </para> 9517 </listitem> 9518 </varlistentry> 9519 </variablelist> 9520</refsect1> 9521<refsect1> 9522<title>Description</title> 9523<para> 9524 Removes all SRP remote ports for a given Scsi_Host. 9525 Must be called just before scsi_remove_host for SRP HBAs. 9526</para> 9527</refsect1> 9528</refentry> 9529 9530<refentry id="API-srp-stop-rport-timers"> 9531<refentryinfo> 9532 <title>LINUX</title> 9533 <productname>Kernel Hackers Manual</productname> 9534 <date>July 2017</date> 9535</refentryinfo> 9536<refmeta> 9537 <refentrytitle><phrase>srp_stop_rport_timers</phrase></refentrytitle> 9538 <manvolnum>9</manvolnum> 9539 <refmiscinfo class="version">4.1.27</refmiscinfo> 9540</refmeta> 9541<refnamediv> 9542 <refname>srp_stop_rport_timers</refname> 9543 <refpurpose> 9544 stop the transport layer recovery timers 9545 </refpurpose> 9546</refnamediv> 9547<refsynopsisdiv> 9548 <title>Synopsis</title> 9549 <funcsynopsis><funcprototype> 9550 <funcdef>void <function>srp_stop_rport_timers </function></funcdef> 9551 <paramdef>struct srp_rport * <parameter>rport</parameter></paramdef> 9552 </funcprototype></funcsynopsis> 9553</refsynopsisdiv> 9554<refsect1> 9555 <title>Arguments</title> 9556 <variablelist> 9557 <varlistentry> 9558 <term><parameter>rport</parameter></term> 9559 <listitem> 9560 <para> 9561 SRP remote port for which to stop the timers. 9562 </para> 9563 </listitem> 9564 </varlistentry> 9565 </variablelist> 9566</refsect1> 9567<refsect1> 9568<title>Description</title> 9569<para> 9570 Must be called after <function>srp_remove_host</function> and <function>scsi_remove_host</function>. The caller 9571 must hold a reference on the rport (rport->dev) and on the SCSI host 9572 (rport->dev.parent). 9573</para> 9574</refsect1> 9575</refentry> 9576 9577<refentry id="API-srp-attach-transport"> 9578<refentryinfo> 9579 <title>LINUX</title> 9580 <productname>Kernel Hackers Manual</productname> 9581 <date>July 2017</date> 9582</refentryinfo> 9583<refmeta> 9584 <refentrytitle><phrase>srp_attach_transport</phrase></refentrytitle> 9585 <manvolnum>9</manvolnum> 9586 <refmiscinfo class="version">4.1.27</refmiscinfo> 9587</refmeta> 9588<refnamediv> 9589 <refname>srp_attach_transport</refname> 9590 <refpurpose> 9591 instantiate SRP transport template 9592 </refpurpose> 9593</refnamediv> 9594<refsynopsisdiv> 9595 <title>Synopsis</title> 9596 <funcsynopsis><funcprototype> 9597 <funcdef>struct scsi_transport_template * <function>srp_attach_transport </function></funcdef> 9598 <paramdef>struct srp_function_template * <parameter>ft</parameter></paramdef> 9599 </funcprototype></funcsynopsis> 9600</refsynopsisdiv> 9601<refsect1> 9602 <title>Arguments</title> 9603 <variablelist> 9604 <varlistentry> 9605 <term><parameter>ft</parameter></term> 9606 <listitem> 9607 <para> 9608 SRP transport class function template 9609 </para> 9610 </listitem> 9611 </varlistentry> 9612 </variablelist> 9613</refsect1> 9614</refentry> 9615 9616<refentry id="API-srp-release-transport"> 9617<refentryinfo> 9618 <title>LINUX</title> 9619 <productname>Kernel Hackers Manual</productname> 9620 <date>July 2017</date> 9621</refentryinfo> 9622<refmeta> 9623 <refentrytitle><phrase>srp_release_transport</phrase></refentrytitle> 9624 <manvolnum>9</manvolnum> 9625 <refmiscinfo class="version">4.1.27</refmiscinfo> 9626</refmeta> 9627<refnamediv> 9628 <refname>srp_release_transport</refname> 9629 <refpurpose> 9630 release SRP transport template instance 9631 </refpurpose> 9632</refnamediv> 9633<refsynopsisdiv> 9634 <title>Synopsis</title> 9635 <funcsynopsis><funcprototype> 9636 <funcdef>void <function>srp_release_transport </function></funcdef> 9637 <paramdef>struct scsi_transport_template * <parameter>t</parameter></paramdef> 9638 </funcprototype></funcsynopsis> 9639</refsynopsisdiv> 9640<refsect1> 9641 <title>Arguments</title> 9642 <variablelist> 9643 <varlistentry> 9644 <term><parameter>t</parameter></term> 9645 <listitem> 9646 <para> 9647 transport template instance 9648 </para> 9649 </listitem> 9650 </varlistentry> 9651 </variablelist> 9652</refsect1> 9653</refentry> 9654 9655 </sect2> 9656 </sect1> 9657 9658 </chapter> 9659 9660 <chapter id="lower_layer"> 9661 <title>SCSI lower layer</title> 9662 <sect1 id="hba_drivers"> 9663 <title>Host Bus Adapter transport types</title> 9664 <para> 9665 Many modern device controllers use the SCSI command set as a protocol to 9666 communicate with their devices through many different types of physical 9667 connections. 9668 </para> 9669 <para> 9670 In SCSI language a bus capable of carrying SCSI commands is 9671 called a "transport", and a controller connecting to such a bus is 9672 called a "host bus adapter" (HBA). 9673 </para> 9674 <sect2 id="scsi_debug.c"> 9675 <title>Debug transport</title> 9676 <para> 9677 The file drivers/scsi/scsi_debug.c simulates a host adapter with a 9678 variable number of disks (or disk like devices) attached, sharing a 9679 common amount of RAM. Does a lot of checking to make sure that we are 9680 not getting blocks mixed up, and panics the kernel if anything out of 9681 the ordinary is seen. 9682 </para> 9683 <para> 9684 To be more realistic, the simulated devices have the transport 9685 attributes of SAS disks. 9686 </para> 9687 <para> 9688 For documentation see 9689 <ulink url='http://sg.danny.cz/sg/sdebug26.html'>http://sg.danny.cz/sg/sdebug26.html</ulink> 9690 </para> 9691<!-- !Edrivers/scsi/scsi_debug.c --> 9692 </sect2> 9693 <sect2 id="todo"> 9694 <title>todo</title> 9695 <para>Parallel (fast/wide/ultra) SCSI, USB, SATA, 9696 SAS, Fibre Channel, FireWire, ATAPI devices, Infiniband, 9697 I20, iSCSI, Parallel ports, netlink... 9698 </para> 9699 </sect2> 9700 </sect1> 9701 </chapter> 9702</book> 9703