l2_traverse.h (2685B)
1 /** 2 * \file bcm_int/dnx/l2/l2_traverse.h 3 * Internal DNX L2 APIs 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 */ 8 9 #ifndef L2_TRAVERSE_H_INCLUDED 10 /* 11 * { 12 */ 13 #define L2_TRAVERSE_H_INCLUDED 14 15 #ifndef BCM_DNX_SUPPORT 16 #error "This file is for use by DNX (JR2) family only!" 17 #endif 18 19 /* 20 * Include files. 21 * { 22 */ 23 #include <sal/core/sync.h> 24 #include <sal/core/thread.h> 25 26 /* 27 * } 28 */ 29 30 /* 31 * DEFINES 32 * { 33 */ 34 35 /** 36 * \brief 37 * DB holding information for running flush traverse in non-blocking mode. 38 */ 39 typedef struct l2_flush_traverse_non_blocking_s 40 { 41 /** Thread control */ 42 sal_sem_t l2_traverse_sem; /* Semaphore for l2 flush traverse in non-blocking mode */ 43 sal_thread_t l2_traverse_tid; /* l2 flush traverse thread id */ 44 volatile int thread_running; /* Input signal to thread */ 45 volatile int thread_exit_complete; /* Output signal from thread */ 46 uint32 table_id; /* The MACT table id (FWD_MACT) */ 47 48 /** User callback parameters */ 49 bcm_l2_traverse_cb trav_fn; /* User callback function */ 50 void *user_data; /* User callback function parameters */ 51 } l2_flush_traverse_non_blocking_t; 52 53 /* 54 * } 55 */ 56 57 /* 58 * Internal functions. 59 * { 60 */ 61 62 /** 63 * \brief - Init the DMA channel of the flush machine 64 * 65 * \param [in] unit - unit id 66 * 67 * \return 68 * shr_error_e 69 * 70 * \remark 71 * * None 72 * \see 73 * * None 74 */ 75 shr_error_e dnx_l2_flush_dma_init( 76 int unit); 77 78 /** 79 * \brief - Stop and free the dma channel of the flush 80 * 81 * \param [in] unit - unit id 82 * 83 * \return 84 * shr_error_e 85 * 86 * \remark 87 * * None 88 * \see 89 * * None 90 */ 91 shr_error_e dnx_l2_flush_dma_deinit( 92 int unit); 93 94 /** 95 * \brief - Get the state of the flush machine. 96 * 97 * \param [in] unit - unit id 98 * \param [out] flush_machine_is_done - 1 in case the flush is idle. o otherwise. 99 * 100 * \return 101 * shr_error_e 102 * 103 * \remark 104 * * None 105 * \see 106 * * None 107 */ 108 shr_error_e dnx_l2_traverse_commit_done_get( 109 int unit, 110 int32 *flush_machine_is_done); 111 112 /** 113 * \brief - Create L2 Flush Traverse Thread (for non-blocking mode). 114 * 115 * \param [in] unit - unit id 116 * 117 * \return 118 * shr_error_e 119 * 120 * \remark 121 * * None 122 * \see 123 * * None 124 */ 125 shr_error_e dnx_l2_traverse_thread_start( 126 int unit); 127 128 /** 129 * \brief - Destroy L2 Flush Traverse Thread (for non-blocking mode). 130 * 131 * \param [in] unit - unit id 132 * 133 * \return 134 * shr_error_e 135 * 136 * \remark 137 * * None 138 * \see 139 * * None 140 */ 141 shr_error_e dnx_l2_traverse_thread_stop( 142 int unit); 143 144 /* 145 * } 146 */ 147 #endif /* L2_TRAVERSE_H_INCLUDED */