On 12/1/25 9:26 AM, Michael S. Tsirkin wrote: > On Wed, Nov 26, 2025 at 01:35:38PM -0600, Daniel Jurgens wrote: >> Implement TCP and UDP V4/V6 ethtool flow types. >> >> Examples: >> $ ethtool -U ens9 flow-type udp4 dst-ip 192.168.5.2 dst-port\ >> 4321 action 20 >> Added rule with ID 4 >> >> This example directs IPv4 UDP traffic with the specified address and >> port to queue 20. >> >> $ ethtool -U ens9 flow-type tcp6 src-ip 2001:db8::1 src-port 1234 dst-ip\ >> 2001:db8::2 dst-port 4321 action 12 >> Added rule with ID 5 >> >> This example directs IPv6 TCP traffic with the specified address and >> port to queue 12. >> >> Signed-off-by: Daniel Jurgens <[email protected]> >> Reviewed-by: Parav Pandit <[email protected]> >> Reviewed-by: Shahar Shitrit <[email protected]> >> Reviewed-by: Xuan Zhuo <[email protected]> >> --- >> v4: (*num_hdrs)++ to ++(*num_hdrs) >> >> v12: >> - Refactor calculate_flow_sizes. MST >> - Refactor build_and_insert to remove goto validate. MST >> - Move parse_ip4/6 l3_mask check here. MST >> --- >> --- >> drivers/net/virtio_net.c | 229 ++++++++++++++++++++++++++++++++++++--- >> 1 file changed, 215 insertions(+), 14 deletions(-) >> >> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c >> index 28d53c8bdec6..908e903272db 100644 >> --- a/drivers/net/virtio_net.c >> +++ b/drivers/net/virtio_net.c >> @@ -5963,6 +5963,52 @@ static bool validate_ip6_mask(const struct virtnet_ff >> *ff, >> return true; >> } >> >> +static bool validate_tcp_mask(const struct virtnet_ff *ff, >> + const struct virtio_net_ff_selector *sel, >> + const struct virtio_net_ff_selector *sel_cap) >> +{ >> + bool partial_mask = !!(sel_cap->flags & >> VIRTIO_NET_FF_MASK_F_PARTIAL_MASK); >> + struct tcphdr *cap, *mask; >> + >> + cap = (struct tcphdr *)&sel_cap->mask; >> + mask = (struct tcphdr *)&sel->mask; > > > given you are parsing tcphdr you should include uapi/linux/tcp.h > > for udp - uapi/linux/udp.h >
Will do.
