From: Paolo Abeni <pabeni@redhat.com>
To: Qingfang Deng <qingfang.deng@linux.dev>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Shuah Khan <shuah@kernel.org>,
Simon Horman <horms@kernel.org>,
Willem de Bruijn <willemb@google.com>,
Petr Machata <petrm@nvidia.com>,
Anubhav Singh <anubhavsinggh@google.com>,
Richard Gobert <richardbgobert@gmail.com>,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: linux-ppp@vger.kernel.org, Pablo Neira Ayuso <pablo@netfilter.org>
Subject: Re: [PATCH net-next v7 2/2] selftests: net: test PPPoE packets in gro.sh
Date: Thu, 30 Apr 2026 12:04:36 +0200 [thread overview]
Message-ID: <2a136e4a-46d5-4527-ab6b-cf61384a8ffe@redhat.com> (raw)
In-Reply-To: <20260428064717.74794-2-qingfang.deng@linux.dev>
On 4/28/26 8:47 AM, Qingfang Deng wrote:
> Add PPPoE test-cases to the GRO selftest. Only run a subset of
> common_tests to avoid changing the hardcoded L3 offsets everywhere.
> Add a new "pppoe_sid" test case to verify that packets with different
> PPPoE session IDs are correctly identified as separate flows and not
> coalesced.
>
> Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev>
> ---
> v7:
> - Do not run all the tests for PPPoE
> - Add a new test for PPPoE
> v6: https://lore.kernel.org/netdev/20260326081127.61229-2-dqfext@gmail.com
>
> tools/testing/selftests/drivers/net/config | 2 +
> tools/testing/selftests/drivers/net/gro.py | 11 +++
> tools/testing/selftests/net/lib/gro.c | 99 ++++++++++++++++++----
> 3 files changed, 96 insertions(+), 16 deletions(-)
>
> diff --git a/tools/testing/selftests/drivers/net/config b/tools/testing/selftests/drivers/net/config
> index fd16994366f4..07e386895b94 100644
> --- a/tools/testing/selftests/drivers/net/config
> +++ b/tools/testing/selftests/drivers/net/config
> @@ -8,5 +8,7 @@ CONFIG_NETCONSOLE=m
> CONFIG_NETCONSOLE_DYNAMIC=y
> CONFIG_NETCONSOLE_EXTENDED_LOG=y
> CONFIG_NETDEVSIM=m
> +CONFIG_PPP=y
> +CONFIG_PPPOE=y
> CONFIG_VLAN_8021Q=m
> CONFIG_XDP_SOCKETS=y
> diff --git a/tools/testing/selftests/drivers/net/gro.py b/tools/testing/selftests/drivers/net/gro.py
> index 221f27e57147..ad7c80f7ba96 100755
> --- a/tools/testing/selftests/drivers/net/gro.py
> +++ b/tools/testing/selftests/drivers/net/gro.py
> @@ -313,6 +313,12 @@ def _gro_variants():
> "ip_frag6", "ip_v6ext_same", "ip_v6ext_diff",
> ]
>
> + # Tests specific to PPPoE
> + pppoe_tests = [
> + "data_same", "data_lrg_sml", "data_sml_lrg", "data_lrg_1byte",
> + "data_burst", "pppoe_sid",
> + ]
> +
> for mode in ["sw", "hw", "lro"]:
> for protocol in ["ipv4", "ipv6", "ipip", "ip6ip6"]:
> for test_name in common_tests:
> @@ -325,6 +331,11 @@ def _gro_variants():
> for test_name in ipv6_tests:
> yield mode, protocol, test_name
>
> + for mode in ["sw"]:
> + for protocol in ["pppoev4", "pppoev6"]:
> + for test_name in pppoe_tests:
> + yield mode, protocol, test_name
> +
>
> @ksft_variants(_gro_variants())
> def test(cfg, mode, protocol, test_name):
> diff --git a/tools/testing/selftests/net/lib/gro.c b/tools/testing/selftests/net/lib/gro.c
> index 11b16ae5f0e8..0da55b757bcc 100644
> --- a/tools/testing/selftests/net/lib/gro.c
> +++ b/tools/testing/selftests/net/lib/gro.c
> @@ -67,12 +67,14 @@
> #include <errno.h>
> #include <error.h>
> #include <getopt.h>
> +#include <net/ethernet.h>
> +#include <net/if.h>
> #include <linux/filter.h>
> #include <linux/if_packet.h>
> +#include <linux/if_pppox.h>
> #include <linux/ipv6.h>
> #include <linux/net_tstamp.h>
> -#include <net/ethernet.h>
> -#include <net/if.h>
> +#include <linux/ppp_defs.h>
> #include <netinet/in.h>
> #include <netinet/ip.h>
> #include <netinet/ip6.h>
> @@ -134,6 +136,7 @@ static int total_hdr_len = -1;
> static int ethhdr_proto = -1;
> static bool ipip;
> static bool ip6ip6;
> +static bool pppoe;
> static uint64_t txtime_ns;
> static int num_flows = 4;
> static bool order_check;
> @@ -171,6 +174,22 @@ static void vlog(const char *fmt, ...)
> }
> }
>
> +static void fill_pppoelayer(void *buf, int payload_len, uint16_t sid)
> +{
> + struct pppoe_ppp_hdr {
> + struct pppoe_hdr eh;
> + __be16 proto;
> + } *ph = buf;
> +
> + payload_len += sizeof(struct tcphdr);
> + ph->eh.type = 1;
> + ph->eh.ver = 1;
> + ph->eh.code = 0;
> + ph->eh.sid = htons(sid);
> + ph->eh.length = htons(payload_len + sizeof(ph->proto));
> + ph->proto = htons(proto == PF_INET ? PPP_IP : PPP_IPV6);
> +}
> +
> static void setup_sock_filter(int fd)
> {
> const int dport_off = tcp_offset + offsetof(struct tcphdr, dest);
> @@ -412,11 +431,15 @@ static void create_packet(void *buf, int seq_offset, int ack_offset,
>
> fill_networklayer(buf + inner_ip_off, payload_len, IPPROTO_TCP);
> if (inner_ip_off > ETH_HLEN) {
> - int encap_proto = (proto == PF_INET) ?
> - IPPROTO_IPIP : IPPROTO_IPV6;
> + if (pppoe) {
> + fill_pppoelayer(buf + ETH_HLEN, payload_len + ip_hdr_len, 0x1234);
> + } else {
> + int encap_proto = (proto == PF_INET) ?
> + IPPROTO_IPIP : IPPROTO_IPV6;
>
> - fill_networklayer(buf + ETH_HLEN,
> - payload_len + ip_hdr_len, encap_proto);
> + fill_networklayer(buf + ETH_HLEN,
> + payload_len + ip_hdr_len, encap_proto);
> + }
> }
>
> fill_datalinklayer(buf);
> @@ -526,7 +549,7 @@ static void send_flags(int fd, struct sockaddr_ll *daddr, int psh, int syn,
> static void send_data_pkts(int fd, struct sockaddr_ll *daddr,
> int payload_len1, int payload_len2)
> {
> - static char buf[ETH_HLEN + IP_MAXPACKET];
> + static char buf[MAX_HDR_LEN + IP_MAXPACKET];
Why MAX_HDR_LEN? I think you should add a new define alike:
#define L2_HLEN_MAX (ETH_HLEN + PPPOE_SES_HLEN)
/P
next prev parent reply other threads:[~2026-04-30 10:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 6:47 [PATCH net-next v7 1/2] net: pppoe: implement GRO/GSO support Qingfang Deng
2026-04-28 6:47 ` [PATCH net-next v7 2/2] selftests: net: test PPPoE packets in gro.sh Qingfang Deng
2026-04-30 10:04 ` Paolo Abeni [this message]
2026-04-30 10:01 ` [PATCH net-next v7 1/2] net: pppoe: implement GRO/GSO support Paolo Abeni
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=2a136e4a-46d5-4527-ab6b-cf61384a8ffe@redhat.com \
--to=pabeni@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=anubhavsinggh@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-ppp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=petrm@nvidia.com \
--cc=qingfang.deng@linux.dev \
--cc=richardbgobert@gmail.com \
--cc=shuah@kernel.org \
--cc=willemb@google.com \
/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