* Re: [PATCH net-next 11/11] virtio_net: Add get ethtool flow rules ops
@ 2025-08-28 18:40 kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-08-28 18:40 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250827183852.2471-12-danielj@nvidia.com>
References: <20250827183852.2471-12-danielj@nvidia.com>
TO: Daniel Jurgens <danielj@nvidia.com>
TO: netdev@vger.kernel.org
TO: mst@redhat.com
TO: jasowang@redhat.com
TO: alex.williamson@redhat.com
TO: virtualization@lists.linux.dev
TO: pabeni@redhat.com
CC: parav@nvidia.com
CC: shshitrit@nvidia.com
CC: yohadt@nvidia.com
CC: Daniel Jurgens <danielj@nvidia.com>
Hi Daniel,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Daniel-Jurgens/virtio-pci-Expose-generic-device-capability-operations/20250828-024128
base: net-next/main
patch link: https://lore.kernel.org/r/20250827183852.2471-12-danielj%40nvidia.com
patch subject: [PATCH net-next 11/11] virtio_net: Add get ethtool flow rules ops
:::::: branch date: 24 hours ago
:::::: commit date: 24 hours ago
config: x86_64-randconfig-r073-20250828 (https://download.01.org/0day-ci/archive/20250829/202508290203.AzlaAntz-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202508290203.AzlaAntz-lkp@intel.com/
New smatch warnings:
drivers/net/virtio_net/virtio_net_ff.c:850 virtnet_ethtool_get_all_flows() warn: iterator 'i' not incremented
Old smatch warnings:
drivers/net/virtio_net/virtio_net_ff.c:321 setup_classifier() warn: iterator 'i' not incremented
drivers/net/virtio_net/virtio_net_ff.c:1014 virtnet_ff_cleanup() warn: iterator 'i' not incremented
vim +/i +850 drivers/net/virtio_net/virtio_net_ff.c
5e0d228c07c140 Daniel Jurgens 2025-08-27 838
5e0d228c07c140 Daniel Jurgens 2025-08-27 839 int
5e0d228c07c140 Daniel Jurgens 2025-08-27 840 virtnet_ethtool_get_all_flows(struct virtnet_ff *ff,
5e0d228c07c140 Daniel Jurgens 2025-08-27 841 struct ethtool_rxnfc *info, u32 *rule_locs)
5e0d228c07c140 Daniel Jurgens 2025-08-27 842 {
5e0d228c07c140 Daniel Jurgens 2025-08-27 843 struct virtnet_ethtool_rule *eth_rule;
5e0d228c07c140 Daniel Jurgens 2025-08-27 844 unsigned long i = 0;
5e0d228c07c140 Daniel Jurgens 2025-08-27 845 int idx = 0;
5e0d228c07c140 Daniel Jurgens 2025-08-27 846
5e0d228c07c140 Daniel Jurgens 2025-08-27 847 if (!ff->ff_supported)
5e0d228c07c140 Daniel Jurgens 2025-08-27 848 return -EOPNOTSUPP;
5e0d228c07c140 Daniel Jurgens 2025-08-27 849
5e0d228c07c140 Daniel Jurgens 2025-08-27 @850 xa_for_each(&ff->ethtool.rules, i, eth_rule)
5e0d228c07c140 Daniel Jurgens 2025-08-27 851 rule_locs[idx++] = i;
5e0d228c07c140 Daniel Jurgens 2025-08-27 852
5e0d228c07c140 Daniel Jurgens 2025-08-27 853 info->data = le32_to_cpu(ff->ff_caps->rules_limit);
5e0d228c07c140 Daniel Jurgens 2025-08-27 854
5e0d228c07c140 Daniel Jurgens 2025-08-27 855 return 0;
5e0d228c07c140 Daniel Jurgens 2025-08-27 856 }
5e0d228c07c140 Daniel Jurgens 2025-08-27 857
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH net-next 00/11] virtio_net: Add ethtool flow rules support
@ 2025-08-27 18:38 Daniel Jurgens
2025-08-27 18:38 ` [PATCH net-next 11/11] virtio_net: Add get ethtool flow rules ops Daniel Jurgens
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Jurgens @ 2025-08-27 18:38 UTC (permalink / raw)
To: netdev, mst, jasowang, alex.williamson, virtualization, pabeni
Cc: parav, shshitrit, yohadt, Daniel Jurgens
This series implements ethtool flow rules support for virtio_net using the
virtio flow filter (FF) specification. The implementation allows users to
configure packet filtering rules through ethtool commands, directing
packets to specific receive queues, or dropping them based on various
header fields.
The series starts with infrastructure changes to expose virtio PCI admin
capabilities and object management APIs. It then creates the virtio_net
directory structure and implements the flow filter functionality with support
for:
- Layer 2 (Ethernet) flow rules
- IPv4 and IPv6 flow rules
- TCP and UDP flow rules (both IPv4 and IPv6)
- Rule querying and management operations
Setting, deleting and viewing flow filters, -1 action is drop, postive
integers steer to that RQ:
$ ethtool -u ens9
4 RX rings available
Total 0 rules
$ ethtool -U ens9 flow-type ether src 1c:34:da:4a:33:dd action 0
Added rule with ID 0
$ ethtool -U ens9 flow-type udp4 dst-port 5001 action 3
Added rule with ID 1
$ ethtool -U ens9 flow-type tcp6 src-ip fc00::2 dst-port 5001 action 2
Added rule with ID 2
$ ethtool -U ens9 flow-type ip4 src-ip 192.168.51.101 action 1
Added rule with ID 3
$ ethtool -U ens9 flow-type ip6 dst-ip fc00::1 action -1
Added rule with ID 4
$ ethtool -U ens9 flow-type ip6 src-ip fc00::2 action -1
Added rule with ID 5
$ ethtool -U ens9 delete 4
$ ethtool -u ens9
4 RX rings available
Total 5 rules
Filter: 0
Flow Type: Raw Ethernet
Src MAC addr: 1C:34:DA:4A:33:DD mask: 00:00:00:00:00:00
Dest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
Ethertype: 0x0 mask: 0xFFFF
Action: Direct to queue 0
Filter: 1
Rule Type: UDP over IPv4
Src IP addr: 0.0.0.0 mask: 255.255.255.255
Dest IP addr: 0.0.0.0 mask: 255.255.255.255
TOS: 0x0 mask: 0xff
Src port: 0 mask: 0xffff
Dest port: 5001 mask: 0x0
Action: Direct to queue 3
Filter: 2
Rule Type: TCP over IPv6
Src IP addr: fc00::2 mask: ::
Dest IP addr: :: mask: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
Traffic Class: 0x0 mask: 0xff
Src port: 0 mask: 0xffff
Dest port: 5001 mask: 0x0
Action: Direct to queue 2
Filter: 3
Rule Type: Raw IPv4
Src IP addr: 192.168.51.101 mask: 0.0.0.0
Dest IP addr: 0.0.0.0 mask: 255.255.255.255
TOS: 0x0 mask: 0xff
Protocol: 0 mask: 0xff
L4 bytes: 0x0 mask: 0xffffffff
Action: Direct to queue 1
Filter: 5
Rule Type: Raw IPv6
Src IP addr: fc00::2 mask: ::
Dest IP addr: :: mask: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
Traffic Class: 0x0 mask: 0xff
Protocol: 0 mask: 0xff
L4 bytes: 0x0 mask: 0xffffffff
Action: Drop
Daniel Jurgens (11):
virtio-pci: Expose generic device capability operations
virtio-pci: Expose object create and destroy API
virtio_net: Create virtio_net directory
virtio_net: Query and set flow filter caps
virtio_net: Create a FF group for ethtool steering
virtio_net: Implement layer 2 ethtool flow rules
virtio_net: Use existing classifier if possible
virtio_net: Implement IPv4 ethtool flow rules
virtio_net: Add support for IPv6 ethtool steering
virtio_net: Add support for TCP and UDP ethtool rules
virtio_net: Add get ethtool flow rules ops
MAINTAINERS | 2 +-
drivers/net/Makefile | 2 +-
drivers/net/virtio_net/Makefile | 8 +
drivers/net/virtio_net/virtio_net_ff.c | 1027 +++++++++++++++++
drivers/net/virtio_net/virtio_net_ff.h | 42 +
.../virtio_net_main.c} | 32 +
drivers/vfio/pci/virtio/migrate.c | 8 +-
drivers/virtio/virtio.c | 141 +++
drivers/virtio/virtio_pci_common.h | 1 -
drivers/virtio/virtio_pci_modern.c | 320 ++---
include/linux/virtio.h | 21 +
include/linux/virtio_admin.h | 101 ++
include/linux/virtio_pci_admin.h | 7 +-
include/uapi/linux/virtio_net_ff.h | 82 ++
include/uapi/linux/virtio_pci.h | 7 +-
15 files changed, 1660 insertions(+), 141 deletions(-)
create mode 100644 drivers/net/virtio_net/Makefile
create mode 100644 drivers/net/virtio_net/virtio_net_ff.c
create mode 100644 drivers/net/virtio_net/virtio_net_ff.h
rename drivers/net/{virtio_net.c => virtio_net/virtio_net_main.c} (99%)
create mode 100644 include/linux/virtio_admin.h
create mode 100644 include/uapi/linux/virtio_net_ff.h
--
2.50.1
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH net-next 11/11] virtio_net: Add get ethtool flow rules ops
2025-08-27 18:38 [PATCH net-next 00/11] virtio_net: Add ethtool flow rules support Daniel Jurgens
@ 2025-08-27 18:38 ` Daniel Jurgens
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jurgens @ 2025-08-27 18:38 UTC (permalink / raw)
To: netdev, mst, jasowang, alex.williamson, virtualization, pabeni
Cc: parav, shshitrit, yohadt, Daniel Jurgens
- Get total number of rules. There's no user interface for this. It is
used to allocate an appropriately sized buffer for getting all the
rules.
- Get specific rule
$ ethtool -u ens9 rule 0
Filter: 0
Rule Type: UDP over IPv4
Src IP addr: 0.0.0.0 mask: 255.255.255.255
Dest IP addr: 192.168.5.2 mask: 0.0.0.0
TOS: 0x0 mask: 0xff
Src port: 0 mask: 0xffff
Dest port: 4321 mask: 0x0
Action: Direct to queue 16
- Get all rules:
$ ethtool -u ens9
31 RX rings available
Total 2 rules
Filter: 0
Rule Type: UDP over IPv4
Src IP addr: 0.0.0.0 mask: 255.255.255.255
Dest IP addr: 192.168.5.2 mask: 0.0.0.0
...
Filter: 1
Flow Type: Raw Ethernet
Src MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF
Dest MAC addr: 08:11:22:33:44:54 mask: 00:00:00:00:00:00
Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
Reviewed-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Shahar Shitrit <shshitrit@nvidia.com>
---
drivers/net/virtio_net/virtio_net_ff.c | 48 ++++++++++++++++++++++++
drivers/net/virtio_net/virtio_net_ff.h | 6 +++
drivers/net/virtio_net/virtio_net_main.c | 9 +++++
3 files changed, 63 insertions(+)
diff --git a/drivers/net/virtio_net/virtio_net_ff.c b/drivers/net/virtio_net/virtio_net_ff.c
index a1f5c913bf08..2a76de5f7f32 100644
--- a/drivers/net/virtio_net/virtio_net_ff.c
+++ b/drivers/net/virtio_net/virtio_net_ff.c
@@ -807,6 +807,54 @@ int virtnet_ethtool_flow_remove(struct virtnet_ff *ff, int location)
return err;
}
+int virtnet_ethtool_get_flow_count(struct virtnet_ff *ff,
+ struct ethtool_rxnfc *info)
+{
+ if (!ff->ff_supported)
+ return -EOPNOTSUPP;
+
+ info->rule_cnt = ff->ethtool.num_rules;
+ info->data = le32_to_cpu(ff->ff_caps->rules_limit) | RX_CLS_LOC_SPECIAL;
+
+ return 0;
+}
+
+int virtnet_ethtool_get_flow(struct virtnet_ff *ff,
+ struct ethtool_rxnfc *info)
+{
+ struct virtnet_ethtool_rule *eth_rule;
+
+ if (!ff->ff_supported)
+ return -EOPNOTSUPP;
+
+ eth_rule = xa_load(&ff->ethtool.rules, info->fs.location);
+ if (!eth_rule)
+ return -ENOENT;
+
+ info->fs = eth_rule->flow_spec;
+
+ return 0;
+}
+
+int
+virtnet_ethtool_get_all_flows(struct virtnet_ff *ff,
+ struct ethtool_rxnfc *info, u32 *rule_locs)
+{
+ struct virtnet_ethtool_rule *eth_rule;
+ unsigned long i = 0;
+ int idx = 0;
+
+ if (!ff->ff_supported)
+ return -EOPNOTSUPP;
+
+ xa_for_each(&ff->ethtool.rules, i, eth_rule)
+ rule_locs[idx++] = i;
+
+ info->data = le32_to_cpu(ff->ff_caps->rules_limit);
+
+ return 0;
+}
+
static size_t get_mask_size(u16 type)
{
switch (type) {
diff --git a/drivers/net/virtio_net/virtio_net_ff.h b/drivers/net/virtio_net/virtio_net_ff.h
index 94b575fbd9ed..4bb41e64cc59 100644
--- a/drivers/net/virtio_net/virtio_net_ff.h
+++ b/drivers/net/virtio_net/virtio_net_ff.h
@@ -28,6 +28,12 @@ void virtnet_ff_init(struct virtnet_ff *ff, struct virtio_device *vdev);
void virtnet_ff_cleanup(struct virtnet_ff *ff);
+int virtnet_ethtool_get_flow_count(struct virtnet_ff *ff,
+ struct ethtool_rxnfc *info);
+int virtnet_ethtool_get_all_flows(struct virtnet_ff *ff,
+ struct ethtool_rxnfc *info, u32 *rule_locs);
+int virtnet_ethtool_get_flow(struct virtnet_ff *ff,
+ struct ethtool_rxnfc *info);
int virtnet_ethtool_flow_insert(struct virtnet_ff *ff,
struct ethtool_rx_flow_spec *fs,
u16 curr_queue_pairs);
diff --git a/drivers/net/virtio_net/virtio_net_main.c b/drivers/net/virtio_net/virtio_net_main.c
index 14ee26fc9ef3..63bf5fdc084f 100644
--- a/drivers/net/virtio_net/virtio_net_main.c
+++ b/drivers/net/virtio_net/virtio_net_main.c
@@ -5619,6 +5619,15 @@ static int virtnet_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
int rc = 0;
switch (info->cmd) {
+ case ETHTOOL_GRXCLSRLCNT:
+ rc = virtnet_ethtool_get_flow_count(&vi->ff, info);
+ break;
+ case ETHTOOL_GRXCLSRULE:
+ rc = virtnet_ethtool_get_flow(&vi->ff, info);
+ break;
+ case ETHTOOL_GRXCLSRLALL:
+ rc = virtnet_ethtool_get_all_flows(&vi->ff, info, rule_locs);
+ break;
case ETHTOOL_GRXRINGS:
info->data = vi->curr_queue_pairs;
break;
--
2.50.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-28 18:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-28 18:40 [PATCH net-next 11/11] virtio_net: Add get ethtool flow rules ops kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2025-08-27 18:38 [PATCH net-next 00/11] virtio_net: Add ethtool flow rules support Daniel Jurgens
2025-08-27 18:38 ` [PATCH net-next 11/11] virtio_net: Add get ethtool flow rules ops Daniel Jurgens
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.