1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2008-2012 Freescale Semiconductor Inc.
3 * Copyright 2017-2020 NXP
6 #ifndef __FM_PORT_EXT_H
7 #define __FM_PORT_EXT_H
11 #include "fm_pcd_ext.h"
14 #include "dpaa_integration.h"
17 * @Description FM Port routines
22 * @Group lnx_ioctl_FM_grp Frame Manager Linux IOCTL API
24 * @Description FM Linux ioctls definitions and enums
30 * @Group lnx_ioctl_FM_PORT_grp FM Port
32 * @Description FM Port API
34 * The FM uses a general module called "port" to represent a Tx
35 * port (MAC), an Rx port (MAC), offline parsing flow or host
36 * command flow. There may be up to 17 (may change) ports in an
37 * FM - 5 Tx ports (4 for the 1G MACs, 1 for the 10G MAC), 5 Rx
38 * Ports, and 7 Host command/Offline parsing ports. The SW driver
39 * manages these ports as sub-modules of the FM, i.e. after an FM
40 * is initialized, its ports may be initialized and operated
43 * The port is initialized aware of its type, but other functions
44 * on a port may be indifferent to its type. When necessary, the
45 * driver verifies coherency and returns error if applicable.
47 * On initialization, user specifies the port type and it's index
48 * (relative to the port's type). Host command and Offline
49 * parsing ports share the same id range, I.e user may not
50 * initialized host command port 0 and offline parsing port 0.
56 * @Description An enum for defining port PCD modes.
57 * (Must match enum e_fm_port_pcd_support defined in
60 * This enum defines the superset of PCD engines support - i.e.
61 * not all engines have to be used, but all have to be enabled.
62 * The real flow of a specific frame depends on the PCD
63 * configuration and the frame headers and payload. Note: the
64 * first engine and the first engine after the parser (if exists)
65 * should be in order, the order is important as it will define
66 * the flow of the port. However, as for the rest engines (the
67 * ones that follows), the order is not important anymore as it
68 * is defined by the PCD graph itself.
70 typedef enum ioc_fm_port_pcd_support {
72 /**< BMI to BMI, PCD is not used */
73 , e_IOC_FM_PCD_PRS_ONLY /**< Use only Parser */
74 , e_IOC_FM_PCD_PLCR_ONLY /**< Use only Policer */
75 , e_IOC_FM_PCD_PRS_PLCR/**< Use Parser and Policer */
76 , e_IOC_FM_PCD_PRS_KG /**< Use Parser and Keygen */
77 , e_IOC_FM_PCD_PRS_KG_AND_CC
78 /**< Use Parser, Keygen and Coarse Classification */
79 , e_IOC_FM_PCD_PRS_KG_AND_CC_AND_PLCR
80 /**< Use all PCD engines */
81 , e_IOC_FM_PCD_PRS_KG_AND_PLCR
82 /**< Use Parser, Keygen and Policer */
84 /**< Use Parser and Coarse Classification */
85 , e_IOC_FM_PCD_PRS_CC_AND_PLCR
86 /**< Use Parser and Coarse Classification and Policer */
87 , e_IOC_FM_PCD_CC_ONLY
88 /**< Use only Coarse Classification */
89 } ioc_fm_port_pcd_support;
92 * @Collection FM Frame error
94 typedef uint32_t ioc_fm_port_frame_err_select_t;
95 /**< typedef for defining Frame Descriptor errors */
100 * @Description An enum for defining Dual Tx rate limiting scale.
101 * (Must match e_fm_port_dual_rate_limiter_scale_down defined in
104 typedef enum ioc_fm_port_dual_rate_limiter_scale_down {
105 e_IOC_FM_PORT_DUAL_RATE_LIMITER_NONE = 0,
106 /**< Use only single rate limiter*/
107 e_IOC_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_2,
108 /**< Divide high rate limiter by 2 */
109 e_IOC_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_4,
110 /**< Divide high rate limiter by 4 */
111 e_IOC_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_8
112 /**< Divide high rate limiter by 8 */
113 } ioc_fm_port_dual_rate_limiter_scale_down;
116 * @Description A structure for defining Tx rate limiting
117 * (Must match struct t_fm_port_rate_limit defined in
120 typedef struct ioc_fm_port_rate_limit_t {
121 uint16_t max_burst_size;
122 /**< in KBytes for Tx ports, in frames for offline
123 * parsing ports. (note that for early chips burst size
124 * is rounded up to a multiply of 1000 frames).
127 /**< in Kb/sec for Tx ports, in frame/sec for offline
128 * parsing ports. Rate limit refers to data rate (rather
131 ioc_fm_port_dual_rate_limiter_scale_down rate_limit_divider;
132 /**< For offline parsing ports only. Not-valid for some
133 * earlier chip revisions
135 } ioc_fm_port_rate_limit_t;
139 * @Group lnx_ioctl_FM_PORT_runtime_control_grp FM Port Runtime Control
142 * @Description FM Port Runtime control unit API functions, definitions and
149 * @Description An enum for defining FM Port counters.
150 * (Must match enum e_fm_port_counters defined in fm_port_ext.h)
152 typedef enum ioc_fm_port_counters {
153 e_IOC_FM_PORT_COUNTERS_CYCLE, /**< BMI performance counter */
154 e_IOC_FM_PORT_COUNTERS_TASK_UTIL, /**< BMI performance counter */
155 e_IOC_FM_PORT_COUNTERS_QUEUE_UTIL, /**< BMI performance counter */
156 e_IOC_FM_PORT_COUNTERS_DMA_UTIL, /**< BMI performance counter */
157 e_IOC_FM_PORT_COUNTERS_FIFO_UTIL, /**< BMI performance counter */
158 e_IOC_FM_PORT_COUNTERS_RX_PAUSE_ACTIVATION,
159 /**< BMI Rx only performance counter */
160 e_IOC_FM_PORT_COUNTERS_FRAME, /**< BMI statistics counter */
161 e_IOC_FM_PORT_COUNTERS_DISCARD_FRAME, /**< BMI statistics counter */
162 e_IOC_FM_PORT_COUNTERS_DEALLOC_BUF,
163 /**< BMI deallocate buffer statistics counter */
164 e_IOC_FM_PORT_COUNTERS_RX_BAD_FRAME,
165 /**< BMI Rx only statistics counter */
166 e_IOC_FM_PORT_COUNTERS_RX_LARGE_FRAME,
167 /**< BMI Rx only statistics counter */
168 e_IOC_FM_PORT_COUNTERS_RX_FILTER_FRAME,
169 /**< BMI Rx & OP only statistics counter */
170 e_IOC_FM_PORT_COUNTERS_RX_LIST_DMA_ERR,
171 /**< BMI Rx, OP & HC only statistics counter */
172 e_IOC_FM_PORT_COUNTERS_RX_OUT_OF_BUFFERS_DISCARD,
173 /**< BMI Rx, OP & HC statistics counter */
174 e_IOC_FM_PORT_COUNTERS_PREPARE_TO_ENQUEUE_COUNTER,
175 /**< BMI Rx, OP & HC only statistics counter */
176 e_IOC_FM_PORT_COUNTERS_WRED_DISCARD,
177 /**< BMI OP & HC only statistics counter */
178 e_IOC_FM_PORT_COUNTERS_LENGTH_ERR,
179 /**< BMI non-Rx statistics counter */
180 e_IOC_FM_PORT_COUNTERS_UNSUPPRTED_FORMAT,
181 /**< BMI non-Rx statistics counter */
182 e_IOC_FM_PORT_COUNTERS_DEQ_TOTAL,/**< QMI total QM dequeues counter */
183 e_IOC_FM_PORT_COUNTERS_ENQ_TOTAL,/**< QMI total QM enqueues counter */
184 e_IOC_FM_PORT_COUNTERS_DEQ_FROM_DEFAULT,/**< QMI counter */
185 e_IOC_FM_PORT_COUNTERS_DEQ_CONFIRM /**< QMI counter */
186 } ioc_fm_port_counters;
188 typedef struct ioc_fm_port_bmi_stats_t {
190 uint32_t cnt_task_util;
191 uint32_t cnt_queue_util;
192 uint32_t cnt_dma_util;
193 uint32_t cnt_fifo_util;
194 uint32_t cnt_rx_pause_activation;
196 uint32_t cnt_discard_frame;
197 uint32_t cnt_dealloc_buf;
198 uint32_t cnt_rx_bad_frame;
199 uint32_t cnt_rx_large_frame;
200 uint32_t cnt_rx_filter_frame;
201 uint32_t cnt_rx_list_dma_err;
202 uint32_t cnt_rx_out_of_buffers_discard;
203 uint32_t cnt_wred_discard;
204 uint32_t cnt_length_err;
205 uint32_t cnt_unsupported_format;
206 } ioc_fm_port_bmi_stats_t;
209 * @Description Structure for Port id parameters.
210 * (Description may be inaccurate;
211 * must match struct t_fm_port_congestion_grps defined in
214 * Fields commented 'IN' are passed by the port module to be used
215 * by the FM module. Fields commented 'OUT' will be filled by FM
216 * before returning to port.
218 typedef struct ioc_fm_port_congestion_groups_t {
219 uint16_t num_of_congestion_grps_to_consider;
220 /**< The number of required congestion groups to define
221 * the size of the following array
223 uint8_t congestion_grps_to_consider[FM_NUM_CONG_GRPS];
224 /**< An array of CG indexes; Note that the size of the
225 * array should be 'num_of_congestion_grps_to_consider'.
227 bool pfc_priorities_enable[FM_NUM_CONG_GRPS][FM_MAX_PFC_PRIO];
228 /**< A matrix that represents the map between the CG ids
229 * defined in 'congestion_grps_to_consider' to the
230 * priorities mapping array.
232 } ioc_fm_port_congestion_groups_t;
236 * @Function fm_port_disable
238 * @Description Gracefully disable an FM port. The port will not start new
239 * tasks after all tasks associated with the port are terminated.
241 * @Return 0 on success; error code otherwise.
243 * @Cautions This is a blocking routine, it returns after port is
244 * gracefully stopped, i.e. the port will not except new frames,
245 * but it will finish all frames or tasks which were already
248 #define FM_PORT_IOC_DISABLE _IO(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(1))
251 * @Function fm_port_enable
253 * @Description A runtime routine provided to allow disable/enable of port.
255 * @Return 0 on success; error code otherwise.
257 #define FM_PORT_IOC_ENABLE _IO(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(2))
260 * @Function fm_port_set_rate_limit
262 * @Description Calling this routine enables rate limit algorithm.
263 * By default, this functionality is disabled.
265 * Note that rate - limit mechanism uses the FM time stamp.
266 * The selected rate limit specified here would be
267 * rounded DOWN to the nearest 16M.
269 * May be used for Tx and offline parsing ports only
271 * @Param[in] ioc_fm_port_rate_limit A structure of rate limit
274 * @Return 0 on success; error code otherwise.
276 #define FM_PORT_IOC_SET_RATE_LIMIT \
277 IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(3), ioc_fm_port_rate_limit_t)
280 * @Function fm_port_delete_rate_limit
282 * @Description Calling this routine disables the previously enabled rate
285 * May be used for Tx and offline parsing ports only
287 * @Return 0 on success; error code otherwise.
289 #define FM_PORT_IOC_DELETE_RATE_LIMIT _IO(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(5))
290 #define FM_PORT_IOC_REMOVE_RATE_LIMIT FM_PORT_IOC_DELETE_RATE_LIMIT
293 * @Function fm_port_add_congestion_grps
295 * @Description This routine effects the corresponding Tx port.
296 * It should be called in order to enable pause frame
297 * transmission in case of congestion in one or more of the
298 * congestion groups relevant to this port.
299 * Each call to this routine may add one or more congestion
300 * groups to be considered relevant to this port.
302 * May be used for Rx, or RX+OP ports only (depending on chip)
304 * @Param[in] ioc_fm_port_congestion_groups_t A pointer to an array of
305 * congestion group ids to
308 * @Return 0 on success; error code otherwise.
310 #define FM_PORT_IOC_ADD_CONGESTION_GRPS \
311 _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(34), \
312 ioc_fm_port_congestion_groups_t)
315 * @Function fm_port_remove_congestion_grps
317 * @Description This routine effects the corresponding Tx port. It should be
318 * called when congestion groups were defined for this port and
319 * are no longer relevant, or pause frames transmitting is not
320 * required on their behalf. Each call to this routine may remove
321 * one or more congestion groups to be considered relevant to
324 * May be used for Rx, or RX+OP ports only (depending on chip)
326 * @Param[in] ioc_fm_port_congestion_groups_t A pointer to an array of
327 * congestion group ids to
330 * @Return 0 on success; error code otherwise.
332 #define FM_PORT_IOC_REMOVE_CONGESTION_GRPS \
333 _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(35), \
334 ioc_fm_port_congestion_groups_t)
337 * @Function fm_port_set_errors_route
339 * @Description Errors selected for this routine will cause a frame with that
340 * error to be enqueued to error queue.
341 * Errors not selected for this routine will cause a frame with
342 * that error to be enqueued to the one of the other port queues.
343 * By default all errors are defined to be enqueued to error
344 * queue. Errors that were configured to be discarded (at
345 * initialization) may not be selected here.
347 * May be used for Rx and offline parsing ports only
349 * @Param[in] ioc_fm_port_frame_err_select_t A list of errors to
350 * enqueue to error queue
352 * @Return 0 on success; error code otherwise.
354 * @Cautions Allowed only following fm_port_config() and before
356 * (szbs001: How is it possible to have one function that needs
357 * to be called BEFORE fm_port_init() implemented as an ioctl,
358 * which will ALWAYS be called AFTER the fm_port_init() for that
359 I port!?!?!?!???!?!??!?!?)
361 #define FM_PORT_IOC_SET_ERRORS_ROUTE \
362 _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(4), \
363 ioc_fm_port_frame_err_select_t)
366 * @Group lnx_ioctl_FM_PORT_pcd_runtime_control_grp FM Port PCD Runtime
369 * @Description FM Port PCD Runtime control unit API functions, definitions
376 * @Description A structure defining the KG scheme after the parser.
377 * (Must match struct ioc_fm_pcd_kg_scheme_select_t defined in
380 * This is relevant only to change scheme selection mode - from
381 * direct to indirect and vice versa, or when the scheme is
382 * selected directly, to select the scheme id.
385 typedef struct ioc_fm_pcd_kg_scheme_select_t {
387 /**< TRUE to use 'scheme_id' directly, FALSE to use LCV.*/
389 /**< Relevant for 'direct'=TRUE only. 'scheme_id' selects the
390 * scheme after parser.
392 } ioc_fm_pcd_kg_scheme_select_t;
395 * @Description Scheme IDs structure
396 * (Must match struct ioc_fm_pcd_port_schemes_params_t defined
399 typedef struct ioc_fm_pcd_port_schemes_params_t {
401 /**< Number of schemes for port to be bound to. */
402 void *scheme_ids[FM_PCD_KG_NUM_OF_SCHEMES];
403 /**< Array of 'num_schemes' schemes for the port to be bound
406 } ioc_fm_pcd_port_schemes_params_t;
409 * @Description A union for defining port protocol parameters for parser
410 * (Must match union u_FmPcdHdrPrsOpts defined in fm_port_ext.h)
412 typedef union ioc_fm_pcd_hdr_prs_opts_u {
415 bool label_interpretation_enable;
416 /**< When this bit is set, the last MPLS label will be
417 * interpreted as described in HW spec table. When the bit is
418 * cleared, the parser will advance to MPLS next parse
420 ioc_net_header_type next_parse;
421 /**< must be equal or higher than IPv4 */
426 uint16_t tag_protocol_id1;
427 /**< User defined Tag Protocol Identifier, to be recognized on
428 * VLAN TAG on top of 0x8100 and 0x88A8
430 uint16_t tag_protocol_id2;
431 /**< User defined Tag Protocol Identifier, to be recognized on
432 * VLAN TAG on top of 0x8100 and 0x88A8
438 bool enable_mtu_check;
439 /**< Check validity of MTU according to RFC2516 */
444 bool routing_hdr_disable;
445 /**< Disable routing header */
450 bool pad_ignore_checksum;
451 /**< TRUE to ignore pad in checksum */
456 bool pad_ignore_checksum;
457 /**< TRUE to ignore pad in checksum */
459 } ioc_fm_pcd_hdr_prs_opts_u;
462 * @Description A structure for defining each header for the parser
463 * (must match struct t_FmPcdPrsAdditionalHdrParams defined in
466 typedef struct ioc_fm_pcd_prs_additional_hdr_params_t {
467 ioc_net_header_type hdr; /**< Selected header */
468 bool err_disable; /**< TRUE to disable error indication */
469 bool soft_prs_enable;
470 /**< Enable jump to SW parser when this header is recognized by
473 uint8_t index_per_hdr;
474 /**< Normally 0, if more than one sw parser attachments exists
475 * for the same header, (in the main sw parser code) use this
476 * index to distinguish between them.
478 bool use_prs_opts; /**< TRUE to use parser options. */
479 ioc_fm_pcd_hdr_prs_opts_u prs_opts;
480 /**< A unuion according to header type, defining the parser
483 } ioc_fm_pcd_prs_additional_hdr_params_t;
486 * @Description A structure for defining port PCD parameters
487 * (Must match t_fm_portPcdPrsParams defined in fm_port_ext.h)
489 typedef struct ioc_fm_port_pcd_prs_params_t {
490 uint8_t prs_res_priv_info;
491 /**< The private info provides a method of inserting port
492 * information into the parser result. This information may be
493 * extracted by KeyGen and be used for frames distribution when
494 * a per-port distinction is required, it may also be used as a
495 * port logical id for analyzing incoming frames.
497 uint8_t parsing_offset;
498 /**< Number of bytes from beginning of packet to start parsing
500 ioc_net_header_type first_prs_hdr;
501 /**< The type of the first header axpected at 'parsing_offset'
503 bool include_in_prs_statistics;
504 /**< TRUE to include this port in the parser statistics */
505 uint8_t num_of_hdrs_with_additional_params;
506 /**< Normally 0, some headers may get special parameters */
507 ioc_fm_pcd_prs_additional_hdr_params_t
508 additional_params[IOC_FM_PCD_PRS_NUM_OF_HDRS];
509 /**< 'num_of_hdrs_with_additional_params' structures additional
510 * parameters for each header that requires them
513 /**< TRUE to configure user selection of Ethertype to indicate a
514 * VLAN tag (in addition to the TPID values 0x8100 and 0x88A8).
517 /**< extra tag to use if set_vlan_tpid1=TRUE. */
519 /**< TRUE to configure user selection of Ethertype to indicate a
520 * VLAN tag (in addition to the TPID values 0x8100 and 0x88A8).
523 /**< extra tag to use if set_vlan_tpid1=TRUE. */
524 } ioc_fm_port_pcd_prs_params_t;
527 * @Description A structure for defining coarse alassification parameters
528 * (Must match t_fm_portPcdCcParams defined in fm_port_ext.h)
530 typedef struct ioc_fm_port_pcd_cc_params_t {
531 void *cc_tree_id; /**< CC tree id */
532 } ioc_fm_port_pcd_cc_params_t;
535 * @Description A structure for defining keygen parameters
536 * (Must match t_fm_portPcdKgParams defined in fm_port_ext.h)
538 typedef struct ioc_fm_port_pcd_kg_params_t {
540 /**< Number of schemes for port to be bound to. */
541 void *scheme_ids[FM_PCD_KG_NUM_OF_SCHEMES];
542 /**< Array of 'num_schemes' schemes for the port to
546 /**< TRUE for going from parser to a specific scheme,
547 * regardless of parser result
549 void *direct_scheme_id;
550 /**< Scheme id, as returned by FM_PCD_KgSetScheme;
551 * relevant only if direct=TRUE.
553 } ioc_fm_port_pcd_kg_params_t;
556 * @Description A structure for defining policer parameters
557 * (Must match t_fm_portPcdPlcrParams defined in fm_port_ext.h)
559 typedef struct ioc_fm_port_pcd_plcr_params_t {
560 void *plcr_profile_id;
561 /**< Selected profile handle;
562 * relevant in one of the following cases:
563 * e_IOC_FM_PCD_PLCR_ONLY or
564 * e_IOC_FM_PCD_PRS_PLCR were selected, or if
565 * any flow uses a KG scheme where policer profile is not
566 * generated (bypass_plcr_profile_generation selected)
568 } ioc_fm_port_pcd_plcr_params_t;
571 * @Description A structure for defining port PCD parameters
572 * (Must match struct t_fm_portPcdParams defined in
575 typedef struct ioc_fm_port_pcd_params_t {
576 ioc_fm_port_pcd_support pcd_support;
577 /**< Relevant for Rx and offline ports only.
578 * Describes the active PCD engines for this port.
580 void *net_env_id; /**< HL Unused in PLCR only mode */
581 ioc_fm_port_pcd_prs_params_t *p_prs_params;
582 /**< Parser parameters for this port */
583 ioc_fm_port_pcd_cc_params_t *p_cc_params;
584 /**< Coarse classification parameters for this port */
585 ioc_fm_port_pcd_kg_params_t *p_kg_params;
586 /**< Keygen parameters for this port */
587 ioc_fm_port_pcd_plcr_params_t *p_plcr_params;
588 /**< Policer parameters for this port */
589 void *p_ip_reassembly_manip;
590 /**< IP Reassembly manipulation */
591 void *p_capwap_reassembly_manip;
592 /**< CAPWAP Reassembly manipulation */
593 } ioc_fm_port_pcd_params_t;
596 * @Description A structure for defining the Parser starting point
597 * (Must match struct ioc_fm_pcd_prs_start_t defined in
600 typedef struct ioc_fm_pcd_prs_start_t {
601 uint8_t parsing_offset;
602 /**< Number of bytes from beginning of packet to start parsing
604 ioc_net_header_type first_prs_hdr;
605 /**< The type of the first header axpected at 'parsing_offset'
607 } ioc_fm_pcd_prs_start_t;
610 * @Description FQID parameters structure
612 typedef struct ioc_fm_port_pcd_fqids_params_t {
614 /**< Number of fqids to be allocated for the port */
616 /**< Alignment required for this port */
618 /**< output parameter - the base fqid */
619 } ioc_fm_port_pcd_fqids_params_t;
622 * @Function FM_PORT_IOC_ALLOC_PCD_FQIDS
624 * @Description Allocates FQID's
625 * May be used for Rx and offline parsing ports only
627 * @Param[in,out] ioc_fm_port_pcd_fqids_params_t Parameters for
630 * @Return 0 on success; error code otherwise.
632 #define FM_PORT_IOC_ALLOC_PCD_FQIDS \
633 _IOWR(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(19), \
634 ioc_fm_port_pcd_fqids_params_t)
637 * @Function FM_PORT_IOC_FREE_PCD_FQIDS
639 * @Description Frees previously-allocated FQIDs
640 * May be used for Rx and offline parsing ports only
642 * @Param[in] uint32_t Base FQID of previously allocated range.
644 * @Return 0 on success; error code otherwise.
646 #define FM_PORT_IOC_FREE_PCD_FQIDS \
647 _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(19), uint32_t)
650 * @Function fm_port_set_pcd
652 * @Description Calling this routine defines the port's PCD configuration.
653 * It changes it from its default configuration which is PCD
654 * disabled (BMI to BMI) and configures it according to the
656 * May be used for Rx and offline parsing ports only
658 * @Param[in] ioc_fm_port_pcd_params_t A Structure of parameters
659 * defining the port's PCD
662 * @Return 0 on success; error code otherwise.
664 #define FM_PORT_IOC_SET_PCD \
665 _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(20), ioc_fm_port_pcd_params_t)
668 * @Function fm_port_delete_pcd
670 * @Description Calling this routine releases the port's PCD configuration.
671 * The port returns to its default configuration which is PCD
672 * disabled (BMI to BMI) and all PCD configuration is removed.
673 * May be used for Rx and offline parsing ports which are in PCD
676 * @Return 0 on success; error code otherwise.
678 #define FM_PORT_IOC_DELETE_PCD _IO(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(21))
681 * @Function fm_port_attach_pcd
683 * @Description This routine may be called after fm_port_detach_pcd was
684 * called, to return to the originally configured PCD support
685 * flow. The couple of routines are used to allow PCD
686 * configuration changes that demand that PCD will not be used
687 * while changes take place.
689 * May be used for Rx and offline parsing ports which are in PCD
692 * @Return 0 on success; error code otherwise.
694 #define FM_PORT_IOC_ATTACH_PCD _IO(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(23))
697 * @Function fm_port_detach_pcd
699 * @Description Calling this routine detaches the port from its PCD
700 * functionality. The port returns to its default flow which is
703 * May be used for Rx and offline parsing ports which are in PCD
706 * @Return 0 on success; error code otherwise.
708 #define FM_PORT_IOC_DETACH_PCD _IO(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(22))
711 * @Function fm_port_pcd_plcr_alloc_profiles
713 * @Description This routine may be called only for ports that use the Policer
714 * in order to allocate private policer profiles.
716 * @Param[in] uint16_t The number of required policer profiles
718 * @Return 0 on success; error code otherwise.
720 * @Cautions Allowed before fm_port_set_pcd() only.
722 #define FM_PORT_IOC_PCD_PLCR_ALLOC_PROFILES \
723 _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(24), uint16_t)
726 * @Function fm_port_pcd_plcr_free_profiles
728 * @Description This routine should be called for freeing private policer
731 * @Return 0 on success; error code otherwise.
733 * @Cautions Allowed before fm_port_set_pcd() only.
735 #define FM_PORT_IOC_PCD_PLCR_FREE_PROFILES \
736 _IO(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(25))
739 * @Function fm_port_pcd_kg_modify_initial_scheme
741 * @Description This routine may be called only for ports that use the keygen
742 * in order to change the initial scheme frame should be routed
743 * to.The change may be of a scheme id (in case of direct mode),
744 * from direct to indirect, or from indirect to direct -
745 * specifying the scheme id.
747 * @Param[in] ioc_fm_pcd_kg_scheme_select_t
748 * A structure of parameters for defining whether a scheme is
749 * direct/indirect, and if direct - scheme id.
751 * @Return 0 on success; error code otherwise.
753 #define FM_PORT_IOC_PCD_KG_MODIFY_INITIAL_SCHEME \
754 _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(26), \
755 ioc_fm_pcd_kg_scheme_select_t)
758 * @Function fm_port_pcd_plcr_modify_initial_profile
760 * @Description This routine may be called for ports with flows
761 * e_IOC_FM_PCD_SUPPORT_PLCR_ONLY or
762 * e_IOC_FM_PCD_SUPPORT_PRS_AND_PLCR only, to change the initial
763 * Policer profile frame should be routed to.
764 * The change may be of a profile and / or absolute / direct mode
767 * @Param[in] ioc_fm_obj_t Policer profile Id as returned from
768 * FM_PCD_PlcrSetProfile.
770 * @Return 0 on success; error code otherwise.
772 #define FM_PORT_IOC_PCD_PLCR_MODIFY_INITIAL_PROFILE \
773 _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(27), ioc_fm_obj_t)
776 * @Function fm_port_pcd_cc_modify_tree
778 * @Description This routine may be called to change this port connection to
779 * a pre - initializes coarse classification Tree.
781 * @Param[in] ioc_fm_obj_t Id of new coarse classification tree selected
784 * @Return 0 on success; error code otherwise.
786 * @Cautions Allowed only following fm_port_set_pcd() and
787 * fm_port_detach_pcd()
789 #define FM_PORT_IOC_PCD_CC_MODIFY_TREE \
790 _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(28), ioc_fm_obj_t)
793 * @Function fm_port_pcd_kg_bind_schemes
795 * @Description These routines may be called for modifying the binding of
796 * ports to schemes. The scheme itself is not added, just this
797 * specific port starts using it.
799 * @Param[in] ioc_fm_pcd_port_schemes_params_t Schemes parameters
802 * @Return 0 on success; error code otherwise.
804 * @Cautions Allowed only following fm_port_set_pcd().
806 #define FM_PORT_IOC_PCD_KG_BIND_SCHEMES \
807 _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(30), \
808 ioc_fm_pcd_port_schemes_params_t)
811 * @Function fm_port_pcd_kg_unbind_schemes
813 * @Description These routines may be called for modifying the binding of
814 * ports to schemes. The scheme itself is not removed or
815 * invalidated, just this specific port stops using it.
817 * @Param[in] ioc_fm_pcd_port_schemes_params_t Schemes parameters
820 * @Return 0 on success; error code otherwise.
822 * @Cautions Allowed only following fm_port_set_pcd().
824 #define FM_PORT_IOC_PCD_KG_UNBIND_SCHEMES \
825 _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(31), \
826 ioc_fm_pcd_port_schemes_params_t)
828 #define ENET_NUM_OCTETS_PER_ADDRESS 6
829 /**< Number of octets (8-bit bytes) in an ethernet address */
830 typedef struct ioc_fm_port_mac_addr_params_t {
831 uint8_t addr[ENET_NUM_OCTETS_PER_ADDRESS];
832 } ioc_fm_port_mac_addr_params_t;
835 * @Function FM_MAC_AddHashMacAddr
837 * @Description Add an Address to the hash table. This is for filter purpose
840 * @Param[in] ioc_fm_port_mac_addr_params_t Ethernet Mac address
842 * @Return E_OK on success; Error code otherwise.
844 * @Cautions Allowed only following FM_MAC_Init(). It is a filter only
846 * @Cautions Some address need to be filtered out in upper FM blocks.
848 #define FM_PORT_IOC_ADD_RX_HASH_MAC_ADDR \
849 _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(36), \
850 ioc_fm_port_mac_addr_params_t)
853 * @Function FM_MAC_RemoveHashMacAddr
855 * @Description Delete an Address to the hash table. This is for filter
858 * @Param[in] ioc_fm_port_mac_addr_params_t Ethernet Mac address
860 * @Return E_OK on success; Error code otherwise.
862 * @Cautions Allowed only following FM_MAC_Init().
864 #define FM_PORT_IOC_REMOVE_RX_HASH_MAC_ADDR \
865 _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(37), \
866 ioc_fm_port_mac_addr_params_t)
868 typedef struct ioc_fm_port_tx_pause_frames_t {
871 uint16_t thresh_time;
872 } ioc_fm_port_tx_pause_frames_t;
875 * @Function FM_MAC_SetTxPauseFrames
877 * @Description Enable/Disable transmission of Pause-Frames. The routine
878 * changes the default configuration: pause-time - [0xf000]
879 * threshold-time - [0]
881 * @Param[in] ioc_fm_port_tx_pause_frames_params_t
882 * A structure holding the required parameters.
884 * @Return E_OK on success; Error code otherwise.
886 * @Cautions Allowed only following FM_MAC_Init(). PFC is supported only on
887 * new mEMAC; i.e. in MACs that don't have PFC support (10G-MAC
888 * and dTSEC), user should use 'FM_MAC_NO_PFC' in the 'priority'
891 #define FM_PORT_IOC_SET_TX_PAUSE_FRAMES \
892 _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(40), \
893 ioc_fm_port_tx_pause_frames_t)
895 typedef struct ioc_fm_port_mac_statistics_t {
897 uint64_t e_stat_pkts_64;
898 /**< r-10G tr-DT 64 byte frame counter */
899 uint64_t e_stat_pkts_65_to_127;
900 /**< r-10G 65 to 127 byte frame counter */
901 uint64_t e_stat_pkts_128_to_255;
902 /**< r-10G 128 to 255 byte frame counter */
903 uint64_t e_stat_pkts_256_to_511;
904 /**< r-10G 256 to 511 byte frame counter */
905 uint64_t e_stat_pkts_512_to_1023;
906 /**< r-10G 512 to 1023 byte frame counter*/
907 uint64_t e_stat_pkts_1024_to_1518;
908 /**< r-10G 1024 to 1518 byte frame counter */
909 uint64_t e_stat_pkts_1519_to_1522;
910 /**< r-10G 1519 to 1522 byte good frame count */
912 uint64_t e_stat_fragments;
913 /**< Total number of packets that were less than 64 octets long
916 uint64_t e_stat_jabbers;
917 /**< Total number of packets longer than valid maximum length
920 uint64_t e_stat_drop_events;
921 /**< number of dropped packets due to internal errors of the MAC
922 * Client (during receive).
924 uint64_t e_stat_CRC_align_errors;
925 /**< Incremented when frames of correct length but with CRC
926 * error are received.
928 uint64_t e_stat_undersize_pkts;
929 /**< Incremented for frames under 64 bytes with a valid FCS and
930 * otherwise well formed; This count does not include range
933 uint64_t e_stat_oversize_pkts;
934 /**< Incremented for frames which exceed 1518 (non VLAN) or 1522
935 * (VLAN) and contains a valid FCS and otherwise well formed
938 uint64_t rx_stat_pause; /**< Pause MAC Control received */
939 uint64_t tx_stat_pause; /**< Pause MAC Control sent */
941 uint64_t if_in_octets; /**< Total number of byte received. */
942 uint64_t if_in_pkts; /**< Total number of packets received.*/
943 uint64_t if_in_ucast_pkts;
944 /**< Total number of unicast frame received;
945 * NOTE: this counter is not supported on dTSEC MAC
947 uint64_t if_in_mcast_pkts;
948 /**< Total number of multicast frame received*/
949 uint64_t if_in_bcast_pkts;
950 /**< Total number of broadcast frame received */
951 uint64_t if_in_discards;
952 /**< Frames received, but discarded due to problems within the
955 uint64_t if_in_errors;
956 /**< Number of frames received with error:
957 * - FIFO Overflow Error
959 * - Frame Too Long Error
961 * - The dedicated Error Code (0xfe, not a code error) was
964 uint64_t if_out_octets; /**< Total number of byte sent. */
965 uint64_t if_out_pkts; /**< Total number of packets sent .*/
966 uint64_t if_out_ucast_pkts;
967 /**< Total number of unicast frame sent;
968 * NOTE: this counter is not supported on dTSEC MAC
970 uint64_t if_out_mcast_pkts;
971 /**< Total number of multicast frame sent */
972 uint64_t if_out_bcast_pkts;
973 /**< Total number of multicast frame sent */
974 uint64_t if_out_discards;
975 /**< Frames received, but discarded due to problems within the
978 uint64_t if_out_errors;
979 /**< Number of frames transmitted with error:
980 * - FIFO Overflow Error
981 * - FIFO Underflow Error
984 } ioc_fm_port_mac_statistics_t;
987 * @Function FM_MAC_GetStatistics
989 * @Description get all MAC statistics counters
991 * @Param[out] ioc_fm_port_mac_statistics_t A structure holding the
994 * @Return E_OK on success; Error code otherwise.
996 * @Cautions Allowed only following FM_Init().
998 #define FM_PORT_IOC_GET_MAC_STATISTICS \
999 _IOR(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(41), \
1000 ioc_fm_port_mac_statistics_t)
1003 * @Function fm_port_get_bmi_counters
1005 * @Description Read port's BMI stat counters and place them into
1006 * a designated structure of counters.
1008 * @Param[in] h_fm_port A handle to a FM Port module.
1009 * @Param[out] p_bmi_stats counters structure
1011 * @Return E_OK on success; Error code otherwise.
1013 * @Cautions Allowed only following fm_port_init().
1016 #define FM_PORT_IOC_GET_BMI_COUNTERS \
1017 _IOR(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(42), ioc_fm_port_bmi_stats_t)
1019 /** @} */ /* end of lnx_ioctl_FM_PORT_pcd_runtime_control_grp group */
1020 /** @} */ /* end of lnx_ioctl_FM_PORT_runtime_control_grp group */
1022 /** @} */ /* end of lnx_ioctl_FM_PORT_grp group */
1023 /** @} */ /* end of lnx_ioctl_FM_grp group */
1027 * @Group gen_id General Drivers Utilities
1029 * @Description External routines.
1035 * @Group gen_error_id Errors, Events and Debug
1037 * @Description External routines.
1043 * The scheme below provides the bits description for error codes:
1045 * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1046 * | Reserved (should be zero) | Module ID |
1048 * 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
1052 #define ERROR_CODE(_err) ((((uint32_t)_err) & 0x0000FFFF) | __ERR_MODULE__)
1054 #define GET_ERROR_TYPE(_errcode) ((_errcode) & 0x0000FFFF)
1055 /**< Extract module code from error code (#uint32_t) */
1057 #define GET_ERROR_MODULE(_errcode) ((_errcode) & 0x00FF0000)
1058 /**< Extract error type (#e_error_type) from
1059 * error code (#uint32_t)
1062 #define RETURN_ERROR(_level, _err, _vmsg) { return ERROR_CODE(_err); }
1065 * @Description Error Type Enumeration
1067 typedef enum e_error_type {
1069 /* Never use "RETURN_ERROR" with E_OK; Use "return E_OK;"*/
1070 , E_WRITE_FAILED = EIO
1071 /**< Write access failed on memory/device.*/
1072 /* String: none, or device name.*/
1073 , E_NO_DEVICE = ENXIO
1074 /**< The associated device is not initialized.*/
1076 , E_NOT_AVAILABLE = EAGAIN
1077 /**< Resource is unavailable.*/
1078 /* String: none, unless the operation is not the main goal of
1079 * the function (in this case add resource description).
1081 , E_NO_MEMORY = ENOMEM
1082 /**< External memory allocation failed.*/
1083 /* String: description of item for which allocation failed. */
1084 , E_INVALID_ADDRESS = EFAULT
1085 /**< Invalid address.*/
1086 /* String: description of the specific violation.*/
1088 /**< Resource or module is busy.*/
1089 /* String: none, unless the operation is not the main goal
1090 * of the function (in this case add resource
1093 , E_ALREADY_EXISTS = EEXIST
1094 /**< Requested resource or item already exists.*/
1095 /* Use when resource duplication or sharing are not allowed.
1096 * String: none, unless the operation is not the main goal
1097 * of the function (in this case add item description).
1099 , E_INVALID_OPERATION = ENODEV
1100 /**< The operation/command is invalid (unrecognized).*/
1102 , E_INVALID_VALUE = EDOM
1103 /**< Invalid value.*/
1104 /* Use for non-enumeration parameters, and only when other error
1105 * types are not suitable.
1106 * String: parameter description + "(should be <attribute>)",
1107 * e.g: "Maximum Rx buffer length (should be divisible
1108 * by 8)", "Channel number (should be even)".
1110 , E_NOT_IN_RANGE = ERANGE
1111 /**< Parameter value is out of range.*/
1112 /* Don't use this error for enumeration parameters.
1113 * String: parameter description + "(should be %d-%d)",
1114 * e.g: "Number of pad characters (should be 0-15)".
1116 , E_NOT_SUPPORTED = ENOSYS
1117 /**< The function is not supported or not implemented.*/
1120 /**< The operation is not allowed in current module state.*/
1123 /**< Invalid handle of module or object.*/
1124 /* String: none, unless the function takes in more than one
1125 * handle (in this case add the handle description)
1128 /**< Invalid module ID (usually enumeration or index).*/
1129 /* String: none, unless the function takes in more than one ID
1130 * (in this case add the ID description)
1133 /**< Unexpected NULL pointer.*/
1134 /* String: pointer description.*/
1135 , E_INVALID_SELECTION
1136 /**< Invalid selection or mode.*/
1137 /* Use for enumeration values, only when other error types are
1139 * String: parameter description.
1141 , E_INVALID_COMM_MODE
1142 /**< Invalid communication mode.*/
1143 /* String: none, unless the function takes in more than one
1144 * communication mode indications (in this case add
1145 * parameter description).
1147 , E_INVALID_MEMORY_TYPE
1148 /**< Invalid memory type.*/
1149 /* String: none, unless the function takes in more than one
1150 * memory types (in this case add memory description,
1151 * e.g: "Data memory", "Buffer descriptors memory").
1154 /**< Invalid clock.*/
1155 /* String: none, unless the function takes in more than one
1156 * clocks (in this case add clock description, e.g: "Rx
1157 * clock", "Tx clock").
1160 /**< Some setting conflicts with another setting.*/
1161 /* String: description of the conflicting settings.*/
1163 /**< Non-aligned address.*/
1164 /* String: parameter description + "(should be %d-bytes
1165 * aligned)", e.g: "Rx data buffer (should be 32-bytes
1169 /**< Requested resource or item was not found.*/
1170 /* Use only when the resource/item is uniquely identified.
1171 * String: none, unless the operation is not the main goal
1172 * of the function (in this case add item description).
1175 /**< Resource is full.*/
1176 /* String: none, unless the operation is not the main goal of
1177 * the function (in this case add resource description).
1180 /**< Resource is empty.*/
1181 /* String: none, unless the operation is not the main goal of
1182 * the function (in this case add resource description).
1185 /**< Specified resource or item is already free or deleted.*/
1186 /* String: none, unless the operation is not the main goal
1187 * of the function (in this case add item description).
1190 /**< Read access failed on memory/device.*/
1191 /* String: none, or device name.*/
1193 /**< Invalid frame object (NULL handle or missing buffers).*/
1196 /**< Send operation failed on device.*/
1197 /* String: none, or device name.*/
1199 /**< Receive operation failed on device.*/
1200 /* String: none, or device name.*/
1201 , E_TIMEOUT/* = ETIMEDOUT*/
1202 /**< The operation timed out.*/
1205 , E_DUMMY_LAST /* NEVER USED */
1211 * @Group FM_grp Frame Manager API
1213 * @Description FM API functions, definitions and enums
1219 * @Group FM_PORT_grp FM Port
1221 * @Description FM Port API
1223 * The FM uses a general module called "port" to represent a Tx
1224 * port (MAC), an Rx port (MAC) or Offline Parsing port. The
1225 * number of ports in an FM varies between SOCs. The SW driver
1226 * manages these ports as sub-modules of the FM, i.e. after an FM
1227 * is initialized, its ports may be initialized and operated
1230 * The port is initialized aware of its type, but other functions
1231 * on a port may be indifferent to its type. When necessary, the
1232 * driver verifies coherence and returns error if applicable.
1234 * On initialization, user specifies the port type and it's index
1235 * (relative to the port's type) - always starting at 0.
1241 * @Description An enum for defining port PCD modes.
1242 * This enum defines the superset of PCD engines support - i.e.
1243 * not all engines have to be used, but all have to be enabled.
1244 * The real flow of a specific frame depends on the PCD
1245 * configuration and the frame headers and payload. Note: the
1246 * first engine and the first engine after the parser (if exists)
1247 * should be in order, the order is important as it will define
1248 * the flow of the port. However, as for the rest engines (the
1249 * ones that follows), the order is not important anymore as it
1250 * is defined by the PCD graph itself.
1252 typedef enum e_fm_port_pcd_support {
1253 e_FM_PORT_PCD_SUPPORT_NONE = 0
1254 /**< BMI to BMI, PCD is not used */
1255 , e_FM_PORT_PCD_SUPPORT_PRS_ONLY
1256 /**< Use only Parser */
1257 , e_FM_PORT_PCD_SUPPORT_PLCR_ONLY
1258 /**< Use only Policer */
1259 , e_FM_PORT_PCD_SUPPORT_PRS_AND_PLCR
1260 /**< Use Parser and Policer */
1261 , e_FM_PORT_PCD_SUPPORT_PRS_AND_KG
1262 /**< Use Parser and Keygen */
1263 , e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_CC
1264 /**< Use Parser, Keygen and Coarse Classification */
1265 , e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_CC_AND_PLCR
1266 /**< Use all PCD engines */
1267 , e_FM_PORT_PCD_SUPPORT_PRS_AND_KG_AND_PLCR
1268 /**< Use Parser, Keygen and Policer */
1269 , e_FM_PORT_PCD_SUPPORT_PRS_AND_CC
1270 /**< Use Parser and Coarse Classification */
1271 , e_FM_PORT_PCD_SUPPORT_PRS_AND_CC_AND_PLCR
1272 /**< Use Parser and Coarse Classification and Policer */
1273 , e_FM_PORT_PCD_SUPPORT_CC_ONLY
1274 /**< Use only Coarse Classification */
1275 #ifdef FM_CAPWAP_SUPPORT
1276 , e_FM_PORT_PCD_SUPPORT_CC_AND_KG
1277 /**< Use Coarse Classification,and Keygen */
1278 , e_FM_PORT_PCD_SUPPORT_CC_AND_KG_AND_PLCR
1279 /**< Use Coarse Classification, Keygen and Policer */
1280 #endif /* FM_CAPWAP_SUPPORT */
1281 } e_fm_port_pcd_support;
1284 * @Description Port interrupts
1286 typedef enum e_fm_port_exceptions {
1287 e_FM_PORT_EXCEPTION_IM_BUSY /**< Independent-Mode Rx-BUSY */
1288 } e_fm_port_exceptions;
1291 * @Collection General FM Port defines
1293 #define FM_PORT_PRS_RESULT_NUM_OF_WORDS 8
1294 /**< Number of 4 bytes words in parser result */
1298 * @Collection FM Frame error
1300 typedef uint32_t fm_port_frame_err_select_t;
1301 /**< typedef for defining Frame Descriptor errors */
1303 #define FM_PORT_FRM_ERR_UNSUPPORTED_FORMAT FM_FD_ERR_UNSUPPORTED_FORMAT
1304 /**< Not for Rx-Port! Unsupported Format */
1305 #define FM_PORT_FRM_ERR_LENGTH FM_FD_ERR_LENGTH
1306 /**< Not for Rx-Port! Length Error */
1307 #define FM_PORT_FRM_ERR_DMA FM_FD_ERR_DMA /**< DMA Data error */
1308 #define FM_PORT_FRM_ERR_NON_FM FM_FD_RX_STATUS_ERR_NON_FM
1309 /**< non Frame-Manager error; probably come from SEC
1310 * that was chained to FM
1313 #define FM_PORT_FRM_ERR_IPRE (FM_FD_ERR_IPR & ~FM_FD_IPR)
1315 #define FM_PORT_FRM_ERR_IPR_NCSP (FM_FD_ERR_IPR_NCSP & ~FM_FD_IPR)
1316 /**< IPR non-consistent-sp */
1318 #define FM_PORT_FRM_ERR_IPFE 0
1319 /**< Obsolete; will be removed in the future */
1321 #ifdef FM_CAPWAP_SUPPORT
1322 #define FM_PORT_FRM_ERR_CRE FM_FD_ERR_CRE
1323 #define FM_PORT_FRM_ERR_CHE FM_FD_ERR_CHE
1324 #endif /* FM_CAPWAP_SUPPORT */
1326 #define FM_PORT_FRM_ERR_PHYSICAL FM_FD_ERR_PHYSICAL
1327 /**< Rx FIFO overflow, FCS error, code error, running
1328 * disparity error (SGMII and TBI modes), FIFO parity
1329 * error. PHY Sequence error, PHY error control
1330 * character detected.
1332 #define FM_PORT_FRM_ERR_SIZE FM_FD_ERR_SIZE
1333 /**< Frame too long OR Frame size exceeds
1336 #define FM_PORT_FRM_ERR_CLS_DISCARD FM_FD_ERR_CLS_DISCARD
1337 /**< indicates a classifier "drop" operation */
1338 #define FM_PORT_FRM_ERR_EXTRACTION FM_FD_ERR_EXTRACTION
1339 /**< Extract Out of Frame */
1340 #define FM_PORT_FRM_ERR_NO_SCHEME FM_FD_ERR_NO_SCHEME
1341 /**< No Scheme Selected */
1342 #define FM_PORT_FRM_ERR_KEYSIZE_OVERFLOW FM_FD_ERR_KEYSIZE_OVERFLOW
1343 /**< Keysize Overflow */
1344 #define FM_PORT_FRM_ERR_COLOR_RED FM_FD_ERR_COLOR_RED
1345 /**< Frame color is red */
1346 #define FM_PORT_FRM_ERR_COLOR_YELLOW FM_FD_ERR_COLOR_YELLOW
1347 /**< Frame color is yellow */
1348 #define FM_PORT_FRM_ERR_ILL_PLCR FM_FD_ERR_ILL_PLCR
1349 /**< Illegal Policer Profile selected */
1350 #define FM_PORT_FRM_ERR_PLCR_FRAME_LEN FM_FD_ERR_PLCR_FRAME_LEN
1351 /**< Policer frame length error */
1352 #define FM_PORT_FRM_ERR_PRS_TIMEOUT FM_FD_ERR_PRS_TIMEOUT
1353 /**< Parser Time out Exceed */
1354 #define FM_PORT_FRM_ERR_PRS_ILL_INSTRUCT FM_FD_ERR_PRS_ILL_INSTRUCT
1355 /**< Invalid Soft Parser instruction */
1356 #define FM_PORT_FRM_ERR_PRS_HDR_ERR FM_FD_ERR_PRS_HDR_ERR
1357 /**< Header error was identified during parsing */
1358 #define FM_PORT_FRM_ERR_BLOCK_LIMIT_EXCEEDED FM_FD_ERR_BLOCK_LIMIT_EXCEEDED
1359 /**< Frame parsed beyind 256 first bytes */
1360 #define FM_PORT_FRM_ERR_PROCESS_TIMEOUT 0x00000001
1361 /**< FPM Frame Processing Timeout Exceeded */
1366 * @Group FM_PORT_init_grp FM Port Initialization Unit
1368 * @Description FM Port Initialization Unit
1374 * @Description Exceptions user callback routine, will be called upon an
1375 * exception passing the exception identification.
1377 * @Param[in] h_app User's application descriptor.
1378 * @Param[in] exception The exception.
1380 typedef void (t_fm_port_exception_callback) (t_handle h_app,
1381 e_fm_port_exceptions exception);
1384 * @Description User callback function called by driver with received data.
1385 * User provides this function. Driver invokes it.
1387 * @Param[in] h_app Application's handle originally specified to
1388 * the API Config function
1389 * @Param[in] p_data A pointer to data received
1390 * @Param[in] length length of received data
1391 * @Param[in] status receive status and errors
1392 * @Param[in] position position of buffer in frame
1393 * @Param[in] h_buf_context A handle of the user acossiated with this buffer
1395 * @Retval e_RX_STORE_RESPONSE_CONTINUE
1396 * order the driver to continue Rx operation for all ready data.
1397 * @Retval e_RX_STORE_RESPONSE_PAUSE
1398 * order the driver to stop Rx operation.
1400 typedef e_rx_store_response(t_fm_port_im_rx_store_callback) (t_handle h_app,
1405 t_handle h_buf_context);
1408 * @Description User callback function called by driver when transmit
1410 * User provides this function. Driver invokes it.
1412 * @Param[in] h_app Application's handle originally specified to
1413 * the API Config function
1414 * @Param[in] p_data A pointer to data received
1415 * @Param[in] status transmit status and errors
1416 * @Param[in] last_buffer is last buffer in frame
1417 * @Param[in] h_buf_context A handle of the user acossiated with this buffer
1419 typedef void (t_fm_port_im_tx_conf_callback) (t_handle h_app,
1422 t_handle h_buf_context);
1425 * @Description A structure for additional Rx port parameters
1427 typedef struct t_fm_port_rx_params {
1428 uint32_t err_fqid; /**< Error Queue Id. */
1429 uint32_t dflt_fqid; /**< Default Queue Id.*/
1430 uint16_t liodn_offset; /**< Port's LIODN offset. */
1431 t_fm_ext_pools ext_buf_pools;
1432 /**< Which external buffer pools are used
1433 * (up to FM_PORT_MAX_NUM_OF_EXT_POOLS), and their sizes
1435 } t_fm_port_rx_params;
1438 * @Description A structure for additional non-Rx port parameters
1440 typedef struct t_fm_port_non_rx_params {
1441 uint32_t err_fqid; /**< Error Queue Id. */
1443 /**< For Tx - Default Confirmation queue,
1444 * 0 means no Tx confirmation for processed frames.
1445 * For OP port - default Rx queue.
1447 uint32_t qm_channel;
1448 /**< QM-channel dedicated to this port; will be used by
1449 * the FM for dequeue.
1451 } t_fm_port_non_rx_params;
1454 * @Description A structure for additional Rx port parameters
1456 typedef struct t_fm_port_im_rx_tx_params {
1457 t_handle h_fm_muram;
1458 /**< A handle of the FM-MURAM partition */
1459 uint16_t liodn_offset;
1460 /**< For Rx ports only. Port's LIODN Offset. */
1461 uint8_t data_mem_id;
1462 /**< Memory partition ID for data buffers */
1463 uint32_t data_mem_attributes;
1464 /**< Memory attributes for data buffers */
1465 t_buffer_pool_info rx_pool_params;
1466 /**< For Rx ports only. */
1467 t_fm_port_im_rx_store_callback *f_rx_store;
1468 /**< For Rx ports only. */
1469 t_fm_port_im_tx_conf_callback *f_tx_conf;
1470 /**< For Tx ports only. */
1471 } t_fm_port_im_rx_tx_params;
1474 * @Description A union for additional parameters depending on port type
1476 typedef union u_fm_port_specific_params {
1477 t_fm_port_im_rx_tx_params im_rx_tx_params;
1478 /**< Rx/Tx Independent-Mode port parameter structure */
1479 t_fm_port_rx_params rx_params;
1480 /**< Rx port parameters structure */
1481 t_fm_port_non_rx_params non_rx_params;
1482 /**< Non-Rx port parameters structure */
1483 } u_fm_port_specific_params;
1486 * @Description A structure representing FM initialization parameters
1488 typedef struct t_fm_port_params {
1489 uintptr_t base_addr;
1490 /**< Virtual Address of memory mapped FM Port registers.
1493 /**< A handle to the FM object this port related to */
1494 e_fm_port_type port_type; /**< Port type */
1496 /**< Port Id - relative to type;
1497 * NOTE: When configuring Offline Parsing port for
1498 * FMANv3 devices (DPAA_VERSION 11 and higher),
1499 * it is highly recommended NOT to use port_id=0 due to
1500 * lack of HW resources on port_id=0.
1502 bool independent_mode_enable;
1503 /**< This port is Independent-Mode - Used for Rx/Tx
1506 uint16_t liodn_base;
1507 /**< Irrelevant for P4080 rev 1. LIODN base for this
1508 * port, to be used together with LIODN offset.
1510 u_fm_port_specific_params specific_params;
1511 /**< Additional parameters depending on port type. */
1513 t_fm_port_exception_callback *f_exception;
1514 /**< Relevant for IM only Callback routine to be called
1518 /**< A handle to an application layer object; This
1519 * handle will be passed by the driver upon calling the
1525 * @Function fm_port_config
1527 * @Description Creates a descriptor for the FM PORT module.
1529 * The routine returns a handle(descriptor) to the FM PORT
1530 * object. This descriptor must be passed as first parameter to
1531 * all other FM PORT function calls.
1533 * No actual initialization or configuration of FM hardware is
1534 * done by this routine.
1536 * @Param[in] p_fm_port_params Pointer to data structure of parameters
1538 * @Retval Handle to FM object, or NULL for Failure.
1540 t_handle fm_port_config(t_fm_port_params *p_fm_port_params);
1543 * @Function fm_port_init
1545 * @Description Initializes the FM PORT module by defining the software
1546 * structure and configuring the hardware registers.
1548 * @Param[in] h_fm_port - FM PORT module descriptor
1550 * @Return E_OK on success; Error code otherwise.
1552 uint32_t fm_port_init(t_handle h_fm_port);
1555 * @Function fm_port_free
1557 * @Description Frees all resources that were assigned to FM PORT module.
1559 * Calling this routine invalidates the descriptor.
1561 * @Param[in] h_fm_port - FM PORT module descriptor
1563 * @Return E_OK on success; Error code otherwise.
1565 uint32_t fm_port_free(t_handle h_fm_port);
1567 t_handle fm_port_open(t_fm_port_params *p_fm_port_params);
1568 void fm_port_close(t_handle h_fm_port);
1572 * @Group FM_PORT_advanced_init_grp FM Port Advanced Configuration
1575 * @Description Configuration functions used to change default values.
1581 * @Description enum for defining QM frame dequeue
1583 typedef enum e_fm_port_deq_type {
1584 e_FM_PORT_DEQ_TYPE1,
1585 /**< Dequeue from the SP channel - with priority precedence,
1586 * and Intra-Class Scheduling respected.
1588 e_FM_PORT_DEQ_TYPE2,
1589 /**< Dequeue from the SP channel - with active FQ precedence,
1590 * and Intra-Class Scheduling respected.
1593 /**< Dequeue from the SP channel - with active FQ precedence,
1594 * and override Intra-Class Scheduling
1596 } e_fm_port_deq_type;
1599 * @Description enum for defining QM frame dequeue
1601 typedef enum e_fm_port_deq_prefetch_option {
1602 e_FM_PORT_DEQ_NO_PREFETCH,
1603 /**< QMI performs a dequeue action for a single frame
1604 * only when a dedicated portID Tnum is waiting.
1606 e_FM_PORT_DEQ_PARTIAL_PREFETCH,
1607 /**< QMI performs a dequeue action for 3 frames
1608 * when one dedicated port_id tnum is waiting.
1610 e_FM_PORT_DEQ_FULL_PREFETCH
1611 /**< QMI performs a dequeue action for 3 frames when
1612 * no dedicated port_id tnums are waiting.
1615 } e_fm_port_deq_prefetch_option;
1618 * @Description enum for defining port default color
1620 typedef enum e_fm_port_color {
1621 e_FM_PORT_COLOR_GREEN, /**< Default port color is green */
1622 e_FM_PORT_COLOR_YELLOW, /**< Default port color is yellow */
1623 e_FM_PORT_COLOR_RED, /**< Default port color is red */
1624 e_FM_PORT_COLOR_OVERRIDE/**< Ignore color */
1628 * @Description A structure for defining Dual Tx rate limiting scale
1630 typedef enum e_fm_port_dual_rate_limiter_scale_down {
1631 e_FM_PORT_DUAL_RATE_LIMITER_NONE = 0,
1632 /**< Use only single rate limiter*/
1633 e_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_2,
1634 /**< Divide high rate limiter by 2 */
1635 e_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_4,
1636 /**< Divide high rate limiter by 4 */
1637 e_FM_PORT_DUAL_RATE_LIMITER_SCALE_DOWN_BY_8
1638 /**< Divide high rate limiter by 8 */
1639 } e_fm_port_dual_rate_limiter_scale_down;
1642 * @Description A structure for defining FM port resources
1644 typedef struct t_fm_port_rsrc {
1646 /**< Committed required resource */
1648 /**< Extra (not committed) required resource */
1652 * @Description A structure for defining Tx rate limiting
1654 typedef struct t_fm_port_rate_limit {
1655 uint16_t max_burst_size;
1656 /**< in KBytes for Tx ports, in frames for OP
1657 * ports. (note that for early chips burst size
1658 * is rounded up to a multiply of 1000 frames).
1660 uint32_t rate_limit;
1661 /**< in Kb/sec for Tx ports, in frame/sec for OP
1662 * ports. Rate limit refers to data rate
1663 * (rather than line rate).
1665 e_fm_port_dual_rate_limiter_scale_down rate_limit_divider;
1666 /**< For OP ports only. Not-valid for some
1667 * earlier chip revisions
1669 } t_fm_port_rate_limit;
1672 * @Description A structure for defining the parameters of
1673 * the Rx port performance counters
1675 typedef struct t_fm_port_performance_cnt {
1676 uint8_t task_comp_val;
1677 /**< Task compare value */
1678 uint8_t queue_comp_val;
1679 /**< Rx queue/Tx confirm queue compare value (unused for H/O) */
1680 uint8_t dma_comp_val;
1681 /**< Dma compare value */
1682 uint32_t fifo_comp_val;
1683 /**< Fifo compare value (in bytes) */
1684 } t_fm_port_performance_cnt;
1687 * @Function fm_port_config_num_of_open_dmas
1689 * @Description Calling this routine changes the max number of open DMA's
1690 * available for this port. It changes this parameter in the
1691 * internal driver data base from its default configuration
1693 * [1G-RX, 1G-TX: 1 (+1)]
1694 * [10G-RX, 10G-TX: 8 (+8)]
1696 * @Param[in] h_fm_port A handle to a FM Port module.
1697 * @Param[in] p_open_dmas A pointer to a structure of parameters defining
1698 * the open DMA allocation.
1700 * @Return E_OK on success; Error code otherwise.
1702 * @Cautions Allowed only following fm_port_config() and before
1705 uint32_t fm_port_config_num_of_open_dmas(t_handle h_fm_port,
1706 t_fm_port_rsrc *p_open_dmas);
1709 * @Function fm_port_config_num_of_tasks
1711 * @Description Calling this routine changes the max number of tasks available
1712 * for this port. It changes this parameter in the internal
1713 * driver data base from its default configuration
1715 * [1G - RX, 1G - TX : 3 ( + 2)]
1716 * [10G - RX, 10G - TX : 16 ( + 8)]
1718 * @Param[in] h_fm_port A handle to a FM Port module.
1719 * @Param[in] p_num_of_tasks A pointer to a structure of parameters
1720 * defining the tasks allocation.
1722 * @Return E_OK on success; Error code otherwise.
1724 * @Cautions Allowed only following fm_port_config() and before
1727 uint32_t fm_port_config_num_of_tasks(t_handle h_fm_port,
1728 t_fm_port_rsrc *p_num_of_tasks);
1731 * @Function fm_port_config_size_of_fifo
1733 * @Description Calling this routine changes the max FIFO size configured for
1736 * This function changes the internal driver data base from its
1737 * default configuration. Please refer to the driver's User Guide
1738 * for information on default FIFO sizes in the various devices.
1740 * [1G-RX, 1G-TX: 11KB]
1741 * [10G-RX, 10G-TX: 12KB]
1743 * @Param[in] h_fm_port A handle to a FM Port module.
1744 * @Param[in] p_size_of_fifo A pointer to a structure of parameters
1745 * defining the FIFO allocation.
1747 * @Return E_OK on success; Error code otherwise.
1749 * @Cautions Allowed only following fm_port_config() and before
1752 uint32_t fm_port_config_size_of_fifo(t_handle h_fm_port,
1753 t_fm_port_rsrc *p_size_of_fifo);
1756 * @Function fm_port_config_deq_high_priority
1758 * @Description Calling this routine changes the dequeue priority in the
1759 * internal driver data base from its default configuration
1760 * 1G: [DEFAULT_PORT_deqHighPriority_1G]
1761 * 10G: [DEFAULT_PORT_deqHighPriority_10G]
1763 * May be used for Non - Rx ports only
1765 * @Param[in] h_fm_port A handle to a FM Port module.
1766 * @Param[in] high_pri TRUE to select high priority, FALSE for normal
1769 * @Return E_OK on success; Error code otherwise.
1771 * @Cautions Allowed only following fm_port_config() and before
1774 uint32_t fm_port_config_deq_high_priority(t_handle h_fm_port, bool high_pri);
1777 * @Function fm_port_config_deq_type
1779 * @Description Calling this routine changes the dequeue type parameter in the
1780 * internal driver data base from its default configuration
1781 * [DEFAULT_PORT_deq_type].
1783 * May be used for Non - Rx ports only
1785 * @Param[in] h_fm_port A handle to a FM Port module.
1786 * @Param[in] deq_type According to QM definition.
1788 * @Return E_OK on success; Error code otherwise.
1790 * @Cautions Allowed only following fm_port_config() and before
1793 uint32_t fm_port_config_deq_type(t_handle h_fm_port,
1794 e_fm_port_deq_type deq_type);
1797 * @Function fm_port_config_deq_prefetch_option
1799 * @Description Calling this routine changes the dequeue prefetch option
1800 * parameter in the internal driver data base from its default
1801 * configuration [DEFAULT_PORT_deq_prefetch_option]
1802 * Note: Available for some chips only
1804 * May be used for Non - Rx ports only
1806 * @Param[in] h_fm_port A handle to a FM Port module.
1807 * @Param[in] deq_prefetch_option New option
1809 * @Return E_OK on success; Error code otherwise.
1811 * @Cautions Allowed only following fm_port_config() and before
1814 uint32_t fm_port_config_deq_prefetch_option(t_handle h_fm_port,
1815 e_fm_port_deq_prefetch_option deq_prefetch_option);
1818 * @Function fm_port_config_deq_byte_cnt
1820 * @Description Calling this routine changes the dequeue byte count parameter
1821 * in the internal driver data base from its default
1823 * 1G:[DEFAULT_PORT_deq_byte_cnt_1G].
1824 * 10G:[DEFAULT_PORT_deq_byte_cnt_10G].
1826 * May be used for Non - Rx ports only
1828 * @Param[in] h_fm_port A handle to a FM Port module.
1829 * @Param[in] deq_byte_cnt New byte count
1831 * @Return E_OK on success; Error code otherwise.
1833 * @Cautions Allowed only following fm_port_config() and before
1836 uint32_t fm_port_config_deq_byte_cnt(t_handle h_fm_port,
1837 uint16_t deq_byte_cnt);
1840 * @Function fm_port_config_buffer_prefix_content
1842 * @Description Defines the structure, size and content of the application
1843 * buffer. The prefix will In Tx ports, if 'pass_prs_result', the
1844 * application should set a value to their offsets in the prefix
1845 * of the FM will save the first 'priv_data_size', than,
1846 * depending on 'pass_prs_result' and 'pass_time_stamp', copy
1847 * parse result and timeStamp, and the packet itself (in this
1848 * order), to the application buffer, and to offset.
1849 * Calling this routine changes the buffer margins definitions in
1850 * the internal driver data base from its default configuration:
1851 * Data size: [DEFAULT_PORT_bufferPrefixContent_priv_data_size]
1852 * Pass Parser result:
1853 * [DEFAULT_PORT_bufferPrefixContent_pass_prs_result].
1855 * [DEFAULT_PORT_bufferPrefixContent_pass_time_stamp].
1857 * May be used for all ports
1860 * @Param[in] h_fm_port A handle to a FM Port
1862 * @Param[in,out] p_fm_buffer_prefix_content A structure of
1863 * parameters describing
1864 * the structure of the
1866 * Out parameter: Start
1867 * margin - offset of data
1868 * from start of external
1871 * @Return E_OK on success; Error code otherwise.
1873 * @Cautions Allowed only following fm_port_config() and before
1876 uint32_t fm_port_config_buffer_prefix_content(t_handle h_fm_port,
1877 t_fm_buffer_prefix_content *p_fm_buffer_prefix_content);
1880 * @Function fm_port_config_checksum_last_bytes_ignore
1882 * @Description Calling this routine changes the number of checksum bytes to
1883 * ignore parameter in the internal driver data base from its
1884 * default configuration.
1886 * May be used by Tx & Rx ports only
1888 * @Param[in] h_fm_port A handle to a FM Port module.
1889 * @Param[in] checksum_last_bytes_ignore New value
1891 * @Return E_OK on success; Error code otherwise.
1893 * @Cautions Allowed only following fm_port_config() and before
1896 uint32_t fm_port_config_checksum_last_bytes_ignore(t_handle h_fm_port,
1897 uint8_t checksum_last_bytes_ignore);
1900 * @Function fm_port_config_cut_bytes_from_end
1902 * @Description Calling this routine changes the number of bytes to cut from a
1903 * frame's end parameter in the internal driver data base
1904 * from its default configuration
1905 * [DEFAULT_PORT_cut_bytes_from_end]
1906 * Note that if the result of (frame length before chop -
1907 * cut_bytes_from_end) is less than 14 bytes, the chop operation
1910 * May be used for Rx ports only
1912 * @Param[in] h_fm_port A handle to a FM Port module.
1913 * @Param[in] cut_bytes_from_end New value
1915 * @Return E_OK on success; Error code otherwise.
1917 * @Cautions Allowed only following fm_port_config() and before
1920 uint32_t fm_port_config_cut_bytes_from_end(t_handle h_fm_port,
1921 uint8_t cut_bytes_from_end);
1924 * @Function fm_port_config_ext_buf_pools
1926 * @Description This routine should be called for OP ports that internally use
1927 * BM buffer pools. In such cases, e.g. for fragmentation and
1928 * re-assembly, the FM needs new BM buffers. By calling this
1929 * routine the user specifies the BM buffer pools that should be
1932 * Note: Available for some chips only
1934 * May be used for OP ports only
1936 * @Param[in] h_fm_port A handle to a FM Port module.
1937 * @Param[in] p_fm_ext_pools A structure of parameters for the
1940 * @Return E_OK on success; Error code otherwise.
1942 * @Cautions Allowed only following fm_port_config() and before
1945 uint32_t fm_port_config_ext_buf_pools(t_handle h_fm_port,
1946 t_fm_ext_pools *p_fm_ext_pools);
1949 * @Function fm_port_config_backup_pools
1951 * @Description Calling this routine allows the configuration of some of the
1952 * BM pools defined for this port as backup pools.
1953 * A pool configured to be a backup pool will be used only if all
1954 * other enabled non - backup pools are depleted.
1956 * May be used for Rx ports only
1958 * @Param[in] h_fm_port A handle to a FM Port module.
1959 * @Param[in] p_fm_port_backup_bm_pools An array of pool id's. All pools
1960 * specified here will be defined
1963 * @Return E_OK on success; Error code otherwise.
1965 * @Cautions Allowed only following fm_port_config() and before
1968 uint32_t fm_port_config_backup_pools(t_handle h_fm_port,
1969 t_fm_backup_bm_pools *p_fm_port_backup_bm_pools);
1972 * @Function fm_port_config_frm_discard_override
1974 * @Description Calling this routine changes the error frames destination
1975 * parameter in the internal driver data base from its default
1976 * configuration: override =[DEFAULT_PORT_frmDiscardOverride]
1978 * May be used for Rx and OP ports only
1980 * @Param[in] h_fm_port A handle to a FM Port module.
1981 * @Param[in] override TRUE to override discarding of error frames and
1982 * enqueueing them to error queue.
1984 * @Return E_OK on success; Error code otherwise.
1986 * @Cautions Allowed only following fm_port_config() and before
1989 uint32_t fm_port_config_frm_discard_override(t_handle h_fm_port,
1993 * @Function fm_port_config_errors_to_discard
1995 * @Description Calling this routine changes the behaviour on error parameter
1996 * in the internal driver data base from its default
1997 * configuration: [DEFAULT_PORT_errorsToDiscard].
1998 * If a requested error was previously defined as
1999 * "ErrorsToEnqueue" it's definition will change and the frame
2000 * will be discarded. Errors that were not defined either as
2001 * "ErrorsToEnqueue" nor as "ErrorsToDiscard", will be forwarded
2004 * May be used for Rx and OP ports only
2006 * @Param[in] h_fm_port A handle to a FM Port module.
2007 * @Param[in] errs A list of errors to discard
2009 * @Return E_OK on success; Error code otherwise.
2011 * @Cautions Allowed only following fm_port_config() and before
2014 uint32_t fm_port_config_errors_to_discard(t_handle h_fm_port,
2015 fm_port_frame_err_select_t errs);
2018 * @Function fm_port_config_dma_ic_cache_attr
2020 * @Description Calling this routine changes the internal context cache
2021 * attribute parameter in the internal driver data base
2022 * from its default configuration:
2023 * [DEFAULT_PORT_dmaIntContextCacheAttr]
2025 * May be used for all port types
2027 * @Param[in] h_fm_port A handle to a FM Port module.
2028 * @Param[in] int_context_cache_attr New selection
2030 * @Return E_OK on success; Error code otherwise.
2032 * @Cautions Allowed only following fm_port_config() and before
2035 uint32_t fm_port_config_dma_ic_cache_attr(t_handle h_fm_port,
2036 e_fm_dma_cache_option int_context_cache_attr);
2039 * @Function fm_port_config_dma_hdr_attr
2041 * @Description Calling this routine changes the header cache attribute
2042 * parameter in the internal driver data base from its default
2043 * configuration[DEFAULT_PORT_dmaHeaderCacheAttr]
2045 * May be used for all port types
2047 * @Param[in] h_fm_port A handle to a FM Port module.
2048 * @Param[in] header_cache_attr New selection
2050 * @Return E_OK on success; Error code otherwise.
2052 * @Cautions Allowed only following fm_port_config() and before
2055 uint32_t fm_port_config_dma_hdr_attr(t_handle h_fm_port,
2056 e_fm_dma_cache_option header_cache_attr);
2059 * @Function fm_port_config_dma_scatter_gather_attr
2061 * @Description Calling this routine changes the scatter gather cache
2062 * attribute parameter in the internal driver data base from its
2063 * default configuration[DEFAULT_PORT_dmaScatterGatherCacheAttr]
2065 * May be used for all port types
2067 * @Param[in] h_fm_port A handle to a FM Port module.
2068 * @Param[in] scatter_gather_cache_attr New selection
2070 * @Return E_OK on success; Error code otherwise.
2072 * @Cautions Allowed only following fm_port_config() and before
2075 uint32_t fm_port_config_dma_scatter_gather_attr(t_handle h_fm_port,
2076 e_fm_dma_cache_option scatter_gather_cache_attr);
2079 * @Function fm_port_config_dma_write_optimize
2081 * @Description Calling this routine changes the write optimization parameter
2082 * in the internal driver data base from its default
2083 * configuration : By default optimize =
2084 * [DEFAULT_PORT_dmaWriteOptimize].
2086 * 1. For head optimization, data alignment must be >= 16
2087 * (supported by default).
2089 * 2. For tail optimization, note that the optimization is
2090 * performed by extending the write transaction of the frame
2091 * payload at the tail as needed to achieve optimal bus
2092 * transfers, so that the last write is extended to be on
2093 * 16 / 64 bytes aligned block (chip dependent).
2095 * Relevant for non - Tx port types
2097 * @Param[in] h_fm_port A handle to a FM Port module.
2098 * @Param[in] optimize TRUE to enable optimization, FALSE for normal
2101 * @Return E_OK on success; Error code otherwise.
2103 * @Cautions Allowed only following fm_port_config() and before
2106 uint32_t fm_port_config_dma_write_optimize(t_handle h_fm_port,
2110 * @Function fm_port_config_no_scather_gather
2112 * @Description Calling this routine changes the no_scather_gather parameter
2113 * in internal driver data base from its default configuration.
2115 * @Param[in] h_fm_port A handle to a FM Port module.
2116 * @Param[in] no_scather_gather TRUE - frame is discarded if can not be
2117 * stored in single buffer,
2118 * FALSE - frame can be stored in scatter
2119 * gather (S / G) format.
2121 * @Return E_OK on success; Error code otherwise.
2123 * @Cautions Allowed only following fm_port_config() and before
2126 uint32_t fm_port_config_no_scather_gather(t_handle h_fm_port,
2127 bool no_scather_gather);
2130 * @Function fm_port_config_dflt_color
2132 * @Description Calling this routine changes the internal default color
2133 * parameter in the internal driver data base
2134 * from its default configuration[DEFAULT_PORT_color]
2136 * May be used for all port types
2138 * @Param[in] h_fm_port A handle to a FM Port module.
2139 * @Param[in] color New selection
2141 * @Return E_OK on success; Error code otherwise.
2143 * @Cautions Allowed only following fm_port_config() and before
2146 uint32_t fm_port_config_dflt_color(t_handle h_fm_port, e_fm_port_color color);
2149 * @Function fm_port_config_sync_req
2151 * @Description Calling this routine changes the synchronization attribute
2152 * parameter in the internal driver data base from its default
2153 * configuration: sync_req =[DEFAULT_PORT_sync_req]
2155 * May be used for all port types
2157 * @Param[in] h_fm_port A handle to a FM Port module.
2158 * @Param[in] sync_req TRUE to request synchronization, FALSE
2161 * @Return E_OK on success; Error code otherwise.
2163 * @Cautions Allowed only following fm_port_config() and before
2166 uint32_t fm_port_config_sync_req(t_handle h_fm_port, bool sync_req);
2169 * @Function fm_port_config_forward_reuse_int_context
2171 * @Description This routine is relevant for Rx ports that are routed to OP
2172 * port. It changes the internal context reuse option in the
2173 * internal driver data base from its default configuration:
2174 * reuse =[DEFAULT_PORT_forwardIntContextReuse]
2176 * May be used for Rx ports only
2178 * @Param[in] h_fm_port A handle to a FM Port module.
2179 * @Param[in] reuse TRUE to reuse internal context on frames
2180 * forwarded to OP port.
2182 * @Return E_OK on success; Error code otherwise.
2184 * @Cautions Allowed only following fm_port_config() and before
2187 uint32_t fm_port_config_forward_reuse_int_context(t_handle h_fm_port,
2191 * @Function fm_port_config_donot_release_tx_buf_to_bm
2193 * @Description This routine should be called if no Tx confirmation
2194 * is done, and yet buffers should not be released to the BM.
2196 * Normally, buffers are returned using the Tx confirmation
2197 * process. When Tx confirmation is not used (defFqid = 0),
2198 * buffers are typically released to the BM. This routine
2199 * may be called to avoid this behavior and not release the
2202 * May be used for Tx ports only
2204 * @Param[in] h_fm_port A handle to a FM Port module.
2206 * @Return E_OK on success; Error code otherwise.
2208 * @Cautions Allowed only following fm_port_config() and before
2211 uint32_t fm_port_config_donot_release_tx_buf_to_bm(t_handle h_fm_port);
2214 * @Function fm_port_config_immax_rx_buf_length
2216 * @Description Changes the maximum receive buffer length from its default
2217 * configuration: Closest rounded down power of 2 value of the
2220 * The maximum receive buffer length directly affects the
2221 * structure of received frames (single- or multi-buffered) and
2222 * the performance of both the FM and the driver.
2224 * The selection between single- or multi-buffered frames should
2225 * be done according to the characteristics of the specific
2226 * application. The recommended mode is to use a single data
2227 * buffer per packet, as this mode provides the best performance.
2228 * However, the user can select to use multiple data buffers per
2231 * @Param[in] h_fm_port A handle to a FM Port module.
2232 * @Param[in] new_val Maximum receive buffer length (in bytes).
2234 * @Return E_OK on success; Error code otherwise.
2236 * @Cautions Allowed only following fm_port_config() and before
2237 * fm_port_init(). This routine is to be used only if
2238 * Independent-Mode is enabled.
2240 uint32_t fm_port_config_immax_rx_buf_length(t_handle h_fm_port,
2244 * @Function fm_port_config_imrx_bd_ring_length
2246 * @Description Changes the receive BD ring length from its default
2247 * configuration:[DEFAULT_PORT_rxBdRingLength]
2249 * @Param[in] h_fm_port A handle to a FM Port module.
2250 * @Param[in] new_val The desired BD ring length.
2252 * @Return E_OK on success; Error code otherwise.
2254 * @Cautions Allowed only following fm_port_config() and before
2255 * fm_port_init(). This routine is to be used only if
2256 * Independent-Mode is enabled.
2258 uint32_t fm_port_config_imrx_bd_ring_length(t_handle h_fm_port,
2262 * @Function fm_port_config_imtx_bd_ring_length
2264 * @Description Changes the transmit BD ring length from its default
2265 * configuration:[DEFAULT_PORT_txBdRingLength]
2267 * @Param[in] h_fm_port A handle to a FM Port module.
2268 * @Param[in] new_val The desired BD ring length.
2270 * @Return E_OK on success; Error code otherwise.
2272 * @Cautions Allowed only following fm_port_config() and before
2273 * fm_port_init(). This routine is to be used only if
2274 * Independent-Mode is enabled.
2276 uint32_t fm_port_config_imtx_bd_ring_length(t_handle h_fm_port,
2280 * @Function fm_port_config_imfman_ctrl_external_structs_memory
2282 * @Description Configures memory partition and attributes for FMan-Controller
2283 * data structures (e.g. BD rings).
2284 * Calling this routine changes the internal driver data base
2285 * from its default configuration
2286 * [DEFAULT_PORT_ImfwExtStructsMemId,
2287 * DEFAULT_PORT_ImfwExtStructsMemAttr].
2289 * @Param[in] h_fm_port A handle to a FM Port module.
2290 * @Param[in] mem_id Memory partition ID.
2291 * @Param[in] mem_attributes Memory attributes mask (a combination of
2292 * MEMORY_ATTR_x flags).
2294 * @Return E_OK on success; Error code otherwise.
2296 uint32_t fm_port_config_imfman_ctrl_external_structs_memory(t_handle h_fm_port,
2298 uint32_t mem_attributes);
2301 * @Function fm_port_config_impolling
2303 * @Description Changes the Rx flow from interrupt driven (default) to
2306 * @Param[in] h_fm_port A handle to a FM Port module.
2308 * @Return E_OK on success; Error code otherwise.
2310 * @Cautions Allowed only following fm_port_config() and before
2312 * This routine is to be used only if Independent-Mode is
2315 uint32_t fm_port_config_impolling(t_handle h_fm_port);
2318 * @Function fm_port_config_max_frame_length
2320 * @Description Changes the definition of the max size of frame that should be
2321 * transmitted/received on this port from its default value
2322 * [DEFAULT_PORT_maxFrameLength].
2323 * This parameter is used for confirmation of the minimum Fifo
2324 * size calculations and only for Tx ports or ports working in
2325 * independent mode. This should be larger than the maximum
2326 * possible MTU that will be used for this port (i.e. its MAC).
2328 * @Param[in] h_fm_port A handle to a FM Port module.
2329 * @Param[in] length Max size of frame
2331 * @Return E_OK on success; Error code otherwise.
2333 * @Cautions Allowed only following fm_port_config() and before
2334 * fm_port_init(). This routine is to be used only if
2335 * Independent-Mode is enabled.
2337 uint32_t fm_port_config_max_frame_length(t_handle h_fm_port,
2341 * @Function fm_port_config_tx_fifo_min_fill_level
2343 * @Description Calling this routine changes the fifo minimum fill level
2344 * parameter in the internal driver data base from its default
2345 * configuration[DEFAULT_PORT_txFifoMinFillLevel]
2347 * May be used for Tx ports only
2349 * @Param[in] h_fm_port A handle to a FM Port module.
2350 * @Param[in] min_fill_level New value
2352 * @Return E_OK on success; Error code otherwise.
2354 * @Cautions Allowed only following fm_port_config() and before
2357 uint32_t fm_port_config_tx_fifo_min_fill_level(t_handle h_fm_port,
2358 uint32_t min_fill_level);
2361 * @Function fm_port_config_fifo_deq_pipeline_depth
2363 * @Description Calling this routine changes the fifo dequeue pipeline depth
2364 * parameter in the internal driver data base
2366 * from its default configuration :
2367 * 1G ports : [DEFAULT_PORT_fifoDeqPipelineDepth_1G],
2368 * 10G port : [DEFAULT_PORT_fifoDeqPipelineDepth_10G],
2369 * OP port : [DEFAULT_PORT_fifoDeqPipelineDepth_OH]
2371 * May be used for Tx / OP ports only
2373 * @Param[in] h_fm_port A handle to a FM Port module.
2374 * @Param[in] deq_pipeline_depth New value
2376 * @Return E_OK on success; Error code otherwise.
2378 * @Cautions Allowed only following fm_port_config() and before
2381 uint32_t fm_port_config_fifo_deq_pipeline_depth(t_handle h_fm_port,
2382 uint8_t deq_pipeline_depth);
2385 * @Function fm_port_config_tx_fifo_low_comf_level
2387 * @Description Calling this routine changes the fifo low comfort level
2388 * parameter in internal driver data base from its default
2389 * configuration[DEFAULT_PORT_txFifoLowComfLevel]
2391 * May be used for Tx ports only
2393 * @Param[in] h_fm_port A handle to a FM Port module.
2394 * @Param[in] fifo_low_comf_level New value
2396 * @Return E_OK on success; Error code otherwise.
2398 * @Cautions Allowed only following fm_port_config() and before
2401 uint32_t fm_port_config_tx_fifo_low_comf_level(t_handle h_fm_port,
2402 uint32_t fifo_low_comf_level);
2405 * @Function fm_port_config_rx_fifo_threshold
2407 * @Description Calling this routine changes the threshold of the FIFO fill
2408 * level parameter in the internal driver data base from its
2409 * default configuration[DEFAULT_PORT_rxFifoThreshold]
2411 * If the total number of buffers which are currently in use and
2412 * associated with the specific RX port exceed this threshold,
2413 * the BMI will signal the MAC to send a pause frame over the
2416 * May be used for Rx ports only
2418 * @Param[in] h_fm_port A handle to a FM Port module.
2419 * @Param[in] fifo_threshold New value
2421 * @Return E_OK on success; Error code otherwise.
2423 * @Cautions Allowed only following fm_port_config() and before
2426 uint32_t fm_port_config_rx_fifo_threshold(t_handle h_fm_port,
2427 uint32_t fifo_threshold);
2430 * @Function fm_port_config_rx_fifo_pri_elevation_level
2432 * @Description Calling this routine changes the priority elevation level
2433 * parameter in the internal driver data base from its default
2434 * configuration[DEFAULT_PORT_rxFifoPriElevationLevel]
2436 * If the total number of buffers which are currently in use and
2437 * associated with the specific RX port exceed the amount
2438 * specified in pri_elevation_level, BMI will signal the main
2439 * FM's DMA to elevate the FM priority on the system bus.
2441 * May be used for Rx ports only
2443 * @Param[in] h_fm_port A handle to a FM Port module.
2444 * @Param[in] pri_elevation_level New value
2446 * @Return E_OK on success; Error code otherwise.
2448 * @Cautions Allowed only following fm_port_config() and before
2451 uint32_t fm_port_config_rx_fifo_pri_elevation_level(t_handle h_fm_port,
2452 uint32_t pri_elevation_level);
2454 #ifdef FM_HEAVY_TRAFFIC_HANG_ERRATA_FMAN_A005669
2456 * @Function fm_port_config_bcbworkaround
2458 * @Description Configures BCB errata workaround.
2460 * When BCB errata is applicable, the workaround is always
2461 * performed by FM Controller. Thus, this function does not
2462 * actually enable errata workaround but rather allows driver to
2463 * perform adjustments required due to errata workaround
2464 * execution in FM controller.
2466 * Applying BCB workaround also configures
2467 * FM_PORT_FRM_ERR_PHYSICAL errors to be discarded. Thus
2468 * FM_PORT_FRM_ERR_PHYSICAL can't be set by
2469 * fm_port_set_errors_route() function.
2471 * @Param[in] h_fm_port A handle to a FM Port module.
2473 * @Return E_OK on success; Error code otherwise.
2475 * @Cautions Allowed only following fm_port_config() and before
2478 uint32_t fm_port_config_bcbworkaround(t_handle h_fm_port);
2479 #endif /* FM_HEAVY_TRAFFIC_HANG_ERRATA_FMAN_A005669 */
2482 * @Function fm_port_config_internal_buff_offset
2484 * @Description Configures internal buffer offset.
2486 * May be used for Rx and OP ports only
2488 * @Param[in] h_fm_port A handle to a FM Port module.
2489 * @Param[in] val New value
2491 * @Return E_OK on success; Error code otherwise.
2493 * @Cautions Allowed only following fm_port_config() and before
2496 uint32_t fm_port_config_internal_buff_offset(t_handle h_fm_port, uint8_t val);
2498 /** @} */ /* end of FM_PORT_advanced_init_grp group */
2499 /** @} */ /* end of FM_PORT_init_grp group */
2502 * @Group FM_PORT_runtime_control_grp FM Port Runtime Control Unit
2504 * @Description FM Port Runtime control unit API functions, definitions and
2511 * @Description enum for defining FM Port counters
2513 typedef enum e_fm_port_counters {
2514 e_FM_PORT_COUNTERS_CYCLE, /**< BMI performance counter */
2515 e_FM_PORT_COUNTERS_TASK_UTIL, /**< BMI performance counter */
2516 e_FM_PORT_COUNTERS_QUEUE_UTIL, /**< BMI performance counter */
2517 e_FM_PORT_COUNTERS_DMA_UTIL, /**< BMI performance counter */
2518 e_FM_PORT_COUNTERS_FIFO_UTIL, /**< BMI performance counter */
2519 e_FM_PORT_COUNTERS_RX_PAUSE_ACTIVATION,
2520 /**< BMI Rx only performance counter */
2521 e_FM_PORT_COUNTERS_FRAME, /**< BMI statistics counter */
2522 e_FM_PORT_COUNTERS_DISCARD_FRAME, /**< BMI statistics counter */
2523 e_FM_PORT_COUNTERS_DEALLOC_BUF,
2524 /**< BMI deallocate buffer statistics counter */
2525 e_FM_PORT_COUNTERS_RX_BAD_FRAME,
2526 /**< BMI Rx only statistics counter */
2527 e_FM_PORT_COUNTERS_RX_LARGE_FRAME,
2528 /**< BMI Rx only statistics counter */
2529 e_FM_PORT_COUNTERS_RX_FILTER_FRAME,
2530 /**< BMI Rx & OP only statistics counter */
2531 e_FM_PORT_COUNTERS_RX_LIST_DMA_ERR,
2532 /**< BMI Rx, OP & HC only statistics counter */
2533 e_FM_PORT_COUNTERS_RX_OUT_OF_BUFFERS_DISCARD,
2534 /**< BMI Rx, OP & HC statistics counter */
2535 e_FM_PORT_COUNTERS_PREPARE_TO_ENQUEUE_COUNTER,
2536 /**< BMI Rx, OP & HC only statistics counter */
2537 e_FM_PORT_COUNTERS_WRED_DISCARD,
2538 /**< BMI OP & HC only statistics counter */
2539 e_FM_PORT_COUNTERS_LENGTH_ERR,
2540 /**< BMI non-Rx statistics counter */
2541 e_FM_PORT_COUNTERS_UNSUPPRTED_FORMAT,
2542 /**< BMI non-Rx statistics counter */
2543 e_FM_PORT_COUNTERS_DEQ_TOTAL, /**< QMI total QM dequeues counter */
2544 e_FM_PORT_COUNTERS_ENQ_TOTAL, /**< QMI total QM enqueues counter */
2545 e_FM_PORT_COUNTERS_DEQ_FROM_DEFAULT, /**< QMI counter */
2546 e_FM_PORT_COUNTERS_DEQ_CONFIRM /**< QMI counter */
2547 } e_fm_port_counters;
2549 typedef struct t_fm_port_bmi_stats {
2551 uint32_t cnt_task_util;
2552 uint32_t cnt_queue_util;
2553 uint32_t cnt_dma_util;
2554 uint32_t cnt_fifo_util;
2555 uint32_t cnt_rx_pause_activation;
2557 uint32_t cnt_discard_frame;
2558 uint32_t cnt_dealloc_buf;
2559 uint32_t cnt_rx_bad_frame;
2560 uint32_t cnt_rx_large_frame;
2561 uint32_t cnt_rx_filter_frame;
2562 uint32_t cnt_rx_list_dma_err;
2563 uint32_t cnt_rx_out_of_buffers_discard;
2564 uint32_t cnt_wred_discard;
2565 uint32_t cnt_length_err;
2566 uint32_t cnt_unsupported_format;
2567 } t_fm_port_bmi_stats;
2570 * @Description Structure for Port id parameters.
2571 * Fields commented 'IN' are passed by the port module to be used
2573 * Fields commented 'OUT' will be filled by FM before returning
2576 typedef struct t_fm_port_congestion_grps {
2577 uint16_t num_of_congestion_grps_to_consider;
2578 /**< The number of required CGs to define the size of
2579 * the following array
2581 uint8_t congestion_grps_to_consider[FM_NUM_CONG_GRPS];
2582 /**< An array of CG indexes; Note that the size of the
2583 * array should be 'num_of_congestion_grps_to_consider'.
2585 bool pfc_prio_enable[FM_NUM_CONG_GRPS][FM_MAX_PFC_PRIO];
2586 /**< a matrix that represents the map between the CG ids
2587 * defined in 'congestion_grps_to_consider' to the
2588 * priorties mapping array.
2590 } t_fm_port_congestion_grps;
2593 #if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
2595 * @Function fm_port_dump_regs
2597 * @Description Dump all regs.
2599 * Calling this routine invalidates the descriptor.
2601 * @Param[in] h_fm_port FM PORT module descriptor
2603 * @Return E_OK on success; Error code otherwise.
2605 * @Cautions Allowed only following fm_port_init().
2607 uint32_t fm_port_dump_regs(t_handle h_fm_port);
2608 #endif /* (defined(DEBUG_ERRORS) && ... */
2611 * @Function fm_port_get_buffer_data_offset
2613 * @Description Relevant for Rx ports. Returns the data offset from the
2614 * beginning of the data buffer
2616 * @Param[in] h_fm_port FM PORT module descriptor
2618 * @Return data offset.
2620 * @Cautions Allowed only following fm_port_init().
2622 uint32_t fm_port_get_buffer_data_offset(t_handle h_fm_port);
2625 * @Function fm_port_get_buffer_icinfo
2627 * @Description Returns the Internal Context offset from the beginning of the
2630 * @Param[in] h_fm_port FM PORT module descriptor
2631 * @Param[in] p_data A pointer to the data buffer.
2633 * @Return Internal context info pointer on success, NULL if
2634 * 'allOtherInfo' was not configured for this port.
2636 * @Cautions Allowed only following fm_port_init().
2638 uint8_t *fm_port_get_buffer_icinfo(t_handle h_fm_port, char *p_data);
2641 * @Function fm_port_get_buffer_prs_result
2643 * @Description Returns the pointer to the parse result in the data buffer.
2644 * In Rx ports this is relevant after reception, if parse result
2645 * is configured to be part of the data passed to the
2646 * application. For non Rx ports it may be used to get the
2647 * pointer of the area in the buffer where parse result should be
2648 * initialized - if so configured.
2649 * See fm_port_config_buffer_prefix_content for data buffer
2650 * prefix configuration.
2652 * @Param[in] h_fm_port FM PORT module descriptor
2653 * @Param[in] p_data A pointer to the data buffer.
2655 * @Return Parse result pointer on success, NULL if parse result was not
2656 * configured for this port.
2658 * @Cautions Allowed only following fm_port_init().
2660 t_fm_prs_result *fm_port_get_buffer_prs_result(t_handle h_fm_port,
2664 * @Function fm_port_get_buffer_time_stamp
2666 * @Description Returns the time stamp in the data buffer.
2667 * Relevant for Rx ports for getting the buffer time stamp.
2668 * See fm_port_config_buffer_prefix_content for data buffer
2669 * prefix configuration.
2671 * @Param[in] h_fm_port FM PORT module descriptor
2672 * @Param[in] p_data A pointer to the data buffer.
2674 * @Return A pointer to the hash result on success, NULL otherwise.
2676 * @Cautions Allowed only following fm_port_init().
2678 uint64_t *fm_port_get_buffer_time_stamp(t_handle h_fm_port, char *p_data);
2681 * @Function fm_port_get_buffer_hash_result
2683 * @Description Given a data buffer, on the condition that hash result was
2684 * defined as a part of the buffer content(see
2685 * fm_port_config_buffer_prefix_content) this routine will return
2686 * the pointer to the hash result location in the buffer prefix.
2688 * @Param[in] h_fm_port FM PORT module descriptor
2689 * @Param[in] p_data A pointer to the data buffer.
2691 * @Return A pointer to the hash result on success, NULL otherwise.
2693 * @Cautions Allowed only following fm_port_init().
2695 uint8_t *fm_port_get_buffer_hash_result(t_handle h_fm_port, char *p_data);
2698 * @Function fm_port_disable
2700 * @Description Gracefully disable an FM port. The port will not start new
2701 * tasks after all tasks associated with the port are terminated.
2703 * @Param[in] h_fm_port A handle to a FM Port module.
2705 * @Return E_OK on success; Error code otherwise.
2707 * @Cautions Allowed only following fm_port_init().
2708 * This is a blocking routine, it returns after port is
2709 * gracefully stopped, i.e. the port will not except new frames,
2710 * but it will finish all frames or tasks which were already
2713 uint32_t fm_port_disable(t_handle h_fm_port);
2716 * @Function fm_port_enable
2718 * @Description A runtime routine provided to allow disable/enable of port.
2720 * @Param[in] h_fm_port A handle to a FM Port module.
2722 * @Return E_OK on success; Error code otherwise.
2724 * @Cautions Allowed only following fm_port_init().
2726 uint32_t fm_port_enable(t_handle h_fm_port);
2729 * @Function fm_port_set_rate_limit
2731 * @Description Calling this routine enables rate limit algorithm.
2732 * By default, this functionality is disabled.
2734 * Note that rate - limit mechanism uses the FM time stamp.
2735 * The selected rate limit specified here would be
2736 * rounded DOWN to the nearest 16M.
2738 * May be used for Tx and OP ports only
2740 * @Param[in] h_fm_port A handle to a FM Port module.
2741 * @Param[in] p_rate_limit A structure of rate limit parameters
2743 * @Return E_OK on success; Error code otherwise.
2745 * @Cautions Allowed only following fm_port_init(). If rate limit is set
2746 * on a port that need to send PFC frames, it might violate the
2747 * stop transmit timing.
2749 uint32_t fm_port_set_rate_limit(t_handle h_fm_port,
2750 t_fm_port_rate_limit *p_rate_limit);
2753 * @Function fm_port_delete_rate_limit
2755 * @Description Calling this routine disables and clears rate limit
2758 * May be used for Tx and OP ports only
2760 * @Param[in] h_fm_port A handle to a FM Port module.
2762 * @Return E_OK on success; Error code otherwise.
2764 * @Cautions Allowed only following fm_port_init().
2766 uint32_t fm_port_delete_rate_limit(t_handle h_fm_port);
2769 * @Function fm_port_set_pfc_priorities_mapping_to_qman_wq
2771 * @Description Calling this routine maps each PFC received priority to the
2772 * transmit WQ. This WQ will be blocked upon receiving a PFC
2773 * frame with this priority.
2775 * May be used for Tx ports only.
2777 * @Param[in] h_fm_port A handle to a FM Port module.
2778 * @Param[in] prio PFC priority (0 - 7).
2779 * @Param[in] wq Work Queue (0 - 7).
2781 * @Return E_OK on success; Error code otherwise.
2783 * @Cautions Allowed only following fm_port_init().
2785 uint32_t fm_port_set_pfc_priorities_mapping_to_qman_wq(t_handle h_fm_port,
2786 uint8_t prio, uint8_t wq);
2789 * @Function fm_port_set_statistics_counters
2791 * @Description Calling this routine enables/disables port's statistics
2792 * counters. By default, counters are enabled.
2794 * May be used for all port types
2796 * @Param[in] h_fm_port A handle to a FM Port module.
2797 * @Param[in] enable TRUE to enable, FALSE to disable.
2799 * @Return E_OK on success; Error code otherwise.
2801 * @Cautions Allowed only following fm_port_init().
2803 uint32_t fm_port_set_statistics_counters(t_handle h_fm_port, bool enable);
2806 * @Function fm_port_set_frame_queue_counters
2808 * @Description Calling this routine enables/disables port's enqueue/dequeue
2809 * counters. By default, counters are enabled.
2811 * May be used for all ports
2813 * @Param[in] h_fm_port A handle to a FM Port module.
2814 * @Param[in] enable TRUE to enable, FALSE to disable.
2816 * @Return E_OK on success; Error code otherwise.
2818 * @Cautions Allowed only following fm_port_init().
2820 uint32_t fm_port_set_frame_queue_counters(t_handle h_fm_port,
2824 * @Function fm_port_analyze_performance_params
2826 * @Description User may call this routine to so the driver will analyze if
2827 * the basic performance parameters are correct and also the
2828 * driver may suggest of improvements; The basic parameters are
2829 * FIFO sizes, number of DMAs and number of TNUMs for the port.
2831 * May be used for all port types
2833 * @Param[in] h_fm_port A handle to a FM Port module.
2835 * @Return E_OK on success; Error code otherwise.
2837 * @Cautions Allowed only following fm_port_init().
2839 uint32_t fm_port_analyze_performance_params(t_handle h_fm_port);
2842 * @Function fm_port_set_alloc_buf_counter
2844 * @Description Calling this routine enables/disables BM pool allocate
2846 * By default, counters are enabled.
2848 * May be used for Rx ports only
2850 * @Param[in] h_fm_port A handle to a FM Port module.
2851 * @Param[in] pool_id BM pool id.
2852 * @Param[in] enable TRUE to enable, FALSE to disable.
2854 * @Return E_OK on success; Error code otherwise.
2856 * @Cautions Allowed only following fm_port_init().
2858 uint32_t fm_port_set_alloc_buf_counter(t_handle h_fm_port,
2859 uint8_t pool_id, bool enable);
2862 * @Function fm_port_get_bmi_counters
2864 * @Description Read port's BMI stat counters and place them into
2865 * a designated structure of counters.
2867 * @Param[in] h_fm_port A handle to a FM Port module.
2868 * @Param[out] p_bmi_stats counters structure
2870 * @Return E_OK on success; Error code otherwise.
2872 * @Cautions Allowed only following fm_port_init().
2874 uint32_t fm_port_get_bmi_counters(t_handle h_fm_port,
2875 t_fm_port_bmi_stats *p_bmi_stats);
2878 * @Function fm_port_get_counter
2880 * @Description Reads one of the FM PORT counters.
2882 * @Param[in] h_fm_port A handle to a FM Port module.
2883 * @Param[in] fm_port_counter The requested counter.
2885 * @Return Counter's current value.
2887 * @Cautions Allowed only following fm_port_init().
2888 * Note that it is user's responsibility to call this routine
2889 * only for enabled counters, and there will be no indication if
2890 * a disabled counter is accessed.
2892 uint32_t fm_port_get_counter(t_handle h_fm_port,
2893 e_fm_port_counters fm_port_counter);
2896 * @Function fm_port_modify_counter
2898 * @Description Sets a value to an enabled counter. Use "0" to reset the
2901 * @Param[in] h_fm_port A handle to a FM Port module.
2902 * @Param[in] fm_port_counter The requested counter.
2903 * @Param[in] value The requested value to be written into
2906 * @Return E_OK on success; Error code otherwise.
2908 * @Cautions Allowed only following fm_port_init().
2910 uint32_t fm_port_modify_counter(t_handle h_fm_port,
2911 e_fm_port_counters fm_port_counter, uint32_t value);
2914 * @Function fm_port_get_alloc_buf_counter
2916 * @Description Reads one of the FM PORT buffer counters.
2918 * @Param[in] h_fm_port A handle to a FM Port module.
2919 * @Param[in] pool_id The requested pool.
2921 * @Return Counter's current value.
2923 * @Cautions Allowed only following fm_port_init().
2924 * Note that it is user's responsibility to call this routine
2925 * only for enabled counters, and there will be no indication if
2926 * a disabled counter is accessed.
2928 uint32_t fm_port_get_alloc_buf_counter(t_handle h_fm_port,
2932 * @Function fm_port_modify_alloc_buf_counter
2934 * @Description Sets a value to an enabled counter. Use "0" to reset the
2937 * @Param[in] h_fm_port A handle to a FM Port module.
2938 * @Param[in] pool_id The requested pool.
2939 * @Param[in] value The requested value to be written into the
2942 * @Return E_OK on success; Error code otherwise.
2944 * @Cautions Allowed only following fm_port_init().
2946 uint32_t fm_port_modify_alloc_buf_counter(t_handle h_fm_port,
2947 uint8_t pool_id, uint32_t value);
2950 * @Function fm_port_add_congestion_grps
2952 * @Description This routine effects the corresponding Tx port.
2953 * It should be called in order to enable pause
2954 * frame transmission in case of congestion in one or more
2955 * of the congestion groups relevant to this port.
2956 * Each call to this routine may add one or more congestion
2957 * groups to be considered relevant to this port.
2959 * May be used for Rx, or RX + OP ports only (depending on chip)
2961 * @Param[in] h_fm_port A handle to a FM Port module.
2962 * @Param[in] p_congestion_grps A pointer to an array of congestion
2963 * groups id's to consider.
2965 * @Return E_OK on success; Error code otherwise.
2967 * @Cautions Allowed only following fm_port_init().
2969 uint32_t fm_port_add_congestion_grps(t_handle h_fm_port,
2970 t_fm_port_congestion_grps *p_congestion_grps);
2973 * @Function fm_port_remove_congestion_grps
2975 * @Description This routine effects the corresponding Tx port. It should be
2976 * called when congestion groups were defined for this port and
2977 * are no longer relevant, or pause frames transmitting is not
2978 * required on their behalf.
2979 * Each call to this routine may remove one or more congestion
2980 * groups to be considered relevant to this port.
2982 * May be used for Rx, or RX + OP ports only (depending on chip)
2984 * @Param[in] h_fm_port A handle to a FM Port module.
2985 * @Param[in] p_congestion_grps A pointer to an array of congestion
2986 * groups id's to consider.
2988 * @Return E_OK on success; Error code otherwise.
2990 * @Cautions Allowed only following fm_port_init().
2992 uint32_t fm_port_remove_congestion_grps(t_handle h_fm_port,
2993 t_fm_port_congestion_grps *p_congestion_grps);
2996 * @Function fm_port_is_stalled
2998 * @Description A routine for checking whether the specified port is stalled.
3000 * @Param[in] h_fm_port A handle to a FM Port module.
3002 * @Return TRUE if port is stalled, FALSE otherwise
3004 * @Cautions Allowed only following fm_port_init().
3006 bool fm_port_is_stalled(t_handle h_fm_port);
3009 * @Function fm_port_release_stalled
3011 * @Description This routine may be called in case the port was stalled and
3012 * may now be released.
3013 * Note that this routine is available only on older FMan
3014 * revisions (FMan v2, DPAA v1.0 only).
3016 * @Param[in] h_fm_port A handle to a FM Port module.
3018 * @Return E_OK on success; Error code otherwise.
3020 * @Cautions Allowed only following fm_port_init().
3022 uint32_t fm_port_release_stalled(t_handle h_fm_port);
3025 * @Function fm_port_set_rx_l4checksum_verify
3027 * @Description This routine is relevant for Rx ports (1G and 10G). The
3028 * routine set / clear the L3 / L4 checksum verification (on RX
3029 * side). Note that this takes affect only if hw - parser is
3032 * @Param[in] h_fm_port A handle to a FM Port module.
3033 * @Param[in] l_4checksum boolean indicates whether to do L3/L4 checksum
3036 * @Return E_OK on success; Error code otherwise.
3038 * @Cautions Allowed only following fm_port_init().
3040 uint32_t fm_port_set_rx_l4checksum_verify(t_handle h_fm_port,
3044 * @Function fm_port_set_errors_route
3046 * @Description Errors selected for this routine will cause a frame with that
3047 * error to be enqueued to error queue.
3048 * Errors not selected for this routine will cause a frame with
3049 * that error to be enqueued to the one of the other port queues.
3050 * By default all errors are defined to be enqueued to error
3051 * queue. Errors that were configured to be discarded(at
3052 * initialization) may not be selected here.
3054 * May be used for Rx and OP ports only
3056 * @Param[in] h_fm_port A handle to a FM Port module.
3057 * @Param[in] errs A list of errors to enqueue to error queue
3059 * @Return E_OK on success; Error code otherwise.
3061 * @Cautions Allowed only following fm_port_config() and before
3064 uint32_t fm_port_set_errors_route(t_handle h_fm_port,
3065 fm_port_frame_err_select_t errs);
3068 * @Function fm_port_set_imexceptions
3070 * @Description Calling this routine enables/disables FM PORT interrupts.
3072 * @Param[in] h_fm_port FM PORT module descriptor.
3073 * @Param[in] exception The exception to be selected.
3074 * @Param[in] enable TRUE to enable interrupt, FALSE to mask it.
3076 * @Return E_OK on success; Error code otherwise.
3078 * @Cautions Allowed only following fm_port_init().
3079 * This routine should NOT be called from guest-partition
3080 * (i.e. guestId != NCSW_PRIMARY_ID)
3082 uint32_t fm_port_set_imexceptions(t_handle h_fm_port,
3083 e_fm_port_exceptions exception, bool enable);
3086 * @Function fm_port_set_performance_counters
3088 * @Description Calling this routine enables/disables port's performance
3089 * counters. By default, counters are enabled.
3091 * May be used for all port types
3093 * @Param[in] h_fm_port A handle to a FM Port module.
3094 * @Param[in] enable TRUE to enable, FALSE to disable.
3096 * @Return E_OK on success; Error code otherwise.
3098 * @Cautions Allowed only following fm_port_init().
3100 uint32_t fm_port_set_performance_counters(t_handle h_fm_port,
3104 * @Function fm_port_set_performance_counters_params
3106 * @Description Calling this routine defines port's performance counters
3109 * May be used for all port types
3111 * @Param[in] h_fm_port A handle to a FM Port module.
3112 * @Param[in] p_fm_port_performance_cnt A pointer to a structure of
3113 * performance counters parameters.
3115 * @Return E_OK on success; Error code otherwise.
3117 * @Cautions Allowed only following fm_port_init().
3119 uint32_t fm_port_set_performance_counters_params(t_handle h_fm_port,
3120 t_fm_port_performance_cnt *p_fm_port_performance_cnt);
3123 * @Group FM_PORT_pcd_runtime_control_grp
3124 * FM Port PCD Runtime Control Unit
3126 * @Description FM Port PCD Runtime control unit API functions, definitions
3129 * @Function fm_port_set_pcd
3131 * @Description Calling this routine defines the port's PCD configuration. It
3132 * changes it from its default configuration which is PCD
3133 * disabled (BMI to BMI) and configures it according to the
3134 * passed parameters.
3136 * May be used for Rx and OP ports only
3138 * @Param[in] h_fm_port A handle to a FM Port module.
3139 * @Param[in] p_fm_port_pcd A Structure of parameters defining the port's
3140 * PCD configuration.
3142 * @Return E_OK on success; Error code otherwise.
3144 * @Cautions Allowed only following fm_port_init().
3146 uint32_t fm_port_set_pcd(t_handle h_fm_port,
3147 ioc_fm_port_pcd_params_t *p_fm_port_pcd);
3150 * @Function fm_port_delete_pcd
3152 * @Description Calling this routine releases the port's PCD configuration.
3153 * The port returns to its default configuration which is PCD
3154 * disabled (BMI to BMI) and all PCD configuration is removed.
3156 * May be used for Rx and OP ports which are in PCD mode only
3158 * @Param[in] h_fm_port A handle to a FM Port module.
3160 * @Return E_OK on success; Error code otherwise.
3162 * @Cautions Allowed only following fm_port_init().
3164 uint32_t fm_port_delete_pcd(t_handle h_fm_port);
3167 * @Function fm_port_attach_pcd
3169 * @Description This routine may be called after fm_port_detach_pcd was
3170 * called, to return to the originally configured PCD support
3171 * flow. The couple of routines are used to allow PCD
3172 * configuration changes that demand that PCD will not be used
3173 * while changes take place.
3175 * May be used for Rx and OP ports which are in PCD mode only
3177 * @Param[in] h_fm_port A handle to a FM Port module.
3179 * @Return E_OK on success; Error code otherwise.
3181 * @Cautions Allowed only following fm_port_init().
3183 uint32_t fm_port_attach_pcd(t_handle h_fm_port);
3186 * @Function fm_port_detach_pcd
3188 * @Description Calling this routine detaches the port from its PCD
3189 * functionality. The port returns to its default flow which is
3192 * May be used for Rx and OP ports which are in PCD mode only
3194 * @Param[in] h_fm_port A handle to a FM Port module.
3196 * @Return E_OK on success; Error code otherwise.
3198 * @Cautions Allowed only following fm_port_attach_pcd().
3200 uint32_t fm_port_detach_pcd(t_handle h_fm_port);
3203 * @Function fm_port_pcd_plcr_alloc_profiles
3205 * @Description This routine may be called only for ports that use the Policer
3206 * in order to allocate private policer profiles.
3208 * @Param[in] h_fm_port A handle to a FM Port module.
3209 * @Param[in] num_of_profiles The number of required policer profiles
3211 * @Return E_OK on success; Error code otherwise.
3213 * @Cautions Allowed only following fm_port_init() and fm_pcd_init(), and
3214 * before fm_port_set_pcd().
3216 uint32_t fm_port_pcd_plcr_alloc_profiles(t_handle h_fm_port,
3217 uint16_t num_of_profiles);
3220 * @Function fm_port_pcd_plcr_free_profiles
3222 * @Description This routine should be called for freeing private policer
3225 * @Param[in] h_fm_port A handle to a FM Port module.
3227 * @Return E_OK on success; Error code otherwise.
3229 * @Cautions Allowed only following fm_port_init() and fm_pcd_init(), and
3230 * before fm_port_set_pcd().
3232 uint32_t fm_port_pcd_plcr_free_profiles(t_handle h_fm_port);
3235 * @Function fm_port_pcd_kg_modify_initial_scheme
3237 * @Description This routine may be called only for ports that use the keygen
3238 * in order to change the initial scheme frame should be routed
3239 * to. The change may be of a scheme id(in case of direct mode),
3240 * from direct to indirect, or from indirect to direct -
3241 * specifying the scheme id.
3243 * @Param[in] h_fm_port A handle to a FM Port module.
3244 * @Param[in] p_fm_pcd_kg_scheme A structure of parameters for defining
3245 * whether a scheme is direct / indirect,
3246 * and if direct - scheme id.
3248 * @Return E_OK on success; Error code otherwise.
3250 * @Cautions Allowed only following fm_port_init() and fm_port_set_pcd().
3252 uint32_t fm_port_pcd_kg_modify_initial_scheme(t_handle h_fm_port,
3253 ioc_fm_pcd_kg_scheme_select_t *p_fm_pcd_kg_scheme);
3256 * @Function fm_port_pcd_plcr_modify_initial_profile
3258 * @Description This routine may be called for ports with flows
3259 * e_FM_PORT_PCD_SUPPORT_PLCR_ONLY or
3260 * e_FM_PORT_PCD_SUPPORT_PRS_AND_PLCR only, to change the initial
3261 * Policer profile frame should be routed to. The change may be
3262 * of a profile and / or absolute / direct mode selection.
3264 * @Param[in] h_fm_port A handle to a FM Port module.
3265 * @Param[in] h_profile Policer profile handle
3267 * @Return E_OK on success; Error code otherwise.
3269 * @Cautions Allowed only following fm_port_init() and fm_port_set_pcd().
3271 uint32_t fm_port_pcd_plcr_modify_initial_profile(t_handle h_fm_port,
3272 t_handle h_profile);
3275 * @Function fm_port_pcd_cc_modify_tree
3277 * @Description This routine may be called for ports that use coarse
3278 * classification tree if the user wishes to replace the tree.
3279 * The routine may not be called while port receives packets
3280 * using the PCD functionalities, therefore port must be first
3281 * detached from the PCD, only than the routine may be called,
3282 * and than port be attached to PCD again.
3284 * @Param[in] h_fm_port A handle to a FM Port module.
3285 * @Param[in] h_cc_tree A CC tree that was already built. The tree id as
3286 * returned from the BuildTree routine.
3288 * @Return E_OK on success; Error code otherwise.
3290 * @Cautions Allowed only following fm_port_init(), fm_port_set_pcd() and
3291 * fm_port_detach_pcd()
3293 uint32_t fm_port_pcd_cc_modify_tree(t_handle h_fm_port, t_handle h_cc_tree);
3296 * @Function fm_port_pcd_kg_bind_schemes
3298 * @Description These routines may be called for adding more schemes for the
3299 * port to be bound to. The selected schemes are not added, just
3300 * this specific port starts using them.
3302 * @Param[in] h_fm_port A handle to a FM Port module.
3303 * @Param[in] p_port_scheme A structure defining the list of schemes
3306 * @Return E_OK on success; Error code otherwise.
3308 * @Cautions Allowed only following fm_port_init() and fm_port_set_pcd().
3310 uint32_t fm_port_pcd_kg_bind_schemes(t_handle h_fm_port,
3311 ioc_fm_pcd_port_schemes_params_t *p_port_scheme);
3314 * @Function fm_port_pcd_kg_unbind_schemes
3316 * @Description These routines may be called for adding more schemes for the
3317 * port to be bound to. The selected schemes are not removed or
3318 * invalidated, just this specific port stops using them.
3320 * @Param[in] h_fm_port A handle to a FM Port module.
3321 * @Param[in] p_port_scheme A structure defining the list of schemes
3324 * @Return E_OK on success; Error code otherwise.
3326 * @Cautions Allowed only following fm_port_init() and fm_port_set_pcd().
3328 uint32_t fm_port_pcd_kg_unbind_schemes(t_handle h_fm_port,
3329 ioc_fm_pcd_port_schemes_params_t *p_port_scheme);
3332 * @Function fm_port_get_ipv_4options_count
3336 * @Param[in] h_fm_port A handle to a FM Port module.
3337 * @Param[out] p_ipv_4options_count will hold the counter value
3339 * @Return E_OK on success; Error code otherwise.
3341 * @Cautions Allowed only following fm_port_init()
3343 uint32_t fm_port_get_ipv_4options_count(t_handle h_fm_port,
3344 uint32_t *p_ipv_4options_count);
3346 /** @} */ /* end of FM_PORT_pcd_runtime_control_grp group */
3347 /** @} */ /* end of FM_PORT_runtime_control_grp group */
3348 /** @} */ /* end of FM_PORT_grp group */
3349 /** @} */ /* end of FM_grp group */
3350 #endif /* __FM_PORT_EXT_H */