From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id F02495A026F for ; Tue, 7 Nov 2023 02:40:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1699321229; bh=GGA/65k/xLLLoajzYYNdX5m3gNkXGgTjaw/g1c+F7GA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vh8CWrH3szK9PfYNz4HMDCn0y+B9mrAPQeNUio6tsXjdNxSECCGTK6Ziv1a9j+BlM ZTgQL4EoPgkwQZo2NH9fkgBft/hFEHx+VoKYeaCz4DFkIxYqROJ7g3ZUc+eXt7VIjl SjNimUIOjPCsNT/0mxtN6bFM2h1o0TDIFWLaW66E= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4SPWBP2fhtz4wd2; Tue, 7 Nov 2023 12:40:29 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 2/4] pif: Introduce notion of passt/pasta interface Date: Tue, 7 Nov 2023 12:40:14 +1100 Message-ID: <20231107014016.1927410-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231107014016.1927410-1-david@gibson.dropbear.id.au> References: <20231107014016.1927410-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: CIHUKCH22OV4AOUZRGKZMDGSB3O7DOPD X-Message-ID-Hash: CIHUKCH22OV4AOUZRGKZMDGSB3O7DOPD X-MailFrom: dgibson@gandalf.ozlabs.org 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: 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: We have several possible ways of communicating with other entities. We use sockets to communicate with the host and other network sites, but also in a different context to communicate "spliced" channels to a namespace. We also use a tuntap device or a qemu socket to communicate with the namespace or guest. For the time being these are just defined implicitly by how we structure things. However, there are other communication channels we want to use in future (e.g. virtio-user), and we want to allow more flexible forwarding between those. To accomplish that we're going to want a specific way of referring to those channels. Introduce the concept of a "passt/pasta interface" or "pif" representing a specific channel to communicate network data. Each pif is assumed to be associated with a specific network namespace in the broad sense (that is as a place where IP addresses have a consistent meaning - not the Linux specific sense). But there could be multiple pifs communicating with the same namespace (e.g. the spliced and tap interfaces in pasta). Signed-off-by: David Gibson --- Makefile | 2 +- pif.h | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 pif.h diff --git a/Makefile b/Makefile index 0324fdd..55972b1 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ MANPAGES = passt.1 pasta.1 qrap.1 PASST_HEADERS = arch.h arp.h checksum.h conf.h dhcp.h dhcpv6.h icmp.h \ inany.h isolation.h lineread.h log.h ndp.h netlink.h packet.h passt.h \ - pasta.h pcap.h port_fwd.h siphash.h tap.h tcp.h tcp_conn.h \ + pasta.h pcap.h pif.h port_fwd.h siphash.h tap.h tcp.h tcp_conn.h \ tcp_splice.h udp.h util.h HEADERS = $(PASST_HEADERS) seccomp.h diff --git a/pif.h b/pif.h new file mode 100644 index 0000000..a705f2c --- /dev/null +++ b/pif.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright Red Hat + * Author: David Gibson + * + * Passt/pasta interface types and IDs + */ +#ifndef PIF_H +#define PIF_H + +/** + * enum pif_type - Type of passt/pasta interface ("pif") + * + * pifs can be an L4 level channel (sockets) or an L2 level channel (tap device + * or qemu socket). + */ +enum pif_type { + /* Invalid or not present pif */ + PIF_NONE = 0, + /* Host socket interface */ + PIF_HOST, + /* Qemu socket or namespace tuntap interface */ + PIF_TAP, + /* Namespace socket interface for splicing */ + PIF_SPLICE, +}; + +#endif /* PIF_H */ -- 2.41.0