Skip to content

Commit

Permalink
Add attributes to disable L3 rewrites (#1924)
Browse files Browse the repository at this point in the history
* Add atrributes to disable L3 rewrites

- Src MAC disable
- Dst MAC disable
- Vlan rewrite disable

Signed-off-by: Vivek Ramamoorthy <vivekmoorthy@google.com>
Knobs for disabling rewrites to following fields

Src MAC disable
Dst MAC disable
Vlan rewrite disable
While we do L3 IP based routing, we have scenarios where we need knobs for disabling L2 field rewrites.

Case 1: For some scenarios, the switch serves as an L3 passthrough. Creating nexthop/RIF for every source mac, dst-mac, vlan will not scale, and we would like to simply passthrough the L2 fields without any rewrites
Case 2: For some scenarios, we set VLAN in pre-ingress stage based on certain classification, and would like to preserve this VLAN in the packet.
  • Loading branch information
vivekmoorthy authored Jan 10, 2024
1 parent 1f66267 commit 0edf5f8
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
70 changes: 70 additions & 0 deletions doc/SAI-Proposal-L3-Rewrite-disable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
## SAI attributes for disabling L3 rewrites
-------------------------------------------------------------------------------
Title | SAI Attributes for disabling L3 rewrites
-------------|-----------------------------------------------------------------
Authors | Vivek Ramamoorthy, Google LLC
Status | In review
Type | Standards track
Created | 12/07/2023

-------------------------------------------------------------------------------
**Overview**

This document discusses the requirements and SAI spec proposal for disabling rewriting fields (Source/Dest Mac address, VLAN) as part of L3 routing.

**Background**

![sai-l3-pipeline](figures/sai-l3-pipeline.png)

The SAI egress pipeline for L3 forwarding performs the following steps:

1. Nexthop sets the egress RIF and NextHop IP.
2. Neighbor table lookup on EgressRiF, NextHop IP to set packet's destination MAC address.
3. Egress RIF lookup to set packet's source MAC address, VLAN and port.

**Requirements**

We require knobs for disabling rewrites to the following fields as part of L3 forwarding for certain LPM flows:

* Src MAC disable
* Dst MAC disable
* Vlan rewrite disable

While we leverage L3 IP-based routing using the LPM tables, we have scenarios where we need knobs for disabling header field rewrites.

* **Case 1:** For certain flows, the switch serves as an L3 passthrough, meaning it relies on IP address-based forwarding but does not want to terminate the L3 packet.
* **Case 2:** For some scenarios, we set the VLAN in the pre-ingress ACL stage based on classifications and would like to preserve this VLAN in the packet when L3 forwarding. For this scenario, we would like to disable L3 VLAN rewrite alone for these scenarios.

In summary, with SDN-based forwarding, the controller treats the L2 fields like any other header field that can be controlled and requires them to be configured flexibly as part of L3 forwarding decisions.

**Proposal**

Since we require the capability to disable the rewrites for "certain" IP flows and not for all flows via neighbor, the best option is to have these as part of the Next Hop object:

* `SAI_NEXT_HOP_ATTR_DISABLE_SRC_MAC_REWRITE`
* `SAI_NEXT_HOP_ATTR_DISABLE_DST_MAC_REWRITE`
* `SAI_NEXT_HOP_ATTR_DISABLE_VLAN_REWRITE`

**Example SAI object creation:**

1. Create a `SAI_OBJECT_TYPE_ROUTER_INTERFACE` with the following attributes:
* `SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID`
* `SAI_ROUTER_INTERFACE_ATTR_SRC_MAC_ADDRESS`
* `SAI_ROUTER_INTERFACE_ATTR_TYPE` (either `SAI_ROUTER_INTERFACE_TYPE_PORT` or `SAI_ROUTER_INTERFACE_TYPE_SUB_PORT`)
* `SAI_ROUTER_INTERFACE_ATTR_PORT_ID`

2. Create a `SAI_OBJECT_TYPE_NEIGHBOR_ENTRY` (1 entry per RIF port) with the following attributes:
* `“ip”` of neighbor (Link local address)
* `“rif”`
* `“switch id”`
* `SAI_NEIGHBOR_ENTRY_ATTR_DST_MAC_ADDRESS`
* `SAI_NEIGHBOR_ENTRY_ATTR_NO_HOST_ROUTE` (we will not use up a host entry)

3. Create a `SAI_OBJECT_TYPE_NEXT_HOP` with the following attributes:
* `SAI_NEXT_HOP_ATTR_TYPE` = `SAI_NEXT_HOP_TYPE_IP`
* `SAI_NEXT_HOP_ATTR_ROUTER_INTERFACE_ID`
* `SAI_NEXT_HOP_ATTR_IP` = `“ip”` of the neighbor (as created above)
* `SAI_NEXT_HOP_ATTR_DISABLE_SRC_MAC_REWRITE` = true
* `SAI_NEXT_HOP_ATTR_DISABLE_DST_MAC_REWRITE` = true
* `SAI_NEXT_HOP_ATTR_DISABLE_VLAN_REWRITE` = true

Binary file added doc/figures/sai-l3-pipeline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions inc/sainexthop.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,33 @@ typedef enum _sai_next_hop_attr_t
*/
SAI_NEXT_HOP_ATTR_QOS_TC_AND_COLOR_TO_MPLS_EXP_MAP,

/**
* @brief To enable/disable source MAC rewrite
*
* @type bool
* @flags CREATE_AND_SET
* @default false
*/
SAI_NEXT_HOP_ATTR_DISABLE_SRC_MAC_REWRITE,

/**
* @brief To enable/disable destination MAC rewrite
*
* @type bool
* @flags CREATE_AND_SET
* @default false
*/
SAI_NEXT_HOP_ATTR_DISABLE_DST_MAC_REWRITE,

/**
* @brief To enable/disable VLAN rewrite
*
* @type bool
* @flags CREATE_AND_SET
* @default false
*/
SAI_NEXT_HOP_ATTR_DISABLE_VLAN_REWRITE,

/**
* @brief End of attributes
*/
Expand Down

0 comments on commit 0edf5f8

Please sign in to comment.