mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Qingfang Deng <dqfext@gmail.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-ppp@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2] ppp: enable TX scatter-gather
Date: Thu, 6 Nov 2025 15:18:54 +0100	[thread overview]
Message-ID: <d9b8ec8a-f541-4356-8c42-e29adced59c0@redhat.com> (raw)
In-Reply-To: <20251103031501.404141-1-dqfext@gmail.com>

On 11/3/25 4:15 AM, Qingfang Deng wrote:
> When chan->direct_xmit is true, and no compressors are in use, PPP
> prepends its header to a skb, and calls dev_queue_xmit directly. In this
> mode the skb does not need to be linearized.
> Enable NETIF_F_SG and NETIF_F_FRAGLIST, and add
> ppp_update_dev_features() to conditionally disable them if a linear skb
> is required. This is required to support PPPoE GSO.

It's unclear to me why IFF_NO_QUEUE is necessary to avoid the
linearization.
> Signed-off-by: Qingfang Deng <dqfext@gmail.com>
> ---
> v1 -> v2:
>  Changes dev->features under the TX spinlock to avoid races.
>  - https://lore.kernel.org/netdev/20250912095928.1532113-1-dqfext@gmail.com/
> 
>  drivers/net/ppp/ppp_generic.c | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
> index 854e1a95d29a..389542f0af5f 100644
> --- a/drivers/net/ppp/ppp_generic.c
> +++ b/drivers/net/ppp/ppp_generic.c
> @@ -498,6 +498,17 @@ static ssize_t ppp_read(struct file *file, char __user *buf,
>  	return ret;
>  }
>  
> +static void ppp_update_dev_features(struct ppp *ppp)
> +{
> +	struct net_device *dev = ppp->dev;
> +
> +	if (!(dev->priv_flags & IFF_NO_QUEUE) || ppp->xc_state ||
> +	    ppp->flags & (SC_COMP_TCP | SC_CCP_UP))
> +		dev->features &= ~(NETIF_F_SG | NETIF_F_FRAGLIST);
> +	else
> +		dev->features |= NETIF_F_SG | NETIF_F_FRAGLIST;
> +}
> +
>  static bool ppp_check_packet(struct sk_buff *skb, size_t count)
>  {
>  	/* LCP packets must include LCP header which 4 bytes long:
> @@ -824,6 +835,7 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>  	case PPPIOCSFLAGS:
>  		if (get_user(val, p))
>  			break;
> +		rtnl_lock();
>  		ppp_lock(ppp);
>  		cflags = ppp->flags & ~val;
>  #ifdef CONFIG_PPP_MULTILINK
> @@ -834,6 +846,12 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>  		ppp_unlock(ppp);
>  		if (cflags & SC_CCP_OPEN)
>  			ppp_ccp_closed(ppp);
> +
> +		ppp_xmit_lock(ppp);
> +		ppp_update_dev_features(ppp);
> +		ppp_xmit_unlock(ppp);
> +		netdev_update_features(ppp->dev);
> +		rtnl_unlock();
>  		err = 0;
>  		break;
>  
> @@ -1650,6 +1668,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);
>  }
>  
> @@ -3112,13 +3132,17 @@ ppp_set_compress(struct ppp *ppp, struct ppp_option_data *data)
>  	if (data->transmit) {
>  		state = cp->comp_alloc(ccp_option, data->length);
>  		if (state) {
> +			rtnl_lock();
>  			ppp_xmit_lock(ppp);
>  			ppp->xstate &= ~SC_COMP_RUN;
>  			ocomp = ppp->xcomp;
>  			ostate = ppp->xc_state;
>  			ppp->xcomp = cp;
>  			ppp->xc_state = state;
> +			ppp_update_dev_features(ppp);
>  			ppp_xmit_unlock(ppp);
> +			netdev_update_features(ppp->dev);
> +			rtnl_unlock();

Instead of dynamically changing the features, what about always exposing
SG and FRAGLIST and linearize the skb as need for compression's sake?

/P


  reply	other threads:[~2025-11-06 14:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-03  3:15 Qingfang Deng
2025-11-06 14:18 ` Paolo Abeni [this message]
2025-11-07  3:34   ` Qingfang Deng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d9b8ec8a-f541-4356-8c42-e29adced59c0@redhat.com \
    --to=pabeni@redhat.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dqfext@gmail.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-ppp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®