1
2
3
4
5
6#ifndef _EFA_ADMIN_CMDS_H_
7#define _EFA_ADMIN_CMDS_H_
8
9#define EFA_ADMIN_API_VERSION_MAJOR 0
10#define EFA_ADMIN_API_VERSION_MINOR 1
11
12
13enum efa_admin_aq_opcode {
14 EFA_ADMIN_CREATE_QP = 1,
15 EFA_ADMIN_MODIFY_QP = 2,
16 EFA_ADMIN_QUERY_QP = 3,
17 EFA_ADMIN_DESTROY_QP = 4,
18 EFA_ADMIN_CREATE_AH = 5,
19 EFA_ADMIN_DESTROY_AH = 6,
20 EFA_ADMIN_REG_MR = 7,
21 EFA_ADMIN_DEREG_MR = 8,
22 EFA_ADMIN_CREATE_CQ = 9,
23 EFA_ADMIN_DESTROY_CQ = 10,
24 EFA_ADMIN_GET_FEATURE = 11,
25 EFA_ADMIN_SET_FEATURE = 12,
26 EFA_ADMIN_GET_STATS = 13,
27 EFA_ADMIN_ALLOC_PD = 14,
28 EFA_ADMIN_DEALLOC_PD = 15,
29 EFA_ADMIN_ALLOC_UAR = 16,
30 EFA_ADMIN_DEALLOC_UAR = 17,
31 EFA_ADMIN_MAX_OPCODE = 17,
32};
33
34enum efa_admin_aq_feature_id {
35 EFA_ADMIN_DEVICE_ATTR = 1,
36 EFA_ADMIN_AENQ_CONFIG = 2,
37 EFA_ADMIN_NETWORK_ATTR = 3,
38 EFA_ADMIN_QUEUE_ATTR = 4,
39 EFA_ADMIN_HW_HINTS = 5,
40 EFA_ADMIN_HOST_INFO = 6,
41};
42
43
44enum efa_admin_qp_type {
45
46 EFA_ADMIN_QP_TYPE_UD = 1,
47
48 EFA_ADMIN_QP_TYPE_SRD = 2,
49};
50
51
52enum efa_admin_qp_state {
53 EFA_ADMIN_QP_STATE_RESET = 0,
54 EFA_ADMIN_QP_STATE_INIT = 1,
55 EFA_ADMIN_QP_STATE_RTR = 2,
56 EFA_ADMIN_QP_STATE_RTS = 3,
57 EFA_ADMIN_QP_STATE_SQD = 4,
58 EFA_ADMIN_QP_STATE_SQE = 5,
59 EFA_ADMIN_QP_STATE_ERR = 6,
60};
61
62enum efa_admin_get_stats_type {
63 EFA_ADMIN_GET_STATS_TYPE_BASIC = 0,
64 EFA_ADMIN_GET_STATS_TYPE_MESSAGES = 1,
65 EFA_ADMIN_GET_STATS_TYPE_RDMA_READ = 2,
66};
67
68enum efa_admin_get_stats_scope {
69 EFA_ADMIN_GET_STATS_SCOPE_ALL = 0,
70 EFA_ADMIN_GET_STATS_SCOPE_QUEUE = 1,
71};
72
73
74
75
76
77struct efa_admin_qp_alloc_size {
78
79 u32 send_queue_ring_size;
80
81
82 u32 send_queue_depth;
83
84
85
86
87
88 u32 recv_queue_ring_size;
89
90
91 u32 recv_queue_depth;
92};
93
94struct efa_admin_create_qp_cmd {
95
96 struct efa_admin_aq_common_desc aq_common_desc;
97
98
99 u16 pd;
100
101
102 u8 qp_type;
103
104
105
106
107
108
109
110
111 u8 flags;
112
113
114
115
116
117 u64 sq_base_addr;
118
119
120 u64 rq_base_addr;
121
122
123 u32 send_cq_idx;
124
125
126 u32 recv_cq_idx;
127
128
129
130
131
132 u32 sq_l_key;
133
134
135
136
137
138 u32 rq_l_key;
139
140
141 struct efa_admin_qp_alloc_size qp_alloc_size;
142
143
144 u16 uar;
145
146
147 u16 reserved;
148
149
150 u32 reserved2;
151};
152
153struct efa_admin_create_qp_resp {
154
155 struct efa_admin_acq_common_desc acq_common_desc;
156
157
158
159
160
161 u32 qp_handle;
162
163
164
165
166
167 u16 qp_num;
168
169
170 u16 reserved;
171
172
173 u16 send_sub_cq_idx;
174
175
176 u16 recv_sub_cq_idx;
177
178
179 u32 sq_db_offset;
180
181
182 u32 rq_db_offset;
183
184
185
186
187
188 u32 llq_descriptors_offset;
189};
190
191struct efa_admin_modify_qp_cmd {
192
193 struct efa_admin_aq_common_desc aq_common_desc;
194
195
196
197
198
199
200
201
202
203
204
205 u32 modify_mask;
206
207
208 u32 qp_handle;
209
210
211 u32 qp_state;
212
213
214 u32 cur_qp_state;
215
216
217 u32 qkey;
218
219
220 u32 sq_psn;
221
222
223 u8 sq_drained_async_notify;
224
225
226 u8 rnr_retry;
227
228
229 u16 reserved2;
230};
231
232struct efa_admin_modify_qp_resp {
233
234 struct efa_admin_acq_common_desc acq_common_desc;
235};
236
237struct efa_admin_query_qp_cmd {
238
239 struct efa_admin_aq_common_desc aq_common_desc;
240
241
242 u32 qp_handle;
243};
244
245struct efa_admin_query_qp_resp {
246
247 struct efa_admin_acq_common_desc acq_common_desc;
248
249
250 u32 qp_state;
251
252
253 u32 qkey;
254
255
256 u32 sq_psn;
257
258
259 u8 sq_draining;
260
261
262 u8 rnr_retry;
263
264
265 u16 reserved2;
266};
267
268struct efa_admin_destroy_qp_cmd {
269
270 struct efa_admin_aq_common_desc aq_common_desc;
271
272
273 u32 qp_handle;
274};
275
276struct efa_admin_destroy_qp_resp {
277
278 struct efa_admin_acq_common_desc acq_common_desc;
279};
280
281
282
283
284
285struct efa_admin_create_ah_cmd {
286
287 struct efa_admin_aq_common_desc aq_common_desc;
288
289
290 u8 dest_addr[16];
291
292
293 u16 pd;
294
295
296 u16 reserved;
297};
298
299struct efa_admin_create_ah_resp {
300
301 struct efa_admin_acq_common_desc acq_common_desc;
302
303
304 u16 ah;
305
306
307 u16 reserved;
308};
309
310struct efa_admin_destroy_ah_cmd {
311
312 struct efa_admin_aq_common_desc aq_common_desc;
313
314
315 u16 ah;
316
317
318 u16 pd;
319};
320
321struct efa_admin_destroy_ah_resp {
322
323 struct efa_admin_acq_common_desc acq_common_desc;
324};
325
326
327
328
329
330
331
332struct efa_admin_reg_mr_cmd {
333
334 struct efa_admin_aq_common_desc aq_common_desc;
335
336
337 u16 pd;
338
339
340 u16 reserved16_w1;
341
342
343 union {
344
345
346
347
348
349 u64 inline_pbl_array[4];
350
351
352 struct efa_admin_ctrl_buff_info pbl;
353 } pbl;
354
355
356 u64 mr_length;
357
358
359
360
361
362
363
364
365
366
367
368
369 u8 flags;
370
371
372
373
374
375
376
377
378
379
380
381 u8 permissions;
382
383
384 u16 reserved16_w5;
385
386
387 u32 page_num;
388
389
390
391
392
393
394 u64 iova;
395};
396
397struct efa_admin_reg_mr_resp {
398
399 struct efa_admin_acq_common_desc acq_common_desc;
400
401
402
403
404
405 u32 l_key;
406
407
408
409
410
411 u32 r_key;
412};
413
414struct efa_admin_dereg_mr_cmd {
415
416 struct efa_admin_aq_common_desc aq_common_desc;
417
418
419 u32 l_key;
420};
421
422struct efa_admin_dereg_mr_resp {
423
424 struct efa_admin_acq_common_desc acq_common_desc;
425};
426
427struct efa_admin_create_cq_cmd {
428 struct efa_admin_aq_common_desc aq_common_desc;
429
430
431
432
433
434
435
436
437
438
439 u8 cq_caps_1;
440
441
442
443
444
445
446 u8 cq_caps_2;
447
448
449 u16 cq_depth;
450
451
452 u32 msix_vector_idx;
453
454
455
456
457
458 struct efa_common_mem_addr cq_ba;
459
460
461
462
463
464 u32 l_key;
465
466
467
468
469
470 u16 num_sub_cqs;
471
472
473 u16 uar;
474};
475
476struct efa_admin_create_cq_resp {
477 struct efa_admin_acq_common_desc acq_common_desc;
478
479 u16 cq_idx;
480
481
482 u16 cq_actual_depth;
483};
484
485struct efa_admin_destroy_cq_cmd {
486 struct efa_admin_aq_common_desc aq_common_desc;
487
488 u16 cq_idx;
489
490
491 u16 reserved1;
492};
493
494struct efa_admin_destroy_cq_resp {
495 struct efa_admin_acq_common_desc acq_common_desc;
496};
497
498
499
500
501
502struct efa_admin_aq_get_stats_cmd {
503 struct efa_admin_aq_common_desc aq_common_descriptor;
504
505 union {
506
507 u32 inline_data_w1[3];
508
509 struct efa_admin_ctrl_buff_info control_buffer;
510 } u;
511
512
513 u8 type;
514
515
516 u8 scope;
517
518 u16 scope_modifier;
519};
520
521struct efa_admin_basic_stats {
522 u64 tx_bytes;
523
524 u64 tx_pkts;
525
526 u64 rx_bytes;
527
528 u64 rx_pkts;
529
530 u64 rx_drops;
531};
532
533struct efa_admin_messages_stats {
534 u64 send_bytes;
535
536 u64 send_wrs;
537
538 u64 recv_bytes;
539
540 u64 recv_wrs;
541};
542
543struct efa_admin_rdma_read_stats {
544 u64 read_wrs;
545
546 u64 read_bytes;
547
548 u64 read_wr_err;
549
550 u64 read_resp_bytes;
551};
552
553struct efa_admin_acq_get_stats_resp {
554 struct efa_admin_acq_common_desc acq_common_desc;
555
556 union {
557 struct efa_admin_basic_stats basic_stats;
558
559 struct efa_admin_messages_stats messages_stats;
560
561 struct efa_admin_rdma_read_stats rdma_read_stats;
562 } u;
563};
564
565struct efa_admin_get_set_feature_common_desc {
566
567 u8 reserved0;
568
569
570 u8 feature_id;
571
572
573 u16 reserved16;
574};
575
576struct efa_admin_feature_device_attr_desc {
577
578 u64 supported_features;
579
580
581 u64 page_size_cap;
582
583 u32 fw_version;
584
585 u32 admin_api_version;
586
587 u32 device_version;
588
589
590 u16 db_bar;
591
592
593 u8 phys_addr_width;
594
595
596 u8 virt_addr_width;
597
598
599
600
601
602
603
604
605 u32 device_caps;
606
607
608 u32 max_rdma_size;
609};
610
611struct efa_admin_feature_queue_attr_desc {
612
613 u32 max_qp;
614
615
616 u32 max_sq_depth;
617
618
619 u32 inline_buf_size;
620
621
622 u32 max_rq_depth;
623
624
625 u32 max_cq;
626
627
628 u32 max_cq_depth;
629
630
631 u16 sub_cqs_per_cq;
632
633
634 u16 min_sq_depth;
635
636
637 u16 max_wr_send_sges;
638
639
640 u16 max_wr_recv_sges;
641
642
643 u32 max_mr;
644
645
646 u32 max_mr_pages;
647
648
649 u32 max_pd;
650
651
652 u32 max_ah;
653
654
655 u32 max_llq_size;
656
657
658 u16 max_wr_rdma_sges;
659
660
661
662
663
664
665
666
667
668
669 u16 max_tx_batch;
670};
671
672struct efa_admin_feature_aenq_desc {
673
674 u32 supported_groups;
675
676
677 u32 enabled_groups;
678};
679
680struct efa_admin_feature_network_attr_desc {
681
682 u8 addr[16];
683
684
685 u32 mtu;
686};
687
688
689
690
691
692struct efa_admin_hw_hints {
693
694 u16 mmio_read_timeout;
695
696
697 u16 driver_watchdog_timeout;
698
699
700 u16 admin_completion_timeout;
701
702
703 u16 poll_interval;
704};
705
706struct efa_admin_get_feature_cmd {
707 struct efa_admin_aq_common_desc aq_common_descriptor;
708
709 struct efa_admin_ctrl_buff_info control_buffer;
710
711 struct efa_admin_get_set_feature_common_desc feature_common;
712
713 u32 raw[11];
714};
715
716struct efa_admin_get_feature_resp {
717 struct efa_admin_acq_common_desc acq_common_desc;
718
719 union {
720 u32 raw[14];
721
722 struct efa_admin_feature_device_attr_desc device_attr;
723
724 struct efa_admin_feature_aenq_desc aenq;
725
726 struct efa_admin_feature_network_attr_desc network_attr;
727
728 struct efa_admin_feature_queue_attr_desc queue_attr;
729
730 struct efa_admin_hw_hints hw_hints;
731 } u;
732};
733
734struct efa_admin_set_feature_cmd {
735 struct efa_admin_aq_common_desc aq_common_descriptor;
736
737 struct efa_admin_ctrl_buff_info control_buffer;
738
739 struct efa_admin_get_set_feature_common_desc feature_common;
740
741 union {
742 u32 raw[11];
743
744
745 struct efa_admin_feature_aenq_desc aenq;
746 } u;
747};
748
749struct efa_admin_set_feature_resp {
750 struct efa_admin_acq_common_desc acq_common_desc;
751
752 union {
753 u32 raw[14];
754 } u;
755};
756
757struct efa_admin_alloc_pd_cmd {
758 struct efa_admin_aq_common_desc aq_common_descriptor;
759};
760
761struct efa_admin_alloc_pd_resp {
762 struct efa_admin_acq_common_desc acq_common_desc;
763
764
765 u16 pd;
766
767
768 u16 reserved;
769};
770
771struct efa_admin_dealloc_pd_cmd {
772 struct efa_admin_aq_common_desc aq_common_descriptor;
773
774
775 u16 pd;
776
777
778 u16 reserved;
779};
780
781struct efa_admin_dealloc_pd_resp {
782 struct efa_admin_acq_common_desc acq_common_desc;
783};
784
785struct efa_admin_alloc_uar_cmd {
786 struct efa_admin_aq_common_desc aq_common_descriptor;
787};
788
789struct efa_admin_alloc_uar_resp {
790 struct efa_admin_acq_common_desc acq_common_desc;
791
792
793 u16 uar;
794
795
796 u16 reserved;
797};
798
799struct efa_admin_dealloc_uar_cmd {
800 struct efa_admin_aq_common_desc aq_common_descriptor;
801
802
803 u16 uar;
804
805
806 u16 reserved;
807};
808
809struct efa_admin_dealloc_uar_resp {
810 struct efa_admin_acq_common_desc acq_common_desc;
811};
812
813
814enum efa_admin_aenq_group {
815 EFA_ADMIN_FATAL_ERROR = 1,
816 EFA_ADMIN_WARNING = 2,
817 EFA_ADMIN_NOTIFICATION = 3,
818 EFA_ADMIN_KEEP_ALIVE = 4,
819 EFA_ADMIN_AENQ_GROUPS_NUM = 5,
820};
821
822struct efa_admin_mmio_req_read_less_resp {
823 u16 req_id;
824
825 u16 reg_off;
826
827
828 u32 reg_val;
829};
830
831enum efa_admin_os_type {
832 EFA_ADMIN_OS_LINUX = 0,
833};
834
835struct efa_admin_host_info {
836
837 u8 os_dist_str[128];
838
839
840 u32 os_type;
841
842
843 u8 kernel_ver_str[32];
844
845
846 u32 kernel_ver;
847
848
849
850
851
852
853
854 u32 driver_ver;
855
856
857
858
859
860
861
862 u16 bdf;
863
864
865
866
867
868
869 u16 spec_ver;
870
871
872
873
874
875
876 u32 flags;
877};
878
879
880#define EFA_ADMIN_CREATE_QP_CMD_SQ_VIRT_MASK BIT(0)
881#define EFA_ADMIN_CREATE_QP_CMD_RQ_VIRT_MASK BIT(1)
882
883
884#define EFA_ADMIN_MODIFY_QP_CMD_QP_STATE_MASK BIT(0)
885#define EFA_ADMIN_MODIFY_QP_CMD_CUR_QP_STATE_MASK BIT(1)
886#define EFA_ADMIN_MODIFY_QP_CMD_QKEY_MASK BIT(2)
887#define EFA_ADMIN_MODIFY_QP_CMD_SQ_PSN_MASK BIT(3)
888#define EFA_ADMIN_MODIFY_QP_CMD_SQ_DRAINED_ASYNC_NOTIFY_MASK BIT(4)
889#define EFA_ADMIN_MODIFY_QP_CMD_RNR_RETRY_MASK BIT(5)
890
891
892#define EFA_ADMIN_REG_MR_CMD_PHYS_PAGE_SIZE_SHIFT_MASK GENMASK(4, 0)
893#define EFA_ADMIN_REG_MR_CMD_MEM_ADDR_PHY_MODE_EN_MASK BIT(7)
894#define EFA_ADMIN_REG_MR_CMD_LOCAL_WRITE_ENABLE_MASK BIT(0)
895#define EFA_ADMIN_REG_MR_CMD_REMOTE_READ_ENABLE_MASK BIT(2)
896
897
898#define EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
899#define EFA_ADMIN_CREATE_CQ_CMD_VIRT_MASK BIT(6)
900#define EFA_ADMIN_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK GENMASK(4, 0)
901
902
903#define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RDMA_READ_MASK BIT(0)
904#define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RNR_RETRY_MASK BIT(1)
905
906
907#define EFA_ADMIN_HOST_INFO_DRIVER_MODULE_TYPE_MASK GENMASK(7, 0)
908#define EFA_ADMIN_HOST_INFO_DRIVER_SUB_MINOR_MASK GENMASK(15, 8)
909#define EFA_ADMIN_HOST_INFO_DRIVER_MINOR_MASK GENMASK(23, 16)
910#define EFA_ADMIN_HOST_INFO_DRIVER_MAJOR_MASK GENMASK(31, 24)
911#define EFA_ADMIN_HOST_INFO_FUNCTION_MASK GENMASK(2, 0)
912#define EFA_ADMIN_HOST_INFO_DEVICE_MASK GENMASK(7, 3)
913#define EFA_ADMIN_HOST_INFO_BUS_MASK GENMASK(15, 8)
914#define EFA_ADMIN_HOST_INFO_SPEC_MINOR_MASK GENMASK(7, 0)
915#define EFA_ADMIN_HOST_INFO_SPEC_MAJOR_MASK GENMASK(15, 8)
916#define EFA_ADMIN_HOST_INFO_INTREE_MASK BIT(0)
917#define EFA_ADMIN_HOST_INFO_GDR_MASK BIT(1)
918
919#endif
920