Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

netdevsim: add loopback support

Support device loopback. Apparently this mode has been historically
supported by the toeplitz test and I don't have any HW which lets
me test the conversion..

Reviewed-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20251120021024.2944527-12-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+12 -5
+12 -5
drivers/net/netdevsim/netdev.c
··· 133 133 if (!nsim_ipsec_tx(ns, skb)) 134 134 goto out_drop_any; 135 135 136 - peer_ns = rcu_dereference(ns->peer); 137 - if (!peer_ns) 138 - goto out_drop_any; 136 + /* Check if loopback mode is enabled */ 137 + if (dev->features & NETIF_F_LOOPBACK) { 138 + peer_ns = ns; 139 + peer_dev = dev; 140 + } else { 141 + peer_ns = rcu_dereference(ns->peer); 142 + if (!peer_ns) 143 + goto out_drop_any; 144 + peer_dev = peer_ns->netdev; 145 + } 139 146 140 147 dr = nsim_do_psp(skb, ns, peer_ns, &psp_ext); 141 148 if (dr) 142 149 goto out_drop_free; 143 150 144 - peer_dev = peer_ns->netdev; 145 151 rxq = skb_get_queue_mapping(skb); 146 152 if (rxq >= peer_dev->num_rx_queues) 147 153 rxq = rxq % peer_dev->num_rx_queues; ··· 982 976 NETIF_F_FRAGLIST | 983 977 NETIF_F_HW_CSUM | 984 978 NETIF_F_LRO | 985 - NETIF_F_TSO; 979 + NETIF_F_TSO | 980 + NETIF_F_LOOPBACK; 986 981 dev->pcpu_stat_type = NETDEV_PCPU_STAT_DSTATS; 987 982 dev->max_mtu = ETH_MAX_MTU; 988 983 dev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_HW_OFFLOAD;