-
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
Map arguments optimization #421
Conversation
Signed-off-by: Atul-source <[email protected]>
Signed-off-by: Atul-source <[email protected]>
Signed-off-by: Atul-source <[email protected]>
Signed-off-by: Atul-source <[email protected]>
Signed-off-by: Atul-source <[email protected]>
Signed-off-by: Atul-source <[email protected]>
Signed-off-by: Atul-source <[email protected]>
Signed-off-by: Atul-source <[email protected]>
bpfprogs/bpfmap.go
Outdated
func (b *BPFMap) Update(value string) error { | ||
|
||
log.Debug().Msgf("update map name %s ID %d", b.Name, b.MapID) | ||
// The RemoveMissingKeys function is used to delete all entries of eBPF maps, which are used by network functions. |
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 RemoveMissingKeys function is used to delete all entries of eBPF maps, which are used by network functions. | |
// The RemoveMissingKeys function is used to delete all entries of eBPF maps, which are used by ebpf program. |
bpfprogs/bpfmap.go
Outdated
log.Info().Msgf("updating map %s key %d mapid %d", b.Name, v, b.MapID) | ||
if err := ebpfMap.Update(unsafe.Pointer(&v), unsafe.Pointer(&x), 0); err != nil { | ||
return fmt.Errorf("update hash map element failed for key %d error %w", key, err) | ||
KeyValueMap := make(map[int]bool, 0) |
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.
Define the size of KeyValueMap to the size of args instead of 0.
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
Signed-off-by: Atul-source <[email protected]>
Signed-off-by: Atul-source <[email protected]>
bpfprogs/bpfmap.go
Outdated
return nil | ||
} | ||
|
||
// The update function is used to update eBPF maps, which are used by network functions. |
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 update function is used to update eBPF maps, which are used by network functions. | |
// The update function is used to update eBPF maps, which are used by ebpf programs |
Signed-off-by: Atul-source <[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.
LGTM
In this PR I have made the changes for map args to take custom key value pairs.