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=ddONtu2N; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 54E7F5A0290 for ; Wed, 04 Jun 2025 15:09:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1749042562; 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=20PLr6Y0GHRyyMKVk6LIgikPJvpWcKSsyxewt6zWcow=; b=ddONtu2Nj/tKPuNHVW7DDgGLGLRmxHqiZT6WKN+PIP/1Ekp56Cybp0fA656vwuJ2zXNpoJ ULAQe7SOwU0cufVfrOdl+hnQR8mhuB86vxRsTK3nTyxRhvVqJflW+YTc0LXQJmY1OluTIs zqo1clB56Wy0BmVxS1/oaZzf7WEOPgE= Received: from mx-prod-mc-08.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-402-iYbMbobyMRaxrXirPL2Eaw-1; Wed, 04 Jun 2025 09:09:20 -0400 X-MC-Unique: iYbMbobyMRaxrXirPL2Eaw-1 X-Mimecast-MFC-AGG-ID: iYbMbobyMRaxrXirPL2Eaw_1749042559 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D4A8F18001E3 for ; Wed, 4 Jun 2025 13:09:19 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.45.225.52]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C065219560AD; Wed, 4 Jun 2025 13:09:18 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v6 22/30] arp: use iov_tail rather than pool Date: Wed, 4 Jun 2025 15:08:26 +0200 Message-ID: <20250604130834.3868010-23-lvivier@redhat.com> In-Reply-To: <20250604130834.3868010-1-lvivier@redhat.com> References: <20250604130834.3868010-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: gwKrrdPnYeevXl4AvrcLxNcWnUs7yxL_C9TcfZgRjJg_1749042559 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: CMF65SX3U4EJCGT3NN5FTFV34SP67OFX X-Message-ID-Hash: CMF65SX3U4EJCGT3NN5FTFV34SP67OFX 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: The arp() function signature is changed to accept `struct iov_tail *data` directly, replacing the previous `const struct pool *p` parameter. Consequently, arp() no longer fetches packet data internally using packet_data(), streamlining its logic. This simplifies callers like tap4_handler(), which now pass the iov_tail for the L2 ARP frame directly, removing intermediate pool handling. Signed-off-by: Laurent Vivier --- arp.c | 14 +++++--------- arp.h | 2 +- tap.c | 5 +---- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/arp.c b/arp.c index 65f0f2627db6..b255e30b739d 100644 --- a/arp.c +++ b/arp.c @@ -63,11 +63,11 @@ static bool accept_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; @@ -80,14 +80,10 @@ 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; - if (!packet_get(p, 0, &data)) - return -1; - - eh = IOV_REMOVE_HEADER(&data, eh_storage); - ah = IOV_REMOVE_HEADER(&data, ah_storage); - am = IOV_REMOVE_HEADER(&data, am_storage); + eh = IOV_REMOVE_HEADER(data, eh_storage); + ah = IOV_REMOVE_HEADER(data, ah_storage); + am = IOV_REMOVE_HEADER(data, am_storage); 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 09da76ea23bc..1daa3009cc65 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; } -- 2.49.0