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=BPGXjSPT; 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 4DB475A0287 for ; Mon, 23 Jun 2025 13:07:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1750676844; 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=AgcqjzB4fPZ7dIDT+zKCGsCS6yBOsY83GIAeYDb2sbA=; b=BPGXjSPTZRpY2ksqDf9rVVsddQHue9gBQrc6KyIM7xUX4G2NlhVlxRb1SQH9DaxtvLruDS pStH75ko/0RkcHhLDw+6vYDZ6BA5JTveFDhd6ZgueSbeuQtG+zNEp4Faa54NEWUg4okJjM vf1X86wLlDUgTSKyAltZoqvVrkKamyE= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-227-ImF68UN9OCe5zHmLvTuxFQ-1; Mon, 23 Jun 2025 07:07:22 -0400 X-MC-Unique: ImF68UN9OCe5zHmLvTuxFQ-1 X-Mimecast-MFC-AGG-ID: ImF68UN9OCe5zHmLvTuxFQ_1750676842 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3727D195609F for ; Mon, 23 Jun 2025 11:07:22 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.45.224.132]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 24CFD195E340; Mon, 23 Jun 2025 11:07:20 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v7 23/31] arp: use iov_tail rather than pool Date: Mon, 23 Jun 2025 13:06:27 +0200 Message-ID: <20250623110635.1478625-24-lvivier@redhat.com> In-Reply-To: <20250623110635.1478625-1-lvivier@redhat.com> References: <20250623110635.1478625-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: rHU2XHuwtCkXxZ9igjKkWf6hUskigyKOJJyL_4F0r9o_1750676842 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: RX25TVJE66NG7IWFBEVPZIO44VUYZH2F X-Message-ID-Hash: RX25TVJE66NG7IWFBEVPZIO44VUYZH2F 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 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 1d2e6fd802e9..ace735cfc136 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