Add Broadcom / Netgear changes from RAXE 1.0.0.48
[project/bcm63xx/u-boot.git] / arch / arm / mach-bcmbca / rdp / rdpa_cpu.h
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * Copyright (c) 2013 Broadcom
4 */
5 /*
6 *
7 */
8
9 #ifndef RDPA_CPU_H_
10 #define RDPA_CPU_H_
11
12 #ifdef __cplusplus
13 extern "C"
14 {
15 #endif
16
17 #include "rdpa_types.h"
18 #include "rdpa_cpu_basic.h"
19
20 /** \defgroup cpu CPU Interface
21 * Functions in this module:
22 * - Send packets from the host to any egress port or to virtual "bridge" port
23 * - Receive packets via one of host termination (CPU_RX) or Wi-Fi acceleration (WLAN_TX) queues
24 * - Connect per-port and/or per-receive queue interrupt handlers
25 * - Configure CPU trap reason --> queue mapping
26 *
27 * Runner to host traffic management parameters can be configured similarly to any other egress queue.
28 * Initial port level (CPU, WLAN0, WLAN1) configuration is done using the appropriate port configuration
29 * that fixes parameters such as scheduling type, number of queues, etc.\n
30 * @{
31 */
32
33 /** \defgroup isr Interrupt Control
34 * \ingroup cpu
35 * Functions in this group allow to
36 * - Register / unregister per-queue interrupt handler
37 * - Enable / disable / clear per-queue interrupt
38 * @{
39 */
40
41 /** Enable CPU queue interrupt
42 * \param[in] port port. rdpa_cpu, rdpa_wlan0, rdpa_wlan1
43 * \param[in] queue Queue index < num_queues in port tm configuration
44 */
45 void rdpa_cpu_int_enable(rdpa_cpu_port port, int queue);
46
47 /** Disable CPU queue interrupt
48 * \param[in] port port. rdpa_cpu, rdpa_wlan0, rdpa_wlan1
49 * \param[in] queue Queue index < num_queues in port tm configuration
50 */
51 void rdpa_cpu_int_disable(rdpa_cpu_port port, int queue);
52
53 /** Clear CPU queue interrupt
54 * \param[in] port port. rdpa_cpu, rdpa_wlan0, rdpa_wlan1
55 * \param[in] queue Queue index < num_queues in port tm configuration
56 */
57 void rdpa_cpu_int_clear(rdpa_cpu_port port, int queue);
58
59 /** Enable Runner interrupt
60 * \param[in] intr_idx Interrupt index < 32
61 */
62 void rdpa_rnr_int_enable(uint8_t intr_idx);
63
64 /** Disable Runner interrupt
65 * \param[in] intr_idx Interrupt index < 32
66 */
67 void rdpa_rnr_int_disable(uint8_t intr_idx);
68
69 /** Clear Runner interrupt
70 * \param[in] intr_idx Interrupt index < 32
71 */
72 void rdpa_rnr_int_clear(uint8_t intr_idx);
73
74 /** @} end of isr Doxygen group */
75
76 /** \defgroup cpu_rx Receive
77 * \ingroup cpu
78 * Functions in this group allow to
79 * - Register/unregister per-port and per-queue interrupt handlers
80 * - Register/unregister packet handler
81 * - Pull received packets from port (scheduling) or queue
82 * @{
83 */
84
85 /** CPU meter SR validation constants */
86
87
88 #ifdef XRDP
89 #define RDPA_CPU_METER_MAX_SR 500000 /**< Max CPU meter SR value in pps */
90 #define RDPA_CPU_METER_MIN_SR 10 /**< Min CPU meter SR value in pps */
91 #define RDPA_CPU_METER_SR_QUANTA 10 /**< CPU meter SR must be a multiple of quanta */
92 #else
93 #define RDPA_CPU_METER_MAX_SR 40000 /**< Max CPU meter SR value in pps */
94 #define RDPA_CPU_METER_MIN_SR 100 /**< Min CPU meter SR value in pps */
95 #define RDPA_CPU_METER_SR_QUANTA 100 /**< CPU meter SR must be a multiple of quanta */
96 #endif
97
98
99
100 /** Reason index. Underlying type of cpu_reason_index aggregate */
101 typedef struct
102 {
103 rdpa_traffic_dir dir; /**< Traffic direction */
104 rdpa_cpu_reason reason; /**< CPU reason */
105 #if defined(BCM_DSL_RDP)
106 int table_index; /**< reason table index */
107 #endif
108 int entry_index; /* Reserved for internal use. */
109 } rdpa_cpu_reason_index_t;
110
111 /** Reason configuration structure.
112 * Underlying structure for cpu_reason_cfg aggregate
113 */
114 typedef struct
115 {
116 bdmf_index queue; /**< reason --> queue mapping */
117 bdmf_index meter; /**< CPU interface meter index < RDPA_CPU_MAX_METERS or BDMF_INDEX_UNDEFINED */
118 rdpa_ports meter_ports; /**< Mask of ports for which the policer is active */
119 } rdpa_cpu_reason_cfg_t;
120
121 /** CPU meter configuration
122 * Underlying structure for cpu_meter_cfg aggregate
123 */
124 typedef struct
125 {
126 uint32_t sir; /**< SIR ( packets per sec ) */
127 uint32_t burst_size; /**< Burst size ( packets ) */
128 } rdpa_cpu_meter_cfg_t;
129
130 /** L4 dst port to reason configuration
131 * Underlying structure for l4_dst_port_to_reason aggregate
132 */
133 typedef struct
134 {
135 bdmf_boolean is_tcp; /**< TCP or UDP */
136 uint16_t l4_dst_port; /**< l4 dst port */
137 rdpa_cpu_reason reason; /**< rdpa cpu reason */
138 bdmf_boolean is_static; /**< static or dynamic */
139 uint8_t refcnt; /**< reference count */
140 } rdpa_l4_dst_port_to_reason_cfg_t;
141
142 /** Receive packet info */
143 typedef struct
144 {
145 rdpa_cpu_reason reason; /**< trap reason */
146 rdpa_if src_port; /**< source port */
147 uint16_t vport;
148 uint32_t reason_data; /**< Reason-specific data.
149 For CPU port it usually contains src_flow
150 For Wi-Fi port it contains source SSID index in 16 MSB and destination SSID vector in 16 LSB
151 It can contain other reason-specific info (such as OAM info, etc.).
152 */
153 void *data; /**<data pointer or FPM/BPM hw token*/
154 uint32_t size; /**<data size */
155 uint32_t data_offset; /**<data offset inside pointer */
156 struct {
157 uint32_t rx_csum_verified:1;
158 uint32_t reserved:31;
159 };
160 uint32_t dest_ssid; /** <when traffic is to be forward to WFD */
161 uint32_t wl_metadata; /** wlan metadata */
162 uint16_t ptp_index; /**< index of ptp RX entry */
163 uint8_t mcast_tx_prio; /**< TX priority (0-7) for multicast traffic \XRDP limited */
164 uint8_t color;
165 uint8_t is_exception;
166 uint8_t is_rx_offload;
167 uint8_t is_ucast;
168 uint8_t omci_encrypted_key_index; /**< encrption key-index in NGPON modes */
169 } rdpa_cpu_rx_info_t;
170
171 /* Extended CPU info (debugging) */
172 typedef struct
173 {
174 uint8_t valid; /**< 1 means that the following fields contain valid data */
175 struct bdmf_object *egress_object; /**< Egress object (port, tcont, llid) */
176 uint32_t egress_queue_id; /**< Egress queue_id */
177 uint16_t wan_flow; /**< Egress/ingress WAN flow */
178 } rdpa_cpu_rx_ext_info_t;
179
180 typedef void (*rdpa_cpu_rxq_rx_isr_cb_t)(long isr_priv);
181 typedef void (*rdpa_cpu_rxq_rx_cb_t)(long priv, bdmf_sysb sysb, rdpa_cpu_rx_info_t *info);
182 typedef void (*rdpa_cpu_rxq_dump_data_cb_t)(bdmf_index queue, bdmf_boolean enabled);
183
184 /** Host receive configuration.
185 * Underlying structure of cpu_rx_cfg aggregate.
186 */
187 typedef struct {
188 bdmf_boolean ic_enable; /**< True - Enable. False - Disable */
189 #define RDPA_CPU_IC_MAX_PKT_CNT 63
190 uint8_t ic_max_pktcnt; /**< Interrupt Coalescing max packet count.
191 MAX value 63
192 */
193 #define RDPA_CPU_IC_MAX_TIMEOUT_IN_US 1023
194 uint16_t ic_timeout_us; /**< The hardware timer period is configured to
195 100 us. This means that the timeout period
196 will round up to the next 100 us.
197 For example, if the timeout is 201 us,
198 a timeout will not be identified until 300us.
199 This means for practical purposes, the
200 timeout value is 100 us, 200 us, 300 us,
201 400 us, 500 us, 600 us, 700 us, 800 us,
202 900 us, 1000 us and 1100 us.
203 */
204 } rdpa_cpu_rxq_ic_cfg_t;
205
206 typedef struct {
207 uint32_t received;
208 uint32_t queued;
209 uint32_t dropped;
210 } extern_rxq_stat_t;
211
212 typedef void (*extern_rxq_stat_callback)(int qid, extern_rxq_stat_t *stat, bdmf_boolean clear);
213
214 typedef void (*reason_stat_extern_callback_t)(uint32_t *stat, rdpa_cpu_reason_index_t *rindex);
215
216 #define RDPA_CPU_QUEUE_MAX_SIZE 1024 /**< Maximal Host queue size */
217 #define RDPA_CPU_QUEUE_MIN_SIZE 64 /**< Minimal Host queue size */
218 #define RDPA_CPU_WLAN_QUEUE_MAX_SIZE 1024 /**< Maximal WFD queue size */
219 #define RDPA_FEED_QUEUE_MAX_SIZE (1024 * 32) /**< Maximal FEED queue size */
220 #if !defined(RDP_SIM)
221 #define RDPA_CPU_TX_RING_HIGH_PRIO_SIZE (1024 *2) /**< Maximal CPU_TX queue for high priority size */
222 #define RDPA_CPU_TX_RING_LOW_PRIO_SIZE (1024 *2) /**< Maximal CPU_TX queue for low priority size */
223 #define RDPA_CPU_TX_RING_SIZE (1024 *2) /**< Maximal CPU_TX queue size for validation */
224 #define RDPA_CPU_TX_RING_EXLUSIVE_RESERVED_SIZE 128 /**< Minimal CPU_TX queue size for high priority packets reservation */
225 #else
226 #define RDPA_CPU_TX_RING_HIGH_PRIO_SIZE (64) /**< Maximal CPU_TX queue for high priority size */
227 #define RDPA_CPU_TX_RING_LOW_PRIO_SIZE (64) /**< Maximal CPU_TX queue for low priority size */
228 #define RDPA_CPU_TX_RING_SIZE (64) /**< Maximal CPU_TX queue size for validation */
229 #define RDPA_CPU_TX_RING_EXLUSIVE_RESERVED_SIZE 2 /**< Minimal CPU_TX queue size for high priority packets reservation */
230 #endif
231 #define RING_NORMAL_PRIO 0
232 #define RING_HIGH_PRIO 1
233
234 /** Receive packet info
235 * Underlying structure for cpu_rxq_cfg aggregate
236 */
237 typedef struct {
238 /** ISR callback
239 * If set ISR is connected to the appropriate port+queue
240 * \param[in] isr_priv
241 */
242 rdpa_cpu_rxq_rx_isr_cb_t rx_isr;
243 void *ring_head; /**< Allocated by client ring */
244 uint32_t size; /**< Queue size */
245 rdpa_ring_type_t type; /**< ring type \XRDP_LIMITED */
246 bdmf_boolean dump; /**< Dump rx data */
247 long isr_priv; /**< Parameter to be passed to isr callback */
248 rdpa_cpu_rxq_ic_cfg_t ic_cfg; /**< Interrupt Coalescing config */
249 rdpa_cpu_rxq_dump_data_cb_t rx_dump_data_cb; /**< Dump RX data callback */
250 extern_rxq_stat_callback rxq_stat; /**< Optional internal statistics callback */
251 long unsigned int irq_affinity_mask; /**< Queue ISR affinity mask - every bit represents CPU */
252 uint32_t ring_prio; /**< Queue Priority - used for buffer allocation request \RDP_LIMITED */
253 } rdpa_cpu_rxq_cfg_t;
254
255 /** Receive statistics.
256 * Underlying structure for cpu_rx_stat aggregate
257 */
258 typedef struct
259 {
260 uint32_t received; /**< Packets passed to rx callback */
261 uint32_t queued; /**< Packets in the queue */
262 uint32_t dropped; /**< Packets dropped by RDD / FW */
263 uint32_t interrupts; /**< interrupts */
264 } rdpa_cpu_rx_stat_t;
265
266 /** Cpu loopback type
267 */
268 typedef enum
269 {
270 rdpa_cpu_loopback_ipsec, /**< IPsec offload packet loopback */
271
272 rdpa_cpu_loopback__num_of
273 } rdpa_cpu_loopback_type;
274
275 /** Pull a single received packet from host queue.
276 * This function pulls a single packet from the host queue.
277 * \param[in] port CPU port (host, wlan0, wlan1, wlan2)
278 * \param[in] queue Queue index < num_queues in rdpa_port_tm_cfg_t or UNASSIGNED
279 * \param[out] info Packet info
280 * \return =0:packet pulled ok, <0:int error code\n
281 */
282 int rdpa_cpu_packet_get(rdpa_cpu_port port, bdmf_index queue, rdpa_cpu_rx_info_t *info);
283
284 /** Pull a single received packet from host queue with extended RX info.
285 * Extended info is only available for packets redirected to CPU
286 * using system.rx_cpu_redirect attribute
287 *
288 * This function pulls a single packet from the host queue.
289 * \param[in] port CPU port (host0, host1, ..)
290 * \param[in] queue Queue index < num_queues in rdpa_port_tm_cfg_t or UNASSIGNED
291 * \param[out] info Packet info
292 * \param[out] ext_info Packet extended info
293 * \return =0:packet pulled ok, <0:int error code\n
294 */
295 int rdpa_cpu_packet_get_redirected(rdpa_cpu_port port, bdmf_index queue,
296 rdpa_cpu_rx_info_t *info, rdpa_cpu_rx_ext_info_t *ext_info);
297
298 #define CPU_RX_PACKETS_BULK_SIZE 32
299 /** Pull a bulk of received packets from host queue.
300 * This function pulls a bulk of packets from the host queue.
301 * \param[in] port CPU port (host, wlan0, wlan1, wlan2)
302 * \param[in] queue Queue index < num_queues in rdpa_port_tm_cfg_t or UNASSIGNED
303 * \param[out] info Array of packet info structures, sizeof of array is CPU_RX_PACKETS_BULK_SIZE
304 * \param[in] max_count Maximal number of packets to read, up to CPU_RX_PACKETS_BULK_SIZE
305 * \param[out] count Number of packets actually read
306 * \return =0:no errors occured, <0:int error code\n
307 */
308 int rdpa_cpu_packets_bulk_get(rdpa_cpu_port port, bdmf_index queue, rdpa_cpu_rx_info_t *info, int max_count, int *count);
309
310
311 /** Pull a single offloaded packet from host queue.
312 * This function receives a single packet that was offloaded from CPU.
313 * \param[in] loopback_type Loopback type
314 * \param[in] queue Queue index < num_queues in rdpa_port_tm_cfg_t or UNASSIGNED
315 * \param[out] sysb Packet data (buffer)
316 * \param[out] info Packet info
317 * \return =1:packet pulled ok, ==0:no packet pulled, <0:int error code\n
318 */
319 int rdpa_cpu_loopback_packet_get(rdpa_cpu_loopback_type loopback_type, bdmf_index queue,
320 bdmf_sysb *sysb, rdpa_cpu_rx_info_t *info);
321
322 /** Pull a bulk of received FKB packets from host queue.
323 * This function pulls a bulk of packets from the host queue.
324 * Buffers will be provided with the FKB envelope.
325 * Up to the maximum number of buffers specified via the budget parameter will be returned
326 * to the caller.
327 *
328 * \param[in] queue_id CPU RX Queue ID
329 * \param[in] budget Maximum number of packets to be read
330 * \param[in] rx_pkts Array of received packets
331 * \param[in] rdpa_cpu_data_p Opaque CPU handle retrieved via ::rdpa_cpu_data_get() API
332 * \return Number of received packets\n
333 */
334 int rdpa_cpu_wfd_bulk_fkb_get(bdmf_index queue_id, unsigned int budget, void **rx_pkts, void *rdpa_cpu_data_p);
335
336 /** Pull a bulk of received SKB packets from host queue.
337 * This function pulls a bulk of packets from the host queue.
338 * Buffers will be provided with tghe SKB envelope.
339 * Up to the maximum number of buffers specified via the budget parameter will be returned
340 * to the caller.
341 * \param[in] queue_id CPU RX Queue ID
342 * \param[in] budget Maximum number of packets to be read
343 * \param[in] rx_pkts Array of received packets
344 * \param[in] rdpa_cpu_data_p Opaque CPU handle retrieved via ::rdpa_cpu_data_get() API
345 * \return Number of received packets\n
346 */
347 int rdpa_cpu_wfd_bulk_skb_get(bdmf_index queue_id, unsigned int budget, void **rx_pkts, void *rdpa_cpu_data_p);
348 /** Retrieves Opaque CPU handle
349 * \param[in] rdpa_cpu_type CPU port identifier ::rdpa_cpu_port
350 * \return Opaque CPU handle.
351 */
352 void *rdpa_cpu_data_get(int rdpa_cpu_type);
353
354
355 /** @} end of cpu_rx Doxygen group */
356
357 /** \defgroup cpu_tx Transmit
358 * \ingroup cpu
359 * Packets can be transmitted
360 * - via specific port/queue
361 * - using FW bridging & classification logic
362 *
363 * All rdpa_cpu_send_to_xx functions return int error code
364 * - If rc==0, buffer ownership is passed to RDPA. The buffer will be released when safe.
365 * - If rc!=0, buffer ownership stays with the caller
366 * @{
367 */
368
369 /** Extra data that can be passed along with the packet to be transmitted */
370 typedef union
371 {
372 uint32_t u32;
373 struct {
374 uint32_t is_spdsvc_setup_packet :1; /**<when set, indicates that a Speed Service Setup packet is being transmitted */
375 uint32_t lag_port :2; /**<Runner to external switch lag port (EMAC) */
376 uint32_t tc_id :6; /**<traffic class value assigned with this packet */
377 uint32_t unused :23;
378 };
379 } rdpa_cpu_tx_extra_info_t;
380
381 /** Transmit statistics */
382 typedef struct
383 {
384 uint32_t tx_ok; /**< Successfully passed to RDD for transmission */
385 uint32_t tx_invalid_queue; /**< Discarded because transmit queue is not configured */
386 uint32_t tx_no_buf; /**< Discarded because couldn't allocate BPM buffer */
387 uint32_t tx_too_long; /**< Discarded packets with length > max MTU size */
388 uint32_t tx_rdd_error; /**< Discarded because RDD returned error */
389 } rdpa_cpu_tx_stat_t;
390
391
392 /** Send system buffer
393 *
394 * \param[in] sysb System buffer. Released regardless on the function outcome
395 * \param[in] info Tx info
396 * \return 0=OK or int error code\n
397 */
398 int rdpa_cpu_send_sysb(bdmf_sysb sysb, const rdpa_cpu_tx_info_t *info);
399
400 /** Send system buffer allocated from FPM
401 *
402 * \param[in] sysb System buffer. Released regardless on the function outcome
403 * \param[in] info Tx info
404 * \return 0=OK or int error code\n
405 */
406 int rdpa_cpu_send_sysb_fpm(bdmf_sysb sysb, const rdpa_cpu_tx_info_t *info);
407
408 int rdpa_cpu_send_wfd_to_bridge(bdmf_sysb sysb, const rdpa_cpu_tx_info_t *info, size_t offset_next);
409
410 #if defined(BCM_DSL_RDP) || defined(BCM_DSL_XRDP)
411 /** Send system buffer to Ethernet/DSL WAN Interface
412 *
413 * \param[in] sysb System buffer. Released regardless on the function outcome
414 * \param[in] egress_queue Ethernet Egress Queue
415 * \return 0=OK or int error code\n
416 */
417 int rdpa_cpu_tx_port_enet_or_dsl_wan(bdmf_sysb sysb, uint32_t egress_queue, rdpa_flow wan_flow, rdpa_if wan_if,
418 rdpa_cpu_tx_extra_info_t extra_info);
419
420 /** Send system buffer to Ethernet LAN Interface
421 *
422 * \param[in] sysb System buffer. Released regardless on the function outcome
423 * \param[in] egress_queue Ethernet Egress Queue
424 * \param[in] phys_port Ethernet LAN physical port
425 * \return 0=OK or int error code\n
426 */
427 int rdpa_cpu_tx_port_enet_lan(bdmf_sysb sysb, uint32_t egress_queue,
428 uint32_t phys_port, rdpa_cpu_tx_extra_info_t extra_info);
429
430 /** Send system buffer to Flow Cache Offload
431 *
432 * \param[in] sysb: System buffer. Released regardless on the function outcome
433 * \param[in] cpu_rx_queue: CPU Rx Queue index, in case of Runner Flow miss
434 * \param[in] dirty: Indicates whether a packet flush from D$ is required
435 * \return 0=OK or int error code\n
436 */
437 int rdpa_cpu_tx_flow_cache_offload(bdmf_sysb sysb, uint32_t cpu_rx_queue, int dirty);
438
439 /** Frees the given free index and returns a pointer to the associated
440 * System Buffer. It is up to the caller to process the System Buffer.
441 *
442 * \param[in] free_index: Runner free index
443 * \return: Pointer to the associated system buffer\n
444 */
445 bdmf_sysb rdpa_cpu_return_free_index(uint16_t free_index);
446
447 /** Receive a system buffer (FKB type) from an Ethernet Interface
448 *
449 * \param[in] queue CPU RX Queue ID
450 * \param[in] sysb System buffer
451 * \param[in] src_port Source RDPA Interface
452 * \return 0=OK or int error code\n
453 */
454 int rdpa_cpu_host_packet_get_enet(bdmf_index queue, bdmf_sysb *sysb, rdpa_if *src_port);
455
456 /** Free all pending Tx Buffers
457 */
458 void rdpa_cpu_tx_reclaim(void);
459
460 /** Send system buffer to IPsec Offload
461 *
462 * \param[in] sysb: System buffer.
463 * \param[in] dir: Indicates whether the packet is upstream or downstream.
464 * \param[in] esphdr_offset: ESP header byte offset into the packet.
465 * \param[in] sa_index: Entry index of the ddr SA descriptor table.
466 * \param[in] sa_update: 0- sa_index entry of the ddr sa descriptor table is new.
467 * 1- sa_index entry of the ddr sa descriptor table has been updated..
468 * \param[in] cpu_qid: Runner - HostCPU queue id
469 * \return 0=OK or int error code\n
470 */
471 int rdpa_cpu_tx_ipsec_offload(bdmf_sysb sysb, rdpa_traffic_dir dir, uint8_t esphdr_offset,
472 uint8_t sa_index, uint8_t sa_update, uint8_t cpu_qid);
473 #endif
474
475 /** Send raw packet
476 *
477 * \param[in] data Packet data
478 * \param[in] length Packet length
479 * \param[in] info Info
480 * \return 0=OK or int error code\n
481 */
482 int rdpa_cpu_send_raw(void *data, uint32_t length, const rdpa_cpu_tx_info_t *info);
483
484 /** Get cpu queue emptiness status
485 *
486 * \param[in] port CPU port (CPU, PCI1, PCI2)
487 * \param[in] queue Queue index < num_queues in rdpa_port_tm_cfg_t or UNASSIGNED
488 * \return 0=no packets are waiting or at least one packet in queue\n
489 */
490 int rdpa_cpu_queue_not_empty(rdpa_cpu_port port, bdmf_index queue);
491
492 /** Get cpu queue fullness status
493 *
494 * \param[in] port CPU port (CPU, PCI1, PCI2)
495 * \param[in] queue Queue index < num_queues in rdpa_port_tm_cfg_t or UNASSIGNED
496 * \return 1 = if queue is full or 0 if there is still place to put packets\n
497 */
498 int rdpa_cpu_queue_is_full(rdpa_cpu_port port, bdmf_index queue);
499
500
501 /** Get the Time Of Day from the FW FIFO, by the ptp index
502 * \param[in] ptp_index ptp_index is an entry of struct rdpa_cpu_rx_info_t and is copied from struct
503 * CPU_RX_PARAMS on each received packet. It is only relevant on ptp 1588 packets.
504 * By this index we get the corresponding Time Of Day of the received packet.
505 * \param[out] tod_h 4 most bytes of the TOD
506 * \param[out] tod_l 4 least bytes of the TOD
507 * \param[out] local_counter_delta time propagation delta between HW and NP
508 * \return 0=OK or int error code\n */
509 int rdpa_cpu_ptp_1588_get_tod(uint16_t ptp_index, uint32_t *tod_h,
510 uint32_t *tod_l, uint16_t *local_counter_delta);
511
512 /** Send ptp-1588 system buffer
513 *
514 * \param[in] sysb System buffer. Released regardless on the function outcome
515 * \param[in] info Tx info
516 * \return 0=OK or int error code\n
517 */
518 int rdpa_cpu_send_sysb_ptp(bdmf_sysb sysb, const rdpa_cpu_tx_info_t *info);
519
520 /** Send system buffer - Special function to send EPON Dying
521 * Gasp:
522 *
523 * \param[in] sysb System buffer. Released regardless on the function outcome
524 * \param[in] info Tx info
525 * \return 0=OK or int error code\n
526 *
527 * */
528 int rdpa_cpu_send_epon_dying_gasp(bdmf_sysb sysb, const rdpa_cpu_tx_info_t *info);
529
530 /** Check if the reason is supported by port metering
531 * \param[in] reason reason to test
532 * \return 0=OK or int error code\n
533 */
534 int rdpa_cpu_is_per_port_metering_supported(rdpa_cpu_reason reason);
535
536
537 /** @} end of cpu_tx Doxygen group */
538 /** @} end of cpu Doxygen group */
539
540 rdpa_ports rdpa_ports_all_lan(void);
541
542 void rdpa_cpu_rx_dump_packet(char *name, rdpa_cpu_port port,
543 bdmf_index queue, rdpa_cpu_rx_info_t *info, uint32_t dst_ssid);
544
545 #ifdef XRDP
546 /** Platform buffer */
547 typedef void *bdmf_pbuf_t;
548
549 static inline void bdmf_pbuf_init(uint32_t size, uint32_t offset) { }
550 static inline void bdmf_pbuf_free(bdmf_pbuf_t *pbuf) { }
551 static inline int bdmf_pbuf_alloc(void *data, uint32_t length, uint16_t source, bdmf_pbuf_t *pbuf) { return 0; }
552 #endif
553
554 #if defined(CONFIG_BCM_FCACHE_CLASSIFICATION_BYPASS)
555 #define L2_FLOW_P_LEN 4
556 typedef struct {
557 union {
558 struct {
559 BE_DECL(
560 uint32_t incarn : 3;
561 uint32_t src_port : 6;
562 uint32_t self : 23;
563 )
564 LE_DECL(
565 uint32_t self : 23;
566 uint32_t src_port : 6;
567 uint32_t incarn : 3;
568 )
569 } id;
570 uint32_t word;
571 };
572 } fc_class_ctx_t;
573 #endif
574
575 #ifdef __cplusplus
576 }
577 #endif
578
579
580 #endif /* RDPA_CPU_H_ */
581