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

Remove unused/redundant default flows #6731

Closed

Conversation

hongliangl
Copy link
Contributor

@hongliangl hongliangl commented Oct 11, 2024

1. cookie=0x9030000000000, table=PreRoutingClassifier, priority=200,ip actions=resubmit(,NodePortMark),resubmit(,SessionAffinity),resubmit(,ServiceLB)
2. cookie=0x9030000000000, table=PreRoutingClassifier, priority=200,ipv6 actions=resubmit(,NodePortMark),resubmit(,SessionAffinity),resubmit(,ServiceLB)
3. cookie=0x9000000000000, table=PreRoutingClassifier, priority=0 actions=goto_table:NodePortMark
4. cookie=0x9030000000000, table=NodePortMark, priority=200,ip,nw_dst=192.168.77.100 actions=set_field:0x80000/0x80000->reg4
5. cookie=0x9030000000000, table=NodePortMark, priority=200,ip,nw_dst=169.254.0.252 actions=set_field:0x80000/0x80000->reg4
6. cookie=0x9030000000000, table=NodePortMark, priority=200,ipv6,ipv6_dst=fd00::192:168:77:100 actions=set_field:0x80000/0x80000->reg4
7. cookie=0x9030000000000, table=NodePortMark, priority=200,ipv6,ipv6_dst=fc01::aabb:ccdd:eefe actions=set_field:0x80000/0x80000->reg4
8. cookie=0x9030000000000, table=NodePortMark, priority=0,actions=goto_table:SessionAffinity
9. cookie=0x9030000000000, table=SessionAffinity, priority=0 actions=set_field:0x10000/0x70000->reg4

This commit removes the default flows (flow 3, flow 8) of PreRoutingClassifier and NodePortMark.

For flow 3, there is no chance to use it since all packets will be matched by flows 1-2.

For flow 8, this is a redundant flow. For example, a packet matched by flow 1 or 2 will
be resubmitted to multiple tables, which means the packet will be processed in these tables
sequentially. Assuming that a packet with destination 192.168.77.200 is matched by flow 1:

  1. NodePortMark: sent by resubmit(,NodePortMark), packet is matched by flow 8 and sent to
    SessionAffinity.
  2. SessionAffinity: packet is matched by flow 9, returns to flow 1 to run the next action
    resubmit(,SessionAffinity).
  3. SessionAffinity: sent by resubmit(,SessionAffinity), packet is matched by flow 9 again,
    returns to flow 1 to run the next action resubmit(,ServiceLB).
  4. ServiceLB: sent by resubmit(,ServiceLB).

We can see that the packet is matched by flow 9 twice. By removing flow 8, we can avoid that.

@hongliangl hongliangl force-pushed the 20241010-remove-nodeport-default branch from 272ae39 to f94dd91 Compare October 11, 2024 09:06
```
1. cookie=0x9030000000000, table=PreRoutingClassifier, priority=200,ip actions=resubmit(,NodePortMark),resubmit(,SessionAffinity),resubmit(,ServiceLB)
2. cookie=0x9030000000000, table=PreRoutingClassifier, priority=200,ipv6 actions=resubmit(,NodePortMark),resubmit(,SessionAffinity),resubmit(,ServiceLB)
3. cookie=0x9000000000000, table=PreRoutingClassifier, priority=0 actions=goto_table:NodePortMark
4. cookie=0x9030000000000, table=NodePortMark, priority=200,ip,nw_dst=192.168.77.100 actions=set_field:0x80000/0x80000->reg4
5. cookie=0x9030000000000, table=NodePortMark, priority=200,ip,nw_dst=169.254.0.252 actions=set_field:0x80000/0x80000->reg4
6. cookie=0x9030000000000, table=NodePortMark, priority=200,ipv6,ipv6_dst=fd00::192:168:77:100 actions=set_field:0x80000/0x80000->reg4
7. cookie=0x9030000000000, table=NodePortMark, priority=200,ipv6,ipv6_dst=fc01::aabb:ccdd:eefe actions=set_field:0x80000/0x80000->reg4
8. cookie=0x9030000000000, table=NodePortMark, priority=0,actions=goto_table:SessionAffinity
9. cookie=0x9030000000000, table=SessionAffinity, priority=0 actions=set_field:0x10000/0x70000->reg4
```

This commit removes the default flows (flow 3, flow 8) of PreRoutingClassifier and NodePortMark.

For flow 3, there is no chance to use it since all packets will be matched by flows 1-2.

For flow 8, this is a redundant flow. For example, a packet matched by flow 1 or 2 will
be resubmitted to multiple tables, which means the packet will be processed in these tables
sequentially. Assuming that a packet with destination 192.168.77.200 is matched by flow 1:

1. NodePortMark: sent by `resubmit(,NodePortMark)`, packet is matched by flow 8 and sent to
   SessionAffinity.
2. SessionAffinity: packet is matched by flow 9, returns to flow 1 to run the next action
   `resubmit(,SessionAffinity)`.
3. SessionAffinity: sent by `resubmit(,SessionAffinity)`, packet is matched by flow 9 again,
   returns to flow 1 to run the next action `resubmit(,ServiceLB)`.
4. ServiceLB: sent by `resubmit(,ServiceLB)`.

We can see that the packet is matched by flow 9 twice. By removing flow 8, we can avoid that.

Signed-off-by: Hongliang Liu <[email protected]>
@hongliangl hongliangl force-pushed the 20241010-remove-nodeport-default branch from f94dd91 to fc18879 Compare October 11, 2024 09:07
@hongliangl hongliangl marked this pull request as ready for review October 11, 2024 09:08
@hongliangl hongliangl changed the title Remove default flow in table NodePortMark Remove unused/redundant default flows Oct 11, 2024
@hongliangl hongliangl marked this pull request as draft October 12, 2024 03:12
@hongliangl hongliangl closed this Nov 13, 2024
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.

1 participant