From patchwork Sat Jan 27 04:03:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13533965 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B2A213FE0 for ; Sat, 27 Jan 2024 04:04:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706328248; cv=none; b=Ni+WLiyG5gk1ZxpaMgY7fqxuOLzMLf6+fUgHp+aTYRlaQpGX8+cnr5Et7lSgKjsrgFJZTFVtO9DI72BRpa+DwcDdpVJISGM+rX3u8LOEgmPuorAAXnZSFnGptq3SMDW0FtzfBh1dGZpAAZX728M4Kxn9tb/plvnwbDBoeouTfZk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706328248; c=relaxed/simple; bh=mRzVPhWEcoGAbg995ZW7hvCM/ykD2tvdYLsaeYZWcOQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kiXOEKpLFiwH+uFC3DTtOZmViQgY1aCA5KrUJgzx/z+EtdgZ9iZJbEH5hGKq3HvPbTFDL0/JduRh6mvNkMHCjRJ/loyjA+5FoWcbgnPhfiDLHCHk/3rVRb3IDBHvWYrzRb2bEku6QXz0Z64JbUMbs3fAv/BZgWZjilIqU/kAR4E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk; spf=none smtp.mailfrom=davidwei.uk; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b=WALJNjJ+; arc=none smtp.client-ip=209.85.210.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b="WALJNjJ+" Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-6ddf05b1922so753907a34.2 for ; Fri, 26 Jan 2024 20:04:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1706328246; x=1706933046; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PAmeDRjxtvH97QBxjdVjaXA34ZKaCeM5uAJh8ptpgD8=; b=WALJNjJ+iNWrKMaE/Vs6hubKe5dO7b9sV7kASafWPwbjYC/ObpqOguTjyeOgyskEcN xy5NjHPjg9qDJoapc0cCA220SNLamPa3gNGsTh+/slW+PHxSK8VtHNRodZiaf/ol71Wm G2xbUtAinV6MRSjb4qctHn+/sxm6gcYqqBlcTyVxxtscqQ2xcIsj7N1CI9bprkK/SkAl PkELcfJVUxFTwbO2+xp4BotpkifxbNI+T/0vu6lALHudBP5y3/bq0O/HJUE6qE69P/Q6 16QQ3eE30fZag0YA80Sm1b21V3zp3sac0QFH6qYDOAZqDKSGlqE1fx8S9l9NQZeZ4RJT IZ9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706328246; x=1706933046; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PAmeDRjxtvH97QBxjdVjaXA34ZKaCeM5uAJh8ptpgD8=; b=jxscIW406HUYN9x51Cq+O0vzhYmRUpbNfmEkRaiyyThEI3UD6IuCRhXZw6PFIzv9it HAGp0m7p+w6oa3P14FOEy99klZpUSDT/j1OJ8LfpO2FqrNSXVRf3hBM1+wy2gC28XMus GFmQvIlwF+4eLWLJEeQflvJeL+mD1/Nk3rc9Y/qN2f8A/zWHia37HX6/dPaXOrA50/+/ YjzYoK5Y9xdYbBe/zYbxC4/4oi08hZ9X61f/WNAAY/7UBjr97E8IzDYR/ASj6gJ+Sv9S t01balEI+VCC9jbMwuefny0otMTEmJ0nQ3a5PMoNfl9qYez+5/0T6n/Zfc2VcD0PJSAJ FIuw== X-Gm-Message-State: AOJu0YzNZ9rYfw77qT8C0C5Sdbf/lKUo1HOZte+a9x/b8ZoXmXAOFgRg LEE0xfEggo1+GMPKI62613En7t77CMZpevAKbwehra08daHP0WvhzxIuIBfPs9s3SCHeoT2YC1o 9 X-Google-Smtp-Source: AGHT+IE/fptB3Z7N6WNpb5kMmbJUC8v9c2D613BFVZfLCRTLOJ5hAiAxtgVMEj5zAmXEhnd9l9xfWA== X-Received: by 2002:a05:6830:114a:b0:6e1:f4f:fe52 with SMTP id x10-20020a056830114a00b006e10f4ffe52mr1048633otq.18.1706328246246; Fri, 26 Jan 2024 20:04:06 -0800 (PST) Received: from localhost (fwdproxy-prn-026.fbsv.net. [2a03:2880:ff:1a::face:b00c]) by smtp.gmail.com with ESMTPSA id k82-20020a628455000000b006dddeb19438sm1933144pfd.188.2024.01.26.20.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 20:04:05 -0800 (PST) From: David Wei To: Jakub Kicinski , Jiri Pirko , Sabrina Dubroca , netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Paolo Abeni Subject: [PATCH net-next v7 1/4] netdevsim: allow two netdevsim ports to be connected Date: Fri, 26 Jan 2024 20:03:51 -0800 Message-Id: <20240127040354.944744-2-dw@davidwei.uk> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240127040354.944744-1-dw@davidwei.uk> References: <20240127040354.944744-1-dw@davidwei.uk> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add two netdevsim bus attribute to sysfs: /sys/bus/netdevsim/link_device /sys/bus/netdevsim/unlink_device Writing "A M B N" to link_device will link netdevsim M in netnsid A with netdevsim N in netnsid B. Writing "A M" to unlink_device will unlink netdevsim M in netnsid A from its peer and vice versa, if any. rtnl_lock is taken to ensure nothing changes during the linking. Signed-off-by: David Wei --- drivers/net/netdevsim/bus.c | 130 ++++++++++++++++++++++++++++++ drivers/net/netdevsim/netdev.c | 11 +++ drivers/net/netdevsim/netdevsim.h | 2 + 3 files changed, 143 insertions(+) diff --git a/drivers/net/netdevsim/bus.c b/drivers/net/netdevsim/bus.c index bcbc1e19edde..3162f88b88ec 100644 --- a/drivers/net/netdevsim/bus.c +++ b/drivers/net/netdevsim/bus.c @@ -232,9 +232,139 @@ del_device_store(const struct bus_type *bus, const char *buf, size_t count) } static BUS_ATTR_WO(del_device); +static ssize_t link_device_store(const struct bus_type *bus, const char *buf, size_t count) +{ + unsigned int netnsid_a, netnsid_b, ifidx_a, ifidx_b; + struct netdevsim *nsim_a, *nsim_b; + struct net_device *dev_a, *dev_b; + struct net *ns_a, *ns_b; + int err; + + err = sscanf(buf, "%u:%u %u:%u", &netnsid_a, &ifidx_a, &netnsid_b, &ifidx_b); + if (err != 4) { + pr_err("Format for linking two devices is \"netnsid_a:ifidx_a netnsid_b:ifidx_b\" (uint uint unit uint).\n"); + return -EINVAL; + } + + err = -EINVAL; + rtnl_lock(); + ns_a = get_net_ns_by_id(current->nsproxy->net_ns, netnsid_a); + if (!ns_a) { + pr_err("Could not find netns with id: %u\n", netnsid_a); + goto out_unlock_rtnl; + } + + dev_a = __dev_get_by_index(ns_a, ifidx_a); + if (!dev_a) { + pr_err("Could not find device with ifindex %u in netnsid %u\n", ifidx_a, netnsid_a); + goto out_put_netns_a; + } + + if (!netdev_is_nsim(dev_a)) { + pr_err("Device with ifindex %u in netnsid %u is not a netdevsim\n", ifidx_a, netnsid_a); + goto out_put_netns_a; + } + + ns_b = get_net_ns_by_id(current->nsproxy->net_ns, netnsid_b); + if (!ns_b) { + pr_err("Could not find netns with id: %u\n", netnsid_b); + goto out_put_netns_a; + } + + dev_b = __dev_get_by_index(ns_b, ifidx_b); + if (!dev_b) { + pr_err("Could not find device with ifindex %u in netnsid %u\n", ifidx_b, netnsid_b); + goto out_put_netns_b; + } + + if (!netdev_is_nsim(dev_b)) { + pr_err("Device with ifindex %u in netnsid %u is not a netdevsim\n", ifidx_b, netnsid_b); + goto out_put_netns_b; + } + + err = 0; + nsim_a = netdev_priv(dev_a); + if (nsim_a->peer) { + pr_err("Netdevsim %u:%u is already linked\n", netnsid_a, ifidx_a); + goto out_put_netns_b; + } + + nsim_b = netdev_priv(dev_b); + if (nsim_b->peer) { + pr_err("Netdevsim %u:%u is already linked\n", netnsid_b, ifidx_b); + goto out_put_netns_b; + } + + rcu_assign_pointer(nsim_a->peer, nsim_b); + rcu_assign_pointer(nsim_b->peer, nsim_a); + +out_put_netns_b: + put_net(ns_b); +out_put_netns_a: + put_net(ns_a); +out_unlock_rtnl: + rtnl_unlock(); + + return !err ? count : err; +} +static BUS_ATTR_WO(link_device); + +static ssize_t unlink_device_store(const struct bus_type *bus, const char *buf, size_t count) +{ + struct netdevsim *nsim, *peer; + unsigned int netnsid, ifidx; + struct net_device *dev; + struct net *ns; + int err; + + err = sscanf(buf, "%u:%u", &netnsid, &ifidx); + if (err != 2) { + pr_err("Format for unlinking a device is \"netnsid:ifidx\" (uint uint).\n"); + return -EINVAL; + } + + err = -EINVAL; + rtnl_lock(); + ns = get_net_ns_by_id(current->nsproxy->net_ns, netnsid); + if (!ns) { + pr_err("Could not find netns with id: %u\n", netnsid); + goto out_unlock_rtnl; + } + + dev = __dev_get_by_index(ns, ifidx); + if (!dev) { + pr_err("Could not find device with ifindex %u in netnsid %u\n", ifidx, netnsid); + goto out_put_netns; + } + + if (!netdev_is_nsim(dev)) { + pr_err("Device with ifindex %u in netnsid %u is not a netdevsim\n", ifidx, netnsid); + goto out_put_netns; + } + + err = 0; + nsim = netdev_priv(dev); + if (!nsim->peer) + goto out_put_netns; + peer = nsim->peer; + + RCU_INIT_POINTER(nsim->peer, NULL); + RCU_INIT_POINTER(peer->peer, NULL); + +out_put_netns: + put_net(ns); +out_unlock_rtnl: + rtnl_unlock(); + + return !err ? count : err; +} +static BUS_ATTR_WO(unlink_device); + static struct attribute *nsim_bus_attrs[] = { &bus_attr_new_device.attr, &bus_attr_del_device.attr, + &bus_attr_link_device.attr, + &bus_attr_unlink_device.attr, NULL }; ATTRIBUTE_GROUPS(nsim_bus); diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 77e8250282a5..969248ffeca8 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -394,6 +394,7 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port) ns->nsim_dev = nsim_dev; ns->nsim_dev_port = nsim_dev_port; ns->nsim_bus_dev = nsim_dev->nsim_bus_dev; + RCU_INIT_POINTER(ns->peer, NULL); SET_NETDEV_DEV(dev, &ns->nsim_bus_dev->dev); SET_NETDEV_DEVLINK_PORT(dev, &nsim_dev_port->devlink_port); nsim_ethtool_init(ns); @@ -413,8 +414,13 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port) void nsim_destroy(struct netdevsim *ns) { struct net_device *dev = ns->netdev; + struct netdevsim *peer; rtnl_lock(); + peer = rtnl_dereference(ns->peer); + if (peer) + RCU_INIT_POINTER(peer->peer, NULL); + RCU_INIT_POINTER(ns->peer, NULL); unregister_netdevice(dev); if (nsim_dev_port_is_pf(ns->nsim_dev_port)) { nsim_macsec_teardown(ns); @@ -427,6 +433,11 @@ void nsim_destroy(struct netdevsim *ns) free_netdev(dev); } +bool netdev_is_nsim(struct net_device *dev) +{ + return dev->netdev_ops == &nsim_netdev_ops; +} + static int nsim_validate(struct nlattr *tb[], struct nlattr *data[], struct netlink_ext_ack *extack) { diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h index 028c825b86db..c8b45b0d955e 100644 --- a/drivers/net/netdevsim/netdevsim.h +++ b/drivers/net/netdevsim/netdevsim.h @@ -125,11 +125,13 @@ struct netdevsim { } udp_ports; struct nsim_ethtool ethtool; + struct netdevsim __rcu *peer; }; struct netdevsim * nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port); void nsim_destroy(struct netdevsim *ns); +bool netdev_is_nsim(struct net_device *dev); void nsim_ethtool_init(struct netdevsim *ns); From patchwork Sat Jan 27 04:03:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13533966 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43D3611CB3 for ; Sat, 27 Jan 2024 04:04:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706328249; cv=none; b=Sp4+msR7YJb/ea5i9SHmhqJ3s5X3WXJVaU/eD1X3L1ozsZgxj6Pt7ttt/vkZ6xeWtGjSQM8aVQYWARpQInv4voceknZ702XMniodZx5fPm6XNoo0OfTKTkV25ODwXoU2qEU/pE2cEZNjkAafUzmbDmoflQkezsvxvwE69PgBD0g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706328249; c=relaxed/simple; bh=rPFoX7y/FzQ327gtbuNYIq04xHE3Rh0Jdtm1iHJQRlo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mfn431Ebjgn3RQCFdtActVaq+Korszv1NNgsTyPTqHzaFCKItpTab/S494909qTbXN294d4HiyJCGF0Sa4YNbf0/6oH5CRGPRjUhmX6Ny+tO+/oRk3YLDeVnRsB4n6Q+/2eBa/xqHMkxBVabj6NdUVNZR072BD0luOu0udn1u5Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk; spf=none smtp.mailfrom=davidwei.uk; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b=NmWO1Gln; arc=none smtp.client-ip=209.85.161.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b="NmWO1Gln" Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-5955a4a9b23so628425eaf.1 for ; Fri, 26 Jan 2024 20:04:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1706328247; x=1706933047; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wJHkq4nBwIbVK7YyQ6gC40pBf6pJSM8m6eSQit08k5c=; b=NmWO1GlnHO/Ha8691SxTwaADc3lzxk0J4TDd0rgKA/iPjI9OHyNsYmSLlI8cdCplmw mTFCjfSxJ3KQ00dEOX8ESWRm3F7RpVVrFBEcQ4N2UhngUFdpNlpq/Tp3GrypSg+nr+79 GAYy+D5ScM0camGO6U1symfg2fImJ1VVS2GIzwdD+knfSZZOVmvYkB7KGXLvnMTrpSxm UhiteLUKHmRpciqh/nEFUBEmrTTAEgJ/6pkVQUkY9C/DLgaCnVOpM9VqJFNQRw4aiovf KmeiUdNQ0hzSpCdeCwQ4Gx1hLuYSU5WfIIZaUQ9MDEQmOIXN7HLIG2rNuD+kdP2oVnix ZFWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706328247; x=1706933047; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wJHkq4nBwIbVK7YyQ6gC40pBf6pJSM8m6eSQit08k5c=; b=fQ3LJ6yfbIK9a7V0jkt+GvRtPwBtynGEWiODOws18fzySfFSuJq5WIjz6qVpMy33bd hOfRCsb2HXsNY3YTZThw3MDi0sPAJLJFyb/iAdofT4sMJOjmt6wlTqS4lKx52gnrjzk1 2MdWgWsGRLvM1sFgqS48x+QgjNJoazpk4Th9bk3/U6LIfi6csONvSXM4qVVDnqFGBZiD R9sjangi4G6LiVA39UP1YcczGiOm2Y6agwMe0kqlhKM+wG8idJo17hJFJAk76FKkMM33 2JK1VSTl4CYnCAUBHSJwnEiWgFg4Bu/5ywHOgOs8xygE8I0gLZQe9+VbvzLuAPUSXZpE XVtA== X-Gm-Message-State: AOJu0YwPsbT4kwWnbhjmQ9n4KnDpFgoKvD29WZATwMXi1zHQps8bmv5v ShWyQH7vn1srk7NNcbtOtwJ1wDDu5duvCr1O/DdJJfERazE9SRDkizldYlO/f9o= X-Google-Smtp-Source: AGHT+IEdcrMAr2goRdDrz6gN6KsKfUHcPpHE/r4BoIgdpKNb0bqokXEuBFSTWCBAoXmHzVKY+Q/HKw== X-Received: by 2002:a05:6808:128e:b0:3bd:c1b2:b1d5 with SMTP id a14-20020a056808128e00b003bdc1b2b1d5mr1035941oiw.46.1706328247271; Fri, 26 Jan 2024 20:04:07 -0800 (PST) Received: from localhost (fwdproxy-prn-018.fbsv.net. [2a03:2880:ff:12::face:b00c]) by smtp.gmail.com with ESMTPSA id i21-20020aa787d5000000b006d9c216a9e6sm1866263pfo.56.2024.01.26.20.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 20:04:07 -0800 (PST) From: David Wei To: Jakub Kicinski , Jiri Pirko , Sabrina Dubroca , netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Paolo Abeni Subject: [PATCH net-next v7 2/4] netdevsim: forward skbs from one connected port to another Date: Fri, 26 Jan 2024 20:03:52 -0800 Message-Id: <20240127040354.944744-3-dw@davidwei.uk> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240127040354.944744-1-dw@davidwei.uk> References: <20240127040354.944744-1-dw@davidwei.uk> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Forward skbs sent from one netdevsim port to its connected netdevsim port using dev_forward_skb, in a spirit similar to veth. Add a tx_dropped variable to struct netdevsim, tracking the number of skbs that could not be forwarded using dev_forward_skb(). The xmit() function accessing the peer ptr is protected by an RCU read critical section. The rcu_read_lock() is functionally redundant as since v5.0 all softirqs are implicitly RCU read critical sections; but it is useful for human readers. If another CPU is concurrently in nsim_destroy(), then it will first set the peer ptr to NULL. This does not affect any existing readers that dereferenced a non-NULL peer. Then, in unregister_netdevice(), there is a synchronize_rcu() before the netdev is actually unregistered and freed. This ensures that any readers i.e. xmit() that got a non-NULL peer will complete before the netdev is freed. Any readers after the RCU_INIT_POINTER() but before synchronize_rcu() will dereference NULL, making it safe. The codepath to nsim_destroy() and nsim_create() takes both the newly added nsim_dev_list_lock and rtnl_lock. This makes it safe with concurrent calls to linking two netdevsims together. Signed-off-by: David Wei --- drivers/net/netdevsim/netdev.c | 28 +++++++++++++++++++++++----- drivers/net/netdevsim/netdevsim.h | 1 + 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 969248ffeca8..120a24d74d28 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -29,19 +29,37 @@ static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct netdevsim *ns = netdev_priv(dev); + unsigned int len = skb->len; + struct netdevsim *peer_ns; + int ret = NETDEV_TX_OK; if (!nsim_ipsec_tx(ns, skb)) goto out; + rcu_read_lock(); + peer_ns = rcu_dereference(ns->peer); + if (!peer_ns) + goto out_stats; + + skb_tx_timestamp(skb); + if (unlikely(dev_forward_skb(peer_ns->netdev, skb) == NET_RX_DROP)) + ret = NET_XMIT_DROP; + +out_stats: + rcu_read_unlock(); u64_stats_update_begin(&ns->syncp); - ns->tx_packets++; - ns->tx_bytes += skb->len; + if (ret == NET_XMIT_DROP) { + ns->tx_dropped++; + } else { + ns->tx_packets++; + ns->tx_bytes += len; + } u64_stats_update_end(&ns->syncp); + return ret; out: dev_kfree_skb(skb); - - return NETDEV_TX_OK; + return ret; } static void nsim_set_rx_mode(struct net_device *dev) @@ -70,6 +88,7 @@ nsim_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) start = u64_stats_fetch_begin(&ns->syncp); stats->tx_bytes = ns->tx_bytes; stats->tx_packets = ns->tx_packets; + stats->tx_dropped = ns->tx_dropped; } while (u64_stats_fetch_retry(&ns->syncp, start)); } @@ -302,7 +321,6 @@ static void nsim_setup(struct net_device *dev) eth_hw_addr_random(dev); dev->tx_queue_len = 0; - dev->flags |= IFF_NOARP; dev->flags &= ~IFF_MULTICAST; dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE; diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h index c8b45b0d955e..553c4b9b4f63 100644 --- a/drivers/net/netdevsim/netdevsim.h +++ b/drivers/net/netdevsim/netdevsim.h @@ -98,6 +98,7 @@ struct netdevsim { u64 tx_packets; u64 tx_bytes; + u64 tx_dropped; struct u64_stats_sync syncp; struct nsim_bus_dev *nsim_bus_dev; From patchwork Sat Jan 27 04:03:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13533967 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 083FF125B1 for ; Sat, 27 Jan 2024 04:04:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706328250; cv=none; b=pi78q0yZOd0K5N/ebBw15RG8kZsskjhYDrt5gbq72nGgvlCwdiVJcIgksQvH5/vrcOfm07Ps2TqMxXHbaR00F6FmJ5zkI7YN+JNeSp9LuayyULfvhwA2Vs8c3b/ctJ3HrgjOE8XDLgxw2eUo6PVHsYeIDRUs+u6Kux15lBf1TNo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706328250; c=relaxed/simple; bh=nj2mDop2t0QrkpEErvwE8HwVED0A/wp9/wADFcl5IMM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Cg0kiijzAkBIF/sf+RT95mUqYzdHzdo5wZyBqTZsA+W7Nhkk9I8oTDjywklGQrRU2tfS9vwraccBONkvLO8r+Eswt8bkm+/d55s7cm8W7+1RoJRKfIuQC/gbHqmRGBF6lV2P9jvRP3ZBUKhmqCDAWVgKjLEX/bBkforcdEBCdeo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk; spf=none smtp.mailfrom=davidwei.uk; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b=W+GcPc1n; arc=none smtp.client-ip=209.85.210.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b="W+GcPc1n" Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-6e10f791f09so748358a34.2 for ; Fri, 26 Jan 2024 20:04:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1706328248; x=1706933048; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z2xN6P4fwXQsEOQPwU6oqJcN9ayeZZ+FE5D8UNFg1aI=; b=W+GcPc1nDO+5fyuw1fDuLOxG0wZfUIRwbRvg2lG8IB0IdbQ0Al7TyGfY1cY8fZwAXH Zd8cpuJ83ZeTVluJWjyOjOxSrNypKP4NE1WlDUzQUyCUOrtIRcMhWMAu7z2pD/CugsAo ewHV7t2HD7yZFsPPZ6ZdzTdbNK2KU5D57l+VjXdIO4DgY1N3aeqbg2X8GK18pdD9mvPb gD7bRcGgp59mqOdFaSVZ8X3dw5sLDeNjtkfKTj9UFTc2glVwbKAYA5aFvD7s7znKNJBb rHairYwKddolsvS2DRhLmlNltYgHyKtQblinGG6DTWZ0mOUUy78FXN6ejQpdNKHx5Akq vnvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706328248; x=1706933048; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z2xN6P4fwXQsEOQPwU6oqJcN9ayeZZ+FE5D8UNFg1aI=; b=GoTsAHgRCstFHyS4cXsx7Sr+qusfMrDi+agc4kUapCUjDcsqR50eS1fmwHGrWQgqi4 ImTVEC6FTDgc//BqVkhSdcADC3UJhopQ+vDvbELA6yOtISYfvhepFwlZRJyPSbiiv/ka MvydZ415FOifWBSFkztr3C1nbm1BrYpOEjtT3z/oFeqZwFDgOdD/EYU6d0/XjZxcnvPj tsUXq2PCpEKOXkd4OSEfubikqBiEaiCAPDxronp2hVsSjoAbGX0uguiHF+bnqlarUV5d +KhGppbeJpOr5aTgg040amr0XG+h2tO9waewVvUKSZ9tWwHDGeuwOPuptujpHDGTlrzz fvbg== X-Gm-Message-State: AOJu0Yy5a3+SpYb+ptvWOpe5Zu0Z8gChrLKjROxG7zXpKKrufNkXmpRk 1jCEg5IrLtGLYx0Ms2ZfdAibkdsKQk7azMZe8/+z/uQMXwYacH4zJ2Mcib0s5fs= X-Google-Smtp-Source: AGHT+IGraCaYT0J2u1lMs56bDL9yClDf3ZQ05keZjxjlTLBlgsZirDBSiI2/QdEakci29XSShpHrCQ== X-Received: by 2002:a05:6830:2055:b0:6d8:567d:ed18 with SMTP id f21-20020a056830205500b006d8567ded18mr1072625otp.7.1706328248259; Fri, 26 Jan 2024 20:04:08 -0800 (PST) Received: from localhost (fwdproxy-prn-021.fbsv.net. [2a03:2880:ff:15::face:b00c]) by smtp.gmail.com with ESMTPSA id r25-20020aa78b99000000b006dbda9a4e6bsm1855477pfd.44.2024.01.26.20.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 20:04:08 -0800 (PST) From: David Wei To: Jakub Kicinski , Jiri Pirko , Sabrina Dubroca , netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Paolo Abeni Subject: [PATCH net-next v7 3/4] netdevsim: add selftest for forwarding skb between connected ports Date: Fri, 26 Jan 2024 20:03:53 -0800 Message-Id: <20240127040354.944744-4-dw@davidwei.uk> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240127040354.944744-1-dw@davidwei.uk> References: <20240127040354.944744-1-dw@davidwei.uk> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Connect two netdevsim ports in different namespaces together, then send packets between them using socat. Signed-off-by: David Wei --- .../selftests/drivers/net/netdevsim/peer.sh | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100755 tools/testing/selftests/drivers/net/netdevsim/peer.sh diff --git a/tools/testing/selftests/drivers/net/netdevsim/peer.sh b/tools/testing/selftests/drivers/net/netdevsim/peer.sh new file mode 100755 index 000000000000..05f3cefa53f3 --- /dev/null +++ b/tools/testing/selftests/drivers/net/netdevsim/peer.sh @@ -0,0 +1,127 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0-only + +NSIM_DEV_1_ID=$((RANDOM % 1024)) +NSIM_DEV_1_SYS=/sys/bus/netdevsim/devices/netdevsim$NSIM_DEV_1_ID +NSIM_DEV_1_DFS=/sys/kernel/debug/netdevsim/netdevsim$NSIM_DEV_1_ID +NSIM_DEV_2_ID=$((RANDOM % 1024)) +NSIM_DEV_2_SYS=/sys/bus/netdevsim/devices/netdevsim$NSIM_DEV_2_ID +NSIM_DEV_2_DFS=/sys/kernel/debug/netdevsim/netdevsim$NSIM_DEV_2_ID + +NSIM_DEV_SYS_NEW=/sys/bus/netdevsim/new_device +NSIM_DEV_SYS_DEL=/sys/bus/netdevsim/del_device +NSIM_DEV_SYS_LINK=/sys/bus/netdevsim/link_device +NSIM_DEV_SYS_UNLINK=/sys/bus/netdevsim/unlink_device + +socat_check() +{ + if [ ! -x "$(command -v socat)" ]; then + echo "socat command not found. Skipping test" + return 1 + fi + + return 0 +} + +setup_ns() +{ + set -e + ip netns add nssv + ip netns add nscl + + NSIM_DEV_1_NAME=$(find $NSIM_DEV_1_SYS/net -maxdepth 1 -type d ! \ + -path $NSIM_DEV_1_SYS/net -exec basename {} \;) + NSIM_DEV_2_NAME=$(find $NSIM_DEV_2_SYS/net -maxdepth 1 -type d ! \ + -path $NSIM_DEV_2_SYS/net -exec basename {} \;) + + ip link set $NSIM_DEV_1_NAME netns nssv + ip link set $NSIM_DEV_2_NAME netns nscl + + ip netns exec nssv ip addr add '192.168.1.1/24' dev $NSIM_DEV_1_NAME + ip netns exec nscl ip addr add '192.168.1.2/24' dev $NSIM_DEV_2_NAME + + ip netns exec nssv ip link set dev $NSIM_DEV_1_NAME up + ip netns exec nscl ip link set dev $NSIM_DEV_2_NAME up + set +e +} + +cleanup_ns() +{ + ip netns del nscl + ip netns del nssv +} + +### +### Code start +### + +modprobe netdevsim + +# linking + +echo $NSIM_DEV_1_ID > $NSIM_DEV_SYS_NEW +echo $NSIM_DEV_2_ID > $NSIM_DEV_SYS_NEW + +setup_ns + +NSIM_DEV_1_NETNSID=$(ip netns list-id | grep nssv | awk '{print $2}') +NSIM_DEV_1_IFIDX=$(ip netns exec nssv cat /sys/class/net/$NSIM_DEV_1_NAME/ifindex) + +NSIM_DEV_2_NETNSID=$(ip netns list-id | grep nscl | awk '{print $2}') +NSIM_DEV_2_IFIDX=$(ip netns exec nscl cat /sys/class/net/$NSIM_DEV_2_NAME/ifindex) + +echo "$NSIM_DEV_1_NETNSID:$NSIM_DEV_1_IFIDX $NSIM_DEV_2_NETNSID:20" > $NSIM_DEV_SYS_LINK 2>/dev/null +if [ $? -eq 0 ]; then + echo "linking with non-existent netdevsim should fail" + exit 1 +fi + +echo "$NSIM_DEV_1_NETNSID:$NSIM_DEV_1_IFIDX 20:$NSIM_DEV_2_IFIDX" > $NSIM_DEV_SYS_LINK 2>/dev/null +if [ $? -eq 0 ]; then + echo "linking with non-existent netnsid should fail" + exit 1 +fi + +echo "$NSIM_DEV_1_NETNSID:$NSIM_DEV_1_IFIDX $NSIM_DEV_2_NETNSID:$NSIM_DEV_2_IFIDX" > $NSIM_DEV_SYS_LINK +if [ $? -ne 0 ]; then + echo "linking netdevsim1 with netdevsim2 should succeed" + exit 1 +fi + +# argument error checking + +echo "$NSIM_DEV_1_NETNSID:$NSIM_DEV_1_IFIDX $NSIM_DEV_2_NETNSID:a" > $NSIM_DEV_SYS_LINK 2>/dev/null +if [ $? -eq 0 ]; then + echo "invalid arg should fail" + exit 1 +fi + +# send/recv packets + +socat_check || exit 4 + +tmp_file=$(mktemp) +ip netns exec nssv socat TCP-LISTEN:1234,fork $tmp_file & +pid=$! +res=0 + +echo "HI" | ip netns exec nscl socat STDIN TCP:192.168.1.1:1234 + +count=$(cat $tmp_file | wc -c) +if [[ $count -ne 3 ]]; then + echo "expected 3 bytes, got $count" + res=1 +fi + +echo "$NSIM_DEV_1_NETNSID:$NSIM_DEV_1_IFIDX" > $NSIM_DEV_SYS_UNLINK + +echo $NSIM_DEV_2_ID > $NSIM_DEV_SYS_DEL + +kill $pid +echo $NSIM_DEV_1_ID > $NSIM_DEV_SYS_DEL + +cleanup_ns + +modprobe -r netdevsim + +exit $res From patchwork Sat Jan 27 04:03:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13533968 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2066C134BC for ; Sat, 27 Jan 2024 04:04:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706328251; cv=none; b=B6I3JvR4nbjkkfSW3T52O/il4zaG+7XW7L7zh9i5t0rI2MIA3LzDLhes8bVTaTMps9mvIgD5ZyjAuekpoK+THGblI54tlpz5qK7RuDNO+0wlE+zudbCGG2CdV9pRZ8cotfaOkZ170AIBkMjpOY3hGg+aaDHLdIVDQoUmXov5lKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706328251; c=relaxed/simple; bh=cLYPdbxUBtT+KaYS866D/Xt5LNCttNpkpzpgDQmmdw4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mmMuMQfU1ILJ+zTE9HAwijde00Ax9t8jm2kS0u28gZ1yzGk735bgDtv3O+n6wvr3f+5Ew0eqGMLV4qFXeRC1zRLPms1bl6FmFPu2zak7PGTurpJfQJJTT3dcsIWCvoViMgAjcSm7ICjVUaNR0FE0niE6AHytiO0bQ9cEz/sZzK8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk; spf=none smtp.mailfrom=davidwei.uk; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b=YLf//VPx; arc=none smtp.client-ip=209.85.161.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b="YLf//VPx" Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-595d24ad466so781291eaf.0 for ; Fri, 26 Jan 2024 20:04:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1706328249; x=1706933049; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HipVj3jFa++EzsAXPaItSnaAVQdrvEwwkSfJxQxVOsU=; b=YLf//VPxZVFVBQn7YSiJKwhhfd2xSgLcy2454lAqryI7PWk4OJHpY5Mop3APlJRJBT IP/+fz3tKWfLdXKxevFa3l0OcOYvX1FlYQmj4yUN2fKekkgbUuMKsnpMDfMCTc3vTsIf EWL7zO54I2epv9hK7oq1tNHHtxdtaxOI3dN9xUMOoifxx3s4/b/k1AXyhz+uvJIEvAg7 x7qZLmQHSA9+qIHQs+tFhVizKTyGUsEfoQ3AJu1fS7o5XZsa7+vP3EdNYaLOp7iGJdES rRiiSQy3X22zjfEkPrqmZbSRoXkAQjIkDf2ypqpwawRYrsrPIzTPNpH5cyFjaOa6eI2L alGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706328249; x=1706933049; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HipVj3jFa++EzsAXPaItSnaAVQdrvEwwkSfJxQxVOsU=; b=B0x0TiYyg+1RoEjgXSzvKR0BYSv6IAQfwgtIVobNFSduhGpP8zrZtKhBPkCLPKa+5W rymzUWAZ2vWZGKw+uQGfKmJ3WyRqfvTtmY/c8zYamLwl8NKGC7SXc+l1qKFgRfsN9TZd YSNSzfql2YS7yK25Ha+v+k8154+SzWdjS5SCHgYytA19Vl5x+qX3ZbQ+zvdLHHzJsAmz gHRvleS5iG2Aqg7IkZg1nSrYGkI4gk+PEuec4ySgjOkuqBFkyF1whTcAfW/IQr6pOlps +rQFuNU2jCIz/sdJ1uGInYi64JO5dyrRuDOsA7kehVM4kuDFJfZR41rvvkQGY0Mj4ncj oHHQ== X-Gm-Message-State: AOJu0YwqsCSYrWq+kEHMnUVXGH48hscjX4leKZu4MBf+yaWjGykRGPT5 6QgNuQplITlx57yrCCL5arddVLKx0zSKbLtKIfFauASvGDtTvlZ+rAbkBYOkrMA= X-Google-Smtp-Source: AGHT+IF0QkZg2HRZSsVSeTg1mul8uxrs1wHVdBvflw7nlya28zZ1+DwXxsvBDl6tZe1QXf/14bCz8g== X-Received: by 2002:a05:6358:33a1:b0:174:edd3:b3e9 with SMTP id i33-20020a05635833a100b00174edd3b3e9mr1008373rwd.38.1706328249140; Fri, 26 Jan 2024 20:04:09 -0800 (PST) Received: from localhost (fwdproxy-prn-002.fbsv.net. [2a03:2880:ff:2::face:b00c]) by smtp.gmail.com with ESMTPSA id g3-20020a17090adac300b0028b845f2890sm3910721pjx.33.2024.01.26.20.04.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 20:04:08 -0800 (PST) From: David Wei To: Jakub Kicinski , Jiri Pirko , Sabrina Dubroca , netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Paolo Abeni Subject: [PATCH net-next v7 4/4] netdevsim: add Makefile for selftests Date: Fri, 26 Jan 2024 20:03:54 -0800 Message-Id: <20240127040354.944744-5-dw@davidwei.uk> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240127040354.944744-1-dw@davidwei.uk> References: <20240127040354.944744-1-dw@davidwei.uk> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add a Makefile for netdevsim selftests and add selftests path to MAINTAINERS Signed-off-by: David Wei --- MAINTAINERS | 1 + .../selftests/drivers/net/netdevsim/Makefile | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tools/testing/selftests/drivers/net/netdevsim/Makefile diff --git a/MAINTAINERS b/MAINTAINERS index 92152ac346c8..562af3dfd2d0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15082,6 +15082,7 @@ NETDEVSIM M: Jakub Kicinski S: Maintained F: drivers/net/netdevsim/* +F: tools/testing/selftests/drivers/net/netdevsim/* NETEM NETWORK EMULATOR M: Stephen Hemminger diff --git a/tools/testing/selftests/drivers/net/netdevsim/Makefile b/tools/testing/selftests/drivers/net/netdevsim/Makefile new file mode 100644 index 000000000000..5bace0b7fb57 --- /dev/null +++ b/tools/testing/selftests/drivers/net/netdevsim/Makefile @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0+ OR MIT + +TEST_PROGS = devlink.sh \ + devlink_in_netns.sh \ + devlink_trap.sh \ + ethtool-coalesce.sh \ + ethtool-fec.sh \ + ethtool-pause.sh \ + ethtool-ring.sh \ + fib.sh \ + hw_stats_l3.sh \ + nexthop.sh \ + peer.sh \ + psample.sh \ + tc-mq-visibility.sh \ + udp_tunnel_nic.sh \ + +include ../../../lib.mk