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