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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD9BD323406 for ; Tue, 3 Feb 2026 10:55:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770116113; cv=none; b=jdso54q3wm7rdCtC6wsQwZK2H8abvzgSB3QgZgVgaLPFOOaTC16+lnHfbXuqfH/0/3MVKRNsBD/BqVxX7czc4+p2GPHydl8U0o1pW3XQyNswMjxdNOaSsg3LKar5yBdy3q6/bCFZm8oqdT0CgGVrf1ElGOwA0Wk/IXOXfs7+IiQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770116113; c=relaxed/simple; bh=wsT1DCBVScKEpY7lkQ5lAK6GmXaE2h8dBINyYKRIc8o=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=d6Bkw0uN9WEnz6NCGnAmHHA5VkPjo9NXRzBetKnsIU/mT6l/6l1KxE6NT4KCr2mOpWgNYbJqW481/7VmAUKPqf1KGueB0stpp+GOrYA4LuPMuUfy6H945PuGV3/TCcpP4UBC+R1efy/3woCBUu0xJwPs9sJXZayYgJlHj6POj7I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=XakpJmOu; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=bhemfROC; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XakpJmOu"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="bhemfROC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770116109; 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=3zdSIwol8eIwonvoR4fHbLrzSsymY7+cYRfeKmjVX+w=; b=XakpJmOut3UNC6muQc/uNnCVojmfVwROZ3WvMHWEXGRNPbwRSpCOy5lWcFXy/+S6Zn99uZ +vu9fmhanmV2264ZaV7XllQyaHGQ6opNVpQWc6uR5vNt5a4o52UmAs0096WHhMajs5krFb 8MgCBX7Ipz6TVMCxxISssjkUi+dW7NA= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-8XnKpfO3PhS3_NbwAVO4EA-1; Tue, 03 Feb 2026 05:55:08 -0500 X-MC-Unique: 8XnKpfO3PhS3_NbwAVO4EA-1 X-Mimecast-MFC-AGG-ID: 8XnKpfO3PhS3_NbwAVO4EA_1770116107 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4801bceb317so50395745e9.1 for ; Tue, 03 Feb 2026 02:55:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770116107; x=1770720907; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=3zdSIwol8eIwonvoR4fHbLrzSsymY7+cYRfeKmjVX+w=; b=bhemfROCsxFA63pJLCnMytTaHS4WP6idd7ylHy4w3WKTT4L2sJQEgx9MZ/Bw3xAhEC h5KLuTDSc8PVvUaAhSkQOeT3yiug961YwbiRVNU2gBgchviAXx3pCnxVqg9uSyOjIAZa nILxk9mWZVTSW5OUIuapm9dx1gSh4jzksvVRSnt/eFukH5Z0+Sb2ohcSi6L3i/IKvVfH E5TgLzcwl1dpiICV9QVRDjkdRX1EsweSUphBqLrduS7ApFMCZDM0jWzmMM01HENooT6b HNoo3N5E6W3u48YwOKd4hUhmlGfnc4xhq1ecdhApYG8kYGdkDRVsU0/2EzDyhYeBtnU6 VrcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770116107; x=1770720907; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3zdSIwol8eIwonvoR4fHbLrzSsymY7+cYRfeKmjVX+w=; b=K02iid1g9ikHtn2abPR4pZue7TT96qX4ezPD19CM67OBCaIZb7YDUt4ypCDvALrboP qgpg8i5l2N+TKJgARmEkqkYm/SyNNWzfSbf2V0wMuzUo37ISE+mFv9Nypb6hOWRvHTh/ 0jE7WPcQCDaheShIcF+TlxH77R568VZ1ot3rk1m5xCQERwOBAdB15BFHYleooIWDyAt4 NyCMuOIOEwA5OKSALQwWSdULZj2Qd5WnOuDU+f/8eHlzxSILUl/EYOiAxYZJp/NPZhGN hWbXi4iV6D57N9yJo9rePWe3zOF7UCskJ7YZgZFiPzbH6w2aE2pH7k0or8dStRX6VfTI w96g== X-Forwarded-Encrypted: i=1; AJvYcCU9OPq/CEoIPeKH6mOQnQ+LGgWjzQ5SypxVDdiLN9/jNrajZpXraFsr9UFdNgI2VXlWVRVV/N/U8Ksjyfg=@vger.kernel.org X-Gm-Message-State: AOJu0YzdKryeDNGNPMjp5ZjjLSJxatIXz0PjbP6veJVuQUVeZ+lKG89E 94QQeXCJwZ53dvaw5RvGy1LRVmlEkqT+H/hmgbZqE6YR9QBkvOturqDGfYgVnwCZZFw2BjuJi7Z 4IhksUCeFoWE/MSXy/S8UPCArcDF8kzZKTxsNVzQb6CJmdOfaeL0SD3oqdNw5UWD4kA== X-Gm-Gg: AZuq6aLwB9C/02kInAeGYe8EN0oT7sL8Vt2YZJxaKLOqNEb0PvrWujGUSPw2yeymbjA Eo7lsskxXNxsYEdmFjU68HXlsJ54MTq63B/ZiQiSYXxz83LKojHpkN2D1QEnBENfIvoRh7Gv4kM SvBVxjhYuk1xbMv4QbPtYZ3HoxUB5IflX3thYbbm2caMjerDdRnSezO0v3U8eGTFoXt86aflFT9 cgApwCUHPEz8Lll7mpBF2supA9w1HLMLVUCW1OOQFq+vpTgj8m46A5YrmxStc7TH6N0JELwUjt1 Ee8sXIJXi2UGccKCM8tZKYlWtrC2QWcelkj4Rbr0Z5Swfkg6qc7uTiDA3M1OMdLtbzUdE77Kz7p 2fDaqgVfkNCU= X-Received: by 2002:a05:600c:45c5:b0:47d:403e:9cd5 with SMTP id 5b1f17b1804b1-482db45fcb4mr193220595e9.11.1770116107133; Tue, 03 Feb 2026 02:55:07 -0800 (PST) X-Received: by 2002:a05:600c:45c5:b0:47d:403e:9cd5 with SMTP id 5b1f17b1804b1-482db45fcb4mr193220235e9.11.1770116106669; Tue, 03 Feb 2026 02:55:06 -0800 (PST) Received: from [192.168.88.32] ([150.228.93.21]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4830515381esm58912085e9.11.2026.02.03.02.55.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Feb 2026 02:55:06 -0800 (PST) Message-ID: <03c714f3-edd5-43fb-a0be-8c4a43bf6101@redhat.com> Date: Tue, 3 Feb 2026 11:55:02 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v4] ppp: enable TX scatter-gather To: Qingfang Deng , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-ppp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?Q?Toke_H=C3=B8iland-J=C3=B8rgensen?= References: <20260129012902.941-1-dqfext@gmail.com> Content-Language: en-US From: Paolo Abeni In-Reply-To: <20260129012902.941-1-dqfext@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/29/26 2:29 AM, Qingfang Deng wrote: > 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. In case a linear > buffer is required (PPP compression, multilink, and channels without > direct_xmit), call skb_linearize() explicitly. > > Signed-off-by: Qingfang Deng > --- > v3 -> v4: > Always expose SG and FRAGLIST, and linearize the skb if necessary. > - https://lore.kernel.org/linux-ppp/20260123014214.225278-1-dqfext@gmail.com/ > > drivers/net/ppp/ppp_generic.c | 30 +++++++++++++++++++++++++----- > 1 file changed, 25 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c > index f9f0f16c41d1..f8814d7be6f1 100644 > --- a/drivers/net/ppp/ppp_generic.c > +++ b/drivers/net/ppp/ppp_generic.c > @@ -1641,6 +1641,8 @@ static void ppp_setup(struct net_device *dev) > dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; > dev->priv_destructor = ppp_dev_priv_destructor; > dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS; > + dev->features = NETIF_F_SG | NETIF_F_FRAGLIST; > + dev->hw_features = dev->features; > netif_keep_dst(dev); > } > > @@ -1710,6 +1712,10 @@ pad_compress_skb(struct ppp *ppp, struct sk_buff *skb) > ppp->xcomp->comp_extra + ppp->dev->hard_header_len; > int compressor_skb_size = ppp->dev->mtu + > ppp->xcomp->comp_extra + PPP_HDRLEN; > + > + if (skb_linearize(skb)) > + return NULL; > + > new_skb = alloc_skb(new_skb_size, GFP_ATOMIC); > if (!new_skb) { > if (net_ratelimit()) > @@ -1797,6 +1803,10 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb) > case PPP_IP: > if (!ppp->vj || (ppp->flags & SC_COMP_TCP) == 0) > break; > + > + if (skb_linearize(skb)) > + goto drop; > + > /* try to do VJ TCP header compression */ > new_skb = alloc_skb(skb->len + ppp->dev->hard_header_len - 2, > GFP_ATOMIC); > @@ -1894,19 +1904,26 @@ ppp_push(struct ppp *ppp) > } > > if ((ppp->flags & SC_MULTILINK) == 0) { > + struct ppp_channel *chan; > /* not doing multilink: send it down the first channel */ > list = list->next; > pch = list_entry(list, struct channel, clist); > > spin_lock(&pch->downl); > - if (pch->chan) { > - if (pch->chan->ops->start_xmit(pch->chan, skb)) > - ppp->xmit_pending = NULL; > - } else { > - /* channel got unregistered */ > + chan = pch->chan; > + if (unlikely(!chan || (!chan->direct_xmit && skb_linearize(skb)))) { > + /* channel got unregistered, or it requires a linear > + * skb but linearization failed > + */ > kfree_skb(skb); > ppp->xmit_pending = NULL; > + goto out; I'm sorry for missing this point before, but AFAICS channels with chan->direct_xmit == 0 do not support GSO packets at all, and here such packets will be transmitted after linearization (but still as GSO). I think that while transmitting over !chan->direct_xmit you additionally need to check for GSO packet. If ppp features are recomputed depending on the channels configuration, you could chose to drop such packets. Otherwise you will need to segment them before transmission, and that looks error prone in case of multilink. /P > } > + > + if (chan->ops->start_xmit(chan, skb)) > + ppp->xmit_pending = NULL; > + > +out: > spin_unlock(&pch->downl); > return; > } > @@ -1991,6 +2008,8 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) > return 0; /* can't take now, leave it in xmit_pending */ > > /* Do protocol field compression */ > + if (skb_linearize(skb)) > + goto err_linearize; > p = skb->data; > len = skb->len; > if (*p == 0 && mp_protocol_compress) { > @@ -2149,6 +2168,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) > > noskb: > spin_unlock(&pch->downl); > + err_linearize: > if (ppp->debug & 1) > netdev_err(ppp->dev, "PPP: no memory (fragment)\n"); > ++ppp->dev->stats.tx_errors;