0001
0002
0003
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
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
0047 enum efa_admin_qp_type {
0048
0049 EFA_ADMIN_QP_TYPE_UD = 1,
0050
0051 EFA_ADMIN_QP_TYPE_SRD = 2,
0052 };
0053
0054
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
0078
0079
0080 struct efa_admin_qp_alloc_size {
0081
0082 u32 send_queue_ring_size;
0083
0084
0085 u32 send_queue_depth;
0086
0087
0088
0089
0090
0091 u32 recv_queue_ring_size;
0092
0093
0094 u32 recv_queue_depth;
0095 };
0096
0097 struct efa_admin_create_qp_cmd {
0098
0099 struct efa_admin_aq_common_desc aq_common_desc;
0100
0101
0102 u16 pd;
0103
0104
0105 u8 qp_type;
0106
0107
0108
0109
0110
0111
0112
0113
0114 u8 flags;
0115
0116
0117
0118
0119
0120 u64 sq_base_addr;
0121
0122
0123 u64 rq_base_addr;
0124
0125
0126 u32 send_cq_idx;
0127
0128
0129 u32 recv_cq_idx;
0130
0131
0132
0133
0134
0135 u32 sq_l_key;
0136
0137
0138
0139
0140
0141 u32 rq_l_key;
0142
0143
0144 struct efa_admin_qp_alloc_size qp_alloc_size;
0145
0146
0147 u16 uar;
0148
0149
0150 u16 reserved;
0151
0152
0153 u32 reserved2;
0154 };
0155
0156 struct efa_admin_create_qp_resp {
0157
0158 struct efa_admin_acq_common_desc acq_common_desc;
0159
0160
0161
0162
0163
0164 u32 qp_handle;
0165
0166
0167
0168
0169
0170 u16 qp_num;
0171
0172
0173 u16 reserved;
0174
0175
0176 u16 send_sub_cq_idx;
0177
0178
0179 u16 recv_sub_cq_idx;
0180
0181
0182 u32 sq_db_offset;
0183
0184
0185 u32 rq_db_offset;
0186
0187
0188
0189
0190
0191 u32 llq_descriptors_offset;
0192 };
0193
0194 struct efa_admin_modify_qp_cmd {
0195
0196 struct efa_admin_aq_common_desc aq_common_desc;
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208 u32 modify_mask;
0209
0210
0211 u32 qp_handle;
0212
0213
0214 u32 qp_state;
0215
0216
0217 u32 cur_qp_state;
0218
0219
0220 u32 qkey;
0221
0222
0223 u32 sq_psn;
0224
0225
0226 u8 sq_drained_async_notify;
0227
0228
0229 u8 rnr_retry;
0230
0231
0232 u16 reserved2;
0233 };
0234
0235 struct efa_admin_modify_qp_resp {
0236
0237 struct efa_admin_acq_common_desc acq_common_desc;
0238 };
0239
0240 struct efa_admin_query_qp_cmd {
0241
0242 struct efa_admin_aq_common_desc aq_common_desc;
0243
0244
0245 u32 qp_handle;
0246 };
0247
0248 struct efa_admin_query_qp_resp {
0249
0250 struct efa_admin_acq_common_desc acq_common_desc;
0251
0252
0253 u32 qp_state;
0254
0255
0256 u32 qkey;
0257
0258
0259 u32 sq_psn;
0260
0261
0262 u8 sq_draining;
0263
0264
0265 u8 rnr_retry;
0266
0267
0268 u16 reserved2;
0269 };
0270
0271 struct efa_admin_destroy_qp_cmd {
0272
0273 struct efa_admin_aq_common_desc aq_common_desc;
0274
0275
0276 u32 qp_handle;
0277 };
0278
0279 struct efa_admin_destroy_qp_resp {
0280
0281 struct efa_admin_acq_common_desc acq_common_desc;
0282 };
0283
0284
0285
0286
0287
0288 struct efa_admin_create_ah_cmd {
0289
0290 struct efa_admin_aq_common_desc aq_common_desc;
0291
0292
0293 u8 dest_addr[16];
0294
0295
0296 u16 pd;
0297
0298
0299 u16 reserved;
0300 };
0301
0302 struct efa_admin_create_ah_resp {
0303
0304 struct efa_admin_acq_common_desc acq_common_desc;
0305
0306
0307 u16 ah;
0308
0309
0310 u16 reserved;
0311 };
0312
0313 struct efa_admin_destroy_ah_cmd {
0314
0315 struct efa_admin_aq_common_desc aq_common_desc;
0316
0317
0318 u16 ah;
0319
0320
0321 u16 pd;
0322 };
0323
0324 struct efa_admin_destroy_ah_resp {
0325
0326 struct efa_admin_acq_common_desc acq_common_desc;
0327 };
0328
0329
0330
0331
0332
0333
0334
0335 struct efa_admin_reg_mr_cmd {
0336
0337 struct efa_admin_aq_common_desc aq_common_desc;
0338
0339
0340 u16 pd;
0341
0342
0343 u16 reserved16_w1;
0344
0345
0346 union {
0347
0348
0349
0350
0351
0352 u64 inline_pbl_array[4];
0353
0354
0355 struct efa_admin_ctrl_buff_info pbl;
0356 } pbl;
0357
0358
0359 u64 mr_length;
0360
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372 u8 flags;
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384 u8 permissions;
0385
0386
0387 u16 reserved16_w5;
0388
0389
0390 u32 page_num;
0391
0392
0393
0394
0395
0396
0397 u64 iova;
0398 };
0399
0400 struct efa_admin_reg_mr_resp {
0401
0402 struct efa_admin_acq_common_desc acq_common_desc;
0403
0404
0405
0406
0407
0408 u32 l_key;
0409
0410
0411
0412
0413
0414 u32 r_key;
0415 };
0416
0417 struct efa_admin_dereg_mr_cmd {
0418
0419 struct efa_admin_aq_common_desc aq_common_desc;
0420
0421
0422 u32 l_key;
0423 };
0424
0425 struct efa_admin_dereg_mr_resp {
0426
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
0435
0436
0437
0438
0439
0440
0441
0442 u8 cq_caps_1;
0443
0444
0445
0446
0447
0448
0449 u8 cq_caps_2;
0450
0451
0452 u16 cq_depth;
0453
0454
0455 u16 eqn;
0456
0457
0458 u16 reserved;
0459
0460
0461
0462
0463
0464 struct efa_common_mem_addr cq_ba;
0465
0466
0467
0468
0469
0470 u32 l_key;
0471
0472
0473
0474
0475
0476 u16 num_sub_cqs;
0477
0478
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
0488 u16 cq_actual_depth;
0489
0490
0491 u32 db_offset;
0492
0493
0494
0495
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
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
0515
0516
0517 struct efa_admin_aq_get_stats_cmd {
0518 struct efa_admin_aq_common_desc aq_common_descriptor;
0519
0520 union {
0521
0522 u32 inline_data_w1[3];
0523
0524 struct efa_admin_ctrl_buff_info control_buffer;
0525 } u;
0526
0527
0528 u8 type;
0529
0530
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
0582 u8 reserved0;
0583
0584
0585 u8 feature_id;
0586
0587
0588 u16 reserved16;
0589 };
0590
0591 struct efa_admin_feature_device_attr_desc {
0592
0593 u64 supported_features;
0594
0595
0596 u64 page_size_cap;
0597
0598 u32 fw_version;
0599
0600 u32 admin_api_version;
0601
0602 u32 device_version;
0603
0604
0605 u16 db_bar;
0606
0607
0608 u8 phys_addr_width;
0609
0610
0611 u8 virt_addr_width;
0612
0613
0614
0615
0616
0617
0618
0619
0620 u32 device_caps;
0621
0622
0623 u32 max_rdma_size;
0624 };
0625
0626 struct efa_admin_feature_queue_attr_desc {
0627
0628 u32 max_qp;
0629
0630
0631 u32 max_sq_depth;
0632
0633
0634 u32 inline_buf_size;
0635
0636
0637 u32 max_rq_depth;
0638
0639
0640 u32 max_cq;
0641
0642
0643 u32 max_cq_depth;
0644
0645
0646 u16 sub_cqs_per_cq;
0647
0648
0649 u16 min_sq_depth;
0650
0651
0652 u16 max_wr_send_sges;
0653
0654
0655 u16 max_wr_recv_sges;
0656
0657
0658 u32 max_mr;
0659
0660
0661 u32 max_mr_pages;
0662
0663
0664 u32 max_pd;
0665
0666
0667 u32 max_ah;
0668
0669
0670 u32 max_llq_size;
0671
0672
0673 u16 max_wr_rdma_sges;
0674
0675
0676
0677
0678
0679
0680
0681
0682
0683
0684 u16 max_tx_batch;
0685 };
0686
0687 struct efa_admin_event_queue_attr_desc {
0688
0689 u32 max_eq;
0690
0691
0692 u32 max_eq_depth;
0693
0694
0695 u32 event_bitmask;
0696 };
0697
0698 struct efa_admin_feature_aenq_desc {
0699
0700 u32 supported_groups;
0701
0702
0703 u32 enabled_groups;
0704 };
0705
0706 struct efa_admin_feature_network_attr_desc {
0707
0708 u8 addr[16];
0709
0710
0711 u32 mtu;
0712 };
0713
0714
0715
0716
0717
0718 struct efa_admin_hw_hints {
0719
0720 u16 mmio_read_timeout;
0721
0722
0723 u16 driver_watchdog_timeout;
0724
0725
0726 u16 admin_completion_timeout;
0727
0728
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
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
0793 u16 pd;
0794
0795
0796 u16 reserved;
0797 };
0798
0799 struct efa_admin_dealloc_pd_cmd {
0800 struct efa_admin_aq_common_desc aq_common_descriptor;
0801
0802
0803 u16 pd;
0804
0805
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
0821 u16 uar;
0822
0823
0824 u16 reserved;
0825 };
0826
0827 struct efa_admin_dealloc_uar_cmd {
0828 struct efa_admin_aq_common_desc aq_common_descriptor;
0829
0830
0831 u16 uar;
0832
0833
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
0845 u16 depth;
0846
0847
0848 u8 msix_vec;
0849
0850
0851
0852
0853
0854
0855 u8 caps;
0856
0857
0858 struct efa_common_mem_addr ba;
0859
0860
0861
0862
0863
0864
0865 u32 event_bitmask;
0866
0867
0868 u32 reserved;
0869 };
0870
0871 struct efa_admin_create_eq_resp {
0872 struct efa_admin_acq_common_desc acq_common_desc;
0873
0874
0875 u16 eqn;
0876
0877
0878 u16 reserved;
0879 };
0880
0881 struct efa_admin_destroy_eq_cmd {
0882 struct efa_admin_aq_common_desc aq_common_descriptor;
0883
0884
0885 u16 eqn;
0886
0887
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
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
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
0919 u8 os_dist_str[128];
0920
0921
0922 u32 os_type;
0923
0924
0925 u8 kernel_ver_str[32];
0926
0927
0928 u32 kernel_ver;
0929
0930
0931
0932
0933
0934
0935
0936 u32 driver_ver;
0937
0938
0939
0940
0941
0942
0943
0944 u16 bdf;
0945
0946
0947
0948
0949
0950
0951 u16 spec_ver;
0952
0953
0954
0955
0956
0957
0958 u32 flags;
0959 };
0960
0961
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
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
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
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
0985 #define EFA_ADMIN_CREATE_CQ_RESP_DB_VALID_MASK BIT(0)
0986
0987
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
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
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