From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id DEC925A027F for ; Thu, 30 Nov 2023 13:45:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701348331; 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=+M7Rh0GWiYQOe0Y6uLrUnFSlT/hKQss7u0Zc8NloEus=; b=SZR+xAIeQ3SpDuZqv2dY9MOBZ+5rFNNchsAfe1T6/hiU80pLHlyPL9d/np+mpjrJ2eoAOg 7xIZ+kWv+lEyDxh0BdCQEgoQcvZhsWulFpHFDsy91yGpvHj3KG/0beZDR3ooNEX5GTbI/E TYJ6dMBhlFnIo4BOSXVhxZ7fjEuMlRg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-379-BfaUzlgYNTyqXiA9MDsGRA-1; Thu, 30 Nov 2023 07:45:28 -0500 X-MC-Unique: BfaUzlgYNTyqXiA9MDsGRA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2FC25828CEE; Thu, 30 Nov 2023 12:45:28 +0000 (UTC) Received: from elisabeth (unknown [10.39.208.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6399740C6EB9; Thu, 30 Nov 2023 12:45:27 +0000 (UTC) Date: Thu, 30 Nov 2023 13:45:25 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v3 14/16] pif: Add helpers to get the name of a pif Message-ID: <20231130134525.141020ef@elisabeth> In-Reply-To: <20231130020222.4056647-15-david@gibson.dropbear.id.au> References: <20231130020222.4056647-1-david@gibson.dropbear.id.au> <20231130020222.4056647-15-david@gibson.dropbear.id.au> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: DG3G52VMWWAPVJC2VCVEJHYHPZPPAXYW X-Message-ID-Hash: DG3G52VMWWAPVJC2VCVEJHYHPZPPAXYW X-MailFrom: sbrivio@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: passt-dev@passt.top 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: On Thu, 30 Nov 2023 13:02:20 +1100 David Gibson wrote: > Future debugging will want to identify a specific passt interface. We make > a distinction in these helpers between the name of the *type* of pif, and > name of the pif itself. For the time being these are always the same > thing, since we have at most instance of each type of pif. However, that > might change in future. > > Signed-off-by: David Gibson > --- > Makefile | 3 ++- > pif.c | 21 +++++++++++++++++++++ > pif.h | 19 +++++++++++++++++++ > 3 files changed, 42 insertions(+), 1 deletion(-) > create mode 100644 pif.c > > diff --git a/Makefile b/Makefile > index d14b029..af4fa87 100644 > --- a/Makefile > +++ b/Makefile > @@ -46,7 +46,8 @@ FLAGS += -DDUAL_STACK_SOCKETS=$(DUAL_STACK_SOCKETS) > > PASST_SRCS = arch.c arp.c checksum.c conf.c dhcp.c dhcpv6.c flow.c icmp.c \ > igmp.c isolation.c lineread.c log.c mld.c ndp.c netlink.c packet.c \ > - passt.c pasta.c pcap.c port_fwd.c tap.c tcp.c tcp_splice.c udp.c util.c > + passt.c pasta.c pcap.c pif.c port_fwd.c tap.c tcp.c tcp_splice.c udp.c \ > + util.c > QRAP_SRCS = qrap.c > SRCS = $(PASST_SRCS) $(QRAP_SRCS) > > diff --git a/pif.c b/pif.c > new file mode 100644 > index 0000000..ebf01cc > --- /dev/null > +++ b/pif.c > @@ -0,0 +1,21 @@ > +/* SPDX-License-Identifier: GPL-2.0-or-later > + * Copyright Red Hat > + * Author: David Gibson > + * > + * Passt/pasta interface types and IDs > + */ > + > +#include > +#include > + > +#include "util.h" > +#include "pif.h" > + > +const char *pif_type_str[] = { > + [PIF_NONE] = "", > + [PIF_HOST] = "HOST", > + [PIF_TAP] = "TAP", > + [PIF_SPLICE] = "SPLICE", Nit, not worth respinning in my opinion: those are just English nouns, not acronyms, so they could simply be printed as "host", "tap", and "splice". -- Stefano