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

Support for list-match type (P4) for ACLs, pending BMV2 fork #91

Closed
KrisNey-MSFT opened this issue Mar 31, 2022 · 15 comments
Closed

Support for list-match type (P4) for ACLs, pending BMV2 fork #91

KrisNey-MSFT opened this issue Mar 31, 2022 · 15 comments
Assignees

Comments

@KrisNey-MSFT
Copy link
Collaborator

Related information

Scope - BMv2. DASH ACL defines two new match types - list and range_list. They need to be handled by the simulator, so it can match a field in a packet against a list of values and generate a hit if one of the values in the list matches.

@KrisNey-MSFT KrisNey-MSFT moved this from 😫 Backlog Needs Owner to 🏝 Backlog in DASH P4 Behavioral Model Mar 31, 2022
@KrisNey-MSFT KrisNey-MSFT moved this from 🏝 Backlog to 🔬Scoping in DASH P4 Behavioral Model Apr 8, 2022
@mqasimfarooqi
Copy link
Collaborator

mqasimfarooqi commented Apr 11, 2022

Hi @marian-pritsak,

I am working on adding the list/range_list match type in the simulator.

I needed some clarification on how this match type actually works. How different is it from adding multiple entries? Do we have any sample of how a CLI input for list/range_list will actually look like? Also it would be great if you could share some reference material (e.g any past discussion) to gain further understanding on this match type.

I have identified 3 areas of development, please correct if I'm wrong:

  1. json parsing.
  2. Runtime handling.
  3. Datapath.

I believe support needs to be added in these 3 areas, am I correct?

Best Regards,
Qasim

@mqasimfarooqi
Copy link
Collaborator

mqasimfarooqi commented Apr 21, 2022

It seems that support for list-match type also needs to be added in the p4c. We have observed that the table match_type does not update to list in the generated json file. For now we have manually changed the match_type to list in json file to continue development.

Is there any past discussion on how the table match_type is decided if a table contains mix types with list and range_list in them?

We have assumed that for an ipv4 key it would look something like this "0x01010100/24,0x01010200/24" etc. For other key values like protocol an entry would look like "value1&&&mask1,value2&&&mask2".

@KrisNey-MSFT
Copy link
Collaborator Author

@marian-pritsak to reply 4/21/2022

@marian-pritsak
Copy link
Collaborator

Hi @mqasimfarooqi

Datapath and runtime for sure, however, what section in JSON are you talking about that is not updated?

@mqasimfarooqi
Copy link
Collaborator

Hi @marian-pritsak

p4c generates table_match_type by parsing key match_types using the following rules:

// Decreasing order of precedence (bmv2 specification):
// 0) more than one LPM field is an error
// 1) if there is at least one RANGE field, then the table is RANGE
// 2) if there is at least one TERNARY or OPTIONAL field, then the table is TERNARY
// 3) if there is a LPM field, then the table is LPM
// 4) otherwise the table is EXACT

We have seen that when we have only "list" match-types for keys it does not change table type to "list".
Table Match Type

@KrisNey-MSFT KrisNey-MSFT moved this from 🔬Scoping to 🏃 In Progress in DASH P4 Behavioral Model Apr 22, 2022
@marian-pritsak
Copy link
Collaborator

Yes, this field needs to be also updated to "list".

List and range_list should be in positions 1 and 2 (before LPM and ternary).

@mqasimfarooqi
Copy link
Collaborator

@KrisNey-MSFT, I believe p4c is out of scope of this issue. Will there be separate issue for this or an extension to the current issue?

@KrisNey-MSFT
Copy link
Collaborator Author

KrisNey-MSFT commented Apr 26, 2022 via email

@KrisNey-MSFT
Copy link
Collaborator Author

P4C defines the match-type of the table. The compiler code needs to be updated (?); this is out of scope b/c this is only bmv2.
@marian-pritsak is not sure if this affects anything.
Changed the table match type (.json file) to list, to continue dev process.
Based on the key values, it changes the table-match-type. List is not yet implemented in the compiler. Why does bmv2 need to know the table match type, what is it being used for? Being used to make decisions in the code.
We have no preference whether this is a new Issue or continues in this one.
Some development left on the range-list, and open PR in the coming week in Qasim's fork.

@KrisNey-MSFT KrisNey-MSFT moved this from 🏃 In Progress to 🟣 75% Complete in DASH P4 Behavioral Model May 19, 2022
@KrisNey-MSFT
Copy link
Collaborator Author

Per @mqasimfarooqi - let's move forward and extend the scope of to encompass p4c and bmv2.

I think, in the first comment, we may change "Scope - BMv2" to "Scope - BMv2,p4c" and add a line in the end to define the other related task which should be "In the compiler, handle list and range_list key values to decide table match type based on precedence.". Rest looks okay.

@marian-pritsak marian-pritsak changed the title Support for list-match type (P4) for ACLs Support for list-match type (P4) for ACLs, pending BMV2 fork Jun 2, 2022
@mqasimfarooqi
Copy link
Collaborator

mqasimfarooqi commented Jun 23, 2022

Following PR implements the "list" and "range_list" match types.

marian-pritsak/behavioral-model#1

@KrisNey-MSFT
Copy link
Collaborator Author

Hi @mqasimfarooqi - Marian has a few updated PRs, one in /opencomputeproject, one in /DASH. Do either of these affect your Issue here?

#249 - Build p4c from custom fork
opencomputeproject/SAI#1630 - Change ACL address key to prefix list

@yusefMS06
Copy link
Collaborator

@mqasimfarooqi Were the PRs mentioned above helpful in solving your issue? Been some time since this was reviewed, can we move to close?

@mqasimfarooqi
Copy link
Collaborator

Hi @KrisNey-MSFT @yusefMS06 - Sorry for the delayed response.

@KrisNey-MSFT - Actually the feature is already merged with Marian's bmv2 fork. I don't think the above mentioned PR's should effect this issue. We can close this issue.

@yusefMS06 - Yes please, we can go ahead and close this issue as the change-set has been merged in Marian's bmv2 fork.

@yusefMS06
Copy link
Collaborator

Going ahead and closing

@github-project-automation github-project-automation bot moved this from 🟣 75% Complete to 🏃 In Progress in DASH P4 Behavioral Model Jan 10, 2023
@yusefMS06 yusefMS06 moved this from 🏃 In Progress to ✔Done in DASH P4 Behavioral Model Jan 10, 2023
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

No branches or pull requests

4 participants