-
Notifications
You must be signed in to change notification settings - Fork 39
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
Adding support for loading TC eBPF programs on existing ingress and HTB qdisc #359
Conversation
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
kf/kf_unix.go
Outdated
if iface.Name == ifaceName && qdisc.Kind == "clsact" { | ||
clsactFound = true | ||
} | ||
if iface.Name == ifaceName && qdisc.Kind == "htb" { | ||
htbFound = true | ||
htbHandle = qdisc.Msg.Handle | ||
} | ||
if iface.Name == ifaceName && qdisc.Kind == "ingress" { | ||
ingressFound = true | ||
ingressHandle = qdisc.Msg.Handle | ||
} |
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 convert this into switch statement
if iface.Name == ifaceName && qdisc.Kind == "clsact" { | |
clsactFound = true | |
} | |
if iface.Name == ifaceName && qdisc.Kind == "htb" { | |
htbFound = true | |
htbHandle = qdisc.Msg.Handle | |
} | |
if iface.Name == ifaceName && qdisc.Kind == "ingress" { | |
ingressFound = true | |
ingressHandle = qdisc.Msg.Handle | |
} | |
if iface.Name == ifaceName { | |
switch qdisc.Kind { | |
case "clsact": | |
clsactFound = true | |
case "htb": | |
htbFound = true | |
htbHandle = qdisc.Msg.Handle | |
case "ingress": | |
ingressFound = true | |
ingressHandle = qdisc.Msg.Handle | |
default: | |
log.Info("qdisc kind for %s : %v", ifaceName, err) | |
} | |
} |
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.
Fixed in the newer commit
kf/kf_unix.go
Outdated
if iface.Name == ifaceName && qdisc.Kind == "clsact" { | ||
clsactFound = true | ||
} | ||
if iface.Name == ifaceName && qdisc.Kind == "htb" { | ||
htbFound = true | ||
htbHandle = qdisc.Msg.Handle | ||
} | ||
if iface.Name == ifaceName && qdisc.Kind == "ingress" { | ||
ingressFound = true | ||
ingressHandle = qdisc.Msg.Handle | ||
} |
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 convert this to switch statement as above.
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.
Fixed in the newer commit
kf/kf_unix.go
Outdated
} | ||
progFD := uint32(bpfRootProg.FD()) | ||
// Netlink attribute used in the Linux kernel | ||
bpfFlag := uint32(tc.BpfActDirect) |
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.
Is it possible to relocate line 301 and 303 outside of the block in order to prevent duplicated 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.
Fixed in the newer commit
FD: &progFD, | ||
Flags: &bpfFlag, | ||
}, | ||
}, |
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.
Is it possible to define tc.Attribute{} outside of the block in order to prevent duplicated 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.
As tc.Attribute{} is the field of tc.Object.Attribute, I would prefer to keep the declaration in place for context.
}, | ||
}, | ||
} | ||
} else if !clsactFound && !ingressFound && !htbFound { |
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.
IMHO For clarity, this condition block can be relocated to the end as part of the else statement.
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.
LGTM, just one small question
ingressFound = true | ||
ingressHandle = qdisc.Msg.Handle | ||
default: | ||
log.Info().Msgf("Un-supported qdisc kind for interface %s ", ifaceName) |
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.
Is this going to be too verbose? Or is it useful to a user who is inspecting the logs?
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 believe it will be useful for debugging on the hypervisors.
Signed-off-by: Jay Sheth <[email protected]>
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
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.
LGTM Thanks :)
This PR is the fix for the issue #362
Specifically, in case of Openstack Hypervisors, whenever rate-limit rules are applied (ref: https://wiki.openstack.org/wiki/InstanceResourceQuota#:~:text=quota%3Acpu_period%3D10240000-,Bandwidth,-limits), openstack install HTB and Ingress qdisc. This PR will add support for deploying TC program on the interface with such HTB and Ingress qdisc as well