Message ID | 20230723150658.241597-1-jdamato@fastly.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp1328678vqg; Sun, 23 Jul 2023 09:09:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlGWGL3iMTmn0c9oLTXsUlW18xIlHSwrpZU1oHD+ioNNVVxD8Bctdv7NjqKwqK8BGL9aq76v X-Received: by 2002:a05:6a00:1405:b0:668:8596:7524 with SMTP id l5-20020a056a00140500b0066885967524mr6458430pfu.20.1690128572342; Sun, 23 Jul 2023 09:09:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690128572; cv=none; d=google.com; s=arc-20160816; b=I80jANkD3eSswYszBtDQYzIHmWIR5Hw6Ld++7i/8uagUJ025+oX2ORhT00SABKJQeW l/nySBkU3yM3ZbszCIYo2zmornBtgfv9EMZOqaOPI27wyhge6A65eTsOw7/BCiY5ZMBc 8fBL09fNiDI1bfhrxBr5CqdWb4ElxMnVt0HLSIyRL/i0X7z3icKKkiMVPqyVeksj4zqL HUe9zk/SRjY4KkJDS5kiD2cQNSh+DH+pXpFR2l0hltmbvlfZyB8i9UGR60RqJJiw9DWh 8FUZHT6V14hC9rHGG1Memzqevc4SxeN6fsHUj3SD8e6gYaiM3MWWdGDG+IIi/xMnv0Yb KfSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=3NErtpmKZLDudWNuVZ/0OM4T/FxzlnDuRfRYmitD82g=; fh=xKmG77m/NWoFpY5P5LAWC3QmMvCsac2XN+OoFpV6C28=; b=ttcK+GDyS80aM8Xkrr8sSA6NrcK9dWlgi0CWxWXIU6E+fpNeyL1l/kAFZmDu3S0GeI gpIR4wZdYbsrHr75jmw6oStKVw5dbhW8UIAF7gPUoxP0EvC5CZ2SqwfWbwXzZu+jyT6n QuaZyjB1hZUhYgQ9xTHKw9Q5F2BcZue5R618nLluF2XdcZb21G7RRVxhbSYjH10dPUU5 w+iwzLIfEE1YTPKRhS2eiczS1k+GiXEvzwjNvfwrHL0NjWbPEbgdwiGA43GMQruyKqJ7 Oq5e11jG5jRKP/0XpRr0nNCy1+CWiuHojYoPdXEguEko0+xZhToNJgyK/NhTm9zSSP8X P3cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=dwgbO6GK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r32-20020a632060000000b00543cca81bb9si7178769pgm.329.2023.07.23.09.09.19; Sun, 23 Jul 2023 09:09:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=dwgbO6GK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229763AbjGWPHa (ORCPT <rfc822;kautuk.consul.80@gmail.com> + 99 others); Sun, 23 Jul 2023 11:07:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbjGWPH3 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 23 Jul 2023 11:07:29 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70484D1 for <linux-kernel@vger.kernel.org>; Sun, 23 Jul 2023 08:07:27 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-991c786369cso555623466b.1 for <linux-kernel@vger.kernel.org>; Sun, 23 Jul 2023 08:07:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1690124846; x=1690729646; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3NErtpmKZLDudWNuVZ/0OM4T/FxzlnDuRfRYmitD82g=; b=dwgbO6GKaHAqW+LFtaslcJ4q3w+T5gxHonbMLkXZ98QEsonyJ+G99ojQFbOVzzzgB3 2oH2Jg1gDQdoRjxW/yI33vo/b4O/EycXHp46cyf4XdHD24J/77TMkDYPYkMouQcGm/oL 0KXUMKH4LgcdH+23eBfhhQUbXJdj53/CBiwj4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690124846; x=1690729646; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3NErtpmKZLDudWNuVZ/0OM4T/FxzlnDuRfRYmitD82g=; b=QFeirdwjpMWnPXijHl5TEwpgyj3cND+zNZ3xQM7IexWRF6BmKd6oX/IvPfJdi4VDG4 A8+hZrJa469WtR+ReJCbc7PcM5iJLmFfIUUVlzL13odM1aKZ1GDdEdII0KpWgkvhos51 Bn2O72x+xQN04Eb9Hr0AgDNwGpxapAPHC0ZuX2KR5211W07E0DnVeq6fTLTQyMMHeK4+ bmK2DenkW+vHsgvUivZKq1vEhDVYQdA54JnR6/SKW4DmQSL2x/mWjeJiJHVQC41tttNX +4vBE+3qpwVb9iSNrYSsHOEF7YK1s2rt+oWN9b3r60xDpGDp27nmjCZ6JaVxU086NqDl DPog== X-Gm-Message-State: ABy/qLav312z8x8dqpF5ygaoyFXI8ZQ0z4m4QMO+vvp8NKQQ27cfkjEN BVYsGZRcYI9iDN9HFBSQBdelyw== X-Received: by 2002:a17:906:9bf6:b0:988:6e75:6b3d with SMTP id de54-20020a1709069bf600b009886e756b3dmr7208827ejc.33.1690124845756; Sun, 23 Jul 2023 08:07:25 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id t10-20020a1709064f0a00b009929d998abcsm5227691eju.209.2023.07.23.08.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jul 2023 08:07:25 -0700 (PDT) From: Joe Damato <jdamato@fastly.com> To: netdev@vger.kernel.org, saeedm@nvidia.com, tariqt@nvidia.com, ecree@solarflare.com, andrew@lunn.ch, kuba@kernel.org, davem@davemloft.net, leon@kernel.org, pabeni@redhat.com, bhutchings@solarflare.com, arnd@arndb.de Cc: linux-kernel@vger.kernel.org, Joe Damato <jdamato@fastly.com> Subject: [net 0/2] rxfh with custom RSS fixes Date: Sun, 23 Jul 2023 15:06:56 +0000 Message-Id: <20230723150658.241597-1-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772228257800106763 X-GMAIL-MSGID: 1772228257800106763 |
Series |
rxfh with custom RSS fixes
|
|
Message
Joe Damato
July 23, 2023, 3:06 p.m. UTC
Greetings: While attempting to get the RX flow hash key for a custom RSS context on my mlx5 NIC, I got an error: $ sudo ethtool -u eth1 rx-flow-hash tcp4 context 1 Cannot get RX network flow hashing options: Invalid argument I dug into this a bit and noticed two things: 1. ETHTOOL_GRXFH supports custom RSS contexts, but ETHTOOL_SRXFH does not. I moved the copy logic out of ETHTOOL_GRXFH and into a helper so that both ETHTOOL_{G,S}RXFH now call it, which fixes ETHTOOL_SRXFH. This is patch 1/2. 2. mlx5 defaulted to RSS context 0 for both ETHTOOL_{G,S}RXFH paths. I have modified the driver to support custom contexts for both paths. It is now possible to get and set the flow hash key for custom RSS contexts with mlx5. This is patch 2/2. See commit messages for more details. The patches include the relevant fixes tags, as I think both commits are fixing previous code, but if this change is preferred for net-next I can resend. Thanks. Joe Damato (2): net: ethtool: Unify ETHTOOL_{G,S}RXFH rxnfc copy net/mlx5: Fix flowhash key set/get for custom RSS .../ethernet/mellanox/mlx5/core/en/rx_res.c | 23 +++++- .../ethernet/mellanox/mlx5/core/en/rx_res.h | 5 +- .../mellanox/mlx5/core/en_fs_ethtool.c | 33 +++++--- net/ethtool/ioctl.c | 75 ++++++++++--------- 4 files changed, 84 insertions(+), 52 deletions(-)
Comments
On 23/07/2023 16:06, Joe Damato wrote: > Greetings: > > While attempting to get the RX flow hash key for a custom RSS context on > my mlx5 NIC, I got an error: > > $ sudo ethtool -u eth1 rx-flow-hash tcp4 context 1 > Cannot get RX network flow hashing options: Invalid argument > > I dug into this a bit and noticed two things: > > 1. ETHTOOL_GRXFH supports custom RSS contexts, but ETHTOOL_SRXFH does > not. I moved the copy logic out of ETHTOOL_GRXFH and into a helper so > that both ETHTOOL_{G,S}RXFH now call it, which fixes ETHTOOL_SRXFH. This > is patch 1/2. As I see it, this is a new feature, not a fix, so belongs on net-next. (No existing driver accepts FLOW_RSS in ETHTOOL_SRXFH's cmd->flow_type, which is just as well as if they did this would be a uABI break.) Going forward, ETHTOOL_SRXFH will hopefully be integrated into the new RSS context kAPI I'm working on[1], so that we can have a new netlink uAPI for RSS configuration that's all in one place instead of the piecemeal-grown ethtool API with its backwards-compatible hacks. But that will take a while, so I think this should go in even though it's technically an extension to legacy ethtool; it was part of the documented uAPI and userland implements it, it just never got implemented on the kernel side (because the initial driver with context support, sfc, didn't support SRXFH). > 2. mlx5 defaulted to RSS context 0 for both ETHTOOL_{G,S}RXFH paths. I > have modified the driver to support custom contexts for both paths. It > is now possible to get and set the flow hash key for custom RSS contexts > with mlx5. This is patch 2/2. My feeling would be that this isn't a Fix either, but not my place to say. -ed [1]: https://lore.kernel.org/netdev/ecaae93a-d41d-4c3d-8e52-2800baa7080d@lunn.ch/T/
On Mon, Jul 24, 2023 at 08:27:43PM +0100, Edward Cree wrote: > On 23/07/2023 16:06, Joe Damato wrote: > > Greetings: > > > > While attempting to get the RX flow hash key for a custom RSS context on > > my mlx5 NIC, I got an error: > > > > $ sudo ethtool -u eth1 rx-flow-hash tcp4 context 1 > > Cannot get RX network flow hashing options: Invalid argument > > > > I dug into this a bit and noticed two things: > > > > 1. ETHTOOL_GRXFH supports custom RSS contexts, but ETHTOOL_SRXFH does > > not. I moved the copy logic out of ETHTOOL_GRXFH and into a helper so > > that both ETHTOOL_{G,S}RXFH now call it, which fixes ETHTOOL_SRXFH. This > > is patch 1/2. > > As I see it, this is a new feature, not a fix, so belongs on net-next. > (No existing driver accepts FLOW_RSS in ETHTOOL_SRXFH's cmd->flow_type, > which is just as well as if they did this would be a uABI break.) > > Going forward, ETHTOOL_SRXFH will hopefully be integrated into the new > RSS context kAPI I'm working on[1], so that we can have a new netlink > uAPI for RSS configuration that's all in one place instead of the > piecemeal-grown ethtool API with its backwards-compatible hacks. > But that will take a while, so I think this should go in even though > it's technically an extension to legacy ethtool; it was part of the > documented uAPI and userland implements it, it just never got > implemented on the kernel side (because the initial driver with > context support, sfc, didn't support SRXFH). > > > 2. mlx5 defaulted to RSS context 0 for both ETHTOOL_{G,S}RXFH paths. I > > have modified the driver to support custom contexts for both paths. It > > is now possible to get and set the flow hash key for custom RSS contexts > > with mlx5. This is patch 2/2. > > My feeling would be that this isn't a Fix either, but not my place to say. Thanks for the context above; I'll let the Mellanox folks weigh in on what they think about the code in the second patch before I proceed. I suspect that you are probably right and that net-next might be a more appropriate place for this. If the code is ack'd by Mellanox (and they agree re: net-next), I can re-send this series to net-next with the Fixes removed and the Ack's added.
On Mon, 24 Jul 2023 20:27:43 +0100 Edward Cree wrote: > On 23/07/2023 16:06, Joe Damato wrote: > > Greetings: > > > > While attempting to get the RX flow hash key for a custom RSS context on > > my mlx5 NIC, I got an error: > > > > $ sudo ethtool -u eth1 rx-flow-hash tcp4 context 1 > > Cannot get RX network flow hashing options: Invalid argument > > > > I dug into this a bit and noticed two things: > > > > 1. ETHTOOL_GRXFH supports custom RSS contexts, but ETHTOOL_SRXFH does > > not. I moved the copy logic out of ETHTOOL_GRXFH and into a helper so > > that both ETHTOOL_{G,S}RXFH now call it, which fixes ETHTOOL_SRXFH. This > > is patch 1/2. > > As I see it, this is a new feature, not a fix, so belongs on net-next. > (No existing driver accepts FLOW_RSS in ETHTOOL_SRXFH's cmd->flow_type, > which is just as well as if they did this would be a uABI break.) > > Going forward, ETHTOOL_SRXFH will hopefully be integrated into the new > RSS context kAPI I'm working on[1], so that we can have a new netlink > uAPI for RSS configuration that's all in one place instead of the > piecemeal-grown ethtool API with its backwards-compatible hacks. > But that will take a while, so I think this should go in even though > it's technically an extension to legacy ethtool; it was part of the > documented uAPI and userland implements it, it just never got > implemented on the kernel side (because the initial driver with > context support, sfc, didn't support SRXFH). What's the status on your work? Are you planning to split the RSS config from ethtool or am I reading too much into what you said? It'd be great to push the uAPI extensions back and make them netlink-only, but we can't make Joe wait if it takes a long time to finish up the basic conversion :(
On 24/07/2023 23:08, Jakub Kicinski wrote: > What's the status on your work? Are you planning to split the RSS > config from ethtool or am I reading too much into what you said? I was just thinking that when netlink dumps get added it would make sense to also extend the netlink version of SRSSH (which is what calls the rxfh_context ethtool_ops, via the misleadingly named ethtool_set_rxfh()) to include the hash fields setting that's currently done through ETHTOOL_SRXFH. In which case I should add that data to struct ethtool_rxfh_context, and include it in the get/create/modify_rss_context ethtool_ops API. Since it only occurred to me to consider that setting when I saw Joe's patches, I haven't really figured out yet how to go about the implementation of that. More generally the status of my RSS work is that I've been umming and ahhing about that mutex you didn't like (I still think it's the Right Thing) so I've not made much progress with it. And I should place on record that probably once I've gotten the kernel-driver API done I'll leave the netlink/uAPI stuff for someone else to do as I really don't have the relevant expertise. > It'd be great to push the uAPI extensions back and make them > netlink-only, but we can't make Joe wait if it takes a long time > to finish up the basic conversion :( Yeah as I said upthread I don't think we should make Joe wait, if he's got a use case that actually needs it (have you, Joe? Or is it only GRXFH you need and the investigation just led you to notice SRXFH was broken?) -ed
On Tue, Jul 25, 2023 at 09:40:24AM +0100, Edward Cree wrote: > On 24/07/2023 23:08, Jakub Kicinski wrote: > > It'd be great to push the uAPI extensions back and make them > > netlink-only, but we can't make Joe wait if it takes a long time > > to finish up the basic conversion :( > > Yeah as I said upthread I don't think we should make Joe wait, if > he's got a use case that actually needs it (have you, Joe? Or > is it only GRXFH you need and the investigation just led you to > notice SRXFH was broken?) In short, yes: I'd like to be able to get and set the flow hash keys for custom RSS contexts on mlx5 which is why I included the patch to mlx5 in this series... but to be fair I am just one user :) I think it's really up to you all on the direction you want to go. Longer story: I am working on building a system which relies on custom RSS contexts, flow rules to associate flows with RSS contexts (and thus specific sets of queues), and epoll based busy poll. It's a long story ;) I had considered changing the flow hash key to see if I could alter the behavior of the system I am working on, but I ran into both issues immediately (GRXFH and FLOW_RSS was not supported by mlx5, and SRXFH was broken) which led me down the path of attempting to fix both so that I could get and set the flow hash keys. I thought the code might be useful, so I submit it upstream -- I was not aware of the netlink work (but it looks really useful!). It seems that the Mellanox folks are OK with the proposed driver change, so I am going to send a v2 rebased on net-next with their requested changes.
On Tue, 25 Jul 2023 09:40:24 +0100 Edward Cree wrote: > More generally the status of my RSS work is that I've been umming > and ahhing about that mutex you didn't like (I still think it's > the Right Thing) so I've not made much progress with it. I had a look at the code again, and I don't think the mutex is a deal breaker. More of an aesthetic thing, so to speak. If you strongly prefer to keep the mutex that's fine.