[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] ebpf: Fix indirections table setting
From: |
Akihiko Odaki |
Subject: |
[PATCH 2/2] ebpf: Fix indirections table setting |
Date: |
Tue, 26 Mar 2024 19:06:30 +0900 |
The kernel documentation says:
> The value stored can be of any size, however, all array elements are
> aligned to 8 bytes.
https://www.kernel.org/doc/html/v6.8/bpf/map_array.html
Fixes: 333b3e5fab75 ("ebpf: Added eBPF map update through mmap.")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
ebpf/ebpf_rss.h | 2 +-
ebpf/ebpf_rss.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/ebpf/ebpf_rss.h b/ebpf/ebpf_rss.h
index 239242b0d26e..7d15b600bf5b 100644
--- a/ebpf/ebpf_rss.h
+++ b/ebpf/ebpf_rss.h
@@ -26,7 +26,7 @@ struct EBPFRSSContext {
/* mapped eBPF maps for direct access to omit bpf_map_update_elem() */
void *mmap_configuration;
void *mmap_toeplitz_key;
- void *mmap_indirections_table;
+ uint64_t *mmap_indirections_table;
};
struct EBPFRSSConfig {
diff --git a/ebpf/ebpf_rss.c b/ebpf/ebpf_rss.c
index 2e506f974357..e0f300febb77 100644
--- a/ebpf/ebpf_rss.c
+++ b/ebpf/ebpf_rss.c
@@ -190,8 +190,9 @@ static bool ebpf_rss_set_indirections_table(struct
EBPFRSSContext *ctx,
return false;
}
- memcpy(ctx->mmap_indirections_table, indirections_table,
- sizeof(*indirections_table) * len);
+ for (size_t i = 0; i < len; i++) {
+ ctx->mmap_indirections_table[i] = indirections_table[i];
+ }
return true;
}
--
2.44.0