Subject: Re: [net-next 2/2] selftests: drv-net: psp: add test for VLAN sub-interface

From: Jakub Kicinski <[email-masked]>
Date: Wed, 21 Jan 2026 20:18:10 -0800

On Tue, 20 Jan 2026 23:35:17 -0800 Kiran Kella wrote:
> --- a/tools/testing/selftests/drivers/net/psp.py
> +++ b/tools/testing/selftests/drivers/net/psp.py
> @@ -17,7 +17,7 @@ from lib.py import ksft_not_none
>  from lib.py import KsftSkipEx
>  from lib.py import NetDrvEpEnv, PSPFamily, NlError
>  from lib.py import bkg, rand_port, wait_port_listen
> -
> +from lib.py import ip
>  

don't clean up this white space, double new line is a thing in Python
for some reason

>  def _get_outq(s):
>      one = b'\0' * 4
> @@ -568,6 +568,119 @@ def removal_device_bi(cfg):
>      finally:
>          _close_conn(cfg, s)
>  
> +def vlan_basic_send(cfg):
> +    """
> +    Test PSP over VLAN-to-VLAN traffic
> +
> +    Network topology:
> +      Local VLAN (nsim0.100) <---> Remote VLAN (nsim1.100)
> +           |                            |
> +      Local Physical (nsim0) <---> Remote Physical (nsim1)
> +          [PSP configured here]
> +    """
> +    cfg.require_nsim()

why would this only work on nsim?

> +    _init_psp_dev(cfg)
> +
> +    # Store original interface names and addresses
> +    orig_local_ifname = cfg.ifname
> +    orig_local_ifindex = cfg.ifindex
> +    orig_remote_ifname = cfg.remote_ifname
> +    orig_local_addr_v4 = cfg.addr_v["4"]
> +    orig_local_addr_v6 = cfg.addr_v["6"]
> +    orig_remote_addr_v4 = cfg.remote_addr_v["4"]
> +    orig_remote_addr_v6 = cfg.remote_addr_v["6"]

maybe instead of all this saving and restoring just make and object and
give it all the attributes so that it looks like cfg? Instead of
modifying the real cfg I mean.

> +    # VLAN configuration
> +    vlan_id = 100
> +    local_vlan_ifname = f"{orig_local_ifname}.{vlan_id}"
> +    remote_vlan_ifname = f"{orig_remote_ifname}.{vlan_id}"
> +
> +    local_vlan_addr_v4 = "192.0.2.21"
> +    remote_vlan_addr_v4 = "192.0.2.22"
> +    local_vlan_addr_v6 = "2001:db8::21"
> +    remote_vlan_addr_v6 = "2001:db8::22"
> +
> +    try:
> +        # Create VLAN interface on LOCAL side
> +        ip(f"link add link {orig_local_ifname} name {local_vlan_ifname} type vlan id {vlan_id}")

please use defer()