[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250919213153.103606-5-daniel@iogearbox.net>
Date: Fri, 19 Sep 2025 23:31:37 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: netdev@...r.kernel.org
Cc: bpf@...r.kernel.org,
kuba@...nel.org,
davem@...emloft.net,
razor@...ckwall.org,
pabeni@...hat.com,
willemb@...gle.com,
sdf@...ichev.me,
john.fastabend@...il.com,
martin.lau@...nel.org,
jordan@...fe.io,
maciej.fijalkowski@...el.com,
magnus.karlsson@...el.com,
David Wei <dw@...idwei.uk>
Subject: [PATCH net-next 04/20] net: Add ndo_{peer,unpeer}_queues callback
Add ndo_{peer,unpeer}_queues() callback which can be used by virtual drivers
that implement rxq mapping to a real rxq to update their internal state or
exposed capability flags from the set of rxq mappings.
Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
Co-developed-by: David Wei <dw@...idwei.uk>
Signed-off-by: David Wei <dw@...idwei.uk>
---
include/linux/netdevice.h | 15 ++++++++++++++-
include/net/netdev_rx_queue.h | 4 ++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 1c54d44805fa..43b3c4e3593e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -65,6 +65,7 @@ struct macsec_context;
struct macsec_ops;
struct netdev_config;
struct netdev_name_node;
+struct netdev_rx_queue;
struct sd_flow_limit;
struct sfp_bus;
/* 802.11 specific */
@@ -1404,6 +1405,15 @@ struct netdev_net_notifier {
* struct kernel_hwtstamp_config *kernel_config,
* struct netlink_ext_ack *extack);
* Change the hardware timestamping parameters for NIC device.
+ *
+ * void (*ndo_peer_queues)(struct net_device *dev, struct netdev_rx_queue *rxq);
+ * Custom callback for drivers when a physical queue gets peered with
+ * a virtual one, so that device drivers can update exposed device flags.
+ *
+ * void (*ndo_unpeer_queues)(struct net_device *dev, struct netdev_rx_queue *rxq);
+ * Custom callback for drivers when a physical queue gets unpeered with
+ * a virtual one, so that device drivers can update exposed device flags.
+ * Reverse operation of ndo_peer_queues.
*/
struct net_device_ops {
int (*ndo_init)(struct net_device *dev);
@@ -1651,7 +1661,10 @@ struct net_device_ops {
int (*ndo_hwtstamp_set)(struct net_device *dev,
struct kernel_hwtstamp_config *kernel_config,
struct netlink_ext_ack *extack);
-
+ void (*ndo_peer_queues)(struct net_device *dev,
+ struct netdev_rx_queue *rxq);
+ void (*ndo_unpeer_queues)(struct net_device *dev,
+ struct netdev_rx_queue *rxq);
#if IS_ENABLED(CONFIG_NET_SHAPER)
/**
* @net_shaper_ops: Device shaping offload operations
diff --git a/include/net/netdev_rx_queue.h b/include/net/netdev_rx_queue.h
index 47126ccaf854..fdfacd28c2ae 100644
--- a/include/net/netdev_rx_queue.h
+++ b/include/net/netdev_rx_queue.h
@@ -72,6 +72,8 @@ static inline void netdev_rx_queue_peer(struct net_device *src_dev,
{
dev_hold(src_dev);
__netdev_rx_queue_peer(src_rxq, dst_rxq);
+ if (dst_rxq->dev->netdev_ops->ndo_peer_queues)
+ dst_rxq->dev->netdev_ops->ndo_peer_queues(dst_rxq->dev, dst_rxq);
}
static inline void __netdev_rx_queue_unpeer(struct netdev_rx_queue *src_rxq,
@@ -85,6 +87,8 @@ static inline void netdev_rx_queue_unpeer(struct net_device *src_dev,
struct netdev_rx_queue *src_rxq,
struct netdev_rx_queue *dst_rxq)
{
+ if (dst_rxq->dev->netdev_ops->ndo_unpeer_queues)
+ dst_rxq->dev->netdev_ops->ndo_unpeer_queues(dst_rxq->dev, dst_rxq);
__netdev_rx_queue_unpeer(src_rxq, dst_rxq);
dev_put(src_dev);
}
--
2.43.0
Powered by blists - more mailing lists