Skip to content

Commit c71962f

Browse files
LGA1150gregkh
authored andcommitted
ppp: use IFF_NO_QUEUE in virtual interfaces
[ Upstream commit 95d0d09 ] For PPPoE, PPTP, and PPPoL2TP, the start_xmit() function directly forwards packets to the underlying network stack and never returns anything other than 1. So these interfaces do not require a qdisc, and the IFF_NO_QUEUE flag should be set. Introduces a direct_xmit flag in struct ppp_channel to indicate when IFF_NO_QUEUE should be applied. The flag is set in ppp_connect_channel() for relevant protocols. While at it, remove the usused latency member from struct ppp_channel. Signed-off-by: Qingfang Deng <dqfext@gmail.com> Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com> Link: https://patch.msgid.link/20250301135517.695809-1-dqfext@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Stable-dep-of: 543adf0 ("ppp: annotate data races in ppp_generic") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 72e2ccf commit c71962f

5 files changed

Lines changed: 8 additions & 2 deletions

File tree

drivers/net/ppp/ppp_generic.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3508,6 +3508,10 @@ ppp_connect_channel(struct channel *pch, int unit)
35083508
ret = -ENOTCONN;
35093509
goto outl;
35103510
}
3511+
if (pch->chan->direct_xmit)
3512+
ppp->dev->priv_flags |= IFF_NO_QUEUE;
3513+
else
3514+
ppp->dev->priv_flags &= ~IFF_NO_QUEUE;
35113515
spin_unlock_bh(&pch->downl);
35123516
if (pch->file.hdrlen > ppp->file.hdrlen)
35133517
ppp->file.hdrlen = pch->file.hdrlen;

drivers/net/ppp/pppoe.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
699699
po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr) - 2;
700700
po->chan.private = sk;
701701
po->chan.ops = &pppoe_chan_ops;
702+
po->chan.direct_xmit = true;
702703

703704
error = ppp_register_net_channel(dev_net(dev), &po->chan);
704705
if (error) {

drivers/net/ppp/pptp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr,
469469
po->chan.mtu -= PPTP_HEADER_OVERHEAD;
470470

471471
po->chan.hdrlen = 2 + sizeof(struct pptp_gre_header);
472+
po->chan.direct_xmit = true;
472473
error = ppp_register_channel(&po->chan);
473474
if (error) {
474475
pr_err("PPTP: failed to register PPP channel (%d)\n", error);

include/linux/ppp_channel.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ struct ppp_channel {
4242
int hdrlen; /* amount of headroom channel needs */
4343
void *ppp; /* opaque to channel */
4444
int speed; /* transfer rate (bytes/second) */
45-
/* the following is not used at present */
46-
int latency; /* overhead time in milliseconds */
45+
bool direct_xmit; /* no qdisc, xmit directly */
4746
};
4847

4948
#ifdef __KERNEL__

net/l2tp/l2tp_ppp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,7 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
810810
po->chan.private = sk;
811811
po->chan.ops = &pppol2tp_chan_ops;
812812
po->chan.mtu = pppol2tp_tunnel_mtu(tunnel);
813+
po->chan.direct_xmit = true;
813814

814815
error = ppp_register_net_channel(sock_net(sk), &po->chan);
815816
if (error) {

0 commit comments

Comments
 (0)