1 ; SPDX-License-Identifier: BSD-3-Clause
2 ; Copyright(c) 2020 Intel Corporation
4 ; A selector table is made out of groups of weighted members, with a given member potentially part
5 ; of several groups. The select operation returns a member ID by first selecting a group based on an
6 ; input group ID and then selecting a member within that group by hashing one or several input
7 ; header or meta-data fields. It is very useful for implementing an Equal-Cost Multi-Path (ECMP) or
8 ; Weighted-Cost Multi-Path (WCMP) enabled FIB or a load balancer. It is part of the action selector
9 ; construct described by the P4 Portable Switch Architecture (PSA) specification.
11 ; Normally, an action selector FIB is built with a routing table (the base table), a selector table
12 ; (the group table) and a next hop table (the member table). One of the routing table actions sets
13 ; up the group ID meta-data field used as the index into the group table, which produces the member
14 ; ID meta-data field, i.e. the next hop ID that is used as the index into the next hop table. The
15 ; next hop action prepares the output packet for being sent next hop in the network by prepending
16 ; one or several headers to the packet (Ethernet at the very least), decrementing the TTL and
17 ; recomputing the IPv4 checksum, etc. The selector allows for multiple next hops to be specified
18 ; for any given route as opposed to a single next hop per route; for every packet, its next hop is
19 ; picked out of the set of next hops defined for the route while preserving the packet ordering
20 ; within the flow, with the flow defined by the selector n-tuple fields.
22 ; In this simple example, the base table and the member table are striped out in order to focus
23 ; exclusively on illustrating the selector table. The group_id is read from the destination MAC
24 ; address and the selector n-tuple is represented by the Protocol, the source IP address and the
25 ; destination IP address fields. The member_id produced by the selector table is used to identify
26 ; the output port which facilitates the testing of different member weights by simply comparing the
27 ; rates of output packets sent on different ports.
42 bit<16> identification
51 header ethernet instanceof ethernet_h
52 header ipv4 instanceof ipv4_h
63 metadata instanceof metadata_t
80 n_members_per_group_max 16
90 mov m.group_id h.ethernet.dst_addr