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.200.17 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796137043; b=ll9OztHSRYAY4pXmIO2Pw2r/J2fcGzn86lZob7hs8j2FwDZz6D/tFkrPri82nb2rWlF9 yRFmg+lCINs2weL6HajZir+P61abTpjufsW/RI2Yun7cXdiUJJVx9NGVd1bHg5LTxjhch ALI2iuTa6c0TdCKOeJIahvtRqIJpEHIKtAR1XnLiRuEggVJd0BU1wFK8qgvw5GAfPnJh9 LOB0H0evChzjDd59XR5Gefi+Y8HviRZS0eDREipwxu9eh2m6No2j1j+ZG8YsuXxq1DyPF yTJQImu022RM/RQrFu0V+EwqHC9KZp92gVpwXBDCn1O3AC3afjnG4JmUpB92kjVlR/g== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796137043; 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=TS+G0NP7DJwe0V/HJJN/0aiSiQYB0rEIlYzll9eeSHo=; b=uhCpiQp6u/9TXtKK6Yrj3xcWzWnHYnBoInIpOexLOME8oeSJtRzqy/qDNFyEGXhzzrsd eOjsqDgm131Ah5b2i71GkzVPst3zS/HcTu2PhYVPS9F6AS0UzRJWj9VbflWjBk53AasuD QIX1o4aMWPOgeV8pq8BfxjhNsCBAg4ocvwKfzR6afBtZn6d74P+vx7SOj97nKf+7JWz7r qNQX1K8gwM2gOaVY6f2iTuY8k+QZKNqYiobVxKIuhqHcYSQob8De4LjR7XGHs4SvR4IAP 80LCb5sQRLl6xlAq639G2sE2plpcVa3DKFIeNpCqSjYBSAigDM3iTmtOVw8nQ48IhRQ== 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=IoCqPoiw; arc=pass header.oldest-pass=0 smtp.remote-ip=40.107.200.17 Received: from CH5PR02CU005.outbound.protection.outlook.com (mail-northcentralusazon11012017.outbound.protection.outlook.com [40.107.200.17]) (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 8A40A606A31A for ; Tue, 1 Dec 2026 14:57:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8A40A606A31A 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=IoCqPoiw ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KtYoRBhETrlfmpM6lOAAkST6Rg33cWMNt82/0zCEKEax6eHBV5uyIuOOuLna145E3gmTEx2t7OEZ+Ll21Q9IwBEBAFV+o2SNrGybGHqei1EpcpAa/ZDPq/Nfetbvez+fI15IoJ0fvn7lsOVD+NnWQFCnIqugjn38qfdMcPwHT3UuHpb7Q59w2korbQ39I9BurKcNvdPvvZv7Yz/eCr0BQHDA62wgXzfj86FXheodNYjDaehFMSIRwFUrnBheld7kx2EQ/f74OffdJSx13TiQzkQaQK9sTfFFDjkX4GnDLQTg949mkBvo6QaZAscI+OLxukZ8UxHcVupoHOY/5hj00Q== 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=TS+G0NP7DJwe0V/HJJN/0aiSiQYB0rEIlYzll9eeSHo=; b=LIXLFregAX9zA2cCoez2DTTDJ7MswgAU/PvHNcyemPKev6lOmXah9ch1xq7w/NyfCMjU35LCgw0+q2DAcpuqwMVDeAX6PvLd6QO7dkaAEl6yE5BHfQq7UHxp3sgJgXEZ8DNeQsQ0nguRufpk/ruzzh3zfTyAnl8L9PMAFCDboukHryOxT26godwsnE74dRJeY074oLHcNaesi44GK6rhPBW5l6RbjjPcJ6I1nCFDo5tct8jQXpexoRIiXTq1Amz16UFGU3z7tTdO5kjLEfnSNA35F5DE9Y32jobk33lF9RVa6OJKJFsPUZV63G13zk6Y4t4T5J+w99wJdVU4e3BYIA== 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=TS+G0NP7DJwe0V/HJJN/0aiSiQYB0rEIlYzll9eeSHo=; b=IoCqPoiwzplq5M2opZQ7Nc7FRQeuVIK3FXML/MU/+UaBQEUrmLoBvDZ3RhmmR7KZLW2TA5YVpT/HG8rEGWVkj50JWa1Z0htTIQ0t7m5PWJbJ/32iBztd5zsRrTFo2sfRsjB+v++2YhuMNtR8JL4l5u845lw0KCs6Vg14ZWjgPzzd94V/0OPHS+nF3QaaUCCc/yRbeCwjZSd5a2tzgEICPDsvKmE6Iyd7zZks5a+dUHLjTKd7CA7eMCP77EVq0Z3VyG8P046NyhhXfX4B3Jr94sSQVxqDwRAWOXDN+iuE6zHLX32/G4waMvr7YKPbXQuPTaGU6DzJU/GEhQR2WIpF1w== 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:09 +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:09 +0000 Message-ID: Date: Tue, 1 Dec 2026 16:57:04 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [net-next,v23,11/14] virtio_net: Implement IPv4 ethtool flow rules 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-12-shshitrit@nvidia.com> <178835474877.3394541.3251614086995049997@kernel.org> Content-Language: en-US From: Shahar Shitrit In-Reply-To: <178835474877.3394541.3251614086995049997@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: netdev@vger.kernel.org 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: 3f597de1-1e03-4bd4-080e-08df4fbb5f5e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|366016|1800799024|376014|7416014|11063799006|4143699003|18002099003|6133799003|261009223027099003|3023799007|22082099003|56012099006|10067099003|261102123227099003|261028144727099003|261026121527099003|261026140227099003|261021121427099003|261022105027099003; X-Microsoft-Antispam-Message-Info: BvxKUCkGWL8VRlnWVWcIEl68pOiqCUUN4ACAvfyoaYE1M/RDisYR74Agm9lqGbtZZ8iPiApks2XVE0w7dwr6WPqXp0Tjtpbi3hpq34C4XVmtslfmGFTs2kQ9ciPOOzlJj40SMzra7WyiKmvWDu6cs8BCC8eYm+pZlIyG9lcWX6TzOS0afBQoyCWWjL2UxE4yhYL4wYhOZgJZdBv50v1TkBrWmMN3xA9OISAAGdf26BmUerR83V3dtQCvBYB0vXVrsDGBuD5iH6qI9lHLn8M2IZ0HvP6Vn7PUNnPRRIJu5+Dw0nwhHte/yoU+X3KVtFPu1yT21t3OW2ioUgD7a50CY58Cj1Uya5mFvsKB+lPHwew3s6alJ3fE32f5VdXYz73+FKlTI/lczyrE4CrrHDZ9xypgQ0iLkdw4IP+TzhvCP2yv5kiFLwwAkglHMfPBn1kJUcdCwOmjtWRa1XAUGqqpRNRCcusuEOwKnJysFkQ+prFEmu8c0AokW6gTxSkLs6vhAJfNSlzGlxNTWo3zfOmgNkd0gSn2SK674Yt4tNWA7KyIF9khhnQjx5pkLJk2weN/0a3rvvFbsBe2qiwD25HtXIwX/1QymjJl0TT+PfIimMWfOtvKjigLTcuwpzJIBmKlsuQnBB3g2Vb+YLh3Pu6PXThz4vstUsmisMStexm6hAg= 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)(11063799006)(4143699003)(18002099003)(6133799003)(261009223027099003)(3023799007)(22082099003)(56012099006)(10067099003)(261102123227099003)(261028144727099003)(261026121527099003)(261026140227099003)(261021121427099003)(261022105027099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NE1ieVFRalhkVXRRZVoydlA2VEdCOXFsMEtoUHlEMVFvWHprNjZ5OHZjU0cw?= =?utf-8?B?aml4M24xdTk4STFyaXlYVE5TajRWTU1yN3JOM2FMZjJNVFhtT1IxZzkwU0ky?= =?utf-8?B?RmVPaEcxQVorMi9vMWF5eGVqNjhKQ25ZdDNlR2Zhc1E1TlQyaU5GRnVZSHpq?= =?utf-8?B?QVlTVVNWZ0V2U3lDNE1QbEFsTnhycXdkeUYvNzBQZXNFUFQ1L3RtWlJZWGVn?= =?utf-8?B?dmxjMmFxSzJHaEdQS1dDbWtTMEkrdVIwNTVDMmxvN1pXemZGTjhKNjdYK2po?= =?utf-8?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ONHZ5UTVWMi9JeTBvRU9WUC84?= =?utf-8?B?bjNXMElNVHNxNnVmUWM0UVFFcEFKWm1HRWJWcGxVemd5S1hIeWg2aTN2QnNO?= =?utf-8?B?RU9JRDhFOUFJdWFkT1hJWDllRnlsVy9vaHdzb1FvS29TcnYyVDladHd5aExv?= =?utf-8?B?SzhCeHBkNU1sSHF0RHlobC9WTmJrODVxOWdRdVk2Ym1GaVU2YXVCREp4TXFV?= =?utf-8?B?bjl1RXhaNTkzdEc4bU9PYW9NaE0xOUVPTDFqOG9jMks4b3ZMZ2gzQT09?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f597de1-1e03-4bd4-080e-08df4fbb5f5e 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:08.9028 (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: lND1UKjRcMdObifILpHp4fpuA1wrozgN4JgNpUYAfBXvBSwEQPnBBmUDc39CoerbXDlRE9gJD+FQwpqzsQ/t3Q== 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] IP_USER_FLOW support silently ignores the ethtool `proto` > match field. > - [Low] While adding the `int num_hdrs` parameter, the patch also de- > indents the two pre-existing continuation lines of… > > -- > > virtio_net: Implement IPv4 ethtool flow rules > > This adds support for ethtool IP_USER_FLOW rules to the virtio_net flow > filter code, building an extra IPv4 selector after the ethernet selector > and matching on source/destination address and tos. The ethernet selector > is forced to match ethertype IPv4 whenever an IPv4 header follows. > > (No Link: tags in the commit header.) > >> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c >> index 6c07eab047afe..c33bbdda75590 100644 >> --- a/drivers/net/virtio_net.c >> +++ b/drivers/net/virtio_net.c > > [ ... ] > >> @@ -5809,6 +5810,39 @@ static bool validate_eth_mask(const struct virtnet_ff *ff, >> return true; >> } >> >> +static bool validate_ip4_mask(const struct virtnet_ff *ff, >> + const struct virtio_net_ff_selector *sel, >> + const struct virtio_net_ff_selector *sel_cap) >> +{ > > [ ... ] > >> + if (mask->protocol && >> + !check_mask_vs_cap(&mask->protocol, &cap->protocol, >> + sizeof(u8), partial_mask)) >> + return false; >> + > > [ ... ] > >> @@ -5820,11 +5854,41 @@ static bool validate_mask(const struct virtnet_ff *ff, > > [ ... ] > >> +static void parse_ip4(struct iphdr *mask, struct iphdr *key, >> + const struct ethtool_rx_flow_spec *fs) >> +{ >> + const struct ethtool_usrip4_spec *l3_mask = &fs->m_u.usr_ip4_spec; >> + const struct ethtool_usrip4_spec *l3_val = &fs->h_u.usr_ip4_spec; >> + >> + if (l3_mask->ip4src) { >> + put_unaligned(l3_mask->ip4src, &mask->saddr); >> + put_unaligned(l3_val->ip4src, &key->saddr); >> + } >> + >> + if (l3_mask->ip4dst) { >> + put_unaligned(l3_mask->ip4dst, &mask->daddr); >> + put_unaligned(l3_val->ip4dst, &key->daddr); >> + } >> + >> + if (l3_mask->tos) { >> + mask->tos = l3_mask->tos; >> + key->tos = l3_val->tos; >> + } >> +} > > [ ... ] > >> @@ -6016,8 +6091,9 @@ static void calculate_flow_sizes(struct ethtool_rx_flow_spec *fs, >> } >> >> static void setup_eth_hdr_key_mask(struct virtio_net_ff_selector *selector, >> - u8 *key, >> - const struct ethtool_rx_flow_spec *fs) >> + u8 *key, >> + const struct ethtool_rx_flow_spec *fs, >> + int num_hdrs) > > [Severity: Low] > This isn't a bug, but the two pre-existing continuation lines lost one > space of indentation here while the new num_hdrs parameter was added. > "static void setup_eth_hdr_key_mask(" puts the open parenthesis one column > further right, so the continuation lines no longer line up with it and > checkpatch reports "Alignment should match open parenthesis". Was the > re-indent intentional? Only the "int num_hdrs" line seems to need > touching. The same alignment persists through the end of the series. > >> { >> struct ethhdr *eth_m = (struct ethhdr *)&selector->mask; >> struct ethhdr *eth_k = (struct ethhdr *)key; >> @@ -6025,8 +6101,35 @@ static void setup_eth_hdr_key_mask(struct virtio_net_ff_selector *selector, > > [ ... ] > >> +static int setup_ip_key_mask(struct virtio_net_ff_selector *selector, >> + u8 *key, >> + const struct ethtool_rx_flow_spec *fs) >> +{ >> + struct iphdr *v4_m = (struct iphdr *)&selector->mask; >> + struct iphdr *v4_k = (struct iphdr *)key; >> + >> + selector->type = VIRTIO_NET_FF_MASK_TYPE_IPV4; >> + selector->length = sizeof(struct iphdr); >> + >> + 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_ip4(v4_m, v4_k, fs); >> + >> + return 0; >> } > > [Severity: Medium] > What happens to h_u.usr_ip4_spec.proto here? Every other unsupported > IPv4 field is rejected, but a non-zero h_u.usr_ip4_spec.proto is neither > rejected nor programmed. > > include/uapi/linux/ethtool.h documents the field for struct > ethtool_usrip4_spec as: > > * @proto: Transport protocol number; mask must be 0 > > So a conforming userspace passes the protocol in h_u with a zero mask in > m_u, which is exactly the combination that passes all five checks above. > parse_ip4() then only copies ip4src, ip4dst and tos, leaving > key->protocol and mask->protocol zero in the zeroed key/classifier > buffers. > > Does this mean > > ethtool -U ethX flow-type ip4 src-ip 192.168.51.101 l4proto 6 action -1 > > installs a rule that matches ethertype IPv4 plus src-ip only, and > therefore drops every protocol from that address rather than just TCP, > without returning an error? Would it be better to either program > iphdr->protocol from h_u.usr_ip4_spec.proto, or return -EINVAL when it is > non-zero? > > There also seems to be a disagreement between the two new functions: the > protocol check in validate_ip4_mask() > > if (mask->protocol && > !check_mask_vs_cap(&mask->protocol, &cap->protocol, > sizeof(u8), partial_mask)) > return false; > > looks unreachable for IP_USER_FLOW, since a non-zero > m_u.usr_ip4_spec.proto always returns -EINVAL in setup_ip_key_mask() > first and parse_ip4() never sets mask->protocol. Is that intended? > > Checking the rest of the series, at 04f0a1ab the behaviour looks > unchanged: setup_ip_key_mask() still returns -EINVAL for > m_u.usr_ip4_spec.proto with num_hdrs == 2, parse_ip4() still never writes > iphdr->protocol, and the protocol key is only filled in for > TCP_V4_FLOW/UDP_V4_FLOW. Will fix by rejecting a non-zero h_u.usr_ip4_spec.proto for ip4 rules with -EINVAL, since the protocol was silently ignored and the rule matched all protocols; use tcp4/udp4 for protocol matching. > > [ ... ] >