All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: "Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	 Andrew Melnychenko <andrew@daynix.com>,
	 Yuri Benditovich <yuri.benditovich@daynix.com>
Cc: qemu-devel@nongnu.org, Akihiko Odaki <akihiko.odaki@daynix.com>
Subject: [PATCH 2/2] ebpf: Fix indirections table setting
Date: Tue, 26 Mar 2024 19:06:30 +0900	[thread overview]
Message-ID: <20240326-vhost-v1-2-09bd85b1ba2c@daynix.com> (raw)
In-Reply-To: <20240326-vhost-v1-0-09bd85b1ba2c@daynix.com>

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



      parent reply	other threads:[~2024-03-26 10:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 10:06 [PATCH 0/2] virtio-net: Fix RSS Akihiko Odaki
2024-03-26 10:06 ` [PATCH 1/2] virtio-net: Fix vhost virtqueue notifiers for RSS Akihiko Odaki
2024-04-08 10:13   ` Michael S. Tsirkin
2024-04-09  3:40     ` Jason Wang
2024-03-26 10:06 ` Akihiko Odaki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240326-vhost-v1-2-09bd85b1ba2c@daynix.com \
    --to=akihiko.odaki@daynix.com \
    --cc=andrew@daynix.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yuri.benditovich@daynix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.