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=YoGM+OZH; 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 D563F5A0279 for ; Thu, 14 Aug 2025 11:49:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1755164981; 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=Es6YWaAsN2CmsDpH4XwlMkbjXY1zCs5Nom7L2/RbZXg=; b=YoGM+OZHzDIcMev65co3acdO9UFK9N2oAYOsr3Uvbfla4wTUi6mXJW1eNW8DJNrwAP0P1R qIECsETkJiK7xeHBupZUhOdkf4sSEjUSy7nkZP2Gt1uqkyziBrDu9PETswsTWFPzASBRvR av9Nb744hoICo2JVHaEW3xVC2JSRio4= 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-348-NiIewn9xMKSsA3jq1gxdWw-1; Thu, 14 Aug 2025 05:49:40 -0400 X-MC-Unique: NiIewn9xMKSsA3jq1gxdWw-1 X-Mimecast-MFC-AGG-ID: NiIewn9xMKSsA3jq1gxdWw_1755164979 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 265011800357; Thu, 14 Aug 2025 09:49:39 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.45.225.81]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A56851955E89; Thu, 14 Aug 2025 09:49:37 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v10 22/30] arp: use iov_tail rather than pool Date: Thu, 14 Aug 2025 11:48:41 +0200 Message-ID: <20250814094849.919709-23-lvivier@redhat.com> In-Reply-To: <20250814094849.919709-1-lvivier@redhat.com> References: <20250814094849.919709-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: QfQySGnwJwf_xBvT_vCZAJITzgu-NrkQIEMGD3TCYR0_1755164979 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: JCSHSXT7XGKX6S2EQHDM4ZUYIGFBSDKW X-Message-ID-Hash: JCSHSXT7XGKX6S2EQHDM4ZUYIGFBSDKW 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 , David Gibson 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 Reviewed-by: David Gibson --- 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 8b97df633e70..44677ad15b93 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; @@ -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 7396e1a23834..90f1cf00d87d 100644 --- a/tap.c +++ b/tap.c @@ -722,10 +722,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