This source file includes following definitions.
- mlxsw_cmd_mbox_alloc
- mlxsw_cmd_mbox_free
- mlxsw_cmd_mbox_zero
- mlxsw_cmd_exec_in
- mlxsw_cmd_exec_out
- mlxsw_cmd_exec_none
- mlxsw_cmd_opcode_str
- mlxsw_cmd_status_str
- mlxsw_cmd_query_fw
- mlxsw_cmd_boardinfo
- mlxsw_cmd_query_aq_cap
- mlxsw_cmd_map_fa
- mlxsw_cmd_unmap_fa
- mlxsw_cmd_query_resources
- mlxsw_cmd_config_profile_set
- mlxsw_cmd_access_reg
- __mlxsw_cmd_sw2hw_dq
- mlxsw_cmd_sw2hw_sdq
- mlxsw_cmd_sw2hw_rdq
- __mlxsw_cmd_hw2sw_dq
- mlxsw_cmd_hw2sw_sdq
- mlxsw_cmd_hw2sw_rdq
- __mlxsw_cmd_2err_dq
- mlxsw_cmd_2err_sdq
- mlxsw_cmd_2err_rdq
- __mlxsw_cmd_query_dq
- mlxsw_cmd_query_sdq
- mlxsw_cmd_query_rdq
- mlxsw_cmd_sw2hw_cq
- mlxsw_cmd_hw2sw_cq
- mlxsw_cmd_query_cq
- mlxsw_cmd_sw2hw_eq
- mlxsw_cmd_hw2sw_eq
- mlxsw_cmd_query_eq
1
2
3
4 #ifndef _MLXSW_CMD_H
5 #define _MLXSW_CMD_H
6
7 #include "item.h"
8
9 #define MLXSW_CMD_MBOX_SIZE 4096
10
11 static inline char *mlxsw_cmd_mbox_alloc(void)
12 {
13 return kzalloc(MLXSW_CMD_MBOX_SIZE, GFP_KERNEL);
14 }
15
16 static inline void mlxsw_cmd_mbox_free(char *mbox)
17 {
18 kfree(mbox);
19 }
20
21 static inline void mlxsw_cmd_mbox_zero(char *mbox)
22 {
23 memset(mbox, 0, MLXSW_CMD_MBOX_SIZE);
24 }
25
26 struct mlxsw_core;
27
28 int mlxsw_cmd_exec(struct mlxsw_core *mlxsw_core, u16 opcode, u8 opcode_mod,
29 u32 in_mod, bool out_mbox_direct, bool reset_ok,
30 char *in_mbox, size_t in_mbox_size,
31 char *out_mbox, size_t out_mbox_size);
32
33 static inline int mlxsw_cmd_exec_in(struct mlxsw_core *mlxsw_core, u16 opcode,
34 u8 opcode_mod, u32 in_mod, char *in_mbox,
35 size_t in_mbox_size)
36 {
37 return mlxsw_cmd_exec(mlxsw_core, opcode, opcode_mod, in_mod, false,
38 false, in_mbox, in_mbox_size, NULL, 0);
39 }
40
41 static inline int mlxsw_cmd_exec_out(struct mlxsw_core *mlxsw_core, u16 opcode,
42 u8 opcode_mod, u32 in_mod,
43 bool out_mbox_direct,
44 char *out_mbox, size_t out_mbox_size)
45 {
46 return mlxsw_cmd_exec(mlxsw_core, opcode, opcode_mod, in_mod,
47 out_mbox_direct, false, NULL, 0,
48 out_mbox, out_mbox_size);
49 }
50
51 static inline int mlxsw_cmd_exec_none(struct mlxsw_core *mlxsw_core, u16 opcode,
52 u8 opcode_mod, u32 in_mod)
53 {
54 return mlxsw_cmd_exec(mlxsw_core, opcode, opcode_mod, in_mod, false,
55 false, NULL, 0, NULL, 0);
56 }
57
58 enum mlxsw_cmd_opcode {
59 MLXSW_CMD_OPCODE_QUERY_FW = 0x004,
60 MLXSW_CMD_OPCODE_QUERY_BOARDINFO = 0x006,
61 MLXSW_CMD_OPCODE_QUERY_AQ_CAP = 0x003,
62 MLXSW_CMD_OPCODE_MAP_FA = 0xFFF,
63 MLXSW_CMD_OPCODE_UNMAP_FA = 0xFFE,
64 MLXSW_CMD_OPCODE_CONFIG_PROFILE = 0x100,
65 MLXSW_CMD_OPCODE_ACCESS_REG = 0x040,
66 MLXSW_CMD_OPCODE_SW2HW_DQ = 0x201,
67 MLXSW_CMD_OPCODE_HW2SW_DQ = 0x202,
68 MLXSW_CMD_OPCODE_2ERR_DQ = 0x01E,
69 MLXSW_CMD_OPCODE_QUERY_DQ = 0x022,
70 MLXSW_CMD_OPCODE_SW2HW_CQ = 0x016,
71 MLXSW_CMD_OPCODE_HW2SW_CQ = 0x017,
72 MLXSW_CMD_OPCODE_QUERY_CQ = 0x018,
73 MLXSW_CMD_OPCODE_SW2HW_EQ = 0x013,
74 MLXSW_CMD_OPCODE_HW2SW_EQ = 0x014,
75 MLXSW_CMD_OPCODE_QUERY_EQ = 0x015,
76 MLXSW_CMD_OPCODE_QUERY_RESOURCES = 0x101,
77 };
78
79 static inline const char *mlxsw_cmd_opcode_str(u16 opcode)
80 {
81 switch (opcode) {
82 case MLXSW_CMD_OPCODE_QUERY_FW:
83 return "QUERY_FW";
84 case MLXSW_CMD_OPCODE_QUERY_BOARDINFO:
85 return "QUERY_BOARDINFO";
86 case MLXSW_CMD_OPCODE_QUERY_AQ_CAP:
87 return "QUERY_AQ_CAP";
88 case MLXSW_CMD_OPCODE_MAP_FA:
89 return "MAP_FA";
90 case MLXSW_CMD_OPCODE_UNMAP_FA:
91 return "UNMAP_FA";
92 case MLXSW_CMD_OPCODE_CONFIG_PROFILE:
93 return "CONFIG_PROFILE";
94 case MLXSW_CMD_OPCODE_ACCESS_REG:
95 return "ACCESS_REG";
96 case MLXSW_CMD_OPCODE_SW2HW_DQ:
97 return "SW2HW_DQ";
98 case MLXSW_CMD_OPCODE_HW2SW_DQ:
99 return "HW2SW_DQ";
100 case MLXSW_CMD_OPCODE_2ERR_DQ:
101 return "2ERR_DQ";
102 case MLXSW_CMD_OPCODE_QUERY_DQ:
103 return "QUERY_DQ";
104 case MLXSW_CMD_OPCODE_SW2HW_CQ:
105 return "SW2HW_CQ";
106 case MLXSW_CMD_OPCODE_HW2SW_CQ:
107 return "HW2SW_CQ";
108 case MLXSW_CMD_OPCODE_QUERY_CQ:
109 return "QUERY_CQ";
110 case MLXSW_CMD_OPCODE_SW2HW_EQ:
111 return "SW2HW_EQ";
112 case MLXSW_CMD_OPCODE_HW2SW_EQ:
113 return "HW2SW_EQ";
114 case MLXSW_CMD_OPCODE_QUERY_EQ:
115 return "QUERY_EQ";
116 case MLXSW_CMD_OPCODE_QUERY_RESOURCES:
117 return "QUERY_RESOURCES";
118 default:
119 return "*UNKNOWN*";
120 }
121 }
122
123 enum mlxsw_cmd_status {
124
125 MLXSW_CMD_STATUS_OK = 0x00,
126
127 MLXSW_CMD_STATUS_INTERNAL_ERR = 0x01,
128
129 MLXSW_CMD_STATUS_BAD_OP = 0x02,
130
131 MLXSW_CMD_STATUS_BAD_PARAM = 0x03,
132
133 MLXSW_CMD_STATUS_BAD_SYS_STATE = 0x04,
134
135
136
137 MLXSW_CMD_STATUS_BAD_RESOURCE = 0x05,
138
139 MLXSW_CMD_STATUS_RESOURCE_BUSY = 0x06,
140
141 MLXSW_CMD_STATUS_EXCEED_LIM = 0x08,
142
143 MLXSW_CMD_STATUS_BAD_RES_STATE = 0x09,
144
145
146
147 MLXSW_CMD_STATUS_BAD_INDEX = 0x0A,
148
149 MLXSW_CMD_STATUS_BAD_NVMEM = 0x0B,
150
151 MLXSW_CMD_STATUS_RUNNING_RESET = 0x26,
152
153 MLXSW_CMD_STATUS_BAD_PKT = 0x30,
154 };
155
156 static inline const char *mlxsw_cmd_status_str(u8 status)
157 {
158 switch (status) {
159 case MLXSW_CMD_STATUS_OK:
160 return "OK";
161 case MLXSW_CMD_STATUS_INTERNAL_ERR:
162 return "INTERNAL_ERR";
163 case MLXSW_CMD_STATUS_BAD_OP:
164 return "BAD_OP";
165 case MLXSW_CMD_STATUS_BAD_PARAM:
166 return "BAD_PARAM";
167 case MLXSW_CMD_STATUS_BAD_SYS_STATE:
168 return "BAD_SYS_STATE";
169 case MLXSW_CMD_STATUS_BAD_RESOURCE:
170 return "BAD_RESOURCE";
171 case MLXSW_CMD_STATUS_RESOURCE_BUSY:
172 return "RESOURCE_BUSY";
173 case MLXSW_CMD_STATUS_EXCEED_LIM:
174 return "EXCEED_LIM";
175 case MLXSW_CMD_STATUS_BAD_RES_STATE:
176 return "BAD_RES_STATE";
177 case MLXSW_CMD_STATUS_BAD_INDEX:
178 return "BAD_INDEX";
179 case MLXSW_CMD_STATUS_BAD_NVMEM:
180 return "BAD_NVMEM";
181 case MLXSW_CMD_STATUS_RUNNING_RESET:
182 return "RUNNING_RESET";
183 case MLXSW_CMD_STATUS_BAD_PKT:
184 return "BAD_PKT";
185 default:
186 return "*UNKNOWN*";
187 }
188 }
189
190
191
192
193
194
195
196
197
198
199 static inline int mlxsw_cmd_query_fw(struct mlxsw_core *mlxsw_core,
200 char *out_mbox)
201 {
202 return mlxsw_cmd_exec_out(mlxsw_core, MLXSW_CMD_OPCODE_QUERY_FW,
203 0, 0, false, out_mbox, MLXSW_CMD_MBOX_SIZE);
204 }
205
206
207
208
209 MLXSW_ITEM32(cmd_mbox, query_fw, fw_pages, 0x00, 16, 16);
210
211
212
213
214 MLXSW_ITEM32(cmd_mbox, query_fw, fw_rev_major, 0x00, 0, 16);
215
216
217
218
219 MLXSW_ITEM32(cmd_mbox, query_fw, fw_rev_subminor, 0x04, 16, 16);
220
221
222
223
224 MLXSW_ITEM32(cmd_mbox, query_fw, fw_rev_minor, 0x04, 0, 16);
225
226
227
228
229 MLXSW_ITEM32(cmd_mbox, query_fw, core_clk, 0x08, 16, 16);
230
231
232
233
234
235
236 MLXSW_ITEM32(cmd_mbox, query_fw, cmd_interface_rev, 0x08, 0, 16);
237
238
239
240
241 MLXSW_ITEM32(cmd_mbox, query_fw, dt, 0x0C, 31, 1);
242
243
244
245
246
247 MLXSW_ITEM32(cmd_mbox, query_fw, api_version, 0x0C, 0, 16);
248
249
250
251
252 MLXSW_ITEM32(cmd_mbox, query_fw, fw_hour, 0x10, 24, 8);
253
254
255
256
257 MLXSW_ITEM32(cmd_mbox, query_fw, fw_minutes, 0x10, 16, 8);
258
259
260
261
262 MLXSW_ITEM32(cmd_mbox, query_fw, fw_seconds, 0x10, 8, 8);
263
264
265
266
267 MLXSW_ITEM32(cmd_mbox, query_fw, fw_year, 0x14, 16, 16);
268
269
270
271
272 MLXSW_ITEM32(cmd_mbox, query_fw, fw_month, 0x14, 8, 8);
273
274
275
276
277 MLXSW_ITEM32(cmd_mbox, query_fw, fw_day, 0x14, 0, 8);
278
279
280
281
282
283 MLXSW_ITEM64(cmd_mbox, query_fw, clr_int_base_offset, 0x20, 0, 64);
284
285
286
287
288
289 MLXSW_ITEM32(cmd_mbox, query_fw, clr_int_bar, 0x28, 30, 2);
290
291
292
293
294
295 MLXSW_ITEM64(cmd_mbox, query_fw, error_buf_offset, 0x30, 0, 64);
296
297
298
299
300 MLXSW_ITEM32(cmd_mbox, query_fw, error_buf_size, 0x38, 0, 32);
301
302
303
304
305
306
307 MLXSW_ITEM32(cmd_mbox, query_fw, error_int_bar, 0x3C, 30, 2);
308
309
310
311
312 MLXSW_ITEM64(cmd_mbox, query_fw, doorbell_page_offset, 0x40, 0, 64);
313
314
315
316
317
318 MLXSW_ITEM32(cmd_mbox, query_fw, doorbell_page_bar, 0x48, 30, 2);
319
320
321
322
323 MLXSW_ITEM64(cmd_mbox, query_fw, free_running_clock_offset, 0x50, 0, 64);
324
325
326
327
328
329
330 MLXSW_ITEM32(cmd_mbox, query_fw, fr_rn_clk_bar, 0x58, 30, 2);
331
332
333
334
335
336
337
338
339 static inline int mlxsw_cmd_boardinfo(struct mlxsw_core *mlxsw_core,
340 char *out_mbox)
341 {
342 return mlxsw_cmd_exec_out(mlxsw_core, MLXSW_CMD_OPCODE_QUERY_BOARDINFO,
343 0, 0, false, out_mbox, MLXSW_CMD_MBOX_SIZE);
344 }
345
346
347
348
349
350 MLXSW_ITEM32(cmd_mbox, boardinfo, intapin, 0x10, 24, 8);
351
352
353
354
355
356
357
358 MLXSW_ITEM32(cmd_mbox, boardinfo, vsd_vendor_id, 0x1C, 0, 16);
359
360
361
362
363
364 #define MLXSW_CMD_BOARDINFO_VSD_LEN 208
365 MLXSW_ITEM_BUF(cmd_mbox, boardinfo, vsd, 0x20, MLXSW_CMD_BOARDINFO_VSD_LEN);
366
367
368
369
370
371
372 #define MLXSW_CMD_BOARDINFO_PSID_LEN 16
373 MLXSW_ITEM_BUF(cmd_mbox, boardinfo, psid, 0xF0, MLXSW_CMD_BOARDINFO_PSID_LEN);
374
375
376
377
378
379
380
381
382
383 static inline int mlxsw_cmd_query_aq_cap(struct mlxsw_core *mlxsw_core,
384 char *out_mbox)
385 {
386 return mlxsw_cmd_exec_out(mlxsw_core, MLXSW_CMD_OPCODE_QUERY_AQ_CAP,
387 0, 0, false, out_mbox, MLXSW_CMD_MBOX_SIZE);
388 }
389
390
391
392
393 MLXSW_ITEM32(cmd_mbox, query_aq_cap, log_max_sdq_sz, 0x00, 24, 8);
394
395
396
397
398 MLXSW_ITEM32(cmd_mbox, query_aq_cap, max_num_sdqs, 0x00, 0, 8);
399
400
401
402
403 MLXSW_ITEM32(cmd_mbox, query_aq_cap, log_max_rdq_sz, 0x04, 24, 8);
404
405
406
407
408 MLXSW_ITEM32(cmd_mbox, query_aq_cap, max_num_rdqs, 0x04, 0, 8);
409
410
411
412
413 MLXSW_ITEM32(cmd_mbox, query_aq_cap, log_max_cq_sz, 0x08, 24, 8);
414
415
416
417
418 MLXSW_ITEM32(cmd_mbox, query_aq_cap, log_max_cqv2_sz, 0x08, 16, 8);
419
420
421
422
423 MLXSW_ITEM32(cmd_mbox, query_aq_cap, max_num_cqs, 0x08, 0, 8);
424
425
426
427
428 MLXSW_ITEM32(cmd_mbox, query_aq_cap, log_max_eq_sz, 0x0C, 24, 8);
429
430
431
432
433 MLXSW_ITEM32(cmd_mbox, query_aq_cap, max_num_eqs, 0x0C, 0, 8);
434
435
436
437
438
439 MLXSW_ITEM32(cmd_mbox, query_aq_cap, max_sg_sq, 0x10, 8, 8);
440
441
442
443
444
445 MLXSW_ITEM32(cmd_mbox, query_aq_cap, max_sg_rq, 0x10, 0, 8);
446
447
448
449
450
451
452
453
454
455
456
457
458
459 #define MLXSW_CMD_MAP_FA_VPM_ENTRIES_MAX 32
460
461 static inline int mlxsw_cmd_map_fa(struct mlxsw_core *mlxsw_core,
462 char *in_mbox, u32 vpm_entries_count)
463 {
464 return mlxsw_cmd_exec_in(mlxsw_core, MLXSW_CMD_OPCODE_MAP_FA,
465 0, vpm_entries_count,
466 in_mbox, MLXSW_CMD_MBOX_SIZE);
467 }
468
469
470
471
472 MLXSW_ITEM64_INDEXED(cmd_mbox, map_fa, pa, 0x00, 12, 52, 0x08, 0x00, true);
473
474
475
476
477
478 MLXSW_ITEM32_INDEXED(cmd_mbox, map_fa, log2size, 0x00, 0, 5, 0x08, 0x04, false);
479
480
481
482
483
484
485
486
487
488
489
490 static inline int mlxsw_cmd_unmap_fa(struct mlxsw_core *mlxsw_core)
491 {
492 return mlxsw_cmd_exec_none(mlxsw_core, MLXSW_CMD_OPCODE_UNMAP_FA, 0, 0);
493 }
494
495
496
497
498
499
500
501
502
503
504
505
506 #define MLXSW_CMD_QUERY_RESOURCES_TABLE_END_ID 0xffff
507 #define MLXSW_CMD_QUERY_RESOURCES_MAX_QUERIES 100
508 #define MLXSW_CMD_QUERY_RESOURCES_PER_QUERY 32
509
510 static inline int mlxsw_cmd_query_resources(struct mlxsw_core *mlxsw_core,
511 char *out_mbox, int index)
512 {
513 return mlxsw_cmd_exec_out(mlxsw_core, MLXSW_CMD_OPCODE_QUERY_RESOURCES,
514 0, index, false, out_mbox,
515 MLXSW_CMD_MBOX_SIZE);
516 }
517
518
519
520
521 MLXSW_ITEM32_INDEXED(cmd_mbox, query_resource, id, 0x00, 16, 16, 0x8, 0, false);
522
523
524
525
526 MLXSW_ITEM64_INDEXED(cmd_mbox, query_resource, data,
527 0x00, 0, 40, 0x8, 0, false);
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544 static inline int mlxsw_cmd_config_profile_set(struct mlxsw_core *mlxsw_core,
545 char *in_mbox)
546 {
547 return mlxsw_cmd_exec_in(mlxsw_core, MLXSW_CMD_OPCODE_CONFIG_PROFILE,
548 1, 0, in_mbox, MLXSW_CMD_MBOX_SIZE);
549 }
550
551
552
553
554
555 MLXSW_ITEM32(cmd_mbox, config_profile, set_max_vepa_channels, 0x0C, 0, 1);
556
557
558
559
560
561 MLXSW_ITEM32(cmd_mbox, config_profile, set_max_lag, 0x0C, 1, 1);
562
563
564
565
566
567 MLXSW_ITEM32(cmd_mbox, config_profile, set_max_port_per_lag, 0x0C, 2, 1);
568
569
570
571
572
573 MLXSW_ITEM32(cmd_mbox, config_profile, set_max_mid, 0x0C, 3, 1);
574
575
576
577
578
579 MLXSW_ITEM32(cmd_mbox, config_profile, set_max_pgt, 0x0C, 4, 1);
580
581
582
583
584
585 MLXSW_ITEM32(cmd_mbox, config_profile, set_max_system_port, 0x0C, 5, 1);
586
587
588
589
590
591 MLXSW_ITEM32(cmd_mbox, config_profile, set_max_vlan_groups, 0x0C, 6, 1);
592
593
594
595
596
597 MLXSW_ITEM32(cmd_mbox, config_profile, set_max_regions, 0x0C, 7, 1);
598
599
600
601
602
603 MLXSW_ITEM32(cmd_mbox, config_profile, set_flood_mode, 0x0C, 8, 1);
604
605
606
607
608
609 MLXSW_ITEM32(cmd_mbox, config_profile, set_flood_tables, 0x0C, 9, 1);
610
611
612
613
614
615 MLXSW_ITEM32(cmd_mbox, config_profile, set_max_ib_mc, 0x0C, 12, 1);
616
617
618
619
620
621 MLXSW_ITEM32(cmd_mbox, config_profile, set_max_pkey, 0x0C, 13, 1);
622
623
624
625
626
627 MLXSW_ITEM32(cmd_mbox, config_profile,
628 set_adaptive_routing_group_cap, 0x0C, 14, 1);
629
630
631
632
633
634 MLXSW_ITEM32(cmd_mbox, config_profile, set_ar_sec, 0x0C, 15, 1);
635
636
637
638
639
640 MLXSW_ITEM32(cmd_mbox, config_profile, set_kvd_linear_size, 0x0C, 24, 1);
641
642
643
644
645
646 MLXSW_ITEM32(cmd_mbox, config_profile, set_kvd_hash_single_size, 0x0C, 25, 1);
647
648
649
650
651
652 MLXSW_ITEM32(cmd_mbox, config_profile, set_kvd_hash_double_size, 0x0C, 26, 1);
653
654
655
656
657
658 MLXSW_ITEM32(cmd_mbox, config_profile, set_cqe_version, 0x08, 0, 1);
659
660
661
662
663
664 MLXSW_ITEM32(cmd_mbox, config_profile, max_vepa_channels, 0x10, 0, 8);
665
666
667
668
669 MLXSW_ITEM32(cmd_mbox, config_profile, max_lag, 0x14, 0, 16);
670
671
672
673
674 MLXSW_ITEM32(cmd_mbox, config_profile, max_port_per_lag, 0x18, 0, 16);
675
676
677
678
679
680 MLXSW_ITEM32(cmd_mbox, config_profile, max_mid, 0x1C, 0, 16);
681
682
683
684
685
686 MLXSW_ITEM32(cmd_mbox, config_profile, max_pgt, 0x20, 0, 16);
687
688
689
690
691 MLXSW_ITEM32(cmd_mbox, config_profile, max_system_port, 0x24, 0, 16);
692
693
694
695
696 MLXSW_ITEM32(cmd_mbox, config_profile, max_vlan_groups, 0x28, 0, 12);
697
698
699
700
701 MLXSW_ITEM32(cmd_mbox, config_profile, max_regions, 0x2C, 0, 16);
702
703
704
705
706
707 MLXSW_ITEM32(cmd_mbox, config_profile, max_flood_tables, 0x30, 16, 4);
708
709
710
711
712
713
714 MLXSW_ITEM32(cmd_mbox, config_profile, max_vid_flood_tables, 0x30, 8, 4);
715
716
717
718
719
720
721
722
723
724
725 MLXSW_ITEM32(cmd_mbox, config_profile, flood_mode, 0x30, 0, 2);
726
727
728
729
730 MLXSW_ITEM32(cmd_mbox, config_profile,
731 max_fid_offset_flood_tables, 0x34, 24, 4);
732
733
734
735
736 MLXSW_ITEM32(cmd_mbox, config_profile,
737 fid_offset_flood_table_size, 0x34, 0, 16);
738
739
740
741
742
743
744
745 MLXSW_ITEM32(cmd_mbox, config_profile, max_fid_flood_tables, 0x38, 24, 4);
746
747
748
749
750 MLXSW_ITEM32(cmd_mbox, config_profile, fid_flood_table_size, 0x38, 0, 16);
751
752
753
754
755
756 MLXSW_ITEM32(cmd_mbox, config_profile, max_ib_mc, 0x40, 0, 15);
757
758
759
760
761 MLXSW_ITEM32(cmd_mbox, config_profile, max_pkey, 0x44, 0, 15);
762
763
764
765
766
767
768
769
770
771 MLXSW_ITEM32(cmd_mbox, config_profile, ar_sec, 0x4C, 24, 2);
772
773
774
775
776
777
778 MLXSW_ITEM32(cmd_mbox, config_profile, adaptive_routing_group_cap, 0x4C, 0, 16);
779
780
781
782
783
784 MLXSW_ITEM32(cmd_mbox, config_profile, arn, 0x50, 31, 1);
785
786
787
788
789
790
791 MLXSW_ITEM32(cmd_mbox, config_profile, kvd_linear_size, 0x54, 0, 24);
792
793
794
795
796
797
798
799
800 MLXSW_ITEM32(cmd_mbox, config_profile, kvd_hash_single_size, 0x58, 0, 24);
801
802
803
804
805
806
807
808
809 MLXSW_ITEM32(cmd_mbox, config_profile, kvd_hash_double_size, 0x5C, 0, 24);
810
811
812
813
814
815
816
817
818
819 MLXSW_ITEM32_INDEXED(cmd_mbox, config_profile, swid_config_mask,
820 0x60, 24, 8, 0x08, 0x00, false);
821
822
823
824
825
826
827
828
829
830 MLXSW_ITEM32_INDEXED(cmd_mbox, config_profile, swid_config_type,
831 0x60, 20, 4, 0x08, 0x00, false);
832
833
834
835
836 MLXSW_ITEM32_INDEXED(cmd_mbox, config_profile, swid_config_properties,
837 0x60, 0, 8, 0x08, 0x00, false);
838
839
840
841
842
843
844
845 MLXSW_ITEM32(cmd_mbox, config_profile, cqe_version, 0xB0, 0, 8);
846
847
848
849
850
851
852
853
854
855 static inline int mlxsw_cmd_access_reg(struct mlxsw_core *mlxsw_core,
856 bool reset_ok,
857 char *in_mbox, char *out_mbox)
858 {
859 return mlxsw_cmd_exec(mlxsw_core, MLXSW_CMD_OPCODE_ACCESS_REG,
860 0, 0, false, reset_ok,
861 in_mbox, MLXSW_CMD_MBOX_SIZE,
862 out_mbox, MLXSW_CMD_MBOX_SIZE);
863 }
864
865
866
867
868
869
870
871
872
873
874
875 static inline int __mlxsw_cmd_sw2hw_dq(struct mlxsw_core *mlxsw_core,
876 char *in_mbox, u32 dq_number,
877 u8 opcode_mod)
878 {
879 return mlxsw_cmd_exec_in(mlxsw_core, MLXSW_CMD_OPCODE_SW2HW_DQ,
880 opcode_mod, dq_number,
881 in_mbox, MLXSW_CMD_MBOX_SIZE);
882 }
883
884 enum {
885 MLXSW_CMD_OPCODE_MOD_SDQ = 0,
886 MLXSW_CMD_OPCODE_MOD_RDQ = 1,
887 };
888
889 static inline int mlxsw_cmd_sw2hw_sdq(struct mlxsw_core *mlxsw_core,
890 char *in_mbox, u32 dq_number)
891 {
892 return __mlxsw_cmd_sw2hw_dq(mlxsw_core, in_mbox, dq_number,
893 MLXSW_CMD_OPCODE_MOD_SDQ);
894 }
895
896 static inline int mlxsw_cmd_sw2hw_rdq(struct mlxsw_core *mlxsw_core,
897 char *in_mbox, u32 dq_number)
898 {
899 return __mlxsw_cmd_sw2hw_dq(mlxsw_core, in_mbox, dq_number,
900 MLXSW_CMD_OPCODE_MOD_RDQ);
901 }
902
903
904
905
906 MLXSW_ITEM32(cmd_mbox, sw2hw_dq, cq, 0x00, 24, 8);
907
908
909
910
911
912 MLXSW_ITEM32(cmd_mbox, sw2hw_dq, sdq_tclass, 0x00, 16, 6);
913
914
915
916
917 MLXSW_ITEM32(cmd_mbox, sw2hw_dq, log2_dq_sz, 0x00, 0, 6);
918
919
920
921
922 MLXSW_ITEM64_INDEXED(cmd_mbox, sw2hw_dq, pa, 0x10, 12, 52, 0x08, 0x00, true);
923
924
925
926
927
928
929
930
931
932
933
934 static inline int __mlxsw_cmd_hw2sw_dq(struct mlxsw_core *mlxsw_core,
935 u32 dq_number, u8 opcode_mod)
936 {
937 return mlxsw_cmd_exec_none(mlxsw_core, MLXSW_CMD_OPCODE_HW2SW_DQ,
938 opcode_mod, dq_number);
939 }
940
941 static inline int mlxsw_cmd_hw2sw_sdq(struct mlxsw_core *mlxsw_core,
942 u32 dq_number)
943 {
944 return __mlxsw_cmd_hw2sw_dq(mlxsw_core, dq_number,
945 MLXSW_CMD_OPCODE_MOD_SDQ);
946 }
947
948 static inline int mlxsw_cmd_hw2sw_rdq(struct mlxsw_core *mlxsw_core,
949 u32 dq_number)
950 {
951 return __mlxsw_cmd_hw2sw_dq(mlxsw_core, dq_number,
952 MLXSW_CMD_OPCODE_MOD_RDQ);
953 }
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969 static inline int __mlxsw_cmd_2err_dq(struct mlxsw_core *mlxsw_core,
970 u32 dq_number, u8 opcode_mod)
971 {
972 return mlxsw_cmd_exec_none(mlxsw_core, MLXSW_CMD_OPCODE_2ERR_DQ,
973 opcode_mod, dq_number);
974 }
975
976 static inline int mlxsw_cmd_2err_sdq(struct mlxsw_core *mlxsw_core,
977 u32 dq_number)
978 {
979 return __mlxsw_cmd_2err_dq(mlxsw_core, dq_number,
980 MLXSW_CMD_OPCODE_MOD_SDQ);
981 }
982
983 static inline int mlxsw_cmd_2err_rdq(struct mlxsw_core *mlxsw_core,
984 u32 dq_number)
985 {
986 return __mlxsw_cmd_2err_dq(mlxsw_core, dq_number,
987 MLXSW_CMD_OPCODE_MOD_RDQ);
988 }
989
990
991
992
993
994
995
996
997
998
999
1000 static inline int __mlxsw_cmd_query_dq(struct mlxsw_core *mlxsw_core,
1001 char *out_mbox, u32 dq_number,
1002 u8 opcode_mod)
1003 {
1004 return mlxsw_cmd_exec_out(mlxsw_core, MLXSW_CMD_OPCODE_2ERR_DQ,
1005 opcode_mod, dq_number, false,
1006 out_mbox, MLXSW_CMD_MBOX_SIZE);
1007 }
1008
1009 static inline int mlxsw_cmd_query_sdq(struct mlxsw_core *mlxsw_core,
1010 char *out_mbox, u32 dq_number)
1011 {
1012 return __mlxsw_cmd_query_dq(mlxsw_core, out_mbox, dq_number,
1013 MLXSW_CMD_OPCODE_MOD_SDQ);
1014 }
1015
1016 static inline int mlxsw_cmd_query_rdq(struct mlxsw_core *mlxsw_core,
1017 char *out_mbox, u32 dq_number)
1018 {
1019 return __mlxsw_cmd_query_dq(mlxsw_core, out_mbox, dq_number,
1020 MLXSW_CMD_OPCODE_MOD_RDQ);
1021 }
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033 static inline int mlxsw_cmd_sw2hw_cq(struct mlxsw_core *mlxsw_core,
1034 char *in_mbox, u32 cq_number)
1035 {
1036 return mlxsw_cmd_exec_in(mlxsw_core, MLXSW_CMD_OPCODE_SW2HW_CQ,
1037 0, cq_number, in_mbox, MLXSW_CMD_MBOX_SIZE);
1038 }
1039
1040 enum mlxsw_cmd_mbox_sw2hw_cq_cqe_ver {
1041 MLXSW_CMD_MBOX_SW2HW_CQ_CQE_VER_1,
1042 MLXSW_CMD_MBOX_SW2HW_CQ_CQE_VER_2,
1043 };
1044
1045
1046
1047
1048 MLXSW_ITEM32(cmd_mbox, sw2hw_cq, cqe_ver, 0x00, 28, 4);
1049
1050
1051
1052
1053 MLXSW_ITEM32(cmd_mbox, sw2hw_cq, c_eqn, 0x00, 24, 1);
1054
1055
1056
1057
1058
1059
1060 MLXSW_ITEM32(cmd_mbox, sw2hw_cq, st, 0x00, 8, 1);
1061
1062
1063
1064
1065 MLXSW_ITEM32(cmd_mbox, sw2hw_cq, log_cq_size, 0x00, 0, 4);
1066
1067
1068
1069
1070
1071
1072 MLXSW_ITEM32(cmd_mbox, sw2hw_cq, producer_counter, 0x04, 0, 16);
1073
1074
1075
1076
1077 MLXSW_ITEM64_INDEXED(cmd_mbox, sw2hw_cq, pa, 0x10, 11, 53, 0x08, 0x00, true);
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087 static inline int mlxsw_cmd_hw2sw_cq(struct mlxsw_core *mlxsw_core,
1088 u32 cq_number)
1089 {
1090 return mlxsw_cmd_exec_none(mlxsw_core, MLXSW_CMD_OPCODE_HW2SW_CQ,
1091 0, cq_number);
1092 }
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106 static inline int mlxsw_cmd_query_cq(struct mlxsw_core *mlxsw_core,
1107 char *out_mbox, u32 cq_number)
1108 {
1109 return mlxsw_cmd_exec_out(mlxsw_core, MLXSW_CMD_OPCODE_QUERY_CQ,
1110 0, cq_number, false,
1111 out_mbox, MLXSW_CMD_MBOX_SIZE);
1112 }
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124 static inline int mlxsw_cmd_sw2hw_eq(struct mlxsw_core *mlxsw_core,
1125 char *in_mbox, u32 eq_number)
1126 {
1127 return mlxsw_cmd_exec_in(mlxsw_core, MLXSW_CMD_OPCODE_SW2HW_EQ,
1128 0, eq_number, in_mbox, MLXSW_CMD_MBOX_SIZE);
1129 }
1130
1131
1132
1133
1134
1135 MLXSW_ITEM32(cmd_mbox, sw2hw_eq, int_msix, 0x00, 24, 1);
1136
1137
1138
1139
1140
1141
1142
1143
1144 MLXSW_ITEM32(cmd_mbox, sw2hw_eq, st, 0x00, 8, 2);
1145
1146
1147
1148
1149 MLXSW_ITEM32(cmd_mbox, sw2hw_eq, log_eq_size, 0x00, 0, 4);
1150
1151
1152
1153
1154
1155
1156 MLXSW_ITEM32(cmd_mbox, sw2hw_eq, producer_counter, 0x04, 0, 16);
1157
1158
1159
1160
1161 MLXSW_ITEM64_INDEXED(cmd_mbox, sw2hw_eq, pa, 0x10, 11, 53, 0x08, 0x00, true);
1162
1163
1164
1165
1166
1167
1168
1169 static inline int mlxsw_cmd_hw2sw_eq(struct mlxsw_core *mlxsw_core,
1170 u32 eq_number)
1171 {
1172 return mlxsw_cmd_exec_none(mlxsw_core, MLXSW_CMD_OPCODE_HW2SW_EQ,
1173 0, eq_number);
1174 }
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184 static inline int mlxsw_cmd_query_eq(struct mlxsw_core *mlxsw_core,
1185 char *out_mbox, u32 eq_number)
1186 {
1187 return mlxsw_cmd_exec_out(mlxsw_core, MLXSW_CMD_OPCODE_QUERY_EQ,
1188 0, eq_number, false,
1189 out_mbox, MLXSW_CMD_MBOX_SIZE);
1190 }
1191
1192 #endif