From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=40.107.201.33 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796137081; b=Fj8OCMp10BLpZnclzwxfLSxxnC7D265Hxu7+sgIIOrGGe1GHcK2zc/NGd9Lv9nSMfgTQ D/6FFPhJ0gCo1E2pCw2hd38h8iYpYyHDVQCPnNccrdLlvaV3kKNmp89GbnqkqGV40q266 hOLlI1y6g6uip7FNYLOkfeehwWHzj7lUqDR5MZJFF92EKX7z7pZtqMEGjkYQyTA2IBGxR 1YgcpF6ZluwJxdvDwlWQuBaW+T5/oaH/+G5+bR92ctKC2mpcV+Q4Nk9inTqIPCvepEi9a eJymZa+eGS43Q8YasxqDMtVVL2O1DZsjxofQazU8dLc/aou4XiLkpjdPSoRay8wTxWQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796137081; h=DMARC-Filter:DKIM-Signature:Received:Received:Message-ID:Date: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-ClientProxiedBy:MIME-Version: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=kD6di2m90mDZ5Cxm3F5+8+3aMLZ1lEpdLQ1CU/N/2T4=; b=nZLlX2DBp2SAAgBnghTdKTyFbpmxOmt47RocNPfhTtYFZ5+Zjj371H560DYi6z3L/fwZ 4FW4lX5V9lM3ukR8I+B32Q1gSykkNMChEMnFm1rJbC4i7jedHz1cmYWrshFq3TmVTQZOH l4gp6THthyj8C+/ZsqWcF5LLKvKF6ZH23nvvATpdZzxB/208lInRUZuxe38ZtGlFOA735 fEic+K7Gkg40lZmAxqVOdSSN9EgOfOp7F1uMX6alGD0LF4j6pKsMoOSNJ7kCRPV+8qFSX DXUNJF3ELfRzqvc/dRvixnMAkrB84l3/+/aBt0JW3ARYjKjFS45aNLzmiyMnOzXsWHA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=TDGXdjgd; arc=pass header.oldest-pass=0 smtp.remote-ip=40.107.201.33 Received: from CH4PR04CU002.outbound.protection.outlook.com (mail-northcentralusazon11013033.outbound.protection.outlook.com [40.107.201.33]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CA2A606A333 for ; Tue, 1 Dec 2026 14:57:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7CA2A606A333 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=TDGXdjgd ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wayt4dUCBHflzzpMb8BwdW8EOJkaTKmL7pe2VQGmnHX7TSwV9hOTRR/MIue40rl3hdUGF0M/do4Xxm+AD/n1xL92UP+XLfNKo1OpiF9PUv5QUvo2oDkDG/qLXcvXm7cytVset6/h2hIxlu5uyA+mlqqqlngnbzK7A6hXwUi96ZDzgrakGKpMPidpew60hfkW2IjNGEQ8mpucPyfM8tmTF78TycoKWl607FR7Ec78JI6+Iqk8iMteYlvK3XNDE5jUlxP7xPSrUTGYXFwA5IgBmplbIKKDAnkAhPY3JVYGxocOPRgeIQREZIsScGfKaa2GkMPIp1FG2pW/TNnztMtosQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kD6di2m90mDZ5Cxm3F5+8+3aMLZ1lEpdLQ1CU/N/2T4=; b=WylRXWPaP9Ae8U7S//nZv5DMJEdcSG1FULqSlsD5BEizrFx5TcQvMP00Rqx8YWLkyt4GL9vVGfsRm6lkbQ1jfqf/qM6QrU36cG7bDp0xFcDXEF0blvk9i9ls/MBbhB2vNYHBlG8CJqkp5jOq2aIlT5ntrj+4YpxP14gtWMplVdD+L4HoFZiGwoFh0RESuJ1D37MOjKsClBcWFXgM+ooF26V00saFfY8lMDPvnfL0XZnQJmwKQho4j5MEPU/laLz4CMWx3sKiv9M22fyKeA1Rt9aRoxg0VSsPKjOEAbXd512B4DBDbibzxRr+7ikXJWwhj9X9/sUAjyCtb3xRD67UMQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kD6di2m90mDZ5Cxm3F5+8+3aMLZ1lEpdLQ1CU/N/2T4=; b=TDGXdjgdD6Eh4lC85K8ZkIfMVkzFcdd/UO7v+L+ZQ/D+mIbX0dm2g9NM+cIyyqwNScsE2EvHzXX8jbQeGMrobshJQ3zdZDZRJTs5S2/Y5+Uow3u3LPDFYqoqF0UrfmRLIesjQuJ7GeOEPPlGfSds5jfJXKgSlnpTmNw9tt54gDYqlxCLm/KaYxNbxW5lncg8U0Xolo75nPrNzQKVngZVOkQ7ZVO9SvqzESLMsYT/X5CdD/3HkxYtTrFjjaF89vtYNzc+l+O7qBNcm8Iz9jb7BPAYuVPNJqVwErV3UGgHb9cApVG8chisBmkttlGzOKZPHHT4iO/hWrK6DqQqcA/lbw== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB5505.namprd12.prod.outlook.com (2603:10b6:208:1ce::7) by DS0PR12MB7948.namprd12.prod.outlook.com (2603:10b6:8:152::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Tue, 1 Dec 2026 14:57:53 +0000 Received: from BL0PR12MB5505.namprd12.prod.outlook.com ([fe80::9329:96cf:507a:eb21]) by BL0PR12MB5505.namprd12.prod.outlook.com ([fe80::9329:96cf:507a:eb21%5]) with mapi id 15.21.0688.009; Tue, 1 Dec 2026 14:57:53 +0000 Message-ID: <763cea34-230c-4f29-aa21-214113dc2fae@nvidia.com> Date: Tue, 1 Dec 2026 16:57:48 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [net-next,v23,12/14] virtio_net: Add support for IPv6 ethtool steering To: netdev-bot+sashiko@kernel.org Cc: netdev@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, pabeni@redhat.com, virtualization@lists.linux.dev, parav@nvidia.com, yohadt@nvidia.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, jgg@ziepe.ca, kevin.tian@intel.com, kuba@kernel.org, andrew+netdev@lunn.ch, edumazet@google.com, danielj@nvidia.com References: <20260831161109.2999926-13-shshitrit@nvidia.com> <178835475012.3394541.15260297346389800429@kernel.org> Content-Language: en-US From: Shahar Shitrit In-Reply-To: <178835475012.3394541.15260297346389800429@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: TL2P290CA0018.ISRP290.PROD.OUTLOOK.COM (2603:1096:950:3::17) To BL0PR12MB5505.namprd12.prod.outlook.com (2603:10b6:208:1ce::7) X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL0PR12MB5505:EE_|DS0PR12MB7948:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ce2435d-c8a8-4289-6c39-08df4fbb7a08 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|366016|1800799024|376014|7416014|5023799004|11063799006|4143699003|18002099003|6133799003|261009223027099003|22082099003|56012099006|10067099003|261102123227099003|261028144727099003|261026130827099003|261026121527099003|261026140227099003|261026135527099003|261021135927099003|261022115727099003|261021130227099003|261021123027099003|261021121427099003|261021133027099003|261022113327099003|261022105027099003|261022075727099003; X-Microsoft-Antispam-Message-Info: yQ6U7AyJaY/+rNuSJzXFnb4EUeDxB9G2Rq2ioBYEuGWSwLeferPI/wBkao9II3RbXdjk32Ls2Ru97Mt7pCGe1aYwadpXbL2Msmn6IePbo3T43vApqUAmlxnyuSR0ZafG1RUEh0vwhFSAjA5TdLIfIporymDCAbGeuH+4OvXfKZZ0Q7inYbeJe5lDirbBMG2hlIigxujGotTd1n/XT5dy7vA4Z2Xoq5laSblQ6VB+1Zq+FrJQw4GeFn5AWjLLMWWeai/JJZDsvzBqElDH++KD+SJWEeEjXr20ZMbRoon+S2LVqDvcqPoaFhQRbzArYTIRpTcGV1LIMyAho6jBtIMrkF09ZDqNH6aOpYuRnOTBU61iRS0lu7Rue3Ksi1yhQ6R71zfBXjhRYY6f9oMaax9Sl8g4RLCFOLptbEsmjI9HmrPEGOS+Q/sjD8fL/fhB5KETcH8Wzdd6PREWhYa4EbABwzgtme8xRcGI6kMcD1XJJ9HDaEgVldykOP0lmHeEdmFpUvND3adfbtYEIeW1n0DodvqZvdX5b24yU6mhOgGNKbUVmatyuddlyigQNCtHRphSBjH3raPf7GT5/WZfxTImJZjESugODcJMxgcnocECFGi6NGplickuSwIV6R1TG5d76xJWLViHTPj+Fy51ofPMZXEYiVefA7XFHaWjRs4lx9E= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB5505.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(366016)(1800799024)(376014)(7416014)(5023799004)(11063799006)(4143699003)(18002099003)(6133799003)(261009223027099003)(22082099003)(56012099006)(10067099003)(261102123227099003)(261028144727099003)(261026130827099003)(261026121527099003)(261026140227099003)(261026135527099003)(261021135927099003)(261022115727099003)(261021130227099003)(261021123027099003)(261021121427099003)(261021133027099003)(261022113327099003)(261022105027099003)(261022075727099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?d2dYQnVSMDZEU0lUK0xUa2dsWkFUaHBuQ2xiYm1rK3c4N28vRVMxdmRPQ0JM?= =?utf-8?B?ajFQU3BBVnZBMk02YWlySzZrWHJMMkQ4VXNraC9mV0RaVEJxQ2srTElUNmh6?= =?utf-8?B?cHZNZnFJNWRxVUt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SRkRLck5HcmFKMjZ3UnBH?= =?utf-8?B?emhkWU0rbWsrMTcrRk1SSWIyQnBMSUJBTllaSm1vN253NTlUWDlHWkY1T0xo?= =?utf-8?B?ZHd4bFIyeWFCODlWenRYNloxQVVYYVdOYmNNcDNxSGJlMG1JbFZGZHFhTFZx?= =?utf-8?B?Y3RqVVpTMGFqbVpmN2FDYVBZNnV2dCtBbDJNc2Y4NG5IcDU5dUpzV1FuNjFH?= =?utf-8?B?MnRtNkI4dGFmMUpSRkJlQVJpS0lRNXdxWkxSb0I5a2o0NkozK01mRGpLQmpz?= =?utf-8?B?TFc3RjlsczlvRzE5QXorVGRVbXFaNVlaRnk4TTJqMEtuZ1hKd3k4c1plRGRl?= =?utf-8?B?aWROU05rcHkxRjZzL3I4VU0vd1U3K0RacE0vV1Z5RzVvMlNyODBFTm1oaXhj?= =?utf-8?B?K09TYS9lUFdsbG43Q3h3SnI2bG01QnpsbnZPUEkrZ1laa2V0ZDhxQT09?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0ce2435d-c8a8-4289-6c39-08df4fbb7a08 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5505.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 14:57:53.7190 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7iBp1MMzX0sEmu6EZhRn0L69049QhMrGVKrQ98oCv0K1CYszl4fcBewVjkdp4Sf9TNAdD6vcPF8nfuHPYTO4ZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7948 On 02/09/2026 16:12, netdev-bot+sashiko@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 2 potential > issue(s) to consider: > > Critical: 0 · High: 0 · Medium: 1 · Low: 1 > > - [Medium] The new IPv6 code overlays `struct ipv6hdr` (alignment 4, from > the embedded struct in6_addr / __be32 s6_addr32[]) on byte-packed… > - [Low] Commit message claims "Implement support for IPV6_USER_FLOW type > rules" but the implementation only supports src-ip/dst-ip matching:… > > -- > > virtio_net: Add support for IPv6 ethtool steering > > This adds IPV6_USER_FLOW support to the virtio_net ethtool flow filter > code: a new validate_ip6_mask() for the IPv6 selector mask, a new > parse_ip6() to build the key/mask pair, and IPv6 handling in > setup_ip_key_mask(), supported_flow_type() and calculate_flow_sizes(). > > Two questions below, one about alignment of the new IPv6 accesses and one > about the scope described in the changelog. > >> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c >> index c33bbdda75590..bfe8f0bc2581a 100644 >> --- a/drivers/net/virtio_net.c >> +++ b/drivers/net/virtio_net.c >> @@ -5843,6 +5843,40 @@ static bool validate_ip4_mask(const struct virtnet_ff *ff, >> return true; >> } >> >> +static bool validate_ip6_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 in6_addr tmp; >> + struct ipv6hdr *cap, *mask; >> + >> + cap = (struct ipv6hdr *)&sel_cap->mask; >> + mask = (struct ipv6hdr *)&sel->mask; >> + >> + /* mask->saddr/daddr may be unaligned; copy to aligned tmp for >> + * ipv6_addr_any(). >> + */ >> + memcpy(&tmp, &mask->saddr, sizeof(tmp)); >> + if (!ipv6_addr_any(&tmp) && >> + !check_mask_vs_cap(&mask->saddr, &cap->saddr, >> + sizeof(cap->saddr), partial_mask)) >> + return false; >> + >> + memcpy(&tmp, &mask->daddr, sizeof(tmp)); >> + if (!ipv6_addr_any(&tmp) && >> + !check_mask_vs_cap(&mask->daddr, &cap->daddr, >> + sizeof(cap->daddr), partial_mask)) >> + return false; >> + >> + if (mask->nexthdr && >> + !check_mask_vs_cap(&mask->nexthdr, &cap->nexthdr, >> + sizeof(cap->nexthdr), partial_mask)) >> + return false; >> + >> + return true; >> +} >> + > > [ ... ] > >> @@ -5884,11 +5921,33 @@ static void parse_ip4(struct iphdr *mask, struct iphdr *key, >> } >> } >> >> +static void parse_ip6(struct ipv6hdr *mask, struct ipv6hdr *key, >> + const struct ethtool_rx_flow_spec *fs) >> +{ >> + const struct ethtool_usrip6_spec *l3_mask = &fs->m_u.usr_ip6_spec; >> + const struct ethtool_usrip6_spec *l3_val = &fs->h_u.usr_ip6_spec; >> + >> + if (!ipv6_addr_any((struct in6_addr *)l3_mask->ip6src)) { >> + memcpy(&mask->saddr, l3_mask->ip6src, sizeof(mask->saddr)); >> + memcpy(&key->saddr, l3_val->ip6src, sizeof(key->saddr)); >> + } >> + >> + if (!ipv6_addr_any((struct in6_addr *)l3_mask->ip6dst)) { >> + memcpy(&mask->daddr, l3_mask->ip6dst, sizeof(mask->daddr)); >> + memcpy(&key->daddr, l3_val->ip6dst, sizeof(key->daddr)); >> + } >> +} > > [Severity: Medium] > Are the destinations of these copies guaranteed to be 4-byte aligned? > > struct in6_addr contains __be32 s6_addr32[4], so struct ipv6hdr has > 4-byte alignment, but the buffers these pointers overlay are byte packed > in the virtio flow filter layout: > > build_and_insert() -> setup_ip_key_mask(next_selector(selector), > key + sizeof(struct ethhdr), fs) > > For the classifier mask, the first selector is an 8-byte > struct virtio_net_ff_selector header plus a 14-byte struct ethhdr mask, > so the second selector starts at obj+30 and its mask[] at obj+38, which > makes &v6_m->saddr land at obj+46, i.e. 2 mod 4. The key buffer is the > same: it is offset by sizeof(struct ethhdr), so &v6_k->saddr is > base+22, again 2 mod 4. > > The IPv4 sibling in the same file goes through the unaligned helpers for > exactly these members: > > drivers/net/virtio_net.c:parse_ip4() { > if (l3_mask->ip4src) { > put_unaligned(l3_mask->ip4src, &mask->saddr); > put_unaligned(l3_val->ip4src, &key->saddr); > } > ... > } > > and validate_ip4_mask() uses get_unaligned(&mask->saddr) for the read > side. Since the pointer expressions here are typed struct in6_addr *, > can the compiler expand these 16-byte copies into word or multi-word > accesses (for example LDRD/STRD or LDM/STM on 32-bit ARM) on an address > that is 2 mod 4, and fault on strict-alignment architectures? > > The comment in validate_ip6_mask() already notes "mask->saddr/daddr may > be unaligned", but the aligned tmp only fixes the destination of that one > copy; the source (&mask->saddr) and the copies in parse_ip6() are still > misaligned accesses through a 4-byte-aligned pointer type. Would using > the unaligned accessors, or plain u8 pointers, for these fields keep the > IPv6 path consistent with the IPv4 one? Will fix so parse_ip6() uses put_unaligned() for the saddr/daddr stores, and validate_ip6_mask() reads them with get_unaligned() into an aligned temporary. > > [ ... ] > >> @@ -6114,20 +6179,38 @@ static int setup_ip_key_mask(struct virtio_net_ff_selector *selector, >> u8 *key, >> const struct ethtool_rx_flow_spec *fs) >> { >> + struct ipv6hdr *v6_m = (struct ipv6hdr *)&selector->mask; >> struct iphdr *v4_m = (struct iphdr *)&selector->mask; >> + struct ipv6hdr *v6_k = (struct ipv6hdr *)key; >> struct iphdr *v4_k = (struct iphdr *)key; >> >> - selector->type = VIRTIO_NET_FF_MASK_TYPE_IPV4; >> - selector->length = sizeof(struct iphdr); >> + if (has_ipv6(fs->flow_type)) { >> + selector->type = VIRTIO_NET_FF_MASK_TYPE_IPV6; >> + selector->length = sizeof(struct ipv6hdr); >> + >> + /* exclude tclass, it's not exposed directly in struct ipv6hdr */ >> + if (fs->h_u.usr_ip6_spec.l4_4_bytes || >> + fs->m_u.usr_ip6_spec.l4_4_bytes || >> + fs->h_u.usr_ip6_spec.tclass || >> + fs->m_u.usr_ip6_spec.tclass || >> + fs->h_u.usr_ip6_spec.l4_proto || >> + fs->m_u.usr_ip6_spec.l4_proto) >> + return -EINVAL; >> >> - if (fs->h_u.usr_ip4_spec.l4_4_bytes || >> - fs->h_u.usr_ip4_spec.ip_ver != ETH_RX_NFC_IP4 || >> - fs->m_u.usr_ip4_spec.l4_4_bytes || >> - fs->m_u.usr_ip4_spec.ip_ver || >> - fs->m_u.usr_ip4_spec.proto) >> - return -EINVAL; >> + parse_ip6(v6_m, v6_k, fs); > > [Severity: Low] > This isn't a bug, but should the changelog say which ip6 match fields are > actually implemented? > > The commit message says: > > Implement support for IPV6_USER_FLOW type rules. > > but setup_ip_key_mask() rejects any non-zero tclass, l4_proto or > l4_4_bytes, in the value as well as in the mask, and parse_ip6() only > ever fills in saddr/daddr. So of the struct ethtool_usrip6_spec fields > only the addresses work, while supported_flow_type() advertises > IPV6_USER_FLOW as a whole: > > case IPV6_USER_FLOW: > return true; > > A request such as: > > ethtool -U ens9 flow-type ip6 src-ip fe80::2 tclass 8 action 3 > > fails with "Invalid argument" and there is nothing in the log describing > the limitation. > > There is also an asymmetry with the IPv4 support added in the previous > patch: parse_ip4() does translate the IPv4 tos field: > > if (l3_mask->tos) { > mask->tos = l3_mask->tos; > key->tos = l3_val->tos; > } > > while the IPv6 path refuses the equivalent tclass, even though > struct ipv6hdr carries the traffic class in the priority/flow_lbl bits. > Could the changelog mention that only src-ip/dst-ip matching is > supported for ip6 flows, and why tclass parity with the IPv4 path is not > provided? > >> + } else { >> + selector->type = VIRTIO_NET_FF_MASK_TYPE_IPV4; >> + selector->length = sizeof(struct iphdr); > > [ ... ] >