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=OBK+iwF2; 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 329A85A061D for ; Thu, 17 Apr 2025 18:52:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744908742; 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=MZISmJopDqWsmGIYeN91pezKjIdKFL534wI/MuMeB/Q=; b=OBK+iwF2v9Tkqzp6M2InaqhwPB8Qozm1hikvf5fBGwDDFcf7DZmvAAsvcURF5wpLpSOmZz aHskvk01t1g+PxfpGy4/W1C232HufiF6giVueBlwYtKS+VdKw0vD2gismDD0w4YmDhVo7Q /T84RbaNvu421hpcT5DdKrs0qXEu858= Received: from mx-prod-mc-05.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-422-EQbT42MDNtCOe2mv6hQZ4Q-1; Thu, 17 Apr 2025 12:52:21 -0400 X-MC-Unique: EQbT42MDNtCOe2mv6hQZ4Q-1 X-Mimecast-MFC-AGG-ID: EQbT42MDNtCOe2mv6hQZ4Q_1744908740 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6767E1955F01 for ; Thu, 17 Apr 2025 16:52:20 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.44.32.6]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5322819560BA; Thu, 17 Apr 2025 16:52:19 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v5 21/29] arp: use iov_tail rather than pool Date: Thu, 17 Apr 2025 18:51:28 +0200 Message-ID: <20250417165136.2688884-22-lvivier@redhat.com> In-Reply-To: <20250417165136.2688884-1-lvivier@redhat.com> References: <20250417165136.2688884-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: Uq53UDHfMux8vVVHcjEqgJIF8eT0plWKN26lV3quReY_1744908740 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: E26EP5VZXDGWT7DERHR4PLO44RMBOJZM X-Message-ID-Hash: E26EP5VZXDGWT7DERHR4PLO44RMBOJZM 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 +---- 3 files changed, 7 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; } -- 2.49.0