From nobody Sat Feb 7 15:22:03 2026 Received: from mail-dl1-f54.google.com (mail-dl1-f54.google.com [74.125.82.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2041F37AA92 for ; Fri, 23 Jan 2026 01:42:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769132579; cv=none; b=dAwbBiG3ILyk4xkqiyVct4wQs6b1NBm3DhT9RRAGlsyWEQ4r7rt+SqmuMWyQ0v0AQ7KvglyId7EuoAm1SVlONC9/axxbxUIDnaIm+KZszG68LwVpKwRIF1SUdxcG3O3rVDV/LtkJmeBbtMoul/IF3Hl/Wm4rZ6Zzw6ZAhqyaIds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769132579; c=relaxed/simple; bh=XgQZQFLyE+cZXfrumIA0EuNEWtSsCOWImP0qsgzSk5w=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=IvdBMVaCcMJjhdeC2h3K60Jhi4jR5QP4ADq9/RX+1CC00uON6pusnNesZGj+td7S97zhC7fJ7WRr9OYT3v1Ay0m6858EpkikeTTWGKsdzk9dhnZ424YPllnun+op41coV4uL/IKKR6flEzieRmFGDtC1FcdeBpusDQK5QVIoKK4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TOfE8wIb; arc=none smtp.client-ip=74.125.82.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TOfE8wIb" Received: by mail-dl1-f54.google.com with SMTP id a92af1059eb24-12332910300so719526c88.0 for ; Thu, 22 Jan 2026 17:42:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769132546; x=1769737346; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=uifsBKed8myajuNyljKie4CeDV4OXM0xUtAmhIR3vmg=; b=TOfE8wIbEcArpcrOJWAKo2lmXRiva9XZq55572B/R2Asi/go4G18GOZEEpWc22HirB lFzS1ATiH1joxa1AC7j/ADrMq1K9FavZQBmJ0ts/FTLt3oQ/23LvaTg0HTGO2Rtz+Qp4 GXjXjt9QpluapX43lX0gy+6jZa2hGsajGobPnlEsrl6pus44+Ui/zvDUCFbxzFRi2DNp IfyRUc2VYnKImrm3ZaIzL1kBDqmPomCgH12LS2OWUbWe/tffTTlsfZp3wmMU/Q+YSGjM 8zxjK8EkndYpPAq7lUaz3dyEI4LnIPZCoAdeeXL0meaMJqQF1ALtH+6ZKkdMILFA9lUA hQOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769132546; x=1769737346; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=uifsBKed8myajuNyljKie4CeDV4OXM0xUtAmhIR3vmg=; b=EUd15lvLpEqUzQXQyGtyqVZrixKGFYntBcNqAS5XcaHdsTABgrjhJIdfJ3TKTffLZp rWBkDkaI17XLtqPvogh8z1ipdcWwilxfCtrkckWeZ2ZNE2jB+oEubp9hL9ipNKdHMxqe epjTYDm8pt0IAcpE3BYUsggifb4wRgwH/rcLXL1kCuEU2t6D8yy64uHOOdfx8ecQRRAd 3oTLG8oLpBfCtuYpT1sMBOXsByE4Gg5iuFZrenFyfSKXue0RxW9gbFwHwThDA7K+9v4m XunwcuOtJu/3EBUUOn5rdZ+GadNy4G6Az47sLd8c1E44DFv/ThRHJnqxRusr29R1D97u PUSw== X-Forwarded-Encrypted: i=1; AJvYcCUYq+rniVe93N5HTxp3xXTAjrcnEkzaCu40/fpJio97x6u3Yl5aFByv3hp+/H0XwUaN2dQXbwreSriVjTY=@vger.kernel.org X-Gm-Message-State: AOJu0YyrEN0BbfyOL8rMVqB7CvCPvEGhEMovmc1kiSR+xKV7Y8sCDbAN JmCXH2a0Vb6gmLB+nK2cGkWtG7mkwFqf0rOBSKPKsH3cOcWMrjDsVqsz X-Gm-Gg: AZuq6aKhiBr5Eu7V9zUIULaqWNFwim/Df+hg72BIN+Y9qc+QJyc/dbkwOZl5LtkUcl9 aSij9N2vlQTbpfJCYqa4+6ASdVUnod9Pm4L4nygjpgLXvvxRqqo/GV4LVPNA/neXK6g/4jDLTpf xci/bw0fuV3McAkiCgVsK0YJR2reSGGxjzpPxCg3vR57901zihhFaOswHNXiNPutuJYrpnJe94K VrR2dlcTtLtmAh80AQ0lWKOQEhDSAaCJXq95u1UYCPuuMEqABrTa9LrCZFJXp5g3uF2ykyn0wAg qGaMu3Ecbaa7RTrqiPZXEStUFUNBMREJ9jwGqMIDUiVh68+wqsCBXc7khzLa/aAf7afMzS+ut0W 0f1OY1bnwPFfbuuEnWARzIzLvBPlN2GmphLNfspIGO1l8+qeDq2sAkyvNvzJbSQw= X-Received: by 2002:a05:7022:e16:b0:123:345f:5d9c with SMTP id a92af1059eb24-1247dba58a2mr589486c88.2.1769132544457; Thu, 22 Jan 2026 17:42:24 -0800 (PST) Received: from gmail.com ([2a09:bac1:19c0:20::4:33f]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1247d9a44d8sm1770093c88.14.2026.01.22.17.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 17:42:24 -0800 (PST) From: Qingfang Deng To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-ppp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= Subject: [PATCH net-next v3] ppp: enable TX scatter-gather Date: Fri, 23 Jan 2026 09:42:13 +0800 Message-ID: <20260123014214.225278-1-dqfext@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" PPP channels using chan->direct_xmit prepend the PPP header to a skb and call dev_queue_xmit() directly. In this mode the skb does not need to be linear, but the PPP netdevice currently does not advertise scatter-gather features, causing unnecessary linearization and preventing GSO. Enable NETIF_F_SG and NETIF_F_FRAGLIST on PPP devices and add an .ndo_fix_features() callback to disable them when the underlying PPP channel is not using direct_xmit (i.e. IFF_NO_QUEUE is not set in priv_flags). This allows the networking core to pass non-linear skbs directly only when it is safe to do so. PPP compressors still require linear skbs, and their states can change at runtime. In order to avoid races, instead of toggling features, call skb_linearize() before passing buffers to them. Compressors are uncommon on high-speed links, so this does not affect the fast path. Signed-off-by: Qingfang Deng --- v2 -> v3: toggle features only if the underlying ppp_channel changes. Call skb_linearize() if compressors are in use. - https://lore.kernel.org/linux-ppp/20251103031501.404141-1-dqfext@gmail.c= om/ drivers/net/ppp/ppp_generic.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index f9f0f16c41d1..d706a175cea9 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c @@ -1545,6 +1545,16 @@ ppp_get_stats64(struct net_device *dev, struct rtnl_= link_stats64 *stats64) dev_fetch_sw_netstats(stats64, dev->tstats); } =20 +static netdev_features_t +ppp_fix_features(struct net_device *dev, netdev_features_t features) +{ + /* Don't advertise SG/FRAGLIST when IFF_NO_QUEUE is absent */ + if (!(dev->priv_flags & IFF_NO_QUEUE)) + features &=3D ~(NETIF_F_SG | NETIF_F_FRAGLIST); + + return features; +} + static int ppp_dev_init(struct net_device *dev) { struct ppp *ppp; @@ -1619,6 +1629,7 @@ static const struct net_device_ops ppp_netdev_ops =3D= { .ndo_start_xmit =3D ppp_start_xmit, .ndo_siocdevprivate =3D ppp_net_siocdevprivate, .ndo_get_stats64 =3D ppp_get_stats64, + .ndo_fix_features =3D ppp_fix_features, .ndo_fill_forward_path =3D ppp_fill_forward_path, }; =20 @@ -1641,6 +1652,8 @@ static void ppp_setup(struct net_device *dev) dev->flags =3D IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; dev->priv_destructor =3D ppp_dev_priv_destructor; dev->pcpu_stat_type =3D NETDEV_PCPU_STAT_TSTATS; + dev->features =3D NETIF_F_SG | NETIF_F_FRAGLIST; + dev->hw_features =3D dev->features; netif_keep_dst(dev); } =20 @@ -1710,6 +1723,10 @@ pad_compress_skb(struct ppp *ppp, struct sk_buff *sk= b) ppp->xcomp->comp_extra + ppp->dev->hard_header_len; int compressor_skb_size =3D ppp->dev->mtu + ppp->xcomp->comp_extra + PPP_HDRLEN; + + if (skb_linearize(skb)) + return NULL; + new_skb =3D alloc_skb(new_skb_size, GFP_ATOMIC); if (!new_skb) { if (net_ratelimit()) @@ -1797,6 +1814,10 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) case PPP_IP: if (!ppp->vj || (ppp->flags & SC_COMP_TCP) =3D=3D 0) break; + + if (skb_linearize(skb)) + goto drop; + /* try to do VJ TCP header compression */ new_skb =3D alloc_skb(skb->len + ppp->dev->hard_header_len - 2, GFP_ATOMIC); @@ -3537,6 +3558,12 @@ ppp_connect_channel(struct channel *pch, int unit) spin_unlock(&pch->upl); out: mutex_unlock(&pn->all_ppp_mutex); + if (ret =3D=3D 0) { + rtnl_lock(); + netdev_update_features(ppp->dev); + rtnl_unlock(); + } + return ret; } =20 --=20 2.43.0