-
Notifications
You must be signed in to change notification settings - Fork 38
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
vpp: pass hashconfig to vpp for service annotations #635
Conversation
5c38b8d
to
7dae114
Compare
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, this looks nice, just a few comments
calico-vpp-agent/services/service.go
Outdated
var hashConfigMap = map[hashConfig]types.IPFlowHash{ | ||
hashConfigDstaddr: types.FlowHashDstIP, | ||
hashConfigDstport: types.FlowHashDstPort, | ||
hashConfigIproto: types.FlowHashProto, | ||
hashConfigReverse: types.FlowHashReverse, | ||
hashConfigSrcaddr: types.FlowHashSrcIP, | ||
hashConfigSrcport: types.FlowHashSrcPort, | ||
hashConfigSymmetric: types.FlowHashSymetric, | ||
} | ||
|
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.
Instead of doing an extra layer of mangling here, we could directly build the bitmap in ParseServiceAnnotations()
as we already are doing a switch statement there
vpplink/types/cnat.go
Outdated
@@ -34,6 +35,18 @@ const ( | |||
MaglevLB = CnatLbType(cnat.CNAT_LB_TYPE_MAGLEV) | |||
) | |||
|
|||
type CnatHashConfig uint8 |
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 worth adding a String()
function on the CnatHashConfig
type
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 no need for that as we already have [0] and we can cast to it when logging.
func (x IPFlowHashConfig) String() string { |
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.
Right, there is this, but the output will probably be really ugly...
e.g. usually "IP_API_FLOW_HASH_SRC_IP|IP_API_FLOW_HASH_DST_IP|IP_API_FLOW_HASH_SRC_PORT|IP_API_FLOW_HASH_DST_PORT|IP_API_FLOW_HASH_PROTO"
...
276bcd0
to
e3aee78
Compare
e3aee78
to
b5d0f00
Compare
This patch uses the newly introduced field in cnat translation vpp api to pass ecmp hashconfig defined by annotations in services.