-
Notifications
You must be signed in to change notification settings - Fork 370
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
Flexible pipeline - #1 Architecture #3035
Flexible pipeline - #1 Architecture #3035
Conversation
fc49ff5
to
05eee0b
Compare
Signed-off-by: Hongliang Liu <[email protected]>
05eee0b
to
19fb48e
Compare
template = &pipelineTemplate{ | ||
stageTables: map[binding.StageID][]tableRequest{ | ||
binding.ClassifierStage: { | ||
tableRequest{ClassifierTable, 0x7f}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anywhere we can learn why here is setting as 0x7f
? or will there be any update for existing ovs-pipeline design doc? https://github.com/antrea-io/antrea/blob/main/docs/design/ovs-pipeline.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. How the table priorities are decided? Should we define constants?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of table within a stage is decided by this priority. We don't need to define constants because priorities should be the same within a stage, otherwise the order of tables cannot be decided by priority. @jianjuns @luolanzone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand your explanation. How 0x7f, 0x6f, 0x7d in this file are decided? If I add a new table later, how I decide the priority value?
break | ||
} | ||
} | ||
} else if protocol == ofProtocolARP { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think here you can use switch
to make the whole structure more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated in #3058
RewriteMACRegMark = binding.NewOneBitRegMark(0, 11, "RewriteMAC") | ||
// reg0[12]: Mark to indicate the packet is denied(Drop/Reject). | ||
CnpDenyRegMark = binding.NewOneBitRegMark(0, 12, "CNPDeny") | ||
// reg0[13..14]: Field to indicate disposition of Antrea Policy. It could have more bits to support more disposition | ||
// that Antrea policy support in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Antrea policy/Antrea Policy/
// reg4[16..19]: Field to store the union value of Endpoint state and the mark of whether Service type is NodePort. | ||
NodePortUnionField = binding.NewRegField(4, 16, 19, "NodePortUnion") | ||
// reg4[21]: Mark to indicate the packet is from local AntreaFlexibleIPAM Pod. | ||
// NotAntreaFlexibleIPAMRegMark will be used with RewriteMACRegMark, thus the reg id must not be same due to the limitation of ofnet library. | ||
AntreaFlexibleIPAMRegMark = binding.NewOneBitRegMark(4, 21, "AntreaFlexibleIPAM") | ||
NotAntreaFlexibleIPAMRegMark = binding.NewOneBitZeroRegMark(4, 21, "AntreaFlexibleIPAM") | ||
// reg4[22..23]: Field to store the state of a connection of Service NodePort/LoadBalancer from gateway which | ||
// requires SNAT or not. | ||
// - 0b01: connection requires SNAT and is not marked with a ct mark. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure which one is correct but I suppose all ct mark
string should be the same, either CT mark
or ct mark
in comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe CT mark.
"antrea.io/antrea/pkg/agent/config" | ||
"antrea.io/antrea/pkg/agent/openflow/cookie" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this to below antrea.io
import section
globalConjMatchFlowCache map[string]*conjMatchFlowContext | ||
conjMatchFlowLock sync.Mutex // Lock for access globalConjMatchFlowCache | ||
// policyCache is a storage that supports listing policyRuleConjunction with different indexers. | ||
// It's guaranteed that one policyRuleConjunction is processed by at most one goroutine at any given time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/It's guaranteed/It guarantees/
enableProxy, | ||
enableAntreaPolicy, | ||
supportEncap bool) feature { | ||
gatewayIPs := make(map[binding.Protocol]net.IP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see this variable gatewayIPs
being used in following codes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it's updated in #3058
|
||
package openflow | ||
|
||
type featureVMConnectivity struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this for? a placeholder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A placeholder, removed in #3058
@@ -0,0 +1,113 @@ | |||
// Copyright 2019 Antrea Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/2019/2021/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
|
||
type pipelineTemplate struct { | ||
// Declare the tables and the corresponding priorities in the expected stage. | ||
// If it is expected to enforce a packet to enter other tables in the same stage after leaving the current table, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is expected to enforce -> To force
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I do not understand this sentence. Do you mean "a packet will enter all tables in the same stage in order of table priority"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean "a packet will enter all tables in the same stage in order of table priority"?
Order of tables within a stage is decided by their priorities. The packet will pass through all tables within the stage by the order which is decided by the priorities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you think about replacing the sentence with my version: "A packet will enter all tables in the same stage in order of table priority"?
binding "antrea.io/antrea/pkg/ovs/openflow" | ||
) | ||
|
||
type featureID int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add comments to explain the terms in this file? Or another way explain them in a separate doc. It is impossible to understand them just looking at code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in #3058
|
||
// A table with a higher priority is assigned with a lower tableID, which means a packet should enter the table | ||
// before others with lower priorities in the same stage. | ||
type tableRequest struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking this one as an example, we should explain what is a tableRequest, before talking about fields in the struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in #3058
c.ofTable = binding.NewOFTable(id, c.name, 0, 0) | ||
} | ||
|
||
// A table with a higher priority is assigned with a lower tableID, which means a packet should enter the table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to rephrase this. There is no relation between "a higher priority is assigned with a lower tableID" and "a packet should enter the table before others with lower priorities in the same stage".
Maybe: A packet enters tables with higher priorities before tables with lower priorities. A table with a higher priority is assigned with a smaller tableID.
But what is tableID? Do you mean tableRequest.priority? Then we should just say: A smaller value indicates a higher priority.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in #3058
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
template = &pipelineTemplate{ | ||
stageTables: map[binding.StageID][]tableRequest{ | ||
binding.ClassifierStage: { | ||
tableRequest{ClassifierTable, 0x7f}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. How the table priorities are decided? Should we define constants?
Architecture code of flexible pipeline.
Signed-off-by: Hongliang Liu [email protected]