diff mbox series

[rdma-next] IB/IPoIB: Fix queue count inconsistency for PKEY child interfaces

Message ID f4a42c8aa43c02d5ae5559a60c3e5e0f18c82531.1670485816.git.leonro@nvidia.com (mailing list archive)
State Accepted
Headers show
Series [rdma-next] IB/IPoIB: Fix queue count inconsistency for PKEY child interfaces | expand

Commit Message

Leon Romanovsky Dec. 8, 2022, 7:52 a.m. UTC
From: Dragos Tatulea <dtatulea@nvidia.com>

There are 2 ways to create IPoIB PKEY child interfaces:
1) Writing a PKEY to /sys/class/net/<ib parent interface>/create_child.
2) Using netlink with iproute.

While with sysfs the child interface has the same number of tx and
rx queues as the parent, with netlink there will always be 1 tx
and 1 rx queue for the child interface. That's because the
get_num_tx/rx_queues() netlink ops are missing and the default value
of 1 is taken for the number of queues (in rtnl_create_link()).

This change adds the get_num_tx/rx_queues() ops which allows for
interfaces with multiple queues to be created over netlink. This
constant only represents the max number of tx and rx queues on that
net device.

Fixes: 9baa0b036410 ("IB/ipoib: Add rtnl_link_ops support")
Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/ulp/ipoib/ipoib_netlink.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Leon Romanovsky Dec. 11, 2022, noon UTC | #1
On Thu, 8 Dec 2022 09:52:54 +0200, Leon Romanovsky wrote:
> From: Dragos Tatulea <dtatulea@nvidia.com>
> 
> There are 2 ways to create IPoIB PKEY child interfaces:
> 1) Writing a PKEY to /sys/class/net/<ib parent interface>/create_child.
> 2) Using netlink with iproute.
> 
> While with sysfs the child interface has the same number of tx and
> rx queues as the parent, with netlink there will always be 1 tx
> and 1 rx queue for the child interface. That's because the
> get_num_tx/rx_queues() netlink ops are missing and the default value
> of 1 is taken for the number of queues (in rtnl_create_link()).
> 
> [...]

Applied, thanks!

[1/1] IB/IPoIB: Fix queue count inconsistency for PKEY child interfaces
      https://git.kernel.org/rdma/rdma/c/dbc94a0fb81771

Best regards,
diff mbox series

Patch

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_netlink.c b/drivers/infiniband/ulp/ipoib/ipoib_netlink.c
index ea16ba5d8da6..9ad8d9856275 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_netlink.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_netlink.c
@@ -41,6 +41,11 @@  static const struct nla_policy ipoib_policy[IFLA_IPOIB_MAX + 1] = {
 	[IFLA_IPOIB_UMCAST]	= { .type = NLA_U16 },
 };
 
+static unsigned int ipoib_get_max_num_queues(void)
+{
+	return min_t(unsigned int, num_possible_cpus(), 128);
+}
+
 static int ipoib_fill_info(struct sk_buff *skb, const struct net_device *dev)
 {
 	struct ipoib_dev_priv *priv = ipoib_priv(dev);
@@ -172,6 +177,8 @@  static struct rtnl_link_ops ipoib_link_ops __read_mostly = {
 	.changelink	= ipoib_changelink,
 	.get_size	= ipoib_get_size,
 	.fill_info	= ipoib_fill_info,
+	.get_num_rx_queues = ipoib_get_max_num_queues,
+	.get_num_tx_queues = ipoib_get_max_num_queues,
 };
 
 struct rtnl_link_ops *ipoib_get_link_ops(void)