Skip to content

Commit

Permalink
netdev-dpdk: manage failure in mempool name creation.
Browse files Browse the repository at this point in the history
In case a mempool name could not be generated log a message
and return a null mempool pointer to the caller.

CC: Mark B Kavanagh <[email protected]>
CC: Darrell Ball <[email protected]>
CC: Ciara Loftus <[email protected]>
CC: Kevin Traynor <[email protected]>
CC: Aaron Conole <[email protected]>
Fixes: d555d9b ("netdev-dpdk: Create separate memory pool for each port.")
Signed-off-by: Antonio Fischetti <[email protected]>
Acked-by: Kevin Traynor <[email protected]>
Signed-off-by: Ian Stokes <[email protected]>
  • Loading branch information
FischettiAntonio authored and istokes committed Oct 26, 2017
1 parent 837c176 commit 65056fd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ dpdk_mp_name(struct dpdk_mp *dmp)
int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%d_%u",
h, dmp->socket_id, dmp->mtu, dmp->mp_size);
if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {
VLOG_DBG("snprintf returned %d. Failed to generate a mempool "
"name for \"%s\". Hash:0x%x, mtu:%d, mbufs:%u.",
ret, dmp->if_name, h, dmp->mtu, dmp->mp_size);
return NULL;
}
return mp_name;
Expand Down Expand Up @@ -533,6 +536,10 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool *mp_exists)

do {
char *mp_name = dpdk_mp_name(dmp);
if (!mp_name) {
rte_free(dmp);
return NULL;
}

VLOG_DBG("Port %s: Requesting a mempool of %u mbufs "
"on socket %d for %d Rx and %d Tx queues.",
Expand Down

0 comments on commit 65056fd

Please sign in to comment.