-
Notifications
You must be signed in to change notification settings - Fork 1
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 flow type enum #427
Conversation
return virtsvc_reply_next(node, m, df); | ||
else |
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.
Hmm. This is not really equivalent to non-refactored version, right ? DP_FLOW_TYPE_LOCAL case was causing a dropped packet in previous version but now it goes to virtsvc_request_next
.
Can this happen in other parts of the code because DP_FLOW_TYPE_LOCAL is eliminated ?
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.
You are right on the else
covering more types of flow_type
, but in CLS this was always either set to INCOMING or OUTGOING based on a match of src/dst IPv6. What the node really needs to know is the direction to/from service. (I thought about splitting the node into two, and depending on the future of this feature I still have it as a point to think about.)
I think there is a problem with the change in |
@@ -676,16 +676,22 @@ int dp_offload_handler(struct rte_mbuf *m, struct dp_flow *df) | |||
const struct dp_port *outgoing_port = dp_get_dst_port(df); | |||
int ret; | |||
|
|||
// TODO(plague): think about using enum for flow_type | |||
if (df->flags.flow_type == DP_FLOW_TYPE_LOCAL) { | |||
if (incoming_port->is_pf == outgoing_port->is_pf) { |
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.
this seems to eliminate the possibility to perform offloading for in-network NAT and LB flow bouncing. For both cases, both incoming_port->is_pf and outgoing_port->is_pf are true, and an error is thrown here. (!incoming_port->is_pf && !outgoing_port->is_pf)
could be an alternative, but the subsequential conditions also need to be reconsidered.
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 had to re-order the code since OUTGOING always had priority before (it changed INCOMING to OOUTGOING in the enum).
I also added checks as I understande the code, but please check that. Maybe they are not needed or maybe the test for df->conntrack->nf_info.nat_type
is not needed? Then we could simplify the code to only ask the is_pf
and be nat_type
agnostic, which would be more readable locally, but maybe would miss the point of the architecture.
53199c1
to
2e401c3
Compare
@byteocean @PlagueCZ |
2e401c3
to
7e11033
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.
Looks good to me
Motivation
I wanted to include
enum flow_type
into the dataplane schema, becauseDP_FLOW_TYPE_INCOMING
is really important for packet traversal. But I could not find a good way to do it, which seemed odd, because what the value represents is really simple.I found out that by removing it and instead using
src_port->is_pf
instead (anddst_port->is_pf
forDP_FLOW_TYPE_OUTGOING
respectively) really simplified everything. This also "solves" the strange state in loadbalancer recirculation where the flow actually is both incoming and outgoing at the same time.Changes
Of course nothing really changed functionally (as using two booleans vs. one 2-bit wide enum is exactly the same amount of information), but in the code everything really clicked for me and the schema only needed a light touch to include this now.
This also enabled me to simplify code in
ipv4_lookup
and I madeipv6_lookup
to look almost the same, which will be good in the future.As a separate commit I also replaced
enum port_type
with a boolean, becauseport->port_type == DP_PORT_PF
is harder to read thanport->is_pf
and this also removes the need forswitch (port->type)
etc.