Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_hal.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2018, Emulex
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  * may be used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  */
32 
33 /**
34  * @file
35  * Defines the Hardware Abstraction Layer (HAL) interface functions.
36  */
37 
38 #ifndef _OCS_HAL_H
39 #define _OCS_HAL_H
40 
41 #include "sli4.h"
42 #include "sli4_fc.h"
43 #include "ocs_hal_config.h"
44 #include "ocs_stats.h"
45 #include "ocs_array.h"
46 #include "ocs_ioctl.h"
47 
48 typedef struct ocs_hal_io_s ocs_hal_io_t;
49 
50 #include "ocs_hal_workaround.h"
51 
52 #if defined(OCS_INCLUDE_DEBUG)
53 #include "ocs_debug.h"
54 #else
55 #define ocs_queue_history_wq(...)
56 #define ocs_queue_history_cqe(...)
57 #define ocs_queue_history_init(...)
58 #define ocs_queue_history_free(...)
59 #endif
60 
61 /**
62  * @brief HAL queue forward declarations
63  */
64 typedef struct hal_eq_s hal_eq_t;
65 typedef struct hal_cq_s hal_cq_t;
66 typedef struct hal_mq_s hal_mq_t;
67 typedef struct hal_wq_s hal_wq_t;
68 typedef struct hal_rq_s hal_rq_t;
69 typedef struct hal_rq_grp_s hal_rq_grp_t;
70 
71 /* HAL asserts/verify
72  *
73  */
74 
75 extern void _ocs_hal_assert(const char *cond, const char *filename, int linenum);
76 extern void _ocs_hal_verify(const char *cond, const char *filename, int linenum);
77 
78 #if defined(HAL_NDEBUG)
79 #define ocs_hal_assert(cond)
80 #define ocs_hal_verify(cond, ...)
81 #else
82 #define ocs_hal_assert(cond) \
83  do { \
84  if ((!(cond))) { \
85  _ocs_hal_assert(#cond, __FILE__, __LINE__); \
86  } \
87  } while (0)
88 
89 #define ocs_hal_verify(cond, ...) \
90  do { \
91  if ((!(cond))) { \
92  _ocs_hal_verify(#cond, __FILE__, __LINE__); \
93  return __VA_ARGS__; \
94  } \
95  } while (0)
96 #endif
97 #define ocs_hal_verify_arg(cond) ocs_hal_verify(cond, OCS_HAL_RTN_INVALID_ARG)
98 
99 /*
100  * HAL completion loop control parameters.
101  *
102  * The HAL completion loop must terminate periodically to keep the OS happy. The
103  * loop terminates when a predefined time has elapsed, but to keep the overhead of
104  * computing time down, the time is only checked after a number of loop iterations
105  * has completed.
106  *
107  * OCS_HAL_TIMECHECK_ITERATIONS number of loop iterations between time checks
108  *
109  */
110 
111 #define OCS_HAL_TIMECHECK_ITERATIONS 100
112 #define OCS_HAL_MAX_NUM_MQ 1
113 
114 #define OCS_HAL_MAX_MRQ_SETS 2
115 #define OCE_HAL_MAX_NUM_MRQ_PAIRS 16 // MAX pairs in MRQ SET
116 
117 /* Max we have 8 RX filters and two can be used for MRQ set of 16.
118  * So total MAX_RQ_PAIRS is 6(normal RQ) + (2 * 16)Sets = 38 RQ Pairs */
119 #define OCS_HAL_MAX_RQ_PAIRS 38
120 #define OCS_HAL_MAX_NUM_RQ (OCS_HAL_MAX_RQ_PAIRS * 2)
121 #define OCS_HAL_MAX_NUM_EQ 128
122 #define OCS_HAL_MAX_NUM_WQ 128
123 #define OCE_HAL_MAX_NUM_MRQ_PAIRS 16
124 
125 #define OCS_HAL_MAX_WQ_CLASS 4
126 #define OCS_HAL_MAX_WQ_CPU 128
127 
128 /*
129  * A CQ will be assinged to each WQ (CQ must have 2X entries of the WQ for abort
130  * processing), plus a separate one for each RQ PAIR and one for MQ
131  */
132 #define OCS_HAL_MAX_NUM_CQ ((OCS_HAL_MAX_NUM_WQ*2) + 1 + (OCS_HAL_MAX_RQ_PAIRS))
133 
134 /*
135  * Q hash - size is the maximum of all the queue sizes, rounded up to the next
136  * power of 2
137  */
138 #define OCS_HAL_Q_HASH_SIZE B32_NEXT_POWER_OF_2(OCS_MAX(OCS_HAL_MAX_NUM_MQ, OCS_MAX(OCS_HAL_MAX_NUM_RQ, \
139  OCS_MAX(OCS_HAL_MAX_NUM_EQ, OCS_MAX(OCS_HAL_MAX_NUM_WQ, \
140  OCS_HAL_MAX_NUM_CQ)))))
141 
142 #define OCS_HAL_RQ_HEADER_SIZE 128
143 #define OCS_HAL_RQ_HEADER_INDEX 0
144 
145 #define OCS_TOW_IO_SIZE_MAX 65536
146 #define OCS_TOW_AXR_IO_SIZE_MIN 2048
147 
148 #define OCS_TOW_FEATURE_AXR 0x01
149 #define OCS_TOW_FEATURE_TFB 0x02
150 
151 /**
152  * @brief Options for ocs_hal_command().
153  */
154 enum {
155  OCS_CMD_POLL, /**< command executes synchronously and busy-waits for completion */
156  OCS_CMD_NOWAIT, /**< command executes asynchronously. Uses callback */
157 };
158 
159 typedef enum {
170 } ocs_hal_rtn_e;
171 #define OCS_HAL_RTN_IS_ERROR(e) ((e) < 0)
172 
173 typedef enum {
178 
179 typedef enum {
187  OCS_HAL_TOPOLOGY, /**< auto, nport, loop */
195  OCS_HAL_MODE, /**< initiator, target, both */
238  OCS_HAL_EMULATE_I_ONLY_AAB, /**< emulate IAAB=0 for initiator-commands only */
239  OCS_HAL_EMULATE_TARGET_WQE_TIMEOUT, /**< enable driver timeouts for target WQEs */
259 
260 enum {
266 };
267 
268 enum {
273 };
274 
275 /**
276  * @brief Port protocols
277  */
278 
279 typedef enum {
285 
286 #define OCS_HAL_MAX_PROFILES 40
287 /**
288  * @brief A Profile Descriptor
289  */
290 typedef struct {
291  uint32_t profile_index;
292  uint32_t profile_id;
293  char profile_description[512];
295 
296 /**
297  * @brief A Profile List
298  */
299 typedef struct {
300  uint32_t num_descriptors;
303 
304 
305 /**
306  * @brief Defines DIF operation modes
307  */
308 enum {
311 };
312 
313 /**
314  * @brief Defines the type of RQ buffer
315  */
316 typedef enum {
321 
322 /**
323  * @brief Defines a wrapper for the RQ payload buffers so that we can place it
324  * back on the proper queue.
325  */
326 typedef struct {
327  uint16_t rqindex;
328  ocs_dma_t dma;
330 
331 /**
332  * @brief T10 DIF operations.
333  */
334 typedef enum {
346 
347 #define OCS_HAL_DIF_OPER_PASS_THRU OCS_HAL_SGE_DIF_OP_IN_CRC_OUT_CRC
348 #define OCS_HAL_DIF_OPER_STRIP OCS_HAL_SGE_DIF_OP_IN_CRC_OUT_NODIF
349 #define OCS_HAL_DIF_OPER_INSERT OCS_HAL_SGE_DIF_OP_IN_NODIF_OUT_CRC
350 
351 /**
352  * @brief T10 DIF block sizes.
353  */
354 typedef enum {
363 
364 /**
365  * @brief Link configurations.
366  */
367 typedef enum {
375 
376  /* must be last */
379 
380 /**
381  * @brief link module types
382  *
383  * (note: these just happen to match SLI4 values)
384  */
385 
386 enum {
394 };
395 
396 /**
397  * @brief T10 DIF information passed to the transport.
398  */
399 
400 typedef struct ocs_hal_dif_info_s {
403  uint32_t ref_tag_cmp;
404  uint32_t ref_tag_repl;
405  uint32_t app_tag_cmp:16,
406  app_tag_repl:16;
407  uint32_t check_ref_tag:1,
408  check_app_tag:1,
409  check_guard:1,
410  auto_incr_ref_tag:1,
411  repl_app_tag:1,
412  repl_ref_tag:1,
413  dif:2,
414  dif_separate:1,
415 
416  /* If the APP TAG is 0xFFFF, disable checking the REF TAG and CRC fields */
417  disable_app_ffff:1,
418 
419  /* if the APP TAG is 0xFFFF and REF TAG is 0xFFFF_FFFF, disable checking the received CRC field. */
420  disable_app_ref_ffff:1,
421 
422  :21;
423  uint16_t dif_seed;
425 
426 typedef enum {
427  OCS_HAL_ELS_REQ, /**< ELS request */
428  OCS_HAL_ELS_RSP, /**< ELS response */
429  OCS_HAL_ELS_RSP_SID, /**< ELS response, override the S_ID */
430  OCS_HAL_FC_CT, /**< FC Common Transport */
431  OCS_HAL_FC_CT_RSP, /**< FC Common Transport Response */
432  OCS_HAL_BLS_ACC, /**< BLS accept (BA_ACC) */
433  OCS_HAL_BLS_ACC_SID, /**< BLS accept (BA_ACC), override the S_ID */
434  OCS_HAL_BLS_RJT, /**< BLS reject (BA_RJT) */
435  OCS_HAL_BCAST, /**< Class 3 broadcast sequence */
445 
446 typedef enum {
452 
453 /* Descriptive strings for the HAL IO request types (note: these must always
454  * match up with the ocs_hal_io_type_e declaration) */
455 #define OCS_HAL_IO_TYPE_STRINGS \
456  "ELS request", \
457  "ELS response", \
458  "ELS response(set SID)", \
459  "FC CT request", \
460  "BLS accept", \
461  "BLS accept(set SID)", \
462  "BLS reject", \
463  "target read", \
464  "target write", \
465  "target response", \
466  "initiator read", \
467  "initiator write", \
468  "initiator nodata",
469 
470 /**
471  * @brief HAL command context.
472  *
473  * Stores the state for the asynchronous commands sent to the hardware.
474  */
475 typedef struct ocs_command_ctx_s {
476  ocs_list_t link;
477  /**< Callback function */
478  int32_t (*cb)(struct ocs_hal_s *, int32_t, uint8_t *, void *);
479  void *arg; /**< Argument for callback */
480  uint8_t *buf; /**< buffer holding command / results */
481  void *ctx; /**< upper layer context */
483 
484 typedef struct ocs_hal_sgl_s {
485  uintptr_t addr;
486  size_t len;
487 } ocs_hal_sgl_t;
488 
489 /**
490  * @brief HAL callback type
491  *
492  * Typedef for HAL "done" callback.
493  */
494 typedef int32_t (*ocs_hal_done_t)(struct ocs_hal_io_s *, ocs_remote_node_t *, uint32_t len, int32_t status, uint32_t ext, void *ul_arg);
495 
496 
497 typedef union ocs_hal_io_param_u {
498  struct {
499  uint16_t ox_id;
500  uint16_t rx_id;
501  uint8_t payload[12]; /**< big enough for ABTS BA_ACC */
502  } bls;
503  struct {
504  uint32_t s_id;
505  uint16_t ox_id;
506  uint16_t rx_id;
507  uint8_t payload[12]; /**< big enough for ABTS BA_ACC */
508  } bls_sid;
509  struct {
510  uint8_t r_ctl;
511  uint8_t type;
512  uint8_t df_ctl;
513  uint8_t timeout;
514  } bcast;
515  struct {
516  uint16_t ox_id;
517  uint8_t timeout;
518  } els;
519  struct {
520  uint32_t s_id;
521  uint16_t ox_id;
522  uint8_t timeout;
523  } els_sid;
524  struct {
525  uint8_t r_ctl;
526  uint8_t type;
527  uint8_t df_ctl;
528  uint8_t timeout;
529  } fc_ct;
530  struct {
531  uint8_t r_ctl;
532  uint8_t type;
533  uint8_t df_ctl;
534  uint8_t timeout;
535  uint16_t ox_id;
536  } fc_ct_rsp;
537  struct {
538  uint32_t offset;
539  uint16_t ox_id;
540  uint16_t flags;
541  uint8_t cs_ctl;
544  uint8_t timeout;
545  uint32_t app_id;
546  uint8_t wqe_timer;
547  } fcp_tgt;
548  struct {
549  ocs_dma_t *cmnd;
550  ocs_dma_t *rsp;
551  ocs_hal_dif_oper_e dif_oper;
552  ocs_hal_dif_blk_size_e blk_size;
553  uint32_t cmnd_size;
554  uint16_t flags;
555  uint8_t timeout;
556  uint32_t first_burst;
557  } fcp_ini;
559 
560 /**
561  * @brief WQ steering mode
562  */
563 typedef enum {
568 
569 /**
570  * @brief HAL wqe object
571  */
572 typedef struct {
573  uint32_t abort_wqe_submit_needed:1, /**< set if abort wqe needs to be submitted */
574  send_abts:1, /**< set to 1 to have hardware to automatically send ABTS */
575  auto_xfer_rdy_dnrx:1, /**< TRUE if DNRX was set on this IO */
576  :29;
577  uint32_t id;
578  uint32_t abort_reqtag;
580  uint8_t *wqebuf; /**< work queue entry buffer */
581 } ocs_hal_wqe_t;
582 
583 /**
584  * @brief HAL IO object.
585  *
586  * Stores the per-IO information necessary for both the lower (SLI) and upper
587  * layers (ocs).
588  */
589 struct ocs_hal_io_s {
590  // Owned by HAL
591  ocs_list_link_t link; /**< used for busy, wait_free, free lists */
592  ocs_list_link_t wqe_link; /**< used for timed_wqe list */
593  ocs_list_link_t dnrx_link; /**< used for io posted dnrx list */
594  ocs_hal_io_state_e state; /**< state of IO: free, busy, wait_free */
595  ocs_hal_wqe_t wqe; /**< Work queue object, with link for pending */
596  ocs_lock_t tow_lock; /**< Lock to synchronize TRSP and TOW Data/Cmd Cqes */
597  ocs_hal_t *hal; /**< pointer back to hardware context */
598  ocs_remote_node_t *rnode;
599  struct ocs_hal_tow_buffer_s *tow_buf;
600  ocs_dma_t xfer_rdy;
601  uint16_t type;
602  uint32_t port_owned_abort_count; /**< IO abort count */
603  hal_wq_t *wq; /**< WQ assigned to the exchange */
604  uint32_t xbusy; /**< Exchange is active in FW */
605  ocs_hal_done_t done; /**< Function called on IO completion */
606  void *arg; /**< argument passed to "IO done" callback */
607  ocs_hal_done_t abort_done; /**< Function called on abort completion */
608  void *abort_arg; /**< argument passed to "abort done" callback */
609  ocs_ref_t ref; /**< refcount object */
610  size_t length; /**< needed for bug O127585: length of IO */
611  uint8_t tgt_wqe_timeout; /**< timeout value for target WQEs */
612  uint64_t submit_ticks; /**< timestamp when current WQE was submitted */
613 
614  uint32_t status_saved:1, /**< if TRUE, latched status should be returned */
615  abort_in_progress:1, /**< if TRUE, abort is in progress */
616  quarantine:1, /**< set if IO to be quarantined */
617  quarantine_first_phase:1, /**< set if first phase of IO */
618  is_port_owned:1, /**< set if POST_XRI was used to send XRI to th chip */
619  tow_dnrx:1,
620  :26;
621  uint32_t saved_status; /**< latched status */
622  uint32_t saved_len; /**< latched length */
623  uint32_t saved_ext; /**< latched extended status */
624 
625  hal_eq_t *eq; /**< EQ that this HIO came up on */
626  ocs_hal_wq_steering_e wq_steering; /**< WQ steering mode request */
627  uint8_t wq_class; /**< WQ class if steering mode is Class */
628 
629  // Owned by SLI layer
630  uint16_t reqtag; /**< request tag for this HAL IO */
631  uint32_t abort_reqtag; /**< request tag for an abort of this HAL IO (note: this is a 32 bit value
632  to allow us to use UINT32_MAX as an uninitialized value) */
633  uint32_t indicator; /**< XRI */
634  ocs_dma_t def_sgl; /**< default scatter gather list */
635  uint32_t def_sgl_count; /**< count of SGEs in default SGL */
636  ocs_dma_t *sgl; /**< pointer to current active SGL */
637  uint32_t sgl_count; /**< count of SGEs in io->sgl */
638  uint32_t first_data_sge; /**< index of first data SGE */
639  ocs_dma_t *ovfl_sgl; /**< overflow SGL */
640  uint32_t ovfl_sgl_count; /**< count of SGEs in default SGL */
641  sli4_lsp_sge_t *ovfl_lsp; /**< pointer to overflow segment length */
642  ocs_hal_io_t *ovfl_io; /**< Used for SGL chaining on skyhawk */
643  uint32_t n_sge; /**< number of active SGEs */
644  uint32_t sge_offset;
645 
646  /* BZ 161832 Workaround: */
647  struct ocs_hal_io_s *sec_hio; /**< Secondary HAL IO context */
648  ocs_hal_io_param_t sec_iparam; /**< Secondary HAL IO context saved iparam */
649  uint32_t sec_len; /**< Secondary HAL IO context saved len */
650 
651  /* Owned by upper layer */
652  void *ul_io; /**< where upper layer can store reference to its IO */
653 };
654 
655 typedef enum {
660 
661 /**
662  * @brief Fabric/Domain events
663  */
664 typedef enum {
665  OCS_HAL_DOMAIN_ALLOC_OK, /**< domain successfully allocated */
666  OCS_HAL_DOMAIN_ALLOC_FAIL, /**< domain allocation failed */
667  OCS_HAL_DOMAIN_ATTACH_OK, /**< successfully attached to domain */
668  OCS_HAL_DOMAIN_ATTACH_FAIL, /**< domain attach failed */
669  OCS_HAL_DOMAIN_FREE_OK, /**< successfully freed domain */
670  OCS_HAL_DOMAIN_FREE_FAIL, /**< domain free failed */
671  OCS_HAL_DOMAIN_LOST, /**< previously discovered domain no longer available */
672  OCS_HAL_DOMAIN_FOUND, /**< new domain discovered */
673  OCS_HAL_DOMAIN_CHANGED, /**< previously discovered domain properties have changed */
675 
676 typedef enum {
677  OCS_HAL_PORT_ALLOC_OK, /**< port successfully allocated */
678  OCS_HAL_PORT_ALLOC_FAIL, /**< port allocation failed */
679  OCS_HAL_PORT_ATTACH_OK, /**< successfully attached to port */
680  OCS_HAL_PORT_ATTACH_FAIL, /**< port attach failed */
681  OCS_HAL_PORT_FREE_OK, /**< successfully freed port */
682  OCS_HAL_PORT_FREE_FAIL, /**< port free failed */
684 
685 typedef enum {
693 
694 typedef enum {
701  OCS_HAL_CB_MAX, /**< must be last */
703 
704 typedef enum {
705  OCS_HAL_XPORT_FC_SPEED_UPDATE, /* Event to notify updated FC SPEED */
707 /**
708  * @brief HAL unsolicited callback status
709  */
710 typedef enum {
714  OCS_HAL_UNSOL_MAX, /**< must be last */
716 
717 /**
718  * @brief Node group rpi reference
719  */
720 typedef struct {
721  ocs_atomic_t rpi_count;
722  ocs_atomic_t rpi_attached;
724 
725 /**
726  * @brief HAL link stat types
727  */
728 typedef enum {
751  OCS_HAL_LINK_STAT_MAX, /**< must be last */
753 
754 typedef enum {
769  OCS_HAL_HOST_STAT_MAX /* MUST BE LAST */
771 
772 typedef enum {
773  OCS_HAL_STATE_UNINITIALIZED, /* power-on, no allocations, no initializations */
774  OCS_HAL_STATE_QUEUES_ALLOCATED, /* chip is reset, allocations are complete (queues not registered) */
775  OCS_HAL_STATE_ACTIVE, /* chip is up an running */
776  OCS_HAL_STATE_RESET_IN_PROGRESS, /* chip is being reset */
777  OCS_HAL_STATE_TEARDOWN_IN_PROGRESS, /* teardown has been started */
779 
780 /**
781  * @brief Defines a general FC sequence object, consisting of a header, payload buffers
782  * and a HAL IO in the case of port owned XRI
783  */
784 typedef struct {
785  ocs_hal_t *hal; /**< HAL that owns this sequence */
786  /* sequence information */
787  uint8_t fcfi; /**< FCFI associated with sequence */
788  uint8_t tow; /**< If TOW completion was generated */
789  uint8_t tow_oox; /**< If IO would have been assisted if XRIs were available */
791  ocs_hal_rq_buffer_t *payload; /**< received frame payload buffer */
792 
793  /* other "state" information from the SRB (sequence coalescing) */
795  uint32_t xri; /**< XRI associated with sequence; sequence coalescing only */
796  ocs_hal_io_t *hio; /**< HAL IO */
797 
799  void *hal_priv; /**< HAL private context */
801 
802 /**
803  * @brief Structure to track optimized write buffers posted to chip owned XRIs.
804  *
805  * Note: The rqindex will be set the following "fake" indexes. This will be used
806  * when the buffer is returned via ocs_seq_free() to make the buffer available
807  * for re-use on another XRI.
808  *
809  * The dma->alloc pointer on the dummy header will be used to get back to this structure when the buffer is freed.
810  *
811  * More of these object may be allocated on the fly if more XRIs are pushed to the chip.
812  */
813 #define OCS_HAL_RQ_INDEX_DUMMY_HDR 0xFF00
814 #define OCS_HAL_RQ_INDEX_DUMMY_DATA 0xFF01
815 typedef struct ocs_hal_tow_buffer_s {
816  fc_header_t hdr; /**< used to build a dummy data header for unsolicited processing */
817  ocs_hal_rq_buffer_t header; /**< Points to the dummy data header */
818  ocs_hal_rq_buffer_t payload; /**< received frame payload buffer */
819  ocs_hal_sequence_t seq; /**< sequence for passing the buffers */
820  uint8_t data_cqe;
821  uint8_t cmd_cqe;
822 
823  /* fields saved from the command header that are needed when the data arrives */
824  uint8_t fcfi;
825 
826  /* To handle outof order completions save TOW cmd and data cqes */
827  uint8_t call_tow_cmd;
828  uint8_t call_tow_data;
831 
832 /**
833  * @brief Node group rpi reference
834  */
835 typedef struct {
836  uint8_t overflow;
837  uint32_t counter;
839 
840 /**
841  * @brief HAL object describing fc host stats
842  */
843 typedef struct {
844  uint32_t counter;
846 
847 #define TID_HASH_BITS 8
848 #define TID_HASH_LEN (1U << TID_HASH_BITS)
849 
850 typedef struct ocs_hal_iopt_s {
851  char name[32];
852  uint32_t instance_index;
853  ocs_thread_t iopt_thread;
854  ocs_cbuf_t *iopt_free_queue; // multiple reader, multiple writer
855  ocs_cbuf_t *iopt_work_queue;
856  ocs_array_t *iopt_cmd_array;
858 
859 typedef enum {
863 
864 #include "ocs_hal_queues.h"
865 
866 /**
867  * @brief Stucture used for the hash lookup of queue IDs
868  */
869 typedef struct {
870  uint32_t id:16,
871  in_use:1,
872  index:15;
874 
875 /**
876  * @brief Define the fields required to implement the skyhawk DIF quarantine.
877  */
878 #define OCS_HAL_QUARANTINE_QUEUE_DEPTH 4
879 
880 typedef struct {
882  ocs_hal_io_t *quarantine_ios[OCS_HAL_QUARANTINE_QUEUE_DEPTH];
884 
885 /**
886  * @brief Define the WQ callback object
887  */
888 typedef struct {
889  uint16_t instance_index; /**< use for request tag */
890  void (*callback)(void *arg, uint8_t *cqe, int32_t status);
891  void *arg;
893 
894 typedef struct {
895  ocs_thread_t thread;
896  uint8_t started:1;
898 
899 /**
900  * @brief HAL object
901  */
902 struct ocs_hal_s {
903  ocs_os_handle_t os;
905  uint16_t ulp_start;
906  uint16_t ulp_max;
907  uint32_t dump_size;
911  uint8_t disable_fec;
914  unsigned long jiffies_prev;
915  ocs_lock_t watchdog_lock;
916  const char *sliport_pause_errors;
917 
918  /** HAL configuration, subject to ocs_hal_set() */
919  struct {
920  uint32_t n_eq; /**< number of event queues */
921  uint32_t n_cq; /**< number of completion queues */
922  uint32_t n_mq; /**< number of mailbox queues */
923  uint32_t n_rq; /**< number of receive queues */
924  uint32_t n_wq; /**< number of work queues */
925  uint32_t n_io; /**< total number of IO objects */
926  uint32_t n_sgl;/**< length of SGL */
927  uint32_t speed; /** requested link speed in Mbps */
928  uint32_t topology; /** requested link topology */
929  uint32_t rq_default_buffer_size; /** size of the buffers for first burst */
930  uint32_t tow_feature; /** Target Optimized Write feature */
931  uint32_t tow_xri_cnt;
932  uint32_t tow_io_size;
933  uint8_t esoc;
934  uint16_t dif_seed; /** The seed for the DIF CRC calculation */
936  uint8_t dif_mode; /**< DIF mode to use */
937  uint8_t i_only_aab; /** Enable initiator-only auto-abort */
938  uint8_t emulate_tgt_wqe_timeout; /** Enable driver target wqe timeouts */
939  uint32_t bounce:1;
940  const char *queue_topology; /**< Queue topology string */
942  uint8_t tow_t10_enable;
943  uint8_t tow_p_type;
946  uint8_t rq_selection_policy; /** MRQ RQ selection policy */
947  uint8_t rr_quanta; /** RQ quanta if rq_selection_policy == 2 */
949  uint32_t cq_process_limit;/** Number of CQE`s to be processed in cq **/
951  } config;
952 
953  /* calculated queue sizes for each type */
955 
956  /* Storage for SLI queue objects */
963 
964  /* HAL queue */
965  uint32_t eq_count;
966  uint32_t cq_count;
967  uint32_t mq_count;
968  uint32_t wq_count;
969  uint32_t rq_count; /**< count of SLI RQs */
970  ocs_list_t eq_list;
971 
975 
976  /* Storage for HAL queue objects */
982  uint32_t hal_rq_count; /**< count of hal_rq[] entries */
984 
985  ocs_varray_t *wq_class_array[OCS_HAL_MAX_WQ_CLASS]; /**< pool per class WQs */
986  ocs_varray_t *wq_cpu_array[OCS_HAL_MAX_WQ_CPU]; /**< pool per CPU WQs */
987 
988  /* Sequence objects used in incoming frame processing */
989  ocs_array_t *seq_pool;
990 
991  /* Target optimized write buffers - protect with io_lock */
992  uint32_t tow_enabled:1, /**< TRUE if TOW is enabled */
993  :31;
994  ocs_pool_t *tow_buffer_pool; /**< pool of ocs_hal_tow_buffer_t objects */
995 
996  ocs_sem_t bmbx_sem;
997 
998  /** Maintain an ordered, linked list of outstanding HAL commands. */
999  ocs_lock_t cmd_lock;
1000  ocs_list_t cmd_head;
1001  ocs_list_t cmd_pending;
1002  uint32_t cmd_head_count;
1003 
1004 
1006  ocs_hal_linkcfg_e linkcfg; /**< link configuration setting */
1007  uint32_t eth_license; /**< Ethernet license; to enable FCoE on Lancer */
1008 
1009  struct {
1010  /**
1011  * Function + argument used to notify upper layer of domain events.
1012  *
1013  * The final argument to the callback is a generic data pointer:
1014  * - ocs_domain_record_t on OCS_HAL_DOMAIN_FOUND
1015  * - ocs_domain_t on OCS_HAL_DOMAIN_ALLOC_FAIL, OCS_HAL_DOMAIN_ALLOC_OK,
1016  * OCS_HAL_DOMAIN_FREE_FAIL, OCS_HAL_DOMAIN_FREE_OK,
1017  * OCS_HAL_DOMAIN_ATTACH_FAIL, OCS_HAL_DOMAIN_ATTACH_OK, and
1018  * OCS_HAL_DOMAIN_LOST.
1019  */
1020  int32_t (*domain)(void *, ocs_hal_domain_event_e, void *);
1021  /**
1022  * Function + argument used to notify upper layers of port events.
1023  *
1024  * The final argument to the callback is a pointer to the effected
1025  * SLI port for all events.
1026  */
1027  int32_t (*port)(void *, ocs_hal_port_event_e, void *);
1028  /** Function + argument used to announce arrival of unsolicited frames */
1029  int32_t (*unsolicited)(void *, ocs_hal_sequence_t *);
1030  int32_t (*rnode)(void *, ocs_hal_remote_node_event_e, void *);
1031  int32_t (*bounce)(void (*)(void *arg), void *arg, uint32_t s_id, uint32_t d_id, uint32_t ox_id);
1032  int32_t (*xport)(void *, ocs_hal_xport_event_e);
1033  } callback;
1034  struct {
1035  void *domain;
1036  void *port;
1038  void *rnode;
1039  void *bounce;
1040  void *xport;
1041  } args;
1042 
1043  /* OCS domain objects index by FCFI */
1044  int32_t first_domain_idx; /* Workaround for srb->fcfi == 0 */
1045  ocs_domain_t *domains[SLI4_MAX_FCFI];
1046 
1047  /* Table of FCFI values index by FCF_index */
1049 
1050  uint16_t fcf_indicator;
1051 
1052  ocs_hal_io_t **io; /**< pointer array of IO objects */
1053  ocs_dma_t *nvmet_sgls; /**< pointer to array of sgls used by nvmet backend */
1054  uint8_t *wqe_buffs; /**< array of WQE buffs mapped to IO objects */
1055 
1056  ocs_lock_t io_lock; /**< IO lock to synchronize list access */
1057  ocs_lock_t io_abort_lock; /**< IO lock to synchronize IO aborting */
1058  ocs_list_t io_inuse; /**< List of IO objects in use */
1059  ocs_list_t io_timed_wqe; /**< List of IO objects with a timed target WQE */
1060  ocs_list_t io_wait_free; /**< List of IO objects waiting to be freed */
1061  ocs_list_t io_free; /**< List of IO objects available for allocation */
1062  ocs_list_t io_port_owned; /**< List of IO objects posted for chip use */
1063  ocs_list_t io_port_dnrx; /**< List of IO objects needing TOW buffers */
1064 
1065  ocs_dma_t loop_map;
1066 
1067  ocs_dma_t xfer_rdy;
1068 
1069  ocs_dma_t chip_dump_sges;
1070  ocs_dma_t func_dump_sges;
1071 
1072  ocs_dma_t rnode_mem;
1073 
1075 
1078 
1080 
1081 #if defined(OCS_DEBUG_QUEUE_HISTORY)
1082  ocs_hal_q_hist_t q_hist;
1083 #endif
1084 
1085  ocs_list_t sec_hio_wait_list; /**< BZ 161832 Workaround: Secondary HAL IO context wait list */
1086  uint32_t sec_hio_wait_count; /**< BZ 161832 Workaround: Count of IOs that were put on the
1087  * Secondary HAL IO wait list
1088  */
1089 
1090 #define HAL_MAX_TCMD_THREADS 16
1091  ocs_hal_qtop_t *qtop; /**< pointer to queue topology */
1092 
1093  uint32_t tcmd_wq_submit[OCS_HAL_MAX_NUM_WQ]; /**< stat: wq sumbit count */
1094  uint32_t tcmd_wq_complete[OCS_HAL_MAX_NUM_WQ]; /**< stat: wq complete count */
1095 
1096  ocs_timer_t wqe_timer; /**< Timer to periodically check for WQE timeouts */
1097  ocs_timer_t watchdog_timer; /**< Timer for heartbeat */
1099  uint32_t in_active_wqe_timer:1, /**< TRUE if currently in active wqe timer handler */
1100  active_wqe_timer_shutdown:1, /** TRUE if wqe timer is to be shutdown */
1101  :30;
1102 
1103  ocs_list_t iopc_list; /**< list of IO processing contexts */
1104  ocs_lock_t iopc_list_lock; /**< lock for iopc_list */
1105 
1106  ocs_pool_t *wq_reqtag_pool; /**< pool of hal_wq_callback_t objects */
1107 
1108  ocs_atomic_t send_frame_seq_id; /**< send frame sequence ID */
1109 };
1110 
1111 
1112 typedef enum {
1119 
1120 typedef void (*tcmd_cq_handler)(ocs_hal_t *hal, uint32_t cq_idx, void *cq_handler_arg);
1121 
1122 /*
1123  * HAL queue data structures
1124  */
1125 
1126 struct hal_eq_s {
1127  ocs_list_link_t link; /**< must be first */
1128  sli4_qtype_e type; /**< must be second */
1129  uint32_t instance;
1130  uint32_t cpu_core;
1131  uint32_t entry_count;
1132  uint32_t entry_size;
1133  ocs_hal_t *hal;
1135  ocs_list_t cq_list;
1136 #if OCS_STAT_ENABLE
1137  uint32_t use_count;
1138 #endif
1139  uint32_t nvmeq;
1140  ocs_varray_t *wq_array; /*<< array of WQs */
1141 };
1142 
1143 struct hal_cq_s {
1144  ocs_list_link_t link; /*<< must be first */
1145  sli4_qtype_e type; /**< must be second */
1146  uint32_t instance; /*<< CQ instance (cq_idx) */
1147  uint32_t entry_count; /*<< Number of entries */
1148  uint32_t entry_size; /*<< entry size */
1149  hal_eq_t *eq; /*<< parent EQ */
1150  sli4_queue_t *queue; /**< pointer to SLI4 queue */
1151  ocs_list_t q_list; /**< list of children queues */
1152 
1153 #if OCS_STAT_ENABLE
1154  uint32_t use_count;
1155 #endif
1156 };
1157 
1158 typedef struct {
1159  ocs_list_link_t link; /*<< must be first */
1160  sli4_qtype_e type; /*<< must be second */
1161 } hal_q_t;
1162 
1163 struct hal_mq_s {
1164  ocs_list_link_t link; /*<< must be first */
1165  sli4_qtype_e type; /*<< must be second */
1166  uint32_t instance;
1167 
1168  uint32_t entry_count;
1169  uint32_t entry_size;
1170  hal_cq_t *cq;
1172 
1173 #if OCS_STAT_ENABLE
1174  uint32_t use_count;
1175 #endif
1176 };
1177 
1178 struct hal_wq_s {
1179  ocs_list_link_t link; /*<< must be first */
1180  sli4_qtype_e type; /*<< must be second */
1181  uint32_t instance;
1182  ocs_hal_t *hal;
1183 
1184  uint32_t entry_count;
1185  uint32_t entry_size;
1186  hal_cq_t *cq;
1188  uint32_t class;
1189  uint8_t ulp;
1190 
1191  /* WQ consumed */
1192  uint32_t wqec_set_count; /*<< how often IOs are submitted with wqce set */
1193  uint32_t wqec_count; /*<< current wqce counter */
1194  uint32_t free_count; /*<< free count */
1195  uint32_t total_submit_count; /*<< total submit count */
1196  ocs_list_t pending_list; /*<< list of IOs pending for this WQ */
1197 
1198  /*
1199  * ---Skyhawk only ---
1200  * BZ 160124 - Driver must quarantine XRIs for target writes and
1201  * initiator read when using DIF separates. Throw them on a
1202  * queue until another 4 similar requests are completed to ensure they
1203  * are flushed from the internal chip cache before being re-used.
1204  * The must be a separate queue per CQ because the actual chip completion
1205  * order cannot be determined. Since each WQ has a separate CQ, use the wq
1206  * associated with the IO.
1207  *
1208  * Note: Protected by queue->lock
1209  */
1211 
1212  /*
1213  * HAL IO allocated for use with Send Frame
1214  */
1215  ocs_hal_io_t *send_frame_io;
1216 
1217  /* Stats */
1218 #if OCS_STAT_ENABLE
1219  uint32_t use_count; /*<< use count */
1220  uint32_t wq_pending_count; /*<< count of HAL IOs that were queued on the WQ pending list */
1221 #endif
1222 };
1223 
1224 struct hal_rq_s {
1225  ocs_list_link_t link; /*<< must be first */
1226  sli4_qtype_e type; /*<< must be second */
1227  uint32_t instance;
1228 
1229  uint32_t entry_count;
1230  uint32_t hdr_entry_size;
1233  uint8_t ulp;
1234  uint8_t policy;
1235  uint8_t nvmeq;
1236  bool is_mrq;
1237  uint32_t base_mrq_id;
1238  uint8_t mrq_set_count;
1239  uint8_t mrq_set_num;
1240 
1241  hal_cq_t *cq;
1242 
1243  uint8_t filter_mask; /* Filter mask value */
1245  uint8_t protocol;
1249 
1252 
1253  ocs_hal_sequence_t **rq_tracker; /* RQ tracker for this RQ */
1254 
1257 
1258 #if OCS_STAT_ENABLE
1259  uint32_t use_count;
1260  uint32_t hdr_use_count;
1261  uint32_t fb_use_count;
1262  uint32_t payload_use_count;
1263 #endif
1264 };
1265 
1266 typedef struct ocs_hal_global_s {
1267  const char *queue_topology_string; /**< queue topology string */
1268  uint32_t fw_diag_log_size; /**< FW diagnostic log size */
1269  uint32_t fw_diag_log_level; /**< FW diagnostic log level */
1271 
1272 typedef struct ocs_mq_mbx_results_s {
1273  ocs_sem_t wait_sem;
1274  ocs_atomic_t refcnt;
1276  uint8_t cmd_buf[SLI4_BMBX_SIZE];
1277  uint8_t status;
1279 
1281 
1282 extern hal_eq_t *hal_new_eq(ocs_hal_t *hal, uint32_t entry_count);
1283 extern hal_cq_t *hal_new_cq(hal_eq_t *eq, uint32_t entry_count);
1284 extern uint32_t hal_new_cq_set(hal_eq_t *eqs[], hal_cq_t *cqs[], uint32_t num_cqs, uint32_t entry_count);
1285 extern hal_mq_t *hal_new_mq(hal_cq_t *cq, uint32_t entry_count);
1286 extern hal_wq_t *hal_new_wq(hal_cq_t *cq, uint32_t entry_count, uint32_t class, uint32_t ulp);
1287 extern hal_rq_t *hal_new_rq(hal_cq_t *cq, uint32_t entry_count, uint32_t ulp);
1288 extern uint32_t hal_new_rq_set(hal_cq_t *cqs[], hal_rq_t *rqs[], uint32_t num_rq_pairs, uint32_t entry_count, uint32_t ulp);
1289 extern void hal_del_eq(hal_eq_t *eq);
1290 extern void hal_del_cq(hal_cq_t *cq);
1291 extern void hal_del_mq(hal_mq_t *mq);
1292 extern void hal_del_wq(hal_wq_t *wq);
1293 extern void hal_del_rq(hal_rq_t *rq);
1294 extern void hal_queue_dump(ocs_hal_t *hal);
1295 extern void hal_queue_teardown(ocs_hal_t *hal);
1296 extern int32_t hal_route_rqe(ocs_hal_t *hal, ocs_hal_sequence_t *seq);
1297 extern int32_t ocs_hal_queue_hash_find(ocs_queue_hash_t *, uint16_t);
1298 extern ocs_hal_rtn_e ocs_hal_setup(ocs_hal_t *, ocs_os_handle_t, sli4_port_type_e);
1299 extern ocs_hal_rtn_e ocs_hal_init(ocs_hal_t *);
1300 extern ocs_hal_rtn_e ocs_hal_teardown(ocs_hal_t *);
1301 extern ocs_hal_rtn_e ocs_hal_reset(ocs_hal_t *, ocs_hal_reset_e);
1302 extern ocs_hal_rtn_e ocs_hal_port_migration(ocs_hal_t *);
1303 extern int32_t ocs_hal_get_num_eq(ocs_hal_t *);
1304 extern ocs_hal_rtn_e ocs_hal_get(ocs_hal_t *, ocs_hal_property_e, uint32_t *);
1305 extern void *ocs_hal_get_ptr(ocs_hal_t *, ocs_hal_property_e);
1306 extern ocs_hal_rtn_e ocs_hal_set(ocs_hal_t *, ocs_hal_property_e, uint32_t);
1307 extern ocs_hal_rtn_e ocs_hal_set_ptr(ocs_hal_t *, ocs_hal_property_e, void*);
1308 extern int32_t ocs_hal_event_check(ocs_hal_t *, uint32_t);
1309 extern int32_t ocs_hal_process(ocs_hal_t *, uint32_t, uint32_t);
1310 extern ocs_hal_rtn_e ocs_hal_command(ocs_hal_t *, uint8_t *, uint32_t, void *, void *);
1311 extern ocs_hal_rtn_e ocs_hal_callback(ocs_hal_t *, ocs_hal_callback_e, void *, void *);
1312 extern ocs_hal_rtn_e ocs_hal_port_alloc(ocs_hal_t *, ocs_sli_port_t *, ocs_domain_t *, uint8_t *);
1313 extern ocs_hal_rtn_e ocs_hal_port_attach(ocs_hal_t *, ocs_sli_port_t *, uint32_t);
1314 typedef void (*ocs_hal_port_control_cb_t)(int32_t status, uintptr_t value, void *arg);
1315 extern ocs_hal_rtn_e ocs_hal_port_control(ocs_hal_t *, ocs_hal_port_e, uintptr_t, ocs_hal_port_control_cb_t, void *);
1316 extern ocs_hal_rtn_e ocs_hal_port_free(ocs_hal_t *, ocs_sli_port_t *);
1317 extern ocs_hal_rtn_e ocs_hal_domain_alloc(ocs_hal_t *, ocs_domain_t *, uint32_t, uint32_t);
1318 extern ocs_hal_rtn_e ocs_hal_domain_attach(ocs_hal_t *, ocs_domain_t *, uint32_t);
1319 extern ocs_hal_rtn_e ocs_hal_domain_free(ocs_hal_t *, ocs_domain_t *);
1320 extern ocs_hal_rtn_e ocs_hal_domain_force_free(ocs_hal_t *, ocs_domain_t *);
1321 extern ocs_domain_t * ocs_hal_domain_get(ocs_hal_t *, uint16_t);
1322 extern ocs_hal_rtn_e ocs_hal_node_alloc(ocs_hal_t *, ocs_remote_node_t *, uint32_t, ocs_sli_port_t *);
1323 extern ocs_hal_rtn_e ocs_hal_unreg_rpi_all(ocs_hal_t *, ocs_sport_t *);
1324 extern ocs_hal_rtn_e ocs_hal_node_attach(ocs_hal_t *, ocs_remote_node_t *, ocs_dma_t *);
1325 extern ocs_hal_rtn_e ocs_hal_node_detach(ocs_hal_t *, ocs_remote_node_t *);
1326 extern ocs_hal_rtn_e ocs_hal_node_free_resources(ocs_hal_t *, ocs_remote_node_t *);
1327 extern ocs_hal_rtn_e ocs_hal_node_group_alloc(ocs_hal_t *, ocs_remote_node_group_t *);
1328 extern ocs_hal_rtn_e ocs_hal_node_group_attach(ocs_hal_t *, ocs_remote_node_group_t *, ocs_remote_node_t *);
1329 extern ocs_hal_rtn_e ocs_hal_node_group_free(ocs_hal_t *, ocs_remote_node_group_t *);
1330 extern ocs_hal_io_t *ocs_hal_io_alloc(ocs_hal_t *);
1331 extern ocs_hal_io_t *ocs_hal_io_activate_port_owned(ocs_hal_t *, ocs_hal_io_t *);
1332 extern int32_t ocs_hal_io_free(ocs_hal_t *, ocs_hal_io_t *);
1333 extern uint8_t ocs_hal_io_inuse(ocs_hal_t *hal, ocs_hal_io_t *io);
1334 typedef int32_t (*ocs_hal_srrs_cb_t)(ocs_hal_io_t *io, ocs_remote_node_t *rnode, uint32_t length, int32_t status, uint32_t ext_status, void *arg);
1335 extern ocs_hal_rtn_e ocs_hal_srrs_send(ocs_hal_t *, ocs_hal_io_type_e, ocs_hal_io_t *, ocs_dma_t *, uint32_t, ocs_dma_t *, ocs_remote_node_t *, ocs_hal_io_param_t *, ocs_hal_srrs_cb_t, void *);
1336 extern ocs_hal_rtn_e ocs_hal_io_send(ocs_hal_t *, ocs_hal_io_type_e, ocs_hal_io_t *, uint32_t, ocs_hal_io_param_t *, ocs_remote_node_t *, void *, void *);
1337 extern ocs_hal_rtn_e _ocs_hal_io_send(ocs_hal_t *hal, ocs_hal_io_type_e type, ocs_hal_io_t *io,
1338  uint32_t len, ocs_hal_io_param_t *iparam, ocs_remote_node_t *rnode,
1339  void *cb, void *arg);
1340 extern ocs_hal_rtn_e ocs_hal_io_register_sgl(ocs_hal_t *, ocs_hal_io_t *, ocs_dma_t *, uint32_t);
1341 extern ocs_hal_rtn_e ocs_hal_io_init_sges(ocs_hal_t *hal, ocs_hal_io_t *io, ocs_hal_io_type_e type);
1342 extern ocs_hal_rtn_e ocs_hal_io_add_seed_sge(ocs_hal_t *hal, ocs_hal_io_t *io, ocs_hal_dif_info_t *dif_info);
1343 extern ocs_hal_rtn_e ocs_hal_io_add_sge(ocs_hal_t *, ocs_hal_io_t *, uintptr_t, uint32_t);
1344 extern ocs_hal_rtn_e ocs_hal_io_add_dif_sge(ocs_hal_t *hal, ocs_hal_io_t *io, uintptr_t addr);
1345 extern ocs_hal_rtn_e ocs_hal_io_abort(ocs_hal_t *, ocs_hal_io_t *, uint32_t, void *, void *);
1346 extern int32_t ocs_hal_io_get_xid(ocs_hal_t *, ocs_hal_io_t *);
1347 extern uint32_t ocs_hal_io_get_count(ocs_hal_t *, ocs_hal_io_count_type_e);
1348 extern uint32_t ocs_hal_rpi_active_count(ocs_hal_t *);
1349 extern uint32_t ocs_hal_get_rqes_produced_count(ocs_hal_t *hal);
1350 
1351 typedef void (*ocs_hal_fw_cb_t)(int32_t status, int32_t ext_status, uint32_t bytes_written,
1352  uint32_t change_status, void *arg);
1353 extern ocs_hal_rtn_e ocs_hal_firmware_write(ocs_hal_t *, ocs_dma_t *, uint32_t, uint32_t, int, ocs_hal_fw_cb_t, void*);
1354 
1355 /* Function for retrieving SFP data */
1356 typedef void (*ocs_hal_sfp_cb_t)(void *, int32_t, uint32_t, uint32_t *, void *);
1357 extern ocs_hal_rtn_e ocs_hal_get_sfp(ocs_hal_t *, uint16_t, ocs_hal_sfp_cb_t, void *);
1358 
1359 /* Function for retrieving temperature data */
1360 typedef void (*ocs_hal_temp_cb_t)(int32_t status,
1361  uint32_t curr_temp,
1362  uint32_t crit_temp_thrshld,
1363  uint32_t warn_temp_thrshld,
1364  uint32_t norm_temp_thrshld,
1365  uint32_t fan_off_thrshld,
1366  uint32_t fan_on_thrshld,
1367  void *arg);
1368 extern ocs_hal_rtn_e ocs_hal_get_temperature(ocs_hal_t *, ocs_hal_temp_cb_t, void*);
1369 extern void ocs_read_temperature_lancer_cb(int32_t status, uint32_t curr_temp,
1370  uint32_t crit_temp_thr, uint32_t warn_temp_thr,
1371  uint32_t norm_temp_thr, uint32_t fan_off_thr,
1372  uint32_t fan_on_thr, void *arg);
1373 
1374 /* Function for retrieving link statistics */
1375 typedef void (*ocs_hal_link_stat_cb_t)(int32_t status,
1376  uint32_t num_counters,
1377  ocs_hal_link_stat_counts_t *counters,
1378  void *arg);
1379 extern ocs_hal_rtn_e ocs_hal_get_link_stats(ocs_hal_t *,
1380  uint8_t req_ext_counters,
1381  uint8_t clear_overflow_flags,
1382  uint8_t clear_all_counters,
1383  ocs_hal_link_stat_cb_t, void*);
1384 /* Function for retrieving host statistics */
1385 typedef void (*ocs_hal_host_stat_cb_t)(int32_t status,
1386  uint32_t num_counters,
1387  ocs_hal_host_stat_counts_t *counters,
1388  void *arg);
1389 extern ocs_hal_rtn_e ocs_hal_get_host_stats(ocs_hal_t *hal, uint8_t cc, ocs_hal_host_stat_cb_t, void *arg);
1390 
1391 extern ocs_hal_rtn_e ocs_hal_raise_ue(ocs_hal_t *, uint8_t);
1392 typedef void (*ocs_hal_dump_get_cb_t)(int32_t status, uint32_t bytes_read, uint8_t eof, void *arg);
1393 extern ocs_hal_rtn_e ocs_hal_dump_get(ocs_hal_t *, ocs_dma_t *, uint32_t, uint32_t, ocs_hal_dump_get_cb_t, void *);
1394 extern ocs_hal_rtn_e ocs_hal_set_dump_to_host_buffers(ocs_hal_t *hal);
1395 extern ocs_hal_rtn_e
1396 ocs_hal_run_biu_diag(ocs_hal_t *hal, void *tx_buff, size_t tx_buff_len,
1397  void *rx_buff, size_t rx_buff_len);
1398 extern void ocs_hal_free_dump_to_host_buffers(ocs_hal_t *hal);
1399 extern ocs_hal_rtn_e ocs_hal_clear_dump_location(ocs_hal_t *hal);
1400 extern ocs_hal_rtn_e ocs_hal_set_loopback_mode(ocs_hal_t *hal, uint32_t type);
1401 extern ocs_hal_rtn_e ocs_hal_set_trunk_mode(ocs_hal_t *hal, uint32_t trunk_mode);
1402 extern ocs_hal_rtn_e ocs_hal_get_trunk_info(ocs_hal_t *hal, uint32_t *trunk_config);
1403 
1404 typedef void (*ocs_get_port_protocol_cb_t)(int32_t status, ocs_hal_port_protocol_e port_protocol, void *arg);
1405 extern ocs_hal_rtn_e ocs_hal_get_port_protocol(ocs_hal_t *hal, uint32_t pci_func, ocs_get_port_protocol_cb_t mgmt_cb, void* ul_arg);
1406 typedef void (*ocs_set_port_protocol_cb_t)(int32_t status, void *arg);
1407 extern ocs_hal_rtn_e ocs_hal_set_port_protocol(ocs_hal_t *hal, ocs_hal_port_protocol_e profile,
1408  uint32_t pci_func, ocs_set_port_protocol_cb_t mgmt_cb,
1409  void* ul_arg);
1410 
1411 typedef void (*ocs_get_profile_list_cb_t)(int32_t status, ocs_hal_profile_list_t*, void *arg);
1412 extern ocs_hal_rtn_e ocs_hal_get_profile_list(ocs_hal_t *hal, ocs_get_profile_list_cb_t mgmt_cb, void *arg);
1413 typedef void (*ocs_get_active_profile_cb_t)(int32_t status, uint32_t active_profile, void *arg);
1414 extern ocs_hal_rtn_e ocs_hal_get_active_profile(ocs_hal_t *hal, ocs_get_active_profile_cb_t mgmt_cb, void *arg);
1415 typedef void (*ocs_set_active_profile_cb_t)(int32_t status, void *arg);
1417  uint32_t profile_id, void *arg);
1418 typedef void (*ocs_get_nvparms_cb_t)(int32_t status, uint8_t *wwpn, uint8_t *wwnn, uint8_t hard_alpa,
1419  uint32_t preferred_d_id, void *arg);
1420 extern ocs_hal_rtn_e ocs_hal_get_nvparms(ocs_hal_t *hal, ocs_get_nvparms_cb_t mgmt_cb, void *arg);
1421 typedef void (*ocs_set_nvparms_cb_t)(int32_t status, void *arg);
1422 extern ocs_hal_rtn_e ocs_hal_set_nvparms(ocs_hal_t *hal, ocs_set_nvparms_cb_t mgmt_cb, uint8_t *wwpn,
1423  uint8_t *wwnn, uint8_t hard_alpa, uint32_t preferred_d_id, void *arg);
1424 extern int32_t ocs_hal_eq_process(ocs_hal_t *hal, hal_eq_t *eq, uint32_t max_isr_time_msec);
1425 extern void ocs_hal_cq_process(ocs_hal_t *hal, hal_cq_t *cq, uint32_t cq_process_limit);
1426 extern void ocs_hal_wq_process(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe, int32_t status, uint16_t rid);
1427 extern void ocs_hal_xabt_process(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe, uint16_t rid);
1428 extern int32_t hal_wq_write(hal_wq_t *wq, ocs_hal_wqe_t *wqe);
1429 
1430 typedef void (*ocs_hal_dump_clear_cb_t)(int32_t status, void *arg);
1431 extern ocs_hal_rtn_e ocs_hal_dump_clear(ocs_hal_t *, ocs_hal_dump_clear_cb_t, void *);
1432 
1433 typedef void (*ocs_hal_parity_stat_cb_t)(int32_t status, uint8_t num_ulp,
1434  ocs_parity_err_count_t *counter, void *arg);
1435 extern ocs_hal_rtn_e ocs_hal_get_itcm_parity_stats(ocs_hal_t *hal, bool clear_stats,
1436  ocs_hal_parity_stat_cb_t cb, void *arg);
1437 
1438 extern uint8_t ocs_hal_is_io_port_owned(ocs_hal_t *hal, ocs_hal_io_t *io);
1439 extern uint8_t ocs_hal_is_xri_port_owned(ocs_hal_t *hal, uint32_t xri);
1440 extern ocs_hal_io_t * ocs_hal_io_lookup(ocs_hal_t *hal, uint32_t indicator);
1441 extern uint32_t ocs_hal_xri_move_to_port_owned(ocs_hal_t *hal, uint32_t num_xri);
1442 extern ocs_hal_rtn_e ocs_hal_xri_move_to_host_owned(ocs_hal_t *hal, uint8_t num_xri);
1443 extern int32_t ocs_hal_reque_xri(ocs_hal_t *hal, ocs_hal_io_t *io);
1444 extern int32_t ocs_hal_flush(ocs_hal_t *hal);
1445 extern int32_t ocs_hal_io_cancel(ocs_hal_t *hal);
1446 
1447 typedef struct {
1448  /* structure elements used by HAL */
1449  ocs_hal_t *hal; /**> pointer to HAL */
1450  hal_wq_callback_t *wqcb; /**> WQ callback object, request tag */
1451  ocs_hal_wqe_t wqe; /**> WQE buffer object (may be queued on WQ pending list) */
1452  void (*callback)(int32_t status, void *arg); /**> final callback function */
1453  void *arg; /**> final callback argument */
1454 
1455  /* General purpose elements */
1457  ocs_dma_t payload; /**> a payload DMA buffer */
1459 
1460 
1461 #define OCS_HAL_OBJECT_G5 0xfeaa0001
1462 #define OCS_HAL_OBJECT_G6 0xfeaa0003
1463 #define OCS_FILE_TYPE_GROUP 0xf7
1464 #define OCS_FILE_ID_GROUP 0xa2
1466  uint32_t size;
1467  uint32_t magic_number;
1468  uint32_t word2;
1469  uint8_t rev_name[128];
1470  uint8_t date[12];
1471  uint8_t revision[32];
1472 };
1473 
1474 
1476 ocs_hal_send_frame(ocs_hal_t *hal, fc_header_le_t *hdr, uint8_t sof, uint8_t eof, ocs_dma_t *payload,
1478  void (*callback)(void *arg, uint8_t *cqe, int32_t status), void *arg);
1479 
1480 /* RQ completion handlers for RQ pair mode */
1481 extern int32_t ocs_hal_rqpair_process_rq(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe);
1483 extern int32_t ocs_hal_rqpair_tow_cmd_process(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe);
1484 extern int32_t ocs_hal_rqpair_tow_data_process(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe);
1485 extern ocs_hal_rtn_e ocs_hal_rqpair_tow_buffer_alloc(ocs_hal_t *hal, uint32_t num_buffers);
1486 extern ocs_hal_rtn_e ocs_hal_rqpair_init(ocs_hal_t *hal);
1487 extern ocs_hal_rtn_e ocs_hal_rqpair_auto_xfer_rdy_buffer_alloc(ocs_hal_t *hal, uint32_t num_buffers);
1488 extern uint8_t ocs_hal_rqpair_tow_xri_buffer_attach(ocs_hal_t *hal, ocs_hal_io_t *io, int reuse_buf);
1489 extern ocs_hal_rtn_e ocs_hal_rqpair_tow_move_to_port(ocs_hal_t *hal, ocs_hal_io_t *io);
1490 extern void ocs_hal_rqpair_tow_move_to_host(ocs_hal_t *hal, ocs_hal_io_t *io);
1491 extern void ocs_hal_rqpair_teardown(ocs_hal_t *hal);
1492 extern int ocs_hal_stop_fw_diagnostic_logging(ocs_hal_t *hal);
1493 
1494 extern ocs_hal_rtn_e ocs_hal_rx_allocate(ocs_hal_t *hal);
1495 extern ocs_hal_rtn_e ocs_hal_rx_post(ocs_hal_t *hal);
1496 extern void ocs_hal_rx_free(ocs_hal_t *hal);
1497 
1498 extern void ocs_hal_unsol_process_bounce(void *arg);
1499 
1500 typedef int32_t (*ocs_hal_async_cb_t)(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg);
1501 extern int32_t ocs_hal_async_call(ocs_hal_t *hal, ocs_hal_async_cb_t callback, void *arg);
1502 
1503 static inline void
1505 {
1506  /* Copy the src to dst, then zero out the linked list link */
1507  *dst = *src;
1508  ocs_memset(&dst->link, 0, sizeof(dst->link));
1509 }
1510 
1511 static inline ocs_hal_rtn_e
1513 {
1514  /* Only RQ pair mode is supported */
1515  return ocs_hal_rqpair_sequence_free(hal, seq);
1516 }
1517 
1518 /* HAL WQ request tag API */
1519 extern ocs_hal_rtn_e ocs_hal_reqtag_init(ocs_hal_t *hal);
1520 extern hal_wq_callback_t *ocs_hal_reqtag_alloc(ocs_hal_t *hal,
1521  void (*callback)(void *arg, uint8_t *cqe, int32_t status), void *arg);
1522 extern void ocs_hal_reqtag_free(ocs_hal_t *hal, hal_wq_callback_t *wqcb);
1523 extern hal_wq_callback_t *ocs_hal_reqtag_get_instance(ocs_hal_t *hal, uint32_t instance_index);
1524 extern void ocs_hal_reqtag_reset(ocs_hal_t *hal);
1525 extern int ocs_hal_can_accept_wqes(ocs_hal_io_t *hio);
1526 
1527 #if defined(OCS_ENABLE_FIRST_BURST)
1528 int32_t ocs_first_burst_enabled(ocs_t *ocs);
1529 #endif
1530 
1531 /* Uncomment to enable CPUTRACE */
1532 //#define ENABLE_CPUTRACE
1533 #ifdef ENABLE_CPUTRACE
1534 #define CPUTRACE(t) ocs_printf("trace: %-20s %2s %-16s cpu %2d\n", __func__, t, \
1535  ({ocs_thread_t *self = ocs_thread_self(); self != NULL ? self->name : "unknown";}), ocs_thread_getcpu());
1536 #else
1537 #define CPUTRACE(...)
1538 #endif
1539 
1540 #endif /* !_OCS_HAL_H */
1541 
1542 /* vim: set noexpandtab textwidth=120: */
uint8_t dif_mode
Definition: ocs_hal.h:936
ocs_hal_io_t * ovfl_io
Definition: ocs_hal.h:642
uint32_t quarantine
Definition: ocs_hal.h:614
ocs_hal_rtn_e ocs_hal_dump_get(ocs_hal_t *hal, ocs_dma_t *dma, uint32_t size, uint32_t offset, ocs_hal_dump_get_cb_t cb, void *arg)
Read a dump image to the host.
Definition: ocs_hal.c:8246
const char * queue_topology
Definition: ocs_hal.h:940
ocs_hal_rtn_e ocs_hal_domain_attach(ocs_hal_t *hal, ocs_domain_t *domain, uint32_t fc_id)
Attach a SLI port to a domain.
Definition: ocs_hal.c:3280
uint32_t s_id
Definition: ocs_hal.h:504
uint32_t n_io
Definition: ocs_hal.h:925
ocs_list_t io_timed_wqe
Definition: ocs_hal.h:1059
ocs_hal_rtn_e ocs_hal_rqpair_init(ocs_hal_t *hal)
Configure the rq_pair function from ocs_hal_init(). Must be after the IOs are setup and the state is ...
void ocs_hal_xabt_process(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe, uint16_t rid)
Process XABT completions.
Definition: ocs_hal.c:10284
int32_t ocs_hal_flush(ocs_hal_t *hal)
Definition: ocs_hal.c:11164
ocs_varray_t * wq_class_array[OCS_HAL_MAX_WQ_CLASS]
Definition: ocs_hal.h:985
uint32_t entry_size
Definition: ocs_hal.h:1185
struct ocs_hal_io_s * sec_hio
Definition: ocs_hal.h:647
#define OCS_HAL_MAX_WQ_CLASS
Definition: ocs_hal.h:125
uint32_t hal_rq_count
Definition: ocs_hal.h:982
ocs_lock_t iopc_list_lock
Definition: ocs_hal.h:1104
ocs_sem_t bmbx_sem
Definition: ocs_hal.h:996
uint8_t i_only_aab
Definition: ocs_hal.h:937
sli4_qtype_e type
Definition: ocs_hal.h:1226
int32_t ocs_hal_io_free(ocs_hal_t *hal, ocs_hal_io_t *io)
Free a previously-allocated HAL IO object.
Definition: ocs_hal.c:4001
ocs_hal_link_stat_e
HAL link stat types.
Definition: ocs_hal.h:728
ocs_hal_host_stat_e
Definition: ocs_hal.h:754
uint32_t sgl_count
Definition: ocs_hal.h:637
void _ocs_hal_assert(const char *cond, const char *filename, int linenum)
Handle HAL assertion.
Definition: ocs_hal.c:13483
uint32_t instance
Definition: ocs_hal.h:1146
ocs_domain_t * domains[SLI4_MAX_FCFI]
Definition: ocs_hal.h:1045
ocs_hal_rtn_e ocs_hal_srrs_send(ocs_hal_t *hal, ocs_hal_io_type_e type, ocs_hal_io_t *io, ocs_dma_t *send, uint32_t len, ocs_dma_t *receive, ocs_remote_node_t *rnode, ocs_hal_io_param_t *iparam, ocs_hal_srrs_cb_t cb, void *arg)
Send a Single Request/Response Sequence (SRRS).
Definition: ocs_hal.c:4295
ocs_hal_rq_buffer_t payload
Definition: ocs_hal.h:818
uint32_t tcmd_wq_complete[OCS_HAL_MAX_NUM_WQ]
Definition: ocs_hal.h:1094
ocs_hal_rtn_e ocs_hal_get_itcm_parity_stats(ocs_hal_t *hal, bool clear_stats, ocs_hal_parity_stat_cb_t cb, void *arg)
Definition: ocs_hal.c:6823
ocs_atomic_t refcnt
Definition: ocs_hal.h:1274
ocs_hal_rtn_e ocs_hal_get_sfp(ocs_hal_t *hal, uint16_t page, ocs_hal_sfp_cb_t cb, void *arg)
Function to retrieve the SFP information.
Definition: ocs_hal.c:5759
uint8_t cs_ctl
Definition: ocs_hal.h:541
int32_t(* port)(void *, ocs_hal_port_event_e, void *)
Definition: ocs_hal.h:1027
ocs_dma_t * rsp
Definition: ocs_hal.h:550
uint32_t cq_count
Definition: ocs_hal.h:966
ocs_list_t ocs_list_link_t
Definition: ocs_list.h:84
void ocs_hal_rqpair_tow_move_to_host(ocs_hal_t *hal, ocs_hal_io_t *io)
Prepares an XRI to move back to the host.
sli4_qtype_e
Definition: sli4.h:3423
uint8_t ocs_hal_io_inuse(ocs_hal_t *hal, ocs_hal_io_t *io)
Check if given HAL IO is in-use.
Definition: ocs_hal.c:4029
ocs_hal_rtn_e ocs_hal_node_alloc(ocs_hal_t *hal, ocs_remote_node_t *rnode, uint32_t fc_addr, ocs_sli_port_t *sport)
Allocate a remote node object.
Definition: ocs_hal.c:3389
uint8_t ulp
Definition: ocs_hal.h:1233
ocs_list_t sec_hio_wait_list
Definition: ocs_hal.h:1085
uint8_t ocs_hal_is_io_port_owned(ocs_hal_t *hal, ocs_hal_io_t *io)
Determine if HAL IO is owned by the port.
Definition: ocs_hal.c:12789
uint32_t filter_def[SLI4_CMD_REG_FCFI_NUM_RQ_CFG]
Definition: ocs_hal.h:948
uint32_t ocs_hal_get_rqes_produced_count(ocs_hal_t *hal)
Called to obtain the count of produced RQs.
Definition: ocs_hal.c:9396
uint32_t instance
Definition: ocs_hal.h:1227
HAL object describing fc host stats.
Definition: ocs_hal.h:843
int32_t hal_wq_write(hal_wq_t *wq, ocs_hal_wqe_t *wqe)
Write a HAL IO to a work queue.
Definition: ocs_hal.c:4092
const char * sliport_pause_errors
Definition: ocs_hal.h:916
uint8_t * wqe_buffs
Definition: ocs_hal.h:1054
void ocs_hal_reqtag_free(ocs_hal_t *hal, hal_wq_callback_t *wqcb)
Free a WQ request tag.
Definition: ocs_hal.c:13406
HAL wqe object.
Definition: ocs_hal.h:572
ocs_hal_rtn_e ocs_hal_get_port_protocol(ocs_hal_t *hal, uint32_t pci_func, ocs_get_port_protocol_cb_t cb, void *ul_arg)
Get the current port protocol.
Definition: ocs_hal.c:8498
uint32_t ref_tag_repl
Definition: ocs_hal.h:404
HAL object.
Definition: ocs_hal.h:902
uint8_t tow_app_tag_valid
Definition: ocs_hal.h:945
ocs_hal_t * hal
Definition: ocs_hal.h:1182
int32_t(* domain)(void *, ocs_hal_domain_event_e, void *)
Definition: ocs_hal.h:1020
void ocs_hal_reqtag_reset(ocs_hal_t *hal)
Reset the WQ request tag pool.
Definition: ocs_hal.c:13448
uint32_t first_data_sge
Definition: ocs_hal.h:638
uint16_t type
Definition: ocs_hal.h:601
void * port
Definition: ocs_hal.h:1036
uint32_t ovfl_sgl_count
Definition: ocs_hal.h:640
uint16_t dif_seed
Definition: ocs_hal.h:934
uint32_t cmd_head_count
Definition: ocs_hal.h:1002
ocs_hal_rtn_e ocs_hal_init(ocs_hal_t *hal)
Allocate memory structures to prepare for the device operation.
Definition: ocs_hal.c:813
ocs_hal_property_e
Definition: ocs_hal.h:179
bool expiration_logged
Definition: ocs_hal.h:1098
ocs_hal_rtn_e ocs_hal_rqpair_tow_buffer_alloc(ocs_hal_t *hal, uint32_t num_buffers)
Allocate tow buffers.
ocs_hal_rtn_e ocs_hal_port_migration(ocs_hal_t *hal)
Definition: ocs_hal.c:1657
uint8_t policy
Definition: ocs_hal.h:1234
HAL queue forward declarations.
Definition: ocs_hal.h:1126
ocs_hal_rq_buffer_t * header
Definition: ocs_hal.h:790
void ocs_read_temperature_lancer_cb(int32_t status, uint32_t curr_temp, uint32_t crit_temp_thr, uint32_t warn_temp_thr, uint32_t norm_temp_thr, uint32_t fan_off_thr, uint32_t fan_on_thr, void *arg)
Definition: ocs_mgmt.c:1059
void(* ocs_set_active_profile_cb_t)(int32_t status, void *arg)
Definition: ocs_hal.h:1415
ocs_list_link_t link
Definition: ocs_hal.h:1164
int32_t ocs_hal_io_get_xid(ocs_hal_t *hal, ocs_hal_io_t *io)
Return the OX_ID/RX_ID of the IO.
Definition: ocs_hal.c:5488
uint8_t ocs_hal_is_xri_port_owned(ocs_hal_t *hal, uint32_t xri)
Return TRUE if exchange is port-owned.
Definition: ocs_hal.c:12808
hal_eq_t * hal_eq[OCS_HAL_MAX_NUM_EQ]
Definition: ocs_hal.h:981
uint32_t n_wq
Definition: ocs_hal.h:924
ocs_list_t pending_list
Definition: ocs_hal.h:1196
void hal_queue_teardown(ocs_hal_t *hal)
Teardown HAL queue objects.
uint8_t hal_setup_called
Definition: ocs_hal.h:909
T10 DIF information passed to the transport.
Definition: ocs_hal.h:400
uint32_t mq_count
Definition: ocs_hal.h:967
void hal_del_wq(hal_wq_t *wq)
Free a WQ object.
int32_t ocs_hal_rqpair_process_rq(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe)
Process receive queue completions for RQ Pair mode.
int32_t ocs_hal_get_num_eq(ocs_hal_t *hal)
Definition: ocs_hal.c:1823
ocs_hal_rtn_e ocs_hal_teardown(ocs_hal_t *hal)
Tear down the Hardware Abstraction Layer module.
Definition: ocs_hal.c:1446
void(* ocs_hal_parity_stat_cb_t)(int32_t status, uint8_t num_ulp, ocs_parity_err_count_t *counter, void *arg)
Definition: ocs_hal.h:1433
uint8_t enable_fw_ag_rsp
Definition: ocs_hal.h:912
#define SLI4_CMD_REG_FCFI_NUM_RQ_CFG
REG_FCFI - activate a FC Forwarder.
Definition: sli4.h:1041
uint32_t saved_len
Definition: ocs_hal.h:622
struct ocs_hal_s::@23 callback
ocs_timer_t watchdog_timer
Definition: ocs_hal.h:1097
uint8_t revision[32]
Definition: ocs_hal.h:1471
int32_t(* unsolicited)(void *, ocs_hal_sequence_t *)
Definition: ocs_hal.h:1029
ocs_list_t io_inuse
Definition: ocs_hal.h:1058
ocs_hal_rtn_e ocs_hal_send_frame(ocs_hal_t *hal, fc_header_le_t *hdr, uint8_t sof, uint8_t eof, ocs_dma_t *payload, ocs_hal_send_frame_context_t *ctx, void(*callback)(void *arg, uint8_t *cqe, int32_t status), void *arg)
Send a raw frame.
Definition: ocs_hal.c:4817
ocs_hal_rtn_e ocs_hal_unreg_rpi_all(ocs_hal_t *hal, ocs_sport_t *sport)
Free all remote node objects.
Definition: ocs_hal.c:3658
uint16_t instance_index
Definition: ocs_hal.h:889
ocs_queue_hash_t * wq_hash
Definition: ocs_hal.h:974
uint8_t call_tow_cmd
Definition: ocs_hal.h:827
uint32_t speed
Definition: ocs_hal.h:927
uint32_t ocs_list_t iopc_list
Definition: ocs_hal.h:1099
void ocs_hal_free_dump_to_host_buffers(ocs_hal_t *hal)
Definition: ocs_hal.c:7561
uint32_t cpu_core
Definition: ocs_hal.h:1130
ocs_atomic_t send_frame_seq_id
Definition: ocs_hal.h:1108
ocs_thread_t thread
Definition: ocs_hal.h:895
void hal_del_rq(hal_rq_t *rq)
Free an RQ object.
ocs_hal_global_t hal_global
Definition: ocs_hal.c:78
#define OCS_HAL_MAX_NUM_RQ
Definition: ocs_hal.h:120
ocs_atomic_t rpi_attached
Definition: ocs_hal.h:722
ocs_hal_rtn_e ocs_hal_io_abort(ocs_hal_t *hal, ocs_hal_io_t *io_to_abort, uint32_t send_abts, void *cb, void *arg)
Abort a previously-started IO.
Definition: ocs_hal.c:5343
sli4_queue_t * queue
Definition: ocs_hal.h:1150
void hal_del_cq(hal_cq_t *cq)
Free a CQ object.
sli4_queue_t * queue
Definition: ocs_hal.h:1171
ocs_hal_rtn_e ocs_hal_port_attach(ocs_hal_t *hal, ocs_sli_port_t *sport, uint32_t fc_id)
Attach a physical/virtual SLI port to a domain.
Definition: ocs_hal.c:2966
ocs_hal_rtn_e ocs_hal_get_profile_list(ocs_hal_t *hal, ocs_get_profile_list_cb_t cb, void *ul_arg)
Get a list of available profiles.
Definition: ocs_hal.c:8955
void(* ocs_get_profile_list_cb_t)(int32_t status, ocs_hal_profile_list_t *, void *arg)
Definition: ocs_hal.h:1411
ocs_timer_t wqe_timer
Definition: ocs_hal.h:1096
ocs_hal_rtn_e ocs_hal_node_group_attach(ocs_hal_t *hal, ocs_remote_node_group_t *ngroup, ocs_remote_node_t *rnode)
Definition: ocs_hal.c:3714
ocs_hal_rq_buffer_t header
Definition: ocs_hal.h:817
size_t length
Definition: ocs_hal.h:610
ocs_varray_t * wq_cpu_array[OCS_HAL_MAX_WQ_CPU]
Definition: ocs_hal.h:986
ocs_hal_wq_steering_e wq_steering
Definition: ocs_hal.h:626
int32_t first_domain_idx
Definition: ocs_hal.h:1044
ocs_hal_rq_buffer_type_e
Defines the type of RQ buffer.
Definition: ocs_hal.h:316
ocs_hal_rtn_e ocs_hal_io_add_seed_sge(ocs_hal_t *hal, ocs_hal_io_t *io, ocs_hal_dif_info_t *dif_info)
Add a T10 PI seed scatter gather list entry.
Definition: ocs_hal.c:5029
ocs_hal_port_event_e
Definition: ocs_hal.h:676
ocs_hal_rtn_e
Definition: ocs_hal.h:159
ocs_hal_rq_buffer_t ** hdr_buf
Definition: ocs_hal.h:1250
ocs_hal_rq_buffer_t ** payload_buf
Definition: ocs_hal.h:1251
uint32_t fw_diag_log_size
Definition: ocs_hal.h:1268
uint16_t flags
Definition: ocs_hal.h:540
uint32_t topology
Definition: ocs_hal.h:928
hal_wq_callback_t * wqcb
Definition: ocs_hal.h:1450
uint16_t ox_id
Definition: ocs_hal.h:499
sli4_lsp_sge_t * ovfl_lsp
Definition: ocs_hal.h:641
ocs_list_t io_port_owned
Definition: ocs_hal.h:1062
static void ocs_hal_sequence_copy(ocs_hal_sequence_t *dst, ocs_hal_sequence_t *src)
Definition: ocs_hal.h:1504
ocs_hal_io_t * hio
Definition: ocs_hal.h:796
ocs_hal_reset_e
Definition: ocs_hal.h:173
#define OCS_HAL_MAX_NUM_EQ
Definition: ocs_hal.h:121
int32_t ocs_hal_reque_xri(ocs_hal_t *hal, ocs_hal_io_t *io)
Reque XRI.
Definition: ocs_hal.c:13528
Node group rpi reference.
Definition: ocs_hal.h:720
void(* ocs_get_active_profile_cb_t)(int32_t status, uint32_t active_profile, void *arg)
Definition: ocs_hal.h:1413
ocs_hal_rtn_e ocs_hal_set_loopback_mode(ocs_hal_t *hal, uint32_t type)
Set the Lancer dump location.
Definition: ocs_hal.c:7772
ocs_hal_rtn_e ocs_hal_get_host_stats(ocs_hal_t *hal, uint8_t cc, ocs_hal_host_stat_cb_t cb, void *arg)
Function to retrieve the link and host statistics.
Definition: ocs_hal.c:6044
ocs_hal_rtn_e ocs_hal_xri_move_to_host_owned(ocs_hal_t *hal, uint8_t num_xri)
Move XRIs from the port-controlled pool to the host.
Definition: ocs_hal.c:13022
uint8_t emulate_tgt_wqe_timeout
Definition: ocs_hal.h:938
const char * name
Definition: ocs_ddump.h:54
ocs_hal_io_param_t sec_iparam
Definition: ocs_hal.h:648
sli4_qtype_e type
Definition: ocs_hal.h:1145
uint16_t ulp_start
Definition: ocs_hal.h:905
uint8_t filter_mask
Definition: ocs_hal.h:1243
ocs_hal_rtn_e ocs_hal_io_add_sge(ocs_hal_t *hal, ocs_hal_io_t *io, uintptr_t addr, uint32_t length)
Add a scatter gather list entry to an IO.
Definition: ocs_hal.c:5214
ocs_hal_io_state_e
Definition: ocs_hal.h:446
ocs_hal_rtn_e ocs_hal_domain_force_free(ocs_hal_t *hal, ocs_domain_t *domain)
Free a fabric domain object.
Definition: ocs_hal.c:3362
void * xport
Definition: ocs_hal.h:1040
ocs_hal_state_e
Definition: ocs_hal.h:772
#define OCS_HAL_MAX_NUM_WQ
Definition: ocs_hal.h:122
Define the WQ callback object.
Definition: ocs_hal.h:888
ocs_hal_rtn_e ocs_hal_callback(ocs_hal_t *hal, ocs_hal_callback_e which, void *func, void *arg)
Register a callback for the given event.
Definition: ocs_hal.c:2824
int32_t ocs_hal_queue_hash_find(ocs_queue_hash_t *hash, uint16_t id)
Find index given queue ID.
Definition: ocs_hal.c:9564
void(* ocs_hal_temp_cb_t)(int32_t status, uint32_t curr_temp, uint32_t crit_temp_thrshld, uint32_t warn_temp_thrshld, uint32_t norm_temp_thrshld, uint32_t fan_off_thrshld, uint32_t fan_on_thrshld, void *arg)
Definition: ocs_hal.h:1360
ocs_list_t io_port_dnrx
Definition: ocs_hal.h:1063
uint32_t ocs_pool_t * tow_buffer_pool
Definition: ocs_hal.h:992
hal_rq_t * hal_new_rq(hal_cq_t *cq, uint32_t entry_count, uint32_t ulp)
Allocate a hal_rq_t object.
#define OCS_HAL_MAX_NUM_MQ
Definition: ocs_hal.h:112
ocs_atomic_t io_alloc_failed_count
Definition: ocs_hal.h:1079
hal_wq_t * hal_wq[OCS_HAL_MAX_NUM_WQ]
Definition: ocs_hal.h:977
hal_wq_callback_t * ocs_hal_reqtag_get_instance(ocs_hal_t *hal, uint32_t instance_index)
Return WQ request tag by index.
Definition: ocs_hal.c:13426
uint32_t wq_count
Definition: ocs_hal.h:968
uint32_t free_count
Definition: ocs_hal.h:1194
hal_cq_t * hal_new_cq(hal_eq_t *eq, uint32_t entry_count)
Allocate a new CQ object.
uint32_t app_id
Definition: ocs_hal.h:545
uint32_t fw_diag_log_level
Definition: ocs_hal.h:1269
fc_header_t hdr
Definition: ocs_hal.h:816
uint32_t port_owned_abort_count
Definition: ocs_hal.h:602
A Profile Descriptor.
Definition: ocs_hal.h:290
ocs_dma_t * nvmet_sgls
Definition: ocs_hal.h:1053
HAL command context.
Definition: ocs_hal.h:475
uint8_t nvmeq
Definition: ocs_hal.h:1235
void(* ocs_hal_fw_cb_t)(int32_t status, int32_t ext_status, uint32_t bytes_written, uint32_t change_status, void *arg)
Definition: ocs_hal.h:1351
ocs_hal_rtn_e ocs_hal_rqpair_auto_xfer_rdy_buffer_alloc(ocs_hal_t *hal, uint32_t num_buffers)
ocs_hal_port_protocol_e
Port protocols.
Definition: ocs_hal.h:279
uint32_t word2
Definition: ocs_hal.h:1468
uintptr_t addr
Definition: ocs_hal.h:485
uint32_t entry_size
Definition: ocs_hal.h:1169
uint32_t rq_count
Definition: ocs_hal.h:969
ocs_hal_io_t * ocs_hal_io_lookup(ocs_hal_t *hal, uint32_t xri)
Find IO given indicator (xri).
Definition: ocs_hal.c:11213
uint8_t tow_oox
Definition: ocs_hal.h:789
uint8_t ocs_hal_rqpair_tow_xri_buffer_attach(ocs_hal_t *hal, ocs_hal_io_t *io, int reuse_buf)
sli4_queue_t * hdr
Definition: ocs_hal.h:1246
int ocs_hal_can_accept_wqes(struct ocs_hal_io_s *hio)
Validate HAL IO state to make sure HAL can accept and post wqe to SLI.
Definition: ocs_hal.c:13588
static ocs_hal_rtn_e ocs_hal_sequence_free(ocs_hal_t *hal, ocs_hal_sequence_t *seq)
Definition: ocs_hal.h:1512
uint8_t df_ctl
Definition: ocs_hal.h:512
void * bounce
Definition: ocs_hal.h:1039
uint8_t call_tow_data
Definition: ocs_hal.h:828
uint32_t tow_feature
Definition: ocs_hal.h:930
uint32_t abort_reqtag
Definition: ocs_hal.h:631
void * arg
Definition: ocs_hal.h:606
ocs_hal_dif_oper_e dif_oper
Definition: ocs_hal.h:542
ocs_hal_callback_e
Definition: ocs_hal.h:694
hal_cq_handler_e
Definition: ocs_hal.h:859
uint32_t sec_hio_wait_count
Definition: ocs_hal.h:1086
sli4_qtype_e type
Definition: ocs_hal.h:1128
Definition: sli4.h:3601
ocs_hal_io_t * ocs_hal_io_alloc(ocs_hal_t *hal)
Allocate a HAL IO object.
Definition: ocs_hal.c:3839
struct ocs_hal_tow_buffer_s * tow_buf
Definition: ocs_hal.h:599
#define SLI4_BMBX_SIZE
Definition: sli4.h:150
ocs_hal_rtn_e ocs_hal_set_dump_to_host_buffers(ocs_hal_t *hal)
Allocates dump dma buffers, if not already allocated. Set the Lancer dump location.
Definition: ocs_hal.c:7721
ocs_hal_io_type_e
Definition: ocs_hal.h:426
ocs_hal_rtn_e ocs_hal_domain_alloc(ocs_hal_t *hal, ocs_domain_t *domain, uint32_t fcf, uint32_t vlan)
Allocate a fabric domain object.
Definition: ocs_hal.c:3217
uint32_t uint32_t saved_status
Definition: ocs_hal.h:614
sli4_queue_t * cq[OCS_HAL_MAX_NUM_CQ]
Definition: ocs_hal.h:961
uint32_t eq_count
Definition: ocs_hal.h:965
ocs_hal_rtn_e ocs_hal_node_detach(ocs_hal_t *hal, ocs_remote_node_t *rnode)
Free a remote node object.
Definition: ocs_hal.c:3562
uint32_t num_descriptors
Definition: ocs_hal.h:300
ocs_hal_rtn_e ocs_hal_reset(ocs_hal_t *hal, ocs_hal_reset_e reset)
Definition: ocs_hal.c:1670
uint8_t esoc
Definition: ocs_hal.h:933
ocs_list_link_t link
Definition: ocs_hal.h:1144
ocs_hal_rtn_e ocs_hal_io_register_sgl(ocs_hal_t *hal, ocs_hal_io_t *io, ocs_dma_t *sgl, uint32_t sgl_count)
Definition: ocs_hal.c:4867
ocs_hal_xport_event_e
Definition: ocs_hal.h:704
FC header in big-endian order.
Definition: ocs_fcp.h:157
ocs_remote_node_t * rnode
Definition: ocs_hal.h:598
ocs_lock_t watchdog_lock
Definition: ocs_hal.h:915
uint32_t entry_count
Definition: ocs_hal.h:1168
ocs_hal_io_t * send_frame_io
Definition: ocs_hal.h:1215
uint16_t rqindex
Definition: ocs_hal.h:327
uint8_t rev_name[128]
Definition: ocs_hal.h:1469
hal_wq_callback_t * ocs_hal_reqtag_alloc(ocs_hal_t *hal, void(*callback)(void *arg, uint8_t *cqe, int32_t status), void *arg)
Allocate a WQ request tag.
Definition: ocs_hal.c:13380
ocs_hal_rtn_e ocs_hal_dump_clear(ocs_hal_t *hal, ocs_hal_dump_clear_cb_t cb, void *arg)
Clear a dump image from the device.
Definition: ocs_hal.c:8354
void(* ocs_set_nvparms_cb_t)(int32_t status, void *arg)
Definition: ocs_hal.h:1421
hal_eq_t * eq
Definition: ocs_hal.h:1149
sli4_queue_t * queue
Definition: ocs_hal.h:1134
ocs_hal_t * hal
Definition: ocs_hal.h:1133
ocs_hal_rpi_ref_t * rpi_ref
Definition: ocs_hal.h:1074
uint32_t ocs_hal_rpi_active_count(ocs_hal_t *hal)
Called to obtain active RPI count.
Definition: ocs_hal.c:9371
uint32_t tcmd_wq_submit[OCS_HAL_MAX_NUM_WQ]
Definition: ocs_hal.h:1093
uint32_t def_sgl_count
Definition: ocs_hal.h:635
void(* ocs_hal_host_stat_cb_t)(int32_t status, uint32_t num_counters, ocs_hal_host_stat_counts_t *counters, void *arg)
Definition: ocs_hal.h:1385
uint32_t abort_reqtag
Definition: ocs_hal.h:578
hal_mq_t * hal_mq[OCS_HAL_MAX_NUM_MQ]
Definition: ocs_hal.h:979
void(* ocs_hal_dump_clear_cb_t)(int32_t status, void *arg)
Definition: ocs_hal.h:1430
ocs_hal_sequence_t ** rq_tracker
Definition: ocs_hal.h:1253
void _ocs_hal_verify(const char *cond, const char *filename, int linenum)
Handle HAL verify.
Definition: ocs_hal.c:13502
uint32_t first_burst
Definition: ocs_hal.h:556
ocs_varray_t * wq_array
Definition: ocs_hal.h:1140
ocs_list_t eq_list
Definition: ocs_hal.h:970
ocs_list_link_t link
Definition: ocs_hal.h:579
ocs_dma_t loop_map
Definition: ocs_hal.h:1065
hal_cq_t * cq
Definition: ocs_hal.h:1241
ocs_list_t cq_list
Definition: ocs_hal.h:1135
ocs_array_t * iopt_cmd_array
Definition: ocs_hal.h:856
sli4_queue_t * rq[OCS_HAL_MAX_NUM_RQ]
Definition: ocs_hal.h:958
ocs_dma_t xfer_rdy
Definition: ocs_hal.h:1067
uint16_t rx_id
Definition: ocs_hal.h:500
uint32_t in_active_wqe_timer
Definition: ocs_hal.h:1099
uint32_t instance_index
Definition: ocs_hal.h:852
ocs_hal_linkcfg_e
Link configurations.
Definition: ocs_hal.h:367
FC header in little-endian order.
Definition: ocs_fcp.h:177
ocs_list_t link
Definition: ocs_hal.h:476
int32_t ocs_hal_set_nvparms(ocs_hal_t *hal, ocs_set_nvparms_cb_t cb, uint8_t *wwpn, uint8_t *wwnn, uint8_t hard_alpa, uint32_t preferred_d_id, void *ul_arg)
Write non-volatile parms.
Definition: ocs_hal.c:9280
void ocs_hal_wq_process(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe, int32_t status, uint16_t rid)
Process WQ completion queue entries.
Definition: ocs_hal.c:9898
ocs_hal_rtn_e ocs_hal_io_add_dif_sge(ocs_hal_t *hal, ocs_hal_io_t *io, uintptr_t addr)
Add a T10 DIF scatter gather list entry to an IO.
Definition: ocs_hal.c:5283
ocs_hal_rtn_e ocs_hal_get(ocs_hal_t *hal, ocs_hal_property_e prop, uint32_t *value)
Definition: ocs_hal.c:1840
ocs_hal_rtn_e ocs_hal_port_free(ocs_hal_t *hal, ocs_sli_port_t *sport)
Free port resources.
Definition: ocs_hal.c:3172
uint32_t n_mq
Definition: ocs_hal.h:922
bool is_mrq
Definition: ocs_hal.h:1236
uint8_t * wqebuf
Definition: ocs_hal.h:580
uint32_t sec_len
Definition: ocs_hal.h:649
uint16_t reqtag
Definition: ocs_hal.h:630
ocs_lock_t tow_lock
Definition: ocs_hal.h:596
uint32_t n_sgl
Definition: ocs_hal.h:926
hal_mq_t * hal_new_mq(hal_cq_t *cq, uint32_t entry_count)
Allocate a new MQ object.
int32_t hal_route_rqe(ocs_hal_t *hal, ocs_hal_sequence_t *seq)
ocs_dma_t xfer_rdy
Definition: ocs_hal.h:600
ocs_pool_t * wq_reqtag_pool
Definition: ocs_hal.h:1106
ocs_quarantine_info_t quarantine_info
Definition: ocs_hal.h:1210
ocs_hal_rtn_e ocs_hal_node_attach(ocs_hal_t *hal, ocs_remote_node_t *rnode, ocs_dma_t *sparms)
Update a remote node object with the remote port&#39;s service parameters.
Definition: ocs_hal.c:3433
struct hal_rq_grp_s hal_rq_grp_t
Definition: ocs_hal.h:69
ocs_hal_rtn_e ocs_hal_set_ptr(ocs_hal_t *hal, ocs_hal_property_e prop, void *value)
Definition: ocs_hal.c:2437
bool protocol_valid
Definition: ocs_hal.h:1244
ocs_list_t io_wait_free
Definition: ocs_hal.h:1060
uint16_t fcf_index_fcfi[SLI4_MAX_FCF_INDEX]
Definition: ocs_hal.h:1048
ocs_hal_done_t abort_done
Definition: ocs_hal.h:607
uint32_t suppress_rsp_capable
Definition: ocs_hal.h:950
int32_t(* ocs_hal_done_t)(struct ocs_hal_io_s *, ocs_remote_node_t *, uint32_t len, int32_t status, uint32_t ext, void *ul_arg)
HAL callback type.
Definition: ocs_hal.h:494
int ocs_hal_stop_fw_diagnostic_logging(ocs_hal_t *hal)
Stop firmware diagnostic logging (RAS).
Definition: ocs_hal.c:7016
uint32_t eth_license
Definition: ocs_hal.h:1007
int32_t(* rnode)(void *, ocs_hal_remote_node_event_e, void *)
Definition: ocs_hal.h:1030
Defines a wrapper for the RQ payload buffers so that we can place it back on the proper queue...
Definition: ocs_hal.h:326
uint32_t quarantine_first_phase
Definition: ocs_hal.h:614
ocs_hal_rtn_e ocs_hal_raise_ue(ocs_hal_t *hal, uint8_t dump)
Cause chip to enter an unrecoverable error state.
Definition: ocs_hal.c:8161
uint32_t n_rq
Definition: ocs_hal.h:923
ocs_hal_rtn_e ocs_hal_port_alloc(ocs_hal_t *hal, ocs_sli_port_t *sport, ocs_domain_t *domain, uint8_t *wwpn)
Allocate a port object.
Definition: ocs_hal.c:2882
uint32_t entry_count
Definition: ocs_hal.h:1229
void * ul_io
Definition: ocs_hal.h:652
uint32_t is_port_owned
Definition: ocs_hal.h:614
ocs_queue_hash_t * rq_hash
Definition: ocs_hal.h:973
A Profile List.
Definition: ocs_hal.h:299
ocs_hal_done_t done
Definition: ocs_hal.h:605
ocs_hal_rtn_e ocs_hal_port_control(ocs_hal_t *hal, ocs_hal_port_e ctrl, uintptr_t value, ocs_hal_port_control_cb_t cb, void *arg)
Control a port (initialize, shutdown, or set link configuration).
Definition: ocs_hal.c:3060
int32_t ocs_hal_event_check(ocs_hal_t *hal, uint32_t vector)
Check for the events associated with the interrupt vector.
Definition: ocs_hal.c:2480
ocs_hal_t * hal
Definition: ocs_hal.h:785
int32_t ocs_hal_get_nvparms(ocs_hal_t *hal, ocs_get_nvparms_cb_t cb, void *ul_arg)
Read non-volatile parms.
Definition: ocs_hal.c:9178
sli4_queue_t * eq[OCS_HAL_MAX_NUM_EQ]
Definition: ocs_hal.h:962
uint32_t magic_number
Definition: ocs_hal.h:1467
uint32_t hal_new_rq_set(hal_cq_t *cqs[], hal_rq_t *rqs[], uint32_t num_rq_pairs, uint32_t entry_count, uint32_t ulp)
Allocate a hal_rq_t object SET.
ocs_sem_t wait_sem
Definition: ocs_hal.h:1273
void(* ocs_get_port_protocol_cb_t)(int32_t status, ocs_hal_port_protocol_e port_protocol, void *arg)
Definition: ocs_hal.h:1404
uint8_t timeout
Definition: ocs_hal.h:513
uint8_t tow_p_type
Definition: ocs_hal.h:943
uint32_t wqec_count
Definition: ocs_hal.h:1193
uint32_t saved_ext
Definition: ocs_hal.h:623
ocs_hal_rtn_e ocs_hal_set_port_protocol(ocs_hal_t *hal, ocs_hal_port_protocol_e new_protocol, uint32_t pci_func, ocs_set_port_protocol_cb_t cb, void *ul_arg)
Set the port protocol.
Definition: ocs_hal.c:8803
ocs_array_t * seq_pool
Definition: ocs_hal.h:989
uint8_t * buf
Definition: ocs_hal.h:480
hal_cq_t * cq
Definition: ocs_hal.h:1186
ocs_domain_t * ocs_hal_domain_get(ocs_hal_t *hal, uint16_t fcfi)
Definition: ocs_hal.c:9692
ocs_hal_rtn_e ocs_hal_rqpair_tow_move_to_port(ocs_hal_t *hal, ocs_hal_io_t *io)
Prepares an XRI to move to the chip.
void hal_queue_dump(ocs_hal_t *hal)
Display HAL queue objects.
ocs_list_t cmd_pending
Definition: ocs_hal.h:1001
void(* ocs_get_nvparms_cb_t)(int32_t status, uint8_t *wwpn, uint8_t *wwnn, uint8_t hard_alpa, uint32_t preferred_d_id, void *arg)
Definition: ocs_hal.h:1418
uint32_t rq_default_buffer_size
Definition: ocs_hal.h:929
ocs_hal_dif_blk_size_e
T10 DIF block sizes.
Definition: ocs_hal.h:354
ocs_list_link_t link
Definition: ocs_hal.h:1179
void ocs_hal_cq_process(ocs_hal_t *hal, hal_cq_t *cq, uint32_t cq_process_limit)
Process entries on the given completion queue.
Definition: ocs_hal.c:9783
uint32_t cmnd_size
Definition: ocs_hal.h:553
ocs_list_link_t dnrx_link
Definition: ocs_hal.h:593
void ocs_hal_rx_free(ocs_hal_t *hal)
Free the RQ data buffers.
Definition: ocs_hal.c:13231
sli4_queue_t * wq[OCS_HAL_MAX_NUM_WQ]
Definition: ocs_hal.h:957
ocs_hal_rtn_e ocs_hal_node_free_resources(ocs_hal_t *hal, ocs_remote_node_t *rnode)
Free a remote node resource.
Definition: ocs_hal.c:3516
ocs_queue_hash_t * cq_hash
Definition: ocs_hal.h:972
ocs_list_t cmd_head
Definition: ocs_hal.h:1000
const char * queue_topology_string
Definition: ocs_hal.h:1267
ocs_hal_io_state_e state
Definition: ocs_hal.h:594
ocs_hal_linkcfg_e linkcfg
Definition: ocs_hal.h:1006
uint32_t entry_count
Definition: ocs_hal.h:1184
ocs_hal_rtn_e ocs_hal_get_temperature(ocs_hal_t *hal, ocs_hal_temp_cb_t cb, void *arg)
Function to retrieve the temperature information.
Definition: ocs_hal.c:5814
ocs_hal_state_e state
Definition: ocs_hal.h:908
ocs_hal_rtn_e ocs_hal_set(ocs_hal_t *hal, ocs_hal_property_e prop, uint32_t value)
Definition: ocs_hal.c:2214
ocs_hal_unsol_status_e status
Definition: ocs_hal.h:794
ocs_hal_rtn_e ocs_hal_rx_allocate(ocs_hal_t *hal)
Allocate the RQ data buffers.
Definition: ocs_hal.c:13129
sli4_link_event_t link
Definition: ocs_hal.h:1005
ocs_lock_t io_abort_lock
Definition: ocs_hal.h:1057
sli4_qtype_e type
Definition: ocs_hal.h:1160
ocs_hal_rtn_e ocs_hal_io_send(ocs_hal_t *hal, ocs_hal_io_type_e type, ocs_hal_io_t *io, uint32_t len, ocs_hal_io_param_t *iparam, ocs_remote_node_t *rnode, void *cb, void *arg)
Send a read, write, or response IO.
Definition: ocs_hal.c:4507
ocs_hal_io_t ** io
Definition: ocs_hal.h:1052
#define OCS_HAL_MAX_NUM_CQ
Definition: ocs_hal.h:132
ocs_list_t io_free
Definition: ocs_hal.h:1061
uint16_t watchdog_timeout
Definition: ocs_hal.h:913
ocs_hal_rtn_e ocs_hal_node_group_free(ocs_hal_t *hal, ocs_remote_node_group_t *ngroup)
Definition: ocs_hal.c:3743
char * hal_war_version
Definition: ocs_hal.h:1076
void ocs_hal_unsol_process_bounce(void *arg)
Definition: ocs_hal.c:2518
uint32_t ref_tag_cmp
Definition: ocs_hal.h:403
sli4_queue_t * data
Definition: ocs_hal.h:1248
sli4_qtype_e type
Definition: ocs_hal.h:1180
ocs_hal_dif_oper_e dif_oper
Definition: ocs_hal.h:401
uint32_t entry_count
Definition: ocs_hal.h:1147
ocs_hal_workaround_t workaround
Definition: ocs_hal.h:1077
uint32_t ocs_hal_xri_move_to_port_owned(ocs_hal_t *hal, uint32_t num_xri)
Move XRIs from the host-controlled pool to the port.
Definition: ocs_hal.c:12921
uint32_t data_entry_size
Definition: ocs_hal.h:1232
void(* ocs_hal_port_control_cb_t)(int32_t status, uintptr_t value, void *arg)
Definition: ocs_hal.h:1314
int32_t ocs_hal_get_active_profile(ocs_hal_t *hal, ocs_get_active_profile_cb_t cb, void *ul_arg)
Get the currently active profile.
Definition: ocs_hal.c:9077
ocs_atomic_t rpi_count
Definition: ocs_hal.h:721
uint32_t hdr_entry_size
Definition: ocs_hal.h:1230
ocs_thread_t iopt_thread
Definition: ocs_hal.h:853
struct ocs_hal_s::@22 config
void * rnode
Definition: ocs_hal.h:1038
uint32_t instance
Definition: ocs_hal.h:1129
ocs_hal_io_t * ocs_hal_io_activate_port_owned(ocs_hal_t *hal, ocs_hal_io_t *io)
Allocate/Activate a port owned HAL IO object.
Definition: ocs_hal.c:3867
uint32_t xri
Definition: ocs_hal.h:795
int32_t ocs_hal_set_active_profile(ocs_hal_t *hal, ocs_set_active_profile_cb_t cb, uint32_t profile_id, void *ul_arg)
Set the currently active profile.
Definition: ocs_hal.c:9484
hal_cq_t * cq
Definition: ocs_hal.h:1170
size_t len
Definition: ocs_hal.h:486
uint32_t quarantine_index
Definition: ocs_hal.h:881
ocs_cbuf_t * iopt_work_queue
Definition: ocs_hal.h:855
ocs_hal_qtop_t * qtop
Definition: ocs_hal.h:1091
ocs_hal_rtn_e ocs_hal_domain_free(ocs_hal_t *hal, ocs_domain_t *domain)
Free a fabric domain object.
Definition: ocs_hal.c:3324
uint8_t tow_t10_enable
Definition: ocs_hal.h:942
ocs_hal_rtn_e ocs_hal_rx_post(ocs_hal_t *hal)
Post the RQ data buffers to the chip.
Definition: ocs_hal.c:13186
uint8_t protocol
Definition: ocs_hal.h:1245
ocs_lock_t io_lock
Definition: ocs_hal.h:1056
uint32_t offset
Definition: ocs_hal.h:538
int32_t(* xport)(void *, ocs_hal_xport_event_e)
Definition: ocs_hal.h:1032
uint8_t tgt_wqe_timeout
Definition: ocs_hal.h:611
uint32_t entry_size
Definition: ocs_hal.h:1148
uint8_t mrq_set_num
Definition: ocs_hal.h:1239
hal_rq_t * hal_rq[OCS_HAL_MAX_NUM_RQ]
Definition: ocs_hal.h:978
ocs_dma_t * ovfl_sgl
Definition: ocs_hal.h:639
ocs_hal_rtn_e ocs_hal_get_trunk_info(ocs_hal_t *hal, uint32_t *trunk_info)
Get trunking mode information.
Definition: ocs_hal.c:6987
uint32_t n_eq
Definition: ocs_hal.h:920
uint16_t ulp_max
Definition: ocs_hal.h:906
int32_t ocs_hal_process(ocs_hal_t *hal, uint32_t vector, uint32_t max_isr_time_msec)
Definition: ocs_hal.c:2530
uint32_t dump_size
Definition: ocs_hal.h:907
uint8_t date[12]
Definition: ocs_hal.h:1470
ocs_hal_rtn_e ocs_hal_reqtag_init(ocs_hal_t *hal)
Initialize the reqtag pool.
Definition: ocs_hal.c:13355
ocs_hal_port_e
Definition: ocs_hal.h:655
uint8_t tow_ref_tag_lba
Definition: ocs_hal.h:944
ocs_hal_wqe_t wqe
Definition: ocs_hal.h:595
Defines a general FC sequence object, consisting of a header, payload buffers and a HAL IO in the cas...
Definition: ocs_hal.h:784
void(* tcmd_cq_handler)(ocs_hal_t *hal, uint32_t cq_idx, void *cq_handler_arg)
Definition: ocs_hal.h:1120
void * domain
Definition: ocs_hal.h:1035
hal_wq_t * hal_new_wq(hal_cq_t *cq, uint32_t entry_count, uint32_t class, uint32_t ulp)
Allocate a new WQ object.
ocs_dma_t * sgl
Definition: ocs_hal.h:636
int32_t ocs_hal_eq_process(ocs_hal_t *hal, hal_eq_t *eq, uint32_t max_isr_time_msec)
Process events associated with an EQ.
Definition: ocs_hal.c:2588
ocs_hal_domain_event_e
Fabric/Domain events.
Definition: ocs_hal.h:664
uint8_t sliport_healthcheck
Definition: ocs_hal.h:910
ocs_hal_rtn_e ocs_hal_node_group_alloc(ocs_hal_t *hal, ocs_remote_node_group_t *ngroup)
Definition: ocs_hal.c:3694
uint32_t total_submit_count
Definition: ocs_hal.h:1195
uint8_t tow_blksize_chip
Definition: ocs_hal.h:941
HAL IO object.
Definition: ocs_hal.h:589
uint16_t tow_app_tag_value
Definition: ocs_hal.h:935
ocs_hal_rtn_e _ocs_hal_io_send(ocs_hal_t *hal, ocs_hal_io_type_e type, ocs_hal_io_t *io, uint32_t len, ocs_hal_io_param_t *iparam, ocs_remote_node_t *rnode, void *cb, void *arg)
sli4_qtype_e type
Definition: ocs_hal.h:1165
ocs_list_link_t link
Definition: ocs_hal.h:591
hal_eq_t * hal_new_eq(ocs_hal_t *hal, uint32_t entry_count)
Allocate a new EQ object.
uint32_t ocs_hal_io_get_count(ocs_hal_t *hal, ocs_hal_io_count_type_e io_count_type)
Called to obtain the count for the specified type.
Definition: ocs_hal.c:9325
ocs_list_link_t wqe_link
Definition: ocs_hal.h:592
ocs_hal_rtn_e ocs_hal_io_init_sges(ocs_hal_t *hal, ocs_hal_io_t *io, ocs_hal_io_type_e type)
Initialize the scatter gather list entries of an IO.
Definition: ocs_hal.c:4917
void(* ocs_hal_sfp_cb_t)(void *, int32_t, uint32_t, uint32_t *, void *)
Definition: ocs_hal.h:1356
uint32_t xbusy
Definition: ocs_hal.h:604
int32_t ocs_hal_rqpair_tow_data_process(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe)
Process CQ completions for Auto xfer rdy data phases.
void hal_del_eq(hal_eq_t *eq)
Free an EQ object.
ocs_dma_t dma
Definition: ocs_hal.h:328
void hal_del_mq(hal_mq_t *mq)
Free a MQ object.
uint64_t submit_ticks
Definition: ocs_hal.h:612
int32_t ocs_hal_rqpair_tow_cmd_process(ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe)
Process receive queue completions for RQ Pair mode - Auto xfer rdy.
uint32_t sge_offset
Definition: ocs_hal.h:644
uint8_t rq_selection_policy
Definition: ocs_hal.h:946
uint32_t entry_count
Definition: ocs_hal.h:1131
uint32_t rq_empty_err_count
Definition: ocs_hal.h:1256
uint32_t n_sge
Definition: ocs_hal.h:643
uint32_t tow_io_size
Definition: ocs_hal.h:932
int32_t ocs_hal_async_call(ocs_hal_t *hal, ocs_hal_async_cb_t callback, void *arg)
Make an async callback using NOP mailbox command.
Definition: ocs_hal.c:13316
ocs_hal_remote_node_event_e
Definition: ocs_hal.h:685
List Segment Pointer Scatter-Gather Entry (SGE)
Definition: sli4.h:563
#define SLI4_MAX_FCFI
Maximum value for a FCFI.
Definition: sli4_fc.h:52
#define OCS_HAL_QUARANTINE_QUEUE_DEPTH
Define the fields required to implement the skyhawk DIF quarantine.
Definition: ocs_hal.h:878
ocs_dma_t rnode_mem
Definition: ocs_hal.h:1072
hal_wq_t * wq
Definition: ocs_hal.h:603
ocs_hal_rtn_e ocs_hal_setup(ocs_hal_t *hal, ocs_os_handle_t os, sli4_port_type_e port_type)
Set up the Hardware Abstraction Layer module.
Definition: ocs_hal.c:606
ocs_hal_io_count_type_e
Definition: ocs_hal.h:1112
void * unsolicited
Definition: ocs_hal.h:1037
uint32_t indicator
Definition: ocs_hal.h:633
uint32_t instance
Definition: ocs_hal.h:1166
ocs_hal_dif_oper_e
T10 DIF operations.
Definition: ocs_hal.h:334
ocs_hal_rtn_e ocs_hal_run_biu_diag(ocs_hal_t *hal, void *tx_buff, size_t tx_buff_len, void *rx_buff, size_t rx_buff_len)
Run Diagnostic PCI Loopback test.
Definition: ocs_hal.c:7801
ocs_dma_t chip_dump_sges
Definition: ocs_hal.h:1069
uint32_t hal_new_cq_set(hal_eq_t *eqs[], hal_cq_t *cqs[], uint32_t num_cqs, uint32_t entry_count)
Allocate a new CQ Set of objects.
bool hal_mrq_used
Definition: ocs_hal.h:983
uint8_t mrq_set_count
Definition: ocs_hal.h:1238
ocs_list_link_t link
Definition: ocs_hal.h:1127
ocs_dma_t func_dump_sges
Definition: ocs_hal.h:1070
ocs_hal_rtn_e ocs_hal_rqpair_sequence_free(ocs_hal_t *hal, ocs_hal_sequence_t *seq)
Return RQ buffers (while in RQ pair mode).
uint32_t entry_size
Definition: ocs_hal.h:1132
uint8_t disable_fec
Definition: ocs_hal.h:911
ocs_hal_rtn_e ocs_hal_command(ocs_hal_t *hal, uint8_t *cmd, uint32_t opts, void *cb, void *arg)
Issue a SLI command.
Definition: ocs_hal.c:2731
ocs_hal_rtn_e ocs_hal_clear_dump_location(ocs_hal_t *hal)
Clear the Lancer dump location.
Definition: ocs_hal.c:7980
ocs_list_link_t link
Definition: ocs_hal.h:1225
ocs_list_t q_list
Definition: ocs_hal.h:1151
void(* ocs_hal_link_stat_cb_t)(int32_t status, uint32_t num_counters, ocs_hal_link_stat_counts_t *counters, void *arg)
Definition: ocs_hal.h:1375
uint32_t instance
Definition: ocs_hal.h:1181
void * ocs_hal_get_ptr(ocs_hal_t *hal, ocs_hal_property_e prop)
Definition: ocs_hal.c:2175
int32_t(* ocs_hal_async_cb_t)(ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
Definition: ocs_hal.h:1500
uint32_t tow_enabled
Definition: ocs_hal.h:992
ocs_hal_sequence_t seq
Definition: ocs_hal.h:819
uint8_t rr_quanta
Definition: ocs_hal.h:947
uint32_t tow_xri_cnt
Definition: ocs_hal.h:931
uint32_t nvmeq
Definition: ocs_hal.h:1139
ocs_hal_sequence_t * seq
Definition: ocs_hal.h:1456
#define SLI4_MAX_FCF_INDEX
Maximum value for FCF index.
Definition: sli4_fc.h:61
ocs_lock_t cmd_lock
Definition: ocs_hal.h:999
#define OCS_HAL_MAX_WQ_CPU
Definition: ocs_hal.h:126
int32_t ocs_hal_io_cancel(ocs_hal_t *hal)
Definition: ocs_hal.c:11262
void ocs_hal_rqpair_teardown(ocs_hal_t *hal)
Tear down the rq_pair function from ocs_hal_teardown().
sli4_queue_t * queue
Definition: ocs_hal.h:1187
uint32_t first_burst_entry_size
Definition: ocs_hal.h:1231
ocs_dma_t * cmnd
Definition: ocs_hal.h:549
ocs_hal_dif_blk_size_e blk_size
Definition: ocs_hal.h:402
ocs_cbuf_t * iopt_free_queue
Definition: ocs_hal.h:854
hal_eq_t * eq
Definition: ocs_hal.h:625
uint32_t base_mrq_id
Definition: ocs_hal.h:1237
int32_t(* ocs_hal_srrs_cb_t)(ocs_hal_io_t *io, ocs_remote_node_t *rnode, uint32_t length, int32_t status, uint32_t ext_status, void *arg)
Definition: ocs_hal.h:1334
uint32_t abort_in_progress
Definition: ocs_hal.h:614
uint32_t wqec_set_count
Definition: ocs_hal.h:1192
uint16_t fcf_indicator
Definition: ocs_hal.h:1050
ocs_list_link_t link
Definition: ocs_hal.h:798
void * abort_arg
Definition: ocs_hal.h:608
uint32_t bounce
Definition: ocs_hal.h:939
uint32_t rq_empty_warn_count
Definition: ocs_hal.h:1255
ocs_hal_unsol_status_e
HAL unsolicited callback status.
Definition: ocs_hal.h:710
ocs_hal_wq_steering_e
WQ steering mode.
Definition: ocs_hal.h:563
sli4_t sli
Definition: ocs_hal.h:904
uint32_t tow_dnrx
Definition: ocs_hal.h:614
uint32_t num_qentries[SLI_QTYPE_MAX]
Definition: ocs_hal.h:954
uint16_t hal_rq_lookup[OCS_HAL_MAX_NUM_RQ]
Definition: ocs_hal.h:959
struct ocs_hal_s::@24 args
uint32_t cq_process_limit
Definition: ocs_hal.h:949
uint8_t wqe_timer
Definition: ocs_hal.h:546
ocs_ref_t ref
Definition: ocs_hal.h:609
ocs_list_link_t link
Definition: ocs_hal.h:1159
void(* ocs_set_port_protocol_cb_t)(int32_t status, void *arg)
Definition: ocs_hal.h:1406
ocs_hal_sequence_t * cmd_seq
Definition: ocs_hal.h:829
unsigned long jiffies_prev
Definition: ocs_hal.h:914
hal_cq_t * hal_cq[OCS_HAL_MAX_NUM_CQ]
Definition: ocs_hal.h:980
ocs_hal_rtn_e ocs_hal_set_trunk_mode(ocs_hal_t *hal, uint32_t trunk_mode)
Set trunking mode.
Definition: ocs_hal.c:6951
ocs_hal_rq_buffer_t * payload
Definition: ocs_hal.h:791
sli4_port_type_e
Definition: sli4.h:3574
ocs_dma_t def_sgl
Definition: ocs_hal.h:634
uint8_t ulp
Definition: ocs_hal.h:1189
sli4_queue_t * mq[OCS_HAL_MAX_NUM_MQ]
Definition: ocs_hal.h:960
ocs_hal_rtn_e ocs_hal_firmware_write(ocs_hal_t *hal, ocs_dma_t *dma, uint32_t size, uint32_t offset, int last, ocs_hal_fw_cb_t cb, void *arg)
Write a portion of a firmware image to the device.
Definition: ocs_hal.c:5569
ocs_hal_rtn_e ocs_hal_get_link_stats(ocs_hal_t *hal, uint8_t req_ext_counters, uint8_t clear_overflow_flags, uint8_t clear_all_counters, ocs_hal_link_stat_cb_t cb, void *arg)
Function to retrieve the link statistics.
Definition: ocs_hal.c:5909
void(* ocs_hal_dump_get_cb_t)(int32_t status, uint32_t bytes_read, uint8_t eof, void *arg)
Definition: ocs_hal.h:1392
uint32_t n_cq
Definition: ocs_hal.h:921
Stucture used for the hash lookup of queue IDs.
Definition: ocs_hal.h:869
ocs_hal_dif_blk_size_e blk_size
Definition: ocs_hal.h:543
uint32_t size
Definition: ocs_hal.h:1466
uint8_t wq_class
Definition: ocs_hal.h:627
uint32_t active_wqe_timer_shutdown
Definition: ocs_hal.h:1099
uint32_t status_saved
Definition: ocs_hal.h:614
#define OCS_HAL_MAX_PROFILES
Definition: ocs_hal.h:286
ocs_os_handle_t os
Definition: ocs_hal.h:903
sli4_queue_t * first_burst
Definition: ocs_hal.h:1247
ocs_hal_t * hal
Definition: ocs_hal.h:597