Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
0002 /*
0003  * Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All rights reserved.
0004  */
0005 
0006 #ifndef _EFA_ADMIN_CMDS_H_
0007 #define _EFA_ADMIN_CMDS_H_
0008 
0009 #define EFA_ADMIN_API_VERSION_MAJOR          0
0010 #define EFA_ADMIN_API_VERSION_MINOR          1
0011 
0012 /* EFA admin queue opcodes */
0013 enum efa_admin_aq_opcode {
0014     EFA_ADMIN_CREATE_QP                         = 1,
0015     EFA_ADMIN_MODIFY_QP                         = 2,
0016     EFA_ADMIN_QUERY_QP                          = 3,
0017     EFA_ADMIN_DESTROY_QP                        = 4,
0018     EFA_ADMIN_CREATE_AH                         = 5,
0019     EFA_ADMIN_DESTROY_AH                        = 6,
0020     EFA_ADMIN_REG_MR                            = 7,
0021     EFA_ADMIN_DEREG_MR                          = 8,
0022     EFA_ADMIN_CREATE_CQ                         = 9,
0023     EFA_ADMIN_DESTROY_CQ                        = 10,
0024     EFA_ADMIN_GET_FEATURE                       = 11,
0025     EFA_ADMIN_SET_FEATURE                       = 12,
0026     EFA_ADMIN_GET_STATS                         = 13,
0027     EFA_ADMIN_ALLOC_PD                          = 14,
0028     EFA_ADMIN_DEALLOC_PD                        = 15,
0029     EFA_ADMIN_ALLOC_UAR                         = 16,
0030     EFA_ADMIN_DEALLOC_UAR                       = 17,
0031     EFA_ADMIN_CREATE_EQ                         = 18,
0032     EFA_ADMIN_DESTROY_EQ                        = 19,
0033     EFA_ADMIN_MAX_OPCODE                        = 19,
0034 };
0035 
0036 enum efa_admin_aq_feature_id {
0037     EFA_ADMIN_DEVICE_ATTR                       = 1,
0038     EFA_ADMIN_AENQ_CONFIG                       = 2,
0039     EFA_ADMIN_NETWORK_ATTR                      = 3,
0040     EFA_ADMIN_QUEUE_ATTR                        = 4,
0041     EFA_ADMIN_HW_HINTS                          = 5,
0042     EFA_ADMIN_HOST_INFO                         = 6,
0043     EFA_ADMIN_EVENT_QUEUE_ATTR                  = 7,
0044 };
0045 
0046 /* QP transport type */
0047 enum efa_admin_qp_type {
0048     /* Unreliable Datagram */
0049     EFA_ADMIN_QP_TYPE_UD                        = 1,
0050     /* Scalable Reliable Datagram */
0051     EFA_ADMIN_QP_TYPE_SRD                       = 2,
0052 };
0053 
0054 /* QP state */
0055 enum efa_admin_qp_state {
0056     EFA_ADMIN_QP_STATE_RESET                    = 0,
0057     EFA_ADMIN_QP_STATE_INIT                     = 1,
0058     EFA_ADMIN_QP_STATE_RTR                      = 2,
0059     EFA_ADMIN_QP_STATE_RTS                      = 3,
0060     EFA_ADMIN_QP_STATE_SQD                      = 4,
0061     EFA_ADMIN_QP_STATE_SQE                      = 5,
0062     EFA_ADMIN_QP_STATE_ERR                      = 6,
0063 };
0064 
0065 enum efa_admin_get_stats_type {
0066     EFA_ADMIN_GET_STATS_TYPE_BASIC              = 0,
0067     EFA_ADMIN_GET_STATS_TYPE_MESSAGES           = 1,
0068     EFA_ADMIN_GET_STATS_TYPE_RDMA_READ          = 2,
0069 };
0070 
0071 enum efa_admin_get_stats_scope {
0072     EFA_ADMIN_GET_STATS_SCOPE_ALL               = 0,
0073     EFA_ADMIN_GET_STATS_SCOPE_QUEUE             = 1,
0074 };
0075 
0076 /*
0077  * QP allocation sizes, converted by fabric QueuePair (QP) create command
0078  * from QP capabilities.
0079  */
0080 struct efa_admin_qp_alloc_size {
0081     /* Send descriptor ring size in bytes */
0082     u32 send_queue_ring_size;
0083 
0084     /* Max number of WQEs that can be outstanding on send queue. */
0085     u32 send_queue_depth;
0086 
0087     /*
0088      * Recv descriptor ring size in bytes, sufficient for user-provided
0089      * number of WQEs
0090      */
0091     u32 recv_queue_ring_size;
0092 
0093     /* Max number of WQEs that can be outstanding on recv queue */
0094     u32 recv_queue_depth;
0095 };
0096 
0097 struct efa_admin_create_qp_cmd {
0098     /* Common Admin Queue descriptor */
0099     struct efa_admin_aq_common_desc aq_common_desc;
0100 
0101     /* Protection Domain associated with this QP */
0102     u16 pd;
0103 
0104     /* QP type */
0105     u8 qp_type;
0106 
0107     /*
0108      * 0 : sq_virt - If set, SQ ring base address is
0109      *    virtual (IOVA returned by MR registration)
0110      * 1 : rq_virt - If set, RQ ring base address is
0111      *    virtual (IOVA returned by MR registration)
0112      * 7:2 : reserved - MBZ
0113      */
0114     u8 flags;
0115 
0116     /*
0117      * Send queue (SQ) ring base physical address. This field is not
0118      * used if this is a Low Latency Queue(LLQ).
0119      */
0120     u64 sq_base_addr;
0121 
0122     /* Receive queue (RQ) ring base address. */
0123     u64 rq_base_addr;
0124 
0125     /* Index of CQ to be associated with Send Queue completions */
0126     u32 send_cq_idx;
0127 
0128     /* Index of CQ to be associated with Recv Queue completions */
0129     u32 recv_cq_idx;
0130 
0131     /*
0132      * Memory registration key for the SQ ring, used only when not in
0133      * LLQ mode and base address is virtual
0134      */
0135     u32 sq_l_key;
0136 
0137     /*
0138      * Memory registration key for the RQ ring, used only when base
0139      * address is virtual
0140      */
0141     u32 rq_l_key;
0142 
0143     /* Requested QP allocation sizes */
0144     struct efa_admin_qp_alloc_size qp_alloc_size;
0145 
0146     /* UAR number */
0147     u16 uar;
0148 
0149     /* MBZ */
0150     u16 reserved;
0151 
0152     /* MBZ */
0153     u32 reserved2;
0154 };
0155 
0156 struct efa_admin_create_qp_resp {
0157     /* Common Admin Queue completion descriptor */
0158     struct efa_admin_acq_common_desc acq_common_desc;
0159 
0160     /*
0161      * Opaque handle to be used for consequent admin operations on the
0162      * QP
0163      */
0164     u32 qp_handle;
0165 
0166     /*
0167      * QP number in the given EFA virtual device. Least-significant bits (as
0168      * needed according to max_qp) carry unique QP ID
0169      */
0170     u16 qp_num;
0171 
0172     /* MBZ */
0173     u16 reserved;
0174 
0175     /* Index of sub-CQ for Send Queue completions */
0176     u16 send_sub_cq_idx;
0177 
0178     /* Index of sub-CQ for Receive Queue completions */
0179     u16 recv_sub_cq_idx;
0180 
0181     /* SQ doorbell address, as offset to PCIe DB BAR */
0182     u32 sq_db_offset;
0183 
0184     /* RQ doorbell address, as offset to PCIe DB BAR */
0185     u32 rq_db_offset;
0186 
0187     /*
0188      * low latency send queue ring base address as an offset to PCIe
0189      * MMIO LLQ_MEM BAR
0190      */
0191     u32 llq_descriptors_offset;
0192 };
0193 
0194 struct efa_admin_modify_qp_cmd {
0195     /* Common Admin Queue descriptor */
0196     struct efa_admin_aq_common_desc aq_common_desc;
0197 
0198     /*
0199      * Mask indicating which fields should be updated
0200      * 0 : qp_state
0201      * 1 : cur_qp_state
0202      * 2 : qkey
0203      * 3 : sq_psn
0204      * 4 : sq_drained_async_notify
0205      * 5 : rnr_retry
0206      * 31:6 : reserved
0207      */
0208     u32 modify_mask;
0209 
0210     /* QP handle returned by create_qp command */
0211     u32 qp_handle;
0212 
0213     /* QP state */
0214     u32 qp_state;
0215 
0216     /* Override current QP state (before applying the transition) */
0217     u32 cur_qp_state;
0218 
0219     /* QKey */
0220     u32 qkey;
0221 
0222     /* SQ PSN */
0223     u32 sq_psn;
0224 
0225     /* Enable async notification when SQ is drained */
0226     u8 sq_drained_async_notify;
0227 
0228     /* Number of RNR retries (valid only for SRD QPs) */
0229     u8 rnr_retry;
0230 
0231     /* MBZ */
0232     u16 reserved2;
0233 };
0234 
0235 struct efa_admin_modify_qp_resp {
0236     /* Common Admin Queue completion descriptor */
0237     struct efa_admin_acq_common_desc acq_common_desc;
0238 };
0239 
0240 struct efa_admin_query_qp_cmd {
0241     /* Common Admin Queue descriptor */
0242     struct efa_admin_aq_common_desc aq_common_desc;
0243 
0244     /* QP handle returned by create_qp command */
0245     u32 qp_handle;
0246 };
0247 
0248 struct efa_admin_query_qp_resp {
0249     /* Common Admin Queue completion descriptor */
0250     struct efa_admin_acq_common_desc acq_common_desc;
0251 
0252     /* QP state */
0253     u32 qp_state;
0254 
0255     /* QKey */
0256     u32 qkey;
0257 
0258     /* SQ PSN */
0259     u32 sq_psn;
0260 
0261     /* Indicates that draining is in progress */
0262     u8 sq_draining;
0263 
0264     /* Number of RNR retries (valid only for SRD QPs) */
0265     u8 rnr_retry;
0266 
0267     /* MBZ */
0268     u16 reserved2;
0269 };
0270 
0271 struct efa_admin_destroy_qp_cmd {
0272     /* Common Admin Queue descriptor */
0273     struct efa_admin_aq_common_desc aq_common_desc;
0274 
0275     /* QP handle returned by create_qp command */
0276     u32 qp_handle;
0277 };
0278 
0279 struct efa_admin_destroy_qp_resp {
0280     /* Common Admin Queue completion descriptor */
0281     struct efa_admin_acq_common_desc acq_common_desc;
0282 };
0283 
0284 /*
0285  * Create Address Handle command parameters. Must not be called more than
0286  * once for the same destination
0287  */
0288 struct efa_admin_create_ah_cmd {
0289     /* Common Admin Queue descriptor */
0290     struct efa_admin_aq_common_desc aq_common_desc;
0291 
0292     /* Destination address in network byte order */
0293     u8 dest_addr[16];
0294 
0295     /* PD number */
0296     u16 pd;
0297 
0298     /* MBZ */
0299     u16 reserved;
0300 };
0301 
0302 struct efa_admin_create_ah_resp {
0303     /* Common Admin Queue completion descriptor */
0304     struct efa_admin_acq_common_desc acq_common_desc;
0305 
0306     /* Target interface address handle (opaque) */
0307     u16 ah;
0308 
0309     /* MBZ */
0310     u16 reserved;
0311 };
0312 
0313 struct efa_admin_destroy_ah_cmd {
0314     /* Common Admin Queue descriptor */
0315     struct efa_admin_aq_common_desc aq_common_desc;
0316 
0317     /* Target interface address handle (opaque) */
0318     u16 ah;
0319 
0320     /* PD number */
0321     u16 pd;
0322 };
0323 
0324 struct efa_admin_destroy_ah_resp {
0325     /* Common Admin Queue completion descriptor */
0326     struct efa_admin_acq_common_desc acq_common_desc;
0327 };
0328 
0329 /*
0330  * Registration of MemoryRegion, required for QP working with Virtual
0331  * Addresses. In standard verbs semantics, region length is limited to 2GB
0332  * space, but EFA offers larger MR support for large memory space, to ease
0333  * on users working with very large datasets (i.e. full GPU memory mapping).
0334  */
0335 struct efa_admin_reg_mr_cmd {
0336     /* Common Admin Queue descriptor */
0337     struct efa_admin_aq_common_desc aq_common_desc;
0338 
0339     /* Protection Domain */
0340     u16 pd;
0341 
0342     /* MBZ */
0343     u16 reserved16_w1;
0344 
0345     /* Physical Buffer List, each element is page-aligned. */
0346     union {
0347         /*
0348          * Inline array of guest-physical page addresses of user
0349          * memory pages (optimization for short region
0350          * registrations)
0351          */
0352         u64 inline_pbl_array[4];
0353 
0354         /* points to PBL (direct or indirect, chained if needed) */
0355         struct efa_admin_ctrl_buff_info pbl;
0356     } pbl;
0357 
0358     /* Memory region length, in bytes. */
0359     u64 mr_length;
0360 
0361     /*
0362      * flags and page size
0363      * 4:0 : phys_page_size_shift - page size is (1 <<
0364      *    phys_page_size_shift). Page size is used for
0365      *    building the Virtual to Physical address mapping
0366      * 6:5 : reserved - MBZ
0367      * 7 : mem_addr_phy_mode_en - Enable bit for physical
0368      *    memory registration (no translation), can be used
0369      *    only by privileged clients. If set, PBL must
0370      *    contain a single entry.
0371      */
0372     u8 flags;
0373 
0374     /*
0375      * permissions
0376      * 0 : local_write_enable - Local write permissions:
0377      *    must be set for RQ buffers and buffers posted for
0378      *    RDMA Read requests
0379      * 1 : reserved1 - MBZ
0380      * 2 : remote_read_enable - Remote read permissions:
0381      *    must be set to enable RDMA read from the region
0382      * 7:3 : reserved2 - MBZ
0383      */
0384     u8 permissions;
0385 
0386     /* MBZ */
0387     u16 reserved16_w5;
0388 
0389     /* number of pages in PBL (redundant, could be calculated) */
0390     u32 page_num;
0391 
0392     /*
0393      * IO Virtual Address associated with this MR. If
0394      * mem_addr_phy_mode_en is set, contains the physical address of
0395      * the region.
0396      */
0397     u64 iova;
0398 };
0399 
0400 struct efa_admin_reg_mr_resp {
0401     /* Common Admin Queue completion descriptor */
0402     struct efa_admin_acq_common_desc acq_common_desc;
0403 
0404     /*
0405      * L_Key, to be used in conjunction with local buffer references in
0406      * SQ and RQ WQE, or with virtual RQ/CQ rings
0407      */
0408     u32 l_key;
0409 
0410     /*
0411      * R_Key, to be used in RDMA messages to refer to remotely accessed
0412      * memory region
0413      */
0414     u32 r_key;
0415 };
0416 
0417 struct efa_admin_dereg_mr_cmd {
0418     /* Common Admin Queue descriptor */
0419     struct efa_admin_aq_common_desc aq_common_desc;
0420 
0421     /* L_Key, memory region's l_key */
0422     u32 l_key;
0423 };
0424 
0425 struct efa_admin_dereg_mr_resp {
0426     /* Common Admin Queue completion descriptor */
0427     struct efa_admin_acq_common_desc acq_common_desc;
0428 };
0429 
0430 struct efa_admin_create_cq_cmd {
0431     struct efa_admin_aq_common_desc aq_common_desc;
0432 
0433     /*
0434      * 4:0 : reserved5 - MBZ
0435      * 5 : interrupt_mode_enabled - if set, cq operates
0436      *    in interrupt mode (i.e. CQ events and EQ elements
0437      *    are generated), otherwise - polling
0438      * 6 : virt - If set, ring base address is virtual
0439      *    (IOVA returned by MR registration)
0440      * 7 : reserved6 - MBZ
0441      */
0442     u8 cq_caps_1;
0443 
0444     /*
0445      * 4:0 : cq_entry_size_words - size of CQ entry in
0446      *    32-bit words, valid values: 4, 8.
0447      * 7:5 : reserved7 - MBZ
0448      */
0449     u8 cq_caps_2;
0450 
0451     /* completion queue depth in # of entries. must be power of 2 */
0452     u16 cq_depth;
0453 
0454     /* EQ number assigned to this cq */
0455     u16 eqn;
0456 
0457     /* MBZ */
0458     u16 reserved;
0459 
0460     /*
0461      * CQ ring base address, virtual or physical depending on 'virt'
0462      * flag
0463      */
0464     struct efa_common_mem_addr cq_ba;
0465 
0466     /*
0467      * Memory registration key for the ring, used only when base
0468      * address is virtual
0469      */
0470     u32 l_key;
0471 
0472     /*
0473      * number of sub cqs - must be equal to sub_cqs_per_cq of queue
0474      * attributes.
0475      */
0476     u16 num_sub_cqs;
0477 
0478     /* UAR number */
0479     u16 uar;
0480 };
0481 
0482 struct efa_admin_create_cq_resp {
0483     struct efa_admin_acq_common_desc acq_common_desc;
0484 
0485     u16 cq_idx;
0486 
0487     /* actual cq depth in number of entries */
0488     u16 cq_actual_depth;
0489 
0490     /* CQ doorbell address, as offset to PCIe DB BAR */
0491     u32 db_offset;
0492 
0493     /*
0494      * 0 : db_valid - If set, doorbell offset is valid.
0495      *    Always set when interrupts are requested.
0496      */
0497     u32 flags;
0498 };
0499 
0500 struct efa_admin_destroy_cq_cmd {
0501     struct efa_admin_aq_common_desc aq_common_desc;
0502 
0503     u16 cq_idx;
0504 
0505     /* MBZ */
0506     u16 reserved1;
0507 };
0508 
0509 struct efa_admin_destroy_cq_resp {
0510     struct efa_admin_acq_common_desc acq_common_desc;
0511 };
0512 
0513 /*
0514  * EFA AQ Get Statistics command. Extended statistics are placed in control
0515  * buffer pointed by AQ entry
0516  */
0517 struct efa_admin_aq_get_stats_cmd {
0518     struct efa_admin_aq_common_desc aq_common_descriptor;
0519 
0520     union {
0521         /* command specific inline data */
0522         u32 inline_data_w1[3];
0523 
0524         struct efa_admin_ctrl_buff_info control_buffer;
0525     } u;
0526 
0527     /* stats type as defined in enum efa_admin_get_stats_type */
0528     u8 type;
0529 
0530     /* stats scope defined in enum efa_admin_get_stats_scope */
0531     u8 scope;
0532 
0533     u16 scope_modifier;
0534 };
0535 
0536 struct efa_admin_basic_stats {
0537     u64 tx_bytes;
0538 
0539     u64 tx_pkts;
0540 
0541     u64 rx_bytes;
0542 
0543     u64 rx_pkts;
0544 
0545     u64 rx_drops;
0546 };
0547 
0548 struct efa_admin_messages_stats {
0549     u64 send_bytes;
0550 
0551     u64 send_wrs;
0552 
0553     u64 recv_bytes;
0554 
0555     u64 recv_wrs;
0556 };
0557 
0558 struct efa_admin_rdma_read_stats {
0559     u64 read_wrs;
0560 
0561     u64 read_bytes;
0562 
0563     u64 read_wr_err;
0564 
0565     u64 read_resp_bytes;
0566 };
0567 
0568 struct efa_admin_acq_get_stats_resp {
0569     struct efa_admin_acq_common_desc acq_common_desc;
0570 
0571     union {
0572         struct efa_admin_basic_stats basic_stats;
0573 
0574         struct efa_admin_messages_stats messages_stats;
0575 
0576         struct efa_admin_rdma_read_stats rdma_read_stats;
0577     } u;
0578 };
0579 
0580 struct efa_admin_get_set_feature_common_desc {
0581     /* MBZ */
0582     u8 reserved0;
0583 
0584     /* as appears in efa_admin_aq_feature_id */
0585     u8 feature_id;
0586 
0587     /* MBZ */
0588     u16 reserved16;
0589 };
0590 
0591 struct efa_admin_feature_device_attr_desc {
0592     /* Bitmap of efa_admin_aq_feature_id */
0593     u64 supported_features;
0594 
0595     /* Bitmap of supported page sizes in MR registrations */
0596     u64 page_size_cap;
0597 
0598     u32 fw_version;
0599 
0600     u32 admin_api_version;
0601 
0602     u32 device_version;
0603 
0604     /* Bar used for SQ and RQ doorbells */
0605     u16 db_bar;
0606 
0607     /* Indicates how many bits are used on physical address access */
0608     u8 phys_addr_width;
0609 
0610     /* Indicates how many bits are used on virtual address access */
0611     u8 virt_addr_width;
0612 
0613     /*
0614      * 0 : rdma_read - If set, RDMA Read is supported on
0615      *    TX queues
0616      * 1 : rnr_retry - If set, RNR retry is supported on
0617      *    modify QP command
0618      * 31:2 : reserved - MBZ
0619      */
0620     u32 device_caps;
0621 
0622     /* Max RDMA transfer size in bytes */
0623     u32 max_rdma_size;
0624 };
0625 
0626 struct efa_admin_feature_queue_attr_desc {
0627     /* The maximum number of queue pairs supported */
0628     u32 max_qp;
0629 
0630     /* Maximum number of WQEs per Send Queue */
0631     u32 max_sq_depth;
0632 
0633     /* Maximum size of data that can be sent inline in a Send WQE */
0634     u32 inline_buf_size;
0635 
0636     /* Maximum number of buffer descriptors per Recv Queue */
0637     u32 max_rq_depth;
0638 
0639     /* The maximum number of completion queues supported per VF */
0640     u32 max_cq;
0641 
0642     /* Maximum number of CQEs per Completion Queue */
0643     u32 max_cq_depth;
0644 
0645     /* Number of sub-CQs to be created for each CQ */
0646     u16 sub_cqs_per_cq;
0647 
0648     /* Minimum number of WQEs per SQ */
0649     u16 min_sq_depth;
0650 
0651     /* Maximum number of SGEs (buffers) allowed for a single send WQE */
0652     u16 max_wr_send_sges;
0653 
0654     /* Maximum number of SGEs allowed for a single recv WQE */
0655     u16 max_wr_recv_sges;
0656 
0657     /* The maximum number of memory regions supported */
0658     u32 max_mr;
0659 
0660     /* The maximum number of pages can be registered */
0661     u32 max_mr_pages;
0662 
0663     /* The maximum number of protection domains supported */
0664     u32 max_pd;
0665 
0666     /* The maximum number of address handles supported */
0667     u32 max_ah;
0668 
0669     /* The maximum size of LLQ in bytes */
0670     u32 max_llq_size;
0671 
0672     /* Maximum number of SGEs for a single RDMA read WQE */
0673     u16 max_wr_rdma_sges;
0674 
0675     /*
0676      * Maximum number of bytes that can be written to SQ between two
0677      * consecutive doorbells (in units of 64B). Driver must ensure that only
0678      * complete WQEs are written to queue before issuing a doorbell.
0679      * Examples: max_tx_batch=16 and WQE size = 64B, means up to 16 WQEs can
0680      * be written to SQ between two consecutive doorbells. max_tx_batch=11
0681      * and WQE size = 128B, means up to 5 WQEs can be written to SQ between
0682      * two consecutive doorbells. Zero means unlimited.
0683      */
0684     u16 max_tx_batch;
0685 };
0686 
0687 struct efa_admin_event_queue_attr_desc {
0688     /* The maximum number of event queues supported */
0689     u32 max_eq;
0690 
0691     /* Maximum number of EQEs per Event Queue */
0692     u32 max_eq_depth;
0693 
0694     /* Supported events bitmask */
0695     u32 event_bitmask;
0696 };
0697 
0698 struct efa_admin_feature_aenq_desc {
0699     /* bitmask for AENQ groups the device can report */
0700     u32 supported_groups;
0701 
0702     /* bitmask for AENQ groups to report */
0703     u32 enabled_groups;
0704 };
0705 
0706 struct efa_admin_feature_network_attr_desc {
0707     /* Raw address data in network byte order */
0708     u8 addr[16];
0709 
0710     /* max packet payload size in bytes */
0711     u32 mtu;
0712 };
0713 
0714 /*
0715  * When hint value is 0, hints capabilities are not supported or driver
0716  * should use its own predefined value
0717  */
0718 struct efa_admin_hw_hints {
0719     /* value in ms */
0720     u16 mmio_read_timeout;
0721 
0722     /* value in ms */
0723     u16 driver_watchdog_timeout;
0724 
0725     /* value in ms */
0726     u16 admin_completion_timeout;
0727 
0728     /* poll interval in ms */
0729     u16 poll_interval;
0730 };
0731 
0732 struct efa_admin_get_feature_cmd {
0733     struct efa_admin_aq_common_desc aq_common_descriptor;
0734 
0735     struct efa_admin_ctrl_buff_info control_buffer;
0736 
0737     struct efa_admin_get_set_feature_common_desc feature_common;
0738 
0739     u32 raw[11];
0740 };
0741 
0742 struct efa_admin_get_feature_resp {
0743     struct efa_admin_acq_common_desc acq_common_desc;
0744 
0745     union {
0746         u32 raw[14];
0747 
0748         struct efa_admin_feature_device_attr_desc device_attr;
0749 
0750         struct efa_admin_feature_aenq_desc aenq;
0751 
0752         struct efa_admin_feature_network_attr_desc network_attr;
0753 
0754         struct efa_admin_feature_queue_attr_desc queue_attr;
0755 
0756         struct efa_admin_event_queue_attr_desc event_queue_attr;
0757 
0758         struct efa_admin_hw_hints hw_hints;
0759     } u;
0760 };
0761 
0762 struct efa_admin_set_feature_cmd {
0763     struct efa_admin_aq_common_desc aq_common_descriptor;
0764 
0765     struct efa_admin_ctrl_buff_info control_buffer;
0766 
0767     struct efa_admin_get_set_feature_common_desc feature_common;
0768 
0769     union {
0770         u32 raw[11];
0771 
0772         /* AENQ configuration */
0773         struct efa_admin_feature_aenq_desc aenq;
0774     } u;
0775 };
0776 
0777 struct efa_admin_set_feature_resp {
0778     struct efa_admin_acq_common_desc acq_common_desc;
0779 
0780     union {
0781         u32 raw[14];
0782     } u;
0783 };
0784 
0785 struct efa_admin_alloc_pd_cmd {
0786     struct efa_admin_aq_common_desc aq_common_descriptor;
0787 };
0788 
0789 struct efa_admin_alloc_pd_resp {
0790     struct efa_admin_acq_common_desc acq_common_desc;
0791 
0792     /* PD number */
0793     u16 pd;
0794 
0795     /* MBZ */
0796     u16 reserved;
0797 };
0798 
0799 struct efa_admin_dealloc_pd_cmd {
0800     struct efa_admin_aq_common_desc aq_common_descriptor;
0801 
0802     /* PD number */
0803     u16 pd;
0804 
0805     /* MBZ */
0806     u16 reserved;
0807 };
0808 
0809 struct efa_admin_dealloc_pd_resp {
0810     struct efa_admin_acq_common_desc acq_common_desc;
0811 };
0812 
0813 struct efa_admin_alloc_uar_cmd {
0814     struct efa_admin_aq_common_desc aq_common_descriptor;
0815 };
0816 
0817 struct efa_admin_alloc_uar_resp {
0818     struct efa_admin_acq_common_desc acq_common_desc;
0819 
0820     /* UAR number */
0821     u16 uar;
0822 
0823     /* MBZ */
0824     u16 reserved;
0825 };
0826 
0827 struct efa_admin_dealloc_uar_cmd {
0828     struct efa_admin_aq_common_desc aq_common_descriptor;
0829 
0830     /* UAR number */
0831     u16 uar;
0832 
0833     /* MBZ */
0834     u16 reserved;
0835 };
0836 
0837 struct efa_admin_dealloc_uar_resp {
0838     struct efa_admin_acq_common_desc acq_common_desc;
0839 };
0840 
0841 struct efa_admin_create_eq_cmd {
0842     struct efa_admin_aq_common_desc aq_common_descriptor;
0843 
0844     /* Size of the EQ in entries, must be power of 2 */
0845     u16 depth;
0846 
0847     /* MSI-X table entry index */
0848     u8 msix_vec;
0849 
0850     /*
0851      * 4:0 : entry_size_words - size of EQ entry in
0852      *    32-bit words
0853      * 7:5 : reserved - MBZ
0854      */
0855     u8 caps;
0856 
0857     /* EQ ring base address */
0858     struct efa_common_mem_addr ba;
0859 
0860     /*
0861      * Enabled events on this EQ
0862      * 0 : completion_events - Enable completion events
0863      * 31:1 : reserved - MBZ
0864      */
0865     u32 event_bitmask;
0866 
0867     /* MBZ */
0868     u32 reserved;
0869 };
0870 
0871 struct efa_admin_create_eq_resp {
0872     struct efa_admin_acq_common_desc acq_common_desc;
0873 
0874     /* EQ number */
0875     u16 eqn;
0876 
0877     /* MBZ */
0878     u16 reserved;
0879 };
0880 
0881 struct efa_admin_destroy_eq_cmd {
0882     struct efa_admin_aq_common_desc aq_common_descriptor;
0883 
0884     /* EQ number */
0885     u16 eqn;
0886 
0887     /* MBZ */
0888     u16 reserved;
0889 };
0890 
0891 struct efa_admin_destroy_eq_resp {
0892     struct efa_admin_acq_common_desc acq_common_desc;
0893 };
0894 
0895 /* asynchronous event notification groups */
0896 enum efa_admin_aenq_group {
0897     EFA_ADMIN_FATAL_ERROR                       = 1,
0898     EFA_ADMIN_WARNING                           = 2,
0899     EFA_ADMIN_NOTIFICATION                      = 3,
0900     EFA_ADMIN_KEEP_ALIVE                        = 4,
0901     EFA_ADMIN_AENQ_GROUPS_NUM                   = 5,
0902 };
0903 
0904 struct efa_admin_mmio_req_read_less_resp {
0905     u16 req_id;
0906 
0907     u16 reg_off;
0908 
0909     /* value is valid when poll is cleared */
0910     u32 reg_val;
0911 };
0912 
0913 enum efa_admin_os_type {
0914     EFA_ADMIN_OS_LINUX                          = 0,
0915 };
0916 
0917 struct efa_admin_host_info {
0918     /* OS distribution string format */
0919     u8 os_dist_str[128];
0920 
0921     /* Defined in enum efa_admin_os_type */
0922     u32 os_type;
0923 
0924     /* Kernel version string format */
0925     u8 kernel_ver_str[32];
0926 
0927     /* Kernel version numeric format */
0928     u32 kernel_ver;
0929 
0930     /*
0931      * 7:0 : driver_module_type
0932      * 15:8 : driver_sub_minor
0933      * 23:16 : driver_minor
0934      * 31:24 : driver_major
0935      */
0936     u32 driver_ver;
0937 
0938     /*
0939      * Device's Bus, Device and Function
0940      * 2:0 : function
0941      * 7:3 : device
0942      * 15:8 : bus
0943      */
0944     u16 bdf;
0945 
0946     /*
0947      * Spec version
0948      * 7:0 : spec_minor
0949      * 15:8 : spec_major
0950      */
0951     u16 spec_ver;
0952 
0953     /*
0954      * 0 : intree - Intree driver
0955      * 1 : gdr - GPUDirect RDMA supported
0956      * 31:2 : reserved2
0957      */
0958     u32 flags;
0959 };
0960 
0961 /* create_qp_cmd */
0962 #define EFA_ADMIN_CREATE_QP_CMD_SQ_VIRT_MASK                BIT(0)
0963 #define EFA_ADMIN_CREATE_QP_CMD_RQ_VIRT_MASK                BIT(1)
0964 
0965 /* modify_qp_cmd */
0966 #define EFA_ADMIN_MODIFY_QP_CMD_QP_STATE_MASK               BIT(0)
0967 #define EFA_ADMIN_MODIFY_QP_CMD_CUR_QP_STATE_MASK           BIT(1)
0968 #define EFA_ADMIN_MODIFY_QP_CMD_QKEY_MASK                   BIT(2)
0969 #define EFA_ADMIN_MODIFY_QP_CMD_SQ_PSN_MASK                 BIT(3)
0970 #define EFA_ADMIN_MODIFY_QP_CMD_SQ_DRAINED_ASYNC_NOTIFY_MASK BIT(4)
0971 #define EFA_ADMIN_MODIFY_QP_CMD_RNR_RETRY_MASK              BIT(5)
0972 
0973 /* reg_mr_cmd */
0974 #define EFA_ADMIN_REG_MR_CMD_PHYS_PAGE_SIZE_SHIFT_MASK      GENMASK(4, 0)
0975 #define EFA_ADMIN_REG_MR_CMD_MEM_ADDR_PHY_MODE_EN_MASK      BIT(7)
0976 #define EFA_ADMIN_REG_MR_CMD_LOCAL_WRITE_ENABLE_MASK        BIT(0)
0977 #define EFA_ADMIN_REG_MR_CMD_REMOTE_READ_ENABLE_MASK        BIT(2)
0978 
0979 /* create_cq_cmd */
0980 #define EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
0981 #define EFA_ADMIN_CREATE_CQ_CMD_VIRT_MASK                   BIT(6)
0982 #define EFA_ADMIN_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK    GENMASK(4, 0)
0983 
0984 /* create_cq_resp */
0985 #define EFA_ADMIN_CREATE_CQ_RESP_DB_VALID_MASK              BIT(0)
0986 
0987 /* feature_device_attr_desc */
0988 #define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RDMA_READ_MASK   BIT(0)
0989 #define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RNR_RETRY_MASK   BIT(1)
0990 
0991 /* create_eq_cmd */
0992 #define EFA_ADMIN_CREATE_EQ_CMD_ENTRY_SIZE_WORDS_MASK       GENMASK(4, 0)
0993 #define EFA_ADMIN_CREATE_EQ_CMD_VIRT_MASK                   BIT(6)
0994 #define EFA_ADMIN_CREATE_EQ_CMD_COMPLETION_EVENTS_MASK      BIT(0)
0995 
0996 /* host_info */
0997 #define EFA_ADMIN_HOST_INFO_DRIVER_MODULE_TYPE_MASK         GENMASK(7, 0)
0998 #define EFA_ADMIN_HOST_INFO_DRIVER_SUB_MINOR_MASK           GENMASK(15, 8)
0999 #define EFA_ADMIN_HOST_INFO_DRIVER_MINOR_MASK               GENMASK(23, 16)
1000 #define EFA_ADMIN_HOST_INFO_DRIVER_MAJOR_MASK               GENMASK(31, 24)
1001 #define EFA_ADMIN_HOST_INFO_FUNCTION_MASK                   GENMASK(2, 0)
1002 #define EFA_ADMIN_HOST_INFO_DEVICE_MASK                     GENMASK(7, 3)
1003 #define EFA_ADMIN_HOST_INFO_BUS_MASK                        GENMASK(15, 8)
1004 #define EFA_ADMIN_HOST_INFO_SPEC_MINOR_MASK                 GENMASK(7, 0)
1005 #define EFA_ADMIN_HOST_INFO_SPEC_MAJOR_MASK                 GENMASK(15, 8)
1006 #define EFA_ADMIN_HOST_INFO_INTREE_MASK                     BIT(0)
1007 #define EFA_ADMIN_HOST_INFO_GDR_MASK                        BIT(1)
1008 
1009 #endif /* _EFA_ADMIN_CMDS_H_ */