dpdk/drivers/net/dpaa/fmlib/fm_port_ext.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: BSD-3-Clause
   2 * Copyright 2008-2012 Freescale Semiconductor Inc.
   3 * Copyright 2017-2020 NXP
   4 */
   5
   6#ifndef __FM_PORT_EXT_H
   7#define __FM_PORT_EXT_H
   8
   9#include <errno.h>
  10#include "ncsw_ext.h"
  11#include "fm_pcd_ext.h"
  12#include "fm_ext.h"
  13#include "net_ext.h"
  14#include "dpaa_integration.h"
  15
  16/*
  17 * @Description   FM Port routines
  18 */
  19
  20/*
  21 *
  22 * @Group         lnx_ioctl_FM_grp Frame Manager Linux IOCTL API
  23 *
  24 * @Description   FM Linux ioctls definitions and enums
  25 *
  26 * @{
  27 */
  28
  29/*
  30 * @Group         lnx_ioctl_FM_PORT_grp FM Port
  31 *
  32 * @Description   FM Port API
  33 *
  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
  41 *                upon.
  42 *
  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.
  46 *
  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.
  51 *
  52 * @{
  53 */
  54
  55/*
  56 * @Description   An enum for defining port PCD modes.
  57 *                (Must match enum e_fm_port_pcd_support defined in
  58 *                fm_port_ext.h)
  59 *
  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.
  69 */
  70typedef enum ioc_fm_port_pcd_support {
  71        e_IOC_FM_PCD_NONE = 0
  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 */
  83        , e_IOC_FM_PCD_PRS_CC
  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;
  90
  91/*
  92 * @Collection   FM Frame error
  93 */
  94typedef uint32_t        ioc_fm_port_frame_err_select_t;
  95        /**< typedef for defining Frame Descriptor errors */
  96
  97/* @} */
  98
  99/*
 100 * @Description   An enum for defining Dual Tx rate limiting scale.
 101 *                (Must match e_fm_port_dual_rate_limiter_scale_down defined in
 102 *                fm_port_ext.h)
 103 */
 104typedef 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;
 114
 115/*
 116 * @Description   A structure for defining Tx rate limiting
 117 *                (Must match struct t_fm_port_rate_limit defined in
 118 *                fm_port_ext.h)
 119 */
 120typedef 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).
 125                         */
 126        uint32_t        rate_limit;
 127                        /**< in Kb/sec for Tx ports, in frame/sec for offline
 128                         * parsing ports. Rate limit refers to data rate (rather
 129                         * than line rate).
 130                         */
 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
 134                         */
 135} ioc_fm_port_rate_limit_t;
 136
 137
 138/*
 139 * @Group         lnx_ioctl_FM_PORT_runtime_control_grp FM Port Runtime Control
 140 *                Unit
 141 *
 142 * @Description   FM Port Runtime control unit API functions, definitions and
 143 *                enums.
 144 *
 145 * @{
 146 */
 147
 148/*
 149 * @Description   An enum for defining FM Port counters.
 150 *                (Must match enum e_fm_port_counters defined in fm_port_ext.h)
 151 */
 152typedef 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;
 187
 188typedef struct ioc_fm_port_bmi_stats_t {
 189        uint32_t cnt_cycle;
 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;
 195        uint32_t cnt_frame;
 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;
 207
 208/*
 209 * @Description   Structure for Port id parameters.
 210 *                (Description may be inaccurate;
 211 *                must match struct t_fm_port_congestion_grps defined in
 212 *                fm_port_ext.h)
 213 *
 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.
 217 */
 218typedef 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
 222                         */
 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'.
 226                         */
 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.
 231                         */
 232} ioc_fm_port_congestion_groups_t;
 233
 234
 235/*
 236 * @Function      fm_port_disable
 237 *
 238 * @Description   Gracefully disable an FM port. The port will not start new
 239 *                tasks after all tasks associated with the port are terminated.
 240 *
 241 * @Return        0 on success; error code otherwise.
 242 *
 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
 246 *                began
 247 */
 248#define FM_PORT_IOC_DISABLE   _IO(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(1))
 249
 250/*
 251 * @Function      fm_port_enable
 252 *
 253 * @Description   A runtime routine provided to allow disable/enable of port.
 254 *
 255 * @Return        0 on success; error code otherwise.
 256 */
 257#define FM_PORT_IOC_ENABLE   _IO(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(2))
 258
 259/*
 260 * @Function      fm_port_set_rate_limit
 261 *
 262 * @Description   Calling this routine enables rate limit algorithm.
 263 *                By default, this functionality is disabled.
 264 *
 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.
 268 *
 269 *                May be used for Tx and offline parsing ports only
 270 *
 271 * @Param[in]     ioc_fm_port_rate_limit        A structure of rate limit
 272 *                                              parameters
 273 *
 274 * @Return      0 on success; error code otherwise.
 275 */
 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)
 278
 279/*
 280 * @Function      fm_port_delete_rate_limit
 281 *
 282 * @Description   Calling this routine disables the previously enabled rate
 283 *                limit.
 284 *
 285 *                May be used for Tx and offline parsing ports only
 286 *
 287 * @Return        0 on success; error code otherwise.
 288 */
 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
 291
 292/*
 293 * @Function      fm_port_add_congestion_grps
 294 *
 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.
 301 *
 302 *                May be used for Rx, or RX+OP ports only (depending on chip)
 303 *
 304 * @Param[in]     ioc_fm_port_congestion_groups_t       A pointer to an array of
 305 *                                                      congestion group ids to
 306 *                                                      consider.
 307 *
 308 * @Return        0 on success; error code otherwise.
 309 */
 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)
 313
 314/*
 315 * @Function    fm_port_remove_congestion_grps
 316 *
 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
 322 *                this port.
 323 *
 324 *                May be used for Rx, or RX+OP ports only (depending on chip)
 325 *
 326 * @Param[in]     ioc_fm_port_congestion_groups_t       A pointer to an array of
 327 *                                                      congestion group ids to
 328 *                                                      consider.
 329 *
 330 * @Return      0 on success; error code otherwise.
 331 */
 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)
 335
 336/*
 337 * @Function      fm_port_set_errors_route
 338 *
 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.
 346 *
 347 *                May be used for Rx and offline parsing ports only
 348 *
 349 * @Param[in]     ioc_fm_port_frame_err_select_t        A list of errors to
 350 *                                                      enqueue to error queue
 351 *
 352 * @Return        0 on success; error code otherwise.
 353 *
 354 * @Cautions      Allowed only following fm_port_config() and before
 355 *                fm_port_init().
 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!?!?!?!???!?!??!?!?)
 360 */
 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)
 364
 365/*
 366 * @Group         lnx_ioctl_FM_PORT_pcd_runtime_control_grp FM Port PCD Runtime
 367 *                Control Unit
 368 *
 369 * @Description   FM Port PCD Runtime control unit API functions, definitions
 370 *                and enums.
 371 *
 372 * @{
 373 */
 374
 375/*
 376 * @Description   A structure defining the KG scheme after the parser.
 377 *                (Must match struct ioc_fm_pcd_kg_scheme_select_t defined in
 378 *                fm_port_ext.h)
 379 *
 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.
 383 *
 384 */
 385typedef struct ioc_fm_pcd_kg_scheme_select_t {
 386        bool    direct;
 387                /**< TRUE to use 'scheme_id' directly, FALSE to use LCV.*/
 388        void    *scheme_id;
 389                /**< Relevant for 'direct'=TRUE only. 'scheme_id' selects the
 390                 * scheme after parser.
 391                 */
 392} ioc_fm_pcd_kg_scheme_select_t;
 393
 394/*
 395 * @Description   Scheme IDs structure
 396 *                (Must match struct ioc_fm_pcd_port_schemes_params_t defined
 397 *                in fm_port_ext.h)
 398 */
 399typedef struct ioc_fm_pcd_port_schemes_params_t {
 400        uint8_t num_schemes;
 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
 404                 * to
 405                 */
 406} ioc_fm_pcd_port_schemes_params_t;
 407
 408/*
 409 * @Description   A union for defining port protocol parameters for parser
 410 *                (Must match union u_FmPcdHdrPrsOpts defined in fm_port_ext.h)
 411 */
 412typedef union ioc_fm_pcd_hdr_prs_opts_u {
 413        /* MPLS */
 414        struct {
 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
 419                 */
 420        ioc_net_header_type next_parse;
 421                /**< must be equal or higher than IPv4 */
 422        } mpls_prs_options;
 423
 424        /* VLAN */
 425        struct {
 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
 429                 */
 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
 433                 */
 434        } vlan_prs_options;
 435
 436        /* PPP */
 437        struct{
 438                bool            enable_mtu_check;
 439                /**< Check validity of MTU according to RFC2516 */
 440        } pppoe_prs_options;
 441
 442        /* IPV6 */
 443        struct {
 444                bool            routing_hdr_disable;
 445                /**< Disable routing header */
 446        } ipv6_prs_options;
 447
 448        /* UDP */
 449        struct {
 450                bool            pad_ignore_checksum;
 451                /**< TRUE to ignore pad in checksum */
 452        } udp_prs_options;
 453
 454        /* TCP */
 455        struct {
 456                bool            pad_ignore_checksum;
 457                /**< TRUE to ignore pad in checksum */
 458        } tcp_prs_options;
 459} ioc_fm_pcd_hdr_prs_opts_u;
 460
 461/*
 462 * @Description   A structure for defining each header for the parser
 463 *                (must match struct t_FmPcdPrsAdditionalHdrParams defined in
 464 *                fm_port_ext.h)
 465 */
 466typedef 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
 471                 * the HW parser.
 472                 */
 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.
 477                 */
 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
 481                 * options selected.
 482                 */
 483} ioc_fm_pcd_prs_additional_hdr_params_t;
 484
 485/*
 486 * @Description   A structure for defining port PCD parameters
 487 *                (Must match t_fm_portPcdPrsParams defined in fm_port_ext.h)
 488 */
 489typedef 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.
 496                 */
 497        uint8_t         parsing_offset;
 498                /**< Number of bytes from beginning of packet to start parsing
 499                 */
 500        ioc_net_header_type     first_prs_hdr;
 501                /**< The type of the first header axpected at 'parsing_offset'
 502                 */
 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
 511                 */
 512        bool            set_vlan_tpid1;
 513                /**< TRUE to configure user selection of Ethertype to indicate a
 514                 * VLAN tag (in addition to the TPID values 0x8100 and 0x88A8).
 515                 */
 516        uint16_t        vlan_tpid1;
 517                /**< extra tag to use if set_vlan_tpid1=TRUE. */
 518        bool            set_vlan_tpid2;
 519                /**< TRUE to configure user selection of Ethertype to indicate a
 520                 * VLAN tag (in addition to the TPID values 0x8100 and 0x88A8).
 521                 */
 522        uint16_t        vlan_tpid2;
 523                /**< extra tag to use if set_vlan_tpid1=TRUE. */
 524} ioc_fm_port_pcd_prs_params_t;
 525
 526/*
 527 * @Description   A structure for defining coarse alassification parameters
 528 *                (Must match t_fm_portPcdCcParams defined in fm_port_ext.h)
 529 */
 530typedef struct ioc_fm_port_pcd_cc_params_t {
 531        void            *cc_tree_id; /**< CC tree id */
 532} ioc_fm_port_pcd_cc_params_t;
 533
 534/*
 535 * @Description   A structure for defining keygen parameters
 536 *                (Must match t_fm_portPcdKgParams defined in fm_port_ext.h)
 537 */
 538typedef struct ioc_fm_port_pcd_kg_params_t {
 539        uint8_t         num_schemes;
 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
 543                         * be bound to
 544                         */
 545        bool            direct_scheme;
 546                        /**< TRUE for going from parser to a specific scheme,
 547                         * regardless of parser result
 548                         */
 549        void            *direct_scheme_id;
 550                        /**< Scheme id, as returned by FM_PCD_KgSetScheme;
 551                         * relevant only if direct=TRUE.
 552                         */
 553} ioc_fm_port_pcd_kg_params_t;
 554
 555/*
 556 * @Description   A structure for defining policer parameters
 557 *                (Must match t_fm_portPcdPlcrParams defined in fm_port_ext.h)
 558 */
 559typedef 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)
 567                 */
 568} ioc_fm_port_pcd_plcr_params_t;
 569
 570/*
 571 * @Description   A structure for defining port PCD parameters
 572 *                (Must match struct t_fm_portPcdParams defined in
 573 *                fm_port_ext.h)
 574 */
 575typedef 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.
 579                 */
 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;
 594
 595/*
 596 * @Description   A structure for defining the Parser starting point
 597 *                (Must match struct ioc_fm_pcd_prs_start_t defined in
 598 *                fm_port_ext.h)
 599 */
 600typedef struct ioc_fm_pcd_prs_start_t {
 601        uint8_t parsing_offset;
 602                /**< Number of bytes from beginning of packet to start parsing
 603                 */
 604        ioc_net_header_type first_prs_hdr;
 605                /**< The type of the first header axpected at 'parsing_offset'
 606                 */
 607} ioc_fm_pcd_prs_start_t;
 608
 609/*
 610 * @Description   FQID parameters structure
 611 */
 612typedef struct ioc_fm_port_pcd_fqids_params_t {
 613        uint32_t        num_fqids;
 614                /**< Number of fqids to be allocated for the port */
 615        uint8_t         alignment;
 616                /**< Alignment required for this port */
 617        uint32_t        base_fqid;
 618                /**< output parameter - the base fqid */
 619} ioc_fm_port_pcd_fqids_params_t;
 620
 621/*
 622 * @Function      FM_PORT_IOC_ALLOC_PCD_FQIDS
 623 *
 624 * @Description   Allocates FQID's
 625 *                May be used for Rx and offline parsing ports only
 626 *
 627 * @Param[in,out] ioc_fm_port_pcd_fqids_params_t        Parameters for
 628 *                                                      allocating FQID's
 629 *
 630 * @Return        0 on success; error code otherwise.
 631 */
 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)
 635
 636/*
 637 * @Function      FM_PORT_IOC_FREE_PCD_FQIDS
 638 *
 639 * @Description   Frees previously-allocated FQIDs
 640 *                May be used for Rx and offline parsing ports only
 641 *
 642 * @Param[in]     uint32_t      Base FQID of previously allocated range.
 643 *
 644 * @Return        0 on success; error code otherwise.
 645 */
 646#define FM_PORT_IOC_FREE_PCD_FQIDS \
 647        _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(19), uint32_t)
 648
 649/*
 650 * @Function    fm_port_set_pcd
 651 *
 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
 655 *                passed parameters.
 656 *                May be used for Rx and offline parsing ports only
 657 *
 658 * @Param[in]     ioc_fm_port_pcd_params_t      A Structure of parameters
 659 *                                              defining the port's PCD
 660 *                                              configuration.
 661 *
 662 * @Return        0 on success; error code otherwise.
 663 */
 664#define FM_PORT_IOC_SET_PCD \
 665        _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(20), ioc_fm_port_pcd_params_t)
 666
 667/*
 668 * @Function      fm_port_delete_pcd
 669 *
 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
 674 *                mode only
 675 *
 676 * @Return        0 on success; error code otherwise.
 677 */
 678#define FM_PORT_IOC_DELETE_PCD _IO(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(21))
 679
 680/*
 681 * @Function      fm_port_attach_pcd
 682 *
 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.
 688 *
 689 *                May be used for Rx and offline parsing ports which are in PCD
 690 *                mode only
 691 *
 692 * @Return        0 on success; error code otherwise.
 693 */
 694#define FM_PORT_IOC_ATTACH_PCD _IO(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(23))
 695
 696/*
 697 * @Function      fm_port_detach_pcd
 698 *
 699 * @Description   Calling this routine detaches the port from its PCD
 700 *                functionality. The port returns to its default flow which is
 701 *                BMI to BMI.
 702 *
 703 *                May be used for Rx and offline parsing ports which are in PCD
 704 *                mode only
 705 *
 706 * @Return        0 on success; error code otherwise.
 707 */
 708#define FM_PORT_IOC_DETACH_PCD _IO(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(22))
 709
 710/*
 711 * @Function      fm_port_pcd_plcr_alloc_profiles
 712 *
 713 * @Description   This routine may be called only for ports that use the Policer
 714 *                in order to allocate private policer profiles.
 715 *
 716 * @Param[in]     uint16_t      The number of required policer profiles
 717 *
 718 * @Return        0 on success; error code otherwise.
 719 *
 720 * @Cautions      Allowed before fm_port_set_pcd() only.
 721 */
 722#define FM_PORT_IOC_PCD_PLCR_ALLOC_PROFILES     \
 723        _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(24), uint16_t)
 724
 725/*
 726 * @Function      fm_port_pcd_plcr_free_profiles
 727 *
 728 * @Description   This routine should be called for freeing private policer
 729 *                profiles.
 730 *
 731 * @Return        0 on success; error code otherwise.
 732 *
 733 * @Cautions      Allowed before fm_port_set_pcd() only.
 734 */
 735#define FM_PORT_IOC_PCD_PLCR_FREE_PROFILES      \
 736        _IO(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(25))
 737
 738/*
 739 * @Function      fm_port_pcd_kg_modify_initial_scheme
 740 *
 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.
 746 *
 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.
 750 *
 751 * @Return        0 on success; error code otherwise.
 752 */
 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)
 756
 757/*
 758 * @Function      fm_port_pcd_plcr_modify_initial_profile
 759 *
 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
 765 *                selection.
 766 *
 767 * @Param[in]     ioc_fm_obj_t          Policer profile Id as returned from
 768 *                                      FM_PCD_PlcrSetProfile.
 769 *
 770 * @Return        0 on success; error code otherwise.
 771 */
 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)
 774
 775/*
 776 * @Function      fm_port_pcd_cc_modify_tree
 777 *
 778 * @Description   This routine may be called to change this port connection to
 779 *                a pre - initializes coarse classification Tree.
 780 *
 781 * @Param[in]     ioc_fm_obj_t  Id of new coarse classification tree selected
 782 *                              for this port.
 783 *
 784 * @Return        0 on success; error code otherwise.
 785 *
 786 * @Cautions      Allowed only following fm_port_set_pcd() and
 787 *                fm_port_detach_pcd()
 788 */
 789#define FM_PORT_IOC_PCD_CC_MODIFY_TREE \
 790        _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(28), ioc_fm_obj_t)
 791
 792/*
 793 * @Function      fm_port_pcd_kg_bind_schemes
 794 *
 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.
 798 *
 799 * @Param[in]     ioc_fm_pcd_port_schemes_params_t      Schemes parameters
 800 *                                                      structure
 801 *
 802 * @Return        0 on success; error code otherwise.
 803 *
 804 * @Cautions      Allowed only following fm_port_set_pcd().
 805 */
 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)
 809
 810/*
 811 * @Function      fm_port_pcd_kg_unbind_schemes
 812 *
 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.
 816 *
 817 * @Param[in]     ioc_fm_pcd_port_schemes_params_t      Schemes parameters
 818 *                                                      structure
 819 *
 820 * @Return        0 on success; error code otherwise.
 821 *
 822 * @Cautions      Allowed only following fm_port_set_pcd().
 823 */
 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)
 827
 828#define ENET_NUM_OCTETS_PER_ADDRESS 6
 829                /**< Number of octets (8-bit bytes) in an ethernet address */
 830typedef 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;
 833
 834/*
 835 * @Function      FM_MAC_AddHashMacAddr
 836 *
 837 * @Description   Add an Address to the hash table. This is for filter purpose
 838 *                only.
 839 *
 840 * @Param[in]     ioc_fm_port_mac_addr_params_t         Ethernet Mac address
 841 *
 842 * @Return        E_OK on success; Error code otherwise.
 843 *
 844 * @Cautions      Allowed only following FM_MAC_Init(). It is a filter only
 845 *                address.
 846 * @Cautions      Some address need to be filtered out in upper FM blocks.
 847 */
 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)
 851
 852/*
 853 * @Function      FM_MAC_RemoveHashMacAddr
 854 *
 855 * @Description   Delete an Address to the hash table. This is for filter
 856 *                purpose only.
 857 *
 858 * @Param[in]     ioc_fm_port_mac_addr_params_t         Ethernet Mac address
 859 *
 860 * @Return        E_OK on success; Error code otherwise.
 861 *
 862 * @Cautions      Allowed only following FM_MAC_Init().
 863 */
 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)
 867
 868typedef struct ioc_fm_port_tx_pause_frames_t {
 869        uint8_t  priority;
 870        uint16_t pause_time;
 871        uint16_t thresh_time;
 872} ioc_fm_port_tx_pause_frames_t;
 873
 874/*
 875 * @Function      FM_MAC_SetTxPauseFrames
 876 *
 877 * @Description   Enable/Disable transmission of Pause-Frames. The routine
 878 *                changes the default configuration: pause-time - [0xf000]
 879 *                threshold-time - [0]
 880 *
 881 * @Param[in]     ioc_fm_port_tx_pause_frames_params_t
 882 *                A structure holding the required parameters.
 883 *
 884 * @Return        E_OK on success; Error code otherwise.
 885 *
 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'
 889 *                field.
 890 */
 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)
 894
 895typedef struct ioc_fm_port_mac_statistics_t {
 896        /* RMON */
 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 */
 911        /* */
 912        uint64_t  e_stat_fragments;
 913                /**< Total number of packets that were less than 64 octets long
 914                 * with a wrong CRC.
 915                 */
 916        uint64_t  e_stat_jabbers;
 917                /**< Total number of packets longer than valid maximum length
 918                 * octets
 919                 */
 920        uint64_t  e_stat_drop_events;
 921                /**< number of dropped packets due to internal errors of the MAC
 922                 * Client (during receive).
 923                 */
 924        uint64_t  e_stat_CRC_align_errors;
 925                /**< Incremented when frames of correct length but with CRC
 926                 * error are received.
 927                 */
 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
 931                 * length errors
 932                 */
 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
 936                 */
 937        /* Pause */
 938        uint64_t  rx_stat_pause;        /**< Pause MAC Control received */
 939        uint64_t  tx_stat_pause;        /**< Pause MAC Control sent */
 940        /* MIB II */
 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
 946                 */
 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
 953                 * MAC RX.
 954                 */
 955        uint64_t  if_in_errors;
 956                /**< Number of frames received with error:
 957                 *      - FIFO Overflow Error
 958                 *      - CRC Error
 959                 *      - Frame Too Long Error
 960                 *      - Alignment Error
 961                 *      - The dedicated Error Code (0xfe, not a code error) was
 962                 *        received
 963                 */
 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
 969                 */
 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
 976                 * MAC TX N/A!.
 977                 */
 978        uint64_t  if_out_errors;
 979                /**< Number of frames transmitted with error:
 980                 *      - FIFO Overflow Error
 981                 *      - FIFO Underflow Error
 982                 *      - Other
 983                 */
 984} ioc_fm_port_mac_statistics_t;
 985
 986/*
 987 * @Function      FM_MAC_GetStatistics
 988 *
 989 * @Description   get all MAC statistics counters
 990 *
 991 * @Param[out]    ioc_fm_port_mac_statistics_t  A structure holding the
 992 *                                              statistics
 993 *
 994 * @Return        E_OK on success; Error code otherwise.
 995 *
 996 * @Cautions      Allowed only following FM_Init().
 997 */
 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)
1001
1002/*
1003 * @Function      fm_port_get_bmi_counters
1004 *
1005 * @Description   Read port's BMI stat counters and place them into
1006 *                a designated structure of counters.
1007 *
1008 * @Param[in]     h_fm_port     A handle to a FM Port module.
1009 * @Param[out]    p_bmi_stats   counters structure
1010 *
1011 * @Return        E_OK on success; Error code otherwise.
1012 *
1013 * @Cautions      Allowed only following fm_port_init().
1014 */
1015
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)
1018
1019/** @} */ /* end of lnx_ioctl_FM_PORT_pcd_runtime_control_grp group */
1020/** @} */ /* end of lnx_ioctl_FM_PORT_runtime_control_grp group */
1021
1022/** @} */ /* end of lnx_ioctl_FM_PORT_grp group */
1023/** @} */ /* end of lnx_ioctl_FM_grp group */
1024
1025
1026/*
1027 * @Group         gen_id        General Drivers Utilities
1028 *
1029 * @Description   External routines.
1030 *
1031 * @{
1032 */
1033
1034/*
1035 * @Group         gen_error_id  Errors, Events and Debug
1036 *
1037 * @Description   External routines.
1038 *
1039 * @{
1040 */
1041
1042/*
1043 * The scheme below provides the bits description for error codes:
1044 *
1045 *  0   1   2   3   4   5   6   7   8   9   10   11   12   13   14   15
1046 * |    Reserved (should be zero)       |       Module ID               |
1047 *
1048 *  16   17   18   19   20   21   22  23   24   25   26   27   28   29   30   31
1049 * |                            Error Type                             |
1050 */
1051
1052#define ERROR_CODE(_err)  ((((uint32_t)_err) & 0x0000FFFF) | __ERR_MODULE__)
1053
1054#define GET_ERROR_TYPE(_errcode)        ((_errcode) & 0x0000FFFF)
1055                        /**< Extract module code from error code (#uint32_t) */
1056
1057#define GET_ERROR_MODULE(_errcode)  ((_errcode) & 0x00FF0000)
1058                        /**< Extract error type (#e_error_type) from
1059                         * error code (#uint32_t)
1060                         */
1061
1062#define RETURN_ERROR(_level, _err, _vmsg) { return ERROR_CODE(_err); }
1063
1064/*
1065 * @Description  Error Type Enumeration
1066 */
1067typedef enum e_error_type {
1068        E_OK = 0
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.*/
1075                /* String: none.*/
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).
1080                 */
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.*/
1087        , E_BUSY = EBUSY
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
1091                 *         description).
1092                 */
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).
1098                 */
1099        , E_INVALID_OPERATION = ENODEV
1100                /**< The operation/command is invalid (unrecognized).*/
1101                /* String: none.*/
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)".
1109                 */
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)".
1115                 */
1116        , E_NOT_SUPPORTED = ENOSYS
1117                /**< The function is not supported or not implemented.*/
1118                /* String: none.*/
1119        , E_INVALID_STATE
1120                /**< The operation is not allowed in current module state.*/
1121                /* String: none.*/
1122        , E_INVALID_HANDLE
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)
1126                 */
1127        , E_INVALID_ID
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)
1131                 */
1132        , E_NULL_POINTER
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
1138                 * not suitable.
1139                 * String: parameter description.
1140                 */
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).
1146                 */
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").
1152                 */
1153        , E_INVALID_CLOCK
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").
1158                 */
1159        , E_CONFLICT
1160                /**< Some setting conflicts with another setting.*/
1161                /* String: description of the conflicting settings.*/
1162        , E_NOT_ALIGNED
1163                /**< Non-aligned address.*/
1164                /* String: parameter description + "(should be %d-bytes
1165                 *         aligned)", e.g: "Rx data buffer (should be 32-bytes
1166                 *         aligned)".
1167                 */
1168        , E_NOT_FOUND
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).
1173                 */
1174        , E_FULL
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).
1178                 */
1179        , E_EMPTY
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).
1183                 */
1184        , E_ALREADY_FREE
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).
1188                 */
1189        , E_READ_FAILED
1190                /**< Read access failed on memory/device.*/
1191                /* String: none, or device name.*/
1192        , E_INVALID_FRAME
1193                /**< Invalid frame object (NULL handle or missing buffers).*/
1194                /* String: none.*/
1195        , E_SEND_FAILED
1196                /**< Send operation failed on device.*/
1197                /* String: none, or device name.*/
1198        , E_RECEIVE_FAILED
1199                /**< Receive operation failed on device.*/
1200                /* String: none, or device name.*/
1201        , E_TIMEOUT/* = ETIMEDOUT*/
1202                /**< The operation timed out.*/
1203                /* String: none.*/
1204
1205        , E_DUMMY_LAST  /* NEVER USED */
1206
1207} e_error_type;
1208
1209/*
1210 *
1211 * @Group         FM_grp Frame Manager API
1212 *
1213 * @Description   FM API functions, definitions and enums
1214 *
1215 * @{
1216 */
1217
1218/*
1219 * @Group         FM_PORT_grp FM Port
1220 *
1221 * @Description   FM Port API
1222 *
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
1228 *                upon.
1229 *
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.
1233 *
1234 *                On initialization, user specifies the port type and it's index
1235 *                (relative to the port's type) - always starting at 0.
1236 *
1237 * @{
1238 */
1239
1240/*
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.
1251 */
1252typedef 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;
1282
1283/*
1284 * @Description   Port interrupts
1285 */
1286typedef enum e_fm_port_exceptions {
1287        e_FM_PORT_EXCEPTION_IM_BUSY     /**< Independent-Mode Rx-BUSY */
1288} e_fm_port_exceptions;
1289
1290/*
1291 * @Collection  General FM Port defines
1292 */
1293#define FM_PORT_PRS_RESULT_NUM_OF_WORDS 8
1294                /**< Number of 4 bytes words in parser result */
1295/* @} */
1296
1297/*
1298 * @Collection   FM Frame error
1299 */
1300typedef uint32_t        fm_port_frame_err_select_t;
1301                        /**< typedef for defining Frame Descriptor errors */
1302
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
1311                         */
1312
1313#define FM_PORT_FRM_ERR_IPRE            (FM_FD_ERR_IPR & ~FM_FD_IPR)
1314                        /**< IPR error */
1315#define FM_PORT_FRM_ERR_IPR_NCSP        (FM_FD_ERR_IPR_NCSP & ~FM_FD_IPR)
1316                        /**< IPR non-consistent-sp */
1317
1318#define FM_PORT_FRM_ERR_IPFE            0
1319                        /**< Obsolete; will be removed in the future */
1320
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 */
1325
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.
1331                         */
1332#define FM_PORT_FRM_ERR_SIZE            FM_FD_ERR_SIZE
1333                        /**< Frame too long OR Frame size exceeds
1334                         * max_length_frame
1335                         */
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 */
1362/* @} */
1363
1364
1365/*
1366 * @Group         FM_PORT_init_grp FM Port Initialization Unit
1367 *
1368 * @Description   FM Port Initialization Unit
1369 *
1370 * @{
1371 */
1372
1373/*
1374 * @Description   Exceptions user callback routine, will be called upon an
1375 *                exception passing the exception identification.
1376 *
1377 * @Param[in]     h_app         User's application descriptor.
1378 * @Param[in]     exception     The exception.
1379 */
1380typedef void (t_fm_port_exception_callback) (t_handle h_app,
1381                                        e_fm_port_exceptions exception);
1382
1383/*
1384 * @Description   User callback function called by driver with received data.
1385 *                User provides this function. Driver invokes it.
1386 *
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
1394 *
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.
1399 */
1400typedef e_rx_store_response(t_fm_port_im_rx_store_callback) (t_handle h_app,
1401                                        uint8_t  *p_data,
1402                                        uint16_t length,
1403                                        uint16_t status,
1404                                        uint8_t  position,
1405                                        t_handle h_buf_context);
1406
1407/*
1408 * @Description   User callback function called by driver when transmit
1409 *                completed.
1410 *                User provides this function. Driver invokes it.
1411 *
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
1418 */
1419typedef void (t_fm_port_im_tx_conf_callback) (t_handle   h_app,
1420                                uint8_t *p_data,
1421                                uint16_t   status,
1422                                t_handle   h_buf_context);
1423
1424/*
1425 * @Description   A structure for additional Rx port parameters
1426 */
1427typedef 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
1434                         */
1435} t_fm_port_rx_params;
1436
1437/*
1438 * @Description   A structure for additional non-Rx port parameters
1439 */
1440typedef struct t_fm_port_non_rx_params {
1441        uint32_t                err_fqid;       /**< Error Queue Id. */
1442        uint32_t                dflt_fqid;
1443                        /**< For Tx - Default Confirmation queue,
1444                         * 0 means no Tx confirmation for processed frames.
1445                         * For OP port - default Rx queue.
1446                         */
1447        uint32_t                qm_channel;
1448                        /**< QM-channel dedicated to this port; will be used by
1449                         * the FM for dequeue.
1450                         */
1451} t_fm_port_non_rx_params;
1452
1453/*
1454 * @Description   A structure for additional Rx port parameters
1455 */
1456typedef 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;
1472
1473/*
1474 * @Description   A union for additional parameters depending on port type
1475 */
1476typedef 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;
1484
1485/*
1486 * @Description   A structure representing FM initialization parameters
1487 */
1488typedef struct t_fm_port_params {
1489        uintptr_t       base_addr;
1490                        /**< Virtual Address of memory mapped FM Port registers.
1491                         */
1492        t_handle        h_fm;
1493                        /**< A handle to the FM object this port related to */
1494        e_fm_port_type  port_type;      /**< Port type */
1495        uint8_t         port_id;
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.
1501                         */
1502        bool            independent_mode_enable;
1503                        /**< This port is Independent-Mode - Used for Rx/Tx
1504                         * ports only!
1505                         */
1506        uint16_t                liodn_base;
1507                        /**< Irrelevant for P4080 rev 1. LIODN base for this
1508                         * port, to be used together with LIODN offset.
1509                         */
1510        u_fm_port_specific_params       specific_params;
1511                        /**< Additional parameters depending on port type. */
1512
1513        t_fm_port_exception_callback   *f_exception;
1514                        /**< Relevant for IM only Callback routine to be called
1515                         * on BUSY exception
1516                         */
1517        t_handle                h_app;
1518                        /**< A handle to an application layer object; This
1519                         * handle will be passed by the driver upon calling the
1520                         * above callbacks
1521                         */
1522} t_fm_port_params;
1523
1524/*
1525 * @Function      fm_port_config
1526 *
1527 * @Description   Creates a descriptor for the FM PORT module.
1528 *
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.
1532 *
1533 *                No actual initialization or configuration of FM hardware is
1534 *                done by this routine.
1535 *
1536 * @Param[in]     p_fm_port_params      Pointer to data structure of parameters
1537 *
1538 * @Retval        Handle to FM object, or NULL for Failure.
1539 */
1540t_handle fm_port_config(t_fm_port_params *p_fm_port_params);
1541
1542/*
1543 * @Function      fm_port_init
1544 *
1545 * @Description   Initializes the FM PORT module by defining the software
1546 *                structure and configuring the hardware registers.
1547 *
1548 * @Param[in]     h_fm_port - FM PORT module descriptor
1549 *
1550 * @Return        E_OK on success; Error code otherwise.
1551 */
1552uint32_t fm_port_init(t_handle h_fm_port);
1553
1554/*
1555 * @Function      fm_port_free
1556 *
1557 * @Description   Frees all resources that were assigned to FM PORT module.
1558 *
1559 *                Calling this routine invalidates the descriptor.
1560 *
1561 * @Param[in]     h_fm_port - FM PORT module descriptor
1562 *
1563 * @Return        E_OK on success; Error code otherwise.
1564 */
1565uint32_t fm_port_free(t_handle h_fm_port);
1566
1567t_handle fm_port_open(t_fm_port_params *p_fm_port_params);
1568void fm_port_close(t_handle h_fm_port);
1569
1570
1571/*
1572 * @Group         FM_PORT_advanced_init_grp     FM Port Advanced Configuration
1573 *                                              Unit
1574 *
1575 * @Description   Configuration functions used to change default values.
1576 *
1577 * @{
1578 */
1579
1580/*
1581 * @Description   enum for defining QM frame dequeue
1582 */
1583typedef 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.
1587                 */
1588        e_FM_PORT_DEQ_TYPE2,
1589                /**< Dequeue from the SP channel - with active FQ precedence,
1590                 * and Intra-Class Scheduling respected.
1591                 */
1592        e_FM_PORT_DEQ_TYPE3
1593                /**< Dequeue from the SP channel - with active FQ precedence,
1594                 * and override Intra-Class Scheduling
1595                 */
1596} e_fm_port_deq_type;
1597
1598/*
1599 * @Description   enum for defining QM frame dequeue
1600 */
1601typedef 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.
1605                 */
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.
1609                 */
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.
1613                 */
1614
1615} e_fm_port_deq_prefetch_option;
1616
1617/*
1618 * @Description   enum for defining port default color
1619 */
1620typedef 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 */
1625} e_fm_port_color;
1626
1627/*
1628 * @Description   A structure for defining Dual Tx rate limiting scale
1629 */
1630typedef 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;
1640
1641/*
1642 * @Description   A structure for defining FM port resources
1643 */
1644typedef struct t_fm_port_rsrc {
1645        uint32_t        num;
1646                        /**< Committed required resource */
1647        uint32_t        extra;
1648                        /**< Extra (not committed) required resource */
1649} t_fm_port_rsrc;
1650
1651/*
1652 * @Description   A structure for defining Tx rate limiting
1653 */
1654typedef 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).
1659                                 */
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).
1664                                 */
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
1668                                 */
1669} t_fm_port_rate_limit;
1670
1671/*
1672 * @Description   A structure for defining the parameters of
1673 *                the Rx port performance counters
1674 */
1675typedef 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;
1685
1686/*
1687 * @Function      fm_port_config_num_of_open_dmas
1688 *
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
1692 *                [OP: 1]
1693 *                [1G-RX, 1G-TX: 1 (+1)]
1694 *                [10G-RX, 10G-TX: 8 (+8)]
1695 *
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.
1699 *
1700 * @Return        E_OK on success; Error code otherwise.
1701 *
1702 * @Cautions      Allowed only following fm_port_config() and before
1703 *                fm_port_init().
1704 */
1705uint32_t fm_port_config_num_of_open_dmas(t_handle h_fm_port,
1706                                                t_fm_port_rsrc *p_open_dmas);
1707
1708/*
1709 * @Function      fm_port_config_num_of_tasks
1710 *
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
1714 *                [OP : 1]
1715 *                [1G - RX, 1G - TX : 3 ( + 2)]
1716 *                [10G - RX, 10G - TX : 16 ( + 8)]
1717 *
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.
1721 *
1722 * @Return        E_OK on success; Error code otherwise.
1723 *
1724 * @Cautions      Allowed only following fm_port_config() and before
1725 *                fm_port_init().
1726 */
1727uint32_t fm_port_config_num_of_tasks(t_handle h_fm_port,
1728                                        t_fm_port_rsrc *p_num_of_tasks);
1729
1730/*
1731 * @Function      fm_port_config_size_of_fifo
1732 *
1733 * @Description   Calling this routine changes the max FIFO size configured for
1734 *                this port.
1735 *
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.
1739 *                [OP: 2KB]
1740 *                [1G-RX, 1G-TX: 11KB]
1741 *                [10G-RX, 10G-TX: 12KB]
1742 *
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.
1746 *
1747 * @Return        E_OK on success; Error code otherwise.
1748 *
1749 * @Cautions      Allowed only following fm_port_config() and before
1750 *                fm_port_init().
1751 */
1752uint32_t fm_port_config_size_of_fifo(t_handle h_fm_port,
1753                                        t_fm_port_rsrc *p_size_of_fifo);
1754
1755/*
1756 * @Function      fm_port_config_deq_high_priority
1757 *
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]
1762 *
1763 *                May be used for Non - Rx ports only
1764 *
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
1767 *                              operation.
1768 *
1769 * @Return        E_OK on success; Error code otherwise.
1770 *
1771 * @Cautions      Allowed only following fm_port_config() and before
1772 *                fm_port_init().
1773 */
1774uint32_t fm_port_config_deq_high_priority(t_handle h_fm_port, bool high_pri);
1775
1776/*
1777 * @Function      fm_port_config_deq_type
1778 *
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].
1782 *
1783 *                May be used for Non - Rx ports only
1784 *
1785 * @Param[in]     h_fm_port     A handle to a FM Port module.
1786 * @Param[in]     deq_type      According to QM definition.
1787 *
1788 * @Return        E_OK on success; Error code otherwise.
1789 *
1790 * @Cautions      Allowed only following fm_port_config() and before
1791 *                fm_port_init().
1792 */
1793uint32_t fm_port_config_deq_type(t_handle h_fm_port,
1794                                        e_fm_port_deq_type deq_type);
1795
1796/*
1797 * @Function      fm_port_config_deq_prefetch_option
1798 *
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
1803 *
1804 *                May be used for Non - Rx ports only
1805 *
1806 * @Param[in]     h_fm_port             A handle to a FM Port module.
1807 * @Param[in]     deq_prefetch_option   New option
1808 *
1809 * @Return        E_OK on success; Error code otherwise.
1810 *
1811 * @Cautions      Allowed only following fm_port_config() and before
1812 *                fm_port_init().
1813 */
1814uint32_t fm_port_config_deq_prefetch_option(t_handle h_fm_port,
1815                        e_fm_port_deq_prefetch_option deq_prefetch_option);
1816
1817/*
1818 * @Function      fm_port_config_deq_byte_cnt
1819 *
1820 * @Description   Calling this routine changes the dequeue byte count parameter
1821 *                in the internal driver data base from its default
1822 *                configuration.
1823 *                1G:[DEFAULT_PORT_deq_byte_cnt_1G].
1824 *                10G:[DEFAULT_PORT_deq_byte_cnt_10G].
1825 *
1826 *                May be used for Non - Rx ports only
1827 *
1828 * @Param[in]     h_fm_port     A handle to a FM Port module.
1829 * @Param[in]     deq_byte_cnt  New byte count
1830 *
1831 * @Return        E_OK on success; Error code otherwise.
1832 *
1833 * @Cautions      Allowed only following fm_port_config() and before
1834 *                fm_port_init().
1835 */
1836uint32_t fm_port_config_deq_byte_cnt(t_handle h_fm_port,
1837                                        uint16_t deq_byte_cnt);
1838
1839/*
1840 * @Function      fm_port_config_buffer_prefix_content
1841 *
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].
1854 *                Pass timestamp:
1855 *                [DEFAULT_PORT_bufferPrefixContent_pass_time_stamp].
1856 *
1857 *                May be used for all ports
1858 *
1859 *
1860 * @Param[in]           h_fm_port                       A handle to a FM Port
1861 *                                                      module.
1862 * @Param[in,out]       p_fm_buffer_prefix_content      A structure of
1863 *                                                      parameters describing
1864 *                                                      the structure of the
1865 *                                                      buffer.
1866 *                                                      Out parameter: Start
1867 *                                                      margin - offset of data
1868 *                                                      from start of external
1869 *                                                      buffer.
1870 *
1871 * @Return        E_OK on success; Error code otherwise.
1872 *
1873 * @Cautions      Allowed only following fm_port_config() and before
1874 *                fm_port_init().
1875 */
1876uint32_t fm_port_config_buffer_prefix_content(t_handle  h_fm_port,
1877                t_fm_buffer_prefix_content      *p_fm_buffer_prefix_content);
1878
1879/*
1880 * @Function      fm_port_config_checksum_last_bytes_ignore
1881 *
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.
1885 *
1886 *                May be used by Tx & Rx ports only
1887 *
1888 * @Param[in]     h_fm_port                     A handle to a FM Port module.
1889 * @Param[in]     checksum_last_bytes_ignore    New value
1890 *
1891 * @Return        E_OK on success; Error code otherwise.
1892 *
1893 * @Cautions      Allowed only following fm_port_config() and before
1894 *                fm_port_init().
1895 */
1896uint32_t fm_port_config_checksum_last_bytes_ignore(t_handle h_fm_port,
1897                        uint8_t checksum_last_bytes_ignore);
1898
1899/*
1900 * @Function      fm_port_config_cut_bytes_from_end
1901 *
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
1908 *                is not executed.
1909 *
1910 *                May be used for Rx ports only
1911 *
1912 * @Param[in]     h_fm_port             A handle to a FM Port module.
1913 * @Param[in]     cut_bytes_from_end    New value
1914 *
1915 * @Return        E_OK on success; Error code otherwise.
1916 *
1917 * @Cautions      Allowed only following fm_port_config() and before
1918 *                fm_port_init().
1919 */
1920uint32_t fm_port_config_cut_bytes_from_end(t_handle h_fm_port,
1921                        uint8_t cut_bytes_from_end);
1922
1923/*
1924 * @Function      fm_port_config_ext_buf_pools
1925 *
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
1930 *                used.
1931 *
1932 *                Note: Available for some chips only
1933 *
1934 *                May be used for OP ports only
1935 *
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
1938 *                                      external pools.
1939 *
1940 * @Return        E_OK on success; Error code otherwise.
1941 *
1942 * @Cautions      Allowed only following fm_port_config() and before
1943 *                fm_port_init().
1944 */
1945uint32_t fm_port_config_ext_buf_pools(t_handle h_fm_port,
1946                        t_fm_ext_pools *p_fm_ext_pools);
1947
1948/*
1949 * @Function      fm_port_config_backup_pools
1950 *
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.
1955 *
1956 *                May be used for Rx ports only
1957 *
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
1961 *                                              as backup pools.
1962 *
1963 * @Return        E_OK on success; Error code otherwise.
1964 *
1965 * @Cautions      Allowed only following fm_port_config() and before
1966 *                fm_port_init().
1967 */
1968uint32_t fm_port_config_backup_pools(t_handle h_fm_port,
1969                        t_fm_backup_bm_pools *p_fm_port_backup_bm_pools);
1970
1971/*
1972 * @Function      fm_port_config_frm_discard_override
1973 *
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]
1977 *
1978 *                May be used for Rx and OP ports only
1979 *
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.
1983 *
1984 * @Return        E_OK on success; Error code otherwise.
1985 *
1986 * @Cautions      Allowed only following fm_port_config() and before
1987 *                fm_port_init().
1988 */
1989uint32_t fm_port_config_frm_discard_override(t_handle h_fm_port,
1990                        bool override);
1991
1992/*
1993 * @Function    fm_port_config_errors_to_discard
1994 *
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
2002 *                to CPU.
2003 *
2004 *                May be used for Rx and OP ports only
2005 *
2006 * @Param[in]     h_fm_port     A handle to a FM Port module.
2007 * @Param[in]     errs          A list of errors to discard
2008 *
2009 * @Return        E_OK on success; Error code otherwise.
2010 *
2011 * @Cautions      Allowed only following fm_port_config() and before
2012 *                fm_port_init().
2013 */
2014uint32_t fm_port_config_errors_to_discard(t_handle h_fm_port,
2015                fm_port_frame_err_select_t errs);
2016
2017/*
2018 * @Function      fm_port_config_dma_ic_cache_attr
2019 *
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]
2024 *
2025 *                May be used for all port types
2026 *
2027 * @Param[in]     h_fm_port                     A handle to a FM Port module.
2028 * @Param[in]     int_context_cache_attr        New selection
2029 *
2030 * @Return        E_OK on success; Error code otherwise.
2031 *
2032 * @Cautions      Allowed only following fm_port_config() and before
2033 *                fm_port_init().
2034 */
2035uint32_t fm_port_config_dma_ic_cache_attr(t_handle h_fm_port,
2036                e_fm_dma_cache_option int_context_cache_attr);
2037
2038/*
2039 * @Function      fm_port_config_dma_hdr_attr
2040 *
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]
2044 *
2045 *                May be used for all port types
2046 *
2047 * @Param[in]     h_fm_port             A handle to a FM Port module.
2048 * @Param[in]     header_cache_attr     New selection
2049 *
2050 * @Return        E_OK on success; Error code otherwise.
2051 *
2052 * @Cautions      Allowed only following fm_port_config() and before
2053 *                fm_port_init().
2054 */
2055uint32_t fm_port_config_dma_hdr_attr(t_handle h_fm_port,
2056                e_fm_dma_cache_option header_cache_attr);
2057
2058/*
2059 * @Function    fm_port_config_dma_scatter_gather_attr
2060 *
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]
2064 *
2065 *                May be used for all port types
2066 *
2067 * @Param[in]     h_fm_port                     A handle to a FM Port module.
2068 * @Param[in]     scatter_gather_cache_attr     New selection
2069 *
2070 * @Return        E_OK on success; Error code otherwise.
2071 *
2072 * @Cautions      Allowed only following fm_port_config() and before
2073 *                fm_port_init().
2074 */
2075uint32_t fm_port_config_dma_scatter_gather_attr(t_handle h_fm_port,
2076                e_fm_dma_cache_option scatter_gather_cache_attr);
2077
2078/*
2079 * @Function      fm_port_config_dma_write_optimize
2080 *
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].
2085 *                Note:
2086 *                1. For head optimization, data alignment must be >= 16
2087 *                   (supported by default).
2088 *
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).
2094 *
2095 *                Relevant for non - Tx port types
2096 *
2097 * @Param[in]     h_fm_port     A handle to a FM Port module.
2098 * @Param[in]     optimize      TRUE to enable optimization, FALSE for normal
2099 *                              operation
2100 *
2101 * @Return        E_OK on success; Error code otherwise.
2102 *
2103 * @Cautions      Allowed only following fm_port_config() and before
2104 *                fm_port_init().
2105 */
2106uint32_t fm_port_config_dma_write_optimize(t_handle h_fm_port,
2107                                                bool optimize);
2108
2109/*
2110 * @Function      fm_port_config_no_scather_gather
2111 *
2112 * @Description   Calling this routine changes the no_scather_gather parameter
2113 *                in internal driver data base from its default configuration.
2114 *
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.
2120 *
2121 * @Return        E_OK on success; Error code otherwise.
2122 *
2123 * @Cautions      Allowed only following fm_port_config() and before
2124 *                fm_port_init().
2125 */
2126uint32_t fm_port_config_no_scather_gather(t_handle h_fm_port,
2127                                                bool no_scather_gather);
2128
2129/*
2130 * @Function      fm_port_config_dflt_color
2131 *
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]
2135 *
2136 *                May be used for all port types
2137 *
2138 * @Param[in]     h_fm_port     A handle to a FM Port module.
2139 * @Param[in]     color         New selection
2140 *
2141 * @Return        E_OK on success; Error code otherwise.
2142 *
2143 * @Cautions      Allowed only following fm_port_config() and before
2144 *                fm_port_init().
2145 */
2146uint32_t fm_port_config_dflt_color(t_handle h_fm_port, e_fm_port_color color);
2147
2148/*
2149 * @Function      fm_port_config_sync_req
2150 *
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]
2154 *
2155 *                May be used for all port types
2156 *
2157 * @Param[in]     h_fm_port     A handle to a FM Port module.
2158 * @Param[in]     sync_req      TRUE to request synchronization, FALSE
2159 *                              otherwise.
2160 *
2161 * @Return        E_OK on success; Error code otherwise.
2162 *
2163 * @Cautions      Allowed only following fm_port_config() and before
2164 *                fm_port_init().
2165 */
2166uint32_t fm_port_config_sync_req(t_handle h_fm_port, bool sync_req);
2167
2168/*
2169 * @Function      fm_port_config_forward_reuse_int_context
2170 *
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]
2175 *
2176 *                May be used for Rx ports only
2177 *
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.
2181 *
2182 * @Return        E_OK on success; Error code otherwise.
2183 *
2184 * @Cautions      Allowed only following fm_port_config() and before
2185 *                fm_port_init().
2186 */
2187uint32_t fm_port_config_forward_reuse_int_context(t_handle h_fm_port,
2188                                                bool reuse);
2189
2190/*
2191 * @Function      fm_port_config_donot_release_tx_buf_to_bm
2192 *
2193 * @Description   This routine should be called if no Tx confirmation
2194 *                is done, and yet buffers should not be released to the BM.
2195 *
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
2200 *                buffers.
2201 *
2202 *                May be used for Tx ports only
2203 *
2204 * @Param[in]     h_fm_port     A handle to a FM Port module.
2205 *
2206 * @Return        E_OK on success; Error code otherwise.
2207 *
2208 * @Cautions      Allowed only following fm_port_config() and before
2209 *                fm_port_init().
2210 */
2211uint32_t fm_port_config_donot_release_tx_buf_to_bm(t_handle h_fm_port);
2212
2213/*
2214 * @Function      fm_port_config_immax_rx_buf_length
2215 *
2216 * @Description   Changes the maximum receive buffer length from its default
2217 *                configuration: Closest rounded down power of 2 value of the
2218 *                data buffer size.
2219 *
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.
2223 *
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
2229 *                packet.
2230 *
2231 * @Param[in]     h_fm_port     A handle to a FM Port module.
2232 * @Param[in]     new_val       Maximum receive buffer length (in bytes).
2233 *
2234 * @Return        E_OK on success; Error code otherwise.
2235 *
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.
2239 */
2240uint32_t fm_port_config_immax_rx_buf_length(t_handle h_fm_port,
2241                                                uint16_t new_val);
2242
2243/*
2244 * @Function      fm_port_config_imrx_bd_ring_length
2245 *
2246 * @Description   Changes the receive BD ring length from its default
2247 *                configuration:[DEFAULT_PORT_rxBdRingLength]
2248 *
2249 * @Param[in]     h_fm_port     A handle to a FM Port module.
2250 * @Param[in]     new_val       The desired BD ring length.
2251 *
2252 * @Return        E_OK on success; Error code otherwise.
2253 *
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.
2257 */
2258uint32_t fm_port_config_imrx_bd_ring_length(t_handle h_fm_port,
2259                                                uint16_t new_val);
2260
2261/*
2262 * @Function    fm_port_config_imtx_bd_ring_length
2263 *
2264 * @Description   Changes the transmit BD ring length from its default
2265 *                configuration:[DEFAULT_PORT_txBdRingLength]
2266 *
2267 * @Param[in]     h_fm_port     A handle to a FM Port module.
2268 * @Param[in]     new_val       The desired BD ring length.
2269 *
2270 * @Return        E_OK on success; Error code otherwise.
2271 *
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.
2275 */
2276uint32_t fm_port_config_imtx_bd_ring_length(t_handle h_fm_port,
2277                                        uint16_t new_val);
2278
2279/*
2280 * @Function      fm_port_config_imfman_ctrl_external_structs_memory
2281 *
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].
2288 *
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).
2293 *
2294 * @Return        E_OK on success; Error code otherwise.
2295 */
2296uint32_t  fm_port_config_imfman_ctrl_external_structs_memory(t_handle h_fm_port,
2297                                uint8_t mem_id,
2298                                uint32_t mem_attributes);
2299
2300/*
2301 * @Function      fm_port_config_impolling
2302 *
2303 * @Description   Changes the Rx flow from interrupt driven (default) to
2304 *                polling.
2305 *
2306 * @Param[in]     h_fm_port     A handle to a FM Port module.
2307 *
2308 * @Return        E_OK on success; Error code otherwise.
2309 *
2310 * @Cautions      Allowed only following fm_port_config() and before
2311 *                fm_port_init().
2312 *                This routine is to be used only if Independent-Mode is
2313 *                enabled.
2314 */
2315uint32_t fm_port_config_impolling(t_handle h_fm_port);
2316
2317/*
2318 * @Function      fm_port_config_max_frame_length
2319 *
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).
2327 *
2328 * @Param[in]     h_fm_port     A handle to a FM Port module.
2329 * @Param[in]     length        Max size of frame
2330 *
2331 * @Return        E_OK on success; Error code otherwise.
2332 *
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.
2336 */
2337uint32_t fm_port_config_max_frame_length(t_handle h_fm_port,
2338                                        uint16_t length);
2339
2340/*
2341 * @Function      fm_port_config_tx_fifo_min_fill_level
2342 *
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]
2346 *
2347 *                May be used for Tx ports only
2348 *
2349 * @Param[in]     h_fm_port             A handle to a FM Port module.
2350 * @Param[in]     min_fill_level        New value
2351 *
2352 * @Return        E_OK on success; Error code otherwise.
2353 *
2354 * @Cautions      Allowed only following fm_port_config() and before
2355 *                fm_port_init().
2356 */
2357uint32_t fm_port_config_tx_fifo_min_fill_level(t_handle h_fm_port,
2358                                        uint32_t min_fill_level);
2359
2360/*
2361 * @Function      fm_port_config_fifo_deq_pipeline_depth
2362 *
2363 * @Description   Calling this routine changes the fifo dequeue pipeline depth
2364 *                parameter in the internal driver data base
2365 *
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]
2370 *
2371 *                May be used for Tx / OP ports only
2372 *
2373 * @Param[in]     h_fm_port             A handle to a FM Port module.
2374 * @Param[in]     deq_pipeline_depth    New value
2375 *
2376 * @Return        E_OK on success; Error code otherwise.
2377 *
2378 * @Cautions      Allowed only following fm_port_config() and before
2379 *                fm_port_init().
2380 */
2381uint32_t fm_port_config_fifo_deq_pipeline_depth(t_handle h_fm_port,
2382                                uint8_t deq_pipeline_depth);
2383
2384/*
2385 * @Function      fm_port_config_tx_fifo_low_comf_level
2386 *
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]
2390 *
2391 *                May be used for Tx ports only
2392 *
2393 * @Param[in]     h_fm_port             A handle to a FM Port module.
2394 * @Param[in]     fifo_low_comf_level   New value
2395 *
2396 * @Return        E_OK on success; Error code otherwise.
2397 *
2398 * @Cautions      Allowed only following fm_port_config() and before
2399 *                fm_port_init().
2400 */
2401uint32_t fm_port_config_tx_fifo_low_comf_level(t_handle h_fm_port,
2402                                        uint32_t fifo_low_comf_level);
2403
2404/*
2405 * @Function      fm_port_config_rx_fifo_threshold
2406 *
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]
2410 *
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
2414 *                link.
2415 *
2416 *                May be used for Rx ports only
2417 *
2418 * @Param[in]     h_fm_port             A handle to a FM Port module.
2419 * @Param[in]     fifo_threshold        New value
2420 *
2421 * @Return        E_OK on success; Error code otherwise.
2422 *
2423 * @Cautions      Allowed only following fm_port_config() and before
2424 *                fm_port_init().
2425 */
2426uint32_t fm_port_config_rx_fifo_threshold(t_handle h_fm_port,
2427                                                uint32_t fifo_threshold);
2428
2429/*
2430 * @Function      fm_port_config_rx_fifo_pri_elevation_level
2431 *
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]
2435 *
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.
2440 *
2441 *                May be used for Rx ports only
2442 *
2443 * @Param[in]     h_fm_port             A handle to a FM Port module.
2444 * @Param[in]     pri_elevation_level   New value
2445 *
2446 * @Return        E_OK on success; Error code otherwise.
2447 *
2448 * @Cautions      Allowed only following fm_port_config() and before
2449 *                fm_port_init().
2450 */
2451uint32_t fm_port_config_rx_fifo_pri_elevation_level(t_handle h_fm_port,
2452                                                uint32_t pri_elevation_level);
2453
2454#ifdef FM_HEAVY_TRAFFIC_HANG_ERRATA_FMAN_A005669
2455/*
2456 * @Function      fm_port_config_bcbworkaround
2457 *
2458 * @Description   Configures BCB errata workaround.
2459 *
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.
2465 *
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.
2470 *
2471 * @Param[in]     h_fm_port             A handle to a FM Port module.
2472 *
2473 * @Return        E_OK on success; Error code otherwise.
2474 *
2475 * @Cautions      Allowed only following fm_port_config() and before
2476 *                fm_port_init().
2477 */
2478uint32_t fm_port_config_bcbworkaround(t_handle h_fm_port);
2479#endif /* FM_HEAVY_TRAFFIC_HANG_ERRATA_FMAN_A005669 */
2480
2481/*
2482 * @Function      fm_port_config_internal_buff_offset
2483 *
2484 * @Description   Configures internal buffer offset.
2485 *
2486 *                May be used for Rx and OP ports only
2487 *
2488 * @Param[in]     h_fm_port     A handle to a FM Port module.
2489 * @Param[in]     val           New value
2490 *
2491 * @Return        E_OK on success; Error code otherwise.
2492 *
2493 * @Cautions      Allowed only following fm_port_config() and before
2494 *                fm_port_init().
2495 */
2496uint32_t fm_port_config_internal_buff_offset(t_handle h_fm_port, uint8_t val);
2497
2498/** @} */ /* end of FM_PORT_advanced_init_grp group */
2499/** @} */ /* end of FM_PORT_init_grp group */
2500
2501/*
2502 * @Group         FM_PORT_runtime_control_grp FM Port Runtime Control Unit
2503 *
2504 * @Description   FM Port Runtime control unit API functions, definitions and
2505 *                enums.
2506 *
2507 * @{
2508 */
2509
2510/*
2511 * @Description   enum for defining FM Port counters
2512 */
2513typedef 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;
2548
2549typedef struct t_fm_port_bmi_stats {
2550        uint32_t cnt_cycle;
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;
2556        uint32_t cnt_frame;
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;
2568
2569/*
2570 * @Description   Structure for Port id parameters.
2571 *                Fields commented 'IN' are passed by the port module to be used
2572 *                by the FM module.
2573 *                Fields commented 'OUT' will be filled by FM before returning
2574 *                to port.
2575 */
2576typedef 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
2580                         */
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'.
2584                         */
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.
2589                         */
2590} t_fm_port_congestion_grps;
2591
2592
2593#if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
2594/*
2595 * @Function      fm_port_dump_regs
2596 *
2597 * @Description   Dump all regs.
2598 *
2599 *                Calling this routine invalidates the descriptor.
2600 *
2601 * @Param[in]     h_fm_port     FM PORT module descriptor
2602 *
2603 * @Return        E_OK on success; Error code otherwise.
2604 *
2605 * @Cautions      Allowed only following fm_port_init().
2606 */
2607uint32_t fm_port_dump_regs(t_handle h_fm_port);
2608#endif /* (defined(DEBUG_ERRORS) && ... */
2609
2610/*
2611 * @Function      fm_port_get_buffer_data_offset
2612 *
2613 * @Description   Relevant for Rx ports. Returns the data offset from the
2614 *                beginning of the data buffer
2615 *
2616 * @Param[in]     h_fm_port     FM PORT module descriptor
2617 *
2618 * @Return        data offset.
2619 *
2620 * @Cautions      Allowed only following fm_port_init().
2621 */
2622uint32_t fm_port_get_buffer_data_offset(t_handle h_fm_port);
2623
2624/*
2625 * @Function      fm_port_get_buffer_icinfo
2626 *
2627 * @Description   Returns the Internal Context offset from the beginning of the
2628 *                data buffer
2629 *
2630 * @Param[in]     h_fm_port     FM PORT module descriptor
2631 * @Param[in]     p_data        A pointer to the data buffer.
2632 *
2633 * @Return        Internal context info pointer on success, NULL if
2634 *                'allOtherInfo' was not configured for this port.
2635 *
2636 * @Cautions      Allowed only following fm_port_init().
2637 */
2638uint8_t *fm_port_get_buffer_icinfo(t_handle h_fm_port, char *p_data);
2639
2640/*
2641 * @Function      fm_port_get_buffer_prs_result
2642 *
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.
2651 *
2652 * @Param[in]     h_fm_port     FM PORT module descriptor
2653 * @Param[in]     p_data        A pointer to the data buffer.
2654 *
2655 * @Return        Parse result pointer on success, NULL if parse result was not
2656 *                configured for this port.
2657 *
2658 * @Cautions      Allowed only following fm_port_init().
2659 */
2660t_fm_prs_result *fm_port_get_buffer_prs_result(t_handle h_fm_port,
2661                                                char *p_data);
2662
2663/*
2664 * @Function      fm_port_get_buffer_time_stamp
2665 *
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.
2670 *
2671 * @Param[in]     h_fm_port     FM PORT module descriptor
2672 * @Param[in]     p_data        A pointer to the data buffer.
2673 *
2674 * @Return        A pointer to the hash result on success, NULL otherwise.
2675 *
2676 * @Cautions      Allowed only following fm_port_init().
2677 */
2678uint64_t *fm_port_get_buffer_time_stamp(t_handle h_fm_port, char *p_data);
2679
2680/*
2681 * @Function      fm_port_get_buffer_hash_result
2682 *
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.
2687 *
2688 * @Param[in]     h_fm_port     FM PORT module descriptor
2689 * @Param[in]     p_data        A pointer to the data buffer.
2690 *
2691 * @Return        A pointer to the hash result on success, NULL otherwise.
2692 *
2693 * @Cautions      Allowed only following fm_port_init().
2694 */
2695uint8_t *fm_port_get_buffer_hash_result(t_handle h_fm_port, char *p_data);
2696
2697/*
2698 * @Function      fm_port_disable
2699 *
2700 * @Description   Gracefully disable an FM port. The port will not start new
2701 *                tasks after all tasks associated with the port are terminated.
2702 *
2703 * @Param[in]     h_fm_port     A handle to a FM Port module.
2704 *
2705 * @Return        E_OK on success; Error code otherwise.
2706 *
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
2711 *                began
2712 */
2713uint32_t fm_port_disable(t_handle h_fm_port);
2714
2715/*
2716 * @Function      fm_port_enable
2717 *
2718 * @Description   A runtime routine provided to allow disable/enable of port.
2719 *
2720 * @Param[in]     h_fm_port     A handle to a FM Port module.
2721 *
2722 * @Return        E_OK on success; Error code otherwise.
2723 *
2724 * @Cautions     Allowed only following fm_port_init().
2725 */
2726uint32_t fm_port_enable(t_handle h_fm_port);
2727
2728/*
2729 * @Function      fm_port_set_rate_limit
2730 *
2731 * @Description   Calling this routine enables rate limit algorithm.
2732 *                By default, this functionality is disabled.
2733 *
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.
2737 *
2738 *                May be used for Tx and OP ports only
2739 *
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
2742 *
2743 * @Return        E_OK on success; Error code otherwise.
2744 *
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.
2748 */
2749uint32_t fm_port_set_rate_limit(t_handle h_fm_port,
2750                                t_fm_port_rate_limit *p_rate_limit);
2751
2752/*
2753 * @Function      fm_port_delete_rate_limit
2754 *
2755 * @Description   Calling this routine disables and clears rate limit
2756 *                initialization.
2757 *
2758 *                May be used for Tx and OP ports only
2759 *
2760 * @Param[in]     h_fm_port     A handle to a FM Port module.
2761 *
2762 * @Return        E_OK on success; Error code otherwise.
2763 *
2764 * @Cautions      Allowed only following fm_port_init().
2765 */
2766uint32_t fm_port_delete_rate_limit(t_handle h_fm_port);
2767
2768/*
2769 * @Function      fm_port_set_pfc_priorities_mapping_to_qman_wq
2770
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.
2774 *
2775 *                May be used for Tx ports only.
2776 *
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).
2780 *
2781 * @Return        E_OK on success; Error code otherwise.
2782 *
2783 * @Cautions      Allowed only following fm_port_init().
2784 */
2785uint32_t fm_port_set_pfc_priorities_mapping_to_qman_wq(t_handle h_fm_port,
2786                                                uint8_t prio, uint8_t wq);
2787
2788/*
2789 * @Function      fm_port_set_statistics_counters
2790 *
2791 * @Description   Calling this routine enables/disables port's statistics
2792 *                counters. By default, counters are enabled.
2793 *
2794 *                May be used for all port types
2795 *
2796 * @Param[in]     h_fm_port     A handle to a FM Port module.
2797 * @Param[in]     enable        TRUE to enable, FALSE to disable.
2798 *
2799 * @Return        E_OK on success; Error code otherwise.
2800 *
2801 * @Cautions      Allowed only following fm_port_init().
2802 */
2803uint32_t fm_port_set_statistics_counters(t_handle h_fm_port, bool enable);
2804
2805/*
2806 * @Function      fm_port_set_frame_queue_counters
2807 *
2808 * @Description   Calling this routine enables/disables port's enqueue/dequeue
2809 *                counters. By default, counters are enabled.
2810 *
2811 *                May be used for all ports
2812 *
2813 * @Param[in]     h_fm_port     A handle to a FM Port module.
2814 * @Param[in]     enable        TRUE to enable, FALSE to disable.
2815 *
2816 * @Return        E_OK on success; Error code otherwise.
2817 *
2818 * @Cautions      Allowed only following fm_port_init().
2819 */
2820uint32_t fm_port_set_frame_queue_counters(t_handle h_fm_port,
2821                                                bool enable);
2822
2823/*
2824 * @Function      fm_port_analyze_performance_params
2825 *
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.
2830 *
2831 *                May be used for all port types
2832 *
2833 * @Param[in]     h_fm_port             A handle to a FM Port module.
2834 *
2835 * @Return        E_OK on success; Error code otherwise.
2836 *
2837 * @Cautions      Allowed only following fm_port_init().
2838 */
2839uint32_t fm_port_analyze_performance_params(t_handle h_fm_port);
2840
2841/*
2842 * @Function      fm_port_set_alloc_buf_counter
2843 *
2844 * @Description   Calling this routine enables/disables BM pool allocate
2845 *                buffer counters.
2846 *                By default, counters are enabled.
2847 *
2848 *                May be used for Rx ports only
2849 *
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.
2853 *
2854 * @Return        E_OK on success; Error code otherwise.
2855 *
2856 * @Cautions      Allowed only following fm_port_init().
2857 */
2858uint32_t fm_port_set_alloc_buf_counter(t_handle h_fm_port,
2859                                                uint8_t pool_id, bool enable);
2860
2861/*
2862 * @Function    fm_port_get_bmi_counters
2863 *
2864 * @Description   Read port's BMI stat counters and place them into
2865 *                a designated structure of counters.
2866 *
2867 * @Param[in]     h_fm_port     A handle to a FM Port module.
2868 * @Param[out]    p_bmi_stats   counters structure
2869 *
2870 * @Return        E_OK on success; Error code otherwise.
2871 *
2872 * @Cautions      Allowed only following fm_port_init().
2873 */
2874uint32_t fm_port_get_bmi_counters(t_handle h_fm_port,
2875                                        t_fm_port_bmi_stats *p_bmi_stats);
2876
2877/*
2878 * @Function      fm_port_get_counter
2879 *
2880 * @Description   Reads one of the FM PORT counters.
2881 *
2882 * @Param[in]     h_fm_port             A handle to a FM Port module.
2883 * @Param[in]     fm_port_counter       The requested counter.
2884 *
2885 * @Return        Counter's current value.
2886 *
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.
2891 */
2892uint32_t fm_port_get_counter(t_handle h_fm_port,
2893                e_fm_port_counters fm_port_counter);
2894
2895/*
2896 * @Function      fm_port_modify_counter
2897 *
2898 * @Description   Sets a value to an enabled counter. Use "0" to reset the
2899 *                counter.
2900 *
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
2904 *                                      the counter.
2905 *
2906 * @Return        E_OK on success; Error code otherwise.
2907 *
2908 * @Cautions      Allowed only following fm_port_init().
2909 */
2910uint32_t fm_port_modify_counter(t_handle h_fm_port,
2911                e_fm_port_counters fm_port_counter, uint32_t value);
2912
2913/*
2914 * @Function      fm_port_get_alloc_buf_counter
2915 *
2916 * @Description   Reads one of the FM PORT buffer counters.
2917 *
2918 * @Param[in]     h_fm_port             A handle to a FM Port module.
2919 * @Param[in]     pool_id               The requested pool.
2920 *
2921 * @Return        Counter's current value.
2922 *
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.
2927 */
2928uint32_t fm_port_get_alloc_buf_counter(t_handle h_fm_port,
2929                        uint8_t pool_id);
2930
2931/*
2932 * @Function      fm_port_modify_alloc_buf_counter
2933 *
2934 * @Description   Sets a value to an enabled counter. Use "0" to reset the
2935 *                counter.
2936 *
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
2940 *                              counter.
2941 *
2942 * @Return        E_OK on success; Error code otherwise.
2943 *
2944 * @Cautions      Allowed only following fm_port_init().
2945 */
2946uint32_t fm_port_modify_alloc_buf_counter(t_handle h_fm_port,
2947                        uint8_t pool_id, uint32_t value);
2948
2949/*
2950 * @Function    fm_port_add_congestion_grps
2951 *
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.
2958 *
2959 *                May be used for Rx, or RX + OP ports only (depending on chip)
2960 *
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.
2964 *
2965 * @Return        E_OK on success; Error code otherwise.
2966 *
2967 * @Cautions      Allowed only following fm_port_init().
2968 */
2969uint32_t fm_port_add_congestion_grps(t_handle h_fm_port,
2970                        t_fm_port_congestion_grps *p_congestion_grps);
2971
2972/*
2973 * @Function      fm_port_remove_congestion_grps
2974 *
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.
2981 *
2982 *                May be used for Rx, or RX + OP ports only (depending on chip)
2983 *
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.
2987 *
2988 * @Return        E_OK on success; Error code otherwise.
2989 *
2990 * @Cautions      Allowed only following fm_port_init().
2991 */
2992uint32_t fm_port_remove_congestion_grps(t_handle h_fm_port,
2993                        t_fm_port_congestion_grps *p_congestion_grps);
2994
2995/*
2996 * @Function      fm_port_is_stalled
2997 *
2998 * @Description   A routine for checking whether the specified port is stalled.
2999 *
3000 * @Param[in]     h_fm_port     A handle to a FM Port module.
3001 *
3002 * @Return        TRUE if port is stalled, FALSE otherwise
3003 *
3004 * @Cautions      Allowed only following fm_port_init().
3005 */
3006bool fm_port_is_stalled(t_handle h_fm_port);
3007
3008/*
3009 * @Function    fm_port_release_stalled
3010 *
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).
3015 *
3016 * @Param[in]     h_fm_port     A handle to a FM Port module.
3017 *
3018 * @Return        E_OK on success; Error code otherwise.
3019 *
3020 * @Cautions      Allowed only following fm_port_init().
3021 */
3022uint32_t fm_port_release_stalled(t_handle h_fm_port);
3023
3024/*
3025 * @Function      fm_port_set_rx_l4checksum_verify
3026 *
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
3030 *                enabled !
3031 *
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
3034 *                              on frames or not.
3035 *
3036 * @Return        E_OK on success; Error code otherwise.
3037 *
3038 * @Cautions      Allowed only following fm_port_init().
3039 */
3040uint32_t fm_port_set_rx_l4checksum_verify(t_handle h_fm_port,
3041                        bool l_4checksum);
3042
3043/*
3044 * @Function      fm_port_set_errors_route
3045 *
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.
3053 *
3054 *                May be used for Rx and OP ports only
3055 *
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
3058 *
3059 * @Return        E_OK on success; Error code otherwise.
3060 *
3061 * @Cautions      Allowed only following fm_port_config() and before
3062 *                fm_port_init().
3063 */
3064uint32_t fm_port_set_errors_route(t_handle h_fm_port,
3065                                fm_port_frame_err_select_t errs);
3066
3067/*
3068 * @Function      fm_port_set_imexceptions
3069 *
3070 * @Description   Calling this routine enables/disables FM PORT interrupts.
3071 *
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.
3075 *
3076 * @Return        E_OK on success; Error code otherwise.
3077 *
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)
3081 */
3082uint32_t fm_port_set_imexceptions(t_handle h_fm_port,
3083                                e_fm_port_exceptions exception, bool enable);
3084
3085/*
3086 * @Function      fm_port_set_performance_counters
3087 *
3088 * @Description   Calling this routine enables/disables port's performance
3089 *                counters. By default, counters are enabled.
3090 *
3091 *                May be used for all port types
3092 *
3093 * @Param[in]     h_fm_port             A handle to a FM Port module.
3094 * @Param[in]     enable                TRUE to enable, FALSE to disable.
3095 *
3096 * @Return        E_OK on success; Error code otherwise.
3097 *
3098 * @Cautions    Allowed only following fm_port_init().
3099 */
3100uint32_t fm_port_set_performance_counters(t_handle h_fm_port,
3101                                                bool enable);
3102
3103/*
3104 * @Function      fm_port_set_performance_counters_params
3105 *
3106 * @Description   Calling this routine defines port's performance counters
3107 *                parameters.
3108 *
3109 *                May be used for all port types
3110 *
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.
3114 *
3115 * @Return        E_OK on success; Error code otherwise.
3116 *
3117 * @Cautions      Allowed only following fm_port_init().
3118 */
3119uint32_t fm_port_set_performance_counters_params(t_handle h_fm_port,
3120                        t_fm_port_performance_cnt *p_fm_port_performance_cnt);
3121
3122/*
3123 * @Group         FM_PORT_pcd_runtime_control_grp
3124 *                FM Port PCD Runtime Control Unit
3125 *
3126 * @Description   FM Port PCD Runtime control unit API functions, definitions
3127 *                and enums.
3128 *
3129 * @Function      fm_port_set_pcd
3130 *
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.
3135 *
3136 *                May be used for Rx and OP ports only
3137 *
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.
3141 *
3142 * @Return        E_OK on success; Error code otherwise.
3143 *
3144 * @Cautions      Allowed only following fm_port_init().
3145 */
3146uint32_t fm_port_set_pcd(t_handle h_fm_port,
3147                        ioc_fm_port_pcd_params_t *p_fm_port_pcd);
3148
3149/*
3150 * @Function      fm_port_delete_pcd
3151 *
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.
3155 *
3156 *                May be used for Rx and OP ports which are in PCD mode only
3157 *
3158 * @Param[in]     h_fm_port     A handle to a FM Port module.
3159 *
3160 * @Return        E_OK on success; Error code otherwise.
3161 *
3162 * @Cautions      Allowed only following fm_port_init().
3163 */
3164uint32_t fm_port_delete_pcd(t_handle h_fm_port);
3165
3166/*
3167 * @Function      fm_port_attach_pcd
3168 *
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.
3174 *
3175 *                May be used for Rx and OP ports which are in PCD mode only
3176 *
3177 * @Param[in]     h_fm_port     A handle to a FM Port module.
3178 *
3179 * @Return        E_OK on success; Error code otherwise.
3180 *
3181 * @Cautions      Allowed only following fm_port_init().
3182 */
3183uint32_t fm_port_attach_pcd(t_handle h_fm_port);
3184
3185/*
3186 * @Function      fm_port_detach_pcd
3187 *
3188 * @Description   Calling this routine detaches the port from its PCD
3189 *                functionality. The port returns to its default flow which is
3190 *                BMI to BMI.
3191 *
3192 *                May be used for Rx and OP ports which are in PCD mode only
3193 *
3194 * @Param[in]     h_fm_port     A handle to a FM Port module.
3195 *
3196 * @Return        E_OK on success; Error code otherwise.
3197 *
3198 * @Cautions      Allowed only following fm_port_attach_pcd().
3199 */
3200uint32_t fm_port_detach_pcd(t_handle h_fm_port);
3201
3202/*
3203 * @Function      fm_port_pcd_plcr_alloc_profiles
3204 *
3205 * @Description   This routine may be called only for ports that use the Policer
3206 *                in order to allocate private policer profiles.
3207 *
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
3210 *
3211 * @Return        E_OK on success; Error code otherwise.
3212 *
3213 * @Cautions      Allowed only following fm_port_init() and fm_pcd_init(), and
3214 *                before fm_port_set_pcd().
3215 */
3216uint32_t fm_port_pcd_plcr_alloc_profiles(t_handle h_fm_port,
3217                        uint16_t num_of_profiles);
3218
3219/*
3220 * @Function      fm_port_pcd_plcr_free_profiles
3221 *
3222 * @Description   This routine should be called for freeing private policer
3223 *                profiles.
3224 *
3225 * @Param[in]     h_fm_port             A handle to a FM Port module.
3226 *
3227 * @Return        E_OK on success; Error code otherwise.
3228 *
3229 * @Cautions      Allowed only following fm_port_init() and fm_pcd_init(), and
3230 *                before fm_port_set_pcd().
3231 */
3232uint32_t fm_port_pcd_plcr_free_profiles(t_handle h_fm_port);
3233
3234/*
3235 * @Function      fm_port_pcd_kg_modify_initial_scheme
3236 *
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.
3242 *
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.
3247 *
3248 * @Return        E_OK on success; Error code otherwise.
3249 *
3250 * @Cautions      Allowed only following fm_port_init() and fm_port_set_pcd().
3251 */
3252uint32_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);
3254
3255/*
3256 * @Function      fm_port_pcd_plcr_modify_initial_profile
3257 *
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.
3263 *
3264 * @Param[in]     h_fm_port             A handle to a FM Port module.
3265 * @Param[in]     h_profile             Policer profile handle
3266 *
3267 * @Return        E_OK on success; Error code otherwise.
3268 *
3269 * @Cautions      Allowed only following fm_port_init() and fm_port_set_pcd().
3270 */
3271uint32_t fm_port_pcd_plcr_modify_initial_profile(t_handle h_fm_port,
3272                                                t_handle h_profile);
3273
3274/*
3275 * @Function      fm_port_pcd_cc_modify_tree
3276 *
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.
3283 *
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.
3287 *
3288 * @Return        E_OK on success; Error code otherwise.
3289 *
3290 * @Cautions      Allowed only following fm_port_init(), fm_port_set_pcd() and
3291 *                fm_port_detach_pcd()
3292 */
3293uint32_t fm_port_pcd_cc_modify_tree(t_handle h_fm_port, t_handle h_cc_tree);
3294
3295/*
3296 * @Function      fm_port_pcd_kg_bind_schemes
3297 *
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.
3301 *
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
3304 *                                      to be added.
3305 *
3306 * @Return        E_OK on success; Error code otherwise.
3307 *
3308 * @Cautions      Allowed only following fm_port_init() and fm_port_set_pcd().
3309 */
3310uint32_t fm_port_pcd_kg_bind_schemes(t_handle h_fm_port,
3311                        ioc_fm_pcd_port_schemes_params_t *p_port_scheme);
3312
3313/*
3314 * @Function      fm_port_pcd_kg_unbind_schemes
3315 *
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.
3319 *
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
3322 *                                      to be added.
3323 *
3324 * @Return        E_OK on success; Error code otherwise.
3325 *
3326 * @Cautions      Allowed only following fm_port_init() and fm_port_set_pcd().
3327 */
3328uint32_t fm_port_pcd_kg_unbind_schemes(t_handle h_fm_port,
3329                        ioc_fm_pcd_port_schemes_params_t *p_port_scheme);
3330
3331/*
3332 * @Function      fm_port_get_ipv_4options_count
3333 *
3334 * @Description   TODO
3335 *
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
3338 *
3339 * @Return        E_OK on success; Error code otherwise.
3340 *
3341 * @Cautions      Allowed only following fm_port_init()
3342 */
3343uint32_t fm_port_get_ipv_4options_count(t_handle h_fm_port,
3344                                uint32_t *p_ipv_4options_count);
3345
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 */
3351