Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.6.0.3
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
TCAM API: Provide An Managing Policy In Hardware [OPENAPI_TCAM]

Data Structures

struct  OPEN_COUNTER_STATS_t
 
struct  OPEN_METER_ENTRY_t
 
struct  OPEN_METER_STATS_t
 
struct  open_sysExtAgentPktRxDesc_t
 
struct  OPEN_TCAM_ACTION_t
 Structure to define the action that should be taken. More...
 
struct  open_tcam_version_t
 Version information for the TCAM API. More...
 
struct  open_tcamHardwareGroupUsage_s
 Hardware TCAM group usage information. More...
 
struct  open_tcamHardwarePolicyUsage_s
 Hardware TCAM Policy Usage Information. More...
 
struct  tcam_api_policyHeader_s
 Header that goes on the front of each policy. More...
 

Macros

#define OPEN_COUNT_BYTES   0x2 /* matching byte counter */
 
#define OPEN_COUNT_PACKETS   0x1 /* matching packet counter */
 
#define OPEN_CPU_RATE_LIMIT   5
 
#define OPEN_CPU_RATE_LIMIT_BURST   5
 
#define OPEN_PT_MATCH_RULE_NUM   61
 Packet Trace rule number for TCAM.
 
#define OPEN_TCAM_ACTION_DROP   1 /* ((uint32_t)(1 << 0)) */
 Drop the frame.
 
#define OPEN_TCAM_ACTION_DSTMAC_NEW   16 /* ((uint32_t)(1 << 4)) */
 Rewrite the destination MAC address.
 
#define OPEN_TCAM_ACTION_NONE   0
 No action.
 
#define OPEN_TCAM_ACTION_OUTERTPID_NEW   64 /* ((uint32_t)(1 << 6)) */
 Rewrite the outer TPID.
 
#define OPEN_TCAM_ACTION_OUTERVLAN   4 /* ((uint32_t)(1 << 2)) */
 Rewrite the outer VLAN field.
 
#define OPEN_TCAM_ACTION_REDIRECT   2 /* ((uint32_t)(1 << 1)) */
 Redirect the frame to another port.
 
#define OPEN_TCAM_ACTION_REDIRECT_CPU   128 /* ((uint32_t)(1 << 7)) */
 redirect packet to CPU
 
#define OPEN_TCAM_ACTION_SRCMAC_NEW   8 /* ((uint32_t)(1 << 3)) */
 Rewrite the source MAC address.
 
#define OPEN_TCAM_ACTION_USERPRIO   32 /* ((uint32_t)(1 << 5)) */
 Rewrite the priority.
 
#define OPEN_TCAM_API_CURR_VER_MAJOR   0
 The current TCAM API major version.
 
#define OPEN_TCAM_API_CURR_VER_MINOR   1
 The current TCAM API minor version.
 
#define OPEN_TCAM_API_POLICYID_INVALID   0
 Invalid Policy ID.
 
#define OPEN_TCAM_EXT_AGENT_PKT_RECEIVE   (0x2)
 External agent receive.
 
#define OPEN_TCAM_EXT_AGENT_PKT_TRANSMIT   (0x1)
 External agent transmit.
 
#define OPEN_TCAM_POLICY_NAME_SIZE   64
 Maximum number of characters in the policy name.
 
#define OPEN_TCAM_POLICY_RULE_PRIORITY_DEFAULT   1
 
#define OPEN_TCAM_POLICY_RULE_PRIORITY_LOWEST   0
 Policy Prority.
 
#define OPEN_TCAM_STAGE_EGRESS   3
 Hardware ECAP.
 
#define OPEN_TCAM_STAGE_INGRESS   2
 Hardware ICAP.
 
#define OPEN_TCAM_STAGE_LOOKUP   1
 Hardware VCAP.
 
#define OPEN_TXRX_MAX_FRAME_SIZE   9216
 Transmit/Receive maximum frame size.
 
#define TCAM_API_DEBUG(dbgLvl, args...)
 Debug macro for logging messages. More...
 
#define TCAM_MAC_ADDR_LEN   6
 The typical sequence is:
openapiTcamApiInit() to initialize the TCAM API
repeat openapiTcamPolicyCreate() to create a policy and get a handle for each policy
repeat openapiTcamPolicyIntfAdd() to add the policy to a set of interfaces for each policy
repeat openapiTcamPolicyIntfRem() to remove the policy from a set of interfaces for each policy
repeat openapiTcamPolicyDestroy() to destroy the policy for each policy
openapiTcamApiFini() to uninitialize the TCAM API
More...
 

Typedefs

typedef uint32_t OPEN_TCAM_API_POLICYID_t
 Type for Policy IDs.
 
typedef uint32_t OPEN_TCAM_POLICY_ACTION_t
 Type for Policy actions.
 
typedef struct open_tcamHardwareGroupUsage_s open_tcamHardwareGroupUsage_t
 Hardware TCAM group usage information.
 
typedef struct open_tcamHardwarePolicyUsage_s open_tcamHardwarePolicyUsage_t
 Hardware TCAM Policy Usage Information.
 
typedef struct tcam_api_policyHeader_s tcam_api_policyHeader_t
 Header that goes on the front of each policy.
 

Enumerations

enum  OPEN_METER_COLOR_MODE_t { OPEN_METER_COLOR_BLIND, OPEN_METER_COLOR_AWARE }
 
enum  OPEN_METER_MODE_t { OPEN_METER_BYTES, OPEN_METER_PACKETS }
 
enum  OPEN_TCAM_POLICY_TYPE_t {
  OPEN_TCAM_POLICY_TYPE_OPENFLOW = 1, OPEN_TCAM_POLICY_TYPE_GEN = 2, OPEN_TCAM_POLICY_TYPE_EGRESS = 3, OPEN_TCAM_POLICY_TYPE_SYSTEM_PORT = 4,
  OPEN_TCAM_POLICY_TYPE_PORT = 5, OPEN_TCAM_POLICY_TYPE_LAST = 6
}
 Enumeration to describe where the policy should apply. More...
 
enum  TCAM_API_DEBUG_FLAG_t {
  TCAM_API_DEBUG_LEVEL_NONE = 0, TCAM_API_DEBUG_LEVEL_INFO = 1, TCAM_API_DEBUG_LEVEL_ERROR = 2, TCAM_API_DEBUG_LEVEL_DEBUG = 3,
  TCAM_API_DEBUG_LEVEL_LAST = 4
}
 Enumeration of debug flags. More...
 

Functions

open_error_t openapiExtAgentPktRegister (uint32_t agentId, open_buffdesc *agentName, uint32_t flags)
 Register an External Packet Transmit/Receive Agent. More...
 
open_error_t openapiExtAgentPktUnregister (uint32_t agentId)
 Unregister an External Packet Transmit/Receive Agent. More...
 
open_error_t openapiTcamApiFini (openapiClientHandle_t *clientHandle)
 Uninitialize the TCAM API and return its resources. More...
 
open_error_t openapiTcamApiInit (openapiClientHandle_t *clientHandle)
 Initialize the TCAM API. More...
 
open_error_t openapiTcamApiVersionGet (openapiClientHandle_t *clientHandle, open_tcam_version_t *version)
 Get the version supported by the current API. More...
 
open_error_t openapiTcamHardwareGroupUsageGetNext (openapiClientHandle_t *client_handle, uint32_t *unit, uint32_t *asic_id, uint32_t *stage, uint32_t *group_id, open_tcamHardwareGroupUsage_t *group_usage)
 Get the hardware usage statistics for the next hardware group after the specified hardware group. More...
 
open_error_t openapiTcamHardwarePolicyUsageGetNext (openapiClientHandle_t *client_handle, uint32_t *unit, uint32_t *asic_id, uint32_t *policy_id, open_tcamHardwarePolicyUsage_t *tcam_usage)
 Get the policy hardware usage statistics for the next policy after the specified policy. More...
 
open_error_t openapiTcamPolicyCreate (openapiClientHandle_t *clientHandle, open_tcamApiPolicy_t policyInfo, OPEN_TCAM_API_POLICYID_t *handle)
 Create a policy in the hardware directly. More...
 
open_error_t openapiTcamPolicyCreateV2 (openapiClientHandle_t *clientHandle, open_tcamApiPolicy_v2_t policyInfo, OPEN_TCAM_API_POLICYID_t *handle)
 Create a policy in the hardware directly. More...
 
open_error_t openapiTcamPolicyDeleteAll (openapiClientHandle_t *clientHandle)
 Delete all the policies created by TCAM API. More...
 
open_error_t openapiTcamPolicyDestroy (openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle)
 Delete the policy created. More...
 
open_error_t openapiTcamPolicyGet (openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle, open_tcamApiPolicy_t *policyInfo)
 Get TCAM policy information from the policy handle provided. More...
 
open_error_t openapiTcamPolicyGetFirst (openapiClientHandle_t *clientHandle, open_tcamApiPolicy_t *policyInfo, OPEN_TCAM_API_POLICYID_t *nextPolicyHandle)
 Get the first TCAM policy information. More...
 
open_error_t openapiTcamPolicyGetFirstV2 (openapiClientHandle_t *clientHandle, open_tcamApiPolicy_v2_t *policyInfo, OPEN_TCAM_API_POLICYID_t *nextPolicyHandle)
 Get the first TCAM policy information. More...
 
open_error_t openapiTcamPolicyGetNext (openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle, open_tcamApiPolicy_t *policyInfo, OPEN_TCAM_API_POLICYID_t *nextPolicyHandle)
 Get the next TCAM policy information from the policy handle provided. More...
 
open_error_t openapiTcamPolicyGetNextV2 (openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle, open_tcamApiPolicy_v2_t *policyInfo, OPEN_TCAM_API_POLICYID_t *nextPolicyHandle)
 Get the next TCAM policy information from the policy handle provided. More...
 
open_error_t openapiTcamPolicyGetV2 (openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle, open_tcamApiPolicy_v2_t *policyInfo)
 Get TCAM policy information from the policy handle provided. More...
 
open_error_t openapiTcamPolicyIntfAdd (openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle, uint32_t intf)
 Add the TCAM policy to the list of interfaces provided. More...
 
open_error_t openapiTcamPolicyIntfAllAdd (openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle)
 Add the TCAM policy to all interfaces. More...
 
open_error_t openapiTcamPolicyIntfRem (openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle, uint32_t intf)
 Remove TCAM policy from the list of interfaces provided. More...
 
open_error_t openapiTcamPolicyMeteringStatsGet (openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle, uint64_t *inProf, uint64_t *outProf)
 Get TCAM policy statistics for the policy handle provided. More...
 
open_error_t openapiTcamPolicyStatsClear (openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle)
 Clear TCAM policy statistics for the policy handle provided. More...
 

Variables

OPEN_TCAM_POLICY_ACTION_t actionType
 
OPEN_TCAM_ACTION_t actionVal
 
unsigned char matchCpuVisibility
 
unsigned char matchCpuVisibilityMask
 
uint32_t matchDstIp
 
uint32_t matchDstIpMask
 
open_in6_addr_t matchDstIpv6Addr
 
open_in6_addr_t matchDstIpv6Mask
 
unsigned char matchDstMac [TCAM_MAC_ADDR_LEN]
 
uint16_t matchDstPortIcmpCode
 
uint16_t matchDstPortIcmpCodeMask
 
uint16_t matchEthType
 
uint32_t matchIpDscp
 
unsigned char matchIpDscpMask
 
uint32_t matchIpProto
 
uint32_t matchIpProtoMask
 
uint32_t matchL4Dport
 
uint32_t matchL4DportMask
 
uint32_t matchL4Sport
 
uint32_t matchL4SportMask
 
uint32_t matchSrcIp
 
uint32_t matchSrcIpMask
 
open_in6_addr_t matchSrcIpv6Addr
 
open_in6_addr_t matchSrcIpv6Mask
 
unsigned char matchSrcMac [TCAM_MAC_ADDR_LEN]
 
uint16_t matchSrcPortIcmpType
 
uint16_t matchSrcPortIcmpTypeMask
 
unsigned char matchVlanPrio
 
uint16_t matchVlanVal
 
OPEN_METER_ENTRY_t meterInfo
 
uint8_t meterPresent
 
 open_tcamApiPolicy_t
 
 open_tcamApiPolicy_v2_t
 
uint32_t policyPrio
 
OPEN_TCAM_POLICY_TYPE_t policyType
 
uint64_t ruleNum
 
uint32_t rulePrio
 
OPEN_PACKED_STRUCT tcamApiPolicy_s
 Structure that contains the full TCAM API policy: headers, match values and action. More...
 
OPEN_PACKED_STRUCT tcamApiPolicy_v2_s
 Structure that contains the full TCAM API policy: headers, match values and action. More...
 

Detailed Description

Macro Definition Documentation

#define TCAM_API_DEBUG (   dbgLvl,
  args... 
)
Value:
{\
if (tcamApiDebugFlag >= dbgLvl) \
{\
SYSAPI_PRINTF(SYSAPI_LOGGING_ALWAYS,args);\
}\
}

Debug macro for logging messages.

Definition at line 84 of file openapi_tcam.h.

#define TCAM_MAC_ADDR_LEN   6

The typical sequence is:
openapiTcamApiInit() to initialize the TCAM API
repeat openapiTcamPolicyCreate() to create a policy and get a handle for each policy
repeat openapiTcamPolicyIntfAdd() to add the policy to a set of interfaces for each policy
repeat openapiTcamPolicyIntfRem() to remove the policy from a set of interfaces for each policy
repeat openapiTcamPolicyDestroy() to destroy the policy for each policy
openapiTcamApiFini() to uninitialize the TCAM API

The length of a MAC address in bytes

Definition at line 59 of file openapi_tcam.h.

Enumeration Type Documentation

Enumeration to describe where the policy should apply.

Enumerator
OPEN_TCAM_POLICY_TYPE_OPENFLOW 

OpenFlow policy

OPEN_TCAM_POLICY_TYPE_GEN 

Gen (IPv6) policy

OPEN_TCAM_POLICY_TYPE_EGRESS 

Egress policy

OPEN_TCAM_POLICY_TYPE_SYSTEM_PORT 

System Port policy

OPEN_TCAM_POLICY_TYPE_PORT 

Port policy

OPEN_TCAM_POLICY_TYPE_LAST 

End value

Definition at line 163 of file openapi_tcam.h.

Enumeration of debug flags.

Enumerator
TCAM_API_DEBUG_LEVEL_NONE 

No debug

TCAM_API_DEBUG_LEVEL_INFO 

Informational debugging

TCAM_API_DEBUG_LEVEL_ERROR 

Error messages

TCAM_API_DEBUG_LEVEL_DEBUG 

Debug messages

TCAM_API_DEBUG_LEVEL_LAST 

End value

Definition at line 74 of file openapi_tcam.h.

Function Documentation

open_error_t openapiExtAgentPktRegister ( uint32_t  agentId,
open_buffdesc agentName,
uint32_t  flags 
)

Register an External Packet Transmit/Receive Agent.

Parameters
[in]agentIdUnique Agent Id. The acceptable range of Agent Ids can be retrieved using usmDbExtAgentIdRangeGet API.
[in]agentNameName of the receive agent.
[in]flagsOPEN_TCAM_EXT_AGENT_PKT_TRANSMIT: Register as external transmit agent OPEN_TCAM_EXT_AGENT_PKT_RECEIVE: Register as external receive agent
Return values
OPEN_E_NONEAgent registered successfully OPEN_E_EXISTS: Agent with the given id is already registered OPEN_E_FAIL: Other failures
Note
Only OPEN_TCAM_EXT_AGENT_PKT_RECEIVE flag is supported

OpEN API Version: 1.2

Examples:
acl_pkt_cap.c, and rx_pkt_example.c.
open_error_t openapiExtAgentPktUnregister ( uint32_t  agentId)

Unregister an External Packet Transmit/Receive Agent.

Parameters
[in]agentIdId to uniquely identify agent
Return values
OPEN_E_NONEAgent unregistered successfully OPEN_E_FAIL: Invalid agentId passed

OpEN API Version: 1.2

Examples:
acl_pkt_cap.c, and rx_pkt_example.c.
open_error_t openapiTcamApiFini ( openapiClientHandle_t clientHandle)

Uninitialize the TCAM API and return its resources.

Parameters
[in]clientHandleOpEN client handle
Return values
OPEN_E_NONEUnintialize succeeded and resources returned
OPEN_E_FAILFini failed

OpEN API Version: 1.2

Examples:
rx_pkt_example.c, and tcam_example.c.
open_error_t openapiTcamApiInit ( openapiClientHandle_t clientHandle)

Initialize the TCAM API.

Parameters
[in]clientHandleOpEN client handle
Return values
OPEN_E_NONEAPI initialized successfully
OPEN_E_FAILError encountered in TCAM API initialization

OpEN API Version: 1.2

Examples:
rx_pkt_example.c, and tcam_example.c.
open_error_t openapiTcamApiVersionGet ( openapiClientHandle_t clientHandle,
open_tcam_version_t version 
)

Get the version supported by the current API.

Parameters
[in]clientHandleOpEN client handle
[out]versionversion structure with version information populated
Return values
OPEN_E_NONEVersion returned.
OPEN_E_PARAMInsufficient string size provided.

OpEN API Version: 1.2

Examples:
rx_pkt_example.c, and tcam_example.c.
open_error_t openapiTcamHardwareGroupUsageGetNext ( openapiClientHandle_t client_handle,
uint32_t *  unit,
uint32_t *  asic_id,
uint32_t *  stage,
uint32_t *  group_id,
open_tcamHardwareGroupUsage_t group_usage 
)

Get the hardware usage statistics for the next hardware group after the specified hardware group.

Parameters
[in]client_handleOpEN client handle
[in,out]unitOn stackable platforms specifies the stack unit ID. Always returns 1 on non-stacking platforms.
[in,out]asic_idOn multi-ASIC units specifies the ASIC number on a unit. Always returns 0 on units with one ASIC.
[in,out]stageTCAM Stage
[in,out]group_idGroup ID to search for
[out]group_usageHardware group usage info.
Return values
OPEN_E_NONEHardware Group Found.
OPEN_E_NOT_FOUNDHardware Group was not found.
Note
In order to get the first group set unit/asic_id/stage/group_id to 0

OpEN API Version: 1.13

Examples:
tcam_usage.c.
open_error_t openapiTcamHardwarePolicyUsageGetNext ( openapiClientHandle_t client_handle,
uint32_t *  unit,
uint32_t *  asic_id,
uint32_t *  policy_id,
open_tcamHardwarePolicyUsage_t tcam_usage 
)

Get the policy hardware usage statistics for the next policy after the specified policy.

Parameters
[in]client_handleOpEN client handle
[in,out]unitOn stackable platforms specifies the stack unit ID. Always returns 1 on non-stacking platforms.
[in,out]asic_idOn multi-ASIC units specifies the ASIC number on a unit. Always returns 0 on units with one ASIC.
[in,out]policy_idPolicy ID to search for
[out]tcam_usageHardware policy usage info.
Return values
OPEN_E_NONEPolicy is found.
OPEN_E_NOT_FOUNDNext policy is not found.
Note
In order to get the first policy set unit/asic_id/policyId to 0

OpEN API Version: 1.13

Examples:
tcam_policy.c.
open_error_t openapiTcamPolicyCreate ( openapiClientHandle_t clientHandle,
open_tcamApiPolicy_t  policyInfo,
OPEN_TCAM_API_POLICYID_t handle 
)

Create a policy in the hardware directly.

Parameters
[in]clientHandleOpEN client handle
[in]policyInfoInformation about the policy to be created
[out]handleThe handle to be used for subsequent operations on this policy
Return values
OPEN_E_NONEPolicy created successfully
OPEN_E_FAILPolicy creation failure
Note
From OpEN API Version 1.15 onwards, setting resourceTrackingFlag for a given client handle will ensure that the TCAM policy (resource) created in hardware gets freed when the client ceases to exist. openapiClientResourceTrackingSet OpEN API can be used to enable or disable resourceTrackingFlag.
This function was deprecated in API version 1.19. Please use openapiTcamPolicyCreateV2 in new code.

OpEN API Version: 1.2 OpEN API Version: 1.19

Examples:
rx_pkt_example.c, and tcam_example.c.
open_error_t openapiTcamPolicyCreateV2 ( openapiClientHandle_t clientHandle,
open_tcamApiPolicy_v2_t  policyInfo,
OPEN_TCAM_API_POLICYID_t handle 
)

Create a policy in the hardware directly.

Parameters
[in]clientHandleOpEN client handle
[in]policyInfoInformation about the policy to be created
[out]handleThe handle to be used for subsequent operations on this policy
Return values
OPEN_E_NONEPolicy created successfully
OPEN_E_FAILPolicy creation failure
Note
From OpEN API Version 1.15 onwards, setting resourceTrackingFlag for a given client handle will ensure that the TCAM policy (resource) created in hardware gets freed when the client ceases to exist. openapiClientResourceTrackingSet OpEN API can be used to enable or disable resourceTrackingFlag.

OpEN API Version: 1.19

Examples:
tcam_example.c.
open_error_t openapiTcamPolicyDeleteAll ( openapiClientHandle_t clientHandle)

Delete all the policies created by TCAM API.

Parameters
[in]clientHandleOpEN client handle
Return values
OPEN_E_NONEPolicy found
OPEN_E_FAILPolicy could not be found

OpEN API Version: 1.2

Examples:
tcam_example.c.
open_error_t openapiTcamPolicyDestroy ( openapiClientHandle_t clientHandle,
OPEN_TCAM_API_POLICYID_t policyHandle 
)

Delete the policy created.

Parameters
[in]clientHandleOpEN client handle
[in]policyHandleHandle associated with the policy
Return values
OPEN_E_NONEPolicy deleted successfully
OPEN_E_FAILPolicy deletion failure
Note
From OpEN API Version 1.15 onwards, setting resourceTrackingFlag for a given client handle will ensure that the TCAM policy (resource) created in hardware gets freed when the client ceases to exist. openapiClientResourceTrackingSet OpEN API can be used to enable or disable resourceTrackingFlag.

OpEN API Version: 1.2

Examples:
tcam_example.c.
open_error_t openapiTcamPolicyGet ( openapiClientHandle_t clientHandle,
OPEN_TCAM_API_POLICYID_t policyHandle,
open_tcamApiPolicy_t *  policyInfo 
)

Get TCAM policy information from the policy handle provided.

Parameters
[in]clientHandleOpEN client handle
[in]policyHandleHandle associated with the policy
[out]policyInfoInformation about the policy associated with the handle
Return values
OPEN_E_NONEPolicy found
OPEN_E_FAILPolicy could not be found
Note
This function was deprecated in API version 1.19. Please use openapiTcamPolicyGetV2 in new code.

OpEN API Version: 1.2 OpEN API Version: 1.19

Examples:
tcam_example.c.
open_error_t openapiTcamPolicyGetFirst ( openapiClientHandle_t clientHandle,
open_tcamApiPolicy_t *  policyInfo,
OPEN_TCAM_API_POLICYID_t nextPolicyHandle 
)

Get the first TCAM policy information.

Parameters
[in]clientHandleOpEN client handle
[out]policyInfoInformation about the next policy
[out]nextPolicyHandleHandle associated with the retrieved policy
Return values
OPEN_E_NONEPolicy found
OPEN_E_FAILPolicy could not be found
Note
This API returns the first policy created by the TCAM API. There might be other policies created outside the TCAM API but those won't be included in these call.
This function was deprecated in API version 1.19. Please use openapiTcamPolicyGetFirstV2 in new code.

OpEN API Version: 1.2 OpEN API Version: 1.19

open_error_t openapiTcamPolicyGetFirstV2 ( openapiClientHandle_t clientHandle,
open_tcamApiPolicy_v2_t *  policyInfo,
OPEN_TCAM_API_POLICYID_t nextPolicyHandle 
)

Get the first TCAM policy information.

Parameters
[in]clientHandleOpEN client handle
[out]policyInfoInformation about the next policy
[out]nextPolicyHandleHandle associated with the retrieved policy
Return values
OPEN_E_NONEPolicy found
OPEN_E_FAILPolicy could not be found
Note
This API returns the first policy created by the TCAM API. There might be other policies created outside the TCAM API but those won't be included in these call.

OpEN API Version: 1.19

open_error_t openapiTcamPolicyGetNext ( openapiClientHandle_t clientHandle,
OPEN_TCAM_API_POLICYID_t policyHandle,
open_tcamApiPolicy_t *  policyInfo,
OPEN_TCAM_API_POLICYID_t nextPolicyHandle 
)

Get the next TCAM policy information from the policy handle provided.

Parameters
[in]clientHandleOpEN client handle
[in]policyHandleHandle associated with the policy
[out]policyInfoInformation about the next policy
[out]nextPolicyHandleHandle associated with the retrieved policy
Return values
OPEN_E_NONEPolicy found
OPEN_E_FAILPolicy could not be found
Note
This API returns the first policy created by the TCAM API. There might be other policies created outside the TCAM API but those won't be included in these call.
This function was deprecated in API version 1.19. Please use openapiTcamPolicyGetNextV2 in new code.

OpEN API Version: 1.2 OpEN API Version: 1.19

open_error_t openapiTcamPolicyGetNextV2 ( openapiClientHandle_t clientHandle,
OPEN_TCAM_API_POLICYID_t policyHandle,
open_tcamApiPolicy_v2_t *  policyInfo,
OPEN_TCAM_API_POLICYID_t nextPolicyHandle 
)

Get the next TCAM policy information from the policy handle provided.

Parameters
[in]clientHandleOpEN client handle
[in]policyHandleHandle associated with the policy
[out]policyInfoInformation about the next policy
[out]nextPolicyHandleHandle associated with the retrieved policy
Return values
OPEN_E_NONEPolicy found
OPEN_E_FAILPolicy could not be found
Note
This API returns the first policy created by the TCAM API. There might be other policies created outside the TCAM API but those won't be included in these call.

OpEN API Version: 1.19

open_error_t openapiTcamPolicyGetV2 ( openapiClientHandle_t clientHandle,
OPEN_TCAM_API_POLICYID_t policyHandle,
open_tcamApiPolicy_v2_t *  policyInfo 
)

Get TCAM policy information from the policy handle provided.

Parameters
[in]clientHandleOpEN client handle
[in]policyHandleHandle associated with the policy
[out]policyInfoInformation about the policy associated with the handle
Return values
OPEN_E_NONEPolicy found
OPEN_E_FAILPolicy could not be found

OpEN API Version: 1.19

open_error_t openapiTcamPolicyIntfAdd ( openapiClientHandle_t clientHandle,
OPEN_TCAM_API_POLICYID_t policyHandle,
uint32_t  intf 
)

Add the TCAM policy to the list of interfaces provided.

This should be done after the policy handle has been created with openapiTcamPolicyCreate().

Parameters
[in]clientHandleOpEN client handle
[in]policyHandleHandle associated with the policy
[in]intfInterface to be added
Return values
OPEN_E_NONEPolicy added to all the interfaces listed
OPEN_E_FAILPolicy could not be added to interfaces
Note
The interfaces should be listed as separated by a comma (,) or hyphen (-) for contiguous range

OpEN API Version: 1.2

Examples:
rx_pkt_example.c, and tcam_example.c.
open_error_t openapiTcamPolicyIntfAllAdd ( openapiClientHandle_t clientHandle,
OPEN_TCAM_API_POLICYID_t policyHandle 
)

Add the TCAM policy to all interfaces.

Parameters
[in]clientHandleOpEN client handle
[in]policyHandleHandle associated with the policy
Return values
OPEN_E_NONEPolicy added to all the interfaces
OPEN_E_FAILPolicy could not be added to interfaces
Note
This should be done after the policy handle has been created with openapiTcamPolicyCreate().

OpEN API Version: 1.14

Examples:
tcam_example.c.
open_error_t openapiTcamPolicyIntfRem ( openapiClientHandle_t clientHandle,
OPEN_TCAM_API_POLICYID_t policyHandle,
uint32_t  intf 
)

Remove TCAM policy from the list of interfaces provided.

Parameters
[in]clientHandleOpEN client handle
[in]policyHandleHandle associated with the policy
[in]intfInterface to be removed
Return values
OPEN_E_NONEPolicy removed from all the interfaces listed
OPEN_E_FAILPolicy could not be removed from at least one of the interfaces.
Note
The interfaces should be listed as separated by a comma (,) or hyphen (-) for contiguous range

OpEN API Version: 1.2

Examples:
tcam_example.c.
open_error_t openapiTcamPolicyMeteringStatsGet ( openapiClientHandle_t clientHandle,
OPEN_TCAM_API_POLICYID_t policyHandle,
uint64_t *  inProf,
uint64_t *  outProf 
)

Get TCAM policy statistics for the policy handle provided.

Parameters
[in]clientHandleOpEN client handle
[in]policyHandleHandle associated with the policy
[out]inProfin-profile metering stats of policy
[out]outProfout-profile metering stats of policy
Return values
OPEN_E_NONEPolicy stats retrieved successfully
OPEN_E_FAILPolicy stats retrieval failed

OpEN API Version: 1.14

Examples:
tcam_example.c.
open_error_t openapiTcamPolicyStatsClear ( openapiClientHandle_t clientHandle,
OPEN_TCAM_API_POLICYID_t policyHandle 
)

Clear TCAM policy statistics for the policy handle provided.

Parameters
[in]clientHandleOpEN client handle
[in]policyHandleHandle associated with the policy
Return values
OPEN_E_NONEPolicy stats cleared successfully
OPEN_E_FAILPolicy stats clear failed

OpEN API Version: 1.14

Examples:
tcam_example.c.

Variable Documentation

Bitmap of the actions that should be applied

Definition at line 270 of file openapi_tcam.h.

OPEN_TCAM_ACTION_t actionVal

Values to be used by the actions

Definition at line 272 of file openapi_tcam.h.

uint32_t policyPrio

Priority of the policy compared to other policies

Definition at line 237 of file openapi_tcam.h.

Policy type. Where the policy should be applied

Examples:
rx_pkt_example.c, and tcam_example.c.

Definition at line 235 of file openapi_tcam.h.

OPEN_PACKED_STRUCT tcamApiPolicy_s
Initial value:
{
Header that goes on the front of each policy.
Definition: openapi_tcam.h:184

Structure that contains the full TCAM API policy: headers, match values and action.

Policy header. This must be filled in

Definition at line 231 of file openapi_tcam.h.

OPEN_PACKED_STRUCT tcamApiPolicy_v2_s
Initial value:
{
Header that goes on the front of each policy.
Definition: openapi_tcam.h:184

Structure that contains the full TCAM API policy: headers, match values and action.

Policy header. This must be filled in

Definition at line 284 of file openapi_tcam.h.