From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8214454F8C for ; Thu, 20 Mar 2025 08:09:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742458152; cv=none; b=TV5dUerWpRJ22ES6I+OlPjUHDzHehpN0ORVdRZcjnyix8q7mo+Lpjm4l8l4Wk7ldNUlgyn8Ion/31AZVSddB8H2VFfS+tnoWLv6IANJvC6peJapRa7WAiwRNKN4eruax5kZKyJ9f9zUV9J6mr9nN0+P/nSvyP0utgSl/QnYlnU8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742458152; c=relaxed/simple; bh=Wl43tPGGo/TmtyqpgNsWD1tQZ77nvfJfiY3ivCAg4Ro=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CcuQ8VUtD3NCYpmIFKIrt201D2CMDhpNzVq9NzvUPSyfCNXviWsYmZIXy5ssXke5R+yU3VKeTRU+LcGZf/eDJmsKe/xgOSeby3WfYP32mQvgxn3w8Uxcz8fZxjTlKDGoMPJR0Jb4kp+7VG6T16VshphR8/lz7qzULYCiBngdBps= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FSe+Jhtp; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FSe+Jhtp" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-43d04dc73b7so4987435e9.3 for ; Thu, 20 Mar 2025 01:09:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742458149; x=1743062949; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=4Wo3wR+2tAhBZ06jeRPoNeDwmXIT3ZDY0lemlEv4m2Y=; b=FSe+Jhtpxxo31V0sgPy+bXJfRLpLtm0gF3qpUefgiDqovxEfItGNZDzmPoFWk17uEa GoXcscxqtRgl1Bcx2T+2csuK6ofqI3BTRurXalQpFEX85QJoObNHdxRquWDYpB4bJZTv NExJ+V/LqoY/qA3mG3ywZu9sPvRZEtI9dKGrHw8daZsQ3RVlNhDUcgVbKjDPNpnQ4npZ oAVOBxiro5ez2sJjKOwXQjmkN4MV2Qc2HX3Yfm54O2CZWSEnAGJFfE3PU1ubDUcLDf2P gyRJM/gzARyk3+b2iM/t7N72PAGD4V87haJ66rlEqnqcpJVsX16Rw2q3pIquKT6UD1xc SKzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742458149; x=1743062949; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4Wo3wR+2tAhBZ06jeRPoNeDwmXIT3ZDY0lemlEv4m2Y=; b=BtPjp/JUT5L8zOb916ufOokq2SfW0j+JDYAYlw5ZJzyF5F7u5wkTLTEI1A6z/6fubO nbhDpkyJzKuE3h6CjKtRMiEbfdx0MJVSUth6RrbV+m9pP36Sj4WhPB3wUcshn74tZg/h t/ziQeg8NvruuY1vRvNPV3tqIdLydFgdtzzs5gLE0R6RKyJgO0izfJrcDlEFBWCYY/fZ VnNlvJwux70b6steSNMhx1tSuMNqidgr8VpxS0VextinQCVmIch+ssXMimyXyaTNY0gx MoxPkqfA5SPxGJnehMhBi4nKVYLF1Ig5a8ImooTPHo+2b/BGxzZtwq0POJ0v5Ewxqu/V 2X0w== X-Forwarded-Encrypted: i=1; AJvYcCWQ33oJ6ttWJ4age5bP0jDbaQyw4ZFO3FTHS8LS44CtKfav/zY9X29/BuDCTnC3KlhjlALs/Mc=@vger.kernel.org X-Gm-Message-State: AOJu0Yx1AeukhvF0Rk9OVtUH7jK3Nnc3VaSDciRF10TDfGi4bu8cN7Wz mGs8stPRioAz+08pCItvin2rV5TIKp4pcrqulQj2hmX5gGsN1/TG X-Gm-Gg: ASbGnct9MegVwWDM3JT884yz9lZcFCwSkIY2ZSPSAB4vtGbMkaeS5OAwBKOIlYcxEWz 2SE1m/w/HLUUbO7EYM685wwgig8+m6tMZU5BnAcn1Mh92Zg2PkXnFKEV9S7E6fDZCco9o0ipJuI zBZT3Jkg6iR5xhX+rgRpm2OhmvSGkRM5obdQjiXxDtieM4CPEiRfYMbMIrgeMcL/pghXp6YWVa6 s6r6KCMWEiTiI87akEomCwrSRKJzxPsYkuiepACM4QPkwGG5M+C2q2Iirm9HNDZh92OwJiQUAIW IvJ197qicqzwls1JCJAzAZicf9fM/ycGHYVQLXfEQ/0dbz+bX9Je7P2PnYp+tnkTQi+4ZvP6weG p X-Google-Smtp-Source: AGHT+IFzJg2JutUFSNOwd0SCvip/8gDRjpxRptNb/WyB/8CO8EtuZOiTgLwWcHzzYsS5HVg/NbD3EA== X-Received: by 2002:a05:600c:4e49:b0:43c:ebc4:36a5 with SMTP id 5b1f17b1804b1-43d4953b186mr18873955e9.7.1742458148118; Thu, 20 Mar 2025 01:09:08 -0700 (PDT) Received: from [172.27.33.126] ([193.47.165.251]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43d43f74c2asm41011965e9.31.2025.03.20.01.09.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Mar 2025 01:09:07 -0700 (PDT) Message-ID: <978c7574-b4d2-4b36-968c-d8d46c588964@gmail.com> Date: Thu, 20 Mar 2025 10:09:04 +0200 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net] net/mlx5e: Fix ethtool -N flow-type ip4 to RSS context To: Maxim Mikityanskiy Cc: Saeed Mahameed , Leon Romanovsky , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan References: <20250319124508.3979818-1-maxim@isovalent.com> <0fa82602-3b4c-46a7-bdfc-e8a9535e74c1@gmail.com> Content-Language: en-US From: Tariq Toukan In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 20/03/2025 9:43, Maxim Mikityanskiy wrote: > On Thu, 20 Mar 2025 at 09:32, Tariq Toukan wrote: >> >> >> >> On 19/03/2025 14:45, Maxim Mikityanskiy wrote: >>> There commands can be used to add an RSS context and steer some traffic >>> into it: >>> >>> # ethtool -X eth0 context new >>> New RSS context is 1 >>> # ethtool -N eth0 flow-type ip4 dst-ip 1.1.1.1 context 1 >>> Added rule with ID 1023 >>> >>> However, the second command fails with EINVAL on mlx5e: >>> >>> # ethtool -N eth0 flow-type ip4 dst-ip 1.1.1.1 context 1 >>> rmgr: Cannot insert RX class rule: Invalid argument >>> Cannot insert classification rule >>> >>> It happens when flow_get_tirn calls flow_type_to_traffic_type with >>> flow_type = IP_USER_FLOW or IPV6_USER_FLOW. That function only handles >>> IPV4_FLOW and IPV6_FLOW cases, but unlike all other cases which are >>> common for hash and spec, IPv4 and IPv6 defines different contants for >>> hash and for spec: >>> >>> #define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */ >>> #define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */ >>> ... >>> #define IPV4_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */ >>> #define IP_USER_FLOW IPV4_USER_FLOW >>> #define IPV6_USER_FLOW 0x0e /* spec only (usr_ip6_spec; nfc only) */ >>> #define IPV4_FLOW 0x10 /* hash only */ >>> #define IPV6_FLOW 0x11 /* hash only */ >>> >>> Extend the switch in flow_type_to_traffic_type to support both, which >>> fixes the failing ethtool -N command with flow-type ip4 or ip6. >>> >> >> Hi Maxim, >> Thanks for your patch! >> >>> Fixes: 248d3b4c9a39 ("net/mlx5e: Support flow classification into RSS contexts") >> >> Seems that the issue originates in commit 756c41603a18 ("net/mlx5e: >> ethtool, Support user configuration for RX hash fields"), > > Not really; commit 756c41603a18 configures the hash (not flow > direction), and IPV4_FLOW/IPV6_FLOW are already correct constants for > IP-based hashes. Moreover, we don't support them anyway, see > mlx5e_set_rss_hash_opt: > > /* RSS does not support anything other than hashing to queues > * on src IP, dest IP, TCP/UDP src port and TCP/UDP dest > * port. > */ > if (flow_type != TCP_V4_FLOW && > flow_type != TCP_V6_FLOW && > flow_type != UDP_V4_FLOW && > flow_type != UDP_V6_FLOW) > return -EOPNOTSUPP; > >> when directly >> classifying into an RQ, before the multi RSS context support. > > Direct classification into an RQ actually works before my fix, because > it goes to another branch in flow_get_tirn, that doesn't call > flow_type_to_traffic_type. It's only steering to an RSS context that > was broken for flow-type ip4/ip6. > Thanks for your patch. LGTM. Reviewed-by: Tariq Toukan Regards, Tariq >>> Signed-off-by: Maxim Mikityanskiy >>> --- >>> drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c | 2 ++ >>> 1 file changed, 2 insertions(+) >>> >>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c >>> index 773624bb2c5d..d68230a7b9f4 100644 >>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c >>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c >>> @@ -884,8 +884,10 @@ static int flow_type_to_traffic_type(u32 flow_type) >>> case ESP_V6_FLOW: >>> return MLX5_TT_IPV6_IPSEC_ESP; >>> case IPV4_FLOW: >>> + case IP_USER_FLOW: >>> return MLX5_TT_IPV4; >>> case IPV6_FLOW: >>> + case IPV6_USER_FLOW: >>> return MLX5_TT_IPV6; >>> default: >>> return -EINVAL; >>