Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tunnel Termination ACL VPP Plugin #114

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

AkeelAli
Copy link

@AkeelAli AkeelAli commented Sep 19, 2024

Overview:

This PR introduces a custom VPP plugin named tunterm_acl into Sonic-VPP. This plugin provides the required dataplane ACL functionality to support Smart Switch HA. In particular, it allows v4-vxlan decap'ed packets to be redirected based on their inner DST IP.

Changes:

  1. Adds the tunterm_acl plugin source code (including tests and docs) under platform/vpp/vppbld/plugins/
  2. Updates the vppbld Makefile to allow for custom plugins to be copied to & built with VPP
  3. Enables the tunterm_acl plugin in the startup.conf files
  4. Adds a change in the vpp.patch file to export vxlan_main

Plugin:

Details of the tunterm_acl plugin implementation can be found in the README.rst file.

= UT: introduce test_tunterm_acl.py with various tests
- Fix: add_replace empty-ACL ignores is_ipv6 as it is not set by sonic-vpp
- Minor formatting & classify table memory size changes
Copy link

linux-foundation-easycla bot commented Sep 19, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

platform/vpp/plugins/tunterm_acl/tunterm_acl_api.c Outdated Show resolved Hide resolved
platform/vpp/plugins/tunterm_acl/tunterm_acl_api.c Outdated Show resolved Hide resolved
platform/vpp/plugins/tunterm_acl/tunterm_acl_decap.c Outdated Show resolved Hide resolved
platform/vpp/plugins/tunterm_acl/tunterm_acl_decap.c Outdated Show resolved Hide resolved
platform/vpp/vppbld/Makefile Outdated Show resolved Hide resolved
Copy link
Contributor

@yue-fred-gao yue-fred-gao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from SONIC side. Let's wait for Abdel to review from vpp

Copy link

@abdbaig abdbaig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not already done, can you use the plugin source code within vpp and run the following to make sure all the code is validated against vpp guidelines:

make checkstyle
make checkstyle-api
make chekcstyle-python

The code may have to committed in local branch for the scripts to work.


It is currently designed to support a single specific use-case:

IPv4 VxLAN tunnel termination and classification based on inner DST IPv4/6 fields, followed by a redirect action using ip4/6-rewrite.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any limitation on the redirect action (redirect to NH IP only, IP has to be in default VRF, etc)? If yes, let's put them here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarified that this is a redirect via a VPP Fib path (as declared in the API using vl_api_fib_path_t)


if (is_ipv6) {
for (int i = 0; i < 16; i++) {
mask[8 + i + skip * CLASSIFY_TABLE_VECTOR_SIZE] = dst.ip6.as_u8[i];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define an constant for offset 8 and use it also when you initialize the mask. Can you also put in a comment there indicating why we need to put IPv6 address at this offset instead of starting at 0.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in latest commit (no longer offset, masking directly from start of DIP)

}
} else {
for (int i = 0; i < 4; i++) {
mask[i + skip * CLASSIFY_TABLE_VECTOR_SIZE] = dst.ip4.data[i];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we using skip to increase the offset?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in latest commit (no longer skipping vectors, masking directly from start of DIP)


if (ethertype == 0x86DD) {
table_index = tunterm_acl_main.classify_table_index_by_sw_if_index_v6[sw_if_index0];
} else if (ethertype == 0x0800) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a usecase where the inner L2 payload may have vlans? If we do, we may need additional parsing to skip the VLAN headers.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added support for vlan tagged inner packet along with testing.

- Classify relative to start of inner DIP
- Support inner vlan tag + add testing
- Formatting of test and src code
@AkeelAli AkeelAli requested a review from abdbaig October 2, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants