From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796126112; b=4K6NP4RQdAu5AzIHxO3nhmvRNzTet633M0NMAYzPn/CzbNEwEGKT5PN1rU+eHhoSCPO4 joSlee1vHgSONK+OP5V1oYlA/8E7GlQ6eZWMtufd9Nv80tHUojefn6rh99Mbp5JrGMUNK IhYiTEYqGJcj9X1BbptxBJ06iC7kB+d82fRW/6r51tYAjn25pUSXp06LYxQBU8Hb7nYli 9uqi6g8O9mqOVwbsJfYFOC4U/cC4HzLssHdtB/X5JcICIlfCmcTudDBJnFjfHTbT4LgSu SMJtWPiUHGT7a5U0RNbaTUYFEvpLA6rBaI5QUe29y2+4nFNHkd3E4TWYjHsWRHDNlJg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796126112; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=5Y51v+K211v+HYls5WxKGPXSdkBk/qkhNM5ZMu6V518=; b=Q0Hm3KsI0YJLnw99BV+BLs05O9ySgQ3HSbDnqKxpoyRASPRToK+aDHKoZAdG1aOVtN94 n7azH4ddyc4p33w3wsuulleqRUfM/y6jrnOSVVXODDVDV8dMnZ/43CDHaNyBL7k2GWTIS KmAnDiZhD5grjy4d4ccxHl3b4pnPp9V0rCXfSt7ueCFselG+49v3mzGzUQYecYlRLTsJO DBez1YzUvUJ3WVIf+lyelOFgeNfL9zc0gMbHWI6RylrDneCQ77jVVU0s7YjnSkZBRSozM pl4yHYQerY7yBY0Bn2lmkYL4+PZdIWvkcoqkfhZ2JH0ctbM9rBv/Bz4u+2eX7L681BQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Y9fqD7SA; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52CDD606A31A for ; Tue, 1 Dec 2026 11:55:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Y9fqD7SA Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E2831F000C1; Tue, 1 Dec 2026 11:55:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796126112; bh=5Y51v+K211v+HYls5WxKGPXSdkBk/qkhNM5ZMu6V518=; h=From:To:Cc:Subject:Date; b=Y9fqD7SAmY0AcIPcctT4xvSokPdEjNVxoar1FnjrTLYR2BAYU9kwL2sjyLBFEyiOg aZcyUyCKDSSzYYyFzXgplB5wcA349R7JxUnqjpiq4EEQiKGly22V8S3gnoEd9acqLO +lylAJnJc2tw8RmhkAzfF0PAL0j+RHAvZkLwT6YuuLdEHt/wR5F8ZUj7COiGk5eZ39 2ERD3NF0wHn4WOyHGNyOKwv/wEuxzOYe0eRx/NbKe/ai1EW9yUvS6fmTGfXA2q1DFi Ll9T4NNuzIkC3GEZazEBfz3ZojnPJRY6cPTg2yfO2VbYy1xbhOtEKYdae1x8t8B4um 37Kui/aCjP7Tg== From: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= To: Andrew Lunn , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Willem de Bruijn , netdev@vger.kernel.org Cc: Stanislav Fomichev , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Simon Horman , Maxime Chevallier , Mina Almasry , Kaiyuan Zhang , Simona Vetter Subject: [PATCH net] ethtool: Allow the channel count that a memory provider needs Date: Tue, 1 Dec 2026 12:54:56 +0100 Message-ID: <20261201115458.1254880-1-bjorn@kernel.org> X-Mailer: git-send-email 2.56.1 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dev_get_min_mp_channel_count() returns the lowest channel count that keeps every queue with a memory provider. One more than the highest such queue. ethtool_check_max_channel() refuses a count that is lower than or equal to it, as it does for the highest queue of the RSS indirection table and of the ntuple filters, which are queue indices. With a provider on queue 42, going down to 43 channels then fails with "requested channel counts are too low for existing memory provider setting (43)", though queue 42 stays. Refuse only counts below the minimum, and name the variable after what it holds, as the queue indices next to it led to the comparison. Counts below the minimum fail as before, and the message reports the minimum. Callers that only ask whether any queue has a provider, as the XDP and tcp-data-split checks do, see no change. Found while testing an AF_XDP memory provider on mlx5, where going from 47 to 43 channels with the provider on queue 42 failed. devmem shows it too. Here, a dmabuf bound to queue 42 of a ConnectX-7, "ethtool -L eth0 combined 43" fails the same way. With a provider on queue 2 of the fbnic QEMU model, 3 channels were refused before this patch and are taken after it, and 2 are still refused. Tested on a ConnectX-7 (firmware 28.48.1000) with a devmem dmabuf bound to queue 42. With this patch, going from 47 to 43 channels is accepted, and going from 43 to 42 is refused. Fixes: 170aafe35cb9 ("netdev: support binding dma-buf to netdevice") Signed-off-by: Björn Töpel --- net/ethtool/common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/ethtool/common.c b/net/ethtool/common.c index ec67fbd6bb86..eb3a4bc67654 100644 --- a/net/ethtool/common.c +++ b/net/ethtool/common.c @@ -801,7 +801,7 @@ int ethtool_check_max_channel(struct net_device *dev, { u64 max_rxnfc_in_use; u32 max_rxfh_in_use; - int max_mp_in_use; + u32 min_mp_channels; /* ensure the new Rx count fits within the configured Rx flow * indirection table/rxnfc settings @@ -820,10 +820,10 @@ int ethtool_check_max_channel(struct net_device *dev, return -EINVAL; } - max_mp_in_use = dev_get_min_mp_channel_count(dev); - if (channels.combined_count + channels.rx_count <= max_mp_in_use) { + min_mp_channels = dev_get_min_mp_channel_count(dev); + if (channels.combined_count + channels.rx_count < min_mp_channels) { if (info) - GENL_SET_ERR_MSG_FMT(info, "requested channel counts are too low for existing memory provider setting (%d)", max_mp_in_use); + GENL_SET_ERR_MSG_FMT(info, "requested channel counts are too low for existing memory provider setting (%u)", min_mp_channels); return -EINVAL; } base-commit: e2fb9368a41662bc54624f9be87ea8989b109306 -- 2.56.1