From: Jason Xing <kerneljasonxing@gmail.com>
To: edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
davem@davemloft.net, dsahern@kernel.org, mst@redhat.com,
jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
eperezma@redhat.com, leitao@debian.org
Cc: netdev@vger.kernel.org, kerneljasonxing@gmail.com,
Jason Xing <kernelxing@tencent.com>
Subject: [PATCH net-next v3] net: dqs: introduce IFF_NO_BQL private flag for non-BQL drivers
Date: Thu, 13 Jun 2024 10:35:49 +0800 [thread overview]
Message-ID: <20240613023549.15213-1-kerneljasonxing@gmail.com> (raw)
From: Jason Xing <kernelxing@tencent.com>
Since commit 74293ea1c4db6 ("net: sysfs: Do not create sysfs for non
BQL device") limits the non-BQL driver not creating byte_queue_limits
directory, I found there is one exception, namely, virtio-net driver,
which should also be limited in netdev_uses_bql(). Let me give it a
try first.
I decided to introduce a NO_BQL bit because:
1) it can help us limit virtio-net driver for now.
2) if we found another non-BQL driver, we can take it into account.
3) we can replace all the driver meeting those two statements in
netdev_uses_bql() in future.
For now, I would like to make the first step to use this new bit for dqs
use instead of replacing/applying all the non-BQL drivers in one go.
As Jakub said, "netdev_uses_bql() is best effort", I think, we can add
new non-BQL drivers as soon as we find one.
After this patch, there is no byte_queue_limits directory in virtio-net
driver.
Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
v3
Link: https://lore.kernel.org/all/20240611033203.54845-1-kerneljasonxing@gmail.com/
1. revise the comment as suggested by Jakub.
v2
Link: https://lore.kernel.org/all/20240609131732.73156-1-kerneljasonxing@gmail.com/
1. chose to add the new bit into enum netdev_priv_flags() instead of
breaking the room of device feature.
---
drivers/net/virtio_net.c | 2 +-
include/linux/netdevice.h | 3 +++
net/core/net-sysfs.c | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 61a57d134544..728f4b9844cc 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -5631,7 +5631,7 @@ static int virtnet_probe(struct virtio_device *vdev)
/* Set up network device as normal. */
dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE |
- IFF_TX_SKB_NO_LINEAR;
+ IFF_TX_SKB_NO_LINEAR | IFF_NO_BQL;
dev->netdev_ops = &virtnet_netdev;
dev->stat_ops = &virtnet_stat_ops;
dev->features = NETIF_F_HIGHDMA;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index f148a01dd1d1..d371c2b425ca 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1649,6 +1649,8 @@ struct net_device_ops {
* @IFF_SEE_ALL_HWTSTAMP_REQUESTS: device wants to see calls to
* ndo_hwtstamp_set() for all timestamp requests regardless of source,
* even if those aren't HWTSTAMP_SOURCE_NETDEV.
+ * @IFF_NO_BQL: driver doesn't support BQL, don't create "byte_queue_limits"
+ * directories in sysfs.
*/
enum netdev_priv_flags {
IFF_802_1Q_VLAN = 1<<0,
@@ -1685,6 +1687,7 @@ enum netdev_priv_flags {
IFF_TX_SKB_NO_LINEAR = BIT_ULL(31),
IFF_CHANGE_PROTO_DOWN = BIT_ULL(32),
IFF_SEE_ALL_HWTSTAMP_REQUESTS = BIT_ULL(33),
+ IFF_NO_BQL = BIT_ULL(34),
};
#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 4c27a360c294..7d99fbbad6af 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1765,7 +1765,7 @@ static const struct kobj_type netdev_queue_ktype = {
static bool netdev_uses_bql(const struct net_device *dev)
{
if (dev->features & NETIF_F_LLTX ||
- dev->priv_flags & IFF_NO_QUEUE)
+ dev->priv_flags & (IFF_NO_QUEUE | IFF_NO_BQL))
return false;
return IS_ENABLED(CONFIG_BQL);
--
2.37.3
next reply other threads:[~2024-06-13 2:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-13 2:35 Jason Xing [this message]
2024-06-13 5:38 ` [PATCH net-next v3] net: dqs: introduce IFF_NO_BQL private flag for non-BQL drivers Jiri Pirko
2024-06-13 6:08 ` Jason Xing
2024-06-13 7:19 ` Jiri Pirko
2024-06-13 7:24 ` Jason Xing
2024-06-13 7:49 ` Jason Xing
2024-06-13 7:51 ` Jiri Pirko
2024-06-13 7:52 ` Jason Xing
2024-06-13 7:56 ` Michael S. Tsirkin
2024-06-13 9:26 ` Jason Xing
2024-06-13 13:08 ` Jason Xing
2024-06-13 13:17 ` Jiri Pirko
2024-06-13 14:11 ` Jason Xing
2024-06-13 14:34 ` Jiri Pirko
2024-06-13 14:48 ` Jason Xing
2024-06-13 14:55 ` Jason Xing
2024-06-13 15:02 ` Jakub Kicinski
2024-06-13 15:25 ` Eric Dumazet
2024-06-13 15:37 ` Jason Xing
2024-06-13 15:48 ` Eric Dumazet
2024-06-13 16:20 ` Jason Xing
2024-06-13 15:31 ` Jason Xing
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=20240613023549.15213-1-kerneljasonxing@gmail.com \
--to=kerneljasonxing@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=kernelxing@tencent.com \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=xuanzhuo@linux.alibaba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.