DPDK logo

Elixir Cross Referencer

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(c) 2019-2021 Broadcom
 * All rights reserved.
 */

#ifndef _TF_MSG_H_
#define _TF_MSG_H_

#include <rte_common.h>
#include <hsi_struct_def_dpdk.h>

#include "tf_em_common.h"
#include "tf_tbl.h"
#include "tf_rm.h"
#include "tf_tcam.h"
#include "tf_global_cfg.h"
#include "bnxt.h"

struct tf;

/* HWRM Direct messages */

/**
 * Sends session open request to Firmware
 *
 * [in] bp
 *   Pointer to bnxt handle
 *
 * [in] ctrl_chan_name
 *   PCI name of the control channel
 *
 * [in/out] fw_session_id
 *   Pointer to the fw_session_id that is allocated on firmware side
 *
 * [in/out] fw_session_client_id
 *   Pointer to the fw_session_client_id that is allocated on firmware side
 *
 * [in/out] dev
 *   Pointer to the associated device
 *
 * [out] shared_session_creator
 *   Pointer to the shared_session_creator
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_session_open(struct bnxt *bp,
			char *ctrl_chan_name,
			uint8_t *fw_session_id,
			uint8_t *fw_session_client_id,
			struct tf_dev_info *dev,
			bool *shared_session_creator);

/**
 * Sends session close request to Firmware
 *
 * [in] session
 *   Pointer to session handle
 *
 * [in] ctrl_chan_name
 *   PCI name of the control channel
 *
 * [in] fw_session_id
 *   Pointer to the fw_session_id that is assigned to the session at
 *   time of session open
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_session_attach(struct tf *tfp,
			  char *ctrl_channel_name,
			  uint8_t tf_fw_session_id);

/**
 * Sends session client register request to Firmware
 *
 * [in] session
 *   Pointer to session handle
 *
 * [in] ctrl_chan_name
 *   PCI name of the control channel
 *
 * [in/out] fw_session_client_id
 *   Pointer to the fw_session_client_id that is allocated on firmware
 *   side
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_session_client_register(struct tf *tfp,
				   struct tf_session *tfs,
				   char *ctrl_channel_name,
				   uint8_t *fw_session_client_id);

/**
 * Sends session client unregister request to Firmware
 *
 * [in] session
 *   Pointer to session handle
 *
 * [in/out] fw_session_client_id
 *   Pointer to the fw_session_client_id that is allocated on firmware
 *   side
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_session_client_unregister(struct tf *tfp,
				     struct tf_session *tfs,
				     uint8_t fw_session_client_id);

/**
 * Sends session close request to Firmware
 *
 * [in] session
 *   Pointer to session handle
 *
 * [in] fw_session_id
 *   fw session id
 *
 * [in] mailbox
 *   mailbox
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_session_close(struct tf *tfp,
			 uint8_t fw_session_id,
			 int mailbox);

/**
 * Sends session query config request to TF Firmware
 *
 * [in] session
 *   Pointer to session handle
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_session_qcfg(struct tf *tfp);

/**
 * Sends session HW resource query capability request to TF Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] dir
 *   Receive or Transmit direction
 *
 * [in] size
 *   Number of elements in the query. Should be set to the max
 *   elements for the device type
 *
 * [out] query
 *   Pointer to an array of query elements
 *
 * [out] resv_strategy
 *   Pointer to the reservation strategy
 *
 * [out] sram_profile
 *   Pointer to the sram profile
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_session_resc_qcaps(struct tf *tfp,
			      struct tf_dev_info *dev,
			      enum tf_dir dir,
			      uint16_t size,
			      struct tf_rm_resc_req_entry *query,
			      enum tf_rm_resc_resv_strategy *resv_strategy,
			      uint8_t *sram_profile);

/**
 * Sends session HW resource allocation request to TF Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] dir
 *   Receive or Transmit direction
 *
 * [in] size
 *   Number of elements in the req and resv arrays
 *
 * [in] req
 *   Pointer to an array of request elements
 *
 * [in] resv
 *   Pointer to an array of reserved elements
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_session_resc_alloc(struct tf *tfp,
			      struct tf_dev_info *dev,
			      enum tf_dir dir,
			      uint16_t size,
			      struct tf_rm_resc_req_entry *request,
			      struct tf_rm_resc_entry *resv);

/**
 * Sends session HW resource allocation request to TF Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] dir
 *   Receive or Transmit direction
 *
 * [in] size
 *   Number of elements in the req and resv arrays
 *
 * [in] req
 *   Pointer to an array of request elements
 *
 * [in] resv
 *   Pointer to an array of reserved elements
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_session_resc_info(struct tf *tfp,
			      struct tf_dev_info *dev,
			      enum tf_dir dir,
			      uint16_t size,
			      struct tf_rm_resc_req_entry *request,
			      struct tf_rm_resc_entry *resv);

/**
 * Sends session resource flush request to TF Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] dir
 *   Receive or Transmit direction
 *
 * [in] size
 *   Number of elements in the req and resv arrays
 *
 * [in] resv
 *   Pointer to an array of reserved elements that needs to be flushed
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_session_resc_flush(struct tf *tfp,
			      enum tf_dir dir,
			      uint16_t size,
			      struct tf_rm_resc_entry *resv);
/**
 * Sends EM internal insert request to Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] params
 *   Pointer to em insert parameter list
 *
 * [in] rptr_index
 *   Record ptr index
 *
 * [in] rptr_entry
 *   Record ptr entry
 *
 * [in] num_of_entries
 *   Number of entries to insert
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_insert_em_internal_entry(struct tf *tfp,
				    struct tf_insert_em_entry_parms *params,
				    uint16_t *rptr_index,
				    uint8_t *rptr_entry,
				    uint8_t *num_of_entries);
/**
 * Sends EM hash internal insert request to Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] params
 *   Pointer to em insert parameter list
 *
 * [in] key0_hash
 *      CRC32 hash of key
 *
 * [in] key1_hash
 *      Lookup3 hash of key
 *
 * [in] rptr_index
 *   Record ptr index
 *
 * [in] rptr_entry
 *   Record ptr entry
 *
 * [in] num_of_entries
 *   Number of entries to insert
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int
tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
				struct tf_insert_em_entry_parms *em_parms,
				uint32_t key0_hash,
				uint32_t key1_hash,
				uint16_t *rptr_index,
				uint8_t *rptr_entry,
				uint8_t *num_of_entries);
/**
 * Sends EM internal delete request to Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] em_parms
 *   Pointer to em delete parameters
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_delete_em_entry(struct tf *tfp,
			   struct tf_delete_em_entry_parms *em_parms);

/**
 * Sends EM internal move request to Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] em_parms
 *   Pointer to em move parameters
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_move_em_entry(struct tf *tfp,
			 struct tf_move_em_entry_parms *em_parms);

/**
 * Sends Ext EM mem allocation request to Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] tbl
 *   memory allocation details
 *
 * [out] dma_addr
 *   memory address
 *
 * [out] page_lvl
 *   page level
 *
 * [out] page_size
 *   page size
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
			struct hcapi_cfa_em_table *tbl,
			uint64_t *dma_addr,
			uint32_t *page_lvl,
			uint32_t *page_size);

/**
 * Sends Ext EM mem allocation request to Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] mem_size_k
 *   memory size in KB
 *
 * [in] page_dir
 *   Pointer to the PBL or PDL depending on number of levels
 *
 * [in] page_level
 *   PBL indirect levels
 *
 * [in] page_size
 *   page size
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
				uint32_t mem_size_k,
				uint64_t dma_addr,
				uint8_t page_level,
				uint8_t page_size);

/**
 * Sends EM mem register request to Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] page_lvl
 *   Page level
 *
 * [in] page_size
 *   Page size
 *
 * [in] dma_addr
 *   DMA Address for the memory page
 *
 * [in] ctx_id
 *   Context id
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_em_mem_rgtr(struct tf *tfp,
		       int page_lvl,
		       int page_size,
		       uint64_t dma_addr,
		       uint16_t *ctx_id);

/**
 * Sends EM mem unregister request to Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] ctx_id
 *   Context id
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_em_mem_unrgtr(struct tf *tfp,
			 uint16_t *ctx_id);

/**
 * Sends EM qcaps request to Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] dir
 *   Receive or Transmit direction
 *
 * [in] em_caps
 *   Pointer to EM capabilities
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_em_qcaps(struct tf *tfp,
		    int dir,
		    struct tf_em_caps *em_caps);

/**
 * Sends EM config request to Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] num_entries
 *   EM Table, key 0, number of entries to configure
 *
 * [in] key0_ctx_id
 *   EM Table, Key 0 context id
 *
 * [in] key1_ctx_id
 *   EM Table, Key 1 context id
 *
 * [in] record_ctx_id
 *   EM Table, Record context id
 *
 * [in] efc_ctx_id
 *   EM Table, EFC Table context id
 *
 * [in] flush_interval
 *   Flush pending HW cached flows every 1/10th of value set in
 *   seconds, both idle and active flows are flushed from the HW
 *   cache. If set to 0, this feature will be disabled.
 *
 * [in] dir
 *   Receive or Transmit direction
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_em_cfg(struct tf *tfp,
		  uint32_t num_entries,
		  uint16_t key0_ctx_id,
		  uint16_t key1_ctx_id,
		  uint16_t record_ctx_id,
		  uint16_t efc_ctx_id,
		  uint8_t flush_interval,
		  int dir);

/**
 * Sends Ext EM config request to Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] fw_se_id
 *   FW session id
 *
 * [in] tbl_scope_cb
 *   Table scope parameters
 *
 * [in] st_buckets
 *   static bucket size
 *
 * [in] flush_interval
 *   Flush pending HW cached flows every 1/10th of value set in
 *   seconds, both idle and active flows are flushed from the HW
 *   cache. If set to 0, this feature will be disabled.
 *
 * [in] dir
 *   Receive or Transmit direction
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_ext_em_cfg(struct tf *tfp,
		      struct tf_tbl_scope_cb *tbl_scope_cb,
		      uint32_t st_buckets,
		      uint8_t flush_interval,
		      enum tf_dir dir);

/**
 * Sends EM operation request to Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] dir
 *   Receive or Transmit direction
 *
 * [in] op
 *   CFA Operator
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_em_op(struct tf *tfp,
		 int dir,
		 uint16_t op);

/**
 * Sends tcam entry 'set' to the Firmware.
 *
 * [in] tfp
 *   Pointer to session handle
 *
 * [in] parms
 *   Pointer to set parameters
 *
 * Returns:
 *  0 on Success else internal Truflow error
 */
int tf_msg_tcam_entry_set(struct tf *tfp,
			  struct tf_dev_info *dev,
			  struct tf_tcam_set_parms *parms);

/**
 * Sends tcam entry 'get' to the Firmware.
 *
 * [in] tfp
 *   Pointer to session handle
 *
 * [in] parms
 *   Pointer to get parameters
 *
 * Returns:
 *  0 on Success else internal Truflow error
 */
int tf_msg_tcam_entry_get(struct tf *tfp,
			  struct tf_dev_info *dev,
			  struct tf_tcam_get_parms *parms);

/**
 * Sends tcam entry 'free' to the Firmware.
 *
 * [in] tfp
 *   Pointer to session handle
 *
 * [in] parms
 *   Pointer to free parameters
 *
 * Returns:
 *  0 on Success else internal Truflow error
 */
int tf_msg_tcam_entry_free(struct tf *tfp,
			   struct tf_dev_info *dev,
			   struct tf_tcam_free_parms *parms);

/**
 * Sends Set message of a Table Type element to the firmware.
 *
 * [in] tfp
 *   Pointer to session handle
 *
 * [in] dir
 *   Direction location of the element to set
 *
 * [in] hcapi_type
 *   Type of the object to set
 *
 * [in] size
 *   Size of the data to set
 *
 * [in] data
 *   Data to set
 *
 * [in] index
 *   Index to set
 *
 * Returns:
 *   0 - Success
 */
int tf_msg_set_tbl_entry(struct tf *tfp,
			 enum tf_dir dir,
			 uint16_t hcapi_type,
			 uint16_t size,
			 uint8_t *data,
			 uint32_t index);

/**
 * Sends get message of a Table Type element to the firmware.
 *
 * [in] tfp
 *   Pointer to session handle
 *
 * [in] dir
 *   Direction location of the element to get
 *
 * [in] hcapi_type
 *   Type of the object to get
 *
 * [in] size
 *   Size of the data read
 *
 * [in] data
 *   Data read
 *
 * [in] index
 *   Index to get
 *
 * Returns:
 *   0 - Success
 */
int tf_msg_get_tbl_entry(struct tf *tfp,
			 enum tf_dir dir,
			 uint16_t hcapi_type,
			 uint16_t size,
			 uint8_t *data,
			 uint32_t index,
			 bool clear_on_read);

/* HWRM Tunneled messages */

/**
 * Sends global cfg read request to Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] params
 *   Pointer to read parameters
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_get_global_cfg(struct tf *tfp,
			  struct tf_global_cfg_parms *params);

/**
 * Sends global cfg update request to Firmware
 *
 * [in] tfp
 *   Pointer to TF handle
 *
 * [in] params
 *   Pointer to write parameters
 *
 * Returns:
 *   0 on Success else internal Truflow error
 */
int tf_msg_set_global_cfg(struct tf *tfp,
			  struct tf_global_cfg_parms *params);

/**
 * Sends bulk get message of a Table Type element to the firmware.
 *
 * [in] tfp
 *   Pointer to session handle
 *
 * [in] parms
 *   Pointer to table get bulk parameters
 *
 * Returns:
 *  0 on Success else internal Truflow error
 */
int tf_msg_bulk_get_tbl_entry(struct tf *tfp,
			      enum tf_dir dir,
			      uint16_t hcapi_type,
			      uint32_t starting_idx,
			      uint16_t num_entries,
			      uint16_t entry_sz_in_bytes,
			      uint64_t physical_mem_addr,
			      bool clear_on_read);

/**
 * Sends Set message of a IF Table Type element to the firmware.
 *
 * [in] tfp
 *   Pointer to session handle
 *
 * [in] parms
 *   Pointer to IF table set parameters
 *
 * Returns:
 *  0 on Success else internal Truflow error
 */
int tf_msg_set_if_tbl_entry(struct tf *tfp,
			    struct tf_if_tbl_set_parms *params);

/**
 * Sends get message of a IF Table Type element to the firmware.
 *
 * [in] tfp
 *   Pointer to session handle
 *
 * [in] parms
 *   Pointer to IF table get parameters
 *
 * Returns:
 *  0 on Success else internal Truflow error
 */
int tf_msg_get_if_tbl_entry(struct tf *tfp,
			    struct tf_if_tbl_get_parms *params);

/**
 * Send get version request to the firmware.
 *
 * [in] bp
 *   Pointer to bnxt handle
 *
 * [in] dev
 *   Pointer to the associated device
 *
 * [in/out] parms
 *   Pointer to the version info parameter
 *
 * Returns:
 *  0 on Success else internal Truflow error
 */
int
tf_msg_get_version(struct bnxt *bp,
		   struct tf_dev_info *dev,
		   struct tf_get_version_parms *parms);
#endif  /* _TF_MSG_H_ */