]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
xdp nit: utilize freeing API added in libknot 3.1
authorVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 23 Mar 2022 11:47:14 +0000 (12:47 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 4 Apr 2022 08:29:03 +0000 (10:29 +0200)
It's probably a bit more efficient, but this part of code should be
rarely used even on a resolver serving all in XDP.

daemon/worker.c

index 7397ca17493e6f7fdb430185487eb44d43705c7f..f14378e6f51890881b8362ac4f97e38596b59ac0 100644 (file)
@@ -318,8 +318,13 @@ static void free_wire(const struct request_ctx *ctx)
        knot_xdp_msg_t out;
        out.payload.iov_base = ans->wire;
        out.payload.iov_len = 0;
-       uint32_t sent;
+       uint32_t sent = 0;
+#if KNOT_VERSION_HEX >= 0x030100
+       int ret = 0;
+       knot_xdp_send_free(xhd->socket, &out, 1);
+#else
        int ret = knot_xdp_send(xhd->socket, &out, 1, &sent);
+#endif
        kr_assert(ret == KNOT_EOK && sent == 0);
        kr_log_debug(XDP, "freed unsent buffer, ret = %d\n", ret);
 }