[PATCH bpf-next v4 07/17] libbpf: Support drivers with non-combined channels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently, libbpf uses the number of combined channels as the maximum
queue number. However, the kernel has a different limitation:

- xdp_reg_umem_at_qid() allows up to max(RX queues, TX queues).

- ethtool_set_channels() checks for UMEMs in queues up to
  combined_count + max(rx_count, tx_count).

libbpf shouldn't limit applications to a lower max queue number. Account
for non-combined RX and TX channels when calculating the max queue
number. Use the same formula that is used in ethtool.

Signed-off-by: Maxim Mikityanskiy <maximmi@xxxxxxxxxxxx>
Reviewed-by: Tariq Toukan <tariqt@xxxxxxxxxxxx>
Acked-by: Saeed Mahameed <saeedm@xxxxxxxxxxxx>
---
 tools/lib/bpf/xsk.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
index bf15a80a37c2..86107857e1f0 100644
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -334,13 +334,13 @@ static int xsk_get_max_queues(struct xsk_socket *xsk)
 		goto out;
 	}
 
-	if (channels.max_combined == 0 || errno == EOPNOTSUPP)
+	ret = channels.max_combined + max(channels.max_rx, channels.max_tx);
+
+	if (ret == 0 || errno == EOPNOTSUPP)
 		/* If the device says it has no channels, then all traffic
 		 * is sent to a single stream, so max queues = 1.
 		 */
 		ret = 1;
-	else
-		ret = channels.max_combined;
 
 out:
 	close(fd);
-- 
2.19.1





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux