dpdk/drivers/net/dpaa/fmlib/fm_pcd_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_PCD_EXT_H
   7#define __FM_PCD_EXT_H
   8
   9#include "ncsw_ext.h"
  10#include "net_ext.h"
  11#include "fm_ext.h"
  12
  13/*
  14 * @Description   FM PCD ...
  15 * @Group         lnx_ioctl_FM_grp Frame Manager Linux IOCTL API
  16 * @Description   Frame Manager Linux ioctls definitions and enums
  17 * @{
  18 */
  19
  20/*
  21 * @Group         lnx_ioctl_FM_PCD_grp FM PCD
  22 * @Description   Frame Manager PCD API functions, definitions and enums
  23 *
  24 *                The FM PCD module is responsible for the initialization of all
  25 *                global classifying FM modules. This includes the parser
  26 *                general and common registers, the key generator global and
  27 *                common registers, and the policer global and common registers.
  28 *                In addition, the FM PCD SW module will initialize all required
  29 *                key generator schemes, coarse classification flows, and
  30 *                policer profiles. When an FM module is configured to work with
  31 *                one of these entities, it will register to it using the FM
  32 *                PORT API. The PCD module will manage the PCD resources - i.e.
  33 *                resource management of KeyGen schemes, etc.
  34 *
  35 * @{
  36 */
  37
  38/*
  39 * @Collection  General PCD defines
  40 */
  41#define IOC_FM_PCD_MAX_NUM_OF_PRIVATE_HDRS              2
  42/**< Number of units/headers saved for user */
  43
  44#define IOC_FM_PCD_PRS_NUM_OF_HDRS                      16
  45/**< Number of headers supported by HW parser */
  46#define IOC_FM_PCD_MAX_NUM_OF_DISTINCTION_UNITS \
  47        (32 - IOC_FM_PCD_MAX_NUM_OF_PRIVATE_HDRS)
  48/**< Number of distinction units is limited by register size (32 bits) minus
  49 * reserved bits for private headers.
  50 */
  51#define IOC_FM_PCD_MAX_NUM_OF_INTERCHANGEABLE_HDRS      4
  52/**< Maximum number of interchangeable headers in a distinction unit */
  53#define IOC_FM_PCD_KG_NUM_OF_GENERIC_REGS               8
  54/**< Total number of generic KeyGen registers */
  55#define IOC_FM_PCD_KG_MAX_EXTRACTS_PER_KEY      35
  56/**< Max number allowed on any configuration; For HW implementation reasons,
  57 * in most cases less than this will be allowed; The driver will return an
  58 * initialization error if resource is unavailable.
  59 */
  60#define IOC_FM_PCD_KG_NUM_OF_EXTRACT_MASKS              4
  61/**< Total number of masks allowed on KeyGen extractions. */
  62#define IOC_FM_PCD_KG_NUM_OF_DEFAULT_GROUPS             16
  63/**< Number of default value logical groups */
  64#define IOC_FM_PCD_PRS_NUM_OF_LABELS                    32
  65/**< Maximum number of SW parser labels */
  66#define IOC_FM_PCD_SW_PRS_SIZE                  0x00000800
  67/**< Total size of SW parser area */
  68
  69#define IOC_FM_PCD_MAX_MANIP_INSRT_TEMPLATE_SIZE        128
  70/**< Maximum size of insertion template for insert manipulation */
  71
  72#define IOC_FM_PCD_FRM_REPLIC_MAX_NUM_OF_ENTRIES        64
  73/**< Maximum possible entries for frame replicator group */
  74/* @} */
  75
  76/*
  77 * @Group         lnx_ioctl_FM_PCD_init_grp FM PCD Initialization Unit
  78 *
  79 * @Description   Frame Manager PCD Initialization Unit API
  80 *
  81 * @{
  82 */
  83
  84/*
  85 * @Description   PCD counters
  86 *                (must match enum ioc_fm_pcd_counters defined in fm_pcd_ext.h)
  87 */
  88typedef enum ioc_fm_pcd_counters {
  89        e_IOC_FM_PCD_KG_COUNTERS_TOTAL,         /**< KeyGen counter */
  90        e_IOC_FM_PCD_PLCR_COUNTERS_RED,
  91        /**< Policer counter - counts the total number of RED packets that exit
  92         * the Policer.
  93         */
  94        e_IOC_FM_PCD_PLCR_COUNTERS_YELLOW,
  95        /**< Policer counter - counts the total number of YELLOW packets that
  96         * exit the Policer.
  97         */
  98        e_IOC_FM_PCD_PLCR_COUNTERS_RECOLORED_TO_RED,
  99        /**< Policer counter - counts the number of packets that changed color
 100         * to RED by the Policer; This is a subset of
 101         * e_IOC_FM_PCD_PLCR_COUNTERS_RED packet count, indicating active color
 102         * changes.
 103         */
 104        e_IOC_FM_PCD_PLCR_COUNTERS_RECOLORED_TO_YELLOW,
 105        /**< Policer counter - counts the number of packets that changed color
 106         * to YELLOW by the Policer; This is a subset of
 107         * e_IOC_FM_PCD_PLCR_COUNTERS_YELLOW packet count, indicating active
 108         * color changes.
 109         */
 110        e_IOC_FM_PCD_PLCR_COUNTERS_TOTAL,
 111        /**< Policer counter - counts the total number of packets passed in the
 112         * Policer.
 113         */
 114        e_IOC_FM_PCD_PLCR_COUNTERS_LENGTH_MISMATCH,
 115        /**< Policer counter - counts the number of packets with length
 116         * mismatch.
 117         */
 118        e_IOC_FM_PCD_PRS_COUNTERS_PARSE_DISPATCH,
 119        /**< Parser counter - counts the number of times the parser block is
 120         * dispatched.
 121         */
 122        e_IOC_FM_PCD_PRS_COUNTERS_L2_PARSE_RESULT_RETURNED,
 123        /**< Parser counter - counts the number of times L2 parse result is
 124         * returned (including errors).
 125         */
 126        e_IOC_FM_PCD_PRS_COUNTERS_L3_PARSE_RESULT_RETURNED,
 127        /**< Parser counter - counts the number of times L3 parse result is
 128         * returned (including errors).
 129         */
 130        e_IOC_FM_PCD_PRS_COUNTERS_L4_PARSE_RESULT_RETURNED,
 131        /**< Parser counter - counts the number of times L4 parse result is
 132         * returned (including errors).
 133         */
 134        e_IOC_FM_PCD_PRS_COUNTERS_SHIM_PARSE_RESULT_RETURNED,
 135        /**< Parser counter - counts the number of times SHIM parse result is
 136         * returned (including errors).
 137         */
 138        e_IOC_FM_PCD_PRS_COUNTERS_L2_PARSE_RESULT_RETURNED_WITH_ERR,
 139        /**< Parser counter - counts the number of times L2 parse result is
 140         * returned with errors.
 141         */
 142        e_IOC_FM_PCD_PRS_COUNTERS_L3_PARSE_RESULT_RETURNED_WITH_ERR,
 143        /**< Parser counter - counts the number of times L3 parse result is
 144         * returned with errors.
 145         */
 146        e_IOC_FM_PCD_PRS_COUNTERS_L4_PARSE_RESULT_RETURNED_WITH_ERR,
 147        /**< Parser counter - counts the number of times L4 parse result is
 148         * returned with errors.
 149         */
 150        e_IOC_FM_PCD_PRS_COUNTERS_SHIM_PARSE_RESULT_RETURNED_WITH_ERR,
 151        /**< Parser counter - counts the number of times SHIM parse result is
 152         * returned with errors.
 153         */
 154        e_IOC_FM_PCD_PRS_COUNTERS_SOFT_PRS_CYCLES,
 155        /**< Parser counter - counts the number of cycles spent executing soft
 156         * parser instruction (including stall cycles).
 157         */
 158        e_IOC_FM_PCD_PRS_COUNTERS_SOFT_PRS_STALL_CYCLES,
 159        /**< Parser counter - counts the number of cycles stalled waiting for
 160         * parser internal memory reads while executing soft parser instruction.
 161         */
 162        e_IOC_FM_PCD_PRS_COUNTERS_HARD_PRS_CYCLE_INCL_STALL_CYCLES,
 163        /**< Parser counter - counts the number of cycles spent executing hard
 164         * parser (including stall cycles).
 165         */
 166        e_IOC_FM_PCD_PRS_COUNTERS_MURAM_READ_CYCLES,
 167        /**< MURAM counter - counts the number of cycles while performing FMan
 168         * Memory read.
 169         */
 170        e_IOC_FM_PCD_PRS_COUNTERS_MURAM_READ_STALL_CYCLES,
 171        /**< MURAM counter - counts the number of cycles stalled while
 172         * performing FMan Memory read.
 173         */
 174        e_IOC_FM_PCD_PRS_COUNTERS_MURAM_WRITE_CYCLES,
 175        /**< MURAM counter - counts the number of cycles while performing FMan
 176         * Memory write.
 177         */
 178        e_IOC_FM_PCD_PRS_COUNTERS_MURAM_WRITE_STALL_CYCLES,
 179        /**< MURAM counter - counts the number of cycles stalled while
 180         * performing FMan Memory write.
 181         */
 182        e_IOC_FM_PCD_PRS_COUNTERS_FPM_COMMAND_STALL_CYCLES
 183        /**< FPM counter - counts the number of cycles stalled while performing
 184         * a FPM Command.
 185         */
 186} ioc_fm_pcd_counters;
 187
 188/*
 189 * @Description   PCD interrupts
 190 *                (must match enum ioc_fm_pcd_exceptions defined in
 191 *                fm_pcd_ext.h)
 192 */
 193typedef enum ioc_fm_pcd_exceptions {
 194        e_IOC_FM_PCD_KG_EXCEPTION_DOUBLE_ECC,
 195        /**< KeyGen double-bit ECC error is detected on internal memory read
 196         * access.
 197         */
 198        e_IOC_FM_PCD_KG_EXCEPTION_KEYSIZE_OVERFLOW,
 199        /**< KeyGen scheme configuration error indicating a key size larger than
 200         * 56 bytes.
 201         */
 202        e_IOC_FM_PCD_PLCR_EXCEPTION_DOUBLE_ECC,
 203        /**< Policer double-bit ECC error has been detected on PRAM read access.
 204         */
 205        e_IOC_FM_PCD_PLCR_EXCEPTION_INIT_ENTRY_ERROR,
 206        /**< Policer access to a non-initialized profile has been detected. */
 207        e_IOC_FM_PCD_PLCR_EXCEPTION_PRAM_SELF_INIT_COMPLETE,
 208        /**< Policer RAM self-initialization complete */
 209        e_IOC_FM_PCD_PLCR_EXCEPTION_ATOMIC_ACTION_COMPLETE,
 210        /**< Policer atomic action complete */
 211        e_IOC_FM_PCD_PRS_EXCEPTION_DOUBLE_ECC,
 212        /**< Parser double-bit ECC error */
 213        e_IOC_FM_PCD_PRS_EXCEPTION_SINGLE_ECC
 214        /**< Parser single-bit ECC error */
 215} ioc_fm_pcd_exceptions;
 216
 217/** @} */ /* end of lnx_ioctl_FM_PCD_init_grp group */
 218
 219/*
 220 * @Group         lnx_ioctl_FM_PCD_Runtime_grp FM PCD Runtime Unit
 221 *
 222 * @Description   Frame Manager PCD Runtime Unit
 223 *
 224 *                The runtime control allows creation of PCD infrastructure
 225 *                modules such as Network Environment Characteristics,
 226 *                Classification Plan Groups and Coarse Classification Trees.
 227 *                It also allows on-the-fly initialization, modification and
 228 *                removal of PCD modules such as KeyGen schemes, coarse
 229 *                classification nodes and Policer profiles.
 230 *
 231 *                In order to explain the programming model of the PCD driver
 232 *                interface a few terms should be explained, and will be used
 233 *                below.
 234 *                - Distinction Header - One of the 16 protocols supported by
 235 *                  the FM parser, or one of the SHIM headers (1 or 2). May be a
 236 *                  header with a special option (see below).
 237 *                - Interchangeable Headers Group - This is a group of Headers
 238 *                  recognized by either one of them. For example, if in a
 239 *                  specific context the user chooses to treat IPv4 and IPV6 in
 240 *                  the same way, they may create an interchangeable Headers
 241 *                  Unit consisting of these 2 headers.
 242 *                - A Distinction Unit - a Distinction Header or an
 243 *                  Interchangeable Headers Group.
 244 *                - Header with special option - applies to Ethernet, MPLS,
 245 *                  VLAN, IPv4 and IPv6, includes multicast, broadcast and other
 246 *                  protocol specific options. In terms of hardware it relates
 247 *                  to the options available in the classification plan.
 248 *                - Network Environment Characteristics - a set of Distinction
 249 *                  Units that define the total recognizable header selection
 250 *                  for a certain environment. This is NOT the list of all
 251 *                  headers that will ever appear in a flow, but rather
 252 *                  everything that needs distinction in a flow, where
 253 *                  distinction is made by KeyGen schemes and coarse
 254 *                  classification action descriptors.
 255 *
 256 *                The PCD runtime modules initialization is done in stages. The
 257 *                first stage after initializing the PCD module itself is to
 258 *                establish a Network Flows Environment Definition. The
 259 *                application may choose to establish one or more such
 260 *                environments. Later, when needed, the application will have to
 261 *                state, for some of its modules, to which single environment it
 262 *                belongs.
 263 *
 264 * @{
 265 */
 266
 267/*
 268 * @Description   structure for FM counters
 269 */
 270typedef struct ioc_fm_pcd_counters_params_t {
 271        ioc_fm_pcd_counters cnt;        /**< The requested counter */
 272        uint32_t        val;
 273                        /**< The requested value to get/set from/into the
 274                         * counter
 275                         */
 276} ioc_fm_pcd_counters_params_t;
 277
 278/*
 279 * @Description   structure for FM exception definitios
 280 */
 281typedef struct ioc_fm_pcd_exception_params_t {
 282        ioc_fm_pcd_exceptions exception;        /**< The requested exception */
 283        bool            enable;
 284                        /**< TRUE to enable interrupt, FALSE to mask it. */
 285} ioc_fm_pcd_exception_params_t;
 286
 287/*
 288 * @Description   A structure for SW parser labels (must be identical to struct
 289 *                t_fm_pcd_prs_label_params defined in fm_pcd_ext.h)
 290 */
 291typedef struct ioc_fm_pcd_prs_label_params_t {
 292        uint32_t instruction_offset;
 293                /**< SW parser label instruction offset (2 bytes resolution),
 294                 * relative to Parser RAM
 295                 */
 296        ioc_net_header_type     hdr;
 297                /**< The existence of this header will invoke the SW parser
 298                 * code.
 299                 */
 300        uint8_t index_per_hdr;
 301                /**< Normally 0, if more than one SW parser attachments for the
 302                 * same header, use this index to distinguish between them.
 303                 */
 304} ioc_fm_pcd_prs_label_params_t;
 305
 306/*
 307 * @Description   A structure for SW parser (Must match struct
 308 *                ioc_fm_pcd_prs_sw_params_t defined in fm_pcd_ext.h)
 309 */
 310typedef struct ioc_fm_pcd_prs_sw_params_t {
 311        bool            override;
 312                        /**< FALSE to invoke a check that nothing else was
 313                         * loaded to this address, including internal patches.
 314                         * TRUE to override any existing code.
 315                         */
 316        uint32_t        size;           /**< SW parser code size */
 317        uint16_t        base;
 318                        /**< SW parser base (in instruction counts! must be
 319                         * larger than 0x20)
 320                         */
 321        uint8_t         *p_code;        /**< SW parser code */
 322        uint32_t        sw_prs_data_params[IOC_FM_PCD_PRS_NUM_OF_HDRS];
 323                                        /**< SW parser data (parameters) */
 324        uint8_t         num_of_labels;  /**< Number of labels for SW parser. */
 325        ioc_fm_pcd_prs_label_params_t
 326                        labels_table[IOC_FM_PCD_PRS_NUM_OF_LABELS];
 327                        /**< SW parser labels table, containing num_of_labels
 328                         * entries
 329                         */
 330} ioc_fm_pcd_prs_sw_params_t;
 331
 332/*
 333 * @Description   A structure to set the a KeyGen default value
 334 */
 335typedef struct ioc_fm_pcd_kg_dflt_value_params_t {
 336        uint8_t         value_id;/**< 0,1 - one of 2 global default values */
 337        uint32_t        value;  /**< The requested default value */
 338} ioc_fm_pcd_kg_dflt_value_params_t;
 339
 340/*
 341 * @Function      fm_pcd_enable
 342 *
 343 * @Description   This routine should be called after PCD is initialized for
 344 *                enabling all PCD engines according to their existing
 345 *                configuration.
 346 *
 347 * @Return        0 on success; Error code otherwise.
 348 *
 349 * @Cautions      Allowed only when PCD is disabled.
 350 */
 351#define FM_PCD_IOC_ENABLE  _IO(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(1))
 352
 353/*
 354 * @Function      fm_pcd_disable
 355 *
 356 * @Description   This routine may be called when PCD is enabled in order to
 357 *                disable all PCD engines. It may be called only when none of
 358 *                the ports in the system are using the PCD.
 359 *
 360 * @Return        0 on success; Error code otherwise.
 361 *
 362 * @Cautions      Allowed only when PCD is enabled.
 363 */
 364#define FM_PCD_IOC_DISABLE  _IO(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(2))
 365
 366/*
 367 * @Function      fm_pcd_prs_load_sw
 368 *
 369 * @Description   This routine may be called only when all ports in the
 370 *                system are actively using the classification plan scheme.
 371 *                In such cases it is recommended in order to save resources.
 372 *                The driver automatically saves 8 classification plans for
 373 *                ports that do NOT use the classification plan mechanism, to
 374 *                avoid this (in order to save those entries) this routine may
 375 *                be called.
 376 *
 377 * @Param[in]     ioc_fm_pcd_prs_sw_params_t
 378 *                A pointer to the image of the software parser code.
 379 *
 380 * @Return        0 on success; Error code otherwise.
 381 *
 382 * @Cautions      Allowed only when PCD is disabled.
 383 */
 384#define FM_PCD_IOC_PRS_LOAD_SW \
 385        _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(3), ioc_fm_pcd_prs_sw_params_t)
 386
 387/*
 388 * @Function      fm_pcd_kg_set_dflt_value
 389 *
 390 * @Description   Calling this routine sets a global default value to be used
 391 *                by the KeyGen when parser does not recognize a required
 392 *                field/header.
 393 *                default value is 0.
 394 *
 395 * @Param[in]     ioc_fm_pcd_kg_dflt_value_params_t     A pointer to a structure
 396 *                                                      with the relevant
 397 *                                                      parameters
 398 *
 399 * @Return        0 on success; Error code otherwise.
 400 *
 401 * @Cautions      Allowed only when PCD is disabled.
 402 */
 403#define FM_PCD_IOC_KG_SET_DFLT_VALUE \
 404        _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(6), \
 405             ioc_fm_pcd_kg_dflt_value_params_t)
 406
 407/*
 408 * @Function      fm_pcd_kg_set_additional_data_after_parsing
 409 *
 410 * @Description   Calling this routine allows the keygen to access data past
 411 *                the parser finishing point.
 412 *
 413 * @Param[in]     uint8_t       payload-offset; the number of bytes beyond the
 414 *                              parser location.
 415 *
 416 * @Return        0 on success; Error code otherwise.
 417 *
 418 * @Cautions      Allowed only when PCD is disabled.
 419 */
 420#define FM_PCD_IOC_KG_SET_ADDITIONAL_DATA_AFTER_PARSING \
 421        _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(7), uint8_t)
 422
 423/*
 424 * @Function      fm_pcd_set_exception
 425 *
 426 * @Description   Calling this routine enables/disables PCD interrupts.
 427 *
 428 * @Param[in]     ioc_fm_pcd_exception_params_t
 429 *                Arguments struct with exception to be enabled/disabled.
 430 *
 431 * @Return        0 on success; Error code otherwise.
 432 */
 433#define FM_PCD_IOC_SET_EXCEPTION \
 434        _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(8), ioc_fm_pcd_exception_params_t)
 435
 436/*
 437 * @Function      fm_pcd_get_counter
 438 *
 439 * @Description   Reads one of the FM PCD counters.
 440 *
 441 * @Param[in,out] ioc_fm_pcd_counters_params_t The requested counter parameters.
 442 *
 443 * @Return        0 on success; Error code otherwise.
 444 *
 445 * @Cautions      It is user's responsibility to call this routine only
 446 *                for enabled counters, and there will be no indication if a
 447 *                disabled counter is accessed.
 448 */
 449#define FM_PCD_IOC_GET_COUNTER \
 450        _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(9), ioc_fm_pcd_counters_params_t)
 451
 452/*
 453 * @Function      fm_pcd_kg_scheme_get_counter
 454 *
 455 * @Description   Reads scheme packet counter.
 456 *
 457 * @Param[in]     h_scheme      scheme handle as returned by
 458 *                              fm_pcd_kg_scheme_set().
 459 *
 460 * @Return        Counter's current value.
 461 *
 462 * @Cautions      Allowed only following fm_pcd_init() & fm_pcd_kg_scheme_set().
 463 */
 464#define FM_PCD_IOC_KG_SCHEME_GET_CNTR \
 465        _IOR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(4), ioc_fm_pcd_kg_scheme_spc_t)
 466
 467/*
 468 * @Function      FM_PCD_ForceIntr
 469 *
 470 * @Description   Causes an interrupt event on the requested source.
 471 *
 472 * @Param[in]     ioc_fm_pcd_exceptions - An exception to be forced.
 473 *
 474 * @Return        0 on success; error code if the exception is not enabled,
 475 *                or is not able to create interrupt.
 476 */
 477#define FM_PCD_IOC_FORCE_INTR \
 478        _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(11), ioc_fm_pcd_exceptions)
 479
 480/*
 481 * @Collection  Definitions of coarse classification parameters as required by
 482 *              KeyGen (when coarse classification is the next engine after this
 483 *              scheme).
 484 */
 485#define IOC_FM_PCD_MAX_NUM_OF_CC_TREES          8
 486#define IOC_FM_PCD_MAX_NUM_OF_CC_GROUPS         16
 487#define IOC_FM_PCD_MAX_NUM_OF_CC_UNITS          4
 488#define IOC_FM_PCD_MAX_NUM_OF_KEYS              256
 489#define IOC_FM_PCD_MAX_NUM_OF_FLOWS             (4 * KILOBYTE)
 490#define IOC_FM_PCD_MAX_SIZE_OF_KEY              56
 491#define IOC_FM_PCD_MAX_CC_ENTRY_IN_GRP          16
 492#define IOC_FM_PCD_LAST_KEY_INDEX               0xffff
 493#define IOC_FM_PCD_MANIP_DSCP_VALUES            64
 494/* @} */
 495
 496/*
 497 * @Collection  A set of definitions to allow protocol
 498 *              special option description.
 499 */
 500typedef uint32_t                ioc_protocol_opt_t;
 501                /**< A general type to define a protocol option. */
 502
 503typedef ioc_protocol_opt_t  ioc_eth_protocol_opt_t;
 504                        /**< Ethernet protocol options. */
 505#define IOC_ETH_BROADCAST               0x80000000   /**< Ethernet Broadcast. */
 506#define IOC_ETH_MULTICAST               0x40000000   /**< Ethernet Multicast. */
 507
 508typedef ioc_protocol_opt_t  ioc_vlan_protocol_opt_t;
 509                                /**< Vlan protocol options. */
 510#define IOC_VLAN_STACKED                0x20000000   /**< Stacked VLAN. */
 511
 512typedef ioc_protocol_opt_t  ioc_mpls_protocol_opt_t;
 513                                /**< MPLS protocol options. */
 514#define IOC_MPLS_STACKED                0x10000000   /**< Stacked MPLS. */
 515
 516typedef ioc_protocol_opt_t  ioc_ipv4_protocol_opt_t;
 517                        /**< IPv4 protocol options. */
 518#define IOC_IPV4_BROADCAST_1            0x08000000   /**< IPv4 Broadcast. */
 519#define IOC_IPV4_MULTICAST_1            0x04000000   /**< IPv4 Multicast. */
 520#define IOC_IPV4_UNICAST_2              0x02000000
 521                                        /**< Tunneled IPv4 - Unicast.
 522                                         */
 523#define IOC_IPV4_MULTICAST_BROADCAST_2  0x01000000
 524                                        /**< Tunneled IPv4 -
 525                                         * Broadcast/Multicast.
 526                                         */
 527
 528#define IOC_IPV4_FRAG_1         0x00000008
 529                                /**< IPV4 reassembly option. IPV4
 530                                 * Reassembly manipulation requires network
 531                                 * environment with IPV4 header and IPV4_FRAG_1
 532                                 * option
 533                                 */
 534
 535typedef ioc_protocol_opt_t  ioc_ipv6_protocol_opt_t;
 536                                        /**< IPv6 protocol options. */
 537#define IOC_IPV6_MULTICAST_1            0x00800000   /**< IPv6 Multicast. */
 538#define IOC_IPV6_UNICAST_2              0x00400000
 539                                        /**< Tunneled IPv6 - Unicast. */
 540#define IOC_IPV6_MULTICAST_2            0x00200000
 541                                        /**< Tunneled IPv6 - Multicast. */
 542
 543#define IOC_IPV6_FRAG_1         0x00000004
 544                                /**< IPV6 reassembly option. IPV6 Reassembly
 545                                 * manipulation requires network environment
 546                                 * with IPV6 header and IPV6_FRAG_1 option
 547                                 */
 548typedef ioc_protocol_opt_t   ioc_capwap_protocol_opt_t;
 549                                        /**< CAPWAP protocol options. */
 550#define CAPWAP_FRAG_1           0x00000008
 551                                /**< CAPWAP reassembly option. CAPWAP Reassembly
 552                                 * manipulation requires network environment
 553                                 * with CAPWAP header and CAPWAP_FRAG_1 option;
 554                                 * in case where fragment found, the
 555                                 * fragment-extension offset may be found at
 556                                 * 'shim2' (in parser-result).
 557                                 */
 558
 559/* @} */
 560
 561#define IOC_FM_PCD_MANIP_MAX_HDR_SIZE           256
 562#define IOC_FM_PCD_MANIP_DSCP_TO_VLAN_TRANS     64
 563/**
 564 * @Collection  A set of definitions to support Header Manipulation selection.
 565 */
 566typedef uint32_t                        ioc_hdr_manip_flags_t;
 567        /**< A general type to define a HMan update command flags. */
 568
 569typedef ioc_hdr_manip_flags_t   ioc_ipv4_hdr_manip_update_flags_t;
 570        /**< IPv4 protocol HMan update command flags. */
 571
 572#define IOC_HDR_MANIP_IPV4_TOS  0x80000000
 573                        /**< update TOS with the given value ('tos' field of
 574                         * ioc_fm_pcd_manip_hdr_field_update_ipv4_t)
 575                         */
 576#define IOC_HDR_MANIP_IPV4_ID   0x40000000
 577                        /**< update IP ID with the given value ('id' field of
 578                         * ioc_fm_pcd_manip_hdr_field_update_ipv4_t)
 579                         */
 580#define IOC_HDR_MANIP_IPV4_TTL  0x20000000      /**< Decrement TTL by 1 */
 581#define IOC_HDR_MANIP_IPV4_SRC  0x10000000
 582                /**< update IP source address with the given value ('src' field
 583                 * of ioc_fm_pcd_manip_hdr_field_update_ipv4_t)
 584                 */
 585#define IOC_HDR_MANIP_IPV4_DST  0x08000000
 586                /**< update IP destination address with the given value
 587                 * ('dst' field of ioc_fm_pcd_manip_hdr_field_update_ipv4_t)
 588                 */
 589
 590typedef ioc_hdr_manip_flags_t   ioc_ipv6_hdr_manip_update_flags_t;
 591                        /**< IPv6 protocol HMan update command flags. */
 592
 593#define IOC_HDR_MANIP_IPV6_TC   0x80000000
 594        /**< update Traffic Class address with the given value ('traffic_class'
 595         * field of ioc_fm_pcd_manip_hdr_field_update_ipv6_t)
 596         */
 597#define IOC_HDR_MANIP_IPV6_HL   0x40000000      /**< Decrement Hop Limit by 1 */
 598#define IOC_HDR_MANIP_IPV6_SRC  0x20000000
 599                /**< update IP source address with the given value ('src' field
 600                 * of ioc_fm_pcd_manip_hdr_field_update_ipv6_t)
 601                 */
 602#define IOC_HDR_MANIP_IPV6_DST  0x10000000
 603                /**< update IP destination address with the given value ('dst'
 604                 * field of ioc_fm_pcd_manip_hdr_field_update_ipv6_t)
 605                 */
 606
 607typedef ioc_hdr_manip_flags_t   ioc_tcp_udp_hdr_manip_update_flags_t;
 608                /**< TCP/UDP protocol HMan update command flags. */
 609
 610#define IOC_HDR_MANIP_TCP_UDP_SRC       0x80000000
 611                /**< update TCP/UDP source address with the given value
 612                 * ('src' field of ioc_fm_pcd_manip_hdr_field_update_tcp_udp_t)
 613                 */
 614#define IOC_HDR_MANIP_TCP_UDP_DST       0x40000000
 615                /**< update TCP/UDP destination address with the given value
 616                 * ('dst' field of ioc_fm_pcd_manip_hdr_field_update_tcp_udp_t)
 617                 */
 618#define IOC_HDR_MANIP_TCP_UDP_CHECKSUM  0x20000000
 619                /**< update TCP/UDP checksum */
 620
 621/* @} */
 622
 623/*
 624 * @Description   A type used for returning the order of the key extraction.
 625 *                each value in this array represents the index of the
 626 *                extraction command as defined by the user in the
 627 *                initialization extraction array. The valid size of this array
 628 *                is the user define number of extractions required (also
 629 *                marked by the second '0' in this array).
 630 */
 631typedef uint8_t
 632        ioc_fm_pcd_kg_key_order_t [IOC_FM_PCD_KG_MAX_EXTRACTS_PER_KEY];
 633
 634/*
 635 *@Description   All PCD engines
 636 *              (must match enum e_FmPcdEngine defined in fm_pcd_ext.h)
 637 */
 638
 639typedef enum ioc_fm_pcd_engine {
 640        e_IOC_FM_PCD_INVALID = 0,   /**< Invalid PCD engine */
 641        e_IOC_FM_PCD_DONE,      /**< No PCD Engine indicated */
 642        e_IOC_FM_PCD_KG,                /**< KeyGen */
 643        e_IOC_FM_PCD_CC,                /**< Coarse Classifier */
 644        e_IOC_FM_PCD_PLCR,      /**< Policer */
 645        e_IOC_FM_PCD_PRS,       /**< Parser */
 646        e_IOC_FM_PCD_FR,        /**< Frame Replicator */
 647        e_IOC_FM_PCD_HASH       /**< Hash Table */
 648} ioc_fm_pcd_engine;
 649
 650/*
 651 * @Description   An enum for selecting extraction by header types
 652 *                (Must match enum e_FmPcdExtractByHdrType defined in
 653 *                fm_pcd_ext.h)
 654 */
 655typedef enum ioc_fm_pcd_extract_by_hdr_type {
 656        e_IOC_FM_PCD_EXTRACT_FROM_HDR,  /**< Extract bytes from header */
 657        e_IOC_FM_PCD_EXTRACT_FROM_FIELD,/**< Extract bytes from header field */
 658        e_IOC_FM_PCD_EXTRACT_FULL_FIELD /**< Extract a full field */
 659} ioc_fm_pcd_extract_by_hdr_type;
 660
 661/*
 662 * @Description   An enum for selecting extraction source (when it is not the
 663 *                header) (Must match enum e_FmPcdExtractFrom defined in
 664 *                fm_pcd_ext.h)
 665 */
 666typedef enum ioc_fm_pcd_extract_from {
 667        e_IOC_FM_PCD_EXTRACT_FROM_FRAME_START,
 668                        /**< KG & CC: Extract from beginning of frame */
 669        e_IOC_FM_PCD_EXTRACT_FROM_DFLT_VALUE,
 670                                /**< KG only: Extract from a default value */
 671        e_IOC_FM_PCD_EXTRACT_FROM_CURR_END_OF_PARSE,
 672                        /**< KG only: Extract from the point where parsing had
 673                         * finished
 674                         */
 675        e_IOC_FM_PCD_EXTRACT_FROM_KEY,  /**< CC only: Field where saved KEY */
 676        e_IOC_FM_PCD_EXTRACT_FROM_HASH, /**< CC only: Field where saved HASH */
 677        e_IOC_FM_PCD_EXTRACT_FROM_PARSE_RESULT,
 678                                /**< KG & CC: Extract from the parser result */
 679        e_IOC_FM_PCD_EXTRACT_FROM_ENQ_FQID,
 680                                /**< KG & CC: Extract from enqueue FQID */
 681        e_IOC_FM_PCD_EXTRACT_FROM_FLOW_ID
 682                                /**< CC only: Field where saved Dequeue FQID */
 683} ioc_fm_pcd_extract_from;
 684
 685/*
 686 * @Description   An enum for selecting extraction type
 687 */
 688typedef enum ioc_fm_pcd_extract_type {
 689        e_IOC_FM_PCD_EXTRACT_BY_HDR,    /**< Extract according to header */
 690        e_IOC_FM_PCD_EXTRACT_NON_HDR,
 691                /**< Extract from data that is not the header */
 692        e_IOC_FM_PCD_KG_EXTRACT_PORT_PRIVATE_INFO
 693                        /**< Extract private info as specified by user */
 694} ioc_fm_pcd_extract_type;
 695
 696/*
 697 * @Description   An enum for selecting a default
 698 */
 699typedef enum ioc_fm_pcd_kg_extract_dflt_select {
 700        e_IOC_FM_PCD_KG_DFLT_GBL_0,
 701                /**< Default selection is KG register 0 */
 702        e_IOC_FM_PCD_KG_DFLT_GBL_1,
 703                /**< Default selection is KG register 1 */
 704        e_IOC_FM_PCD_KG_DFLT_PRIVATE_0,
 705                /**< Default selection is a per scheme register 0 */
 706        e_IOC_FM_PCD_KG_DFLT_PRIVATE_1,
 707                /**< Default selection is a per scheme register 1 */
 708        e_IOC_FM_PCD_KG_DFLT_ILLEGAL    /**< Illegal selection */
 709} ioc_fm_pcd_kg_extract_dflt_select;
 710
 711/*
 712 * @Description   Enumeration type defining all default groups - each group
 713 *                shares a default value, one of four user-initialized values.
 714 */
 715typedef enum ioc_fm_pcd_kg_known_fields_dflt_types {
 716        e_IOC_FM_PCD_KG_MAC_ADDR,               /**< MAC Address */
 717        e_IOC_FM_PCD_KG_TCI,                    /**< TCI field */
 718        e_IOC_FM_PCD_KG_ENET_TYPE,              /**< ENET Type */
 719        e_IOC_FM_PCD_KG_PPP_SESSION_ID,         /**< PPP Session id */
 720        e_IOC_FM_PCD_KG_PPP_PROTOCOL_ID,        /**< PPP Protocol id */
 721        e_IOC_FM_PCD_KG_MPLS_LABEL,             /**< MPLS label */
 722        e_IOC_FM_PCD_KG_IP_ADDR,                /**< IP addr */
 723        e_IOC_FM_PCD_KG_PROTOCOL_TYPE,          /**< Protocol type */
 724        e_IOC_FM_PCD_KG_IP_TOS_TC,              /**< TOS or TC */
 725        e_IOC_FM_PCD_KG_IPV6_FLOW_LABEL,        /**< IPV6 flow label */
 726        e_IOC_FM_PCD_KG_IPSEC_SPI,              /**< IPSEC SPI */
 727        e_IOC_FM_PCD_KG_L4_PORT,                /**< L4 Port */
 728        e_IOC_FM_PCD_KG_TCP_FLAG,               /**< TCP Flag */
 729        e_IOC_FM_PCD_KG_GENERIC_FROM_DATA,
 730                /**< grouping implemented by SW, any data extraction that is not
 731                 * the full field described above
 732                 */
 733        e_IOC_FM_PCD_KG_GENERIC_FROM_DATA_NO_V,
 734                /**< grouping implemented by SW, any data extraction without
 735                 * validation
 736                 */
 737        e_IOC_FM_PCD_KG_GENERIC_NOT_FROM_DATA
 738                /**< grouping implemented by SW, extraction from parser result
 739                 * or direct use of default value
 740                 */
 741} ioc_fm_pcd_kg_known_fields_dflt_types;
 742
 743/*
 744 * @Description   Enumeration type for defining header index for scenarios with
 745 *                multiple (tunneled) headers
 746 */
 747typedef enum ioc_fm_pcd_hdr_index {
 748        e_IOC_FM_PCD_HDR_INDEX_NONE     =   0,
 749                                /**< used when multiple headers not used, also
 750                                 * to specify regular IP (not tunneled).
 751                                 */
 752        e_IOC_FM_PCD_HDR_INDEX_1,/**< may be used for VLAN, MPLS, tunneled IP */
 753        e_IOC_FM_PCD_HDR_INDEX_2,/**< may be used for MPLS, tunneled IP */
 754        e_IOC_FM_PCD_HDR_INDEX_3,/**< may be used for MPLS */
 755        e_IOC_FM_PCD_HDR_INDEX_LAST =   0xFF /**< may be used for VLAN, MPLS */
 756} ioc_fm_pcd_hdr_index;
 757
 758/*
 759 * @Description   Enumeration type for selecting the policer profile functional
 760 *                type
 761 */
 762typedef enum ioc_fm_pcd_profile_type_selection {
 763        e_IOC_FM_PCD_PLCR_PORT_PRIVATE,         /**< Port dedicated profile */
 764        e_IOC_FM_PCD_PLCR_SHARED
 765                        /**< Shared profile (shared within partition) */
 766} ioc_fm_pcd_profile_type_selection;
 767
 768/*
 769 * @Description   Enumeration type for selecting the policer profile algorithm
 770 */
 771typedef enum ioc_fm_pcd_plcr_algorithm_selection {
 772        e_IOC_FM_PCD_PLCR_PASS_THROUGH, /**< Policer pass through */
 773        e_IOC_FM_PCD_PLCR_RFC_2698,     /**< Policer algorithm RFC 2698 */
 774        e_IOC_FM_PCD_PLCR_RFC_4115      /**< Policer algorithm RFC 4115 */
 775} ioc_fm_pcd_plcr_algorithm_selection;
 776
 777/*
 778 * @Description   Enumeration type for selecting a policer profile color mode
 779 */
 780typedef enum ioc_fm_pcd_plcr_color_mode {
 781        e_IOC_FM_PCD_PLCR_COLOR_BLIND,  /**< Color blind */
 782        e_IOC_FM_PCD_PLCR_COLOR_AWARE   /**< Color aware */
 783} ioc_fm_pcd_plcr_color_mode;
 784
 785/*
 786 * @Description   Enumeration type for selecting a policer profile color
 787 */
 788typedef enum ioc_fm_pcd_plcr_color {
 789        e_IOC_FM_PCD_PLCR_GREEN,        /**< Green */
 790        e_IOC_FM_PCD_PLCR_YELLOW,       /**< Yellow */
 791        e_IOC_FM_PCD_PLCR_RED,          /**< Red */
 792        e_IOC_FM_PCD_PLCR_OVERRIDE      /**< Color override */
 793} ioc_fm_pcd_plcr_color;
 794
 795/*
 796 * @Description   Enumeration type for selecting the policer profile packet
 797 *                frame length selector
 798 */
 799typedef enum ioc_fm_pcd_plcr_frame_length_select {
 800        e_IOC_FM_PCD_PLCR_L2_FRM_LEN,   /**< L2 frame length */
 801        e_IOC_FM_PCD_PLCR_L3_FRM_LEN,   /**< L3 frame length */
 802        e_IOC_FM_PCD_PLCR_L4_FRM_LEN,   /**< L4 frame length */
 803        e_IOC_FM_PCD_PLCR_FULL_FRM_LEN  /**< Full frame length */
 804} ioc_fm_pcd_plcr_frame_length_select;
 805
 806/*
 807 * @Description   Enumeration type for selecting roll-back frame
 808 */
 809typedef enum ioc_fm_pcd_plcr_roll_back_frame_select {
 810        e_IOC_FM_PCD_PLCR_ROLLBACK_L2_FRM_LEN,  /**< Rollback L2 frame length */
 811        e_IOC_FM_PCD_PLCR_ROLLBACK_FULL_FRM_LEN
 812                                /**< Rollback Full frame length */
 813} ioc_fm_pcd_plcr_roll_back_frame_select;
 814
 815/*
 816 * @Description   Enumeration type for selecting the policer profile packet or
 817 *                byte mode
 818 */
 819typedef enum ioc_fm_pcd_plcr_rate_mode {
 820        e_IOC_FM_PCD_PLCR_BYTE_MODE,    /**< Byte mode */
 821        e_IOC_FM_PCD_PLCR_PACKET_MODE   /**< Packet mode */
 822} ioc_fm_pcd_plcr_rate_mode;
 823
 824/*
 825 * @Description   Enumeration type for defining action of frame
 826 */
 827typedef enum ioc_fm_pcd_done_action {
 828        e_IOC_FM_PCD_ENQ_FRAME = 0,     /**< Enqueue frame */
 829        e_IOC_FM_PCD_DROP_FRAME /**< Drop frame */
 830} ioc_fm_pcd_done_action;
 831
 832/*
 833 * @Description   Enumeration type for selecting the policer counter
 834 */
 835typedef enum ioc_fm_pcd_plcr_profile_counters {
 836        e_IOC_FM_PCD_PLCR_PROFILE_GREEN_PACKET_TOTAL_COUNTER,
 837                                        /**< Green packets counter */
 838        e_IOC_FM_PCD_PLCR_PROFILE_YELLOW_PACKET_TOTAL_COUNTER,
 839                                        /**< Yellow packets counter */
 840        e_IOC_FM_PCD_PLCR_PROFILE_RED_PACKET_TOTAL_COUNTER,
 841                                        /**< Red packets counter */
 842        e_IOC_FM_PCD_PLCR_PROFILE_RECOLOURED_YELLOW_PACKET_TOTAL_COUNTER,
 843                                        /**< Recolored yellow packets counter */
 844        e_IOC_FM_PCD_PLCR_PROFILE_RECOLOURED_RED_PACKET_TOTAL_COUNTER
 845                                        /**< Recolored red packets counter */
 846} ioc_fm_pcd_plcr_profile_counters;
 847
 848/*
 849 * @Description   Enumeration type for selecting the PCD action after extraction
 850 */
 851typedef enum ioc_fm_pcd_action {
 852        e_IOC_FM_PCD_ACTION_NONE,               /**< NONE  */
 853        e_IOC_FM_PCD_ACTION_EXACT_MATCH,
 854                /**< Exact match on the selected extraction */
 855        e_IOC_FM_PCD_ACTION_INDEXED_LOOKUP
 856                /**< Indexed lookup on the selected extraction */
 857} ioc_fm_pcd_action;
 858
 859/*
 860 * @Description   Enumeration type for selecting type of insert manipulation
 861 */
 862typedef enum ioc_fm_pcd_manip_hdr_insrt_type {
 863        e_IOC_FM_PCD_MANIP_INSRT_GENERIC,
 864                /**< Insert according to offset & size */
 865        e_IOC_FM_PCD_MANIP_INSRT_BY_HDR,
 866                /**< Insert according to protocol */
 867} ioc_fm_pcd_manip_hdr_insrt_type;
 868
 869/*
 870 * @Description   Enumeration type for selecting type of remove manipulation
 871 */
 872typedef enum ioc_fm_pcd_manip_hdr_rmv_type {
 873        e_IOC_FM_PCD_MANIP_RMV_GENERIC,
 874                /**< Remove according to offset & size */
 875        e_IOC_FM_PCD_MANIP_RMV_BY_HDR
 876                /**< Remove according to offset & size */
 877} ioc_fm_pcd_manip_hdr_rmv_type;
 878
 879/*
 880 * @Description   An enum for selecting specific L2 fields removal
 881 */
 882typedef enum ioc_fm_pcd_manip_hdr_rmv_specific_l2 {
 883        e_IOC_FM_PCD_MANIP_HDR_RMV_ETHERNET,    /**< Ethernet/802.3 MAC */
 884        e_IOC_FM_PCD_MANIP_HDR_RMV_STACKED_QTAGS,       /**< stacked QTags */
 885        e_IOC_FM_PCD_MANIP_HDR_RMV_ETHERNET_AND_MPLS,
 886                        /**< MPLS and Ethernet/802.3 MAC header unitl the header
 887                         * which follows the MPLS header
 888                         */
 889        e_IOC_FM_PCD_MANIP_HDR_RMV_MPLS
 890                        /**< Remove MPLS header (Unlimited MPLS labels) */
 891} ioc_fm_pcd_manip_hdr_rmv_specific_l2;
 892
 893/*
 894 * @Description   Enumeration type for selecting specific fields updates
 895 */
 896typedef enum ioc_fm_pcd_manip_hdr_field_update_type {
 897        e_IOC_FM_PCD_MANIP_HDR_FIELD_UPDATE_VLAN,       /**< VLAN updates */
 898        e_IOC_FM_PCD_MANIP_HDR_FIELD_UPDATE_IPV4,       /**< IPV4 updates */
 899        e_IOC_FM_PCD_MANIP_HDR_FIELD_UPDATE_IPV6,       /**< IPV6 updates */
 900        e_IOC_FM_PCD_MANIP_HDR_FIELD_UPDATE_TCP_UDP,    /**< TCP_UDP updates */
 901} ioc_fm_pcd_manip_hdr_field_update_type;
 902
 903/*
 904 * @Description   Enumeration type for selecting VLAN updates
 905 */
 906typedef enum ioc_fm_pcd_manip_hdr_field_update_vlan {
 907        e_IOC_FM_PCD_MANIP_HDR_FIELD_UPDATE_VLAN_VPRI,
 908                                /**< Replace VPri of outer most VLAN tag. */
 909        e_IOC_FM_PCD_MANIP_HDR_FIELD_UPDATE_DSCP_TO_VLAN
 910                                /**< DSCP to VLAN priority bits translation */
 911} ioc_fm_pcd_manip_hdr_field_update_vlan;
 912
 913/*
 914 * @Description   Enumeration type for selecting specific L2 fields removal
 915 */
 916typedef enum ioc_fm_pcd_manip_hdr_insrt_specific_l2 {
 917        e_IOC_FM_PCD_MANIP_HDR_INSRT_MPLS
 918                /**< Insert MPLS header (Unlimited MPLS labels) */
 919} ioc_fm_pcd_manip_hdr_insrt_specific_l2;
 920
 921/*
 922 * @Description   Enumeration type for selecting QoS mapping mode
 923 *
 924 *                Note: In all cases except
 925 *                'e_FM_PCD_MANIP_HDR_QOS_MAPPING_NONE' User should instruct the
 926 *                port to read the parser-result
 927 */
 928typedef enum ioc_fm_pcd_manip_hdr_qos_mapping_mode {
 929        e_IOC_FM_PCD_MANIP_HDR_QOS_MAPPING_NONE = 0,
 930                        /**< No mapping, QoS field will not be changed */
 931        e_IOC_FM_PCD_MANIP_HDR_QOS_MAPPING_AS_IS,
 932                        /**< QoS field will be overwritten by the last byte in
 933                         * the parser-result.
 934                         */
 935} ioc_fm_pcd_manip_hdr_qos_mapping_mode;
 936
 937/*
 938 * @Description   Enumeration type for selecting QoS source
 939 *
 940 *                Note: In all cases except 'e_FM_PCD_MANIP_HDR_QOS_SRC_NONE'
 941 *                User should left room for the parser-result on input/output
 942 *                buffer and instruct the port to read/write the parser-result
 943 *                to the buffer (RPD should be set)
 944 */
 945typedef enum ioc_fm_pcd_manip_hdr_qos_src {
 946        e_IOC_FM_PCD_MANIP_HDR_QOS_SRC_NONE = 0,
 947                        /**< TODO */
 948        e_IOC_FM_PCD_MANIP_HDR_QOS_SRC_USER_DEFINED,
 949                        /**< QoS will be taken from the last byte in the
 950                         * parser-result.
 951                         */
 952} ioc_fm_pcd_manip_hdr_qos_src;
 953
 954/*
 955 * @Description   Enumeration type for selecting type of header insertion
 956 */
 957typedef enum ioc_fm_pcd_manip_hdr_insrt_by_hdr_type {
 958        e_IOC_FM_PCD_MANIP_INSRT_BY_HDR_SPECIFIC_L2,
 959                        /**< Specific L2 fields insertion */
 960        e_IOC_FM_PCD_MANIP_INSRT_BY_HDR_IP,             /**< IP insertion */
 961        e_IOC_FM_PCD_MANIP_INSRT_BY_HDR_UDP,            /**< UDP insertion */
 962        e_IOC_FM_PCD_MANIP_INSRT_BY_HDR_UDP_LITE,
 963                        /**< UDP lite insertion */
 964        e_IOC_FM_PCD_MANIP_INSRT_BY_HDR_CAPWAP          /**< CAPWAP insertion */
 965} ioc_fm_pcd_manip_hdr_insrt_by_hdr_type;
 966
 967/*
 968 * @Description   Enumeration type for selecting specific custom command
 969 */
 970typedef enum ioc_fm_pcd_manip_hdr_custom_type {
 971        e_IOC_FM_PCD_MANIP_HDR_CUSTOM_IP_REPLACE,
 972                        /**< Replace IPv4/IPv6 */
 973        e_IOC_FM_PCD_MANIP_HDR_CUSTOM_GEN_FIELD_REPLACE,
 974} ioc_fm_pcd_manip_hdr_custom_type;
 975
 976/*
 977 * @Description   Enumeration type for selecting specific custom command
 978 */
 979typedef enum ioc_fm_pcd_manip_hdr_custom_ip_replace {
 980        e_IOC_FM_PCD_MANIP_HDR_CUSTOM_REPLACE_IPV4_BY_IPV6,
 981                                        /**< Replace IPv4 by IPv6 */
 982        e_IOC_FM_PCD_MANIP_HDR_CUSTOM_REPLACE_IPV6_BY_IPV4
 983                                        /**< Replace IPv6 by IPv4 */
 984} ioc_fm_pcd_manip_hdr_custom_ip_replace;
 985
 986/*
 987 * @Description   Enumeration type for selecting type of header removal
 988 */
 989typedef enum ioc_fm_pcd_manip_hdr_rmv_by_hdr_type {
 990        e_IOC_FM_PCD_MANIP_RMV_BY_HDR_SPECIFIC_L2 = 0,
 991                        /**< Specific L2 fields removal */
 992        e_IOC_FM_PCD_MANIP_RMV_BY_HDR_CAPWAP,   /**< CAPWAP removal */
 993        e_IOC_FM_PCD_MANIP_RMV_BY_HDR_FROM_START,
 994                                /**< Locate from data that is not the header */
 995} ioc_fm_pcd_manip_hdr_rmv_by_hdr_type;
 996
 997/*
 998 * @Description   Enumeration type for selecting type of timeout mode
 999 */
1000typedef enum ioc_fm_pcd_manip_reassem_time_out_mode {
1001        e_IOC_FM_PCD_MANIP_TIME_OUT_BETWEEN_FRAMES,
1002                                        /**< Limits the time of the reassembly
1003                                         * process from the first fragment to
1004                                         * the last
1005                                         */
1006        e_IOC_FM_PCD_MANIP_TIME_OUT_BETWEEN_FRAG
1007                                        /**< Limits the time of receiving the
1008                                         * fragment
1009                                         */
1010} ioc_fm_pcd_manip_reassem_time_out_mode;
1011
1012/*
1013 * @Description   Enumeration type for selecting type of WaysNumber mode
1014 */
1015typedef enum ioc_fm_pcd_manip_reassem_ways_number {
1016        e_IOC_FM_PCD_MANIP_ONE_WAY_HASH = 1,    /**< One way hash    */
1017        e_IOC_FM_PCD_MANIP_TWO_WAYS_HASH,       /**< Two ways hash   */
1018        e_IOC_FM_PCD_MANIP_THREE_WAYS_HASH,     /**< Three ways hash */
1019        e_IOC_FM_PCD_MANIP_FOUR_WAYS_HASH,      /**< Four ways hash  */
1020        e_IOC_FM_PCD_MANIP_FIVE_WAYS_HASH,      /**< Five ways hash  */
1021        e_IOC_FM_PCD_MANIP_SIX_WAYS_HASH,       /**< Six ways hash   */
1022        e_IOC_FM_PCD_MANIP_SEVEN_WAYS_HASH,     /**< Seven ways hash */
1023        e_IOC_FM_PCD_MANIP_EIGHT_WAYS_HASH      /**< Eight ways hash */
1024} ioc_fm_pcd_manip_reassem_ways_number;
1025
1026/*
1027 * @Description   Enumeration type for selecting manipulation type
1028 */
1029typedef enum ioc_fm_pcd_manip_type {
1030        e_IOC_FM_PCD_MANIP_HDR = 0,             /**< Header manipulation */
1031        e_IOC_FM_PCD_MANIP_REASSEM,             /**< Reassembly */
1032        e_IOC_FM_PCD_MANIP_FRAG,                /**< Fragmentation */
1033        e_IOC_FM_PCD_MANIP_SPECIAL_OFFLOAD      /**< Special Offloading */
1034} ioc_fm_pcd_manip_type;
1035
1036/*
1037 * @Description   Enumeration type for selecting type of statistics mode
1038 */
1039typedef enum ioc_fm_pcd_cc_stats_mode {
1040        e_IOC_FM_PCD_CC_STATS_MODE_NONE = 0,    /**< No statistics support */
1041        e_IOC_FM_PCD_CC_STATS_MODE_FRAME,       /**< Frame count statistics */
1042        e_IOC_FM_PCD_CC_STATS_MODE_BYTE_AND_FRAME,
1043                        /**< Byte and frame count statistics */
1044        e_IOC_FM_PCD_CC_STATS_MODE_RMON,
1045                        /**< Byte and frame length range count statistics */
1046} ioc_fm_pcd_cc_stats_mode;
1047
1048/*
1049 * @Description   Enumeration type for determining the action in case an IP
1050 *                packet is larger than MTU but its DF (Don't Fragment) bit is
1051 *                set.
1052 */
1053typedef enum ioc_fm_pcd_manip_donot_frag_action {
1054        e_IOC_FM_PCD_MANIP_DISCARD_PACKET = 0,  /**< Discard packet */
1055        e_IOC_FM_PCD_MANIP_ENQ_TO_ERR_Q_OR_DISCARD_PACKET =
1056                        e_IOC_FM_PCD_MANIP_DISCARD_PACKET,
1057                                /**< Obsolete, cannot enqueue to error queue; In
1058                                 * practice, selects to discard packets; Will be
1059                                 * removed in the future
1060                                 */
1061        e_IOC_FM_PCD_MANIP_FRAGMENT_PACKECT,
1062                                /**< Fragment packet and continue normal
1063                                 * processing
1064                                 */
1065        e_IOC_FM_PCD_MANIP_CONTINUE_WITHOUT_FRAG
1066                                /**< Continue normal processing without
1067                                 * fragmenting the packet
1068                                 */
1069} ioc_fm_pcd_manip_donot_frag_action;
1070
1071/*
1072 * @Description   Enumeration type for selecting type of special offload
1073 *                manipulation
1074 */
1075typedef enum ioc_fm_pcd_manip_special_offload_type {
1076        e_IOC_FM_PCD_MANIP_SPECIAL_OFFLOAD_IPSEC,
1077                                        /**< IPSec offload manipulation */
1078        e_IOC_FM_PCD_MANIP_SPECIAL_OFFLOAD_CAPWAP
1079                                        /**< CAPWAP offload manipulation */
1080} ioc_fm_pcd_manip_special_offload_type;
1081
1082/*
1083 * @Description   A union of protocol dependent special options
1084 *                (Must match union u_FmPcdHdrProtocolOpt defined in
1085 *                fm_pcd_ext.h)
1086 */
1087typedef union ioc_fm_pcd_hdr_protocol_opt_u {
1088        ioc_eth_protocol_opt_t  eth_opt;        /**< Ethernet options */
1089        ioc_vlan_protocol_opt_t   vlan_opt;     /**< Vlan options */
1090        ioc_mpls_protocol_opt_t   mpls_opt;     /**< MPLS options */
1091        ioc_ipv4_protocol_opt_t   ipv4_opt;     /**< IPv4 options */
1092        ioc_ipv6_protocol_opt_t   ipv6_opt;     /**< IPv6 options */
1093        ioc_capwap_protocol_opt_t capwap_opt;  /**< CAPWAP options */
1094} ioc_fm_pcd_hdr_protocol_opt_u;
1095
1096/*
1097 * @Description   A union holding all known protocol fields
1098 */
1099typedef union ioc_fm_pcd_fields_u {
1100        ioc_header_field_eth_t          eth;            /**< Ethernet*/
1101        ioc_header_field_vlan_t         vlan;           /**< VLAN*/
1102        ioc_header_field_llc_snap_t     llc_snap;       /**< LLC SNAP*/
1103        ioc_header_field_pppoe_t                pppoe;  /**< PPPoE*/
1104        ioc_header_field_mpls_t         mpls;           /**< MPLS*/
1105        ioc_header_field_ip_t           ip;             /**< IP */
1106        ioc_header_field_ipv4_t         ipv4;           /**< IPv4*/
1107        ioc_header_field_ipv6_t         ipv6;           /**< IPv6*/
1108        ioc_header_field_udp_t          udp;            /**< UDP        */
1109        ioc_header_field_udp_lite_t     udp_lite;       /**< UDP_Lite*/
1110        ioc_header_field_tcp_t          tcp;            /**< TCP        */
1111        ioc_header_field_sctp_t         sctp;           /**< SCTP*/
1112        ioc_header_field_dccp_t         dccp;           /**< DCCP*/
1113        ioc_header_field_gre_t          gre;            /**< GRE        */
1114        ioc_header_field_minencap_t     minencap;/**< Minimal Encapsulation  */
1115        ioc_header_field_ipsec_ah_t     ipsec_ah;       /**< IPSec AH*/
1116        ioc_header_field_ipsec_esp_t    ipsec_esp;      /**< IPSec ESP*/
1117        ioc_header_field_udp_encap_esp_t        udp_encap_esp;
1118                                                /**< UDP Encapsulation ESP  */
1119} ioc_fm_pcd_fields_u;
1120
1121/*
1122 * @Description   Parameters for defining header extraction for key generation
1123 */
1124typedef struct ioc_fm_pcd_from_hdr_t {
1125        uint8_t         size;   /**< Size in byte */
1126        uint8_t         offset; /**< Byte offset */
1127} ioc_fm_pcd_from_hdr_t;
1128
1129/*
1130 * @Description   Parameters for defining field extraction for key generation
1131 */
1132typedef struct ioc_fm_pcd_from_field_t {
1133        ioc_fm_pcd_fields_u field;      /**< Field selection */
1134        uint8_t         size;   /**< Size in byte */
1135        uint8_t         offset; /**< Byte offset */
1136} ioc_fm_pcd_from_field_t;
1137
1138/*
1139 * @Description   Parameters for defining a single network environment unit
1140 *                A distinction unit should be defined if it will later be used
1141 *                by one or more PCD engines to distinguish between flows.
1142 *                (Must match struct t_FmPcdDistinctionUnit defined in
1143 *                fm_pcd_ext.h)
1144 */
1145typedef struct ioc_fm_pcd_distinction_unit_t {
1146        struct {
1147        ioc_net_header_type     hdr;
1148                                /**< One of the headers supported by the FM */
1149        ioc_fm_pcd_hdr_protocol_opt_u  opt;     /**< Select only one option! */
1150        } hdrs[IOC_FM_PCD_MAX_NUM_OF_INTERCHANGEABLE_HDRS];
1151} ioc_fm_pcd_distinction_unit_t;
1152
1153/*
1154 * @Description   Parameters for defining all different distinction units
1155 *                supported by a specific PCD Network Environment
1156 *                Characteristics module.
1157 *
1158 *                Each unit represent a protocol or a group of protocols that
1159 *                may be used later by the different PCD engines to distinguish
1160 *                between flows.
1161 *                (Must match struct t_FmPcdNetEnvParams defined in
1162 *                fm_pcd_ext.h)
1163 */
1164struct fm_pcd_net_env_params_t {
1165        uint8_t num_of_distinction_units;
1166        /**< Number of different units to be identified */
1167        ioc_fm_pcd_distinction_unit_t
1168                units[IOC_FM_PCD_MAX_NUM_OF_DISTINCTION_UNITS];
1169        /**< An array of num_of_distinction_units of the different units to be
1170         * identified
1171         */
1172};
1173
1174typedef struct ioc_fm_pcd_net_env_params_t {
1175        struct fm_pcd_net_env_params_t param;
1176        void                            *id;
1177                /**< Output parameter; Returns the net-env Id to be used */
1178} ioc_fm_pcd_net_env_params_t;
1179
1180/*
1181 * @Description   Parameters for defining a single extraction action when
1182 *                creating a key
1183 */
1184typedef struct ioc_fm_pcd_extract_entry_t {
1185        ioc_fm_pcd_extract_type         type;   /**< Extraction type select */
1186        union {
1187        struct {
1188                ioc_net_header_type     hdr;            /**< Header selection */
1189                bool                    ignore_protocol_validation;
1190                                        /**< Ignore protocol validation */
1191                ioc_fm_pcd_hdr_index    hdr_index;
1192                                        /**< Relevant only for MPLS, VLAN and
1193                                         * tunneled IP. Otherwise should be
1194                                         * cleared.
1195                                         */
1196                ioc_fm_pcd_extract_by_hdr_type  type;
1197                                        /**< Header extraction type select */
1198                union {
1199                ioc_fm_pcd_from_hdr_t   from_hdr;
1200                                        /**< Extract bytes from header
1201                                         * parameters
1202                                         */
1203                ioc_fm_pcd_from_field_t from_field;
1204                                        /**< Extract bytes from field parameters
1205                                         */
1206                ioc_fm_pcd_fields_u     full_field;
1207                                        /**< Extract full field parameters */
1208                } extract_by_hdr_type;
1209        } extract_by_hdr;/**< Used when type = e_IOC_FM_PCD_KG_EXTRACT_BY_HDR */
1210        struct {
1211                ioc_fm_pcd_extract_from src;
1212                                        /**< Non-header extraction source */
1213                ioc_fm_pcd_action       action; /**< Relevant for CC Only */
1214                uint16_t        ic_indx_mask;
1215                                /**< Relevant only for CC whenaction =
1216                                 * e_IOC_FM_PCD_ACTION_INDEXED_LOOKUP; Note that
1217                                 * the number of bits that are set within this
1218                                 * mask must be log2 of the CC-node
1219                                 * 'num_of_keys'. Note that the mask cannot be
1220                                 * set on the lower bits.
1221                                 */
1222                uint8_t                 offset; /**< Byte offset */
1223                uint8_t                 size;   /**< Size in bytes */
1224        } extract_non_hdr;
1225                /**< Used when type = e_IOC_FM_PCD_KG_EXTRACT_NON_HDR */
1226        } extract_params;
1227} ioc_fm_pcd_extract_entry_t;
1228
1229/*
1230 * @Description   A structure for defining masks for each extracted
1231 *                field in the key.
1232 */
1233typedef struct ioc_fm_pcd_kg_extract_mask_t {
1234        uint8_t         extract_array_index;
1235                                /**< Index in the extraction array, as
1236                                 * initialized by user
1237                                 */
1238        uint8_t         offset; /**< Byte offset */
1239        uint8_t         mask;
1240                        /**< A byte mask (selected bits will be ignored) */
1241} ioc_fm_pcd_kg_extract_mask_t;
1242
1243/*
1244 * @Description   A structure for defining default selection per groups of
1245 *                fields
1246 */
1247typedef struct ioc_fm_pcd_kg_extract_dflt_t {
1248        ioc_fm_pcd_kg_known_fields_dflt_types   type;
1249                                                /**< Default type select */
1250        ioc_fm_pcd_kg_extract_dflt_select       dflt_select;
1251                                                /**< Default register select */
1252} ioc_fm_pcd_kg_extract_dflt_t;
1253
1254
1255/*
1256 * @Description   A structure for defining all parameters needed for
1257 *                generation a key and using a hash function
1258 */
1259typedef struct ioc_fm_pcd_kg_key_extract_and_hash_params_t {
1260        uint32_t                        private_dflt0;
1261                                        /**< Scheme default register 0 */
1262        uint32_t                        private_dflt1;
1263                                        /**< Scheme default register 1 */
1264        uint8_t                         num_of_used_extracts;
1265                                        /**< defines the valid size of the
1266                                         * following array
1267                                         */
1268        ioc_fm_pcd_extract_entry_t
1269                        extract_array[IOC_FM_PCD_KG_MAX_EXTRACTS_PER_KEY];
1270                                        /**< An array of extraction definitions.
1271                                         */
1272        uint8_t                         num_of_used_dflts;
1273                                        /**< defines the valid size of the
1274                                         * following array
1275                                         */
1276        ioc_fm_pcd_kg_extract_dflt_t
1277                                dflts[IOC_FM_PCD_KG_NUM_OF_DEFAULT_GROUPS];
1278                                        /**< For each extraction used in this
1279                                         * scheme, specify the required default
1280                                         * register to be used when header is
1281                                         * not found. types not specified in
1282                                         * this array will get undefined value.
1283                                         */
1284        uint8_t                         num_of_used_masks;
1285                                        /**< Defines the valid size of the
1286                                         * following array
1287                                         */
1288        ioc_fm_pcd_kg_extract_mask_t
1289                                masks[IOC_FM_PCD_KG_NUM_OF_EXTRACT_MASKS];
1290        uint8_t                         hash_shift;
1291                                        /**< Hash result right shift. Selects
1292                                         * the 24 bits out of the 64 hash
1293                                         * result. 0 means using the 24 LSB's,
1294                                         * otherwise use the 24 LSB's after
1295                                         * shifting right.
1296                                         */
1297        uint32_t                        hash_dist_num_of_fqids;
1298                                        /**< must be > 1 and a power of 2.
1299                                         * Represents the range of queues for
1300                                         * the key and hash functionality
1301                                         */
1302        uint8_t                         hash_distribution_fqids_shift;
1303                                        /**< selects the FQID bits that will be
1304                                         * effected by the hash
1305                                         */
1306        bool                            symmetric_hash;
1307                                        /**< TRUE to generate the same hash for
1308                                         * frames with swapped source and
1309                                         * destination fields on all layers; If
1310                                         * TRUE, driver will check that for all
1311                                         * layers, if SRC extraction is
1312                                         * selected, DST extraction must also be
1313                                         * selected, and vice versa.
1314                                         */
1315} ioc_fm_pcd_kg_key_extract_and_hash_params_t;
1316
1317/*
1318 * @Description   A structure of parameters for defining a single Qid mask
1319 *                (extracted OR).
1320 */
1321typedef struct ioc_fm_pcd_kg_extracted_or_params_t {
1322        ioc_fm_pcd_extract_type         type;
1323                                        /**< Extraction type select */
1324        union {
1325        struct {
1326                        /**< used when type = e_IOC_FM_PCD_KG_EXTRACT_BY_HDR */
1327                ioc_net_header_type             hdr;
1328                ioc_fm_pcd_hdr_index            hdr_index;
1329                                                /**< Relevant only for MPLS,
1330                                                 * VLAN and tunneled IP.
1331                                                 * Otherwise should be cleared.
1332                                                 */
1333                bool                            ignore_protocol_validation;
1334
1335        } extract_by_hdr;
1336        ioc_fm_pcd_extract_from         src;
1337                                        /**< used when type =
1338                                         * e_IOC_FM_PCD_KG_EXTRACT_NON_HDR
1339                                         */
1340        } extract_params;
1341        uint8_t                         extraction_offset;
1342                                        /**< Offset for extraction */
1343        ioc_fm_pcd_kg_extract_dflt_select       dflt_value;
1344                                        /**< Select register from which
1345                                         * extraction is taken if field not
1346                                         * found
1347                                         */
1348        uint8_t                         mask;
1349                                        /**< Mask LSB byte of extraction
1350                                         * (specified bits are ignored)
1351                                         */
1352
1353        uint8_t                 bit_offset_in_fqid;
1354                /**< 0-31, Selects which bits of the 24 FQID bits to effect
1355                 * using the extracted byte; Assume byte is placed as the 8
1356                 * MSB's in a 32 bit word where the lower bits are the FQID; i.e
1357                 * if bitOffsetInFqid=1 than its LSB will effect the FQID MSB,
1358                 * if bitOffsetInFqid=24 than the extracted byte will effect the
1359                 * 8 LSB's of the FQID, if bitOffsetInFqid=31 than the byte's
1360                 * MSB will effect the FQID's LSB; 0 means - no effect on FQID;
1361                 * Note that one, and only one of bitOffsetInFqid or
1362                 * bitOffsetInPlcrProfile must be set (i.e, extracted byte must
1363                 * effect either FQID or Policer profile).
1364                 */
1365        uint8_t                 bit_offset_in_plcr_profile;
1366                /**< 0-15, Selects which bits of the 8 policer profile id bits
1367                 * to effect using the extracted byte; Assume byte is placed as
1368                 * the 8 MSB's in a 16 bit word where the lower bits are the
1369                 * policer profile id; i.e if bitOffsetInPlcrProfile=1 than its
1370                 * LSB will effect the profile MSB, if bitOffsetInFqid=8 than
1371                 * the extracted byte will effect the whole policer profile id,
1372                 * if bitOffsetInFqid=15 than the byte's MSB will effect the
1373                 * Policer Profile id's LSB; 0 means - no effect on policer
1374                 * profile; Note that one, and only one of bitOffsetInFqid or
1375                 * bitOffsetInPlcrProfile must be set (i.e, extracted byte must
1376                 * effect either FQID or Policer profile).
1377                 */
1378} ioc_fm_pcd_kg_extracted_or_params_t;
1379
1380/*
1381 * @Description   A structure for configuring scheme counter
1382 */
1383typedef struct ioc_fm_pcd_kg_scheme_counter_t {
1384        bool            update;
1385                        /**< FALSE to keep the current counter state and
1386                         * continue from that point, TRUE to update/reset the
1387                         * counter when the scheme is written.
1388                         */
1389        uint32_t        value;
1390                        /**< If update=TRUE, this value will be written into the
1391                         * counter; clear this field to reset the counter.
1392                         */
1393} ioc_fm_pcd_kg_scheme_counter_t;
1394
1395
1396/*
1397 * @Description   A structure for retrieving FMKG_SE_SPC
1398 */
1399typedef struct ioc_fm_pcd_kg_scheme_spc_t {
1400        uint32_t        val;    /**< return value */
1401        void    *id;            /**< scheme handle */
1402} ioc_fm_pcd_kg_scheme_spc_t;
1403
1404/*
1405 * @Description   A structure for defining policer profile parameters as
1406 *                required by keygen (when policer is the next engine after this
1407 *                scheme).
1408 *                (Must match struct t_FmPcdKgPlcrProfile defined in
1409 *                fm_pcd_ext.h)
1410 */
1411typedef struct ioc_fm_pcd_kg_plcr_profile_t {
1412        bool            shared_profile;
1413                        /**< TRUE if this profile is shared between ports (i.e.
1414                         * managed by primary partition) May not be TRUE if
1415                         * profile is after Coarse Classification
1416                         */
1417        bool            direct;
1418                        /**< If TRUE, direct_relative_profile_id only selects
1419                         * the profile id, if FALSE
1420                         * fqid_offset_relative_profile_id_base is used together
1421                         * with fqid_offset_shift and num_of_profiles
1422                         * parameters, to define a range of profiles from which
1423                         * the KeyGen result will determine the destination
1424                         * policer profile.
1425                         */
1426        union {
1427        uint16_t        direct_relative_profile_id;
1428                        /**< Used if 'direct' is TRUE, to select policer
1429                         * profile. This parameter should indicate the policer
1430                         * profile offset within the port's policer profiles or
1431                         * SHARED window.
1432                         */
1433        struct {
1434                uint8_t fqid_offset_shift;
1435                        /**< Shift of KG results without the qid base */
1436                uint8_t fqid_offset_relative_profile_id_base;
1437                        /**< OR of KG results without the qid base This
1438                         * parameter should indicate the policer profile offset
1439                         * within the port's policer profiles window or SHARED
1440                         * window depends on shared_profile
1441                         */
1442                uint8_t num_of_profiles;
1443                        /**< Range of profiles starting at base */
1444        } indirect_profile;             /**< Indirect profile parameters */
1445        } profile_select;
1446                        /**< Direct/indirect profile selection and parameters */
1447} ioc_fm_pcd_kg_plcr_profile_t;
1448
1449/*
1450 * @Description   Parameters for configuring a storage profile for a KeyGen
1451 *                scheme.
1452 */
1453typedef struct ioc_fm_pcd_kg_storage_profile_t {
1454        bool    direct;
1455                /**< If TRUE, directRelativeProfileId only selects the profile
1456                 * id; If FALSE, fqidOffsetRelativeProfileIdBase is used
1457                 * together with fqidOffsetShift and num_of_profiles parameters
1458                 * to define a range of profiles from which the KeyGen result
1459                 * will determine the destination storage profile.
1460                 */
1461        union {
1462                uint16_t        direct_relative_profile_id;
1463                /**< Used when 'direct' is TRUE, to select a storage profile;
1464                 * should indicate the storage profile offset within the port's
1465                 * storage profiles window.
1466                 */
1467                struct {
1468                        uint8_t fqid_offset_shift;
1469                        /**< Shift of KeyGen results without the FQID base */
1470                        uint8_t fqid_offset_relative_profile_id_base;
1471                        /**< OR of KeyGen results without the FQID base; should
1472                         * indicate the policer profile offset within the port's
1473                         * storage profiles window.
1474                         */
1475                        uint8_t num_of_profiles;
1476                        /**< Range of profiles starting at base. */
1477                } indirect_profile;
1478                /**< Indirect profile parameters. */
1479        } profile_select;
1480        /**< Direct/indirect profile selection and parameters. */
1481} ioc_fm_pcd_kg_storage_profile_t;
1482
1483/*
1484 * @Description   Parameters for defining CC as the next engine after KeyGen
1485 *                (Must match struct t_FmPcdKgCc defined in fm_pcd_ext.h)
1486 */
1487typedef struct ioc_fm_pcd_kg_cc_t {
1488        void                            *tree_id;
1489                                        /**< CC Tree id */
1490        uint8_t                         grp_id;
1491                                        /**< CC group id within the CC tree */
1492        bool                            plcr_next;
1493                                        /**< TRUE if after CC, in case of data
1494                                         * frame, policing is required.
1495                                         */
1496        bool                            bypass_plcr_profile_generation;
1497                                        /**< TRUE to bypass KeyGen policer
1498                                         * profile generation; selected profile
1499                                         * is the one set at port initialization
1500                                         */
1501        ioc_fm_pcd_kg_plcr_profile_t    plcr_profile;
1502                                        /**< Valid only if plcr_next = TRUE and
1503                                         * bypass_plcr_profile_generation =
1504                                         * FALSE
1505                                         */
1506} ioc_fm_pcd_kg_cc_t;
1507
1508/*
1509 * @Description   Parameters for defining initializing a KeyGen scheme (Must
1510 *                match struct t_FmPcdKgSchemeParams defined in fm_pcd_ext.h)
1511 */
1512struct fm_pcd_kg_scheme_params_t {
1513        bool modify;    /**< TRUE to change an existing scheme */
1514        union {
1515                uint8_t relative_scheme_id;
1516                /**< if modify=FALSE: partition-relative scheme id */
1517                void *scheme_id;
1518                /**< if modify=TRUE: the id of an existing scheme */
1519        } scm_id;
1520        bool always_direct;
1521                /**< This scheme is reached only directly, i.e. no need for
1522                 * match vector; KeyGen will ignore it when matching
1523                 */
1524        struct {
1525                /**< HL relevant only if always_direct=FALSE */
1526                void *net_env_id;
1527                /**< The id of the Network Environment as returned
1528                 * by fm_pcd_net_env_characteristics_set()
1529                 */
1530                uint8_t num_of_distinction_units;
1531                /**< Number of NetEnv units listed in unit_ids array */
1532                uint8_t unit_ids[IOC_FM_PCD_MAX_NUM_OF_DISTINCTION_UNITS];
1533                /**< Indexes as passed to SetNetEnvCharacteristics (?) array */
1534        } net_env_params;
1535        bool use_hash;
1536                /**< use the KG Hash functionality */
1537        ioc_fm_pcd_kg_key_extract_and_hash_params_t key_ext_and_hash;
1538                /**< used only if useHash = TRUE */
1539        bool bypass_fqid_generation;
1540                /**< Normally - FALSE, TRUE to avoid FQID update in the IC; In
1541                 * such a case FQID after KG will be the default FQID defined
1542                 * for the relevant port, or the FQID defined by CC in cases
1543                 * where CC was the previous engine.
1544                 */
1545        uint32_t base_fqid;
1546                /**< Base FQID; Relevant only if bypass_fqid_generation = FALSE;
1547                 * If hash is used and an even distribution is expected
1548                 * according to hash_dist_num_of_fqids, base_fqid must
1549                 * be aligned to hash_dist_num_of_fqids.
1550                 */
1551        uint8_t num_of_used_extracted_ors;
1552                /**< Number of FQID masks listed in extracted_ors array*/
1553        ioc_fm_pcd_kg_extracted_or_params_t
1554                extracted_ors[IOC_FM_PCD_KG_NUM_OF_GENERIC_REGS];
1555                /**< IOC_FM_PCD_KG_NUM_OF_GENERIC_REGS registers are shared
1556                 * between qid_masks functionality and some of the extraction
1557                 * actions; Normally only some will be used for qid_mask. Driver
1558                 * will return error if resource is full at initialization time.
1559                 */
1560        bool override_storage_profile;
1561                /**< TRUE if KeyGen override previously decided storage profile
1562                 */
1563        ioc_fm_pcd_kg_storage_profile_t storage_profile;
1564                /**< Used when override_storage_profile=TRUE */
1565        ioc_fm_pcd_engine next_engine;
1566                /**< may be BMI, PLCR or CC */
1567        union {
1568                /**< depends on nextEngine */
1569                ioc_fm_pcd_done_action done_action;
1570                /**< Used when next engine is BMI (done) */
1571                ioc_fm_pcd_kg_plcr_profile_t plcr_profile;
1572                /**< Used when next engine is PLCR */
1573                ioc_fm_pcd_kg_cc_t cc;
1574                /**< Used when next engine is CC */
1575        } kg_next_engine_params;
1576        ioc_fm_pcd_kg_scheme_counter_t scheme_counter;
1577                /**< A structure of parameters for updating the scheme counter*/
1578};
1579
1580typedef struct ioc_fm_pcd_kg_scheme_params_t {
1581        struct fm_pcd_kg_scheme_params_t param;
1582        void *id;               /**< Returns the scheme Id to be used */
1583} ioc_fm_pcd_kg_scheme_params_t;
1584
1585/*
1586 * @Collection
1587 */
1588#define IOC_FM_PCD_CC_STATS_MAX_FLR     10
1589                        /* Maximal supported number of frame length ranges */
1590#define IOC_FM_PCD_CC_STATS_FLR_SIZE            2
1591                        /* Size in bytes of a frame length range limit */
1592#define IOC_FM_PCD_CC_STATS_FLR_COUNT_SIZE      4
1593                        /* Size in bytes of a frame length range counter */
1594/* @} */
1595
1596/*
1597 * @Description   Parameters for defining CC as the next engine after a CC node.
1598 *                (Must match struct t_FmPcdCcNextCcParams defined in
1599 *                fm_pcd_ext.h)
1600 */
1601typedef struct ioc_fm_pcd_cc_next_cc_params_t {
1602        void    *cc_node_id;                    /**< Id of the next CC node */
1603} ioc_fm_pcd_cc_next_cc_params_t;
1604
1605/*
1606 * @Description   A structure for defining Frame Replicator as the next engine
1607 *                after a CC node. (Must match struct t_FmPcdCcNextFrParams
1608 *                defined in fm_pcd_ext.h)
1609 */
1610typedef struct ioc_fm_pcd_cc_next_fr_params_t {
1611        void *frm_replic_id;
1612                        /**< The id of the next frame replicator group */
1613} ioc_fm_pcd_cc_next_fr_params_t;
1614
1615/*
1616 * @Description   A structure for defining PLCR params when PLCR is the
1617 *                next engine after a CC node
1618 *                (Must match struct t_FmPcdCcNextPlcrParams defined in
1619 *                fm_pcd_ext.h)
1620 */
1621typedef struct ioc_fm_pcd_cc_next_plcr_params_t {
1622        bool    override_params;
1623                /**< TRUE if CC override previously decided parameters*/
1624        bool    shared_profile;
1625                /**< Relevant only if overrideParams=TRUE: TRUE if this profile
1626                 * is shared between ports
1627                 */
1628        uint16_t        new_relative_profile_id;
1629                /**< Relevant only if overrideParams=TRUE: (otherwise profile id
1630                 * is taken from keygen); This parameter should indicate the
1631                 * policer profile offset within the port's policer profiles or
1632                 * from SHARED window.
1633                 */
1634        uint32_t        new_fqid;
1635                /**< Relevant only if overrideParams=TRUE: FQID for enquing the
1636                 * frame; In earlier chips  if policer next engine is KEYGEN,
1637                 * this parameter can be 0, because the KEYGEN always decides
1638                 * the enqueue FQID.
1639                 */
1640        uint8_t new_relative_storage_profile_id;
1641                /**< Indicates the relative storage profile offset within the
1642                 * port's storage profiles window; Relevant only if the port was
1643                 * configured with VSP.
1644                 */
1645} ioc_fm_pcd_cc_next_plcr_params_t;
1646
1647/*
1648 * @Description   A structure for defining enqueue params when BMI is the next
1649 *                engine after a CC node (Must match struct
1650 *                t_FmPcdCcNextEnqueueParams defined in fm_pcd_ext.h)
1651 */
1652typedef struct ioc_fm_pcd_cc_next_enqueue_params_t {
1653        ioc_fm_pcd_done_action  action;
1654                                /**< Action - when next engine is BMI (done) */
1655        bool                    override_fqid;
1656                                /**< TRUE if CC override previously decided fqid
1657                                 * and vspid, relevant if action =
1658                                 * e_IOC_FM_PCD_ENQ_FRAME
1659                                 */
1660        uint32_t                new_fqid;
1661                                /**< Valid if overrideFqid=TRUE, FQID for
1662                                 * enqueuing the frame (otherwise FQID is taken
1663                                 * from KeyGen), relevant if action =
1664                                 * e_IOC_FM_PCD_ENQ_FRAME
1665                                 */
1666        uint8_t         new_relative_storage_profile_id;
1667                        /**< Valid if override_fqid=TRUE, Indicates the relative
1668                         * virtual storage profile offset within the port's
1669                         * storage profiles window; Relevant only if the port
1670                         * was configured with VSP.
1671                         */
1672
1673} ioc_fm_pcd_cc_next_enqueue_params_t;
1674
1675/*
1676 * @Description   A structure for defining KG params when KG is the next engine
1677 *                after a CC node (Must match struct t_FmPcdCcNextKgParams
1678 *                defined in fm_pcd_ext.h)
1679 */
1680typedef struct ioc_fm_pcd_cc_next_kg_params_t {
1681        bool    override_fqid;
1682                /**< TRUE if CC override previously decided fqid and vspid,
1683                 * Note - this parameters are irrelevant for earlier chips
1684                 */
1685        uint32_t   new_fqid;
1686                /**< Valid if overrideFqid=TRUE, FQID for enqueuing the frame
1687                 * (otherwise FQID is taken from KeyGen),
1688                 * Note - this parameters are irrelevant for earlier chips
1689                 */
1690        uint8_t   new_relative_storage_profile_id;
1691                /**< Valid if override_fqid=TRUE, Indicates the relative virtual
1692                 * storage profile offset within the port's storage profiles
1693                 * window; Relevant only if the port was configured with VSP.
1694                 */
1695        void    *p_direct_scheme;       /**< Direct scheme id to go to. */
1696} ioc_fm_pcd_cc_next_kg_params_t;
1697
1698/*
1699 * @Description   Parameters for defining the next engine after a CC node.
1700 *                (Must match struct ioc_fm_pcd_cc_next_engine_params_t defined
1701 *                in fm_pcd_ext.h)
1702 */
1703typedef struct ioc_fm_pcd_cc_next_engine_params_t {
1704        ioc_fm_pcd_engine                       next_engine;
1705                                /**< User has to initialize parameters according
1706                                 * to nextEngine definition
1707                                 */
1708        union {
1709                ioc_fm_pcd_cc_next_cc_params_t  cc_params;
1710                                /**< Parameters in case next engine is CC */
1711                ioc_fm_pcd_cc_next_plcr_params_t        plcr_params;
1712                                /**< Parameters in case next engine is PLCR */
1713                ioc_fm_pcd_cc_next_enqueue_params_t enqueue_params;
1714                                /**< Parameters in case next engine is BMI */
1715                ioc_fm_pcd_cc_next_kg_params_t  kg_params;
1716                                /**< Parameters in case next engine is KG */
1717                ioc_fm_pcd_cc_next_fr_params_t  fr_params;
1718                                /**< Parameters in case next engine is FR */
1719        } params;
1720                /**< Union used for all the next-engine parameters options */
1721        void                                    *manip_id;
1722                                /**< Handle to Manipulation object. Relevant if
1723                                 * next engine is of type result
1724                                 * (e_IOC_FM_PCD_PLCR, e_IOC_FM_PCD_KG,
1725                                 * e_IOC_FM_PCD_DONE)
1726                                 */
1727        bool                                    statistics_en;
1728                                /**< If TRUE, statistics counters are
1729                                 * incremented for each frame passing through
1730                                 * this Coarse Classification entry.
1731                                 */
1732} ioc_fm_pcd_cc_next_engine_params_t;
1733
1734/*
1735 * @Description   Parameters for defining a single CC key
1736 */
1737typedef struct ioc_fm_pcd_cc_key_params_t {
1738        uint8_t         *p_key;
1739                        /**< pointer to the key of the size defined in key_size
1740                         */
1741        uint8_t         *p_mask;
1742                        /**< pointer to the Mask per key of the size defined in
1743                         * key_size. p_key and p_mask (if defined) has to be of
1744                         * the same size defined in the key_size
1745                         */
1746        ioc_fm_pcd_cc_next_engine_params_t  cc_next_engine_params;
1747                        /**< parameters for the next for the defined Key in
1748                         * p_key
1749                         */
1750
1751} ioc_fm_pcd_cc_key_params_t;
1752
1753/*
1754 * @Description   Parameters for defining CC keys parameters
1755 *                The driver supports two methods for CC node allocation:
1756 *                dynamic and static. Static mode was created in order to
1757 *                prevent runtime alloc/free of FMan memory (MURAM), which may
1758 *                cause fragmentation; in this mode, the driver automatically
1759 *                allocates the memory according to 'max_num_of_keys' parameter.
1760 *                The driver calculates the maximal memory size that may be used
1761 *                for this CC-Node taking into consideration 'mask_support' and
1762 *                'statistics_mode' parameters. When 'action' =
1763 *                e_IOC_FM_PCD_ACTION_INDEXED_LOOKUP in the extraction
1764 *                parameters of this node, 'max_num_of_keys' must be equal to
1765 *                'num_of_keys'. In dynamic mode, 'max_num_of_keys' must be
1766 *                zero. At initialization, all required structures are allocated
1767 *                according to 'num_of_keys' parameter. During runtime
1768 *                modification, these structures are re-allocated according to
1769 *                the updated number of keys.
1770 *                Please note that 'action' and 'ic_indx_mask' mentioned in the
1771 *                specific parameter explanations are passed in the extraction
1772 *                parameters of the node (fields of
1773 *                extractccparams.extractnonhdr).
1774 */
1775typedef struct ioc_keys_params_t {
1776        uint16_t                max_num_of_keys;
1777                        /**< Maximum number of keys that will (ever) be used in
1778                         * this CC-Node; A value of zero may be used for dynamic
1779                         * memory allocation.
1780                         */
1781        bool                    mask_support;
1782                        /**< This parameter is relevant only if a node is
1783                         * initialized with action =
1784                         * e_IOC_FM_PCD_ACTION_EXACT_MATCH and max_num_of_keys >
1785                         * 0; Should be TRUE to reserve table memory for key
1786                         * masks, even if initial keys do not contain masks, or
1787                         * if the node was initialized as 'empty' (without
1788                         * keys); this will allow user to add keys with masks at
1789                         * runtime.
1790                         */
1791        ioc_fm_pcd_cc_stats_mode        statistics_mode;
1792                        /**< Determines the supported statistics mode for all
1793                         * node's keys. To enable statistics gathering,
1794                         * statistics should be enabled per every key, using
1795                         * 'statistics_en' in next engine parameters structure
1796                         * of that key; If 'max_num_of_keys' is set, all
1797                         * required structures will be preallocated for all keys
1798                         */
1799        uint16_t        frame_length_ranges[IOC_FM_PCD_CC_STATS_MAX_FLR];
1800                /**< Relevant only for 'RMON' statistics mode (this feature is
1801                 * supported only on B4860 device); Holds a list of programmable
1802                 * thresholds. For each received frame, its length in bytes is
1803                 * examined against these range thresholds and the appropriate
1804                 * counter is incremented by 1. For example, to belong to range
1805                 * i, the following should hold: range i-1 threshold < frame
1806                 * length <= range i threshold Each range threshold must be
1807                 * larger then its preceding range threshold. Last range
1808                 * threshold must be 0xFFFF.
1809                 */
1810        uint16_t                        num_of_keys;
1811                /**< Number of initial keys; Note that in case of 'action' =
1812                 * e_IOC_FM_PCD_ACTION_INDEXED_LOOKUP, this field should be
1813                 * power-of-2 of the number of bits that are set in
1814                 * 'ic_indx_mask'.
1815                 */
1816        uint8_t                 key_size;
1817                /**< Size of key - for extraction of type FULL_FIELD, 'key_size'
1818                 * has to be the standard size of the selected key; For other
1819                 * extraction types, 'key_size' has to be as size of extraction;
1820                 * When 'action' = e_IOC_FM_PCD_ACTION_INDEXED_LOOKUP,
1821                 * 'key_size' must be 2.
1822                 */
1823        ioc_fm_pcd_cc_key_params_t  key_params[IOC_FM_PCD_MAX_NUM_OF_KEYS];
1824                /**< An array with 'num_of_keys' entries, each entry specifies
1825                 * the corresponding key parameters; When 'action' =
1826                 * e_IOC_FM_PCD_ACTION_EXACT_MATCH, this value must not exceed
1827                 * 255 (IOC_FM_PCD_MAX_NUM_OF_KEYS-1) as the last entry is saved
1828                 * for the 'miss' entry.
1829                 */
1830        ioc_fm_pcd_cc_next_engine_params_t  cc_next_engine_params_for_miss;
1831                /**< Parameters for defining the next engine when a key is not
1832                 * matched; Not relevant if action =
1833                 * e_IOC_FM_PCD_ACTION_INDEXED_LOOKUP.
1834                 */
1835} ioc_keys_params_t;
1836
1837/*
1838 * @Description   Parameters for defining a CC node
1839 */
1840struct fm_pcd_cc_node_params_t {
1841        ioc_fm_pcd_extract_entry_t extract_cc_params;
1842        /**< Extraction parameters */
1843        ioc_keys_params_t keys_params;
1844        /**< Keys definition matching the selected extraction */
1845};
1846
1847typedef struct ioc_fm_pcd_cc_node_params_t {
1848        struct fm_pcd_cc_node_params_t param;
1849        void *id;
1850        /**< Output parameter; returns the CC node Id to be used */
1851} ioc_fm_pcd_cc_node_params_t;
1852
1853/*
1854 * @Description   Parameters for defining a hash table
1855 *                (Must match struct ioc_fm_pcd_hash_table_params_t defined in
1856 *                fm_pcd_ext.h)
1857 */
1858struct fm_pcd_hash_table_params_t {
1859        uint16_t max_num_of_keys;
1860                /**< Maximum Number Of Keys that will (ever) be used in this
1861                 * Hash-table
1862                 */
1863        ioc_fm_pcd_cc_stats_mode statistics_mode;
1864                /**< If not e_IOC_FM_PCD_CC_STATS_MODE_NONE, the required
1865                 * structures for the requested statistics mode will be
1866                 * allocated according to max_num_of_keys.
1867                 */
1868        uint8_t kg_hash_shift;
1869                /**< KG-Hash-shift as it was configured in the KG-scheme that
1870                 * leads to this hash-table.
1871                 */
1872        uint16_t hash_res_mask;
1873                /**< Mask that will be used on the hash-result; The
1874                 * number-of-sets for this hash will be calculated as (2^(number
1875                 * of bits set in 'hash_res_mask')); The 4 lower bits must be
1876                 * cleared.
1877                 */
1878        uint8_t hash_shift;
1879                /**< Byte offset from the beginning of the KeyGen hash result to
1880                 * the 2-bytes to be used as hash index.
1881                 */
1882        uint8_t match_key_size;
1883                /**< Size of the exact match keys held by the hash buckets */
1884
1885        ioc_fm_pcd_cc_next_engine_params_t cc_next_engine_params_for_miss;
1886                /**< Parameters for defining the next engine when a key is not
1887                 * matched
1888                 */
1889};
1890
1891typedef struct ioc_fm_pcd_hash_table_params_t {
1892        struct fm_pcd_hash_table_params_t param;
1893        void *id;
1894} ioc_fm_pcd_hash_table_params_t;
1895
1896/*
1897 * @Description   A structure with the arguments for the
1898 *                fm_pcd_hash_table_add_key ioctl() call
1899 */
1900typedef struct ioc_fm_pcd_hash_table_add_key_params_t {
1901        void                    *p_hash_tbl;
1902        uint8_t                 key_size;
1903        ioc_fm_pcd_cc_key_params_t  key_params;
1904} ioc_fm_pcd_hash_table_add_key_params_t;
1905
1906/*
1907 * @Description   Parameters for defining a CC tree group.
1908 *
1909 *                This structure defines a CC group in terms of NetEnv units and
1910 *                the action to be taken in each case. The unit_ids list must be
1911 *                given in order from low to high indices.
1912 *                ioc_fm_pcd_cc_next_engine_params_t is a list of
1913 *                2^num_of_distinction_units structures where each defines the
1914 *                next action to be taken for each units combination. for
1915 *                example: num_of_distinction_units = 2 unit_ids = {1,3}
1916 *                next_engine_per_entries_in_grp[0] =
1917 *                ioc_fm_pcd_cc_next_engine_params_t for the case that unit 1 -
1918 *                not found; unit 3 - not found;
1919 *                next_engine_per_entries_in_grp[1] =
1920 *                ioc_fm_pcd_cc_next_engine_params_t for the case that unit 1 -
1921 *                not found; unit 3 - found;
1922 *                next_engine_per_entries_in_grp[2] =
1923 *                ioc_fm_pcd_cc_next_engine_params_t for the case that unit 1 -
1924 *                found; unit 3 - not found;
1925 *                next_engine_per_entries_in_grp[3] =
1926 *                ioc_fm_pcd_cc_next_engine_params_t for the case that unit 1 -
1927 *                found; unit 3 - found;
1928 */
1929typedef struct ioc_fm_pcd_cc_grp_params_t {
1930        uint8_t         num_of_distinction_units;   /**< Up to 4 */
1931        uint8_t         unit_ids[IOC_FM_PCD_MAX_NUM_OF_CC_UNITS];
1932                /**< Indexes of the units as defined in
1933                 * fm_pcd_net_env_characteristics_set()
1934                 */
1935        ioc_fm_pcd_cc_next_engine_params_t
1936                next_engine_per_entries_in_grp[IOC_FM_PCD_MAX_CC_ENTRY_IN_GRP];
1937                /**< Maximum entries per group is 16 */
1938} ioc_fm_pcd_cc_grp_params_t;
1939
1940/*
1941 * @Description   Parameters for defining the CC tree groups
1942 *                (Must match struct ioc_fm_pcd_cc_tree_params_t defined in
1943 *                fm_pcd_ext.h)
1944 */
1945typedef struct ioc_fm_pcd_cc_tree_params_t {
1946        void            *net_env_id;
1947                        /**< Id of the Network Environment as returned
1948                         * by fm_pcd_net_env_characteristics_set()
1949                         */
1950        uint8_t         num_of_groups;
1951                        /**< Number of CC groups within the CC tree */
1952        ioc_fm_pcd_cc_grp_params_t
1953                        fm_pcd_cc_group_params[IOC_FM_PCD_MAX_NUM_OF_CC_GROUPS];
1954                        /**< Parameters for each group. */
1955        void            *id;
1956                        /**< Output parameter; Returns the tree Id to be used */
1957} ioc_fm_pcd_cc_tree_params_t;
1958
1959/*
1960 * @Description   Parameters for defining policer byte rate
1961 */
1962typedef struct ioc_fm_pcd_plcr_byte_rate_mode_param_t {
1963        ioc_fm_pcd_plcr_frame_length_select     frame_length_selection;
1964                        /**< Frame length selection */
1965        ioc_fm_pcd_plcr_roll_back_frame_select  roll_back_frame_selection;
1966                        /**< relevant option only e_IOC_FM_PCD_PLCR_L2_FRM_LEN,
1967                         * e_IOC_FM_PCD_PLCR_FULL_FRM_LEN
1968                         */
1969} ioc_fm_pcd_plcr_byte_rate_mode_param_t;
1970
1971/*
1972 * @Description   Parameters for defining the policer profile (based on
1973 *                RFC-2698 or RFC-4115 attributes).
1974 */
1975typedef struct ioc_fm_pcd_plcr_non_passthrough_alg_param_t {
1976        ioc_fm_pcd_plcr_rate_mode               rate_mode;
1977                        /**< Byte / Packet */
1978        ioc_fm_pcd_plcr_byte_rate_mode_param_t  byte_mode_param;
1979                        /**< Valid for Byte NULL for Packet */
1980        uint32_t                                committed_info_rate;
1981                        /**< KBits/Sec or Packets/Sec */
1982        uint32_t                                committed_burst_size;
1983                        /**< KBits or Packets */
1984        uint32_t                                peak_or_excess_info_rate;
1985                        /**< KBits/Sec or Packets/Sec */
1986        uint32_t                                peak_or_excess_burst_size;
1987                        /**< KBits or Packets */
1988} ioc_fm_pcd_plcr_non_passthrough_alg_param_t;
1989
1990/*
1991 * @Description   Parameters for defining the next engine after policer
1992 */
1993typedef union ioc_fm_pcd_plcr_next_engine_params_u {
1994        ioc_fm_pcd_done_action  action;
1995                                /**< Action - when next engine is BMI (done) */
1996        void                    *p_profile;
1997                                /**< Policer profile handle -  used when next
1998                                 * engine is PLCR, must be a SHARED profile
1999                                 */
2000        void                    *p_direct_scheme;
2001                                /**< Direct scheme select - when next engine is
2002                                 * Keygen
2003                                 */
2004} ioc_fm_pcd_plcr_next_engine_params_u;
2005
2006typedef struct ioc_fm_pcd_port_params_t {
2007        ioc_fm_port_type                        port_type;
2008                                /**< Type of port for this profile */
2009        uint8_t                         port_id;
2010                                /**< FM-Port id of port for this profile */
2011} ioc_fm_pcd_port_params_t;
2012
2013/*
2014 * @Description   Parameters for defining the policer profile entry
2015 *                (Must match struct ioc_fm_pcd_plcr_profile_params_t defined in
2016 *                fm_pcd_ext.h)
2017 */
2018struct fm_pcd_plcr_profile_params_t {
2019        bool modify;
2020                /**< TRUE to change an existing profile */
2021        union {
2022                struct {
2023                        ioc_fm_pcd_profile_type_selection profile_type;
2024                                /**< Type of policer profile */
2025                        ioc_fm_pcd_port_params_t *p_fm_port;
2026                                /**< Relevant for per-port profiles only */
2027                        uint16_t relative_profile_id;
2028                                /**< Profile id - relative to shared group or to
2029                                 * port
2030                                 */
2031                } new_params;
2032                        /**< Use it when modify = FALSE */
2033                void *p_profile;
2034                        /**< A handle to a profile - use it when modify=TRUE */
2035        } profile_select;
2036        ioc_fm_pcd_plcr_algorithm_selection alg_selection;
2037        /**< Profile Algorithm PASS_THROUGH, RFC_2698, RFC_4115 */
2038        ioc_fm_pcd_plcr_color_mode color_mode;
2039        /**< COLOR_BLIND, COLOR_AWARE */
2040
2041        union {
2042                ioc_fm_pcd_plcr_color dflt_color;
2043                /**< For Color-Blind Pass-Through mode; the policer will
2044                 * re-color any incoming packet with the default value.
2045                 */
2046                ioc_fm_pcd_plcr_color override;
2047                /**< For Color-Aware modes; the profile response to a pre-color
2048                 * value of 2'b11.
2049                 */
2050        } color;
2051
2052        ioc_fm_pcd_plcr_non_passthrough_alg_param_t
2053                non_passthrough_alg_param;
2054                /**< RFC2698 or RFC4115 parameters */
2055
2056        ioc_fm_pcd_engine next_engine_on_green;
2057                /**< Next engine for green-colored frames */
2058        ioc_fm_pcd_plcr_next_engine_params_u params_on_green;
2059                /**< Next engine parameters for green-colored frames */
2060
2061        ioc_fm_pcd_engine next_engine_on_yellow;
2062                /**< Next engine for yellow-colored frames */
2063        ioc_fm_pcd_plcr_next_engine_params_u params_on_yellow;
2064                /**< Next engine parameters for yellow-colored frames */
2065
2066        ioc_fm_pcd_engine next_engine_on_red;
2067                /**< Next engine for red-colored frames */
2068        ioc_fm_pcd_plcr_next_engine_params_u params_on_red;
2069                /**< Next engine parameters for red-colored frames */
2070
2071        bool trap_profile_on_flow_A;
2072                /**< Obsolete - do not use */
2073        bool trap_profile_on_flow_B;
2074                /**< Obsolete - do not use */
2075        bool trap_profile_on_flow_C;
2076                /**< Obsolete - do not use */
2077};
2078
2079typedef struct ioc_fm_pcd_plcr_profile_params_t {
2080        struct fm_pcd_plcr_profile_params_t param;
2081        void    *id;
2082                /**< output parameter; Returns the profile Id to be used */
2083} ioc_fm_pcd_plcr_profile_params_t;
2084
2085/*
2086 * @Description   A structure for modifying CC tree next engine
2087 */
2088typedef struct ioc_fm_pcd_cc_tree_modify_next_engine_params_t {
2089        void                            *id;
2090                        /**< CC tree Id to be used */
2091        uint8_t                         grp_indx;
2092                        /**< A Group index in the tree */
2093        uint8_t                         indx;
2094                        /**< Entry index in the group defined by grp_index */
2095        ioc_fm_pcd_cc_next_engine_params_t  cc_next_engine_params;
2096                        /**< Parameters for the next for the defined Key in the
2097                         * p_key
2098                         */
2099} ioc_fm_pcd_cc_tree_modify_next_engine_params_t;
2100
2101/*
2102 * @Description   A structure for modifying CC node next engine
2103 */
2104typedef struct ioc_fm_pcd_cc_node_modify_next_engine_params_t {
2105        void                            *id;
2106                        /**< CC node Id to be used */
2107        uint16_t                                key_indx;
2108                        /**< Key index for Next Engine Params modifications;
2109                         * NOTE: This parameter is IGNORED for miss-key!
2110                         */
2111        uint8_t                         key_size;
2112                        /**< Key size of added key */
2113        ioc_fm_pcd_cc_next_engine_params_t  cc_next_engine_params;
2114                        /**< parameters for the next for the defined Key in the
2115                         * p_key
2116                         */
2117} ioc_fm_pcd_cc_node_modify_next_engine_params_t;
2118
2119/*
2120 * @Description   A structure for remove CC node key
2121 */
2122typedef struct ioc_fm_pcd_cc_node_remove_key_params_t {
2123        void                            *id;
2124                        /**< CC node Id to be used */
2125        uint16_t                                key_indx;
2126                        /**< Key index for Next Engine Params modifications;
2127                         * NOTE: This parameter is IGNORED for miss-key!
2128                         */
2129} ioc_fm_pcd_cc_node_remove_key_params_t;
2130
2131/*
2132 * @Description   A structure for modifying CC node key and next engine
2133 */
2134typedef struct ioc_fm_pcd_cc_node_modify_key_and_next_engine_params_t {
2135        void                            *id;
2136                        /**< CC node Id to be used */
2137        uint16_t                                key_indx;
2138                        /**< Key index for Next Engine Params modifications;
2139                         * NOTE: This parameter is IGNORED for miss-key!
2140                         */
2141        uint8_t                         key_size;
2142                        /**< Key size of added key */
2143        ioc_fm_pcd_cc_key_params_t      key_params;
2144                        /**< it's array with num_of_keys entries each entry in
2145                         * the array of the type ioc_fm_pcd_cc_key_params_t
2146                         */
2147} ioc_fm_pcd_cc_node_modify_key_and_next_engine_params_t;
2148
2149/*
2150 * @Description   A structure for modifying CC node key
2151 */
2152typedef struct ioc_fm_pcd_cc_node_modify_key_params_t {
2153        void                            *id;
2154                        /**< CC node Id to be used */
2155        uint16_t                                key_indx;
2156                        /**< Key index for Next Engine Params modifications;
2157                         * NOTE: This parameter is IGNORED for miss-key!
2158                         */
2159        uint8_t                         key_size;
2160                        /**< Key size of added key */
2161        uint8_t                         *p_key;
2162                        /**< Pointer to the key of the size defined in key_size
2163                         */
2164        uint8_t                         *p_mask;
2165                        /**< Pointer to the Mask per key of the size defined in
2166                         * key_size. p_key and p_mask (if defined) have to be of
2167                         * the same size as defined in the key_size
2168                         */
2169} ioc_fm_pcd_cc_node_modify_key_params_t;
2170
2171/*
2172 * @Description   A structure with the arguments for the
2173 *                fm_pcd_hash_table_remove_key ioctl() call
2174 */
2175typedef struct ioc_fm_pcd_hash_table_remove_key_params_t {
2176        void    *p_hash_tbl;    /**< The id of the hash table */
2177        uint8_t key_size;       /**< The size of the key to remove */
2178        uint8_t *p_key;         /**< Pointer to the key to remove */
2179} ioc_fm_pcd_hash_table_remove_key_params_t;
2180
2181/*
2182 * @Description   Parameters for selecting a location for requested manipulation
2183 */
2184typedef struct ioc_fm_manip_hdr_info_t {
2185        ioc_net_header_type             hdr;            /**< Header selection */
2186        ioc_fm_pcd_hdr_index            hdr_index;
2187                        /**< Relevant only for MPLS, VLAN and tunneled IP.
2188                         * Otherwise should be cleared.
2189                         */
2190        bool                            by_field;
2191                        /**< TRUE if the location of manipulation is according
2192                         * to some field in the specific header
2193                         */
2194        ioc_fm_pcd_fields_u             full_field;
2195                        /**< Relevant only when by_field = TRUE: Extract field
2196                         */
2197} ioc_fm_manip_hdr_info_t;
2198
2199/*
2200 * @Description   Parameters for defining header removal by header type
2201 */
2202typedef struct ioc_fm_pcd_manip_hdr_rmv_by_hdr_params_t {
2203        ioc_fm_pcd_manip_hdr_rmv_by_hdr_type    type;
2204                        /**< Selection of header removal location */
2205        union {
2206        ioc_fm_manip_hdr_info_t         hdr_info;
2207                /**< Relevant when type = e_FM_PCD_MANIP_RMV_BY_HDR_FROM_START
2208                 */
2209        ioc_fm_pcd_manip_hdr_rmv_specific_l2    specific_l2;
2210                /**< Relevant when type = e_IOC_FM_PCD_MANIP_BY_HDR_SPECIFIC_L2;
2211                 * Defines which L2 headers to remove.
2212                 */
2213        } u;
2214} ioc_fm_pcd_manip_hdr_rmv_by_hdr_params_t;
2215
2216/*
2217 * @Description   Parameters for configuring IP fragmentation manipulation
2218 */
2219typedef struct ioc_fm_pcd_manip_frag_ip_params_t {
2220        uint16_t                        size_for_fragmentation;
2221                /**< If length of the frame is greater than this value, IP
2222                 * fragmentation will be executed.
2223                 */
2224        bool                    sg_bpid_en;
2225                /**< Enable a dedicated buffer pool id for the Scatter/Gather
2226                 * buffer allocation; If disabled, the Scatter/Gather buffer
2227                 * will be allocated from the same pool as the received frame's
2228                 * buffer.
2229                 */
2230        uint8_t                 sg_bpid;
2231                /**< Scatter/Gather buffer pool id; This parameter is relevant
2232                 * when 'sg_bpid_en=TRUE'; Same LIODN number is used for these
2233                 * buffers as for the received frames buffers, so buffers of
2234                 * this pool need to be allocated in the same memory area as the
2235                 * received buffers. If the received buffers arrive from
2236                 * different sources, the Scatter/Gather BP id should be mutual
2237                 * to all these sources.
2238                 */
2239        ioc_fm_pcd_manip_donot_frag_action  donot_frag_action;
2240                /**< Don't Fragment Action - If an IP packet is larger than MTU
2241                 * and its DF bit is set, then this field will determine the
2242                 * action to be taken.
2243                 */
2244} ioc_fm_pcd_manip_frag_ip_params_t;
2245
2246/*
2247 * @Description   Parameters for configuring IP reassembly manipulation.
2248 *
2249 *                This is a common structure for both IPv4 and IPv6 reassembly
2250 *                manipulation. For reassembly of both IPv4 and IPv6, make sure
2251 *                to set the 'hdr' field in ioc_fm_pcd_manip_reassem_params_t to
2252 *                IOC_header_type_ipv_6.
2253 */
2254typedef struct ioc_fm_pcd_manip_reassem_ip_params_t {
2255        uint8_t                 relative_scheme_id[2];
2256                        /**< Partition relative scheme id: relativeSchemeId[0] -
2257                         * Relative scheme ID for IPV4 Reassembly manipulation;
2258                         * relativeSchemeId[1] -  Relative scheme ID for IPV6
2259                         * Reassembly manipulation; NOTE: The following comment
2260                         * is relevant only for FMAN v2 devices: Relative scheme
2261                         * ID for IPv4/IPv6 Reassembly manipulation must be
2262                         * smaller than the user schemes id to ensure that the
2263                         * reassembly's schemes will be first match. The
2264                         * remaining schemes, if defined, should have higher
2265                         * relative scheme ID.
2266                         */
2267        uint32_t                        non_consistent_sp_fqid;
2268                        /**< In case that other fragments of the frame
2269                         * corresponds to different storage profile than the
2270                         * opening fragment (Non-Consistent-SP state) then one
2271                         * of two possible scenarios occurs: if
2272                         * 'nonConsistentSpFqid != 0', the reassembled frame
2273                         * will be enqueued to this fqid, otherwise a 'Non
2274                         * Consistent SP' bit will be set in the FD[status].
2275                         */
2276        uint8_t                         data_mem_id;
2277                        /**< Memory partition ID for the IPR's external tables
2278                         * structure
2279                         */
2280        uint16_t                        data_liodn_offset;
2281                        /**< LIODN offset for access the IPR's external tables
2282                         * structure.
2283                         */
2284        uint16_t                        min_frag_size[2];
2285                        /**< Minimum fragment size: minFragSize[0] - for ipv4,
2286                         * minFragSize[1] - for ipv6
2287                         */
2288        ioc_fm_pcd_manip_reassem_ways_number   num_of_frames_per_hash_entry[2];
2289                        /**< Number of frames per hash entry needed for
2290                         * reassembly process: num_of_frames_per_hash_entry[0] -
2291                         * for ipv4 (max value is
2292                         * e_IOC_FM_PCD_MANIP_EIGHT_WAYS_HASH);
2293                         * num_of_frames_per_hash_entry[1] - for ipv6 (max value
2294                         * is e_IOC_FM_PCD_MANIP_SIX_WAYS_HASH).
2295                         */
2296        uint16_t                        max_num_frames_in_process;
2297                        /**< Number of frames which can be processed by
2298                         * Reassembly in the same time; Must be power of 2; In
2299                         * the case num_of_frames_per_hash_entry ==
2300                         * e_IOC_FM_PCD_MANIP_FOUR_WAYS_HASH,
2301                         * max_num_frames_in_process has to be in the range of
2302                         * 4 - 512; In the case num_of_frames_per_hash_entry ==
2303                         * e_IOC_FM_PCD_MANIP_EIGHT_WAYS_HASH,
2304                         * max_num_frames_in_process has to be in the range of
2305                         * 8 - 2048.
2306                         */
2307        ioc_fm_pcd_manip_reassem_time_out_mode  time_out_mode;
2308                        /**< Expiration delay initialized by Reassembly process
2309                         */
2310        uint32_t                        fqid_for_time_out_frames;
2311                        /**< FQID in which time out frames will enqueue during
2312                         * Time Out Process
2313                         */
2314        uint32_t                        timeout_threshold_for_reassm_process;
2315                        /**< Represents the time interval in microseconds which
2316                         * defines if opened frame (at least one fragment was
2317                         * processed but not all the fragments)is found as too
2318                         * old
2319                         */
2320} ioc_fm_pcd_manip_reassem_ip_params_t;
2321
2322/*
2323 * @Description   Parameters for defining IPSEC manipulation
2324 */
2325typedef struct ioc_fm_pcd_manip_special_offload_ipsec_params_t {
2326        bool    decryption;
2327                        /**< TRUE if being used in decryption direction;
2328                         * FALSE if being used in encryption direction.
2329                         */
2330        bool    ecn_copy;
2331                        /**< TRUE to copy the ECN bits from inner/outer to
2332                         * outer/inner (direction depends on the 'decryption'
2333                         * field).
2334                         */
2335        bool    dscp_copy;
2336                        /**< TRUE to copy the DSCP bits from inner/outer to
2337                         * outer/inner (direction depends on the 'decryption'
2338                         * field).
2339                         */
2340        bool    variable_ip_hdr_len;
2341                        /**< TRUE for supporting variable IP header length in
2342                         * decryption.
2343                         */
2344        bool    variable_ip_version;
2345                        /**< TRUE for supporting both IP version on the same SA
2346                         * in encryption
2347                         */
2348        uint8_t outer_ip_hdr_len;
2349                        /**< If 'variable_ip_version == TRUE' than this field
2350                         * must be set to non-zero value; It is specifies the
2351                         * length of the outer IP header that was configured in
2352                         * the corresponding SA.
2353                         */
2354        uint16_t        arw_size;
2355                        /**< if <> '0' then will perform ARW check for this SA;
2356                         * The value must be a multiplication of 16
2357                         */
2358        void    *arw_addr;
2359                        /**< if arwSize <> '0' then this field must be set to
2360                         * non-zero value; MUST be allocated from FMAN's MURAM
2361                         * that the post-sec op-port belong Must be 4B aligned.
2362                         * Required MURAM size is
2363                         * '(NEXT_POWER_OF_2(arwSize+32))/8+4' Bytes
2364                         */
2365} ioc_fm_pcd_manip_special_offload_ipsec_params_t;
2366
2367/*
2368 * @Description   Parameters for configuring CAPWAP fragmentation manipulation
2369 *
2370 *                Restrictions:
2371 *                - Maximum number of fragments per frame is 16.
2372 *                - Transmit confirmation is not supported.
2373 *                - Fragmentation nodes must be set as the last PCD action (i.e.
2374 *                  the corresponding CC node key must have next engine set to
2375 *                  e_FM_PCD_DONE).
2376 *                - Only BMan buffers shall be used for frames to be fragmented.
2377 *                - NOTE: The following comment is relevant only for FMAN v3
2378 *                  devices: IPF does not support VSP. Therefore, on the same
2379 *                  port where we have IPF we cannot support VSP.
2380 */
2381typedef struct ioc_fm_pcd_manip_frag_capwap_params_t {
2382        uint16_t        size_for_fragmentation;
2383                        /**< If length of the frame is greater than this value,
2384                         * CAPWAP fragmentation will be executed.
2385                         */
2386        bool            sg_bpid_en;
2387                        /**< Enable a dedicated buffer pool id for the
2388                         * Scatter/Gather buffer allocation; If disabled, the
2389                         * Scatter/Gather buffer will be allocated from the same
2390                         * pool as the received frame's buffer.
2391                         */
2392        uint8_t         sg_bpid;
2393                        /**< Scatter/Gather buffer pool id; This parameters is
2394                         * relevant when 'sg_bpidEn=TRUE'; Same LIODN number is
2395                         * used for these buffers as for the received frames
2396                         * buffers, so buffers of this pool need to be allocated
2397                         * in the same memory area as the received buffers. If
2398                         * the received buffers arrive from different sources,
2399                         * the Scatter/Gather BP id should be mutual to all
2400                         * these sources.
2401                         */
2402        bool    compress_mode_en;
2403                        /**< CAPWAP Header Options Compress Enable mode; When
2404                         * this mode is enabled then only the first fragment
2405                         * include the CAPWAP header options field (if user
2406                         * provides it in the input frame) and all other
2407                         * fragments exclude the CAPWAP options field (CAPWAP
2408                         * header is updated accordingly).
2409                         */
2410} ioc_fm_pcd_manip_frag_capwap_params_t;
2411
2412/*
2413 * @Description   Parameters for configuring CAPWAP reassembly manipulation.
2414 *
2415 *                Restrictions:
2416 *                - Application must define one scheme to catch the reassembled
2417 *                  frames.
2418 *                - Maximum number of fragments per frame is 16.
2419 */
2420typedef struct ioc_fm_pcd_manip_reassem_capwap_params_t {
2421        uint8_t         relative_scheme_id;
2422                        /**< Partition relative scheme id; NOTE: this id must be
2423                         * smaller than the user schemes id to ensure that the
2424                         * reassembly scheme will be first match; Rest schemes,
2425                         * if defined, should have higher relative scheme ID.
2426                         */
2427        uint8_t         data_mem_id;
2428                        /**< Memory partition ID for the IPR's external tables
2429                         * structure
2430                         */
2431        uint16_t        data_liodn_offset;
2432                        /**< LIODN offset for access the IPR's external tables
2433                         * structure.
2434                         */
2435        uint16_t        max_reassembled_frame_length;
2436                        /**< The maximum CAPWAP reassembled frame length in
2437                         * bytes; If maxReassembledFrameLength == 0, any
2438                         * successful reassembled frame length is considered as
2439                         * a valid length; if maxReassembledFrameLength > 0, a
2440                         * successful reassembled frame which its length exceeds
2441                         * this value is considered as an error frame (FD
2442                         * status[CRE] bit is set).
2443                         */
2444        ioc_fm_pcd_manip_reassem_ways_number   num_of_frames_per_hash_entry;
2445                        /**< Number of frames per hash entry needed for
2446                         * reassembly process
2447                         */
2448        uint16_t        max_num_frames_in_process;
2449                        /**< Number of frames which can be processed by
2450                         * reassembly in the same time; Must be power of 2; In
2451                         * the case num_of_frames_per_hash_entry ==
2452                         * e_FM_PCD_MANIP_FOUR_WAYS_HASH,
2453                         * max_num_frames_in_process has to be in the range of
2454                         * 4 - 512; In the case num_of_frames_per_hash_entry ==
2455                         * e_FM_PCD_MANIP_EIGHT_WAYS_HASH,
2456                         * max_num_frames_in_process has to be in the range of
2457                         * 8 - 2048.
2458                         */
2459        ioc_fm_pcd_manip_reassem_time_out_mode  time_out_mode;
2460                        /**< Expiration delay initialized by Reassembly process
2461                         */
2462        uint32_t        fqid_for_time_out_frames;
2463                        /**< FQID in which time out frames will enqueue during
2464                         * Time Out Process; Recommended value for this field is
2465                         * 0; in this way timed-out frames will be discarded
2466                         */
2467        uint32_t        timeout_threshold_for_reassm_process;
2468                        /**< Represents the time interval in microseconds which
2469                         * defines if opened frame (at least one fragment was
2470                         * processed but not all the fragments)is found as too
2471                         * old
2472                         */
2473} ioc_fm_pcd_manip_reassem_capwap_params_t;
2474
2475/*
2476 * @Description   structure for defining CAPWAP manipulation
2477 */
2478typedef struct ioc_fm_pcd_manip_special_offload_capwap_params_t {
2479        bool                    dtls;
2480                        /**< TRUE if continue to SEC DTLS encryption */
2481        ioc_fm_pcd_manip_hdr_qos_src   qos_src;
2482                        /**< TODO */
2483} ioc_fm_pcd_manip_special_offload_capwap_params_t;
2484
2485/*
2486 * @Description   Parameters for defining special offload manipulation
2487 */
2488typedef struct ioc_fm_pcd_manip_special_offload_params_t {
2489        ioc_fm_pcd_manip_special_offload_type           type;
2490                /**< Type of special offload manipulation */
2491        union {
2492        ioc_fm_pcd_manip_special_offload_ipsec_params_t ipsec;
2493                /**< Parameters for IPSec; Relevant when type =
2494                 * e_IOC_FM_PCD_MANIP_SPECIAL_OFFLOAD_IPSEC
2495                 */
2496
2497        ioc_fm_pcd_manip_special_offload_capwap_params_t capwap;
2498                /**< Parameters for CAPWAP; Relevant when type =
2499                 * e_FM_PCD_MANIP_SPECIAL_OFFLOAD_CAPWAP
2500                 */
2501        } u;
2502} ioc_fm_pcd_manip_special_offload_params_t;
2503
2504/*
2505 * @Description   Parameters for defining generic removal manipulation
2506 */
2507typedef struct ioc_fm_pcd_manip_hdr_rmv_generic_params_t {
2508        uint8_t                 offset;
2509                /**< Offset from beginning of header to the start location of
2510                 * the removal
2511                 */
2512        uint8_t                 size;   /**< Size of removed section */
2513} ioc_fm_pcd_manip_hdr_rmv_generic_params_t;
2514
2515/*
2516 * @Description   Parameters for defining insertion manipulation
2517 */
2518typedef struct ioc_fm_pcd_manip_hdr_insrt_t {
2519        uint8_t size;           /**< size of inserted section */
2520        uint8_t *p_data;        /**< data to be inserted */
2521} ioc_fm_pcd_manip_hdr_insrt_t;
2522
2523/*
2524 * @Description   Parameters for defining generic insertion manipulation
2525 */
2526typedef struct ioc_fm_pcd_manip_hdr_insrt_generic_params_t {
2527        uint8_t                 offset;
2528                        /**< Offset from beginning of header to the start
2529                         * location of the insertion
2530                         */
2531        uint8_t                 size;   /**< Size of inserted section */
2532        bool                    replace;
2533                        /**< TRUE to override (replace) existing data at
2534                         * 'offset', FALSE to insert
2535                         */
2536        uint8_t                 *p_data;
2537                        /**< Pointer to data to be inserted */
2538} ioc_fm_pcd_manip_hdr_insrt_generic_params_t;
2539
2540/*
2541 * @Description   Parameters for defining header manipulation VLAN DSCP To Vpri
2542 *                translation
2543 */
2544typedef struct ioc_fm_pcd_manip_hdr_field_update_vlan_dscp_to_vpri_t {
2545        uint8_t         dscp_to_vpri_table[IOC_FM_PCD_MANIP_DSCP_TO_VLAN_TRANS];
2546                /**< A table of VPri values for each DSCP value; The index is
2547                 * the D_SCP value (0-0x3F) and the value is the corresponding
2548                 * VPRI (0-15).
2549                 */
2550        uint8_t         vpri_def_val;
2551                /**< 0-7, Relevant only if update_type =
2552                 * e_IOC_FM_PCD_MANIP_HDR_FIELD_UPDATE_DSCP_TO_VLAN, this field
2553                 * is the Q Tag default value if the IP header is not found.
2554                 */
2555} ioc_fm_pcd_manip_hdr_field_update_vlan_dscp_to_vpri_t;
2556
2557/*
2558 * @Description   Parameters for defining header manipulation VLAN fields
2559 *                updates
2560 */
2561typedef struct ioc_fm_pcd_manip_hdr_field_update_vlan_t {
2562        ioc_fm_pcd_manip_hdr_field_update_vlan  update_type;
2563                /**< Selects VLAN update type */
2564        union {
2565        uint8_t                                 vpri;
2566                /**< 0-7, Relevant only if If update_type =
2567                 * e_IOC_FM_PCD_MANIP_HDR_FIELD_UPDATE_VLAN_PRI, this is the new
2568                 * VLAN pri.
2569                 */
2570        ioc_fm_pcd_manip_hdr_field_update_vlan_dscp_to_vpri_t   dscp_to_vpri;
2571                /**<  Parameters structure, Relevant only if update_type =
2572                 * e_IOC_FM_PCD_MANIP_HDR_FIELD_UPDATE_DSCP_TO_VLAN.
2573                 */
2574        } u;
2575} ioc_fm_pcd_manip_hdr_field_update_vlan_t;
2576
2577/*
2578 * @Description   Parameters for defining header manipulation IPV4 fields
2579 *                updates
2580 */
2581typedef struct ioc_fm_pcd_manip_hdr_field_update_ipv4_t {
2582        ioc_ipv4_hdr_manip_update_flags_t       valid_updates;
2583                        /**< ORed flag, selecting the required updates */
2584        uint8_t         tos;
2585                        /**< 8 bit New TOS; Relevant if valid_updates contains
2586                         * IOC_HDR_MANIP_IPV4_TOS
2587                         */
2588        uint16_t        id;
2589                        /**< 16 bit New IP ID; Relevant only if
2590                         * valid_updates contains IOC_HDR_MANIP_IPV4_ID
2591                         */
2592        uint32_t        src;
2593                        /**< 32 bit New IP SRC; Relevant only if
2594                         * valid_updates contains IOC_HDR_MANIP_IPV4_SRC
2595                         */
2596        uint32_t        dst;
2597                        /**< 32 bit New IP DST; Relevant only if
2598                         * valid_updates contains IOC_HDR_MANIP_IPV4_DST
2599                         */
2600} ioc_fm_pcd_manip_hdr_field_update_ipv4_t;
2601
2602/*
2603 * @Description   Parameters for defining header manipulation IPV6 fields
2604 *                updates
2605 */
2606typedef struct ioc_fm_pcd_manip_hdr_field_update_ipv6_t {
2607        ioc_ipv6_hdr_manip_update_flags_t       valid_updates;
2608                        /**< ORed flag, selecting the required updates */
2609        uint8_t         traffic_class;
2610                        /**< 8 bit New Traffic Class; Relevant if valid_updates
2611                         * contains IOC_HDR_MANIP_IPV6_TC
2612                         */
2613        uint8_t         src[ioc_net_hf_ipv6_addr_size];
2614                        /**< 16 byte new IP SRC; Relevant only if valid_updates
2615                         * contains IOC_HDR_MANIP_IPV6_SRC
2616                         */
2617        uint8_t         dst[ioc_net_hf_ipv6_addr_size];
2618                        /**< 16 byte new IP DST; Relevant only if valid_updates
2619                         * contains IOC_HDR_MANIP_IPV6_DST
2620                         */
2621} ioc_fm_pcd_manip_hdr_field_update_ipv6_t;
2622
2623/*
2624 * @Description   Parameters for defining header manipulation TCP/UDP fields
2625 *                updates
2626 */
2627typedef struct ioc_fm_pcd_manip_hdr_field_update_tcp_udp_t {
2628        ioc_tcp_udp_hdr_manip_update_flags_t    valid_updates;
2629                        /**< ORed flag, selecting the required updates */
2630        uint16_t        src;
2631                        /**< 16 bit New TCP/UDP SRC; Relevant only if
2632                         * valid_updates contains IOC_HDR_MANIP_TCP_UDP_SRC
2633                         */
2634        uint16_t        dst;
2635                        /**< 16 bit New TCP/UDP DST; Relevant only if
2636                         * valid_updates contains IOC_HDR_MANIP_TCP_UDP_DST
2637                         */
2638} ioc_fm_pcd_manip_hdr_field_update_tcp_udp_t;
2639
2640/*
2641 * @Description   Parameters for defining header manipulation fields updates
2642 */
2643typedef struct ioc_fm_pcd_manip_hdr_field_update_params_t {
2644        ioc_fm_pcd_manip_hdr_field_update_type  type;
2645                        /**< Type of header field update manipulation */
2646        union {
2647        ioc_fm_pcd_manip_hdr_field_update_vlan_t        vlan;
2648                        /**< Parameters for VLAN update. Relevant when type =
2649                         * e_IOC_FM_PCD_MANIP_HDR_FIELD_UPDATE_VLAN
2650                         */
2651        ioc_fm_pcd_manip_hdr_field_update_ipv4_t        ipv4;
2652                        /**< Parameters for IPv4 update. Relevant when type =
2653                         * e_IOC_FM_PCD_MANIP_HDR_FIELD_UPDATE_IPV4
2654                         */
2655        ioc_fm_pcd_manip_hdr_field_update_ipv6_t        ipv6;
2656                        /**< Parameters for IPv6 update. Relevant when type =
2657                         * e_IOC_FM_PCD_MANIP_HDR_FIELD_UPDATE_IPV6
2658                         */
2659        ioc_fm_pcd_manip_hdr_field_update_tcp_udp_t tcp_udp;
2660                        /**< Parameters for TCP/UDP update. Relevant when type =
2661                         * e_IOC_FM_PCD_MANIP_HDR_FIELD_UPDATE_TCP_UDP
2662                         */
2663        } u;
2664} ioc_fm_pcd_manip_hdr_field_update_params_t;
2665
2666/*
2667 * @Description   Parameters for defining custom header manipulation for IP
2668 *                replacement
2669 */
2670typedef struct ioc_fm_pcd_manip_hdr_custom_ip_hdr_replace_t {
2671        ioc_fm_pcd_manip_hdr_custom_ip_replace  replace_type;
2672                        /**< Selects replace update type */
2673        bool    dec_ttl_hl;
2674                        /**< Decrement TTL (IPV4) or Hop limit (IPV6) by 1 */
2675        bool    update_ipv4_id;
2676                        /**< Relevant when replace_type =
2677                         * e_IOC_FM_PCD_MANIP_HDR_CUSTOM_REPLACE_IPV6_BY_IPV4
2678                         */
2679        uint16_t id;
2680                /**< 16 bit New IP ID; Relevant only if update_ipv4_id = TRUE */
2681        uint8_t hdr_size;
2682                        /**< The size of the new IP header */
2683        uint8_t hdr[IOC_FM_PCD_MANIP_MAX_HDR_SIZE];
2684                        /**< The new IP header */
2685} ioc_fm_pcd_manip_hdr_custom_ip_hdr_replace_t;
2686
2687/*
2688 * @Description   Parameters for defining custom header manipulation
2689 */
2690typedef struct ioc_fm_pcd_manip_hdr_custom_params_t {
2691        ioc_fm_pcd_manip_hdr_custom_type                type;
2692                        /**< Type of header field update manipulation */
2693        union {
2694        ioc_fm_pcd_manip_hdr_custom_ip_hdr_replace_t    ip_hdr_replace;
2695                        /**< Parameters IP header replacement */
2696        } u;
2697} ioc_fm_pcd_manip_hdr_custom_params_t;
2698
2699/*
2700 * @Description   Parameters for defining specific L2 insertion manipulation
2701 */
2702typedef struct ioc_fm_pcd_manip_hdr_insrt_specific_l2_params_t {
2703        ioc_fm_pcd_manip_hdr_insrt_specific_l2  specific_l2;
2704                        /**< Selects which L2 headers to insert */
2705        bool                                    update;
2706                        /**< TRUE to update MPLS header */
2707        uint8_t                         size;
2708                        /**< size of inserted section */
2709        uint8_t                         *p_data;
2710                        /**< data to be inserted */
2711} ioc_fm_pcd_manip_hdr_insrt_specific_l2_params_t;
2712
2713/*
2714 * @Description   Parameters for defining IP insertion manipulation
2715 */
2716typedef struct ioc_fm_pcd_manip_hdr_insrt_ip_params_t {
2717        bool    calc_l4_checksum;
2718                        /**< Calculate L4 checksum. */
2719        ioc_fm_pcd_manip_hdr_qos_mapping_mode   mapping_mode;
2720                        /**< TODO */
2721        uint8_t last_pid_offset;
2722                        /**< the offset of the last Protocol within the inserted
2723                         * header
2724                         */
2725        uint16_t  id;   /**< 16 bit New IP ID */
2726        bool    donot_frag_overwrite;
2727                        /**< IPv4 only. DF is overwritten with the hash-result
2728                         * next-to-last byte. This byte is configured to be
2729                         * overwritten when RPD is set.
2730                         */
2731        uint8_t last_dst_offset;
2732                        /**< IPv6 only. if routing extension exist, user should
2733                         * set the offset of the destination address in order
2734                         * to calculate UDP checksum pseudo header; Otherwise
2735                         * set it to '0'.
2736                         */
2737        ioc_fm_pcd_manip_hdr_insrt_t insrt;
2738                        /**< size and data to be inserted. */
2739} ioc_fm_pcd_manip_hdr_insrt_ip_params_t;
2740
2741/*
2742 * @Description   Parameters for defining header insertion manipulation by
2743 *                header type
2744 */
2745typedef struct ioc_fm_pcd_manip_hdr_insrt_by_hdr_params_t {
2746        ioc_fm_pcd_manip_hdr_insrt_by_hdr_type  type;
2747                        /**< Selects manipulation type */
2748        union {
2749        ioc_fm_pcd_manip_hdr_insrt_specific_l2_params_t  specific_l2_params;
2750                        /**< Used when type =
2751                         * e_IOC_FM_PCD_MANIP_INSRT_BY_HDR_SPECIFIC_L2: Selects
2752                         * which L2 headers to remove
2753                         */
2754        ioc_fm_pcd_manip_hdr_insrt_ip_params_t  ip_params;
2755                        /**< Used when type = e_FM_PCD_MANIP_INSRT_BY_HDR_IP */
2756        ioc_fm_pcd_manip_hdr_insrt_t            insrt;
2757                        /**< Used when type is one of
2758                         * e_FM_PCD_MANIP_INSRT_BY_HDR_UDP,
2759                         * e_FM_PCD_MANIP_INSRT_BY_HDR_UDP_LITE, or
2760                         * e_FM_PCD_MANIP_INSRT_BY_HDR_CAPWAP
2761                         */
2762        } u;
2763} ioc_fm_pcd_manip_hdr_insrt_by_hdr_params_t;
2764
2765/*
2766 * @Description   Parameters for defining header insertion manipulation
2767 */
2768typedef struct ioc_fm_pcd_manip_hdr_insrt_params_t {
2769        ioc_fm_pcd_manip_hdr_insrt_type                 type;
2770                        /**< Type of insertion manipulation */
2771        union {
2772        ioc_fm_pcd_manip_hdr_insrt_by_hdr_params_t      by_hdr;
2773                        /**< Parameters for defining header insertion
2774                         * manipulation by header type, relevant if 'type' =
2775                         * e_IOC_FM_PCD_MANIP_INSRT_BY_HDR
2776                         */
2777        ioc_fm_pcd_manip_hdr_insrt_generic_params_t     generic;
2778                        /**< Parameters for defining generic header insertion
2779                         * manipulation, relevant if type =
2780                         * e_IOC_FM_PCD_MANIP_INSRT_GENERIC
2781                         */
2782        } u;
2783} ioc_fm_pcd_manip_hdr_insrt_params_t;
2784
2785/*
2786 * @Description   Parameters for defining header removal manipulation
2787 */
2788typedef struct ioc_fm_pcd_manip_hdr_rmv_params_t {
2789        ioc_fm_pcd_manip_hdr_rmv_type           type;
2790                        /**< Type of header removal manipulation */
2791        union {
2792        ioc_fm_pcd_manip_hdr_rmv_by_hdr_params_t   by_hdr;
2793                        /**< Parameters for defining header removal manipulation
2794                         * by header type, relevant if type =
2795                         * e_IOC_FM_PCD_MANIP_RMV_BY_HDR
2796                         */
2797        ioc_fm_pcd_manip_hdr_rmv_generic_params_t  generic;
2798                        /**< Parameters for defining generic header removal
2799                         * manipulation, relevant if type =
2800                         * e_IOC_FM_PCD_MANIP_RMV_GENERIC
2801                         */
2802        } u;
2803} ioc_fm_pcd_manip_hdr_rmv_params_t;
2804
2805/*
2806 * @Description   Parameters for defining header manipulation node
2807 */
2808typedef struct ioc_fm_pcd_manip_hdr_params_t {
2809        bool                                    rmv;
2810                        /**< TRUE, to define removal manipulation */
2811        ioc_fm_pcd_manip_hdr_rmv_params_t       rmv_params;
2812                        /**< Parameters for removal manipulation, relevant if
2813                         * 'rmv' = TRUE
2814                         */
2815
2816        bool                                    insrt;
2817                        /**< TRUE, to define insertion manipulation */
2818        ioc_fm_pcd_manip_hdr_insrt_params_t     insrt_params;
2819                        /**< Parameters for insertion manipulation, relevant if
2820                         * 'insrt' = TRUE
2821                         */
2822
2823        bool                                    field_update;
2824                        /**< TRUE, to define field update manipulation */
2825        ioc_fm_pcd_manip_hdr_field_update_params_t  field_update_params;
2826                        /**< Parameters for field update manipulation, relevant
2827                         * if 'fieldUpdate' = TRUE
2828                         */
2829
2830        bool                                    custom;
2831                        /**< TRUE, to define custom manipulation */
2832        ioc_fm_pcd_manip_hdr_custom_params_t    custom_params;
2833                        /**< Parameters for custom manipulation, relevant if
2834                         * 'custom' = TRUE
2835                         */
2836
2837        bool                            donot_parse_after_manip;
2838                        /**< FALSE to activate the parser a second time after
2839                         * completing the manipulation on the frame
2840                         */
2841} ioc_fm_pcd_manip_hdr_params_t;
2842
2843/*
2844 * @Description   structure for defining fragmentation manipulation
2845 */
2846typedef struct ioc_fm_pcd_manip_frag_params_t {
2847        ioc_net_header_type                     hdr;
2848                        /**< Header selection */
2849        union {
2850        ioc_fm_pcd_manip_frag_capwap_params_t   capwap_frag;
2851                        /**< Parameters for defining CAPWAP fragmentation,
2852                         * relevant if 'hdr' = HEADER_TYPE_CAPWAP
2853                         */
2854        ioc_fm_pcd_manip_frag_ip_params_t   ip_frag;
2855                        /**< Parameters for defining IP fragmentation, relevant
2856                         * if 'hdr' = HEADER_TYPE_Ipv4 or HEADER_TYPE_Ipv6
2857                         */
2858        } u;
2859} ioc_fm_pcd_manip_frag_params_t;
2860
2861/*
2862 * @Description   structure for defining reassemble manipulation
2863 */
2864typedef struct ioc_fm_pcd_manip_reassem_params_t {
2865        ioc_net_header_type                     hdr;
2866                        /**< Header selection */
2867        union {
2868        ioc_fm_pcd_manip_reassem_capwap_params_t capwap_reassem;
2869                        /**< Parameters for defining CAPWAP reassembly, relevant
2870                         * if 'hdr' = HEADER_TYPE_CAPWAP
2871                         */
2872        ioc_fm_pcd_manip_reassem_ip_params_t    ip_reassem;
2873                        /**< Parameters for defining IP reassembly, relevant if
2874                         * 'hdr' = HEADER_TYPE_Ipv4 or HEADER_TYPE_Ipv6
2875                         */
2876        } u;
2877} ioc_fm_pcd_manip_reassem_params_t;
2878
2879/*
2880 * @Description   Parameters for defining a manipulation node
2881 */
2882struct fm_pcd_manip_params_t {
2883        ioc_fm_pcd_manip_type type;
2884                /**< Selects type of manipulation node */
2885        union {
2886                ioc_fm_pcd_manip_hdr_params_t hdr;
2887                        /**< Parameters for defining header manipulation node */
2888                ioc_fm_pcd_manip_reassem_params_t reassem;
2889                        /**< Parameters for defining reassembly manipulation
2890                         * node
2891                         */
2892                ioc_fm_pcd_manip_frag_params_t frag;
2893                        /**< Parameters for defining fragmentation manipulation
2894                         * node
2895                         */
2896                ioc_fm_pcd_manip_special_offload_params_t special_offload;
2897                        /**< Parameters for defining special offload
2898                         * manipulation node
2899                         */
2900        } u;
2901        void *p_next_manip;
2902                /**< Handle to another (previously defined) manipulation node;
2903                 * Allows concatenation of manipulation actions. This parameter
2904                 * is optional and may be NULL.
2905                 */
2906};
2907
2908typedef struct ioc_fm_pcd_manip_params_t {
2909        struct fm_pcd_manip_params_t param;
2910        void *id;
2911} ioc_fm_pcd_manip_params_t;
2912
2913/*
2914 * @Description   Structure for retrieving IP reassembly statistics
2915 */
2916typedef struct ioc_fm_pcd_manip_reassem_ip_stats_t {
2917        /* common counters for both IPv4 and IPv6 */
2918        uint32_t        timeout;
2919                /**< Counts the number of TimeOut occurrences */
2920        uint32_t        rfd_pool_busy;
2921                /**< Counts the number of failed attempts to allocate a
2922                 * Reassembly Frame Descriptor
2923                 */
2924        uint32_t        internal_buffer_busy;
2925                /**< Counts the number of times an internal buffer busy occurred
2926                 */
2927        uint32_t        external_buffer_busy;
2928                /**< Counts the number of times external buffer busy occurred */
2929        uint32_t        sg_fragments;
2930                /**< Counts the number of Scatter/Gather fragments */
2931        uint32_t        dma_semaphore_depletion;
2932                /**< Counts the number of failed attempts to allocate a DMA
2933                 * semaphore
2934                 */
2935        uint32_t        non_consistent_sp;
2936                /**< Counts the number of Non Consistent Storage Profile events
2937                 * for successfully reassembled frames
2938                 */
2939struct {
2940        uint32_t        successfully_reassembled;
2941                /**< Counts the number of successfully reassembled frames */
2942        uint32_t        valid_fragments;
2943                /**< Counts the total number of valid fragments that have been
2944                 * processed for all frames
2945                 */
2946        uint32_t        processed_fragments;
2947                /**< Counts the number of processed fragments (valid and error
2948                 * fragments) for all frames
2949                 */
2950        uint32_t        malformed_fragments;
2951                /**< Counts the number of malformed fragments processed for all
2952                 * frames
2953                 */
2954        uint32_t        discarded_fragments;
2955                /**< Counts the number of fragments discarded by the reassembly
2956                 * process
2957                 */
2958        uint32_t        auto_learn_busy;
2959                /**< Counts the number of times a busy condition occurs when
2960                 * attempting to access an IP-Reassembly Automatic Learning Hash
2961                 * set
2962                 */
2963        uint32_t        more_than16fragments;
2964                /**< Counts the fragment occurrences in which the number of
2965                 * fragments-per-frame exceeds 16
2966                 */
2967        } specific_hdr_statistics[2];
2968                /**< slot '0' is for IPv4, slot '1' is for IPv6 */
2969} ioc_fm_pcd_manip_reassem_ip_stats_t;
2970
2971/*
2972 * @Description   Structure for retrieving IP fragmentation statistics
2973 */
2974typedef struct ioc_fm_pcd_manip_frag_ip_stats_t {
2975        uint32_t        total_frames;
2976                        /**< Number of frames that passed through the
2977                         * manipulation node
2978                         */
2979        uint32_t        fragmented_frames;
2980                        /**< Number of frames that were fragmented */
2981        uint32_t        generated_fragments;
2982                        /**< Number of fragments that were generated */
2983} ioc_fm_pcd_manip_frag_ip_stats_t;
2984
2985/*
2986 * @Description   Structure for retrieving CAPWAP reassembly statistics
2987 */
2988typedef struct ioc_fm_pcd_manip_reassem_capwap_stats_t {
2989        uint32_t        timeout;
2990                        /**< Counts the number of timeout occurrences */
2991        uint32_t        rfd_pool_busy;
2992                        /**< Counts the number of failed attempts to allocate a
2993                         * Reassembly Frame Descriptor
2994                         */
2995        uint32_t        internal_buffer_busy;
2996                        /**< Counts the number of times an internal buffer busy
2997                         * occurred
2998                         */
2999        uint32_t        external_buffer_busy;
3000                        /**< Counts the number of times external buffer busy
3001                         * occurred
3002                         */
3003        uint32_t        sg_fragments;
3004                        /**< Counts the number of Scatter/Gather fragments */
3005        uint32_t        dma_semaphore_depletion;
3006                        /**< Counts the number of failed attempts to allocate a
3007                         * DMA semaphore
3008                         */
3009        uint32_t        successfully_reassembled;
3010                        /**< Counts the number of successfully reassembled
3011                         * frames
3012                         */
3013        uint32_t        valid_fragments;
3014                        /**< Counts the total number of valid fragments that
3015                         * have been processed for all frames
3016                         */
3017        uint32_t        processed_fragments;
3018                        /**< Counts the number of processed fragments (valid and
3019                         * error fragments) for all frames
3020                         */
3021        uint32_t        malformed_fragments;
3022                        /**< Counts the number of malformed fragments processed
3023                         * for all frames
3024                         */
3025        uint32_t        auto_learn_busy;
3026                        /**< Counts the number of times a busy condition occurs
3027                         * when attempting to access an Reassembly Automatic
3028                         * Learning Hash set
3029                         */
3030        uint32_t        discarded_fragments;
3031                        /**< Counts the number of fragments discarded by the
3032                         * reassembly process
3033                         */
3034        uint32_t        more_than16fragments;
3035                        /**< Counts the fragment occurrences in which the number
3036                         * of fragments-per-frame exceeds 16
3037                         */
3038        uint32_t        exceed_max_reassembly_frame_len;
3039                        /**< ounts the number of times that a successful
3040                         * reassembled frame length exceeds
3041                         * MaxReassembledFrameLength value
3042                         */
3043} ioc_fm_pcd_manip_reassem_capwap_stats_t;
3044
3045/*
3046 * @Description   Structure for retrieving CAPWAP fragmentation statistics
3047 */
3048typedef struct ioc_fm_pcd_manip_frag_capwap_stats_t {
3049        uint32_t        total_frames;
3050                        /**< Number of frames that passed through the
3051                         * manipulation node
3052                         */
3053        uint32_t        fragmented_frames;
3054                        /**< Number of frames that were fragmented */
3055        uint32_t        generated_fragments;
3056                        /**< Number of fragments that were generated */
3057#if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
3058        uint8_t sg_allocation_failure;
3059                        /**< Number of allocation failure of s/g buffers */
3060#endif /* (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0)) */
3061} ioc_fm_pcd_manip_frag_capwap_stats_t;
3062
3063/*
3064 * @Description   Structure for retrieving reassembly statistics
3065 */
3066typedef struct ioc_fm_pcd_manip_reassem_stats_t {
3067        union {
3068        ioc_fm_pcd_manip_reassem_ip_stats_t  ip_reassem;
3069                        /**< Structure for IP reassembly statistics */
3070        ioc_fm_pcd_manip_reassem_capwap_stats_t  capwap_reassem;
3071                        /**< Structure for CAPWAP reassembly statistics */
3072        } u;
3073} ioc_fm_pcd_manip_reassem_stats_t;
3074
3075/*
3076 * @Description   structure for retrieving fragmentation statistics
3077 */
3078typedef struct ioc_fm_pcd_manip_frag_stats_t {
3079        union {
3080        ioc_fm_pcd_manip_frag_ip_stats_t        ip_frag;
3081                        /**< Structure for IP fragmentation statistics */
3082        ioc_fm_pcd_manip_frag_capwap_stats_t capwap_frag;
3083                        /**< Structure for CAPWAP fragmentation statistics */
3084        } u;
3085} ioc_fm_pcd_manip_frag_stats_t;
3086
3087/*
3088 * @Description   structure for defining manipulation statistics
3089 */
3090typedef struct ioc_fm_pcd_manip_stats_t {
3091        union {
3092        ioc_fm_pcd_manip_reassem_stats_t  reassem;
3093                                /**< Structure for reassembly statistics */
3094        ioc_fm_pcd_manip_frag_stats_t   frag;
3095                                /**< Structure for fragmentation statistics */
3096        } u;
3097} ioc_fm_pcd_manip_stats_t;
3098
3099/*
3100 * @Description   Parameters for acquiring manipulation statistics
3101 */
3102typedef struct ioc_fm_pcd_manip_get_stats_t {
3103        void                            *id;
3104        ioc_fm_pcd_manip_stats_t        stats;
3105} ioc_fm_pcd_manip_get_stats_t;
3106
3107/*
3108 * @Description   Parameters for defining frame replicator group and its members
3109 */
3110struct fm_pcd_frm_replic_group_params_t {
3111        uint8_t                 max_num_of_entries;
3112                                /**< Maximal number of members in the group -
3113                                 * must be at least two
3114                                 */
3115        uint8_t                 num_of_entries;
3116                                /**< Number of members in the group - must be at
3117                                 * least 1
3118                                 */
3119        ioc_fm_pcd_cc_next_engine_params_t
3120                next_engine_params[IOC_FM_PCD_FRM_REPLIC_MAX_NUM_OF_ENTRIES];
3121                                /**< Array of members' parameters */
3122};
3123
3124typedef struct ioc_fm_pcd_frm_replic_group_params_t {
3125        struct fm_pcd_frm_replic_group_params_t param;
3126        void *id;
3127} ioc_fm_pcd_frm_replic_group_params_t;
3128
3129typedef struct ioc_fm_pcd_frm_replic_member_t {
3130        void *h_replic_group;
3131        uint16_t member_index;
3132} ioc_fm_pcd_frm_replic_member_t;
3133
3134typedef struct ioc_fm_pcd_frm_replic_member_params_t {
3135        ioc_fm_pcd_frm_replic_member_t member;
3136        ioc_fm_pcd_cc_next_engine_params_t next_engine_params;
3137} ioc_fm_pcd_frm_replic_member_params_t;
3138
3139
3140typedef struct ioc_fm_pcd_cc_key_statistics_t {
3141        uint32_t        byte_count;
3142                        /**< This counter reflects byte count of frames that
3143                         * were matched by this key.
3144                         */
3145        uint32_t        frame_count;
3146                        /**< This counter reflects count of frames that were
3147                         * matched by this key.
3148                         */
3149        uint32_t        frame_length_range_count[IOC_FM_PCD_CC_STATS_MAX_FLR];
3150                        /**< These counters reflect how many frames matched this
3151                         * key in 'RMON' statistics mode: Each counter holds the
3152                         * number of frames of a specific frames length range,
3153                         * according to the ranges provided at initialization.
3154                         */
3155} ioc_fm_pcd_cc_key_statistics_t;
3156
3157
3158typedef struct ioc_fm_pcd_cc_tbl_get_stats_t {
3159        void                            *id;
3160        uint16_t                        key_index;
3161        ioc_fm_pcd_cc_key_statistics_t  statistics;
3162} ioc_fm_pcd_cc_tbl_get_stats_t;
3163
3164/*
3165 * @Function      fm_pcd_match_table_get_key_statistics
3166 *
3167 * @Description   This routine may be used to get statistics counters of
3168 *                specific key in a CC Node.
3169 *
3170 *                If 'e_FM_PCD_CC_STATS_MODE_FRAME' and
3171 *                'e_FM_PCD_CC_STATS_MODE_BYTE_AND_FRAME' were set for this
3172 *                node, these counters reflect how many frames passed that were
3173 *                matched this key; The total frames count will be returned in
3174 *                the counter of the first range (as only one frame length range
3175 *                was defined). If 'e_FM_PCD_CC_STATS_MODE_RMON' was set for
3176 *                this node, the total frame count will be separated to frame
3177 *                length counters, based on provided frame length ranges.
3178 *
3179 * @Param[in]     h_cc_node             A handle to the node
3180 * @Param[in]     key_index             Key index for adding
3181 * @Param[out]    p_key_statistics      Key statistics counters
3182 *
3183 * @Return        The specific key statistics.
3184 *
3185 * @Cautions      Allowed only following fm_pcd_match_table_set().
3186 */
3187#define FM_PCD_IOC_MATCH_TABLE_GET_KEY_STAT \
3188                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(12), \
3189                      ioc_fm_pcd_cc_tbl_get_stats_t)
3190
3191/*
3192 * @Function      fm_pcd_match_table_get_miss_statistics
3193 *
3194 * @Description   This routine may be used to get statistics counters of miss
3195 *                entry in a CC Node.
3196 *
3197 *                If 'e_FM_PCD_CC_STATS_MODE_FRAME' and
3198 *                'e_FM_PCD_CC_STATS_MODE_BYTE_AND_FRAME' were set for this
3199 *                node, these counters reflect how many frames were not matched
3200 *                to any existing key and therefore passed through the miss
3201 *                entry; The total frames count will be returned in the counter
3202 *                of the first range (as only one frame length range was
3203 *                defined).
3204 *
3205 * @Param[in]     h_cc_node             A handle to the node
3206 * @Param[out]    p_miss_statistics     Statistics counters for 'miss'
3207 *
3208 * @Return        E_OK on success; Error code otherwise.
3209 *
3210 * @Cautions      Allowed only following fm_pcd_match_table_set().
3211 */
3212
3213#define FM_PCD_IOC_MATCH_TABLE_GET_MISS_STAT \
3214                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(13), \
3215                      ioc_fm_pcd_cc_tbl_get_stats_t)
3216
3217/*
3218 * @Function      fm_pcd_hash_table_get_miss_statistics
3219 *
3220 * @Description   This routine may be used to get statistics counters of 'miss'
3221 *                entry of the a hash table.
3222 *
3223 *                If 'e_FM_PCD_CC_STATS_MODE_FRAME' and
3224 *                'e_FM_PCD_CC_STATS_MODE_BYTE_AND_FRAME' were set for this
3225 *                node, these counters reflect how many frames were not matched
3226 *                to any existing key and therefore passed through the miss
3227 *                entry;
3228 *
3229 * @Param[in]     h_hash_tbl            A handle to a hash table
3230 * @Param[out]    p_miss_statistics     Statistics counters for 'miss'
3231 *
3232 * @Return        E_OK on success; Error code otherwise.
3233 *
3234 * @Cautions      Allowed only following fm_pcd_hash_table_set().
3235 */
3236#define FM_PCD_IOC_HASH_TABLE_GET_MISS_STAT \
3237                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(14), \
3238                      ioc_fm_pcd_cc_tbl_get_stats_t)
3239
3240/*
3241 * @Function      fm_pcd_net_env_characteristics_set
3242 *
3243 * @Description   Define a set of Network Environment Characteristics.
3244 *
3245 *                When setting an environment it is important to understand its
3246 *                application. It is not meant to describe the flows that will
3247 *                run on the ports using this environment, but what the user
3248 *                means TO DO with the PCD mechanisms in order to
3249 *                parse-classify-distribute those frames.
3250 *                By specifying a distinction unit, the user means it would use
3251 *                that option for distinction between frames at either a KeyGen
3252 *                scheme or a coarse classification action descriptor. Using
3253 *                interchangeable headers to define a unit means that the user
3254 *                is indifferent to which of the interchangeable headers is
3255 *                present in the frame, and wants the distinction to be based on
3256 *                the presence of either one of them.
3257 *
3258 *                Depending on context, there are limitations to the use of
3259 *                environments. A port using the PCD functionality is bound to
3260 *                an environment. Some or even all ports may share an
3261 *                environment but also an environment per port is possible. When
3262 *                initializing a scheme, a classification plan group (see
3263 *                below), or a coarse classification tree, one of the
3264 *                initialized environments must be stated and related to. When a
3265 *                port is bound to a scheme, a classification plan group, or a
3266 *                coarse classification tree, it MUST be bound to the same
3267 *                environment.
3268 *
3269 *                The different PCD modules, may relate (for flows definition)
3270 *                ONLY on distinction units as defined by their environment.
3271 *                When initializing a scheme for example, it may not choose to
3272 *                select IPV4 as a match for recognizing flows unless it was
3273 *                defined in the relating environment. In fact, to guide the
3274 *                user through the configuration of the PCD, each module's
3275 *                characterization in terms of flows is not done using protocol
3276 *                names, but using environment indexes.
3277 *
3278 *                In terms of HW implementation, the list of distinction units
3279 *                sets the LCV vectors and later used for match vector,
3280 *                classification plan vectors and coarse classification
3281 *                indexing.
3282 *
3283 * @Param[in,out] ioc_fm_pcd_net_env_params_t   A structure defining the
3284 *                                              distinction units for this
3285 *                                              configuration.
3286 *
3287 * @Return        0 on success; Error code otherwise.
3288 */
3289#define FM_PCD_IOC_NET_ENV_CHARACTERISTICS_SET \
3290                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(20), \
3291                      ioc_fm_pcd_net_env_params_t)
3292
3293/*
3294 * @Function      fm_pcd_net_env_characteristics_delete
3295 *
3296 * @Description   Deletes a set of Network Environment Charecteristics.
3297 *
3298 * @Param[in]     ioc_fm_obj_t          The id of a Network Environment object.
3299 *
3300 * @Return        0 on success; Error code otherwise.
3301 */
3302#define FM_PCD_IOC_NET_ENV_CHARACTERISTICS_DELETE \
3303                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(21), ioc_fm_obj_t)
3304
3305/*
3306 * @Function      fm_pcd_kg_scheme_set
3307 *
3308 * @Description   Initializing or modifying and enabling a scheme for the
3309 *                KeyGen. This routine should be called for adding or modifying
3310 *                a scheme. When a scheme needs modifying, the API requires that
3311 *                it will be rewritten. In such a case 'modify' should be TRUE.
3312 *                If the routine is called for a valid scheme and 'modify' is
3313 *                FALSE, it will return error.
3314 *
3315 * @Param[in,out] ioc_fm_pcd_kg_scheme_params_t         A structure of
3316 *                                                      parameters for defining
3317 *                                                      the scheme
3318 *
3319 * @Return        0 on success; Error code otherwise.
3320 */
3321#define FM_PCD_IOC_KG_SCHEME_SET \
3322                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(24), \
3323                      ioc_fm_pcd_kg_scheme_params_t)
3324
3325/*
3326 * @Function      fm_pcd_kg_scheme_delete
3327 *
3328 * @Description   Deleting an initialized scheme.
3329 *
3330 * @Param[in]     ioc_fm_obj_t  scheme id as initialized by application at
3331 *                              FM_PCD_IOC_KG_SET_SCHEME
3332 *
3333 * @Return        0 on success; Error code otherwise.
3334 */
3335#define FM_PCD_IOC_KG_SCHEME_DELETE \
3336                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(25), ioc_fm_obj_t)
3337
3338/*
3339 * @Function      fm_pcd_cc_root_build
3340 *
3341 * @Description   This routine must be called to define a complete coarse
3342 *                classification tree. This is the way to define coarse
3343 *                classification to a certain flow - the KeyGen schemes may
3344 *                point only to trees defined in this way.
3345 *
3346 * @Param[in,out] ioc_fm_pcd_cc_tree_params_t   A structure of parameters to
3347 *                                              define the tree.
3348 *
3349 * @Return        0 on success; Error code otherwise.
3350 */
3351#define FM_PCD_IOC_CC_ROOT_BUILD \
3352                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(26), void *)
3353                /* workaround ...*/
3354
3355/*
3356 * @Function      fm_pcd_cc_root_delete
3357 *
3358 * @Description   Deleting a built tree.
3359 *
3360 * @Param[in]     ioc_fm_obj_t - The id of a CC tree.
3361 */
3362#define FM_PCD_IOC_CC_ROOT_DELETE \
3363                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(27), ioc_fm_obj_t)
3364
3365/*
3366 * @Function      fm_pcd_match_table_set
3367 *
3368 * @Description   This routine should be called for each CC (coarse
3369 *                classification) node. The whole CC tree should be built bottom
3370 *                up so that each node points to already defined nodes. p_NodeId
3371 *                returns the node Id to be used by other nodes.
3372 *
3373 * @Param[in,out] ioc_fm_pcd_cc_node_params_t   A structure for defining the CC
3374 *                                              node params
3375 *
3376 * @Return        0 on success; Error code otherwise.
3377 */
3378#define FM_PCD_IOC_MATCH_TABLE_SET \
3379                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(28), void *)
3380                /* workaround ...*/
3381
3382/*
3383 * @Function      fm_pcd_match_table_delete
3384 *
3385 * @Description   Deleting a built node.
3386 *
3387 * @Param[in]     ioc_fm_obj_t - The id of a CC node.
3388 *
3389 * @Return        0 on success; Error code otherwise.
3390 */
3391#define FM_PCD_IOC_MATCH_TABLE_DELETE \
3392                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(29), ioc_fm_obj_t)
3393
3394/*
3395 * @Function      fm_pcd_cc_root_modify_next_engine
3396 *
3397 * @Description   Modify the Next Engine Parameters in the entry of the tree.
3398 *
3399 * @Param[in]     ioc_fm_pcd_cc_tree_modify_next_engine_params_t
3400 *                Pointer to a structure with the relevant parameters
3401 *
3402 * @Return        0 on success; Error code otherwise.
3403 *
3404 * @Cautions      Allowed only following fm_pcd_cc_root_build().
3405 */
3406#define FM_PCD_IOC_CC_ROOT_MODIFY_NEXT_ENGINE \
3407                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(30), \
3408                     ioc_fm_pcd_cc_tree_modify_next_engine_params_t)
3409
3410/*
3411 * @Function      fm_pcd_match_table_modify_next_engine
3412 *
3413 * @Description   Modify the Next Engine Parameters in the relevant key entry of
3414 *                the node.
3415 *
3416 * @Param[in]     ioc_fm_pcd_cc_node_modify_next_engine_params_t
3417 *                A pointer to a structure with the relevant parameters
3418 *
3419 * @Return        0 on success; Error code otherwise.
3420 *
3421 * @Cautions      Allowed only following fm_pcd_match_table_set().
3422 */
3423#define FM_PCD_IOC_MATCH_TABLE_MODIFY_NEXT_ENGINE \
3424                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(31), \
3425                     ioc_fm_pcd_cc_node_modify_next_engine_params_t)
3426
3427/*
3428 * @Function      fm_pcd_match_table_modify_miss_next_engine
3429 *
3430 * @Description   Modify the Next Engine Parameters of the Miss key case of the
3431 *                node.
3432 *
3433 * @Param[in]     ioc_fm_pcd_cc_node_modify_next_engine_params_t
3434 *                Pointer to a structure with the relevant parameters
3435 *
3436 * @Return        0 on success; Error code otherwise.
3437 *
3438 * @Cautions      Allowed only following fm_pcd_match_table_set().
3439 */
3440#define FM_PCD_IOC_MATCH_TABLE_MODIFY_MISS_NEXT_ENGINE \
3441                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(32), \
3442                     ioc_fm_pcd_cc_node_modify_next_engine_params_t)
3443
3444/*
3445 * @Function      fm_pcd_match_table_remove_key
3446 *
3447 * @Description   Remove the key (including next engine parameters of this key)
3448 *                defined by the index of the relevant node.
3449 *
3450 * @Param[in]     ioc_fm_pcd_cc_node_remove_key_params_t
3451 *                A pointer to a structure with the relevant parameters
3452 *
3453 * @Return        0 on success; Error code otherwise.
3454 *
3455 * @Cautions      Allowed only after fm_pcd_match_table_set() has been called
3456 *                for this node and for all of the nodes that lead to it.
3457 */
3458#define FM_PCD_IOC_MATCH_TABLE_REMOVE_KEY \
3459                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(33), \
3460                     ioc_fm_pcd_cc_node_remove_key_params_t)
3461
3462/*
3463 * @Function      fm_pcd_match_table_add_key
3464 *
3465 * @Description   Add the key (including next engine parameters of this key in
3466 *                the index defined by the key_index. Note that
3467 *                'FM_PCD_LAST_KEY_INDEX' may be used when the user don't care
3468 *                about the position of the key in the table - in that case, the
3469 *                key will be automatically added by the driver in the last
3470 *                available entry.
3471 *
3472 * @Param[in]     ioc_fm_pcd_cc_node_modify_key_and_next_engine_params_t
3473 *                A pointer to a structure with the relevant parameters
3474 *
3475 * @Return        0 on success; Error code otherwise.
3476 *
3477 * @Cautions      Allowed only after fm_pcd_match_table_set() has been called
3478 *                for this node and for all of the nodes that lead to it.
3479 */
3480#define FM_PCD_IOC_MATCH_TABLE_ADD_KEY \
3481                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(34), \
3482                     ioc_fm_pcd_cc_node_modify_key_and_next_engine_params_t)
3483
3484/*
3485 * @Function      fm_pcd_match_table_modify_key_and_next_engine
3486 *
3487 * @Description   Modify the key and Next Engine Parameters of this key in the
3488 *                index defined by key_index.
3489 *
3490 * @Param[in]     ioc_fm_pcd_cc_node_modify_key_and_next_engine_params_t
3491 *                A pointer to a structure with the relevant parameters
3492 *
3493 * @Return        0 on success; Error code otherwise.
3494 *
3495 * @Cautions      Allowed only following fm_pcd_match_table_set() not only of
3496 *                the relevnt node but also the node that points to this node.
3497 */
3498#define FM_PCD_IOC_MATCH_TABLE_MODIFY_KEY_AND_NEXT_ENGINE \
3499                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(35), \
3500                     ioc_fm_pcd_cc_node_modify_key_and_next_engine_params_t)
3501
3502/*
3503 * @Function      fm_pcd_match_table_modify_key
3504 *
3505 * @Description   Modify the key at the index defined by key_index.
3506 *
3507 * @Param[in]     ioc_fm_pcd_cc_node_modify_key_params_t - Pointer to a
3508 * structure with the relevant parameters
3509 *
3510 * @Return        0 on success; Error code otherwise.
3511 *
3512 * @Cautions      Allowed only after fm_pcd_match_table_set() has been called
3513 *                for this node and for all of the nodes that lead to it.
3514 */
3515#define FM_PCD_IOC_MATCH_TABLE_MODIFY_KEY \
3516                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(36), \
3517                     ioc_fm_pcd_cc_node_modify_key_params_t)
3518
3519/*
3520 * @Function      fm_pcd_hash_table_set
3521 *
3522 * @Description   This routine initializes a hash table structure.
3523 *                KeyGen hash result determines the hash bucket.
3524 *                Next, KeyGen key is compared against all keys of this bucket
3525 *                (exact match).
3526 *                Number of sets (number of buckets) of the hash equals to the
3527 *                number of 1-s in 'hash_res_mask' in the provided parameters.
3528 *                Number of hash table ways is then calculated by dividing
3529 *                'max_num_of_keys' equally between the hash sets. This is the
3530 *                maximal number of keys that a hash bucket may hold.
3531 *                The hash table is initialized empty and keys may be added to
3532 *                it following the initialization. Keys masks are not supported
3533 *                in current hash table implementation. The initialized hash
3534 *                table can be integrated as a node in a CC tree.
3535 *
3536 * @Param[in,out] ioc_fm_pcd_hash_table_params_t        Pointer to a structure
3537 *                                                      with the relevant
3538 *                                                      parameters.
3539 *
3540 * @Return        0 on success; Error code otherwise.
3541 */
3542#define FM_PCD_IOC_HASH_TABLE_SET \
3543                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(37), \
3544                      ioc_fm_pcd_hash_table_params_t)
3545
3546/*
3547 * @Function      fm_pcd_hash_table_delete
3548 *
3549 * @Description   This routine deletes the provided hash table and released all
3550 *                its allocated resources.
3551 *
3552 * @Param[in]     ioc_fm_obj_t          The ID of a hash table.
3553 *
3554 * @Return        0 on success; Error code otherwise.
3555 *
3556 * @Cautions    Allowed only following fm_pcd_hash_table_set().
3557 */
3558#define FM_PCD_IOC_HASH_TABLE_DELETE \
3559                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(37), ioc_fm_obj_t)
3560
3561/*
3562 * @Function      fm_pcd_hash_table_add_key
3563 *
3564 * @Description   This routine adds the provided key (including next engine
3565 *                parameters of this key) to the hash table.
3566 *                The key is added as the last key of the bucket that it is
3567 *                mapped to.
3568 *
3569 * @Param[in]     ioc_fm_pcd_hash_table_add_key_params_t
3570 *                Pointer to a structure with the relevant parameters
3571 *
3572 * @Return        0 on success; error code otherwise.
3573 *
3574 * @Cautions    Allowed only following fm_pcd_hash_table_set().
3575 */
3576#define FM_PCD_IOC_HASH_TABLE_ADD_KEY \
3577                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(39), \
3578                     ioc_fm_pcd_hash_table_add_key_params_t)
3579
3580/*
3581 * @Function      fm_pcd_hash_table_remove_key
3582 *
3583 * @Description   This routine removes the requested key (including next engine
3584 *                parameters of this key) from the hash table.
3585 *
3586 * @Param[in]     ioc_fm_pcd_hash_table_remove_key_params_t - Pointer to a
3587 *                structure with the relevant parameters
3588 *
3589 * @Return        0 on success; Error code otherwise.
3590 *
3591 * @Cautions      Allowed only following fm_pcd_hash_table_set().
3592 */
3593#define FM_PCD_IOC_HASH_TABLE_REMOVE_KEY \
3594                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(40), \
3595                     ioc_fm_pcd_hash_table_remove_key_params_t)
3596
3597/*
3598 * @Function      fm_pcd_plcr_profile_set
3599 *
3600 * @Description   Sets a profile entry in the policer profile table.
3601 *                The routine overrides any existing value.
3602 *
3603 * @Param[in,out] ioc_fm_pcd_plcr_profile_params_t      A structure of
3604 *                                                      parameters for defining
3605 *                                                      a policer profile entry.
3606 *
3607 * @Return        0 on success; Error code otherwise.
3608 */
3609#define FM_PCD_IOC_PLCR_PROFILE_SET \
3610                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(41), \
3611                      ioc_fm_pcd_plcr_profile_params_t)
3612
3613/*
3614 * @Function      fm_pcd_plcr_profile_delete
3615 *
3616 * @Description   Delete a profile entry in the policer profile table.
3617 *                The routine set entry to invalid.
3618 *
3619 * @Param[in]     ioc_fm_obj_t          The id of a policer profile.
3620 *
3621 * @Return        0 on success; Error code otherwise.
3622 */
3623#define FM_PCD_IOC_PLCR_PROFILE_DELETE  \
3624                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(41), ioc_fm_obj_t)
3625
3626/*
3627 * @Function      fm_pcd_manip_node_set
3628 *
3629 * @Description   This routine should be called for defining a manipulation
3630 *                node. A manipulation node must be defined before the CC node
3631 *                that precedes it.
3632 *
3633 * @Param[in]     ioc_fm_pcd_manip_params_t     A structure of parameters
3634 *                                              defining the manipulation.
3635 *
3636 * @Return        A handle to the initialized object on success; NULL code
3637 *                otherwise.
3638 */
3639#define FM_PCD_IOC_MANIP_NODE_SET \
3640                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(43), \
3641                      ioc_fm_pcd_manip_params_t)
3642
3643/*
3644 * @Function      fm_pcd_manip_node_replace
3645 *
3646 * @Description   Change existing manipulation node to be according to new
3647 *                requirement. (Here, it's implemented as a variant of the same
3648 *                IOCTL as for fm_pcd_manip_node_set(), and one that when
3649 *                called, the 'id' member in its 'ioc_fm_pcd_manip_params_t'
3650 *                argument is set to contain the manip node's handle)
3651 *
3652 * @Param[in]     ioc_fm_pcd_manip_params_t     A structure of parameters
3653 *                                              defining the manipulation.
3654 *
3655 * @Return        0 on success; error code otherwise.
3656 *
3657 * @Cautions      Allowed only following fm_pcd_manip_node_set().
3658 */
3659#define FM_PCD_IOC_MANIP_NODE_REPLACE   FM_PCD_IOC_MANIP_NODE_SET
3660
3661/*
3662 * @Function      fm_pcd_manip_node_delete
3663 *
3664 * @Description   Delete an existing manipulation node.
3665 *
3666 * @Param[in]     ioc_fm_obj_t  The id of the manipulation node to delete.
3667 *
3668 * @Return        0 on success; error code otherwise.
3669 *
3670 * @Cautions      Allowed only following fm_pcd_manip_node_set().
3671 */
3672#define FM_PCD_IOC_MANIP_NODE_DELETE \
3673                _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(44), ioc_fm_obj_t)
3674
3675/*
3676 * @Function      fm_pcd_manip_get_statistics
3677 *
3678 * @Description   Retrieve the manipulation statistics.
3679 *
3680 * @Param[in]     h_manip_node          A handle to a manipulation node.
3681 * @Param[out]    p_fm_pcd_manip_stats  A structure for retrieving the
3682 *                                      manipulation statistics.
3683 *
3684 * @Return      E_OK on success; Error code otherwise.
3685 *
3686 * @Cautions    Allowed only following fm_pcd_manip_node_set().
3687 */
3688#define FM_PCD_IOC_MANIP_GET_STATS \
3689                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(50), \
3690                      ioc_fm_pcd_manip_get_stats_t)
3691
3692/*
3693 * @Function      fm_pcd_set_advanced_offload_support
3694 *
3695 * @Description   This routine must be called in order to support the following
3696 *                features: IP-fragmentation, IP-reassembly, IPsec,
3697 *                Header-manipulation, frame-replicator.
3698 *
3699 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
3700 *
3701 * @Return        0 on success; error code otherwise.
3702 *
3703 * @Cautions      Allowed only when PCD is disabled.
3704 */
3705#define FM_PCD_IOC_SET_ADVANCED_OFFLOAD_SUPPORT \
3706                _IO(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(45))
3707
3708/*
3709 * @Function      fm_pcd_frm_replic_set_group
3710 *
3711 * @Description   Initialize a Frame Replicator group.
3712 *
3713 * @Param[in]     h_fm_pcd                      FM PCD module descriptor.
3714 * @Param[in]     p_frm_replic_group_param      A structure of parameters for
3715 *                                              the initialization of the frame
3716 *                                              replicator group.
3717 *
3718 * @Return        A handle to the initialized object on success; NULL code
3719 *                otherwise.
3720 *
3721 * @Cautions      Allowed only following fm_pcd_init().
3722 */
3723#define FM_PCD_IOC_FRM_REPLIC_GROUP_SET \
3724                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(46), \
3725                      ioc_fm_pcd_frm_replic_group_params_t)
3726
3727/*
3728 * @Function      fm_pcd_frm_replic_delete_group
3729 *
3730 * @Description   Delete a Frame Replicator group.
3731 *
3732 * @Param[in]     h_frm_replic_group  A handle to the frame replicator group.
3733 *
3734 * @Return        E_OK on success;  Error code otherwise.
3735 *
3736 * @Cautions      Allowed only following fm_pcd_frm_replic_set_group().
3737 */
3738#define FM_PCD_IOC_FRM_REPLIC_GROUP_DELETE \
3739                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(47), ioc_fm_obj_t)
3740
3741/*
3742 * @Function      fm_pcd_frm_replic_add_member
3743 *
3744 * @Description   Add the member in the index defined by the member_index.
3745 *
3746 * @Param[in]     h_frm_replic_group    A handle to the frame replicator group.
3747 * @Param[in]     member_index          Member index for adding.
3748 * @Param[in]     p_member_params       A pointer to the new member parameters.
3749 *
3750 * @Return        E_OK on success; Error code otherwise.
3751 *
3752 * @Cautions      Allowed only following fm_pcd_frm_replic_set_group() of this
3753 *                group.
3754 */
3755#define FM_PCD_IOC_FRM_REPLIC_MEMBER_ADD \
3756                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(48), \
3757                        ioc_fm_pcd_frm_replic_member_params_t)
3758
3759/*
3760 * @Function      fm_pcd_frm_replic_remove_member
3761 *
3762 * @Description   Remove the member defined by the index from the relevant group
3763 *
3764 * @Param[in]     h_frm_replic_group    A handle to the frame replicator group.
3765 * @Param[in]     member_index          Member index for removing.
3766 *
3767 * @Return        E_OK on success; Error code otherwise.
3768 *
3769 * @Cautions      Allowed only following fm_pcd_frm_replic_set_group() of this
3770 *                group.
3771 */
3772#define FM_PCD_IOC_FRM_REPLIC_MEMBER_REMOVE \
3773                _IOWR(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(49), \
3774                      ioc_fm_pcd_frm_replic_member_t)
3775
3776/*
3777 * @Group         FM_grp Frame Manager API
3778 *
3779 * @Description   Frame Manager Application Programming Interface
3780 *
3781 * @{
3782 */
3783
3784/*
3785 * @Group         FM_PCD_grp FM PCD
3786 *
3787 * @Description   Frame Manager PCD (Parse-Classify-Distribute) API.
3788 *
3789 *                The FM PCD module is responsible for the initialization of all
3790 *                global classifying FM modules. This includes the parser
3791 *                general and common registers, the key generator global and
3792 *                common registers, and the policer global and common registers.
3793 *                In addition, the FM PCD SW module will initialize all required
3794 *                key generator schemes, coarse classification flows, and
3795 *                policer profiles. When FM module is configured to work with
3796 *                one of these entities, it will register to it using the FM
3797 *                PORT API. The PCD module will manage the PCD resources - i.e.
3798 *                resource management of KeyGen schemes, etc.
3799 *
3800 * @{
3801 */
3802
3803/*
3804 * @Collection    General PCD defines
3805 */
3806#define FM_PCD_MAX_NUM_OF_PRIVATE_HDRS          2
3807/**< Number of units/headers saved for user */
3808
3809#define FM_PCD_PRS_NUM_OF_HDRS                  16
3810/**< Number of headers supported by HW parser */
3811#define FM_PCD_MAX_NUM_OF_DISTINCTION_UNITS \
3812                (32 - FM_PCD_MAX_NUM_OF_PRIVATE_HDRS)
3813/**< Number of distinction units is limited by register size (32 bits) minus
3814 *reserved bits for private headers.
3815 */
3816#define FM_PCD_MAX_NUM_OF_INTERCHANGEABLE_HDRS  4
3817/**< Maximum number of interchangeable headers in a distinction unit */
3818#define FM_PCD_KG_NUM_OF_GENERIC_REGS           FM_KG_NUM_OF_GENERIC_REGS
3819/**< Total number of generic KeyGen registers */
3820#define FM_PCD_KG_MAX_NUM_OF_EXTRACTS_PER_KEY   35
3821/**< Max number allowed on any configuration; For HW implementation reasons, in
3822 * most cases less than this will be allowed; The driver will return an
3823 * initialization error if resource is unavailable.
3824 */
3825#define FM_PCD_KG_NUM_OF_EXTRACT_MASKS          4
3826/**< Total number of masks allowed on KeyGen extractions. */
3827#define FM_PCD_KG_NUM_OF_DEFAULT_GROUPS         16
3828/**< Number of default value logical groups */
3829
3830#define FM_PCD_PRS_NUM_OF_LABELS                        32
3831/**< Maximum number of SW parser labels */
3832#define FM_SW_PRS_MAX_IMAGE_SIZE \
3833        (FM_PCD_SW_PRS_SIZE \
3834         /*- FM_PCD_PRS_SW_OFFSET -FM_PCD_PRS_SW_TAIL_SIZE*/ \
3835         - FM_PCD_PRS_SW_PATCHES_SIZE)
3836/**< Maximum size of SW parser code */
3837
3838#define FM_PCD_MAX_MANIP_INSRT_TEMPLATE_SIZE    128
3839/**< Maximum size of insertion template for insert manipulation */
3840
3841#define FM_PCD_FRM_REPLIC_MAX_NUM_OF_ENTRIES    64
3842/**< Maximum possible entries for frame replicator group */
3843/* @} */
3844
3845/*
3846 * @Group         FM_PCD_init_grp FM PCD Initialization Unit
3847 *
3848 * @Description   Frame Manager PCD Initialization Unit API
3849 *
3850 * @{
3851 */
3852
3853/*
3854 * @Description   Exceptions user callback routine, will be called upon an
3855 *                exception passing the exception identification.
3856 *
3857 * @Param[in]     h_app         User's application descriptor.
3858 * @Param[in]     exception     The exception.
3859 */
3860typedef void (t_fm_pcd_exception_callback) (t_handle h_app,
3861                                        ioc_fm_pcd_exceptions exception);
3862
3863/*
3864 * @Description   Exceptions user callback routine, will be called upon an
3865 *                exception passing the exception identification.
3866 *
3867 * @Param[in]     h_app         User's application descriptor.
3868 * @Param[in]     exception     The exception.
3869 * @Param[in]     index         id of the relevant source (may be scheme or
3870 *                              profile id).
3871 */
3872typedef void (t_fm_pcd_id_exception_callback) (t_handle h_app,
3873                                        ioc_fm_pcd_exceptions  exception,
3874                                        uint16_t        index);
3875
3876/*
3877 * @Description   A callback for enqueuing frame onto a QM queue.
3878 *
3879 * @Param[in]     h_qm_arg      Application's handle passed to QM module on
3880 *                              enqueue.
3881 * @Param[in]     p_fd          Frame descriptor for the frame.
3882 *
3883 * @Return        E_OK on success; Error code otherwise.
3884 */
3885typedef uint32_t (t_fm_pcd_qm_enqueue_callback) (t_handle h_qm_arg, void *p_fd);
3886
3887/*
3888 * @Description   Host-Command parameters structure.
3889 *
3890 *                When using Host command for PCD functionalities, a dedicated
3891 *                port must be used. If this routine is called for a PCD in a
3892 *                single partition environment, or it is the Master partition in
3893 *                a Multi-partition environment, The port will be initialized by
3894 *                the PCD driver initialization routine.
3895 */
3896typedef struct t_fm_pcd_hc_params {
3897        uintptr_t               port_base_addr;
3898        /**< Virtual Address of Host-Command Port memory mapped registers.*/
3899        uint8_t                 port_id;
3900        /**< Port Id (0-6 relative to Host-Command/Offline-Parsing ports);
3901         * NOTE: When configuring Host Command port for FMANv3 devices
3902         * (DPAA_VERSION 11 and higher), port_id=0 MUST be used.
3903         */
3904        uint16_t                        liodn_base;
3905        /**< LIODN base for this port, to be used together with LIODN offset
3906         * (irrelevant for P4080 revision 1.0)
3907         */
3908        uint32_t                        err_fqid;
3909        /**< Host-Command Port error queue Id. */
3910        uint32_t                        conf_fqid;
3911        /**< Host-Command Port confirmation queue Id. */
3912        uint32_t                        qm_channel;
3913        /**< QM channel dedicated to this Host-Command port; will be used by the
3914         * FM for dequeue.
3915         */
3916        t_fm_pcd_qm_enqueue_callback    *f_qm_enqueue;
3917        /**< Callback routine for enqueuing a frame to the QM */
3918        t_handle                        h_qm_arg;
3919        /**< Application's handle passed to QM module on enqueue */
3920} t_fm_pcd_hc_params;
3921
3922/*
3923 * @Description   The main structure for PCD initialization
3924 */
3925typedef struct t_fm_pcd_params {
3926        bool                    prs_support;
3927        /**< TRUE if Parser will be used for any of the FM ports. */
3928        bool                    cc_support;
3929        /**< TRUE if Coarse Classification will be used for any of the FM ports.
3930         */
3931        bool                    kg_support;
3932        /**< TRUE if KeyGen will be used for any of the FM ports. */
3933        bool                    plcr_support;
3934        /**< TRUE if Policer will be used for any of the FM ports. */
3935        t_handle                h_fm;
3936        /**< A handle to the FM module. */
3937        uint8_t                 num_schemes;
3938        /**< Number of schemes dedicated to this partition.
3939         * this parameter is relevant if 'kg_support'=TRUE.
3940         */
3941        bool                    use_host_command;
3942        /**< Optional for single partition, Mandatory for Multi partition */
3943        t_fm_pcd_hc_params              hc;
3944        /**< Host Command parameters, relevant only if 'use_host_command'=TRUE;
3945         * Relevant when FM not runs in "guest-mode".
3946         */
3947        t_fm_pcd_exception_callback     *f_exception;
3948        /**< Callback routine for general PCD exceptions; Relevant when FM not
3949         * runs in "guest-mode".
3950         */
3951        t_fm_pcd_id_exception_callback  *f_exception_id;
3952        /**< Callback routine for specific KeyGen scheme or Policer profile
3953         * exceptions; Relevant when FM not runs in "guest-mode".
3954         */
3955        t_handle                h_app;
3956        /**< A handle to an application layer object; This handle will be passed
3957         * by the driver upon calling the above callbacks; Relevant when FM not
3958         * runs in "guest-mode".
3959         */
3960        uint8_t                 part_plcr_profiles_base;
3961        /**< The first policer-profile-id dedicated to this partition. this
3962         * parameter is relevant if 'plcr_support'=TRUE. NOTE: this parameter
3963         * relevant only when working with multiple partitions.
3964         */
3965        uint16_t                part_num_of_plcr_profiles;
3966        /**< Number of policer-profiles dedicated to this partition. This
3967         * parameter is relevant if 'plcr_support'=TRUE. NOTE: this parameter
3968         * relevant only when working with multiple partitions.
3969         */
3970} t_fm_pcd_params;
3971
3972typedef struct t_fm_pcd_prs_label_params {
3973        uint32_t instruction_offset;
3974        ioc_net_header_type hdr;
3975        uint8_t index_per_hdr;
3976} t_fm_pcd_prs_label_params;
3977
3978typedef struct t_fm_pcd_prs_sw_params {
3979        bool override;
3980        uint32_t size;
3981        uint16_t base;
3982        uint8_t *p_code;
3983        uint32_t sw_prs_data_params[FM_PCD_PRS_NUM_OF_HDRS];
3984        uint8_t num_of_labels;
3985        t_fm_pcd_prs_label_params labels_table[FM_PCD_PRS_NUM_OF_LABELS];
3986} t_fm_pcd_prs_sw_params;
3987
3988/*
3989 * @Function      fm_pcd_config
3990 *
3991 * @Description   Basic configuration of the PCD module.
3992 *                Creates descriptor for the FM PCD module.
3993 *
3994 * @Param[in]     p_fm_pcd_params       A structure of parameters for the
3995                                        initialization of PCD.
3996 *
3997 * @Return        A handle to the initialized module.
3998 */
3999t_handle fm_pcd_config(t_fm_pcd_params *p_fm_pcd_params);
4000
4001/*
4002 * @Function      fm_pcd_init
4003 *
4004 * @Description   Initialization of the PCD module.
4005 *
4006 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4007 *
4008 * @Return        E_OK on success; Error code otherwise.
4009 */
4010uint32_t fm_pcd_init(t_handle h_fm_pcd);
4011
4012/*
4013 * @Function      fm_pcd_free
4014 *
4015 * @Description   Frees all resources that were assigned to FM module.
4016 *                Calling this routine invalidates the descriptor.
4017 *
4018 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4019 *
4020 * @Return        E_OK on success; Error code otherwise.
4021 */
4022uint32_t fm_pcd_free(t_handle h_fm_pcd);
4023
4024/*
4025 * @Group         FM_PCD_advanced_cfg_grp       FM PCD Advanced Configuration
4026 *                                              Unit
4027 *
4028 * @Description   Frame Manager PCD Advanced Configuration API.
4029 *
4030 * @{
4031 */
4032
4033/*
4034 * @Function      fm_pcd_config_exception
4035 *
4036 * @Description   Calling this routine changes the internal driver data base
4037 *                from its default selection of exceptions enabling.
4038 *                [DEFAULT_num_of_shared_plcr_profiles].
4039 *
4040 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4041 * @Param[in]     exception     The exception to be selected.
4042 * @Param[in]     enable        TRUE to enable interrupt, FALSE to mask it.
4043 *
4044 * @Return        E_OK on success; Error code otherwise.
4045 *
4046 * @Cautions      This routine should NOT be called from guest-partition (i.e.
4047 *                guestId != NCSW_PRIMARY_ID)
4048 */
4049uint32_t fm_pcd_config_exception(t_handle h_fm_pcd,
4050                ioc_fm_pcd_exceptions exception, bool enable);
4051
4052/*
4053 * @Function      fm_pcd_config_hc_frames_data_memory
4054 *
4055 * @Description   Configures memory-partition-id for FMan-Controller
4056 *                Host-Command frames. Calling this routine changes the internal
4057 *                driver data base from its default configuration [0].
4058 *
4059 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4060 * @Param[in]     mem_id        Memory partition ID.
4061 *
4062 * @Return        E_OK on success; Error code otherwise.
4063 *
4064 * @Cautions      This routine may be called only if 'use_host_command' was TRUE
4065 *                when fm_pcd_config() routine was called.
4066 */
4067uint32_t fm_pcd_config_hc_frames_data_memory(t_handle h_fm_pcd, uint8_t mem_id);
4068
4069/*
4070 * @Function      fm_pcd_config_plcr_num_of_shared_profiles
4071 *
4072 * @Description   Calling this routine changes the internal driver data base
4073 *                from its default selection of exceptions enablement.
4074 *                [DEFAULT_num_of_shared_plcr_profiles].
4075 *
4076 * @Param[in]     h_fm_pcd                      FM PCD module descriptor.
4077 * @Param[in]     num_of_shared_plcr_profiles   Number of profiles to be shared
4078 *                                              between ports on this partition
4079 *
4080 * @Return        E_OK on success; Error code otherwise.
4081 */
4082uint32_t fm_pcd_config_plcr_num_of_shared_profiles(t_handle h_fm_pcd,
4083                uint16_t num_of_shared_plcr_profiles);
4084
4085/*
4086 * @Function      fm_pcd_config_plcr_auto_refresh_mode
4087 *
4088 * @Description   Calling this routine changes the internal driver data base
4089 *                from its default selection of exceptions enablement. By
4090 *                default auto-refresh is [DEFAULT_plcrAutoRefresh].
4091 *
4092 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4093 * @Param[in]     enable        TRUE to enable, FALSE to disable
4094 *
4095 * @Return        E_OK on success; Error code otherwise.
4096 *
4097 * @Cautions      This routine should NOT be called from guest-partition
4098 *                (i.e. guestId != NCSW_PRIMARY_ID)
4099 */
4100uint32_t fm_pcd_config_plcr_auto_refresh_mode(t_handle h_fm_pcd, bool enable);
4101
4102/*
4103 * @Function      fm_pcd_config_prs_max_cycle_limit
4104 *
4105 * @Description   Calling this routine changes the internal data structure for
4106 *                the maximum parsing time from its default value
4107 *                [DEFAULT_MAX_PRS_CYC_LIM].
4108 *
4109 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4110 * @Param[in]     value         0 to disable the mechanism, or new maximum
4111 *                              parsing time.
4112 *
4113 * @Return        E_OK on success; Error code otherwise.
4114 *
4115 * @Cautions      This routine should NOT be called from guest-partition
4116 *                (i.e. guestId != NCSW_PRIMARY_ID)
4117 */
4118uint32_t fm_pcd_config_prs_max_cycle_limit(t_handle h_fm_pcd, uint16_t value);
4119
4120/** @} */ /* end of FM_PCD_advanced_cfg_grp group */
4121/** @} */ /* end of FM_PCD_init_grp group */
4122
4123/*
4124 * @Group         FM_PCD_Runtime_grp FM PCD Runtime Unit
4125 *
4126 * @Description   Frame Manager PCD Runtime Unit API
4127 *
4128 *                The runtime control allows creation of PCD infrastructure
4129 *                modules such as Network Environment Characteristics,
4130 *                Classification Plan Groups and Coarse Classification Trees.
4131 *                It also allows on-the-fly initialization, modification and
4132 *                removal of PCD modules such as KeyGen schemes, coarse
4133 *                classification nodes and Policer profiles.
4134 *
4135 *                In order to explain the programming model of the PCD driver
4136 *                interface a few terms should be explained, and will be used
4137 *                below.
4138 *                - Distinction Header - One of the 16 protocols supported by
4139 *                  the FM parser, or one of the SHIM headers (1 or 2). May be a
4140 *                  header with a special option (see below).
4141 *                - Interchangeable Headers Group - This is a group of Headers
4142 *                  recognized by either one of them. For example, if in a
4143 *                  specific context the user chooses to treat IPv4 and IPV6 in
4144 *                  the same way, they may create an interchangeable Headers
4145 *                  Unit consisting of these 2 headers.
4146 *                - A Distinction Unit - a Distinction Header or an
4147 *                  Interchangeable Headers Group.
4148 *                - Header with special option - applies to Ethernet, MPLS,
4149 *                  VLAN, IPv4 and IPv6, includes multicast, broadcast and other
4150 *                  protocol specific options. In terms of hardware it relates
4151 *                  to the options available in the classification plan.
4152 *                - Network Environment Characteristics - a set of Distinction
4153 *                  Units that define the total recognizable header selection
4154 *                  for a certain environment. This is NOT the list of all
4155 *                  headers that will ever appear in a flow, but rather
4156 *                  everything that needs distinction in a flow, where
4157 *                  distinction is made by KeyGen schemes and coarse
4158 *                  classification action descriptors.
4159 *
4160 *                The PCD runtime modules initialization is done in stages. The
4161 *                first stage after initializing the PCD module itself is to
4162 *                establish a Network Flows Environment Definition. The
4163 *                application may choose to establish one or more such
4164 *                environments. Later, when needed, the application will have to
4165 *                state, for some of its modules, to which single environment it
4166 *                belongs.
4167 *
4168 * @{
4169 */
4170
4171t_handle fm_pcd_open(t_fm_pcd_params *p_fm_pcd_params);
4172void fm_pcd_close(t_handle h_fm_pcd);
4173
4174/*
4175 * @Function      fm_pcd_enable
4176 *
4177 * @Description   This routine should be called after PCD is initialized for
4178 *                enabling all PCD engines according to their existing
4179 *                configuration.
4180 *
4181 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4182 *
4183 * @Return        E_OK on success; Error code otherwise.
4184 *
4185 * @Cautions      Allowed only following fm_pcd_init() and when PCD is disabled.
4186 */
4187uint32_t fm_pcd_enable(t_handle h_fm_pcd);
4188
4189/*
4190 * @Function      fm_pcd_disable
4191 *
4192 * @Description   This routine may be called when PCD is enabled in order to
4193 *                disable all PCD engines. It may be called only when none of
4194 *                the ports in the system are using the PCD.
4195 *
4196 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4197 *
4198 * @Return        E_OK on success; Error code otherwise.
4199 *
4200 * @Cautions      Allowed only following fm_pcd_init() and when PCD is enabled.
4201 */
4202uint32_t fm_pcd_disable(t_handle h_fm_pcd);
4203
4204/*
4205 * @Function      fm_pcd_get_counter
4206 *
4207 * @Description   Reads one of the FM PCD counters.
4208 *
4209 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4210 * @Param[in]     counter       The requested counter.
4211 *
4212 * @Return        Counter's current value.
4213 *
4214 * @Cautions      Allowed only following fm_pcd_init().
4215 *                Note that it is user's responsibility to call this routine
4216 *                only for enabled counters, and there will be no indication if
4217 *                a disabled counter is accessed.
4218 */
4219uint32_t fm_pcd_get_counter(t_handle h_fm_pcd, ioc_fm_pcd_counters counter);
4220
4221/*
4222 * @Function    fm_pcd_prs_load_sw
4223 *
4224 * @Description This routine may be called in order to load software parsing
4225 *              code.
4226 *
4227 * @Param[in]   h_fm_pcd        FM PCD module descriptor.
4228 * @Param[in]   p_sw_prs        A pointer to a structure of software
4229 *                              parser parameters, including the software
4230 *                              parser image.
4231 *
4232 * @Return      E_OK on success; Error code otherwise.
4233 *
4234 * @Cautions    Allowed only following fm_pcd_init() and when PCD is disabled.
4235 *              This routine should NOT be called from guest-partition
4236 *              (i.e. guestId != NCSW_PRIMARY_ID)
4237 */
4238uint32_t fm_pcd_prs_load_sw(t_handle h_fm_pcd,
4239                ioc_fm_pcd_prs_sw_params_t *p_sw_prs);
4240
4241/*
4242 * @Function      fm_pcd_set_advanced_offload_support
4243 *
4244 * @Description   This routine must be called in order to support the following
4245 *                features: IP-fragmentation, IP-reassembly, IPsec,
4246 *                Header-manipulation, frame-replicator.
4247 *
4248 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4249 *
4250 * @Return        E_OK on success; Error code otherwise.
4251 *
4252 * @Cautions      Allowed only following fm_pcd_init() and when PCD is disabled.
4253 *                This routine should NOT be called from guest-partition
4254 *                (i.e. guestId != NCSW_PRIMARY_ID)
4255 */
4256uint32_t fm_pcd_set_advanced_offload_support(t_handle h_fm_pcd);
4257
4258/*
4259 * @Function      fm_pcd_kg_set_dflt_value
4260 *
4261 * @Description   Calling this routine sets a global default value to be used
4262 *                by the KeyGen when parser does not recognize a required
4263 *                field/header.
4264 *                default value is 0.
4265 *
4266 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4267 * @Param[in]     value_id      0,1 - one of 2 global default values.
4268 * @Param[in]     value         The requested default value.
4269 *
4270 * @Return        E_OK on success; Error code otherwise.
4271 *
4272 * @Cautions      Allowed only following fm_pcd_init() and when PCD is disabled.
4273 *                This routine should NOT be called from guest-partition
4274 *                (i.e. guestId != NCSW_PRIMARY_ID)
4275 */
4276uint32_t fm_pcd_kg_set_dflt_value(t_handle h_fm_pcd,
4277                uint8_t value_id, uint32_t value);
4278
4279/*
4280 * @Function      fm_pcd_kg_set_additional_data_after_parsing
4281 *
4282 * @Description   Calling this routine allows the KeyGen to access data past
4283 *                the parser finishing point.
4284 *
4285 * @Param[in]     h_fm_pcd              FM PCD module descriptor.
4286 * @Param[in]     payload_offset        the number of bytes beyond the parser
4287 *                                      location.
4288 *
4289 * @Return        E_OK on success; Error code otherwise.
4290 *
4291 * @Cautions      Allowed only following fm_pcd_init() and when PCD is disabled.
4292 *                This routine should NOT be called from guest-partition (i.e.
4293 *                guestId != NCSW_PRIMARY_ID)
4294 */
4295uint32_t fm_pcd_kg_set_additional_data_after_parsing(t_handle h_fm_pcd,
4296                uint8_t payload_offset);
4297
4298/*
4299 * @Function      fm_pcd_set_exception
4300 *
4301 * @Description   Calling this routine enables/disables PCD interrupts.
4302 *
4303 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4304 * @Param[in]     exception     The exception to be selected.
4305 * @Param[in]     enable        TRUE to enable interrupt, FALSE to mask it.
4306 *
4307 * @Return        E_OK on success; Error code otherwise.
4308 *
4309 * @Cautions      Allowed only following fm_pcd_init().
4310 *                This routine should NOT be called from guest-partition
4311 *                (i.e. guestId != NCSW_PRIMARY_ID)
4312 */
4313uint32_t fm_pcd_set_exception(t_handle h_fm_pcd,
4314                ioc_fm_pcd_exceptions exception, bool enable);
4315
4316/*
4317 * @Function      fm_pcd_modify_counter
4318 *
4319 * @Description   Sets a value to an enabled counter. Use "0" to reset the
4320 *                counter.
4321 *
4322 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4323 * @Param[in]     counter       The requested counter.
4324 * @Param[in]     value         The requested value to be written into the
4325 *                              counter.
4326 *
4327 * @Return      E_OK on success; Error code otherwise.
4328 *
4329 * @Cautions    Allowed only following fm_pcd_init().
4330 *              This routine should NOT be called from guest-partition
4331 *              (i.e. guestId != NCSW_PRIMARY_ID)
4332 */
4333uint32_t fm_pcd_modify_counter(t_handle h_fm_pcd,
4334                ioc_fm_pcd_counters counter, uint32_t value);
4335
4336/*
4337 * @Function      fm_pcd_set_plcr_statistics
4338 *
4339 * @Description   This routine may be used to enable/disable policer statistics
4340 *                counter. By default the statistics is enabled.
4341 *
4342 * @Param[in]     h_fm_pcd      FM PCD module descriptor
4343 * @Param[in]     enable        TRUE to enable, FALSE to disable.
4344 *
4345 * @Return        E_OK on success; Error code otherwise.
4346 *
4347 * @Cautions      Allowed only following fm_pcd_init().
4348 *                This routine should NOT be called from guest-partition
4349 *                (i.e. guestId != NCSW_PRIMARY_ID)
4350 */
4351uint32_t fm_pcd_set_plcr_statistics(t_handle h_fm_pcd, bool enable);
4352
4353/*
4354 * @Function      fm_pcd_set_prs_statistics
4355 *
4356 * @Description   Defines whether to gather parser statistics including all
4357 *                ports.
4358 *
4359 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4360 * @Param[in]     enable        TRUE to enable, FALSE to disable.
4361 *
4362 * @Return        None
4363 *
4364 * @Cautions      Allowed only following fm_pcd_init().
4365 *                This routine should NOT be called from guest-partition
4366 *                (i.e. guestId != NCSW_PRIMARY_ID)
4367 */
4368void fm_pcd_set_prs_statistics(t_handle h_fm_pcd, bool enable);
4369
4370#if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
4371/*
4372 * @Function      fm_pcd_dump_regs
4373 *
4374 * @Description   Dumps all PCD registers
4375 *
4376 * @Param[in]     h_fm_pcd      A handle to an FM PCD Module.
4377 *
4378 * @Return        E_OK on success; Error code otherwise.
4379 *
4380 * @Cautions      Allowed only following fm_pcd_init().
4381 *                NOTE: this routine may be called only for FM in master mode
4382 *                (i.e. 'guestId'=NCSW_PRIMARY_ID) or in a case that the
4383 *                registers are mapped.
4384 */
4385uint32_t fm_pcd_dump_regs(t_handle h_fm_pcd);
4386
4387/*
4388 * @Function      fm_pcd_kg_dump_regs
4389 *
4390 * @Description   Dumps all PCD KG registers
4391 *
4392 * @Param[in]     h_fm_pcd      A handle to an FM PCD Module.
4393 *
4394 * @Return        E_OK on success; Error code otherwise.
4395 *
4396 * @Cautions      Allowed only following fm_pcd_init().
4397 *                NOTE: this routine may be called only for FM in master mode
4398 *                (i.e. 'guestId'=NCSW_PRIMARY_ID) or in a case that the
4399 *                registers are mapped.
4400 */
4401uint32_t fm_pcd_kg_dump_regs(t_handle h_fm_pcd);
4402
4403/*
4404 * @Function      fm_pcd_plcr_dump_regs
4405 *
4406 * @Description   Dumps all PCD Policer registers
4407 *
4408 * @Param[in]     h_fm_pcd      A handle to an FM PCD Module.
4409 *
4410 * @Return        E_OK on success; Error code otherwise.
4411 *
4412 * @Cautions      Allowed only following fm_pcd_init().
4413 *                NOTE: this routine may be called only for FM in master mode
4414 *                (i.e. 'guestId'=NCSW_PRIMARY_ID) or in a case that the
4415 *                registers are mapped.
4416 */
4417uint32_t fm_pcd_plcr_dump_regs(t_handle h_fm_pcd);
4418
4419/*
4420 * @Function      fm_pcd_plcr_profile_dump_regs
4421 *
4422 * @Description   Dumps all PCD Policer profile registers
4423 *
4424 * @Param[in]     h_profile     A handle to a Policer profile.
4425 *
4426 * @Return        E_OK on success; Error code otherwise.
4427 *
4428 * @Cautions      Allowed only following fm_pcd_init().
4429 *                NOTE: this routine may be called only for FM in master mode
4430 *                (i.e. 'guestId'=NCSW_PRIMARY_ID) or in a case that the
4431 *                registers are mapped.
4432 */
4433uint32_t fm_pcd_plcr_profile_dump_regs(t_handle h_profile);
4434
4435/*
4436 * @Function      fm_pcd_prs_dump_regs
4437 *
4438 * @Description   Dumps all PCD Parser registers
4439 *
4440 * @Param[in]     h_fm_pcd      A handle to an FM PCD Module.
4441 *
4442 * @Return        E_OK on success; Error code otherwise.
4443 *
4444 * @Cautions      Allowed only following fm_pcd_init().
4445 *                NOTE: this routine may be called only for FM in master mode
4446 *                (i.e. 'guestId'=NCSW_PRIMARY_ID) or in a case that the
4447 *                registers are mapped.
4448 */
4449uint32_t fm_pcd_prs_dump_regs(t_handle h_fm_pcd);
4450
4451/*
4452 * @Function      fm_pcd_hc_dump_regs
4453 *
4454 * @Description   Dumps HC Port registers
4455 *
4456 * @Param[in]     h_fm_pcd      A handle to an FM PCD Module.
4457 *
4458 * @Return        E_OK on success; Error code otherwise.
4459 *
4460 * @Cautions      Allowed only following fm_pcd_init().
4461 *                NOTE: this routine may be called only for FM in master mode
4462 *                (i.e. 'guestId'=NCSW_PRIMARY_ID).
4463 */
4464uint32_t        fm_pcd_hc_dump_regs(t_handle h_fm_pcd);
4465#endif /* (defined(DEBUG_ERRORS) && ... */
4466
4467
4468/*
4469 * KeyGen         FM_PCD_Runtime_build_grp FM PCD Runtime Building Unit
4470 *
4471 * @Description   Frame Manager PCD Runtime Building API
4472 *
4473 *                This group contains routines for setting, deleting and
4474 *                modifying PCD resources, for defining the total PCD tree.
4475 * @{
4476 */
4477
4478/*
4479 * @Collection    Definitions of coarse classification
4480 *                parameters as required by KeyGen (when coarse classification
4481 *                is the next engine after this scheme).
4482 */
4483#define FM_PCD_MAX_NUM_OF_CC_TREES              8
4484#define FM_PCD_MAX_NUM_OF_CC_GROUPS             16
4485#define FM_PCD_MAX_NUM_OF_CC_UNITS              4
4486#define FM_PCD_MAX_NUM_OF_KEYS          256
4487#define FM_PCD_MAX_NUM_OF_FLOWS         (4 * KILOBYTE)
4488#define FM_PCD_MAX_SIZE_OF_KEY          56
4489#define FM_PCD_MAX_NUM_OF_CC_ENTRIES_IN_GRP     16
4490#define FM_PCD_LAST_KEY_INDEX           0xffff
4491
4492#define FM_PCD_MAX_NUM_OF_CC_NODES      255
4493                        /* Obsolete, not used - will be removed in the future */
4494/* @} */
4495
4496/*
4497 * @Collection    A set of definitions to allow protocol
4498 *                special option description.
4499 */
4500typedef uint32_t        protocol_opt_t;
4501                        /**< A general type to define a protocol option. */
4502
4503typedef protocol_opt_t   eth_protocol_opt_t;
4504                        /**< Ethernet protocol options. */
4505#define ETH_BROADCAST           0x80000000  /**< Ethernet Broadcast. */
4506#define ETH_MULTICAST           0x40000000  /**< Ethernet Multicast. */
4507
4508typedef protocol_opt_t   vlan_protocol_opt_t;   /**< VLAN protocol options. */
4509#define VLAN_STACKED            0x20000000  /**< Stacked VLAN. */
4510
4511typedef protocol_opt_t   mpls_protocol_opt_t;   /**< MPLS protocol options. */
4512#define MPLS_STACKED            0x10000000  /**< Stacked MPLS. */
4513
4514typedef protocol_opt_t   ipv_4protocol_opt_t;   /**< IPv4 protocol options. */
4515#define IPV4_BROADCAST_1                0x08000000  /**< IPv4 Broadcast. */
4516#define IPV4_MULTICAST_1                0x04000000  /**< IPv4 Multicast. */
4517#define IPV4_UNICAST_2          0x02000000  /**< Tunneled IPv4 - Unicast. */
4518#define IPV4_MULTICAST_BROADCAST_2  0x01000000
4519                                /**< Tunneled IPv4 - Broadcast/Multicast. */
4520
4521#define IPV4_FRAG_1             0x00000008
4522                                /**< IPV4 reassembly option. IPV4 Reassembly
4523                                 * manipulation requires network environment
4524                                 * with IPV4 header and IPV4_FRAG_1 option
4525                                 */
4526
4527typedef protocol_opt_t   ipv_6protocol_opt_t;   /**< IPv6 protocol options. */
4528#define IPV6_MULTICAST_1        0x00800000  /**< IPv6 Multicast. */
4529#define IPV6_UNICAST_2          0x00400000  /**< Tunneled IPv6 - Unicast. */
4530#define IPV6_MULTICAST_2        0x00200000  /**< Tunneled IPv6 - Multicast. */
4531
4532#define IPV6_FRAG_1             0x00000004
4533                                /**< IPV6 reassembly option. IPV6 Reassembly
4534                                 * manipulation requires network environment
4535                                 * with IPV6 header and IPV6_FRAG_1 option; in
4536                                 * case where fragment found, the
4537                                 * fragment-extension offset may be found at
4538                                 * 'shim2' (in parser-result).
4539                                 */
4540typedef protocol_opt_t   capwap_protocol_opt_t; /**< CAPWAP protocol options. */
4541#define CAPWAP_FRAG_1           0x00000008
4542                                /**< CAPWAP reassembly option. CAPWAP Reassembly
4543                                 * manipulation requires network environment
4544                                 * with CAPWAP header and CAPWAP_FRAG_1 option;
4545                                 * in case where fragment found, the
4546                                 * fragment-extension offset may be found at
4547                                 * 'shim2' (in parser-result).
4548                                 */
4549
4550/* @} */
4551
4552#define FM_PCD_MANIP_MAX_HDR_SIZE       256
4553#define FM_PCD_MANIP_DSCP_TO_VLAN_TRANS 64
4554
4555/*
4556 * @Collection    A set of definitions to support Header Manipulation selection.
4557 */
4558typedef uint32_t                hdr_manip_flags_t;
4559                /**< A general type to define a HMan update command flags. */
4560
4561typedef hdr_manip_flags_t       ipv_4hdr_manip_update_flags_t;
4562                /**< IPv4 protocol HMan update command flags. */
4563
4564#define HDR_MANIP_IPV4_TOS      0x80000000
4565                        /**< update TOS with the given value ('tos' field
4566                         * of t_FmPcdManipHdrFieldUpdateIpv4)
4567                         */
4568#define HDR_MANIP_IPV4_ID       0x40000000
4569                        /**< update IP ID with the given value ('id' field
4570                         * of t_FmPcdManipHdrFieldUpdateIpv4)
4571                         */
4572#define HDR_MANIP_IPV4_TTL      0x20000000
4573                        /**< Decrement TTL by 1 */
4574#define HDR_MANIP_IPV4_SRC      0x10000000
4575                        /**< update IP source address with the given value
4576                         * ('src' field of t_FmPcdManipHdrFieldUpdateIpv4)
4577                         */
4578#define HDR_MANIP_IPV4_DST      0x08000000
4579                        /**< update IP destination address with the given value
4580                         * ('dst' field of t_FmPcdManipHdrFieldUpdateIpv4)
4581                         */
4582
4583typedef hdr_manip_flags_t       ipv_6hdr_manip_update_flags_t;
4584                        /**< IPv6 protocol HMan update command flags. */
4585
4586#define HDR_MANIP_IPV6_TC       0x80000000
4587                        /**< update Traffic Class address with the given value
4588                         * ('trafficClass' field of
4589                         * t_FmPcdManipHdrFieldUpdateIpv6)
4590                         */
4591#define HDR_MANIP_IPV6_HL       0x40000000
4592                        /**< Decrement Hop Limit by 1 */
4593#define HDR_MANIP_IPV6_SRC      0x20000000
4594                        /**< update IP source address with the given value
4595                         * ('src' field of t_FmPcdManipHdrFieldUpdateIpv6)
4596                         */
4597#define HDR_MANIP_IPV6_DST      0x10000000
4598                        /**< update IP destination address with the given value
4599                         * ('dst' field of t_FmPcdManipHdrFieldUpdateIpv6)
4600                         */
4601
4602typedef hdr_manip_flags_t       tcp_udp_hdr_manip_update_flags_t;
4603                /**< TCP/UDP protocol HMan update command flags. */
4604
4605#define HDR_MANIP_TCP_UDP_SRC   0x80000000
4606                /**< update TCP/UDP source address with the given value
4607                 * ('src' field of t_FmPcdManipHdrFieldUpdateTcpUdp)
4608                 */
4609#define HDR_MANIP_TCP_UDP_DST   0x40000000
4610                /**< update TCP/UDP destination address with the given value
4611                 * ('dst' field of t_FmPcdManipHdrFieldUpdateTcpUdp)
4612                 */
4613#define HDR_MANIP_TCP_UDP_CHECKSUM  0x20000000
4614                /**< update TCP/UDP checksum */
4615
4616/* @} */
4617
4618/*
4619 * @Description   A type used for returning the order of the key extraction.
4620 *                each value in this array represents the index of the
4621 *                extraction command as defined by the user in the
4622 *                initialization extraction array. The valid size of this array
4623 *                is the user define number of extractions required (also marked
4624 *                by the second '0' in this array).
4625 */
4626typedef uint8_t t_fm_pcd_kg_key_order[FM_PCD_KG_MAX_NUM_OF_EXTRACTS_PER_KEY];
4627
4628/*
4629 * @Collection    Definitions for CC statistics
4630 */
4631#define FM_PCD_CC_STATS_MAX_NUM_OF_FLR  10
4632        /* Maximal supported number of frame length ranges */
4633#define FM_PCD_CC_STATS_FLR_SIZE        2
4634        /* Size in bytes of a frame length range limit */
4635#define FM_PCD_CC_STATS_COUNTER_SIZE    4
4636        /* Size in bytes of a frame length range counter */
4637/* @} */
4638
4639/*
4640 * @Description   Parameters for defining CC keys parameters
4641 *                The driver supports two methods for CC node allocation:
4642 *                dynamic and static. Static mode was created in order to
4643 *                prevent runtime alloc/free of FMan memory (MURAM), which may
4644 *                cause fragmentation; in this mode, the driver automatically
4645 *                allocates the memory according to 'max_num_of_keys' parameter.
4646 *                The driver calculates the maximal memory size that may be used
4647 *                for this CC-Node taking into consideration 'mask_support' and
4648 *                'statistics_mode' parameters. When 'action' =
4649 *                e_FM_PCD_ACTION_INDEXED_LOOKUP in the extraction parameters of
4650 *                this node, 'max_num_of_keys' must be equal to 'num_of_keys'.
4651 *                In dynamic mode, 'max_num_of_keys' must be zero. At
4652 *                initialization, all required structures are allocated
4653 *                according to 'num_of_keys' parameter. During runtime
4654 *                modification, these structures are re-allocated according to
4655 *                the updated number of keys.
4656 *
4657 *                Please note that 'action' and 'icIndxMask' mentioned in the
4658 *                specific parameter explanations are passed in the extraction
4659 *                parameters of the node (fields of
4660 *                extractCcParams.extractNonHdr).
4661 */
4662typedef struct t_keys_params {
4663        uint16_t        max_num_of_keys;
4664                /**< Maximum number of keys that will (ever) be used in this
4665                 * CC-Node; A value of zero may be used for dynamic memory
4666                 * allocation.
4667                 */
4668        bool            mask_support;
4669                /**< This parameter is relevant only if a node is initialized
4670                 * with 'action' = e_FM_PCD_ACTION_EXACT_MATCH and
4671                 * max_num_of_keys > 0; Should be TRUE to reserve table memory
4672                 * for key masks, even if initial keys do not contain masks, or
4673                 * if the node was initialized as 'empty' (without keys); this
4674                 * will allow user to add keys with masks at runtime.
4675                 * NOTE that if user want to use only global-masks (i.e. one
4676                 * common mask for all the entries within this table, this
4677                 * parameter should set to 'FALSE'.
4678                 */
4679        ioc_fm_pcd_cc_stats_mode        statistics_mode;
4680                /**< Determines the supported statistics mode for all node's
4681                 * keys. To enable statistics gathering, statistics should be
4682                 * enabled per every key, using 'statisticsEn' in next engine
4683                 * parameters structure of that key; If 'max_num_of_keys' is
4684                 * set, all required structures will be preallocated for all
4685                 * keys.
4686                 */
4687        uint16_t        frame_length_ranges[FM_PCD_CC_STATS_MAX_NUM_OF_FLR];
4688                /**< Relevant only for 'RMON' statistics mode (this feature is
4689                 * supported only on B4860 device); Holds a list of programmable
4690                 * thresholds - for each received frame, its length in bytes is
4691                 * examined against these range thresholds and the appropriate
4692                 * counter is incremented by 1 - for example, to belong to range
4693                 * i, the following should hold: range i-1 threshold < frame
4694                 * length <= range i threshold. Each range threshold must be
4695                 * larger then its preceding range threshold, and last range
4696                 * threshold must be 0xFFFF.
4697                 */
4698        uint16_t        num_of_keys;
4699                /**< Number of initial keys; Note that in case of 'action' =
4700                 * e_FM_PCD_ACTION_INDEXED_LOOKUP, this field should be
4701                 * power-of-2 of the number of bits that are set in 'icIndxMask'
4702                 */
4703        uint8_t         key_size;
4704                /**< Size of key - for extraction of type FULL_FIELD, 'key_size'
4705                 * has to be the standard size of the selected key; For other
4706                 * extraction types, 'key_size' has to be as size of extraction;
4707                 * When 'action' = e_FM_PCD_ACTION_INDEXED_LOOKUP, 'key_size'
4708                 * must be 2.
4709                 */
4710        ioc_fm_pcd_cc_key_params_t      key_params[FM_PCD_MAX_NUM_OF_KEYS];
4711                /**< An array with 'num_of_keys' entries, each entry specifies
4712                 * the corresponding key parameters; When 'action' =
4713                 * e_FM_PCD_ACTION_EXACT_MATCH, this value must not exceed 255
4714                 * (FM_PCD_MAX_NUM_OF_KEYS-1) as the last entry is saved for the
4715                 * 'miss' entry.
4716                 */
4717        ioc_fm_pcd_cc_next_engine_params_t   cc_next_engine_params_for_miss;
4718                /**< Parameters for defining the next engine when a key is not
4719                 * matched; Not relevant if action =
4720                 * e_FM_PCD_ACTION_INDEXED_LOOKUP.
4721                 */
4722} t_keys_params;
4723
4724/*
4725 * @Description   Parameters for defining custom header manipulation for generic
4726 *                field replacement
4727 */
4728typedef struct ioc_fm_pcd_manip_hdr_custom_gen_field_replace {
4729        uint8_t         src_offset;
4730                        /**< Location of new data - Offset from Parse Result
4731                         * (>= 16, src_offset+size <= 32, )
4732                         */
4733        uint8_t         dst_offset;
4734                        /**< Location of data to be overwritten - Offset from
4735                         * start of frame (dst_offset + size <= 256).
4736                         */
4737        uint8_t         size;
4738                        /**< The number of bytes (<=16) to be replaced */
4739        uint8_t         mask;
4740                        /**< Optional 1 byte mask. Set to select bits for
4741                         * replacement (1 - bit will be replaced); Clear to use
4742                         * field as is.
4743                         */
4744        uint8_t         mask_offset;
4745                        /**< Relevant if mask != 0; Mask offset within the
4746                         * replaces "size"
4747                         */
4748} ioc_fm_pcd_manip_hdr_custom_gen_field_replace;
4749
4750/*
4751 * @Function      fm_pcd_net_env_characteristics_set
4752 *
4753 * @Description   Define a set of Network Environment Characteristics.
4754 *
4755 *                When setting an environment it is important to understand its
4756 *                application. It is not meant to describe the flows that will
4757 *                run on the ports using this environment, but what the user
4758 *                means TO DO with the PCD mechanisms in order to
4759 *                parse-classify-distribute those frames.
4760 *                By specifying a distinction unit, the user means it would use
4761 *                that option for distinction between frames at either a KeyGen
4762 *                scheme or a coarse classification action descriptor. Using
4763 *                interchangeable headers to define a unit means that the user
4764 *                is indifferent to which of the interchangeable headers is
4765 *                present in the frame, and wants the distinction to be based on
4766 *                the presence of either one of them.
4767 *
4768 *                Depending on context, there are limitations to the use of
4769 *                environments. A port using the PCD functionality is bound to
4770 *                an environment. Some or even all ports may share an
4771 *                environment but also an environment per port is possible. When
4772 *                initializing a scheme, a classification plan group (see
4773 *                below), or a coarse classification tree, one of the
4774 *                initialized environments must be stated and related to. When a
4775 *                port is bound to a scheme, a classification plan group, or a
4776 *                coarse classification tree, it MUST be bound to the same
4777 *                environment.
4778 *
4779 *                The different PCD modules, may relate (for flows definition)
4780 *                ONLY on distinction units as defined by their environment.
4781 *                When initializing a scheme for example, it may not choose to
4782 *                select IPV4 as a match for recognizing flows unless it was
4783 *                defined in the relating environment. In fact, to guide the
4784 *                user through the configuration of the PCD, each module's
4785 *                characterization in terms of flows is not done using protocol
4786 *                names, but using environment indexes.
4787 *
4788 *                In terms of HW implementation, the list of distinction units
4789 *                sets the LCV vectors and later used for match vector,
4790 *                classification plan vectors and coarse classification
4791 *                indexing.
4792 *
4793 * @Param[in]     h_fm_pcd              FM PCD module descriptor.
4794 * @Param[in]     p_netenv_params       A structure of parameters for the
4795 *                                      initialization of the network
4796 *                                      environment.
4797 *
4798 * @Return        A handle to the initialized object on success; NULL code
4799 *                otherwise.
4800 *
4801 * @Cautions      Allowed only following fm_pcd_init().
4802 */
4803t_handle fm_pcd_net_env_characteristics_set(t_handle h_fm_pcd,
4804                                 ioc_fm_pcd_net_env_params_t *p_netenv_params);
4805
4806/*
4807 * @Function      fm_pcd_net_env_characteristics_delete
4808 *
4809 * @Description   Deletes a set of Network Environment Characteristics.
4810 *
4811 * @Param[in]     h_net_env     A handle to the Network environment.
4812 *
4813 * @Return        E_OK on success; Error code otherwise.
4814 */
4815uint32_t fm_pcd_net_env_characteristics_delete(t_handle h_net_env);
4816
4817/*
4818 * @Function      fm_pcd_kg_scheme_set
4819 *
4820 * @Description   Initializing or modifying and enabling a scheme for the
4821 *                KeyGen. This routine should be called for adding or modifying
4822 *                a scheme. When a scheme needs modifying, the API requires that
4823 *                it will be rewritten. In such a case 'modify' should be TRUE.
4824 *                If the routine is called for a valid scheme and 'modify' is
4825 *                FALSE, it will return error.
4826 *
4827 * @Param[in]     h_fm_pcd              If this is a new scheme - A handle to an
4828 *                                      FM PCD Module. Otherwise NULL (ignored
4829 *                                      by driver).
4830 * @Param[in,out] p_scheme_params       A structure of parameters for defining
4831 *                                      the scheme
4832 *
4833 * @Return        A handle to the initialized scheme on success; NULL code
4834 *                otherwise. When used as "modify" (rather than for setting a
4835 *                new scheme), p_scheme_params->id.h_scheme will return NULL if
4836 *                action fails due to scheme BUSY state.
4837 *
4838 * @Cautions      Allowed only following fm_pcd_init().
4839 */
4840t_handle fm_pcd_kg_scheme_set(t_handle h_fm_pcd,
4841                            ioc_fm_pcd_kg_scheme_params_t *p_scheme_params);
4842
4843/*
4844 * @Function      fm_pcd_kg_scheme_delete
4845 *
4846 * @Description   Deleting an initialized scheme.
4847 *
4848 * @Param[in]     h_scheme      scheme handle as returned by
4849 *                              fm_pcd_kg_scheme_set()
4850 *
4851 * @Return        E_OK on success; Error code otherwise.
4852 *
4853 * @Cautions      Allowed only following fm_pcd_init() & fm_pcd_kg_scheme_set().
4854 */
4855uint32_t        fm_pcd_kg_scheme_delete(t_handle h_scheme);
4856
4857/*
4858 * @Function      fm_pcd_kg_scheme_get_counter
4859 *
4860 * @Description   Reads scheme packet counter.
4861 *
4862 * @Param[in]     h_scheme      scheme handle as returned by
4863 *                              fm_pcd_kg_scheme_set().
4864 *
4865 * @Return        Counter's current value.
4866 *
4867 * @Cautions      Allowed only following fm_pcd_init() & fm_pcd_kg_scheme_set().
4868 */
4869uint32_t  fm_pcd_kg_scheme_get_counter(t_handle h_scheme);
4870
4871/*
4872 * @Function      fm_pcd_kg_scheme_set_counter
4873 *
4874 * @Description   Writes scheme packet counter.
4875 *
4876 * @Param[in]     h_scheme      scheme handle as returned by
4877 *                              fm_pcd_kg_scheme_set().
4878 * @Param[in]     value         New scheme counter value - typically '0' for
4879 *                              resetting the counter.
4880 *
4881 * @Return        E_OK on success; Error code otherwise.
4882 *
4883 * @Cautions      Allowed only following fm_pcd_init() & fm_pcd_kg_scheme_set().
4884 */
4885uint32_t  fm_pcd_kg_scheme_set_counter(t_handle h_scheme,
4886                        uint32_t value);
4887
4888/*
4889 * @Function      fm_pcd_plcr_profile_set
4890 *
4891 * @Description   Sets a profile entry in the policer profile table.
4892 *                The routine overrides any existing value.
4893 *
4894 * @Param[in]     h_fm_pcd      A handle to an FM PCD Module.
4895 * @Param[in]     p_profile     A structure of parameters for defining a
4896 *                              policer profile entry.
4897 *
4898 * @Return        A handle to the initialized object on success; NULL code
4899 *                otherwise. When used as "modify" (rather than for setting a
4900 *                new profile), p_profile->id.h_profile will return NULL if
4901 *                action fails due to profile BUSY state.
4902 *
4903 * @Cautions      Allowed only following fm_pcd_init().
4904 */
4905t_handle fm_pcd_plcr_profile_set(t_handle h_fm_pcd,
4906                               ioc_fm_pcd_plcr_profile_params_t  *p_profile);
4907
4908/*
4909 * @Function      fm_pcd_plcr_profile_delete
4910 *
4911 * @Description   Delete a profile entry in the policer profile table.
4912 *                The routine set entry to invalid.
4913 *
4914 * @Param[in]     h_profile     A handle to the profile.
4915 *
4916 * @Return        E_OK on success; Error code otherwise.
4917 *
4918 * @Cautions      Allowed only following fm_pcd_init().
4919 */
4920uint32_t fm_pcd_plcr_profile_delete(t_handle h_profile);
4921
4922/*
4923 * @Function      fm_pcd_plcr_profile_get_counter
4924 *
4925 * @Description   Sets an entry in the classification plan.
4926 *                The routine overrides any existing value.
4927 *
4928 * @Param[in]     h_profile     A handle to the profile.
4929 * @Param[in]     counter       Counter selector.
4930 *
4931 * @Return        specific counter value.
4932 *
4933 * @Cautions      Allowed only following fm_pcd_init().
4934 */
4935uint32_t fm_pcd_plcr_profile_get_counter(t_handle       h_profile,
4936                        ioc_fm_pcd_plcr_profile_counters        counter);
4937
4938/*
4939 * @Function      fm_pcd_plcr_profile_set_counter
4940 *
4941 * @Description   Sets an entry in the classification plan.
4942 *                The routine overrides any existing value.
4943 *
4944 * @Param[in]     h_profile     A handle to the profile.
4945 * @Param[in]     counter       Counter selector.
4946 * @Param[in]     value         value to set counter with.
4947 *
4948 * @Return        E_OK on success; Error code otherwise.
4949 *
4950 * @Cautions      Allowed only following fm_pcd_init().
4951 */
4952uint32_t fm_pcd_plcr_profile_set_counter(t_handle h_profile,
4953                                      ioc_fm_pcd_plcr_profile_counters counter,
4954                                        uint32_t                value);
4955
4956/*
4957 * @Function      fm_pcd_cc_root_build
4958 *
4959 * @Description   This routine must be called to define a complete coarse
4960 *                classification tree. This is the way to define coarse
4961 *                classification to a certain flow - the KeyGen schemes may
4962 *                point only to trees defined in this way.
4963 *
4964 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
4965 * @Param[in]     p_params      A structure of parameters to define the tree.
4966 *
4967 * @Return        A handle to the initialized object on success; NULL code
4968 *                otherwise.
4969 *
4970 * @Cautions      Allowed only following fm_pcd_init().
4971 */
4972t_handle fm_pcd_cc_root_build(t_handle h_fm_pcd,
4973                             ioc_fm_pcd_cc_tree_params_t  *p_params);
4974
4975/*
4976 * @Function      fm_pcd_cc_root_delete
4977 *
4978 * @Description   Deleting an built tree.
4979 *
4980 * @Param[in]     h_cc_tree     A handle to a CC tree.
4981 *
4982 * @Return        E_OK on success; Error code otherwise.
4983 *
4984 * @Cautions      Allowed only following fm_pcd_init().
4985 */
4986uint32_t fm_pcd_cc_root_delete(t_handle h_cc_tree);
4987
4988/*
4989 * @Function      fm_pcd_cc_root_modify_next_engine
4990 *
4991 * @Description   Modify the Next Engine Parameters in the entry of the tree.
4992 *
4993 * @Param[in]     h_cc_tree                     A handle to the tree
4994 * @Param[in]     grp_id                        A Group index in the tree
4995 * @Param[in]     index                         Entry index in the group
4996 *                                              defined by grp_id
4997 * @Param[in]     p_fm_pcd_cc_next_engine       Pointer to new next
4998 *                                              engine parameters
4999 *
5000 * @Return        E_OK on success; Error code otherwise.
5001 *
5002 * @Cautions      Allowed only following FM_PCD_CcBuildTree().
5003 */
5004uint32_t fm_pcd_cc_root_modify_next_engine(t_handle h_cc_tree,
5005                uint8_t         grp_id,
5006                uint8_t         index,
5007                ioc_fm_pcd_cc_next_engine_params_t *p_fm_pcd_cc_next_engine);
5008
5009/*
5010 * @Function      fm_pcd_match_table_set
5011 *
5012 * @Description   This routine should be called for each CC (coarse
5013 *                classification) node. The whole CC tree should be built bottom
5014 *                up so that each node points to already defined nodes.
5015 *
5016 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
5017 * @Param[in]     p_param       A structure of parameters defining the CC node
5018 *
5019 * @Return        A handle to the initialized object on success; NULL code
5020 *                otherwise.
5021 *
5022 * @Cautions      Allowed only following fm_pcd_init().
5023 */
5024t_handle   fm_pcd_match_table_set(t_handle h_fm_pcd,
5025                ioc_fm_pcd_cc_node_params_t *p_param);
5026
5027/*
5028 * @Function      fm_pcd_match_table_delete
5029 *
5030 * @Description   Deleting an built node.
5031 *
5032 * @Param[in]     h_cc_node     A handle to a CC node.
5033 *
5034 * @Return        E_OK on success; Error code otherwise.
5035 *
5036 * @Cautions      Allowed only following fm_pcd_init().
5037 */
5038uint32_t fm_pcd_match_table_delete(t_handle h_cc_node);
5039
5040/*
5041 * @Function      fm_pcd_match_table_modify_miss_next_engine
5042 *
5043 * @Description   Modify the Next Engine Parameters of the Miss key case of the
5044 *                node.
5045 *
5046 * @Param[in]     h_cc_node                             A handle to the node
5047 * @Param[in]     p_fm_pcd_cc_next_engine_params        Parameters for defining
5048 *                                                      next engine
5049 *
5050 * @Return        E_OK on success; Error code otherwise.
5051 *
5052 * @Cautions      Allowed only following fm_pcd_match_table_set(); Not
5053 *                relevant in the case the node is of type 'INDEXED_LOOKUP'.
5054 *                When configuring nextEngine = e_FM_PCD_CC, note that
5055 *                p_fm_pcd_cc_next_engine_params->ccParams.h_cc_node must be
5056 *                different from the currently changed table.
5057 *
5058 */
5059uint32_t fm_pcd_match_table_modify_miss_next_engine(t_handle h_cc_node,
5060        ioc_fm_pcd_cc_next_engine_params_t *p_fm_pcd_cc_next_engine_params);
5061
5062/*
5063 * @Function      fm_pcd_match_table_remove_key
5064 *
5065 * @Description   Remove the key (including next engine parameters of this key)
5066 *                defined by the index of the relevant node.
5067 *
5068 * @Param[in]     h_cc_node     A handle to the node
5069 * @Param[in]     key_index     Key index for removing
5070 *
5071 * @Return        E_OK on success; Error code otherwise.
5072 *
5073 * @Cautions      Allowed only following fm_pcd_match_table_set() was called for
5074 *                this node and the nodes that lead to it.
5075 */
5076uint32_t fm_pcd_match_table_remove_key(t_handle h_cc_node,
5077                        uint16_t key_index);
5078
5079/*
5080 * @Function      fm_pcd_match_table_add_key
5081 *
5082 * @Description   Add the key (including next engine parameters of this key in
5083 *                the index defined by the key_index. Note that
5084 *                'FM_PCD_LAST_KEY_INDEX' may be used by user that don't care
5085 *                about the position of the key in the table - in that case, the
5086 *                key will be automatically added by the driver in the last
5087 *                available entry.
5088 *
5089 * @Param[in]     h_cc_node     A handle to the node
5090 * @Param[in]     key_index     Key index for adding.
5091 * @Param[in]     key_size      Key size of added key
5092 * @Param[in]     p_key_params  A pointer to the parameters includes new key
5093 *                              with Next Engine Parameters
5094 *
5095 * @Return        E_OK on success; Error code otherwise.
5096 *
5097 * @Cautions      Allowed only following fm_pcd_match_table_set() was called for
5098 *                this node and the nodes that lead to it.
5099 */
5100uint32_t fm_pcd_match_table_add_key(t_handle h_cc_node,
5101                                uint16_t                key_index,
5102                                uint8_t         key_size,
5103                                ioc_fm_pcd_cc_key_params_t  *p_key_params);
5104
5105/*
5106 * @Function      fm_pcd_match_table_modify_next_engine
5107 *
5108 * @Description   Modify the Next Engine Parameters in the relevant key entry of
5109 *                the node.
5110 *
5111 * @Param[in]     h_cc_node                     A handle to the node
5112 * @Param[in]     key_index                     Key index for Next
5113 *                                              Engine modifications
5114 * @Param[in]     p_fm_pcd_cc_next_engine       Parameters for defining
5115 *                                              next engine
5116 *
5117 * @Return        E_OK on success; Error code otherwise.
5118 *
5119 * @Cautions      Allowed only following fm_pcd_match_table_set(). When
5120 *                configuring nextEngine = e_FM_PCD_CC, note that
5121 *                p_fm_pcd_cc_next_engine_params->ccParams.h_cc_node must be
5122 *                different from the currently changed table.
5123 *
5124 */
5125uint32_t fm_pcd_match_table_modify_next_engine(t_handle h_cc_node,
5126                uint16_t                key_index,
5127                ioc_fm_pcd_cc_next_engine_params_t *p_fm_pcd_cc_next_engine);
5128
5129/*
5130 * @Function      fm_pcd_match_table_modify_key_and_next_engine
5131 *
5132 * @Description   Modify the key and Next Engine Parameters of this key in the
5133 *                index defined by the key_index.
5134 *
5135 * @Param[in]     h_cc_node             A handle to the node
5136 * @Param[in]     key_index             Key index for adding
5137 * @Param[in]     key_size              Key size of added key
5138 * @Param[in]     p_key_params          A pointer to the parameters includes
5139 *                                      modified key and modified Next Engine
5140 *                                      Params
5141 *
5142 * @Return        E_OK on success; Error code otherwise.
5143 *
5144 * @Cautions    Allowed only following fm_pcd_match_table_set() was called for
5145 *              this node and the nodes that lead to it. When configuring
5146 *              nextEngine = e_FM_PCD_CC, note that
5147 *              p_fm_pcd_cc_next_engine_params->ccParams.h_cc_node must be
5148 *              different from the currently changed table.
5149 */
5150uint32_t fm_pcd_match_table_modify_key_and_next_engine(t_handle h_cc_node,
5151                                uint16_t                key_index,
5152                                uint8_t         key_size,
5153                                ioc_fm_pcd_cc_key_params_t  *p_key_params);
5154
5155/*
5156 * @Function      fm_pcd_match_table_modify_key
5157 *
5158 * @Description   Modify the key in the index defined by the key_index.
5159 *
5160 * @Param[in]     h_cc_node             A handle to the node
5161 * @Param[in]     key_index             Key index for adding
5162 * @Param[in]     key_size              Key size of added key
5163 * @Param[in]     p_key                 A pointer to the new key
5164 * @Param[in]     p_mask                A pointer to the new mask if relevant,
5165 *                                      otherwise pointer to NULL
5166 *
5167 * @Return        E_OK on success; Error code otherwise.
5168 *
5169 * @Cautions      Allowed only following fm_pcd_match_table_set() was called for
5170 *                this node and the nodes that lead to it.
5171 */
5172uint32_t fm_pcd_match_table_modify_key(t_handle h_cc_node,
5173                                uint16_t key_index,
5174                                uint8_t  key_size,
5175                                uint8_t  *p_key,
5176                                uint8_t  *p_mask);
5177
5178/*
5179 * @Function      fm_pcd_match_table_find_nremove_key
5180 *
5181 * @Description   Remove the key (including next engine parameters of this key)
5182 *                defined by the key and mask. Note that this routine will
5183 *                search the node to locate the index of the required key
5184 *                (& mask) to remove.
5185 *
5186 * @Param[in]     h_cc_node     A handle to the node
5187 * @Param[in]     key_size      Key size of the one to remove.
5188 * @Param[in]     p_key         A pointer to the requested key to remove.
5189 * @Param[in]     p_mask        A pointer to the mask if relevant,
5190 *                              otherwise pointer to NULL
5191 *
5192 * @Return        E_OK on success; Error code otherwise.
5193 *
5194 * @Cautions      Allowed only following fm_pcd_match_table_set() was called for
5195 *                this node and the nodes that lead to it.
5196 */
5197uint32_t fm_pcd_match_table_find_nremove_key(t_handle h_cc_node,
5198                                        uint8_t  key_size,
5199                                        uint8_t  *p_key,
5200                                        uint8_t  *p_mask);
5201
5202/*
5203 * @Function      fm_pcd_match_table_find_nmodify_next_engine
5204 *
5205 * @Description   Modify the Next Engine Parameters in the relevant key entry of
5206 *                the node. Note that this routine will search the node to
5207 *                locate the index of the required key (& mask) to modify.
5208 *
5209 * @Param[in]     h_cc_node             A handle to the node
5210 * @Param[in]     key_size              Key size of the one to modify.
5211 * @Param[in]     p_key                 A pointer to the requested key to modify
5212 * @Param[in]     p_mask                A pointer to the mask if relevant,
5213 *                                      otherwise pointer to NULL
5214 * @Param[in]     p_fm_pcd_cc_next_engine       Parameters for defining
5215 *                                                      next engine
5216 *
5217 * @Return        E_OK on success; Error code otherwise.
5218 *
5219 * @Cautions      Allowed only following fm_pcd_match_table_set(). When
5220 *                configuring nextEngine = e_FM_PCD_CC, note that
5221 *                p_fm_pcd_cc_next_engine_params->ccParams.h_cc_node must be
5222 *                different from the currently changed table.
5223 */
5224uint32_t fm_pcd_match_table_find_nmodify_next_engine(t_handle h_cc_node,
5225                uint8_t         key_size,
5226                uint8_t         *p_key,
5227                uint8_t         *p_mask,
5228                ioc_fm_pcd_cc_next_engine_params_t *p_fm_pcd_cc_next_engine);
5229
5230/*
5231 * @Function     fm_pcd_match_table_find_nmodify_key_and_next_engine
5232 *
5233 * @Description   Modify the key and Next Engine Parameters of this key in the
5234 *                index defined by the key_index. Note that this routine will
5235 *                search the node to locate the index of the required key
5236 *                (& mask) to modify.
5237 *
5238 * @Param[in]     h_cc_node             A handle to the node
5239 * @Param[in]     key_size              Key size of the one to modify.
5240 * @Param[in]     p_key                 A pointer to the requested key to modify
5241 * @Param[in]     p_mask                A pointer to the mask if relevant,
5242 *                                      otherwise pointer to NULL
5243 * @Param[in]     p_key_params          A pointer to the parameters includes
5244 *                                      modified key and modified Next Engine
5245 *                                      Params
5246 *
5247 * @Return        E_OK on success; Error code otherwise.
5248 *
5249 * @Cautions      Allowed only following fm_pcd_match_table_set() was called for
5250 *                this node and the nodes that lead to it.
5251 *                When configuring nextEngine = e_FM_PCD_CC, note that
5252 *                p_fm_pcd_cc_next_engine_params->ccParams.h_cc_node must be
5253 *                different from the currently changed table.
5254 */
5255uint32_t fm_pcd_match_table_find_nmodify_key_and_next_engine(t_handle h_cc_node,
5256                                uint8_t key_size,
5257                                uint8_t *p_key,
5258                                uint8_t *p_mask,
5259                                ioc_fm_pcd_cc_key_params_t *p_key_params);
5260
5261/*
5262 * @Function      fm_pcd_match_table_find_nmodify_key
5263 *
5264 * @Description   Modify the key  in the index defined by the key_index. Note
5265 *                that this routine will search the node to locate the index of
5266 *                the required key (& mask) to modify.
5267 *
5268 * @Param[in]     h_cc_node     A handle to the node
5269 * @Param[in]     key_size      Key size of the one to modify.
5270 * @Param[in]     p_key         A pointer to the requested key to modify.
5271 * @Param[in]     p_mask        A pointer to the mask if relevant,
5272 *                              otherwise pointer to NULL
5273 * @Param[in]     p_new_key     A pointer to the new key
5274 * @Param[in]     p_new_mask    A pointer to the new mask if relevant,
5275 *                              otherwise pointer to NULL
5276 *
5277 * @Return        E_OK on success; Error code otherwise.
5278 *
5279 * @Cautions      Allowed only following fm_pcd_match_table_set() was called for
5280 *                this node and the nodes that lead to it.
5281 */
5282uint32_t fm_pcd_match_table_find_nmodify_key(t_handle h_cc_node,
5283                                        uint8_t  key_size,
5284                                        uint8_t  *p_key,
5285                                        uint8_t  *p_mask,
5286                                        uint8_t  *p_new_key,
5287                                        uint8_t  *p_new_mask);
5288
5289/*
5290 * @Function      fm_pcd_match_table_get_key_counter
5291 *
5292 * @Description   This routine may be used to get a counter of specific key in a
5293 *                CC Node; This counter reflects how many frames passed that
5294 *                were matched this key.
5295 *
5296 * @Param[in]     h_cc_node     A handle to the node
5297 * @Param[in]     key_index     Key index for adding
5298 *
5299 * @Return        The specific key counter.
5300 *
5301 * @Cautions      Allowed only following fm_pcd_match_table_set().
5302 */
5303uint32_t fm_pcd_match_table_get_key_counter(t_handle h_cc_node,
5304                                uint16_t key_index);
5305
5306/*
5307 * @Function      fm_pcd_match_table_get_key_statistics
5308 *
5309 * @Description   This routine may be used to get statistics counters of
5310 *                specific key in a CC Node.
5311 *
5312 *                If 'e_FM_PCD_CC_STATS_MODE_FRAME' and
5313 *                'e_FM_PCD_CC_STATS_MODE_BYTE_AND_FRAME' were set for this
5314 *                node, these counters reflect how many frames passed that were
5315 *                matched this key; The total frames count will be returned in
5316 *                the counter of the first range (as only one frame length range
5317 *                was defined). If 'e_FM_PCD_CC_STATS_MODE_RMON' was set for
5318 *                this node, the total frame count will be separated to frame
5319 *                length counters, based on provided frame length ranges.
5320 *
5321 * @Param[in]     h_cc_node             A handle to the node
5322 * @Param[in]     key_index             Key index for adding
5323 * @Param[out]    p_key_statistics      Key statistics counters
5324 *
5325 * @Return        The specific key statistics.
5326 *
5327 * @Cautions      Allowed only following fm_pcd_match_table_set().
5328 */
5329uint32_t fm_pcd_match_table_get_key_statistics(t_handle h_cc_node,
5330                        uint16_t                key_index,
5331                        ioc_fm_pcd_cc_key_statistics_t  *p_key_statistics);
5332
5333/*
5334 * @Function      fm_pcd_match_table_get_miss_statistics
5335 *
5336 * @Description   This routine may be used to get statistics counters of miss
5337 *                entry in a CC Node.
5338 *
5339 *                If 'e_FM_PCD_CC_STATS_MODE_FRAME' and
5340 *                'e_FM_PCD_CC_STATS_MODE_BYTE_AND_FRAME' were set for this
5341 *                node, these counters reflect how many frames were not matched
5342 *                to any existing key and therefore passed through the miss
5343 *                entry; The total frames count will be returned in the counter
5344 *                of the first range (as only one frame length range was
5345 *                defined).
5346 *
5347 * @Param[in]     h_cc_node             A handle to the node
5348 * @Param[out]    p_miss_statistics     Statistics counters for 'miss'
5349 *
5350 * @Return        The statistics for 'miss'.
5351 *
5352 * @Cautions      Allowed only following fm_pcd_match_table_set().
5353 */
5354uint32_t fm_pcd_match_table_get_miss_statistics(t_handle h_cc_node,
5355                    ioc_fm_pcd_cc_key_statistics_t      *p_miss_statistics);
5356
5357/*
5358 * @Function      fm_pcd_match_table_find_nget_key_statistics
5359 *
5360 * @Description   This routine may be used to get statistics counters of
5361 *                specific key in a CC Node.
5362 *
5363 *                If 'e_FM_PCD_CC_STATS_MODE_FRAME' and
5364 *                'e_FM_PCD_CC_STATS_MODE_BYTE_AND_FRAME' were set for this
5365 *                node, these counters reflect how many frames passed that were
5366 *                matched this key; The total frames count will be returned in
5367 *                the counter of the first range (as only one frame length range
5368 *                was defined). If 'e_FM_PCD_CC_STATS_MODE_RMON' was set for
5369 *                this node, the total frame count will be separated to frame
5370 *                length counters, based on provided frame length ranges.
5371 *                Note that this routine will search the node to locate the
5372 *                index of the required key based on received key parameters.
5373 *
5374 * @Param[in]     h_cc_node             A handle to the node
5375 * @Param[in]     key_size              Size of the requested key
5376 * @Param[in]     p_key                 A pointer to the requested key
5377 * @Param[in]     p_mask                A pointer to the mask if relevant,
5378 *                                      otherwise pointer to NULL
5379 * @Param[out]    p_key_statistics      Key statistics counters
5380 *
5381 * @Return        The specific key statistics.
5382 *
5383 * @Cautions      Allowed only following fm_pcd_match_table_set().
5384 */
5385uint32_t fm_pcd_match_table_find_nget_key_statistics(t_handle h_cc_node,
5386                        uint8_t         key_size,
5387                        uint8_t         *p_key,
5388                        uint8_t         *p_mask,
5389                        ioc_fm_pcd_cc_key_statistics_t   *p_key_statistics);
5390
5391/*
5392 * @Function      fm_pcd_match_table_get_next_engine
5393 *
5394 * @Description   Gets NextEngine of the relevant key_index.
5395 *
5396 * @Param[in]     h_cc_node                             A handle to the node.
5397 * @Param[in]     key_index                             key_index in the
5398 *                                                      relevant node.
5399 * @Param[out]    p_fm_pcd_cc_next_engine_params        here updated
5400 *                                                      nextEngine parameters
5401 *                                                      for the relevant
5402 *                                                      key_index of the CC Node
5403 *                                                      received as parameter to
5404 *                                                      this function
5405 *
5406 * @Return        E_OK on success; Error code otherwise.
5407 *
5408 * @Cautions      Allowed only following fm_pcd_init().
5409 */
5410uint32_t fm_pcd_match_table_get_next_engine(t_handle    h_cc_node,
5411        uint16_t                        key_index,
5412        ioc_fm_pcd_cc_next_engine_params_t *p_fm_pcd_cc_next_engine_params);
5413
5414/*
5415 * @Function      fm_pcd_match_table_get_indexed_hash_bucket
5416 *
5417 * @Description   This routine simulates KeyGen operation on the provided key
5418 *                and calculates to which hash bucket it will be mapped.
5419 *
5420 * @Param[in]     h_cc_node                     A handle to the node.
5421 * @Param[in]     kg_key_size                   Key size as it was configured in
5422 *                                              the KG scheme that leads to this
5423 *                                              hash.
5424 * @Param[in]     p_kg_key                      Pointer to the key; must be like
5425 *                                              the key that the KG is
5426 *                                              generated, i.e. the same
5427 *                                              extraction and with mask if
5428 *                                              exist.
5429 * @Param[in]     kg_hash_shift                 Hash-shift as it was configured
5430 *                                              in the KG scheme that leads to
5431 *                                              this hash.
5432 * @Param[out]    p_cc_node_bucket_handle       Pointer to the bucket of the
5433 *                                              provided key.
5434 * @Param[out]    p_bucket_index                Index to the bucket of the
5435 *                                              provided key
5436 * @Param[out]    p_last_index                  Pointer to last index in the
5437 *                                              bucket of the provided key.
5438 *
5439 * @Return        E_OK on success; Error code otherwise.
5440 *
5441 * @Cautions      Allowed only following fm_pcd_hash_table_set()
5442 */
5443uint32_t fm_pcd_match_table_get_indexed_hash_bucket(t_handle h_cc_node,
5444                                uint8_t kg_key_size,
5445                                uint8_t *p_kg_key,
5446                                uint8_t kg_hash_shift,
5447                                t_handle        *p_cc_node_bucket_handle,
5448                                uint8_t *p_bucket_index,
5449                                uint16_t        *p_last_index);
5450
5451/*
5452 * @Function      fm_pcd_hash_table_set
5453 *
5454 * @Description   This routine initializes a hash table structure.
5455 *                KeyGen hash result determines the hash bucket.
5456 *                Next, KeyGen key is compared against all keys of this bucket
5457 *                (exact match).
5458 *                Number of sets (number of buckets) of the hash equals to the
5459 *                number of 1-s in 'hashResMask' in the provided parameters.
5460 *                Number of hash table ways is then calculated by dividing
5461 *                'max_num_of_keys' equally between the hash sets. This is the
5462 *                maximal number of keys that a hash bucket may hold.
5463 *                The hash table is initialized empty and keys may be added to
5464 *                it following the initialization. Keys masks are not supported
5465 *                in current hash table implementation.
5466 *                The initialized hash table can be integrated as a node in a CC
5467 *                tree.
5468 *
5469 * @Param[in]     h_fm_pcd      FM PCD module descriptor.
5470 * @Param[in]     p_param       A structure of parameters defining the hash
5471 *                              table
5472 *
5473 * @Return        A handle to the initialized object on success; NULL code
5474 *                otherwise.
5475 *
5476 * @Cautions      Allowed only following fm_pcd_init().
5477 */
5478t_handle fm_pcd_hash_table_set(t_handle h_fm_pcd,
5479        ioc_fm_pcd_hash_table_params_t *p_param);
5480
5481/*
5482 * @Function      fm_pcd_hash_table_delete
5483 *
5484 * @Description   This routine deletes the provided hash table and released all
5485 *                its allocated resources.
5486 *
5487 * @Param[in]     h_hash_tbl    A handle to a hash table
5488 *
5489 * @Return        E_OK on success; Error code otherwise.
5490 *
5491 * @Cautions      Allowed only following fm_pcd_hash_table_set().
5492 */
5493uint32_t fm_pcd_hash_table_delete(t_handle h_hash_tbl);
5494
5495/*
5496 * @Function      fm_pcd_hash_table_add_key
5497 *
5498 * @Description   This routine adds the provided key (including next engine
5499 *                parameters of this key) to the hash table.
5500 *                The key is added as the last key of the bucket that it is
5501 *                mapped to.
5502 *
5503 * @Param[in]     h_hash_tbl    A handle to a hash table
5504 * @Param[in]     key_size      Key size of added key
5505 * @Param[in]     p_key_params  A pointer to the parameters includes
5506 *                              new key with next engine parameters; The pointer
5507 *                              to the key mask must be NULL, as masks are not
5508 *                              supported in hash table implementation.
5509 *
5510 * @Return        E_OK on success; Error code otherwise.
5511 *
5512 * @Cautions      Allowed only following fm_pcd_hash_table_set().
5513 */
5514uint32_t fm_pcd_hash_table_add_key(t_handle h_hash_tbl,
5515                                uint8_t         key_size,
5516                                ioc_fm_pcd_cc_key_params_t  *p_key_params);
5517
5518/*
5519 * @Function      fm_pcd_hash_table_remove_key
5520 *
5521 * @Description   This routine removes the requested key (including next engine
5522 *                parameters of this key) from the hash table.
5523 *
5524 * @Param[in]     h_hash_tbl    A handle to a hash table
5525 * @Param[in]     key_size      Key size of the one to remove.
5526 * @Param[in]     p_key         A pointer to the requested key to remove.
5527 *
5528 * @Return        E_OK on success; Error code otherwise.
5529 *
5530 * @Cautions      Allowed only following fm_pcd_hash_table_set().
5531 */
5532uint32_t fm_pcd_hash_table_remove_key(t_handle h_hash_tbl,
5533                                uint8_t  key_size,
5534                                uint8_t  *p_key);
5535
5536/*
5537 * @Function      fm_pcd_hash_table_modify_next_engine
5538 *
5539 * @Description   This routine modifies the next engine for the provided key.
5540 *                The key should be previously added to the hash table.
5541 *
5542 * @Param[in]     h_hash_tbl                    A handle to a hash table
5543 * @Param[in]     key_size                      Key size of the key to modify.
5544 * @Param[in]     p_key                         A pointer to the requested key
5545 *                                              to modify.
5546 * @Param[in]     p_fm_pcd_cc_next_engine       A structure for defining
5547 *                                              new next engine parameters.
5548 *
5549 * @Return        E_OK on success; Error code otherwise.
5550 *
5551 * @Cautions      Allowed only following fm_pcd_hash_table_set().
5552 *                When configuring nextEngine = e_FM_PCD_CC, note that
5553 *                p_fm_pcd_cc_next_engine_params->ccParams.h_cc_node must be
5554 *                different from the currently changed table.
5555 */
5556uint32_t fm_pcd_hash_table_modify_next_engine(t_handle h_hash_tbl,
5557                uint8_t         key_size,
5558                uint8_t         *p_key,
5559                ioc_fm_pcd_cc_next_engine_params_t *p_fm_pcd_cc_next_engine);
5560
5561/*
5562 * @Function      fm_pcd_hash_table_modify_miss_next_engine
5563 *
5564 * @Description   This routine modifies the next engine on key match miss.
5565 *
5566 * @Param[in]     h_hash_tbl                    A handle to a hash table
5567 * @Param[in]     p_fm_pcd_cc_next_engine       A structure for defining
5568 *                                              new next engine parameters.
5569 *
5570 * @Return        E_OK on success; Error code otherwise.
5571 *
5572 * @Cautions      Allowed only following fm_pcd_hash_table_set().
5573 *                When configuring nextEngine = e_FM_PCD_CC, note that
5574 *                p_fm_pcd_cc_next_engine_params->ccParams.h_cc_node must be
5575 *                different from the currently changed table.
5576 */
5577uint32_t fm_pcd_hash_table_modify_miss_next_engine(t_handle h_hash_tbl,
5578              ioc_fm_pcd_cc_next_engine_params_t *p_fm_pcd_cc_next_engine);
5579
5580/*
5581 * @Function      fm_pcd_hash_table_get_miss_next_engine
5582 *
5583 * @Description   Gets NextEngine in case of key match miss.
5584 *
5585 * @Param[in]     h_hash_tbl                            A handle to a hash table
5586 * @Param[out]    p_fm_pcd_cc_next_engine_params        Next engine parameters
5587 *                                                      for the specified hash
5588 *                                                      table.
5589 *
5590 * @Return        E_OK on success; Error code otherwise.
5591 *
5592 * @Cautions      Allowed only following fm_pcd_hash_table_set().
5593 */
5594uint32_t fm_pcd_hash_table_get_miss_next_engine(t_handle        h_hash_tbl,
5595        ioc_fm_pcd_cc_next_engine_params_t *p_fm_pcd_cc_next_engine_params);
5596
5597/*
5598 * @Function      fm_pcd_hash_table_find_nget_key_statistics
5599 *
5600 * @Description   This routine may be used to get statistics counters of
5601 *                specific key in a hash table.
5602 *
5603 *                If 'e_FM_PCD_CC_STATS_MODE_FRAME' and
5604 *                'e_FM_PCD_CC_STATS_MODE_BYTE_AND_FRAME' were set for this
5605 *                node, these counters reflect how many frames passed that were
5606 *                matched this key; The total frames count will be returned in
5607 *                the counter of the first range (as only one frame length range
5608 *                was defined). If 'e_FM_PCD_CC_STATS_MODE_RMON' was set for
5609 *                this node, the total frame count will be separated to frame
5610 *                length counters, based on provided frame length ranges. Note
5611 *                that this routine will identify the bucket of this key in the
5612 *                hash table and will search the bucket to locate the index of
5613 *                the required key based on received key parameters.
5614 *
5615 * @Param[in]     h_hash_tbl            A handle to a hash table
5616 * @Param[in]     key_size              Size of the requested key
5617 * @Param[in]     p_key                 A pointer to the requested key
5618 * @Param[out]    p_key_statistics      Key statistics counters
5619 *
5620 * @Return        The specific key statistics.
5621 *
5622 * @Cautions      Allowed only following fm_pcd_hash_table_set().
5623 */
5624uint32_t fm_pcd_hash_table_find_nget_key_statistics(t_handle h_hash_tbl,
5625                        uint8_t         key_size,
5626                        uint8_t         *p_key,
5627                        ioc_fm_pcd_cc_key_statistics_t   *p_key_statistics);
5628
5629/*
5630 * @Function      fm_pcd_hash_table_get_miss_statistics
5631 *
5632 * @Description   This routine may be used to get statistics counters of 'miss'
5633 *                entry of the a hash table.
5634 *
5635 *                If 'e_FM_PCD_CC_STATS_MODE_FRAME' and
5636 *                'e_FM_PCD_CC_STATS_MODE_BYTE_AND_FRAME' were set for this
5637 *                node, these counters reflect how many frames were not matched
5638 *                to any existing key and therefore passed through the miss
5639 *                entry;
5640 *
5641 * @Param[in]     h_hash_tbl            A handle to a hash table
5642 * @Param[out]    p_miss_statistics     Statistics counters for 'miss'
5643 *
5644 * @Return        The statistics for 'miss'.
5645 *
5646 * @Cautions      Allowed only following fm_pcd_hash_table_set().
5647 */
5648uint32_t fm_pcd_hash_table_get_miss_statistics(t_handle h_hash_tbl,
5649                        ioc_fm_pcd_cc_key_statistics_t   *p_miss_statistics);
5650
5651/*
5652 * @Function      fm_pcd_manip_node_set
5653 *
5654 * @Description   This routine should be called for defining a manipulation
5655 *                node. A manipulation node must be defined before the CC node
5656 *                that precedes it.
5657 *
5658 * @Param[in]     h_fm_pcd                      FM PCD module descriptor.
5659 * @Param[in]     p_fm_pcd_manip_params         A structure of parameters
5660 *                                              defining the manipulation
5661 *
5662 * @Return        A handle to the initialized object on success; NULL code
5663 *                otherwise.
5664 *
5665 * @Cautions      Allowed only following fm_pcd_init().
5666 */
5667t_handle fm_pcd_manip_node_set(t_handle h_fm_pcd,
5668        ioc_fm_pcd_manip_params_t *p_fm_pcd_manip_params);
5669
5670/*
5671 * @Function      fm_pcd_manip_node_delete
5672 *
5673 * @Description   Delete an existing manipulation node.
5674 *
5675 * @Param[in]     h_manip_node          A handle to a manipulation node.
5676 *
5677 * @Return        E_OK on success; Error code otherwise.
5678 *
5679 * @Cautions      Allowed only following fm_pcd_manip_node_set().
5680 */
5681uint32_t  fm_pcd_manip_node_delete(t_handle h_manip_node);
5682
5683/*
5684 * @Function      fm_pcd_manip_get_statistics
5685 *
5686 * @Description   Retrieve the manipulation statistics.
5687 *
5688 * @Param[in]     h_manip_node          A handle to a manipulation node.
5689 * @Param[out]    p_fm_pcd_manip_stats  A structure for retrieving the
5690 *                                      manipulation statistics
5691 *
5692 * @Return        E_OK on success; Error code otherwise.
5693 *
5694 * @Cautions      Allowed only following fm_pcd_manip_node_set().
5695 */
5696uint32_t fm_pcd_manip_get_statistics(t_handle h_manip_node,
5697        ioc_fm_pcd_manip_stats_t *p_fm_pcd_manip_stats);
5698
5699/*
5700 * @Function      fm_pcd_manip_node_replace
5701 *
5702 * @Description   Change existing manipulation node to be according to new
5703 *                requirement.
5704 *
5705 * @Param[in]     h_manip_node          A handle to a manipulation node.
5706 * @Param[out]    p_manip_params        A structure of parameters defining the
5707 *                                      change requirement
5708 *
5709 * @Return        E_OK on success; Error code otherwise.
5710 *
5711 * @Cautions      Allowed only following fm_pcd_manip_node_set().
5712 */
5713uint32_t fm_pcd_manip_node_replace(t_handle h_manip_node,
5714ioc_fm_pcd_manip_params_t *p_manip_params);
5715
5716/*
5717 * @Function      fm_pcd_frm_replic_set_group
5718 *
5719 * @Description   Initialize a Frame Replicator group.
5720 *
5721 * @Param[in]     h_fm_pcd                      FM PCD module descriptor.
5722 * @Param[in]     p_frm_replic_group_param      A structure of parameters for
5723 *                                              the initialization of the frame
5724 *                                              replicator group.
5725 *
5726 * @Return        A handle to the initialized object on success; NULL code
5727 *                otherwise.
5728 *
5729 * @Cautions      Allowed only following fm_pcd_init().
5730 */
5731t_handle fm_pcd_frm_replic_set_group(t_handle h_fm_pcd,
5732                ioc_fm_pcd_frm_replic_group_params_t *p_frm_replic_group_param);
5733
5734/*
5735 * @Function      fm_pcd_frm_replic_delete_group
5736 *
5737 * @Description   Delete a Frame Replicator group.
5738 *
5739 * @Param[in]     h_frm_replic_group    A handle to the frame replicator group.
5740 *
5741 * @Return        E_OK on success;  Error code otherwise.
5742 *
5743 * @Cautions      Allowed only following fm_pcd_frm_replic_set_group().
5744 */
5745uint32_t fm_pcd_frm_replic_delete_group(t_handle h_frm_replic_group);
5746
5747/*
5748 * @Function      fm_pcd_frm_replic_add_member
5749 *
5750 * @Description   Add the member in the index defined by the member_index.
5751 *
5752 * @Param[in]     h_frm_replic_group    A handle to the frame replicator group.
5753 * @Param[in]     member_index          member index for adding.
5754 * @Param[in]     p_member_params       A pointer to the new member parameters.
5755 *
5756 * @Return        E_OK on success; Error code otherwise.
5757 *
5758 * @Cautions      Allowed only following fm_pcd_frm_replic_set_group() of this
5759 *                group.
5760 */
5761uint32_t fm_pcd_frm_replic_add_member(t_handle h_frm_replic_group,
5762                        uint16_t                member_index,
5763                        ioc_fm_pcd_cc_next_engine_params_t *p_member_params);
5764
5765/*
5766 * @Function      fm_pcd_frm_replic_remove_member
5767 *
5768 * @Description   Remove the member defined by the index from the relevant
5769 *                group.
5770 *
5771 * @Param[in]     h_frm_replic_group    A handle to the frame replicator group.
5772 * @Param[in]     member_index          member index for removing.
5773 *
5774 * @Return        E_OK on success; Error code otherwise.
5775 *
5776 * @Cautions      Allowed only following fm_pcd_frm_replic_set_group() of this
5777 * group.
5778 */
5779uint32_t fm_pcd_frm_replic_remove_member(t_handle h_frm_replic_group,
5780                                      uint16_t member_index);
5781
5782/** @} */ /* end of FM_PCD_Runtime_build_grp group */
5783/** @} */ /* end of FM_PCD_Runtime_grp group */
5784/** @} */ /* end of FM_PCD_grp group */
5785/** @} */ /* end of FM_grp group */
5786
5787#endif /* __FM_PCD_EXT_H */
5788