Skip to content

Commit dbc94a0

Browse files
dtatulearleon
authored andcommitted
IB/IPoIB: Fix queue count inconsistency for PKEY child interfaces
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: 9baa0b0 ("IB/ipoib: Add rtnl_link_ops support") Signed-off-by: Dragos Tatulea <[email protected]> Link: https://lore.kernel.org/r/f4a42c8aa43c02d5ae5559a60c3e5e0f18c82531.1670485816.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <[email protected]>
1 parent e42f9c2 commit dbc94a0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/infiniband/ulp/ipoib/ipoib_netlink.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ static const struct nla_policy ipoib_policy[IFLA_IPOIB_MAX + 1] = {
4141
[IFLA_IPOIB_UMCAST] = { .type = NLA_U16 },
4242
};
4343

44+
static unsigned int ipoib_get_max_num_queues(void)
45+
{
46+
return min_t(unsigned int, num_possible_cpus(), 128);
47+
}
48+
4449
static int ipoib_fill_info(struct sk_buff *skb, const struct net_device *dev)
4550
{
4651
struct ipoib_dev_priv *priv = ipoib_priv(dev);
@@ -172,6 +177,8 @@ static struct rtnl_link_ops ipoib_link_ops __read_mostly = {
172177
.changelink = ipoib_changelink,
173178
.get_size = ipoib_get_size,
174179
.fill_info = ipoib_fill_info,
180+
.get_num_rx_queues = ipoib_get_max_num_queues,
181+
.get_num_tx_queues = ipoib_get_max_num_queues,
175182
};
176183

177184
struct rtnl_link_ops *ipoib_get_link_ops(void)

0 commit comments

Comments
 (0)