From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bb2uWG4f; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 519DE5A061A for ; Wed, 16 Apr 2025 17:26:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744817209; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lFl8EgbEv2aBkY/W7zw63IgaLwTt2s4t/0D+qQHzI+g=; b=bb2uWG4fK25BjScimmtNVszeuXbz4LfUSKJmcMOm7IaWCSQPpKxv30IqvtsAeNI+vGMi+y /TobInMGmxSnfrZeGpcuiTCcnxD5UGiPvipRj57MEvGY9GXmUTMFVSI6rjtei+VIqfRiUm WiwlY8SsdI73Mr3pstLy6SKx4tuPYP4= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-487-mLFfO6MGO1C0gdZb2niOYw-1; Wed, 16 Apr 2025 11:26:48 -0400 X-MC-Unique: mLFfO6MGO1C0gdZb2niOYw-1 X-Mimecast-MFC-AGG-ID: mLFfO6MGO1C0gdZb2niOYw_1744817207 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 478E9180034A for ; Wed, 16 Apr 2025 15:26:47 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.44.32.6]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 37F431955F3C; Wed, 16 Apr 2025 15:26:45 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v4 21/28] arp: use iov_tail rather than pool Date: Wed, 16 Apr 2025 17:25:58 +0200 Message-ID: <20250416152605.3947623-22-lvivier@redhat.com> In-Reply-To: <20250416152605.3947623-1-lvivier@redhat.com> References: <20250416152605.3947623-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: WIHw4wxEdVhoVOjbQsrF4Mw6dJGY7aElZG5qBu9hAq4_1744817207 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: 226ARQ2ZBHE353CZH6BVS2HRWGGAJGUA X-Message-ID-Hash: 226ARQ2ZBHE353CZH6BVS2HRWGGAJGUA X-MailFrom: lvivier@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Laurent Vivier X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Laurent Vivier --- arp.c | 14 +++++--------- arp.h | 2 +- tap.c | 5 +---- tap.h | 1 + 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/arp.c b/arp.c index 4cb6965e9793..f979ad260275 100644 --- a/arp.c +++ b/arp.c @@ -63,11 +63,11 @@ static bool ignore_arp(const struct ctx *c, /** * arp() - Check if this is a supported ARP message, reply as needed * @c: Execution context - * @p: Packet pool, single packet with Ethernet buffer + * @data: Single packet with Ethernet buffer * * Return: 1 if handled, -1 on failure */ -int arp(const struct ctx *c, const struct pool *p) +int arp(const struct ctx *c, struct iov_tail *data) { struct { struct ethhdr eh; @@ -77,17 +77,13 @@ int arp(const struct ctx *c, const struct pool *p) const struct ethhdr *eh; const struct arphdr *ah; const struct arpmsg *am; - struct iov_tail data; struct arphdr ahc; struct ethhdr ehc; struct arpmsg amc; - if (!packet_data(p, 0, &data)) - return -1; - - eh = IOV_REMOVE_HEADER(&data, ehc); - ah = IOV_REMOVE_HEADER(&data, ahc); - am = IOV_REMOVE_HEADER(&data, amc); + eh = IOV_REMOVE_HEADER(data, ehc); + ah = IOV_REMOVE_HEADER(data, ahc); + am = IOV_REMOVE_HEADER(data, amc); if (!eh || !ah || !am) return -1; diff --git a/arp.h b/arp.h index ac5cd16e47f4..86bcbf878eda 100644 --- a/arp.h +++ b/arp.h @@ -20,6 +20,6 @@ struct arpmsg { unsigned char tip[4]; } __attribute__((__packed__)); -int arp(const struct ctx *c, const struct pool *p); +int arp(const struct ctx *c, struct iov_tail *data); #endif /* ARP_H */ diff --git a/tap.c b/tap.c index 56b8cb21d9dd..b1c817451031 100644 --- a/tap.c +++ b/tap.c @@ -720,10 +720,7 @@ resume: if (!eh) continue; if (ntohs(eh->h_proto) == ETH_P_ARP) { - PACKET_POOL_P(pkt, 1, in->buf, in->buf_size); - - packet_add(pkt, &data); - arp(c, pkt); + arp(c, &data); continue; } diff --git a/tap.h b/tap.h index 954ad440a287..095190eea44e 100644 --- a/tap.h +++ b/tap.h @@ -115,6 +115,7 @@ void tap_handler_passt(struct ctx *c, uint32_t events, const struct timespec *now); int tap_sock_unix_open(char *sock_path); void tap_sock_reset(struct ctx *c); +void tap_sock_set_mr(struct vhost_user_memory *mr, int nb); void tap_sock_update_pool(void *base, size_t size); void tap_backend_init(struct ctx *c); void tap_flush_pools(void); -- 2.49.0