Print this page
XXXX Nexenta fixes for mpt_sas(7d)

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/scsi/adapters/mpt_sas/mptsas_var.h
          +++ new/usr/src/uts/common/sys/scsi/adapters/mpt_sas/mptsas_var.h
↓ open down ↓ 200 lines elided ↑ open up ↑
 201  201                  int32_t                 m_t_throttle;
 202  202                  int32_t                 m_t_ncmds;
 203  203                  int32_t                 m_reset_delay;
 204  204                  int32_t                 m_t_nwait;
 205  205  
 206  206                  uint16_t                m_qfull_retry_interval;
 207  207                  uint8_t                 m_qfull_retries;
 208  208                  uint16_t                m_enclosure;
 209  209                  uint16_t                m_slot_num;
 210  210                  uint32_t                m_tgt_unconfigured;
      211 +                uint32_t                m_timeout_interval;
      212 +                uint8_t                 m_timeout_count;
 211  213  
 212      -                /*
 213      -                 * For the common case, the elements in this structure are
 214      -                 * protected by the per hba instance mutex. In order to make
 215      -                 * the key code path in ISR lockless, a separate mutex is
 216      -                 * introdeced to protect those shown in ISR.
 217      -                 */
 218      -                kmutex_t                m_tgt_intr_mutex;
 219      -
 220  214  } mptsas_target_t;
 221  215  
 222  216  typedef struct mptsas_smp {
 223  217          uint64_t        m_sasaddr;      /* hash key1 */
 224  218          mptsas_phymask_t m_phymask;     /* hash key2 */
 225  219          uint8_t         reserved1;
 226  220          uint16_t        m_devhdl;
 227  221          uint32_t        m_deviceinfo;
 228  222          uint16_t        m_pdevhdl;
 229  223          uint32_t        m_pdevinfo;
↓ open down ↓ 364 lines elided ↑ open up ↑
 594  588  
 595  589  /*
 596  590   * Last allocated slot is used for TM requests.  Since only m_max_requests
 597  591   * frames are allocated, the last SMID will be m_max_requests - 1.
 598  592   */
 599  593  #define MPTSAS_SLOTS_SIZE(mpt) \
 600  594          (sizeof (struct mptsas_slots) + (sizeof (struct mptsas_cmd *) * \
 601  595                  mpt->m_max_requests))
 602  596  #define MPTSAS_TM_SLOT(mpt)     (mpt->m_max_requests - 1)
 603  597  
 604      -typedef struct mptsas_slot_free_e {
 605      -        processorid_t           cpuid;
 606      -        int                     slot;
 607      -        list_node_t             node;
 608      -} mptsas_slot_free_e_t;
 609      -
 610  598  /*
 611      - * each of the allocq and releaseq in all CPU groups resides in separate
 612      - * cacheline(64 bytes). Multiple mutex in the same cacheline is not good
 613      - * for performance.
 614      - */
 615      -typedef union mptsas_slot_freeq {
 616      -        struct {
 617      -                kmutex_t        m_fq_mutex;
 618      -                list_t          m_fq_list;
 619      -                int             m_fq_n;
 620      -                int             m_fq_n_init;
 621      -        } s;
 622      -        char pad[64];
 623      -} mptsas_slot_freeq_t;
 624      -
 625      -typedef struct mptsas_slot_freeq_pair {
 626      -        mptsas_slot_freeq_t     m_slot_allocq;
 627      -        mptsas_slot_freeq_t     m_slot_releq;
 628      -} mptsas_slot_freeq_pair_t;
 629      -
 630      -/*
 631  599   * Macro for phy_flags
 632  600   */
 633  601  
 634  602  typedef struct smhba_info {
 635  603          kmutex_t        phy_mutex;
 636  604          uint8_t         phy_id;
 637  605          uint64_t        sas_addr;
 638  606          char            path[8];
 639  607          uint16_t        owner_devhdl;
 640  608          uint16_t        attached_devhdl;
↓ open down ↓ 44 lines elided ↑ open up ↑
 685  653  } mptsas_doneq_thread_list_t;
 686  654  
 687  655  typedef struct mptsas {
 688  656          int             m_instance;
 689  657  
 690  658          struct mptsas *m_next;
 691  659  
 692  660          scsi_hba_tran_t         *m_tran;
 693  661          smp_hba_tran_t          *m_smptran;
 694  662          kmutex_t                m_mutex;
      663 +        kmutex_t                m_passthru_mutex;
 695  664          kcondvar_t              m_cv;
      665 +        kcondvar_t              m_passthru_cv;
 696  666          kcondvar_t              m_fw_cv;
 697  667          kcondvar_t              m_config_cv;
 698  668          kcondvar_t              m_fw_diag_cv;
 699  669          dev_info_t              *m_dip;
 700  670  
 701  671          /*
 702  672           * soft state flags
 703  673           */
 704  674          uint_t          m_softstate;
 705  675  
 706  676          struct mptsas_slots *m_active;  /* outstanding cmds */
 707  677  
 708  678          mptsas_cmd_t    *m_waitq;       /* cmd queue for active request */
 709  679          mptsas_cmd_t    **m_waitqtail;  /* wait queue tail ptr */
 710  680  
      681 +        kmutex_t        m_tx_waitq_mutex;
      682 +        mptsas_cmd_t    *m_tx_waitq;    /* TX cmd queue for active request */
      683 +        mptsas_cmd_t    **m_tx_waitqtail;       /* tx_wait queue tail ptr */
      684 +        int             m_tx_draining;  /* TX queue draining flag */
      685 +
 711  686          mptsas_cmd_t    *m_doneq;       /* queue of completed commands */
 712  687          mptsas_cmd_t    **m_donetail;   /* queue tail ptr */
 713  688  
 714      -        kmutex_t                m_passthru_mutex;
 715      -        kcondvar_t              m_passthru_cv;
 716  689          /*
 717  690           * variables for helper threads (fan-out interrupts)
 718  691           */
 719  692          mptsas_doneq_thread_list_t      *m_doneq_thread_id;
 720  693          uint32_t                m_doneq_thread_n;
 721  694          uint32_t                m_doneq_thread_threshold;
 722  695          uint32_t                m_doneq_length_threshold;
 723  696          uint32_t                m_doneq_len;
 724  697          kcondvar_t              m_doneq_thread_cv;
 725  698          kmutex_t                m_doneq_mutex;
↓ open down ↓ 18 lines elided ↑ open up ↑
 744  717          ddi_dma_handle_t m_dma_req_frame_hdl;
 745  718          ddi_acc_handle_t m_acc_req_frame_hdl;
 746  719          ddi_dma_handle_t m_dma_reply_frame_hdl;
 747  720          ddi_acc_handle_t m_acc_reply_frame_hdl;
 748  721          ddi_dma_handle_t m_dma_free_queue_hdl;
 749  722          ddi_acc_handle_t m_acc_free_queue_hdl;
 750  723          ddi_dma_handle_t m_dma_post_queue_hdl;
 751  724          ddi_acc_handle_t m_acc_post_queue_hdl;
 752  725  
 753  726          /*
 754      -         * Try the best to make the key code path in the ISR lockless.
 755      -         * so avoid to use the per instance mutex m_mutex in the ISR. Introduce
 756      -         * a separate mutex to protect the elements shown in ISR.
 757      -         */
 758      -        kmutex_t        m_intr_mutex;
 759      -
 760      -        /*
 761  727           * list of reset notification requests
 762  728           */
 763  729          struct scsi_reset_notify_entry  *m_reset_notify_listf;
 764  730  
 765  731          /*
 766  732           * qfull handling
 767  733           */
 768  734          timeout_id_t    m_restart_cmd_timeid;
 769  735  
 770  736          /*
↓ open down ↓ 71 lines elided ↑ open up ↑
 842  808           */
 843  809          ushort_t        m_fwupload;
 844  810  
 845  811          uint16_t        m_productid;
 846  812  
 847  813          /*
 848  814           * per instance data structures for dma memory resources for
 849  815           * MPI handshake protocol. only one handshake cmd can run at a time.
 850  816           */
 851  817          ddi_dma_handle_t        m_hshk_dma_hdl;
 852      -
 853  818          ddi_acc_handle_t        m_hshk_acc_hdl;
 854      -
 855  819          caddr_t                 m_hshk_memp;
 856      -
 857  820          size_t                  m_hshk_dma_size;
 858  821  
 859  822          /* Firmware version on the card at boot time */
 860  823          uint32_t                m_fwversion;
 861  824  
 862  825          /* MSI specific fields */
 863  826          ddi_intr_handle_t       *m_htable;      /* For array of interrupts */
 864  827          int                     m_intr_type;    /* What type of interrupt */
 865  828          int                     m_intr_cnt;     /* # of intrs count returned */
 866  829          size_t                  m_intr_size;    /* Size of intr array */
↓ open down ↓ 50 lines elided ↑ open up ↑
 917  880           * Event Replay flag (MUR support)
 918  881           */
 919  882          uint8_t                 m_event_replay;
 920  883  
 921  884          /*
 922  885           * IR Capable flag
 923  886           */
 924  887          uint8_t                 m_ir_capable;
 925  888  
 926  889          /*
 927      -         * release and alloc queue for slot
 928      -         */
 929      -        int                     m_slot_freeq_pair_n;
 930      -        mptsas_slot_freeq_pair_t        *m_slot_freeq_pairp;
 931      -        mptsas_slot_free_e_t    *m_slot_free_ae;
 932      -#define MPI_ADDRESS_COALSCE_MAX 128
 933      -        pMpi2ReplyDescriptorsUnion_t    m_reply;
 934      -
 935      -        /*
 936  890           * Is HBA processing a diag reset?
 937  891           */
 938  892          uint8_t                 m_in_reset;
 939  893  
 940  894          /*
 941  895           * per instance cmd data structures for task management cmds
 942  896           */
 943  897          m_event_struct_t        m_event_task_mgmt;      /* must be last */
 944  898                                                          /* ... scsi_pkt_size */
 945  899  } mptsas_t;
↓ open down ↓ 526 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX