summaryrefslogtreecommitdiff
path: root/drivers/ppposeq/ppposeq.h
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@mail.ru>2026-07-30 15:48:55 +0500
committerVladislav Grishenko <themiron@mail.ru>2026-08-03 01:06:01 +0500
commitf2606293c1007aa68a8bcf1e92ae3d64e250eadb (patch)
treea804a66f12bf586f3724d959b40dab40e0862244 /drivers/ppposeq/ppposeq.h
parent332daf3705c8f6ec2e04e041261f86ba7b8650a6 (diff)
downloadaccel-ppp-sstp-ppposeq.tar.gz
accel-ppp-sstp-ppposeq.zip
sstp: add ppposeq transport to avoid userspace HDLC framingsstp-ppposeq
A pty is a byte stream, so the tty flip buffer merges frames written back to back and sstp has to re-delimit them with async HDLC escaping and a CRC-16 FCS. On a 1452-byte payload that is ~3600 ns per frame, most of it spent on the FCS. PPPOSEQ is a pppox protocol whose socket is the ppp endpoint itself, so one datagram is one frame and no framing is needed at all. The same payload takes ~380 ns per frame, about 9 times less. Requires kernel 2.6.37, the first with PX_MAX_PROTO 3, whose remaining slot it claims. Supported kernels are from 2.6.37 to 7.2. The new ppp-mode option selects the transport; auto, the default, falls back to async when the module is unavailable, so hosts with prebuilt kernels are unaffected. PPP_SYNC is removed, being disabled and unfixable over a pty: frame boundaries cannot be recovered from the stream, and coalescing cannot be prevented since frames arrive from the network stack.
Diffstat (limited to 'drivers/ppposeq/ppposeq.h')
-rw-r--r--drivers/ppposeq/ppposeq.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/ppposeq/ppposeq.h b/drivers/ppposeq/ppposeq.h
new file mode 100644
index 00000000..ecdbdfb1
--- /dev/null
+++ b/drivers/ppposeq/ppposeq.h
@@ -0,0 +1,34 @@
+#ifndef __PPPOSEQ_H
+#define __PPPOSEQ_H
+
+#include <linux/if_pppox.h>
+
+/*
+ * ppposeq - PPP over a SEQPACKET AF_PPPOX socket.
+ *
+ * Replaces the pty + ppp_async transport for userspace PPP terminators
+ * such as sstp. A pty is a byte stream, so frame boundaries are lost in
+ * the tty flip buffer and have to be rebuilt with HDLC escape+FCS framing.
+ * Here the socket itself is the ppp endpoint and each datagram carries
+ * exactly one ppp frame, so no framing is needed on either side.
+ *
+ * fd = socket(AF_PPPOX, SOCK_SEQPACKET, PX_PROTO_OSEQ);
+ * connect(fd, &sa, sizeof(sa)); // registers the channel
+ * ioctl(fd, PPPIOCGCHAN, &idx);
+ * chan = open("/dev/ppp"); ioctl(chan, PPPIOCATTCHAN, &idx);
+ * // frames flow over fd with send()/recv()
+ *
+ * Only the protocol number is new; everything else uses the common
+ * AF_PPPOX and PPPIOC* interfaces.
+ */
+
+#ifndef PX_PROTO_OSEQ
+#define PX_PROTO_OSEQ 3
+#endif
+
+struct sockaddr_ppposeq {
+ __kernel_sa_family_t sa_family; /* AF_PPPOX */
+ unsigned int sa_protocol; /* PX_PROTO_OSEQ */
+} __attribute__((packed));
+
+#endif