39 #ifndef OPENAPI_TCAM_H_INCLUDED
40 #define OPENAPI_TCAM_H_INCLUDED
59 #define TCAM_MAC_ADDR_LEN 6
62 #define OPEN_TCAM_API_CURR_VER_MAJOR 0
64 #define OPEN_TCAM_API_CURR_VER_MINOR 1
67 #define OPEN_TCAM_API_POLICYID_INVALID 0
70 #define OPEN_TCAM_POLICY_RULE_PRIORITY_LOWEST 0
71 #define OPEN_TCAM_POLICY_RULE_PRIORITY_DEFAULT 1
84 #define TCAM_API_DEBUG(dbgLvl, args...) {\
85 if (tcamApiDebugFlag >= dbgLvl) \
87 SYSAPI_PRINTF(SYSAPI_LOGGING_ALWAYS,args);\
92 #define OPEN_TXRX_MAX_FRAME_SIZE 9216
94 #define OPEN_TCAM_EXT_AGENT_PKT_TRANSMIT (0x1)
96 #define OPEN_TCAM_EXT_AGENT_PKT_RECEIVE (0x2)
108 uint32_t destIntIfNum;
126 unsigned char vlanPrio;
133 #define OPEN_TCAM_ACTION_NONE 0
135 #define OPEN_TCAM_ACTION_DROP 1
137 #define OPEN_TCAM_ACTION_REDIRECT 2
139 #define OPEN_TCAM_ACTION_OUTERVLAN 4
141 #define OPEN_TCAM_ACTION_SRCMAC_NEW 8
143 #define OPEN_TCAM_ACTION_DSTMAC_NEW 16
145 #define OPEN_TCAM_ACTION_USERPRIO 32
147 #define OPEN_TCAM_ACTION_OUTERTPID_NEW 64
149 #define OPEN_TCAM_ACTION_REDIRECT_CPU 128
152 #define OPEN_PT_MATCH_RULE_NUM 61
154 #define OPEN_CPU_RATE_LIMIT 5
155 #define OPEN_CPU_RATE_LIMIT_BURST 5
194 OPEN_METER_COLOR_BLIND,
195 OPEN_METER_COLOR_AWARE
196 } OPEN_METER_COLOR_MODE_t;
214 OPEN_METER_COLOR_MODE_t colorMode;
215 OPEN_METER_MODE_t meterMode;
218 #define OPEN_COUNT_PACKETS 0x1
219 #define OPEN_COUNT_BYTES 0x2
245 uint16_t matchVlanVal;
246 unsigned char matchVlanPrio;
247 uint16_t matchEthType;
249 uint32_t matchDstIpMask;
251 uint32_t matchSrcIpMask;
252 uint32_t matchIpProto;
253 uint32_t matchIpProtoMask;
254 uint32_t matchL4Sport;
255 uint32_t matchL4SportMask;
256 uint32_t matchL4Dport;
257 uint32_t matchL4DportMask;
258 uint32_t matchIpDscp;
259 unsigned char matchIpDscpMask;
260 uint16_t matchSrcPortIcmpType;
261 uint16_t matchSrcPortIcmpTypeMask;
262 uint16_t matchDstPortIcmpCode;
263 uint16_t matchDstPortIcmpCodeMask;
277 uint8_t meterPresent;
278 } open_tcamApiPolicy_t;
298 uint16_t matchVlanVal;
299 unsigned char matchVlanPrio;
300 uint16_t matchEthType;
302 uint32_t matchDstIpMask;
304 uint32_t matchSrcIpMask;
305 uint32_t matchIpProto;
306 uint32_t matchIpProtoMask;
307 uint32_t matchL4Sport;
308 uint32_t matchL4SportMask;
309 uint32_t matchL4Dport;
310 uint32_t matchL4DportMask;
311 uint32_t matchIpDscp;
312 unsigned char matchIpDscpMask;
313 uint16_t matchSrcPortIcmpType;
314 uint16_t matchSrcPortIcmpTypeMask;
315 uint16_t matchDstPortIcmpCode;
316 uint16_t matchDstPortIcmpCodeMask;
321 unsigned char matchCpuVisibility;
322 unsigned char matchCpuVisibilityMask;
332 uint8_t meterPresent;
333 } open_tcamApiPolicy_v2_t;
355 #define OPEN_TCAM_POLICY_NAME_SIZE 64
357 #define OPEN_TCAM_STAGE_LOOKUP 1
358 #define OPEN_TCAM_STAGE_INGRESS 2
359 #define OPEN_TCAM_STAGE_EGRESS 3
363 typedef struct open_tcamHardwarePolicyUsage_s
429 open_tcamApiPolicy_t policyInfo,
518 open_tcamApiPolicy_t *policyInfo);
542 open_tcamApiPolicy_t *policyInfo,
569 open_tcamApiPolicy_t *policyInfo,
738 uint64_t *inProf, uint64_t *outProf);
778 open_tcamApiPolicy_v2_t policyInfo,
798 open_tcamApiPolicy_v2_t *policyInfo);
819 open_tcamApiPolicy_v2_t *policyInfo,
843 open_tcamApiPolicy_v2_t *policyInfo,
open_error_t openapiTcamPolicyDeleteAll(openapiClientHandle_t *clientHandle)
Delete all the policies created by TCAM API.
Hardware TCAM Policy Usage Information.
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_TCAM_POLICY_TYPE_t
Enumeration to describe where the policy should apply.
open_error_t openapiTcamApiInit(openapiClientHandle_t *clientHandle)
Initialize the TCAM API.
OPEN_TCAM_ACTION_t actionVal
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.
open_error_t openapiTcamApiFini(openapiClientHandle_t *clientHandle)
Uninitialize the TCAM API and return its resources.
uint32_t in_use_rules
Number of rules currently used in the hardware group.
open_error_t openapiTcamPolicyGetFirstV2(openapiClientHandle_t *clientHandle, open_tcamApiPolicy_v2_t *policyInfo, OPEN_TCAM_API_POLICYID_t *nextPolicyHandle)
Get the first TCAM policy information.
uint32_t total_counters
Total counters available for the hardware group.
open_error_t openapiTcamPolicyDestroy(openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle)
Delete the policy created.
uint32_t total_rules
Total number of rules that can be added to the hardware group.
open_error_t
OPEN uses these enumerators to indicate the error codes.
#define OPEN_TCAM_POLICY_NAME_SIZE
Maximum number of characters in the policy name.
open_error_t openapiExtAgentPktUnregister(uint32_t agentId)
Unregister an External Packet Transmit/Receive Agent.
open_error_t openapiTcamApiVersionGet(openapiClientHandle_t *clientHandle, open_tcam_version_t *version)
Get the version supported by the current API.
uint32_t total_rules
Total number of rules that can be added to the hardware group.
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 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 openapiTcamPolicyCreateV2(openapiClientHandle_t *clientHandle, open_tcamApiPolicy_v2_t policyInfo, OPEN_TCAM_API_POLICYID_t *handle)
Create a policy in the hardware directly.
struct tcam_api_policyHeader_s tcam_api_policyHeader_t
Header that goes on the front of each policy.
uint32_t OPEN_TCAM_POLICY_ACTION_t
Type for Policy actions.
open_error_t openapiExtAgentPktRegister(uint32_t agentId, open_buffdesc *agentName, uint32_t flags)
Register an External Packet Transmit/Receive Agent.
uint32_t natural_depth
Number of rules when slice depth is one.
uint32_t in_use_meters
Number of meters currently used in the hardware group.
#define TCAM_MAC_ADDR_LEN
The typical sequence is: openapiTcamApiInit() to initialize the TCAM API repeat openapiTcamPolicyCr...
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.
TCAM_API_DEBUG_FLAG_t
Enumeration of debug flags.
Version information for the TCAM API.
OPEN_PACKED_STRUCT tcamApiPolicy_v2_s
Structure that contains the full TCAM API policy: headers, match values and action.
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.
uint32_t hardware_group
The group in the TCAM to which this policy belongs.
OPEN_PACKED_STRUCT tcamApiPolicy_s
Structure that contains the full TCAM API policy: headers, match values and action.
open_error_t openapiTcamPolicyGetFirst(openapiClientHandle_t *clientHandle, open_tcamApiPolicy_t *policyInfo, OPEN_TCAM_API_POLICYID_t *nextPolicyHandle)
Get the first TCAM policy information.
struct open_tcamHardwareGroupUsage_s open_tcamHardwareGroupUsage_t
Hardware TCAM group usage information.
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_TCAM_POLICY_TYPE_t policyType
struct open_tcamHardwarePolicyUsage_s open_tcamHardwarePolicyUsage_t
Hardware TCAM Policy Usage Information.
uint32_t total_meters
Total meters available for the hardware group.
uint32_t OPEN_TCAM_API_POLICYID_t
Type for Policy IDs.
OPEN_TCAM_POLICY_ACTION_t actionType
OPEN_PACKED_STRUCT
MPLS LFDB entry information.
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.
uint32_t slice_width_physical
Slice width of group based on physical slices.
uint32_t in_use_rules
Number of rules currently used in the hardware group.
uint32_t intraslice_mode_enable
Indicates if intraslice mode is enabled.
uint32_t rxUntagged
Parameter to specify whether the packet ingressing on physical port is having VLAN tag or not...
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 openapiTcamPolicyIntfRem(openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle, uint32_t intf)
Remove TCAM policy from the list of interfaces provided.
uint32_t num_policy_rules
Number of rules in this policy.
uint32_t hardware_stage
In which TCAM the policy is installed.
Structure to define the action that should be taken.
open_error_t openapiTcamPolicyIntfAllAdd(openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle)
Add the TCAM policy to all interfaces.
uint32_t in_use_counters
Number of counters currently used in the hardware group.
Hardware TCAM group usage information.
open_error_t openapiTcamPolicyStatsClear(openapiClientHandle_t *clientHandle, OPEN_TCAM_API_POLICYID_t *policyHandle)
Clear TCAM policy statistics for the policy handle provided.