Skip to content

Commit

Permalink
Merge pull request #692 from AltraMayor/q_limit
Browse files Browse the repository at this point in the history
lib/net: give an informative error when not enough queues
  • Loading branch information
AltraMayor authored Jun 26, 2024
2 parents 7eed1ea + efaffb0 commit 1a0d2f4
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions lib/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,42 @@ randomize_rss_key(struct gatekeeper_if *iface)
return 0;
}

static int
check_if_queues(struct gatekeeper_if *iface,
const struct rte_eth_dev_info *dev_info, struct rte_eth_conf *port_conf)
{
const char *type_queues;
unsigned int requested_queues, max_queues;

/*
* DPDK API quirk: rte_eth_dev_configure() receives the numbers of
* RX and TX queues as parameters instead of fields in @port_conf.
*/
RTE_SET_USED(port_conf);

if (unlikely(iface->num_rx_queues > dev_info->max_rx_queues)) {
type_queues = "RX";
requested_queues = iface->num_rx_queues;
max_queues = dev_info->max_rx_queues;
goto error;
}

if (unlikely(iface->num_tx_queues > dev_info->max_tx_queues)) {
type_queues = "TX";
requested_queues = iface->num_tx_queues;
max_queues = dev_info->max_tx_queues;
goto error;
}

return 0;

error:
G_LOG(ERR, "%s(%s): the current configuration requires %u %s queues, but the interface supports at most %u %s queues. It may be possible to reduce the number of instances of the GK or GT functional block to reduce the number of queues. If not, more capable NICs are needed.\n",
__func__, iface->name, requested_queues, type_queues,
max_queues, type_queues);
return -ENOSPC;
}

/*
* Split up RTE_ETH_RSS_IP into IPv4-related and IPv6-related hash functions.
* For each type of IP being used in Gatekeeper, check the supported
Expand Down Expand Up @@ -1435,6 +1471,10 @@ check_if_offloads(struct gatekeeper_if *iface, struct rte_eth_conf *port_conf)
return ret;
}

ret = check_if_queues(iface, &dev_info, port_conf);
if (unlikely(ret < 0))
return ret;

ret = check_if_rss(iface, &dev_info, port_conf);
if (unlikely(ret < 0))
return ret;
Expand Down

0 comments on commit 1a0d2f4

Please sign in to comment.