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=iFJua18C; 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 739FE5A026D for ; Tue, 16 Jun 2026 14:51:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781614302; 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=EWTKlLue9AwPsDox9SrUMbmEZnDD1X0d3O/x2ClHwL4=; b=iFJua18C2tV5Cke3JVaxsdsn25Qk/LrFFcs3MjnUDtja2RILoI6X7njWjD+uyzCMQtQzjP hIaauZtLeLSnXsIZpM99IDf9P/raQ8MVlNo5B70EERgcYtqRH11CaTlMR2F6hhVPowWoEm WdJkXgNJ3pUGDedVRbAQTVncj9ZZEeY= Received: from mx-prod-mc-03.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-6-WKlmcC_0MOSPgTsllQZ4-g-1; Tue, 16 Jun 2026 08:51:41 -0400 X-MC-Unique: WKlmcC_0MOSPgTsllQZ4-g-1 X-Mimecast-MFC-AGG-ID: WKlmcC_0MOSPgTsllQZ4-g_1781614300 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 53DCE19540DE for ; Tue, 16 Jun 2026 12:51:40 +0000 (UTC) Received: from lenovo-t14s.redhat.corp (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7ABAB1800593; Tue, 16 Jun 2026 12:51:39 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v5 05/12] arp: Pass queue pair explicitly through ARP send path Date: Tue, 16 Jun 2026 14:51:23 +0200 Message-ID: <20260616125130.1324274-6-lvivier@redhat.com> In-Reply-To: <20260616125130.1324274-1-lvivier@redhat.com> References: <20260616125130.1324274-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: pI8kvMzgUrTIn9QmrMFLm3J-YPOc3dJgxhttWcIdrfE_1781614300 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: EAVSAIKAKJZHXQGQU545HBI6SXI5C6XW X-Message-ID-Hash: EAVSAIKAKJZHXQGQU545HBI6SXI5C6XW 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: Add a qpair parameter to arp(), arp_send_init_req(), and arp_announce(), forwarding it to tap_send_single() instead of hardcoding QPAIR_DEFAULT. tap_start_connection() now consumes the qpair parameter it received in the previous commit. fwd_neigh_table_update() has no queue pair context and keeps using QPAIR_DEFAULT. No functional change. Signed-off-by: Laurent Vivier --- arp.c | 15 +++++++++------ arp.h | 6 +++--- fwd.c | 2 +- tap.c | 6 ++---- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/arp.c b/arp.c index e97c4de86a99..1dc8b87cd993 100644 --- a/arp.c +++ b/arp.c @@ -63,11 +63,12 @@ static bool ignore_arp(const struct ctx *c, /** * arp() - Check if this is a supported ARP message, reply as needed * @c: Execution context + * @qpair: Queue pair on which to send the reply * @data: Single packet with Ethernet buffer * * Return: 1 if handled, -1 on failure */ -int arp(const struct ctx *c, struct iov_tail *data) +int arp(const struct ctx *c, unsigned int qpair, struct iov_tail *data) { union inany_addr tgt; struct { @@ -112,7 +113,7 @@ int arp(const struct ctx *c, struct iov_tail *data) memcpy(resp.am.tha, am->sha, sizeof(resp.am.tha)); memcpy(resp.am.tip, am->sip, sizeof(resp.am.tip)); - tap_send_single(c, QPAIR_DEFAULT, &resp, sizeof(resp)); + tap_send_single(c, qpair, &resp, sizeof(resp)); return 1; } @@ -120,8 +121,9 @@ int arp(const struct ctx *c, struct iov_tail *data) /** * arp_send_init_req() - Send initial ARP request to retrieve guest MAC address * @c: Execution context + * @qpair: Queue pair on which to send the request */ -void arp_send_init_req(const struct ctx *c) +void arp_send_init_req(const struct ctx *c, unsigned int qpair) { struct { struct ethhdr eh; @@ -148,16 +150,17 @@ void arp_send_init_req(const struct ctx *c) memcpy(req.am.tip, &c->ip4.addr, sizeof(req.am.tip)); debug("Sending initial ARP request for guest MAC address"); - tap_send_single(c, QPAIR_DEFAULT, &req, sizeof(req)); + tap_send_single(c, qpair, &req, sizeof(req)); } /** * arp_announce() - Send an ARP announcement for an IPv4 host * @c: Execution context + * @qpair: Queue pair on which to send the announcement * @ip: IPv4 address we announce as owned by @mac * @mac: MAC address to advertise for @ip */ -void arp_announce(const struct ctx *c, struct in_addr *ip, +void arp_announce(const struct ctx *c, unsigned int qpair, struct in_addr *ip, const unsigned char *mac) { char ip_str[INET_ADDRSTRLEN]; @@ -202,5 +205,5 @@ void arp_announce(const struct ctx *c, struct in_addr *ip, eth_ntop(mac, mac_str, sizeof(mac_str)); debug("ARP announcement for %s / %s", ip_str, mac_str); - tap_send_single(c, QPAIR_DEFAULT, &msg, sizeof(msg)); + tap_send_single(c, qpair, &msg, sizeof(msg)); } diff --git a/arp.h b/arp.h index 4b1f38bcec9b..501760393a74 100644 --- a/arp.h +++ b/arp.h @@ -22,9 +22,9 @@ struct arpmsg { unsigned char tip[4]; } __attribute__((__packed__)); -int arp(const struct ctx *c, struct iov_tail *data); -void arp_send_init_req(const struct ctx *c); -void arp_announce(const struct ctx *c, struct in_addr *ip, +int arp(const struct ctx *c, unsigned int qpair, struct iov_tail *data); +void arp_send_init_req(const struct ctx *c, unsigned int qpair); +void arp_announce(const struct ctx *c, unsigned int qpair, struct in_addr *ip, const unsigned char *mac); #endif /* ARP_H */ diff --git a/fwd.c b/fwd.c index c0a6adacd294..0d0e265b7dc0 100644 --- a/fwd.c +++ b/fwd.c @@ -145,7 +145,7 @@ void fwd_neigh_table_update(const struct ctx *c, const union inany_addr *addr, return; if (inany_v4(addr)) - arp_announce(c, inany_v4(addr), e->mac); + arp_announce(c, QPAIR_DEFAULT, inany_v4(addr), e->mac); else ndp_unsolicited_na(c, &addr->a6); } diff --git a/tap.c b/tap.c index 521ccd6d47e7..66dcb83665a7 100644 --- a/tap.c +++ b/tap.c @@ -741,7 +741,7 @@ resume: if (!eh) continue; if (ntohs(eh->h_proto) == ETH_P_ARP) { - arp(c, &data); + arp(c, qpair, &data); continue; } @@ -1453,8 +1453,6 @@ static void tap_start_connection(const struct ctx *c, unsigned int qpair) { union epoll_ref ref = { 0 }; - (void)qpair; - ref.fd = c->fd_tap; switch (c->mode) { case MODE_PASST: @@ -1474,7 +1472,7 @@ static void tap_start_connection(const struct ctx *c, unsigned int qpair) return; if (c->ifi4) - arp_send_init_req(c); + arp_send_init_req(c, qpair); if (c->ifi6 && !c->no_ndp) ndp_send_init_req(c); } -- 2.54.0