1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2013 Broadcom
10 #ifndef _RDPA_TYPES_H_
11 #define _RDPA_TYPES_H_
13 #include <bdmf_data_types.h>
15 /** Traffic direction */
17 rdpa_dir_ds
, /* Downstream */
18 rdpa_dir_us
/* Upstream */
21 /* Direction + index, Underlying structure for rdpa_dir_index aggregate */
23 rdpa_traffic_dir dir
; /* Traffic direction */
24 bdmf_index index
; /* Index */
29 uint32_t session
; /* PPPoE session ID */
33 typedef uint8_t rdpa_pbit
;
36 typedef uint8_t rdpa_dscp
;
40 uint8_t pbit
; /* pbit */
41 uint8_t dei
; /* pbit */
45 typedef uint8_t rdpa_prty
;
48 typedef uint8_t rdpa_tcont
;
50 /* Dual Stack lite tunnel ID */
51 /* this enum is the only modification needed in order to add more than
54 rdpa_ds_lite_tunnel_0
,
55 rdpa_ds_lite_max_tunnel_id
= rdpa_ds_lite_tunnel_0
56 } rdpa_ds_lite_tunnel_id
;
58 /* GEM flow ID (internal index) */
59 typedef uint16_t rdpa_gem
;
61 /* Ethernet/GEM flow ID */
62 typedef uint16_t rdpa_flow
;
64 /* not used by xDSL WAN Mode. flows 1-15 are used by DSL WAN modes for 16
65 * channels in multiples upto 255.
66 * Any other values would collide with the DSL WAN flows.
67 * values 0x0, 0x10, 0x20... are unused. */
68 #define GBE_WAN_FLOW_ID 0
71 /* UNASSIGNED value */
72 #define RDPA_VALUE_UNASSIGNED ((unsigned)-1)
73 #define RDPA_VALUE_UNMATCHED RDPA_VALUE_UNASSIGNED
76 #define RDPA_VALUE_ANY ((unsigned)-2)
79 #define RDPA_VID_UNTAGGED ((unsigned)-3)
80 #define RDPA_MAX_VID 4095
81 #define RDPA_MAX_PBIT 7
82 #define RDPA_MAX_DEI 1
84 /* Layer-4 PROTOCOL definitions */
85 #define RDPA_INVALID_PROTOCOL (0xFF)
88 * A set of TPID values, both pre- and user-defined,
89 * used to apply tagging classification rules on incoming
90 * traffic. Accordingly, every packet is classified as Single
91 * or Double tagged. */
93 rdpa_tpid_detect_0x8100
, /* Pre-Defined, 0x8100 */
94 rdpa_tpid_detect_0x88A8
, /* Pre-Defined, 0x88A8 */
95 rdpa_tpid_detect_0x9100
, /* Pre-Defined, 0x9100 */
96 rdpa_tpid_detect_0x9200
, /* Pre-Defined, 0x9200 */
98 rdpa_tpid_detect_udef_1
, /* User-Defined, #1 */
99 rdpa_tpid_detect_udef_2
, /* User-Defined, #2 */
101 rdpa_tpid_detect__num_of
102 } rdpa_tpid_detect_t
;
105 /* Forwarding action */
107 rdpa_forward_action_none
= 0, /* ACL */
108 rdpa_forward_action_forward
= 1, /* Forward */
109 rdpa_forward_action_host
= 2, /* Trap to the host */
110 rdpa_forward_action_drop
= 4, /* Discard */
111 rdpa_forward_action_flood
= 8, /* Flood, for DA lookup only */
112 /* Skip - used for generic filter for increment counter action only */
113 rdpa_forward_action_skip
= 16
114 } rdpa_forward_action
;
116 /** Filtering action */
118 rdpa_filter_action_allow
, /* Allow through */
119 rdpa_filter_action_deny
/* Block packet */
120 } rdpa_filter_action
;
122 /** QoS mapping method */
124 rdpa_qos_method_flow
, /**< Flow-based QoS mapping */
125 rdpa_qos_method_pbit
/**< Pbit-based QoS mapping */
128 /** Allow frame types */
131 rdpa_port_allow_any
, /**< Allow tagged and untagged frames */
132 rdpa_port_allow_tagged
, /**< Allow tagged frames only */
133 rdpa_port_allow_untagged
, /**< Allow untagged frames only */
134 } rdpa_port_frame_allow
;
136 /** Forwarding mode */
139 rdpa_forwarding_mode_pkt
, /**< Packet-based forwarding */
140 rdpa_forwarding_mode_flow
, /**< Flow-based forwarding */
141 } rdpa_forwarding_mode
;
143 /** DS Ethernet flow classification mode */
146 rdpa_classify_mode_pkt
, /**< Packet-based classification */
147 rdpa_classify_mode_flow
, /**< Flow-based classification */
148 } rdpa_classify_mode
;
150 /** Discard priority */
153 rdpa_discard_prty_low
, /**< Low priority for Ingress QoS: traffic dropped under high ingress congestion */
154 rdpa_discard_prty_high
/**< High priority for Ingress QoS: traffic passed under high ingress congresion */
157 /** Flow destination */
160 rdpa_flow_dest_none
, /**< Not set */
162 rdpa_flow_dest_iptv
, /**< IPTV */
163 rdpa_flow_dest_eth
, /**< Flow */
164 rdpa_flow_dest_omci
, /**< OMCI */
166 rdpa_flow_dest__num_of
, /* Number of values in rdpa_flow_destination enum */
167 } rdpa_flow_destination
;
169 /** WAN technology */
172 rdpa_wan_none
, /**< Not configured */
173 rdpa_wan_gpon
, /**< GPON */
174 rdpa_wan_xgpon
, /**< XGPON */
175 rdpa_wan_epon
, /**< EPON */
176 rdpa_wan_xepon
, /**< XEPON */
177 rdpa_wan_gbe
, /**< GbE */
178 rdpa_wan_dsl
, /**< xDSL */
179 rdpa_wan_type__num_of
185 rdpa_speed_none
, /**< Not configured */
186 rdpa_speed_100m
, /**< Speed of 100 Mega */
187 rdpa_speed_1g
, /**< Speed of 1 Giga */
188 rdpa_speed_2_5g
, /**< Speed of 2.5 Giga */
189 rdpa_speed_5g
, /**< Speed of 5 Giga */
190 rdpa_speed_10g
, /**< Speed of 10 Giga */
193 /** Simple statistics */
196 uint32_t packets
; /**< Packets */
197 uint32_t bytes
; /**< Bytes */
200 /** Generic 1-way statistics */
203 rdpa_stat_t passed
; /**< Passed statistics */
204 rdpa_stat_t discarded
; /**< Discarded statistics */
207 /** Tx+Rx statistics */
210 rdpa_stat_1way_t tx
; /**< Transmit statistics */
211 rdpa_stat_1way_t rx
; /**< Receive statistics */
214 /** Tx+Rx statistics for passed packets + bytes */
217 rdpa_stat_t tx
; /**< Transmit statistics */
218 rdpa_stat_t rx
; /**< Receive statistics */
219 } rdpa_stat_tx_rx_valid_t
;
221 /** RDPA interface (port).
222 * The enum includes physical and virtual ports that
223 * can appear in bridging / routing rules as ingress or egress interface.
224 * The port list does not include VLAN-based virtual interfaces and tunnels.
225 * Aggregation ports, such as PCI and SWITCH, can be used in 2-level scheduling.
229 rdpa_if_first
, /*< First interface */
232 rdpa_if_wan0
= rdpa_if_first
, /**< WAN0 port */
233 rdpa_if_wan1
, /**< WAN1 port */
234 rdpa_if_wan2
, /**< WAN2 port */
235 rdpa_if_wan_max
= rdpa_if_wan2
,
237 rdpa_if_lan0
, /**< LAN0 port */
238 rdpa_if_lan1
, /**< LAN1 port */
239 rdpa_if_lan2
, /**< LAN2 port */
240 rdpa_if_lan3
, /**< LAN3 port */
241 rdpa_if_lan4
, /**< LAN4 port */
242 rdpa_if_lan5
, /**< LAN5 port */
243 rdpa_if_lan6
, /**< LAN6 port */
244 rdpa_if_lan7
, /**< LAN7 port */
245 #if defined(BCM_DSL_RDP) || defined(BCM_DSL_XRDP)
246 rdpa_if_lan_max
= rdpa_if_lan7
,
247 #else /* DSL Platforms */
248 rdpa_if_lan8
, /**< LAN8 port */
249 rdpa_if_lan9
, /**< LAN9 port */
250 rdpa_if_lan10
, /**< LAN10 port */
251 rdpa_if_lan11
, /**< LAN11 port */
252 rdpa_if_lan12
, /**< LAN12 port */
253 rdpa_if_lan13
, /**< LAN13 port */
254 rdpa_if_lan14
, /**< LAN14 port */
255 rdpa_if_lan15
, /**< LAN15 port */
256 rdpa_if_lan16
, /**< LAN16 port */
257 rdpa_if_lan17
, /**< LAN17 port */
258 rdpa_if_lan18
, /**< LAN18 port */
259 rdpa_if_lan19
, /**< LAN19 port */
260 rdpa_if_lan20
, /**< LAN20 port */
261 rdpa_if_lan21
, /**< LAN21 port */
263 rdpa_if_lan22
, /**< LAN22 port */
264 rdpa_if_lan23
, /**< LAN23 port */
265 rdpa_if_lan24
, /**< LAN24 port */
266 rdpa_if_lan25
, /**< LAN25 port */
267 rdpa_if_lan26
, /**< LAN26 port */
268 rdpa_if_lan27
, /**< LAN27 port */
269 rdpa_if_lan28
, /**< LAN28 port */
270 rdpa_if_lan29
, /**< LAN29 port */
271 rdpa_if_lan_max
= rdpa_if_lan29
,
273 rdpa_if_lan_max
= rdpa_if_lan21
,
275 #endif /* PON Platforms */
277 rdpa_if_lag0
, /**< Physical emac0 port */
278 rdpa_if_lag1
, /**< Physical emac1 port */
279 rdpa_if_lag2
, /**< Physical emac2 port */
280 rdpa_if_lag3
, /**< Physical emac3 port */
281 rdpa_if_lag4
, /**< Physical emac4 port */
282 rdpa_if_lag_max
= rdpa_if_lag4
,
284 /** Switch aggregate port */
285 rdpa_if_switch
, /**< LAN switch port */
288 /** CPU ports for WLAN usage (local termination) */
290 rdpa_if_cpu_first
= rdpa_if_wlan0
,
292 rdpa_if_wlan_last
= rdpa_if_wlan1
,
293 /** CPU (local termination) */
294 rdpa_if_cpu
, /**< CPU port (local termination) */
296 rdpa_if_max_mcast_port
= rdpa_if_cpu
, /* only above ports could be part of mcast egress port mask */
298 /** Wi-Fi logical ports (SSIDs) */
299 rdpa_if_ssid0
, /**< Wi-Fi: SSID0 */
300 rdpa_if_ssid1
, /**< Wi-Fi: SSID1 */
301 rdpa_if_ssid2
, /**< Wi-Fi: SSID2 */
302 rdpa_if_ssid3
, /**< Wi-Fi: SSID3 */
303 rdpa_if_ssid4
, /**< Wi-Fi: SSID4 */
304 rdpa_if_ssid5
, /**< Wi-Fi: SSID5 */
305 rdpa_if_ssid6
, /**< Wi-Fi: SSID6 */
306 rdpa_if_ssid7
, /**< Wi-Fi: SSID7 */
307 rdpa_if_ssid8
, /**< Wi-Fi: SSID8 */
308 rdpa_if_ssid9
, /**< Wi-Fi: SSID9 */
309 rdpa_if_ssid10
, /**< Wi-Fi: SSID10 */
310 rdpa_if_ssid11
, /**< Wi-Fi: SSID11 */
311 rdpa_if_ssid12
, /**< Wi-Fi: SSID12 */
312 rdpa_if_ssid13
, /**< Wi-Fi: SSID13 */
313 rdpa_if_ssid14
, /**< Wi-Fi: SSID14 */
314 rdpa_if_ssid15
, /**< Wi-Fi: SSID15 */
315 rdpa_if_cpu_last
= rdpa_if_ssid15
,
317 /** CPU ports (local termination) */
318 rdpa_if_cpu0
, /**< CPU0 port (local termination) */
319 rdpa_if_cpu_first
= rdpa_if_cpu0
,
320 rdpa_if_cpu
= rdpa_if_cpu0
,
321 rdpa_if_max_mcast_port
= rdpa_if_cpu
, /* only above ports could be part of mcast egress port mask */
322 rdpa_if_cpu1
, /**< CPU1 port (local termination) */
323 rdpa_if_cpu2
, /**< CPU2 port (local termination) */
324 rdpa_if_cpu3
, /**< CPU3 port (local termination) */
325 rdpa_if_wlan0
, /**< CPU port (local termination) reserved for WLAN0 */
326 rdpa_if_wlan1
, /**< CPU port (local termination) reserved for WLAN1 */
327 rdpa_if_wlan2
, /**< CPU port (local termination) reserved for WLAN2 */
328 rdpa_if_wlan_last
= rdpa_if_wlan2
,
329 rdpa_if_cpu_last
= rdpa_if_wlan2
,
332 rdpa_if_bond0
, /**< Virtual Port bonding interface 0 */
333 rdpa_if_bond1
, /**< Virtual Port bonding interface 1 */
334 rdpa_if_bond2
, /**< Virtual Port bonding interface 2 */
335 rdpa_if_bond_max
= rdpa_if_bond2
,
336 rdpa_if_any
, /**< Any Port */
341 rdpa_if_none
/**< No port */
368 rdpa_emac0
, /**< EMAC0 */
369 rdpa_emac1
, /**< EMAC1 */
370 rdpa_emac2
, /**< EMAC2 */
371 rdpa_emac3
, /**< EMAC3 */
372 rdpa_emac4
, /**< EMAC4 */
373 rdpa_emac5
, /**< EMAC5 */
374 rdpa_emac6
, /**< EMAC6 */
375 rdpa_emac7
, /**< EMAC7 */
376 rdpa_emac__num_of
, /* Max number of EMACs */
377 rdpa_emac_none
, /**< Indicates virtual port */
383 rdpa_emac_mode_sgmii
, /**< SGMII */
384 rdpa_emac_mode_hisgmii
, /**< HISGMII */
385 rdpa_emac_mode_qsgmii
, /**< QSGMII */
386 rdpa_emac_mode_ss_smii
, /**< SS SMII */
387 rdpa_emac_mode_rgmii
, /**< RGMII */
388 rdpa_emac_mode_mii
, /**< MII */
389 rdpa_emac_mode_tmii
, /**< TMII */
391 rdpa_emac_mode__num_of
, /* Number of EMAC modes */
398 rdpa_emac_rate_10m
, /**< 10 Mbps */
399 rdpa_emac_rate_100m
, /**< 100 Mbps */
400 rdpa_emac_rate_1g
, /**< 1 Gbps */
401 rdpa_emac_rate_2_5g
, /**< 2.5 Gbps */
403 rdpa_emac_rate__num_of
, /* Number of rates */
406 /** EMAC configuration */
409 char loopback
; /**< 1 = line loopback */
410 rdpa_emac_rate rate
; /**< EMAC rate */
411 char generate_crc
; /**< 1 = generate CRC */
412 char full_duplex
; /**< 1 = full duplex */
413 char pad_short
; /**< 1 = pad short frames */
414 char allow_too_long
;/**< 1 = allow long frames */
415 char check_length
; /**< 1 = check frame length */
416 uint32_t preamble_length
; /**< Preamble length */
417 uint32_t back2back_gap
; /**< Back2Back inter-packet gap */
418 uint32_t non_back2back_gap
; /**< Non Back2Back inter-packet gap */
419 uint32_t min_interframe_gap
; /**< Min inter-frame gap */
420 char rx_flow_control
;/**< 1 = enable RX flow control */
421 char tx_flow_control
;/**< 1 = enable TX flow control */
424 /** RX RMON counters.
425 * Underlying type for emac_rx_stat aggregate type.
429 uint32_t byte
; /**< Receive Byte Counter */
430 uint32_t packet
; /**< Receive Packet Counter */
431 uint32_t frame_64
; /**< Receive 64 Byte Frame Counter */
432 uint32_t frame_65_127
; /**< Receive 65 to 127 Byte Frame Counter */
433 uint32_t frame_128_255
; /**< Receive 128 to 255 Byte Frame Counter */
434 uint32_t frame_256_511
; /**< Receive 256 to 511 Byte Frame Counter */
435 uint32_t frame_512_1023
; /**< Receive 512 to 1023 Byte Frame Counter */
436 uint32_t frame_1024_1518
; /**< Receive 1024 to 1518 Byte Frame Counter */
437 uint32_t frame_1519_mtu
; /**< Receive 1519 to MTU Frame Counter */
438 uint32_t multicast_packet
; /**< Receive Multicast Packet */
439 uint32_t broadcast_packet
; /**< Receive Broadcast Packet */
440 uint32_t unicast_packet
; /**< Receive Unicast Packet */
441 uint32_t alignment_error
; /**< Receive Alignment error */
442 uint32_t frame_length_error
;/**< Receive Frame Length Error Counter */
443 uint32_t code_error
; /**< Receive Code Error Counter */
444 uint32_t carrier_sense_error
;/**< Receive Carrier sense error */
445 uint32_t fcs_error
; /**< Receive FCS Error Counter */
446 uint32_t control_frame
; /**< Receive Control Frame Counter */
447 uint32_t pause_control_frame
;/**< Receive Pause Control Frame */
448 uint32_t unknown_opcode
; /**< Receive Unknown opcode */
449 uint32_t undersize_packet
; /**< Receive Undersize Packet */
450 uint32_t oversize_packet
; /**< Receive Oversize Packet */
451 uint32_t fragments
; /**< Receive Fragments */
452 uint32_t jabber
; /**< Receive Jabber counter */
453 uint32_t overflow
; /**< Receive Overflow counter */
454 } rdpa_emac_rx_stat_t
;
456 /** Tx RMON counters.
457 * Underlying type for emac_tx_stat aggregate type.
461 uint32_t byte
; /**< Transmit Byte Counter */
462 uint32_t packet
; /**< Transmit Packet Counter */
463 uint32_t frame_64
; /**< Transmit 64 Byte Frame Counter */
464 uint32_t frame_65_127
; /**< Transmit 65 to 127 Byte Frame Counter */
465 uint32_t frame_128_255
; /**< Transmit 128 to 255 Byte Frame Counter */
466 uint32_t frame_256_511
; /**< Transmit 256 to 511 Byte Frame Counter */
467 uint32_t frame_512_1023
; /**< Transmit 512 to 1023 Byte Frame Counter */
468 uint32_t frame_1024_1518
; /**< Transmit 1024 to 1518 Byte Frame Counter */
469 uint32_t frame_1519_mtu
; /**< Transmit 1519 to MTU Frame Counter */
470 uint32_t fcs_error
; /**< Transmit FCS Error */
471 uint32_t multicast_packet
; /**< Transmit Multicast Packet */
472 uint32_t broadcast_packet
; /**< Transmit Broadcast Packet */
473 uint32_t unicast_packet
; /**< Transmit Unicast Packet */
474 uint32_t excessive_collision
; /**< Transmit Excessive collision counter */
475 uint32_t late_collision
; /**< Transmit Late collision counter */
476 uint32_t single_collision
; /**< Transmit Single collision frame counter */
477 uint32_t multiple_collision
;/**< Transmit Multiple collision frame counter */
478 uint32_t total_collision
; /**< Transmit Total Collision Counter */
479 uint32_t pause_control_frame
; /**< Transmit PAUSE Control Frame */
480 uint32_t deferral_packet
; /**< Transmit Deferral Packet */
481 uint32_t excessive_deferral_packet
; /**< Transmit Excessive Deferral Packet */
482 uint32_t jabber_frame
; /**< Transmit Jabber Frame */
483 uint32_t control_frame
; /**< Transmit Control Frame */
484 uint32_t oversize_frame
; /**< Transmit Oversize Frame counter */
485 uint32_t undersize_frame
; /**< Transmit Undersize Frame */
486 uint32_t fragments_frame
; /**< Transmit Fragments Frame counter */
487 uint32_t error
; /**< Transmission errors*/
488 uint32_t underrun
; /**< Transmission underrun */
489 } rdpa_emac_tx_stat_t
;
491 /** Emac statistics */
494 rdpa_emac_rx_stat_t rx
; /**< Emac Receive Statistics */
495 rdpa_emac_tx_stat_t tx
; /**< Emac Transmit Statistics */
499 * A combination of \ref rdpa_emac_id constants.
501 typedef unsigned int rdpa_emacs
;
504 * \param[in] __emac EMAC
505 * \return EMAC - Mask representation
507 static inline rdpa_emacs
rdpa_emac_id(rdpa_emac __emac
)
509 return 1 << (__emac
);
513 * A combination of \ref rdpa_if_id constants.
515 typedef uint64_t rdpa_ports
__attribute__((aligned(8)));
517 /** RDPA interface (port) mask.
518 * Can be combined in rdpa_ports mask to specify multiple ports in the same operation.
519 * \param[in] __if Interface
520 * \return Interface - Mask representation
522 static inline rdpa_ports
rdpa_if_id(rdpa_if __if
)
524 return 1LL << (__if
);
528 #define RDPA_PORT_ALL_WAN (rdpa_if_id(rdpa_if_wan0) | rdpa_if_id(rdpa_if_wan1) | rdpa_if_id(rdpa_if_wan2))
530 /** Check if interface is WAN interface
531 * \param[in] __if Interface
532 * \return 1 WAN, 0 otherwise
534 static inline int rdpa_if_is_wan(rdpa_if __if
)
536 return (RDPA_PORT_ALL_WAN
& rdpa_if_id(__if
)) ? 1 : 0;
539 /** Map a given WAN type to the corresponding WAN interface per the platform support.
540 * \param[in] __wan WAN type
541 * \return Interface (rdpa_if_wan0/1/2) or rdpa_if_none if wan_type is not supported on the platform
543 static inline rdpa_if
rdpa_wan_type_to_if(rdpa_wan_type __wan
)
545 #if defined(CONFIG_BCM63146)
548 return (rdpa_if_wan0
);
550 return (rdpa_if_wan1
);
552 return (rdpa_if_none
);
554 #else /* PON Platforms */
557 case rdpa_wan_xgpon
:
559 case rdpa_wan_xepon
:
560 return (rdpa_if_wan0
);
562 #ifdef CONFIG_MULTI_WAN_SUPPORT
563 return (rdpa_if_wan1
);
565 return (rdpa_if_wan0
);
568 return (rdpa_if_none
);
570 #endif /* PON Platforms */
575 #define RDPA_PORT_ALL_LOOKUP_PORTS \
576 (rdpa_if_id(rdpa_if_wan0) | rdpa_if_id(rdpa_if_lan0) | rdpa_if_id(rdpa_if_lan1) | rdpa_if_id(rdpa_if_lan2) | \
577 rdpa_if_id(rdpa_if_lan3) | rdpa_if_id(rdpa_if_lan4))
581 #define RDPA_PORT_ALL_LAN_MACS \
582 (rdpa_if_id(rdpa_if_lan0) | rdpa_if_id(rdpa_if_lan1) | rdpa_if_id(rdpa_if_lan2) | \
583 rdpa_if_id(rdpa_if_lan3) | rdpa_if_id(rdpa_if_lan4) | rdpa_if_id(rdpa_if_lan5) | \
584 rdpa_if_id(rdpa_if_lan6) | rdpa_if_id(rdpa_if_lan7) | rdpa_if_id(rdpa_if_lan8) | \
585 rdpa_if_id(rdpa_if_lan9) | rdpa_if_id(rdpa_if_lan10) | rdpa_if_id(rdpa_if_lan11) | \
586 rdpa_if_id(rdpa_if_lan12) | rdpa_if_id(rdpa_if_lan13) | rdpa_if_id(rdpa_if_lan14) | \
587 rdpa_if_id(rdpa_if_lan15) | rdpa_if_id(rdpa_if_lan16) | rdpa_if_id(rdpa_if_lan17) | \
588 rdpa_if_id(rdpa_if_lan18) | rdpa_if_id(rdpa_if_lan19) | rdpa_if_id(rdpa_if_lan20) | \
589 rdpa_if_id(rdpa_if_lan21) | rdpa_if_id(rdpa_if_lan22) | rdpa_if_id(rdpa_if_lan23) | \
590 rdpa_if_id(rdpa_if_lan24) | rdpa_if_id(rdpa_if_lan25) | rdpa_if_id(rdpa_if_lan26) | \
591 rdpa_if_id(rdpa_if_lan27) | rdpa_if_id(rdpa_if_lan28) | rdpa_if_id(rdpa_if_lan29))
592 #elif defined(BCM_DSL_RDP) || defined(BCM_DSL_XRDP)
593 #define RDPA_PORT_ALL_LAN_MACS \
594 (rdpa_if_id(rdpa_if_lan0) | rdpa_if_id(rdpa_if_lan1) | rdpa_if_id(rdpa_if_lan2) | \
595 rdpa_if_id(rdpa_if_lan3) | rdpa_if_id(rdpa_if_lan4) | rdpa_if_id(rdpa_if_lan5) | \
596 rdpa_if_id(rdpa_if_lan6) | rdpa_if_id(rdpa_if_lan7))
598 #define RDPA_PORT_ALL_LAN_MACS \
599 (rdpa_if_id(rdpa_if_lan0) | rdpa_if_id(rdpa_if_lan1) | rdpa_if_id(rdpa_if_lan2) | \
600 rdpa_if_id(rdpa_if_lan3) | rdpa_if_id(rdpa_if_lan4) | rdpa_if_id(rdpa_if_lan5) | \
601 rdpa_if_id(rdpa_if_lan6) | rdpa_if_id(rdpa_if_lan7) | rdpa_if_id(rdpa_if_lan8) | \
602 rdpa_if_id(rdpa_if_lan9) | rdpa_if_id(rdpa_if_lan10) | rdpa_if_id(rdpa_if_lan11) | \
603 rdpa_if_id(rdpa_if_lan12) | rdpa_if_id(rdpa_if_lan13) | rdpa_if_id(rdpa_if_lan14) | \
604 rdpa_if_id(rdpa_if_lan15) | rdpa_if_id(rdpa_if_lan16) | rdpa_if_id(rdpa_if_lan17) | \
605 rdpa_if_id(rdpa_if_lan18) | rdpa_if_id(rdpa_if_lan19) | rdpa_if_id(rdpa_if_lan20) | \
606 rdpa_if_id(rdpa_if_lan21))
609 /** All physical ports */
610 #define RDPA_PORT_LAG_AND_SWITCH_PORTS \
611 (rdpa_if_id(rdpa_if_lag0) | rdpa_if_id(rdpa_if_lag1) | rdpa_if_id(rdpa_if_lag2) | \
612 rdpa_if_id(rdpa_if_lag3) | rdpa_if_id(rdpa_if_lag4) | rdpa_if_id(rdpa_if_switch))
616 #define RDPA_PORT_ALL_EMACS \
617 (rdpa_emac_id(rdpa_emac0) | rdpa_emac_id(rdpa_emac1) | rdpa_emac_id(rdpa_emac2) | \
618 rdpa_emac_id(rdpa_emac3) | rdpa_emac_id(rdpa_emac4) | rdpa_emac_id(rdpa_emac5))
620 #define RDPA_PORT_ALL_EMACS \
621 (rdpa_emac_id(rdpa_emac0) | rdpa_emac_id(rdpa_emac1) | rdpa_emac_id(rdpa_emac2) | \
622 rdpa_emac_id(rdpa_emac3) | rdpa_emac_id(rdpa_emac4) | rdpa_emac_id(rdpa_emac5) |\
623 rdpa_emac_id(rdpa_emac6))
627 #define RDPA_PORT_ALL_LAN (RDPA_PORT_ALL_LAN_MACS)
628 /** All LAN ports and physical */
629 #define RDPA_PORT_ALL_LAN_AND_LAG (RDPA_PORT_ALL_LAN_MACS | RDPA_PORT_LAG_AND_SWITCH_PORTS)
631 /** Check if interface is LAN interface (LAN EMAC port or LAN switch port, not including Wi-Fi ports)
632 * \param[in] __if Interface
633 * \return 1 LAN (port or switch), 0 otherwise
635 static inline int rdpa_if_is_lan(rdpa_if __if
)
637 return (RDPA_PORT_ALL_LAN
& rdpa_if_id(__if
)) ? 1 : 0;
640 /** Check if interface is LAN interface (LAN EMAC port, not including WiFi ports)
641 * \param[in] __if Interface
642 * \return 1 LAN , 0 otherwise
644 static inline int rdpa_if_is_lan_mac(rdpa_if __if
)
646 return (RDPA_PORT_ALL_LAN_MACS
& rdpa_if_id(__if
)) ? 1 : 0;
649 /** Check if interface is LAN interface (LAN EMAC port or physical port)
650 * \param[in] __if Interface
651 * \return 1 LAN (port or phisical), 0 otherwise
653 static inline int rdpa_if_is_lan_lag_and_switch(rdpa_if __if
)
655 return (RDPA_PORT_ALL_LAN_AND_LAG
& rdpa_if_id(__if
)) ? 1 : 0;
659 /** Check if interface is LAG interface (physical port)
660 * \param[in] __if Interface
661 * \return 1 LAN (port or phisical), 0 otherwise
663 static inline int rdpa_if_is_lag_and_switch(rdpa_if __if
)
665 return (RDPA_PORT_LAG_AND_SWITCH_PORTS
& rdpa_if_id(__if
)) ? 1 : 0;
668 /** All WLAN ports */
670 #define RDPA_PORT_ALL_WLAN \
671 (rdpa_if_id(rdpa_if_wlan0) | rdpa_if_id(rdpa_if_wlan1) | rdpa_if_id(rdpa_if_wlan2))
673 #define RDPA_PORT_ALL_WLAN \
674 (rdpa_if_id(rdpa_if_wlan0) | rdpa_if_id(rdpa_if_wlan1))
677 /** Check if interface is WLAN (PCI port)
678 * \param[in] __if Interface
679 * \return 1 if WLAN port, 0 otherwise
681 static inline int rdpa_if_is_wlan(rdpa_if __if
)
683 return (RDPA_PORT_ALL_WLAN
& rdpa_if_id(__if
)) ? 1 : 0;
686 #if defined(CONFIG_BCM_PON_XRDP) || defined(BCM_DSL_XRDP)
687 #define WL_NUM_OF_SSID_PER_UNIT 16
689 #define WL_NUM_OF_SSID_PER_UNIT 8
690 #endif /* CONFIG_BCM_PON */
692 /** All Bond ports */
693 #define RDPA_PORT_ALL_BOND \
694 (rdpa_if_id(rdpa_if_bond0) | rdpa_if_id(rdpa_if_bond1) | rdpa_if_id(rdpa_if_bond2))
696 /** Check if interface is Bonded
697 * \param[in] __if Interface
698 * \return 1 if Bond port, 0 otherwise
700 static inline int rdpa_if_is_bond(rdpa_if __if
)
702 return (RDPA_PORT_ALL_BOND
& rdpa_if_id(__if
)) ? 1 : 0;
707 /** All WiFi virtual interfaces */
708 #define RDPA_PORT_ALL_SSIDS \
709 (rdpa_if_id(rdpa_if_ssid0) | rdpa_if_id(rdpa_if_ssid1) | rdpa_if_id(rdpa_if_ssid2) | rdpa_if_id(rdpa_if_ssid3) | \
710 rdpa_if_id(rdpa_if_ssid4) | rdpa_if_id(rdpa_if_ssid5) | rdpa_if_id(rdpa_if_ssid6) | rdpa_if_id(rdpa_if_ssid7) | \
711 rdpa_if_id(rdpa_if_ssid8) | rdpa_if_id(rdpa_if_ssid9) | rdpa_if_id(rdpa_if_ssid10) | rdpa_if_id(rdpa_if_ssid11) | \
712 rdpa_if_id(rdpa_if_ssid12) | rdpa_if_id(rdpa_if_ssid13) | rdpa_if_id(rdpa_if_ssid14) | rdpa_if_id(rdpa_if_ssid15))
714 /** Check if interface is Wi-Fi SSID
715 * \param[in] __if Interface
716 * \return 1 Wi-Fi SSID, 0 otherwise
718 static inline int rdpa_if_is_wifi(rdpa_if __if
)
720 return (RDPA_PORT_ALL_SSIDS
& rdpa_if_id(__if
)) ? 1 : 0;
723 static inline int rdpa_if_is_wifi(rdpa_if __if
)
725 return rdpa_if_is_wlan(__if
);
729 static inline int rdpa_if_is_cpu_port(rdpa_if __if
)
731 return __if
>= rdpa_if_cpu_first
&& __if
<= rdpa_if_cpu_last
;
734 /** Check if interface is either LAN interface (LAN EMAC port or LAN switch port) or Wi-Fi SSID
735 * \param[in] __if Interface
736 * \return 1 LAN interface or Wi-Fi SSID, 0 otherwise
738 static inline int rdpa_if_is_lan_or_wifi(rdpa_if __if
)
740 return rdpa_if_is_lan(__if
) || rdpa_if_is_wifi(__if
);
743 /** Check if interface is either LAN interface (LAN EMAC port or LAN switch port) or WLAN (PCI port)
744 * \param[in] __if Interface
745 * \return 1 LAN interface or WLAN, 0 otherwise
747 static inline int rdpa_if_is_lan_or_cpu(rdpa_if __if
)
749 return rdpa_if_is_lan(__if
) || rdpa_if_is_cpu_port(__if
);
752 /** Check if interface is CPU and not WLAN (PCI port)
753 * \param[in] __if Interface
754 * \return 1 if pure CPU, 0 otherwise
756 static inline int rdpa_if_is_cpu_not_wlan(rdpa_if __if
)
758 return rdpa_if_is_cpu_port(__if
) && (!rdpa_if_is_wlan(__if
));
763 #define RDPA_PORT_ALL_MACS (RDPA_PORT_ALL_LAN_MACS | RDPA_PORT_ALL_WAN)
765 /** Check if port mask contains single port
766 * \param[in] ports Port Mask
767 * \return 1 if mask contains a single port , 0 otherwise
769 static inline int rdpa_port_is_single(rdpa_ports ports
)
771 return (ports
& (ports
- 1)) == 0;
774 /** Check if port mask contains wan0 port
775 * \param[in] ports Port Mask
776 * \return 1 if mask contains a wan0 port , 0 otherwise
778 static inline int rdpa_ports_contains_wan0_if(rdpa_ports ports
)
780 return ports
& rdpa_if_id(rdpa_if_wan0
); /* FIXME - MULTI-WAN XPON */
783 /** System operation mode */
786 rdpa_method_prv
, /**< Used to configure system in Provision mode */
787 rdpa_method_fc
, /**< Used to configure system in Flow Cache mode */
788 } rdpa_operation_mode
;
790 /** IPTV entries lookup method */
793 iptv_lookup_method_mac
, /**< Perform IPTV entry lookup by MAC address (L2) */
794 iptv_lookup_method_mac_vid
, /**< Perform IPTV entry lookup by MAC address and VID (L2) */
795 iptv_lookup_method_group_ip
, /**< Perform IPTV entry lookup by Multicast Group IP address (IGMPv2/MLDv1) */
796 iptv_lookup_method_group_ip_src_ip
, /**< Perform IPTV entry lookup by Multicast Group IP and Source IP
797 addresses (IGMPv3/MLDv2). Source IP address is optional. */
798 iptv_lookup_method_group_ip_src_ip_vid
/**< Perform IPTV entry lookup by Multicast Group IP and Source IP
799 addresses and VID. Source IP address is optional. */
800 } rdpa_iptv_lookup_method
;
805 rdpa_epon_none
, /**< not EPON mode */
806 rdpa_epon_ctc
, /**< CTC OAM mode */
807 rdpa_epon_cuc
, /**< CUC OAM mode */
808 rdpa_epon_dpoe
, /**< DPOE OAM mode */
809 rdpa_epon_bcm
, /**< BCM OAM mode */
810 rdpa_epon_ctc_dyn
, /**< CTC OAM dynamic mode */
811 rdpa_epon_cuc_dyn
, /**< CUC OAM dynamic mode */
815 /** Packet offset type */
818 RDPA_OFFSET_L2
, /**< Offset of L2 header */
819 RDPA_OFFSET_L3
, /**< Offset of L3 header */
820 RDPA_OFFSET_L4
, /**< Offset of L4 header */
823 /* BPM buffer size */
826 RDPA_BPM_BUFFER_2K
= 2048,
827 RDPA_BPM_BUFFER_2_5K
= 2560,
828 RDPA_BPM_BUFFER_4K
= 4096,
829 RDPA_BPM_BUFFER_16K
= 16384,
830 } rdpa_bpm_buffer_size_t
;
832 /** WiFi Acceleration type */
835 RDPA_WL_ACCEL_NONE
= 0, /**< Acceleration disabled */
836 RDPA_WL_ACCEL_WFD
, /**< WFD Acceleration type */
837 RDPA_WL_ACCEL_DHD_OFFLOAD
/**< DHD Offload Acceleration type */
842 rdpa_ring_data
= 0, /**< Data ring */
843 rdpa_ring_recycle
= 1, /**< Recycle ring */
844 rdpa_ring_feed
= 2, /**< Feed ring */
845 rdpa_ring_cpu_tx
= 3, /**< Cpu tx PD ring */
849 rdpa_proto_filter_ipv4
,
850 rdpa_proto_filter_ipv6
,
851 rdpa_proto_filter_pppoe
,
852 rdpa_proto_filter_non_ip
,
853 rdpa_proto_filter_any
,
854 rdpa_proto_filter_last
= rdpa_proto_filter_any
,
855 } rdpa_proto_filter_t
;
857 /** Protocol Filters mask, defines allowed protocols */
859 rdpa_proto_filter_ipv4_mask
= (1 << rdpa_proto_filter_ipv4
), /**< Allow IPv4 traffic */
860 rdpa_proto_filter_ipv6_mask
= (1 << rdpa_proto_filter_ipv6
), /**< Allow IPv6 traffic */
861 rdpa_proto_filter_pppoe_mask
= (1 << rdpa_proto_filter_pppoe
), /**< Allow PPPoE traffic */
862 rdpa_proto_filter_non_ip_mask
= (1 << rdpa_proto_filter_non_ip
), /**< Allow Non-IP traffic */
863 rdpa_proto_filter_any_mask
= (1 << rdpa_proto_filter_any
), /**< Allow any traffic */
864 } rdpa_proto_filter_fields
;
866 typedef uint32_t rdpa_proto_filters_mask_t
; /**< Mask of \ref rdpa_proto_filter_fields (enabled protocols) */
868 /** @} end of types Doxygen group */
876 static inline int int2int_map(int2int_map_t
*map
, int src
, int last
)
878 for (; map
->src
!= last
&& map
->src
!= src
; map
++)
883 static inline int int2int_map_r(int2int_map_t
*map
, int src
, int last
)
885 for (; map
->src
!= last
&& map
->dest
!= src
; map
++)
898 #endif /* _RDPA_TYPES_H_ */