|
Open Ethernet Networking (OpEN) API Guide and Reference Manual
3.4.4.5
|
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. | |
| #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 | |
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. | |
| open_error_t | openapiExtAgentPktUnregister (uint32_t agentId) |
| Unregister an External Packet Transmit/Receive Agent. | |
| open_error_t | openapiTcamApiFini (openapiClientHandle_t *clientHandle) |
| Uninitialize the TCAM API and return its resources. | |
| open_error_t | openapiTcamApiInit (openapiClientHandle_t *clientHandle) |
| Initialize the TCAM API. | |
| open_error_t | openapiTcamApiVersionGet (openapiClientHandle_t *clientHandle, open_tcam_version_t *version) |
| Get the version supported by the current API. | |
| 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. | |
| 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. | |
| open_error_t | openapiTcamPolicyCreate (openapiClientHandle_t *clientHandle, open_tcamApiPolicy_t policyInfo, OPEN_TCAM_API_POLICYID_t *handle) |
| Create a policy in the hardware directly. | |
| open_error_t | openapiTcamPolicyDeleteAll (openapiClientHandle_t *clientHandle) |
| Delete all the policies created by TCAM API. | |
| open_error_t | openapiTcamPolicyDestroy (openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle) |
| Delete the policy created. | |
| 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. | |
| open_error_t | openapiTcamPolicyGetFirst (openapiClientHandle_t *clientHandle, open_tcamApiPolicy_t *policyInfo, OPEN_TCAM_API_POLICYID_t *nextPolicyHandle) |
| Get the first TCAM policy information. | |
| 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. | |
| 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. | |
| open_error_t | openapiTcamPolicyIntfAllAdd (openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle) |
| Add the TCAM policy to all interfaces. | |
| 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. | |
| 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. | |
| open_error_t | openapiTcamPolicyStatsClear (openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle) |
| Clear TCAM policy statistics for the policy handle provided. | |
Variables | |
| OPEN_TCAM_POLICY_ACTION_t | actionType |
| OPEN_TCAM_ACTION_t | actionVal |
| 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 | |
| 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. | |
| #define TCAM_API_DEBUG | ( | dbgLvl, | |
| 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 to describe where the policy should apply.
Definition at line 163 of file openapi_tcam.h.
Enumeration of debug flags.
Definition at line 74 of file openapi_tcam.h.
| open_error_t openapiExtAgentPktRegister | ( | uint32_t | agentId, |
| open_buffdesc * | agentName, | ||
| uint32_t | flags | ||
| ) |
Register an External Packet Transmit/Receive Agent.
| [in] | agentId | Unique Agent Id. The acceptable range of Agent Ids can be retrieved using usmDbExtAgentIdRangeGet API. |
| [in] | agentName | Name of the receive agent. |
| [in] | flags | OPEN_TCAM_EXT_AGENT_PKT_TRANSMIT: Register as external transmit agent OPEN_TCAM_EXT_AGENT_PKT_RECEIVE: Register as external receive agent |
| OPEN_E_NONE | Agent registered successfully OPEN_E_EXISTS: Agent with the given id is already registered OPEN_E_FAIL: Other failures |
OpEN API Version: 1.2
| open_error_t openapiExtAgentPktUnregister | ( | uint32_t | agentId | ) |
Unregister an External Packet Transmit/Receive Agent.
| [in] | agentId | Id to uniquely identify agent |
| OPEN_E_NONE | Agent unregistered successfully OPEN_E_FAIL: Invalid agentId passed |
OpEN API Version: 1.2
| open_error_t openapiTcamApiFini | ( | openapiClientHandle_t * | clientHandle | ) |
Uninitialize the TCAM API and return its resources.
| [in] | clientHandle | OpEN client handle |
| OPEN_E_NONE | Unintialize succeeded and resources returned |
| OPEN_E_FAIL | Fini failed |
OpEN API Version: 1.2
| open_error_t openapiTcamApiInit | ( | openapiClientHandle_t * | clientHandle | ) |
Initialize the TCAM API.
| [in] | clientHandle | OpEN client handle |
| OPEN_E_NONE | API initialized successfully |
| OPEN_E_FAIL | Error encountered in TCAM API initialization |
OpEN API Version: 1.2
| open_error_t openapiTcamApiVersionGet | ( | openapiClientHandle_t * | clientHandle, |
| open_tcam_version_t * | version | ||
| ) |
Get the version supported by the current API.
| [in] | clientHandle | OpEN client handle |
| [out] | version | version structure with version information populated |
| OPEN_E_NONE | Version returned. |
| OPEN_E_PARAM | Insufficient string size provided. |
OpEN API Version: 1.2
| 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.
| [in] | client_handle | OpEN client handle |
| [in,out] | unit | On stackable platforms specifies the stack unit ID. Always returns 1 on non-stacking platforms. |
| [in,out] | asic_id | On multi-ASIC units specifies the ASIC number on a unit. Always returns 0 on units with one ASIC. |
| [in,out] | stage | TCAM Stage |
| [in,out] | group_id | Group ID to search for |
| [out] | group_usage | Hardware group usage info. |
| OPEN_E_NONE | Hardware Group Found. |
| OPEN_E_NOT_FOUND | Hardware Group was not found. |
OpEN API Version: 1.13
| 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.
| [in] | client_handle | OpEN client handle |
| [in,out] | unit | On stackable platforms specifies the stack unit ID. Always returns 1 on non-stacking platforms. |
| [in,out] | asic_id | On multi-ASIC units specifies the ASIC number on a unit. Always returns 0 on units with one ASIC. |
| [in,out] | policy_id | Policy ID to search for |
| [out] | tcam_usage | Hardware policy usage info. |
| OPEN_E_NONE | Policy is found. |
| OPEN_E_NOT_FOUND | Next policy is not found. |
OpEN API Version: 1.13
| open_error_t openapiTcamPolicyCreate | ( | openapiClientHandle_t * | clientHandle, |
| open_tcamApiPolicy_t | policyInfo, | ||
| OPEN_TCAM_API_POLICYID_t * | handle | ||
| ) |
Create a policy in the hardware directly.
| [in] | clientHandle | OpEN client handle |
| [in] | policyInfo | Information about the policy to be created |
| [out] | handle | The handle to be used for subsequent operations on this policy |
| OPEN_E_NONE | Policy created successfully |
| OPEN_E_FAIL | Policy creation failure |
OpEN API Version: 1.2
| open_error_t openapiTcamPolicyDeleteAll | ( | openapiClientHandle_t * | clientHandle | ) |
Delete all the policies created by TCAM API.
| [in] | clientHandle | OpEN client handle |
| OPEN_E_NONE | Policy found |
| OPEN_E_FAIL | Policy could not be found |
OpEN API Version: 1.2
| open_error_t openapiTcamPolicyDestroy | ( | openapiClientHandle_t * | clientHandle, |
| OPEN_TCAM_API_POLICYID_t * | policyHandle | ||
| ) |
Delete the policy created.
| [in] | clientHandle | OpEN client handle |
| [in] | policyHandle | Handle associated with the policy |
| OPEN_E_NONE | Policy deleted successfully |
| OPEN_E_FAIL | Policy deletion failure |
OpEN API Version: 1.2
| 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.
| [in] | clientHandle | OpEN client handle |
| [in] | policyHandle | Handle associated with the policy |
| [out] | policyInfo | Information about the policy associated with the handle |
| OPEN_E_NONE | Policy found |
| OPEN_E_FAIL | Policy could not be found |
OpEN API Version: 1.2
| open_error_t openapiTcamPolicyGetFirst | ( | openapiClientHandle_t * | clientHandle, |
| open_tcamApiPolicy_t * | policyInfo, | ||
| OPEN_TCAM_API_POLICYID_t * | nextPolicyHandle | ||
| ) |
Get the first TCAM policy information.
| [in] | clientHandle | OpEN client handle |
| [out] | policyInfo | Information about the next policy |
| [out] | nextPolicyHandle | Handle associated with the retrieved policy |
| OPEN_E_NONE | Policy found |
| OPEN_E_FAIL | Policy could not be found |
OpEN API Version: 1.2
| 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.
| [in] | clientHandle | OpEN client handle |
| [in] | policyHandle | Handle associated with the policy |
| [out] | policyInfo | Information about the next policy |
| [out] | nextPolicyHandle | Handle associated with the retrieved policy |
| OPEN_E_NONE | Policy found |
| OPEN_E_FAIL | Policy could not be found |
OpEN API Version: 1.2
| 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().
| [in] | clientHandle | OpEN client handle |
| [in] | policyHandle | Handle associated with the policy |
| [in] | intf | Interface to be added |
| OPEN_E_NONE | Policy added to all the interfaces listed |
| OPEN_E_FAIL | Policy could not be added to interfaces |
OpEN API Version: 1.2
| open_error_t openapiTcamPolicyIntfAllAdd | ( | openapiClientHandle_t * | clientHandle, |
| OPEN_TCAM_API_POLICYID_t * | policyHandle | ||
| ) |
Add the TCAM policy to all interfaces.
| [in] | clientHandle | OpEN client handle |
| [in] | policyHandle | Handle associated with the policy |
| OPEN_E_NONE | Policy added to all the interfaces |
| OPEN_E_FAIL | Policy could not be added to interfaces |
OpEN API Version: 1.14
| 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.
| [in] | clientHandle | OpEN client handle |
| [in] | policyHandle | Handle associated with the policy |
| [in] | intf | Interface to be removed |
| OPEN_E_NONE | Policy removed from all the interfaces listed |
| OPEN_E_FAIL | Policy could not be removed from at least one of the interfaces. |
OpEN API Version: 1.2
| 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.
| [in] | clientHandle | OpEN client handle |
| [in] | policyHandle | Handle associated with the policy |
| [out] | inProf | in-profile metering stats of policy |
| [out] | outProf | out-profile metering stats of policy |
| OPEN_E_NONE | Policy stats retrieved successfully |
| OPEN_E_FAIL | Policy stats retrieval failed |
OpEN API Version: 1.14
| open_error_t openapiTcamPolicyStatsClear | ( | openapiClientHandle_t * | clientHandle, |
| OPEN_TCAM_API_POLICYID_t * | policyHandle | ||
| ) |
Clear TCAM policy statistics for the policy handle provided.
| [in] | clientHandle | OpEN client handle |
| [in] | policyHandle | Handle associated with the policy |
| OPEN_E_NONE | Policy stats cleared successfully |
| OPEN_E_FAIL | Policy stats clear failed |
OpEN API Version: 1.14
| OPEN_TCAM_POLICY_ACTION_t actionType |
Bitmap of the actions that should be applied
Definition at line 271 of file openapi_tcam.h.
| OPEN_TCAM_ACTION_t actionVal |
Values to be used by the actions
Definition at line 273 of file openapi_tcam.h.
| uint32_t policyPrio |
Priority of the policy compared to other policies
Definition at line 238 of file openapi_tcam.h.
| OPEN_TCAM_POLICY_TYPE_t policyType |
Policy type. Where the policy should be applied
Definition at line 236 of file openapi_tcam.h.
| OPEN_PACKED_STRUCT tcamApiPolicy_s |
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.