* [PATCH net-next v2] net: dqs: introduce IFF_NO_BQL private flag for non-BQL drivers
@ 2024-06-11 3:32 Jason Xing
2024-06-12 21:40 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Jason Xing @ 2024-06-11 3:32 UTC (permalink / raw)
To: edumazet, kuba, pabeni, davem, dsahern, mst, jasowang, xuanzhuo,
eperezma, leitao
Cc: netdev, kerneljasonxing, Jason Xing
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>
---
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 | 4 ++++
net/core/net-sysfs.c | 2 +-
3 files changed, 6 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 d20c6c99eb88..6d379858d11f 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1649,6 +1649,9 @@ 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 use BQL for flow control for now. It's used
+ * to check if we should create byte_queue_limits directory in dqs
+ * (see netdev_uses_bql())
*/
enum netdev_priv_flags {
IFF_802_1Q_VLAN = 1<<0,
@@ -1685,6 +1688,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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next v2] net: dqs: introduce IFF_NO_BQL private flag for non-BQL drivers
2024-06-11 3:32 [PATCH net-next v2] net: dqs: introduce IFF_NO_BQL private flag for non-BQL drivers Jason Xing
@ 2024-06-12 21:40 ` Jakub Kicinski
2024-06-13 2:23 ` Jason Xing
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2024-06-12 21:40 UTC (permalink / raw)
To: Jason Xing
Cc: edumazet, pabeni, davem, dsahern, mst, jasowang, xuanzhuo,
eperezma, leitao, netdev, Jason Xing
On Tue, 11 Jun 2024 11:32:03 +0800 Jason Xing wrote:
> +++ b/include/linux/netdevice.h
> @@ -1649,6 +1649,9 @@ 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 use BQL for flow control for now. It's used
> + * to check if we should create byte_queue_limits directory in dqs
> + * (see netdev_uses_bql())
Sorry for nit but since it's netdevice.h.. can we rephrase the comment
a bit? How about just:
+ * @IFF_NO_BQL: driver doesn't support BQL, don't create "byte_queue_limits"
+ * directories in sysfs.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net-next v2] net: dqs: introduce IFF_NO_BQL private flag for non-BQL drivers
2024-06-12 21:40 ` Jakub Kicinski
@ 2024-06-13 2:23 ` Jason Xing
0 siblings, 0 replies; 3+ messages in thread
From: Jason Xing @ 2024-06-13 2:23 UTC (permalink / raw)
To: Jakub Kicinski
Cc: edumazet, pabeni, davem, dsahern, mst, jasowang, xuanzhuo,
eperezma, leitao, netdev, Jason Xing
On Thu, Jun 13, 2024 at 5:40 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Tue, 11 Jun 2024 11:32:03 +0800 Jason Xing wrote:
> > +++ b/include/linux/netdevice.h
> > @@ -1649,6 +1649,9 @@ 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 use BQL for flow control for now. It's used
> > + * to check if we should create byte_queue_limits directory in dqs
> > + * (see netdev_uses_bql())
>
> Sorry for nit but since it's netdevice.h.. can we rephrase the comment
> a bit? How about just:
>
> + * @IFF_NO_BQL: driver doesn't support BQL, don't create "byte_queue_limits"
> + * directories in sysfs.
No problem. I will revise it as you said. Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-13 2:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-11 3:32 [PATCH net-next v2] net: dqs: introduce IFF_NO_BQL private flag for non-BQL drivers Jason Xing
2024-06-12 21:40 ` Jakub Kicinski
2024-06-13 2:23 ` Jason Xing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).