From patchwork Thu Dec 28 01:46:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13505546 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 CEE6F1FDC for ; Thu, 28 Dec 2023 01:46:38 +0000 (UTC) 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="bsesUh4H" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6da16ec9be4so291201b3a.1 for ; Wed, 27 Dec 2023 17:46:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1703727998; x=1704332798; 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=CNB++PJ6pw8L12UZXBY4NQeYCzHzjlirc1hhBOThbfU=; b=bsesUh4HyY1EqUvyKSY2HHOP14GLciUFDYkcaopmHr7tVXAAFYjKV7dwHCjhEiCCEX YtGD3bK3+2wmppGpnsuJ2aekxVk5CgN48ftycVw7JXCbvlYeKrbrU6EkDk7RaTWsMbYI MOLWJ3+6oMoupzz/ENAZJX2VBF7wvvIrGQVFL8xgP6OTFrO5Owr+8xGYKJ54yR9edBV+ XnDNB8vt63Q+2rwpa2Vm6WzicSiZjiprpBXHLfGxW1L0mk/nLXKhBZCMu5CqIn7kqZax ou9fy8orGCxAsuVTl231O+qaXGt0eXVzYWgP6BFd8ngwRnMUqumBnoBiLB9AKqk2zoE1 zn1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703727998; x=1704332798; 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=CNB++PJ6pw8L12UZXBY4NQeYCzHzjlirc1hhBOThbfU=; b=C3rFr/r6PbgtQS0b7011CG6R+MvYS7TVvr3DvwLNNSbrZilXkSp5A8YPXNTl5Ue5lS WPwfVSNmYEQIdUU90clYoydDIZMXc9w0Q44OxeXZIxkGTJHWPlsPenus9zCy9xviHmjX l++EBQ+gID3/o7GEQJ2WJoHLwwA+jrqBhAO/Tp9gO4JBSFuNx4KTGpK8kSq4O2u6cy5A MbCndhGjzLs6ZYsu0ufBlGqrjvLnN4w2Q9q0Osz1P60SIxrTxAL3rIRi6+6uRCZ32qRc A1xhDgdtU1a17xRD0RFbonqO3UrcOU9QAqJqh3Djkl3j6rIe0mgUTmAli6/HjmzBFTvc F/kg== X-Gm-Message-State: AOJu0Yy8augzqSj0XU2ASXxxwooDczuMXX2bYCNhVPB92svwNjrSWoiM ZTi+EgD54nr53u7U8su0X8gFbN3kSqR3/d21iZIKLO5KQFo= X-Google-Smtp-Source: AGHT+IEbMLDbh9U3iXgrW4hFObfZAg7S4YjooCGQR/ZnZEGdoC73ulVVVoxKIAOJ/JFGTc+EnFcR0A== X-Received: by 2002:a05:6a00:1e02:b0:6d9:bbc9:98d9 with SMTP id gx2-20020a056a001e0200b006d9bbc998d9mr5002362pfb.8.1703727997927; Wed, 27 Dec 2023 17:46:37 -0800 (PST) Received: from localhost (fwdproxy-prn-020.fbsv.net. [2a03:2880:ff:14::face:b00c]) by smtp.gmail.com with ESMTPSA id f4-20020a63de04000000b00588e8421fa8sm12232182pgg.84.2023.12.27.17.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 17:46:37 -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 v5 1/5] netdevsim: maintain a list of probed netdevsims Date: Wed, 27 Dec 2023 17:46:29 -0800 Message-Id: <20231228014633.3256862-2-dw@davidwei.uk> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231228014633.3256862-1-dw@davidwei.uk> References: <20231228014633.3256862-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 In this patch I added a linked list nsim_dev_list of probed nsim_devs, added during nsim_drv_probe() and removed during nsim_drv_remove(). A mutex nsim_dev_list_lock protects the list. Signed-off-by: David Wei --- drivers/net/netdevsim/dev.c | 19 +++++++++++++++++++ drivers/net/netdevsim/netdevsim.h | 1 + 2 files changed, 20 insertions(+) diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c index b4d3b9cde8bd..8d477aa99f94 100644 --- a/drivers/net/netdevsim/dev.c +++ b/drivers/net/netdevsim/dev.c @@ -35,6 +35,9 @@ #include "netdevsim.h" +static LIST_HEAD(nsim_dev_list); +static DEFINE_MUTEX(nsim_dev_list_lock); + static unsigned int nsim_dev_port_index(enum nsim_dev_port_type type, unsigned int port_index) { @@ -1607,6 +1610,11 @@ int nsim_drv_probe(struct nsim_bus_dev *nsim_bus_dev) nsim_dev->esw_mode = DEVLINK_ESWITCH_MODE_LEGACY; devl_unlock(devlink); + + mutex_lock(&nsim_dev_list_lock); + list_add(&nsim_dev->list, &nsim_dev_list); + mutex_unlock(&nsim_dev_list_lock); + return 0; err_hwstats_exit: @@ -1668,8 +1676,19 @@ void nsim_drv_remove(struct nsim_bus_dev *nsim_bus_dev) { struct nsim_dev *nsim_dev = dev_get_drvdata(&nsim_bus_dev->dev); struct devlink *devlink = priv_to_devlink(nsim_dev); + struct nsim_dev *pos, *tmp; + + mutex_lock(&nsim_dev_list_lock); + list_for_each_entry_safe(pos, tmp, &nsim_dev_list, list) { + if (pos == nsim_dev) { + list_del(&nsim_dev->list); + break; + } + } + mutex_unlock(&nsim_dev_list_lock); devl_lock(devlink); + nsim_dev_reload_destroy(nsim_dev); nsim_bpf_dev_exit(nsim_dev); diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h index 028c825b86db..babb61d7790b 100644 --- a/drivers/net/netdevsim/netdevsim.h +++ b/drivers/net/netdevsim/netdevsim.h @@ -277,6 +277,7 @@ struct nsim_vf_config { struct nsim_dev { struct nsim_bus_dev *nsim_bus_dev; + struct list_head list; struct nsim_fib_data *fib_data; struct nsim_trap_data *trap_data; struct dentry *ddir; From patchwork Thu Dec 28 01:46:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13505547 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (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 8A1662568 for ; Thu, 28 Dec 2023 01:46:39 +0000 (UTC) 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="b3ZGTz8Z" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6d9b37f4804so1683341b3a.1 for ; Wed, 27 Dec 2023 17:46:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1703727999; x=1704332799; 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=pyd3nrqtxjfL3K25CWzrFdKGTu8rTW64z3GVAZH6QeY=; b=b3ZGTz8Zv7tXe0Jx2Q73K/H6r4pqOaNbYmKColdkCZ+72vXyTr2zxfKtsjQNA5wclP wNvZsGMAB6zEvnpywbMUL8iv8AijzIlDGi2ldmWR12AS0e9ArgVIIez6wd87k182H56g Z/w1Umn19Tof6VQsNZsa043pBjtiEv5feEoP0Ehbu5xn3dSXPWoJpU76XFGYsn5mpCXk 26Z/rRhmEqysP3gsiQtuJpj5REcVLMLa+RR2m2ipeQtlAtYpqFtg1NNEodzf8u6ofVgK rIzhqgr3tCOUnRtFoM51MC+Alqd787AMGCl0Md71c9BpFCv88P9n0avLHiUL/1MyMqjU yg9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703727999; x=1704332799; 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=pyd3nrqtxjfL3K25CWzrFdKGTu8rTW64z3GVAZH6QeY=; b=us+/QD9zfRglmzLwJzI8BvxMAsh2pWXCmYHKc/tHdbi/1nEiFK08Wm02CRO1czLdvv 2X6aGeqsU7VplqzujiQ5ZMe+B9WzFwBa+K5c8XWSSIbcm7akjXMye03LMyA+M9IZL7qE acnfPy/oPoiRJ3ajmuOIhz3lRHT8NxxbbmV3p1DL62v4y4zwUGPvItYaXUIRYfPhW2lZ AWDq466HdjYNi8Z4J1T8GbCmQwWoRNwaVr1tCQ/FsoX1fieIeCRfqjGp3TWFhOwMGcwC uxmVGhGBijOVewJjyzYIPcghh8o52coLDMwWJBYoo69cHr71Dh5+d67T4zXnS8hEGs+q gmzQ== X-Gm-Message-State: AOJu0YzRjCqtSk7/8NXPwDWRL1ZN5Dhek/8VwqmolIxyBag+VMbi5Wio zsQJazNJYVpWzi0cp91Qd01doxQKtPVqmw== X-Google-Smtp-Source: AGHT+IFQs8fIM2ujsD2PVkHziOWJjBwssXWDnIFfLuTg6/xn765AqbmaHql4srgFm+MG+armjEh26g== X-Received: by 2002:a05:6a21:1445:b0:196:3085:eb23 with SMTP id oc5-20020a056a21144500b001963085eb23mr1312151pzb.8.1703727998804; Wed, 27 Dec 2023 17:46:38 -0800 (PST) Received: from localhost (fwdproxy-prn-116.fbsv.net. [2a03:2880:ff:74::face:b00c]) by smtp.gmail.com with ESMTPSA id f26-20020aa78b1a000000b006d97f80c4absm10934573pfd.41.2023.12.27.17.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 17:46:38 -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 v5 2/5] netdevsim: allow two netdevsim ports to be connected Date: Wed, 27 Dec 2023 17:46:30 -0800 Message-Id: <20231228014633.3256862-3-dw@davidwei.uk> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231228014633.3256862-1-dw@davidwei.uk> References: <20231228014633.3256862-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 debugfs file in /sys/kernel/debug/netdevsim/netdevsimN/ports/A/peer Writing "M B" to this file will link port A of netdevsim N with port B of netdevsim M. Reading this file will return the linked netdevsim id and port, if any. During nsim_dev_peer_write(), nsim_dev_list_lock prevents concurrent modifications to nsim_dev and peer's devlink->lock prevents concurrent modifications to the peer's port_list. rtnl_lock ensures netdevices do not change during the critical section where a link is established. The lock order is consistent with other parts that touch netdevsim and should not deadlock. During nsim_dev_peer_read(), RCU read critical section ensures valid values even if stale. Signed-off-by: David Wei --- drivers/net/netdevsim/dev.c | 134 +++++++++++++++++++++++++++--- drivers/net/netdevsim/netdev.c | 6 ++ drivers/net/netdevsim/netdevsim.h | 1 + 3 files changed, 128 insertions(+), 13 deletions(-) diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c index 8d477aa99f94..6d5e4ce08dfd 100644 --- a/drivers/net/netdevsim/dev.c +++ b/drivers/net/netdevsim/dev.c @@ -391,6 +391,124 @@ static const struct file_operations nsim_dev_rate_parent_fops = { .owner = THIS_MODULE, }; +static struct nsim_dev *nsim_dev_find_by_id(unsigned int id) +{ + struct nsim_dev *dev; + + list_for_each_entry(dev, &nsim_dev_list, list) + if (dev->nsim_bus_dev->dev.id == id) + return dev; + + return NULL; +} + +static struct nsim_dev_port * +__nsim_dev_port_lookup(struct nsim_dev *nsim_dev, enum nsim_dev_port_type type, + unsigned int port_index) +{ + struct nsim_dev_port *nsim_dev_port; + + port_index = nsim_dev_port_index(type, port_index); + list_for_each_entry(nsim_dev_port, &nsim_dev->port_list, list) + if (nsim_dev_port->port_index == port_index) + return nsim_dev_port; + return NULL; +} + +static ssize_t nsim_dev_peer_read(struct file *file, char __user *data, + size_t count, loff_t *ppos) +{ + struct nsim_dev_port *nsim_dev_port; + struct netdevsim *peer; + unsigned int id, port; + ssize_t ret = 0; + char buf[23]; + + nsim_dev_port = file->private_data; + rcu_read_lock(); + peer = rcu_dereference(nsim_dev_port->ns->peer); + if (!peer) { + rcu_read_unlock(); + return 0; + } + + id = peer->nsim_bus_dev->dev.id; + port = peer->nsim_dev_port->port_index; + ret = scnprintf(buf, sizeof(buf), "%u %u\n", id, port); + ret = simple_read_from_buffer(data, count, ppos, buf, ret); + + rcu_read_unlock(); + return ret; +} + +static ssize_t nsim_dev_peer_write(struct file *file, + const char __user *data, + size_t count, loff_t *ppos) +{ + struct nsim_dev_port *nsim_dev_port, *peer_dev_port; + struct nsim_dev *peer_dev; + unsigned int id, port; + char buf[22]; + ssize_t ret; + + if (count >= sizeof(buf)) + return -ENOSPC; + + ret = copy_from_user(buf, data, count); + if (ret) + return -EFAULT; + buf[count] = '\0'; + + ret = sscanf(buf, "%u %u", &id, &port); + if (ret != 2) { + pr_err("Format is peer netdevsim \"id port\" (uint uint)\n"); + return -EINVAL; + } + + ret = -EINVAL; + mutex_lock(&nsim_dev_list_lock); + peer_dev = nsim_dev_find_by_id(id); + if (!peer_dev) { + pr_err("Peer netdevsim %u does not exist\n", id); + goto out_mutex; + } + + devl_lock(priv_to_devlink(peer_dev)); + rtnl_lock(); + nsim_dev_port = file->private_data; + peer_dev_port = __nsim_dev_port_lookup(peer_dev, NSIM_DEV_PORT_TYPE_PF, + port); + if (!peer_dev_port) { + pr_err("Peer netdevsim %u port %u does not exist\n", id, port); + goto out_devl; + } + + if (nsim_dev_port == peer_dev_port) { + pr_err("Cannot link netdevsim to itself\n"); + goto out_devl; + } + + rcu_assign_pointer(nsim_dev_port->ns->peer, peer_dev_port->ns); + rcu_assign_pointer(peer_dev_port->ns->peer, nsim_dev_port->ns); + ret = count; + +out_devl: + rtnl_unlock(); + devl_unlock(priv_to_devlink(peer_dev)); +out_mutex: + mutex_unlock(&nsim_dev_list_lock); + + return ret; +} + +static const struct file_operations nsim_dev_peer_fops = { + .open = simple_open, + .read = nsim_dev_peer_read, + .write = nsim_dev_peer_write, + .llseek = generic_file_llseek, + .owner = THIS_MODULE, +}; + static int nsim_dev_port_debugfs_init(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port) { @@ -421,6 +539,9 @@ static int nsim_dev_port_debugfs_init(struct nsim_dev *nsim_dev, } debugfs_create_symlink("dev", nsim_dev_port->ddir, dev_link_name); + debugfs_create_file("peer", 0600, nsim_dev_port->ddir, + nsim_dev_port, &nsim_dev_peer_fops); + return 0; } @@ -1704,19 +1825,6 @@ void nsim_drv_remove(struct nsim_bus_dev *nsim_bus_dev) dev_set_drvdata(&nsim_bus_dev->dev, NULL); } -static struct nsim_dev_port * -__nsim_dev_port_lookup(struct nsim_dev *nsim_dev, enum nsim_dev_port_type type, - unsigned int port_index) -{ - struct nsim_dev_port *nsim_dev_port; - - port_index = nsim_dev_port_index(type, port_index); - list_for_each_entry(nsim_dev_port, &nsim_dev->port_list, list) - if (nsim_dev_port->port_index == port_index) - return nsim_dev_port; - return NULL; -} - int nsim_drv_port_add(struct nsim_bus_dev *nsim_bus_dev, enum nsim_dev_port_type type, unsigned int port_index) { diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index aecaf5f44374..434322f6a565 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -388,6 +388,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); @@ -407,8 +408,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); diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h index babb61d7790b..24fc3fbda791 100644 --- a/drivers/net/netdevsim/netdevsim.h +++ b/drivers/net/netdevsim/netdevsim.h @@ -125,6 +125,7 @@ struct netdevsim { } udp_ports; struct nsim_ethtool ethtool; + struct netdevsim __rcu *peer; }; struct netdevsim * From patchwork Thu Dec 28 01:46:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13505548 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 68E71EDB for ; Thu, 28 Dec 2023 01:46:40 +0000 (UTC) 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="fJ4eyBee" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1d3dee5f534so43853705ad.1 for ; Wed, 27 Dec 2023 17:46:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1703727999; x=1704332799; 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=HS58+UKX3zYzrUWjdlnAGph2pSrC7waS+cUH+Y73puo=; b=fJ4eyBee2IhvMjzYjaluNxfiMMX6fivDgdFEk28pheMXerSaReV72+llUVzjJwO3jO lgeqaStMf9GWIf1NiVaK4EM+vEaBp8Tbt5zsT2fr04MmAGZPo0R8/jkZKX1FxwDL1nE3 DJHuo3DWCj6timqzZfdgUQZDrEIHh2q9NU9bwTsJxFy0Zq8eHVs2HKDcQcHyqyGsoeOh SJaiT3NLneQLMRnZDSDclg/A8ZTZnNhQnEYyvvT1bSrDVQ1ge7xaD8PksNJqemTAqzVq 8vsEro8YE7FreVt2e93IBYjhWLC5Kp7Fo4+TeEJa0G47n3AXv9UgF0z4yc6eYHhEr/7v YKtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703727999; x=1704332799; 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=HS58+UKX3zYzrUWjdlnAGph2pSrC7waS+cUH+Y73puo=; b=pdh6giTgZtvUqwB2f3abo4KaHnciKo7GGLaG5G46/zDiPXnCjMlIS+srFoRh5ppd01 vkseuhv3kYh50teEEVbiOVhhn7ROBepbFJL2OtpDNm8Lmc4O4r3cYj0L8/iYHjvaJcMB aSkq/qsDP1KFgvM6+FHDDAIGyAQ0MjeNBOOeYPLW65HY9nhWS46QYJXzSVwNLDCisMQI QrYkl6TYr8AtBoJIXmBvCk1AEojQMLMN6xx018f9Qy7qss2NbWzU94iG6Yav8xXLFftr 1OZaHKkU16cnq9McZgNakTB0il3iZLCzQg2JIjNCHRk9TL8kMHSY3K4fbQYaGBbnpWV0 ZGEA== X-Gm-Message-State: AOJu0Yx/tEbO4tpCbyh4uz6UgBXCbwYHrSk6S1X4kAxY9+8usYNt/YgS kdOCt5eWmFWVxJnSduULTQxuacGzlHALwcJLQo/JtZR3Iok= X-Google-Smtp-Source: AGHT+IFnOA+MNP93s632NzdRvC0WCNfXwdY10gKVyb8pXRHMLOQl8Wj7VCzhtMpDUmfN91AXSabj6w== X-Received: by 2002:a17:903:40cc:b0:1d3:f7ce:c187 with SMTP id t12-20020a17090340cc00b001d3f7cec187mr11372196pld.17.1703727999727; Wed, 27 Dec 2023 17:46:39 -0800 (PST) Received: from localhost (fwdproxy-prn-017.fbsv.net. [2a03:2880:ff:11::face:b00c]) by smtp.gmail.com with ESMTPSA id z20-20020a170902ee1400b001d3a9676973sm12650854plb.111.2023.12.27.17.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 17:46:39 -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 v5 3/5] netdevsim: forward skbs from one connected port to another Date: Wed, 27 Dec 2023 17:46:31 -0800 Message-Id: <20231228014633.3256862-4-dw@davidwei.uk> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231228014633.3256862-1-dw@davidwei.uk> References: <20231228014633.3256862-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 | 21 ++++++++++++++++++--- drivers/net/netdevsim/netdevsim.h | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 434322f6a565..0009d0f1243f 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -29,19 +29,34 @@ static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct netdevsim *ns = netdev_priv(dev); + 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++; 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 +85,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 +318,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 24fc3fbda791..083b1ee7a1a2 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 Thu Dec 28 01:46:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13505549 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (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 3AE9A1FAA for ; Thu, 28 Dec 2023 01:46:40 +0000 (UTC) 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="REh6A+Ca" Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-28beb1d946fso4608634a91.0 for ; Wed, 27 Dec 2023 17:46:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1703728000; x=1704332800; 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=c0RSkXs7li8lnvkzU5r8iNz4kfcZb38Ob07KAbBW2h4=; b=REh6A+CaZfHGEqlP/6u9Q+M+U4F7q0SgX+78jo+L0DWmRR/iQP7XfXAKRkcwYuVr9s 0Lg6DIP+W2KYiZe33kxi1Qjt2D8p8IDfCqidN2p0nYeu1OuYEahxkFUIkAwNg5i1zxpL Yu7mXw77lzMMxECw43vT4hwt5oucUYcgvJa7xeiD6V574g4lnQRneLsc12zM98SZuylZ 7LRMr9CDLul25vzE4qRz4EdEGindt/MGIVdJM/xh//kh5WtRnbkupWfSf42+yF6fYRQO f/PciuPw2pvYRHHhk8R5r4tjI7H4NpknhkNxGL+IgdKYrgtvAc5GmYRwzU2ADcJzynfX dinA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703728000; x=1704332800; 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=c0RSkXs7li8lnvkzU5r8iNz4kfcZb38Ob07KAbBW2h4=; b=Hb9OrVVq9W5HbnWw1/LrdapPggXuLsKry6b9aqNsNcOI1KQrj+DWRDYB5pVuvnT+cu 1AejSD2K/j7SLlQDUHnD4NNikOSFXwGnf+TAc6eNRzAJQMkBV+HNsUhjMUwh7KG7nEBI r7M6nZKT5mk6jzIo0eGanqwpEyvMKckNQpwmEo74jYOpZJ8x8zvg5F6vYOF4wgwfdhE4 zUpeXwFD7lBgEbW1+He9end/F8+UNmMizmNyh3ykmXIyKbSAUbpQOthHMVZ0XfXuJnre zgmAiWYonX3fbWC60Hnpzu4bHEOh8xvTdoEdvM5qxF4atyBAdM77FgO+Z7U9Pa8O/EUp 6XpQ== X-Gm-Message-State: AOJu0YxVtfdQSUAyUT0iREDRBCKDOLKebf8n1ln2+CteSD8l/j4hL4NF QNi8LCHtC4ejFQeRbGynvLi2/n/0ZO3JQg== X-Google-Smtp-Source: AGHT+IGNmlb/hRtCzZrqmDGNddn0b2sG830VPHvMqXJQisK30qOMU8uIGq9dyFqFU0+rw17E6qKNJg== X-Received: by 2002:a17:90a:d243:b0:28b:ecdf:3267 with SMTP id o3-20020a17090ad24300b0028becdf3267mr4470803pjw.85.1703728000559; Wed, 27 Dec 2023 17:46:40 -0800 (PST) Received: from localhost (fwdproxy-prn-002.fbsv.net. [2a03:2880:ff:2::face:b00c]) by smtp.gmail.com with ESMTPSA id o23-20020a17090aac1700b0028c361b5c7csm8788341pjq.23.2023.12.27.17.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 17:46:40 -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 v5 4/5] netdevsim: add selftest for forwarding skb between connected ports Date: Wed, 27 Dec 2023 17:46:32 -0800 Message-Id: <20231228014633.3256862-5-dw@davidwei.uk> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231228014633.3256862-1-dw@davidwei.uk> References: <20231228014633.3256862-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 | 124 ++++++++++++++++++ 1 file changed, 124 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..f123e6b7cd2f --- /dev/null +++ b/tools/testing/selftests/drivers/net/netdevsim/peer.sh @@ -0,0 +1,124 @@ +#!/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 + +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 0" > ${NSIM_DEV_1_DFS}/ports/0/peer 2>/dev/null +if [ $? -eq 0 ]; then + echo "linking with non-existent netdevsim should fail" + exit 1 +fi + +echo $NSIM_DEV_2_ID > $NSIM_DEV_SYS_NEW + +echo "$NSIM_DEV_2_ID 0" > ${NSIM_DEV_1_DFS}/ports/0/peer +if [ $? -ne 0 ]; then + echo "linking netdevsim1 port0 with netdevsim2 port0 should succeed" + exit 1 +fi + +# argument error checking + +echo "$NSIM_DEV_2_ID 1" > ${NSIM_DEV_1_DFS}/ports/0/peer 2>/dev/null +if [ $? -eq 0 ]; then + echo "linking with non-existent port in a netdevsim should fail" + exit 1 +fi + +echo "$NSIM_DEV_1_ID 0" > ${NSIM_DEV_1_DFS}/ports/0/peer 2>/dev/null +if [ $? -eq 0 ]; then + echo "linking with self should fail" + exit 1 +fi + +echo "$NSIM_DEV_2_ID a" > ${NSIM_DEV_1_DFS}/ports/0/peer 2>/dev/null +if [ $? -eq 0 ]; then + echo "invalid arg should fail" + exit 1 +fi + +# send/recv packets + +socat_check || exit 4 + +setup_ns + +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_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 Thu Dec 28 01:46:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13505550 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) (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 5817F63CD for ; Thu, 28 Dec 2023 01:46:42 +0000 (UTC) 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="ShJ4JkW9" Received: by mail-il1-f173.google.com with SMTP id e9e14a558f8ab-36011002a61so6916455ab.2 for ; Wed, 27 Dec 2023 17:46:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1703728001; x=1704332801; 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=iWOr9qiisUkjpabZ4ff5uQEtv5SlwPvl6ptfPUH6+qE=; b=ShJ4JkW9x5Hx6vCIisDBFqLM4D5vass+jQGAMdzXLWSDHP3UIdENKnfd55AUb6ZB4s xysaZBQLWwi+Gq+uiXmTndc+34yaJPI3senkZ+aeMym/ujqLk/NhYZfdz9S/kBaje6Zs /WDxeYXfNBrDH0IqYIE1CcgmHazc/2H2V4GtM64jKbB2IcnEEPEMdFBGykHqGU/s/iBf j7J0kVA/6Oz0VIqp/eLXXwdP+LX5Vgd48tIIh9K9N5tY0FUXbBFifZy1lsh9fsyTsdEC 3My8qqnVw47vFyzwHrwlTpR8LGz4orfvK33wIjO+fpuMZ8ab1fejrAzqnnizYqTFs9Mu FRQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703728001; x=1704332801; 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=iWOr9qiisUkjpabZ4ff5uQEtv5SlwPvl6ptfPUH6+qE=; b=mNxwIr+DBoz2UQdJM2vuHtUwdGB2oM7nUDXECCXmpOYbA0t4Ca9Gshx9X9qMyeF+cx plqH6njUJyDuU64cATMBEeHLcV2stXgtlzFccwuYV7GGIqlWp6D93hsjnXr5essqDvxd wyQH0gUwu9+lhbTk8Nhjhz6IXg5XrxcCpUsJVWyOXY0Gg1PQWEDvT6QpxkPvOJzbFA+7 +mdBusd9Kb5FBjBZIaxn4O6fxib829fwCPt2/pxwRpXS7FFRRVZpv2hOOVjyue7neR2w jCQj5scTjbxdEm2Mb96Pj9OtJSxdbfs7v1uTQA/XBxo8io/1G6Matg6XShqjxVOrl4as ohKw== X-Gm-Message-State: AOJu0Yw7GNXbGe9VFJt9zeJK/crgVVoTfmEe6NGpT0BU3fAITrF+icEI mP26C7h0wd3dMzlfAF+lk9x4QIETH2lC4Q== X-Google-Smtp-Source: AGHT+IGMPegCJ/F3qJEJmMCzk2K1vXg812RpdKQudnYzc843wiuvK4+uTcbD78Ik+CpZovH3zIE59Q== X-Received: by 2002:a05:6e02:154e:b0:35f:eba8:4e36 with SMTP id j14-20020a056e02154e00b0035feba84e36mr8828546ilu.23.1703728001425; Wed, 27 Dec 2023 17:46:41 -0800 (PST) Received: from localhost (fwdproxy-prn-120.fbsv.net. [2a03:2880:ff:78::face:b00c]) by smtp.gmail.com with ESMTPSA id u26-20020a63235a000000b005c2420fb198sm12159560pgm.37.2023.12.27.17.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 17:46:41 -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 v5 5/5] netdevsim: add Makefile for selftests Date: Wed, 27 Dec 2023 17:46:33 -0800 Message-Id: <20231228014633.3256862-6-dw@davidwei.uk> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231228014633.3256862-1-dw@davidwei.uk> References: <20231228014633.3256862-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 dda78b4ce707..d086e49eac57 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14853,6 +14853,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