Skip to content
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

Merged
merged 13 commits into from
Jul 17, 2024
Merged

Conversation

Atul-source
Copy link
Contributor

In this PR I have made the changes for map args to take custom key value pairs.

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]>
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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.

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)
Copy link
Contributor

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.

pmoroney
pmoroney previously approved these changes Jul 17, 2024
Copy link

@pmoroney pmoroney left a 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]>
return nil
}

// The update function is used to update eBPF maps, which are used by network functions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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]>
Copy link

@pmoroney pmoroney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sanfern sanfern merged commit 9bbb4a0 into l3af-project:main Jul 17, 2024
8 checks passed
@sanfern sanfern added breaking-change enhancement New feature or request labels Jul 30, 2024
@Atul-source Atul-source deleted the map-arg-opt branch January 2, 2025 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants