PDK API Guide for J721E
ALE Handler and Driver API

Introduction

The ALE Driver provides low level access to switch configuration

Following features are supported:

Sub Modules

 ALE Configuration Definitions
 
 ALE ENUMS
 
 ALE IOCTLS
 
 ALE OPENPARAMS
 

Enumerations

enum  CPSW_ALE_FWDSTLVL_E { CPSW_ALE_FWDSTLVL_FORWARDING = 0, CPSW_ALE_FWDSTLVL_BLK_FWD_LRN = 1, CPSW_ALE_FWDSTLVL_FWD_LRN = 2 }
 
enum  CPSW_ALE_POLICER_YELLOWTHRESH_E {
  CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_100, CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_50, CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_33, CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_25,
  CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_20, CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_17, CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_14, CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_13
}
 Yellow Threshold Value. More...
 
enum  CPSW_ALE_POLICER_NOMATCH_MODE_E { CPSW_ALE_POLICER_NOMATCH_MODE_GREEN, CPSW_ALE_POLICER_NOMATCH_MODE_YELLOW, CPSW_ALE_POLICER_NOMATCH_MODE_RED, CPSW_ALE_POLICER_NOMATCH_MODE_UNREGULATED_TRAFFIC_POLICER }
 Policing Match Mode. More...
 
enum  CPSW_ALE_PORTSTATE_E { CPSW_ALE_PORTSTATE_DISABLED = 0, CPSW_ALE_PORTSTATE_BLOCKED, CPSW_ALE_PORTSTATE_LEARN, CPSW_ALE_PORTSTATE_FORWARD }
 Defines ALE port states. More...
 
enum  CPSW_ALE_IPADDR_CLASSIFIER_E { CPSW_ALE_IPADDR_CLASSIFIER_IPV4 = 0x00U, CPSW_ALE_IPADDR_CLASSIFIER_IPV6 = 0x01U }
 Defines IP address classifier type. More...
 
enum  CPSW_ALE_TBLENTRYTYPE_E {
  CPSW_ALE_TBLENTRYTYPE_ADDR, CPSW_ALE_TBLENTRYTYPE_VLAN, CPSW_ALE_TBLENTRYTYPE_ETHERTYPE, CPSW_ALE_TBLENTRYTYPE_OUI,
  CPSW_ALE_TBLENTRYTYPE_IPV4, CPSW_ALE_TBLENTRYTYPE_IPV6
}
 Defines IP address classifier type. More...
 
enum  CPSW_ALE_RXFILTER_E {
  CPSW_ALE_RXFILTER_NOTHING = 0x0000U, CPSW_ALE_RXFILTER_DIRECT = 0x0001U, CPSW_ALE_RXFILTER_BROADCAST = 0x0002U, CPSW_ALE_RXFILTER_MULTICAST = 0x0003U,
  CPSW_ALE_RXFILTER_ALLMULTICAST = 0x0004U, CPSW_ALE_RXFILTER_ALL = 0x0005U
}
 Packet Filtering Settings (cumulative) More...
 

Macros

#define CPSW_ALE_NUM_PORTS   ((uint32_t)9)
 Number of switch ports in the subsystem. More...
 
#define CPSW_ALE_NUM_MAC_PORTS   (CPSW_ALE_NUM_PORTS - 1U)
 Number of external ports in the subsystem. More...
 
#define CPSW_ALE_MAX_WHITELIST_IP_NXT_HDR   (4U)
 Maximum IP next header whilelist. More...
 
#define CPSW_ALE_ALL_PORTS_MASK   ((1U << CPSW_ALE_NUM_PORTS) - 1U)
 Mask value for the all the PORTS. More...
 
#define CPSW_ALE_ALL_MACPORTS_MASK   (((1U << CPSW_ALE_NUM_PORTS) - 1U) - 1U)
 Mask value for the all MAC PORTS. More...
 
#define CPSW_ALE_HOST_PORT_MASK   (0x1U)
 Mask value for the host PORT. More...
 
#define CPSW_ALE_HOST_PORT_NUM   (0x0U)
 Port number for the host PORT. More...
 
#define CPSW_ALE_MCAST_IGN_BITS_MAX   (10U)
 Maximum number of ignore bits in multicast address. More...
 
#define CPSW_ALE_MACADDR_NUM_OCTETS   (CPSW_MAC_ADDR_LEN)
 Num of octets in MAC address. More...
 
#define CPSW_ALE_OUIADDR_NUM_OCTETS   (3U)
 Number of octets in OUI address. More...
 
#define CPSW_ALE_IPV4ADDR_NUM_OCTETS   (4U)
 Number of octets in IPV4 address. More...
 
#define CPSW_ALE_IPV6ADDR_NUM_OCTETS   (16U)
 Number of octets in IPV6 address. More...
 
#define CPSW_ALE_PEAKBITRATE_DISABLE   (0U)
 Disable peak bit rate. More...
 
#define CPSW_ALE_COMMITBITRATE_DISABLE   (0U)
 Disable commit bit rate. More...
 
#define CPSW_ALE_THREADID_INVALID   (~0U)
 ALE invalid thread id. More...
 
#define CPSW_ALE_MACPORT_BASE   (1U)
 Base index for MAC ports in ALE context. More...
 
#define CPSW_ALE_MACPORT_TO_ALEPORT(macPortNum)   (CPSW_NORMALIZE_MACPORT(macPortNum) + CPSW_ALE_MACPORT_BASE)
 Macro to convert MAC port (Cpsw_MacPort) to ALE port number. More...
 
#define CPSW_ALE_ALEPORT_TO_MACPORT(alePortNum)   (CPSW_DENORMALIZE_MACPORT(alePortNum - CPSW_ALE_MACPORT_BASE))
 Macro to convert ALE port number to MAC port number(Cpsw_MacPort) More...
 
#define CPSW_ALE_MACPORT_TO_PORTMASK(macPortNum)   CPSW_SET_BIT(CPSW_ALE_MACPORT_TO_ALEPORT(macPortNum))
 Macro to convert MAC port (Cpsw_MacPort) to ALE port mask. More...
 
#define CPSW_ALE_PUBLIC_IOCTL(x)   (CPSW_IOCTL_ALE_BASE | CPSW_IOCTL_MIN(x))
 Helper macro to create IOCTL commands for ALE submodule. More...
 

ALE classifier match types

Classifier match type supported by ALE. Each type is represented by a bit To enable multiple classifiers in a single classifier entry, create bitmask ORing required classifier match type defines

#define CPSW_ALE_POLICER_MATCH_PORT   (CPSW_SET_BIT(0U))
 
#define CPSW_ALE_POLICER_MATCH_PRIORITY   (CPSW_SET_BIT(1U))
 
#define CPSW_ALE_POLICER_MATCH_OUI   (CPSW_SET_BIT(2U))
 
#define CPSW_ALE_POLICER_MATCH_MACDST   (CPSW_SET_BIT(3U))
 
#define CPSW_ALE_POLICER_MATCH_MACSRC   (CPSW_SET_BIT(4U))
 
#define CPSW_ALE_POLICER_MATCH_OVLAN   (CPSW_SET_BIT(5U))
 
#define CPSW_ALE_POLICER_MATCH_IVLAN   (CPSW_SET_BIT(6U))
 
#define CPSW_ALE_POLICER_MATCH_ETHERTYPE   (CPSW_SET_BIT(7U))
 
#define CPSW_ALE_POLICER_MATCH_IPSRC   (CPSW_SET_BIT(8U))
 
#define CPSW_ALE_POLICER_MATCH_IPDST   (CPSW_SET_BIT(9U))
 

ALE classifier aleEntry delete bitmask

Associated with some classifier types are ALE table entries. When deleting the classifier entry application needs to specify by means of below bitmask if the ALE entry associated with the classifier should also be deleted. If not set the ALE entry will remain.

#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_OUI   (CPSW_ALE_POLICER_MATCH_PRIORITY)
 Delete OUI ALE table entry. More...
 
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_MACSRC   (CPSW_ALE_POLICER_MATCH_MACSRC)
 Delete MAC source address ALE table entry. More...
 
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_MACDST   (CPSW_ALE_POLICER_MATCH_MACDST)
 Delete MAC destination address ALE table entry. More...
 
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_IVLAN   (CPSW_ALE_POLICER_MATCH_IVLAN)
 Delete InnerVLAN classifier associated ALE table entry. More...
 
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_OVLAN   (CPSW_ALE_POLICER_MATCH_OVLAN)
 Delete OuterVLAN classifier associated ALE table entry. More...
 
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_ETHERTYPE   (CPSW_ALE_POLICER_MATCH_ETHERTYPE)
 Delete EtherType classifier associated ALE table entry. More...
 
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_IPSRC   (CPSW_ALE_POLICER_MATCH_IPSRC)
 Delete IPv4/IPv6 source address classifier associated ALE table entry. More...
 
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_IPDST   (CPSW_ALE_POLICER_MATCH_IPDST)
 Delete IPv4/IPv6 destination address classifier associated ALE table entry. More...
 
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_ALL
 Delete all ale entries associated with classifier entries. More...
 

Macro Definition Documentation

#define CPSW_ALE_NUM_PORTS   ((uint32_t)9)

Number of switch ports in the subsystem.

#define CPSW_ALE_NUM_MAC_PORTS   (CPSW_ALE_NUM_PORTS - 1U)

Number of external ports in the subsystem.

#define CPSW_ALE_MAX_WHITELIST_IP_NXT_HDR   (4U)

Maximum IP next header whilelist.

#define CPSW_ALE_ALL_PORTS_MASK   ((1U << CPSW_ALE_NUM_PORTS) - 1U)

Mask value for the all the PORTS.

#define CPSW_ALE_ALL_MACPORTS_MASK   (((1U << CPSW_ALE_NUM_PORTS) - 1U) - 1U)

Mask value for the all MAC PORTS.

#define CPSW_ALE_HOST_PORT_MASK   (0x1U)

Mask value for the host PORT.

#define CPSW_ALE_HOST_PORT_NUM   (0x0U)

Port number for the host PORT.

#define CPSW_ALE_MCAST_IGN_BITS_MAX   (10U)

Maximum number of ignore bits in multicast address.

#define CPSW_ALE_MACADDR_NUM_OCTETS   (CPSW_MAC_ADDR_LEN)

Num of octets in MAC address.

#define CPSW_ALE_OUIADDR_NUM_OCTETS   (3U)

Number of octets in OUI address.

#define CPSW_ALE_IPV4ADDR_NUM_OCTETS   (4U)

Number of octets in IPV4 address.

#define CPSW_ALE_IPV6ADDR_NUM_OCTETS   (16U)

Number of octets in IPV6 address.

#define CPSW_ALE_PEAKBITRATE_DISABLE   (0U)

Disable peak bit rate.

#define CPSW_ALE_COMMITBITRATE_DISABLE   (0U)

Disable commit bit rate.

#define CPSW_ALE_THREADID_INVALID   (~0U)

ALE invalid thread id.

#define CPSW_ALE_POLICER_MATCH_PORT   (CPSW_SET_BIT(0U))

Enable classifier match with PORT number

#define CPSW_ALE_POLICER_MATCH_PRIORITY   (CPSW_SET_BIT(1U))

Enable classifier match with received packet priority

#define CPSW_ALE_POLICER_MATCH_OUI   (CPSW_SET_BIT(2U))

Enable classifier match with OUI portion of source MAC address

#define CPSW_ALE_POLICER_MATCH_MACDST   (CPSW_SET_BIT(3U))

Enable classifier match with MAC destination address entry with/without VLAN

#define CPSW_ALE_POLICER_MATCH_MACSRC   (CPSW_SET_BIT(4U))

Enable classifier match with MAC source address entry with/without VLAN

#define CPSW_ALE_POLICER_MATCH_OVLAN   (CPSW_SET_BIT(5U))

Enable classifier match with outer VLAN entry

#define CPSW_ALE_POLICER_MATCH_IVLAN   (CPSW_SET_BIT(6U))

Enable classifier match with inner VLAN entry

#define CPSW_ALE_POLICER_MATCH_ETHERTYPE   (CPSW_SET_BIT(7U))

Enable classifier match with Ethertype

#define CPSW_ALE_POLICER_MATCH_IPSRC   (CPSW_SET_BIT(8U))

Enable classifier match with IPv4/IPv6 source address

#define CPSW_ALE_POLICER_MATCH_IPDST   (CPSW_SET_BIT(9U))

Enable classifier match with IPv4/IPv6 destination address

#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_OUI   (CPSW_ALE_POLICER_MATCH_PRIORITY)

Delete OUI ALE table entry.

#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_MACSRC   (CPSW_ALE_POLICER_MATCH_MACSRC)

Delete MAC source address ALE table entry.

#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_MACDST   (CPSW_ALE_POLICER_MATCH_MACDST)

Delete MAC destination address ALE table entry.

#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_IVLAN   (CPSW_ALE_POLICER_MATCH_IVLAN)

Delete InnerVLAN classifier associated ALE table entry.

#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_OVLAN   (CPSW_ALE_POLICER_MATCH_OVLAN)

Delete OuterVLAN classifier associated ALE table entry.

#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_ETHERTYPE   (CPSW_ALE_POLICER_MATCH_ETHERTYPE)

Delete EtherType classifier associated ALE table entry.

#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_IPSRC   (CPSW_ALE_POLICER_MATCH_IPSRC)

Delete IPv4/IPv6 source address classifier associated ALE table entry.

#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_IPDST   (CPSW_ALE_POLICER_MATCH_IPDST)

Delete IPv4/IPv6 destination address classifier associated ALE table entry.

#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_ALL
Value:
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_IVLAN
Delete InnerVLAN classifier associated ALE table entry.
Definition: cpsw_ale.h:207
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_OVLAN
Delete OuterVLAN classifier associated ALE table entry.
Definition: cpsw_ale.h:210
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_IPSRC
Delete IPv4/IPv6 source address classifier associated ALE table entry.
Definition: cpsw_ale.h:216
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_ETHERTYPE
Delete EtherType classifier associated ALE table entry.
Definition: cpsw_ale.h:213
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_IPDST
Delete IPv4/IPv6 destination address classifier associated ALE table entry.
Definition: cpsw_ale.h:219
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_MACDST
Delete MAC destination address ALE table entry.
Definition: cpsw_ale.h:204
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_MACSRC
Delete MAC source address ALE table entry.
Definition: cpsw_ale.h:201
#define CPSW_ALE_POLICER_TABLEENTRY_DELETE_OUI
Delete OUI ALE table entry.
Definition: cpsw_ale.h:198

Delete all ale entries associated with classifier entries.

#define CPSW_ALE_MACPORT_BASE   (1U)

Base index for MAC ports in ALE context.

#define CPSW_ALE_MACPORT_TO_ALEPORT (   macPortNum)    (CPSW_NORMALIZE_MACPORT(macPortNum) + CPSW_ALE_MACPORT_BASE)

Macro to convert MAC port (Cpsw_MacPort) to ALE port number.

#define CPSW_ALE_ALEPORT_TO_MACPORT (   alePortNum)    (CPSW_DENORMALIZE_MACPORT(alePortNum - CPSW_ALE_MACPORT_BASE))

Macro to convert ALE port number to MAC port number(Cpsw_MacPort)

#define CPSW_ALE_MACPORT_TO_PORTMASK (   macPortNum)    CPSW_SET_BIT(CPSW_ALE_MACPORT_TO_ALEPORT(macPortNum))

Macro to convert MAC port (Cpsw_MacPort) to ALE port mask.

#define CPSW_ALE_PUBLIC_IOCTL (   x)    (CPSW_IOCTL_ALE_BASE | CPSW_IOCTL_MIN(x))

Helper macro to create IOCTL commands for ALE submodule.

Enumeration Type Documentation

Forward State Level - Indicates the port state(s) required for the received port on a destination address lookup in order for the multicast packet to be forwarded to the transmit port(s). A transmit port must be in the Forwarding state in order to forward the packet. If the transmit port_mask has multiple set bits then each forward decision is independent of the other transmit port(s) forward decision.

  • 00 - Forwarding
  • 01 - Blocking/Forwarding/Learning
  • 10 - Forwarding/Learning
  • 11 - Forwarding
Enumerator
CPSW_ALE_FWDSTLVL_FORWARDING 

Forwarding

CPSW_ALE_FWDSTLVL_BLK_FWD_LRN 

Blocking/Forwarding/Learning

CPSW_ALE_FWDSTLVL_FWD_LRN 

Forwarding/Learning

Yellow Threshold Value.

When set enables a portion of the yellow packets to be dropped based on the "yellow_drop_en" enable.

Enumerator
CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_100 

Drop 100% of packets colored yellow by policer

CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_50 

Drop 50% of packets colored yellow by policer

CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_33 

Drop 33% of packets colored yellow by policer

CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_25 

Drop 25% of packets colored yellow by policer

CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_20 

Drop 20% of packets colored yellow by policer

CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_17 

Drop 17% of packets colored yellow by policer

CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_14 

Drop 14% of packets colored yellow by policer

CPSW_ALE_POLICER_YELLOWTHRESH_DROP_PERCENT_13 

Drop 13% of packets colored yellow by policer

Policing Match Mode.

This field determines what happens to packets that fail to hit any policing/classifier entry.

Enumerator
CPSW_ALE_POLICER_NOMATCH_MODE_GREEN 

Color packets not matching any classifier entry as GREEN

CPSW_ALE_POLICER_NOMATCH_MODE_YELLOW 

Color packets not matching any classifier entry as YELLOW

CPSW_ALE_POLICER_NOMATCH_MODE_RED 

Color packets not matching any classifier entry as RED

CPSW_ALE_POLICER_NOMATCH_MODE_UNREGULATED_TRAFFIC_POLICER 

No Hit packets are marked based on policing for unregulated traffic

Defines ALE port states.

Enumerator
CPSW_ALE_PORTSTATE_DISABLED 

Discard all packets

CPSW_ALE_PORTSTATE_BLOCKED 

Discard all packets except supervisory packets (BPDUs)

CPSW_ALE_PORTSTATE_LEARN 

Discard all packets except supervisory packets (BPDUs). Also add packet MAC SA as learned entries in ALE table

CPSW_ALE_PORTSTATE_FORWARD 

Forward all packets.Learning also enabled

Defines IP address classifier type.

Enumerator
CPSW_ALE_IPADDR_CLASSIFIER_IPV4 

Classifier entry is IPv4 address

CPSW_ALE_IPADDR_CLASSIFIER_IPV6 

Classifier entry is IPv6 address

Defines IP address classifier type.

Enumerator
CPSW_ALE_TBLENTRYTYPE_ADDR 

ALE entry type Unicast/Multicast address

CPSW_ALE_TBLENTRYTYPE_VLAN 

ALE entry type Inner/outer vlan

CPSW_ALE_TBLENTRYTYPE_ETHERTYPE 

ALE entry type Ethertype

CPSW_ALE_TBLENTRYTYPE_OUI 

ALE entry type OUI

CPSW_ALE_TBLENTRYTYPE_IPV4 

ALE entry type IPv4

CPSW_ALE_TBLENTRYTYPE_IPV6 

ALE entry type IPv6

Packet Filtering Settings (cumulative)

Enumerator
CPSW_ALE_RXFILTER_NOTHING 

Receive filter set to Nothing

CPSW_ALE_RXFILTER_DIRECT 

Receive filter set to Direct

CPSW_ALE_RXFILTER_BROADCAST 

Receive filter set to Broadcast

CPSW_ALE_RXFILTER_MULTICAST 

Receive filter set to Multicast

CPSW_ALE_RXFILTER_ALLMULTICAST 

Receive filter set to All Mcast

CPSW_ALE_RXFILTER_ALL 

Receive filter set to All