qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/5] ebpf: Added eBPF initialization by fds and map update.


From: Jason Wang
Subject: Re: [PATCH 1/5] ebpf: Added eBPF initialization by fds and map update.
Date: Fri, 20 Aug 2021 11:34:06 +0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0


在 2021/7/13 下午11:37, Andrew Melnychenko 写道:
-static bool ebpf_rss_set_indirections_table(struct EBPFRSSContext *ctx,
-                                            uint16_t *indirections_table,
-                                            size_t len)
-{
-    uint32_t i = 0;
+    ctx->program_fd = program_fd;
+    ctx->map_configuration = config_fd;
- if (!ebpf_rss_is_loaded(ctx) || indirections_table == NULL ||
-       len > VIRTIO_NET_RSS_MAX_TABLE_LEN) {
+    ctx->mmap_configuration = mmap(NULL, qemu_real_host_page_size,
+                                   PROT_READ | PROT_WRITE, MAP_SHARED,
+                                   ctx->map_configuration, 0);
+    if (ctx->mmap_configuration == MAP_FAILED) {
+        trace_ebpf_error("eBPF RSS", "can not mmap eBPF configuration array");
          return false;
      }
- for (; i < len; ++i) {
-        if (bpf_map_update_elem(ctx->map_indirections_table, &i,
-                                indirections_table + i, 0) < 0) {
-            return false;
-        }
-    }
-    return true;
-}
-


It looks to me you want to drop syscall path for map updating completely. I think we'd better keep that for backward compatibility?

Thanks




reply via email to

[Prev in Thread] Current Thread [Next in Thread]