Skip to content

Commit

Permalink
dpdk: fix format device name using wrong index
Browse files Browse the repository at this point in the history
When I setup vpp by netvsc driver, occurs the following crash:

(format_dpdk_device_name) assertion `(i) < vec_len (dm->devices)' fails

vnet[100166]: #6  0x00007f434d651f6a _clib_error + 0x2da
vnet[100166]: #7  0x00007f430b4bef64 format_dpdk_device_name + 0xf4
vnet[100166]: #8  0x00007f434d6555f3 do_percent + 0xee3
vnet[100166]: #9  0x00007f434d654359 va_format + 0xb9
vnet[100166]: #10 0x00007f434d7ac16e vlib_log + 0x3ce
vnet[100166]: #11 0x00007f430b49ebe3 dpdk_device_start + 0x193
vnet[100166]: #12 0x00007f430b4aa233 dpdk_interface_admin_up_down + 0x163
vnet[100166]: #13 0x00007f434d988fc8 vnet_sw_interface_set_flags_helper + 0x378
vnet[100166]: #14 0x00007f434d989338 vnet_sw_interface_set_flags + 0x48

This patch fix it by device_index as a index for devices vec, and not
dpdk port_id.

Type: fix
Change-Id: I84c46616d06117c9ae3b2c7d0473050f1b8ded5f
Signed-off-by: Daniel Ding <[email protected]>
  • Loading branch information
danieldin95 authored and dwallacelf committed May 19, 2023
1 parent bc4d5b0 commit fc70a66
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/plugins/dpdk/device/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ static struct
void
dpdk_device_error (dpdk_device_t * xd, char *str, int rv)
{
dpdk_log_err ("Interface %U error %d: %s",
format_dpdk_device_name, xd->port_id, rv, rte_strerror (rv));
dpdk_log_err ("Interface %U error %d: %s", format_dpdk_device_name,
xd->device_index, rv, rte_strerror (rv));
xd->errors = clib_error_return (xd->errors, "%s[port:%d, errno:%d]: %s",
str, xd->port_id, rv, rte_strerror (rv));
}
Expand Down Expand Up @@ -331,15 +331,15 @@ dpdk_setup_interrupts (dpdk_device_t *xd)
if (rte_eth_dev_rx_intr_enable (xd->port_id, 0))
{
dpdk_log_info ("probe for interrupt mode for device %U. Failed.\n",
format_dpdk_device_name, xd->port_id);
format_dpdk_device_name, xd->device_index);
}
else
{
xd->flags |= DPDK_DEVICE_FLAG_INT_SUPPORTED;
if (!(xd->flags & DPDK_DEVICE_FLAG_INT_UNMASKABLE))
rte_eth_dev_rx_intr_disable (xd->port_id, 0);
dpdk_log_info ("Probe for interrupt mode for device %U. Success.\n",
format_dpdk_device_name, xd->port_id);
format_dpdk_device_name, xd->device_index);
}

if (xd->flags & DPDK_DEVICE_FLAG_INT_SUPPORTED)
Expand All @@ -360,8 +360,8 @@ dpdk_setup_interrupts (dpdk_device_t *xd)
f.flags = UNIX_FILE_EVENT_EDGE_TRIGGERED;
f.file_descriptor = rxq->efd;
f.private_data = rxq->queue_index;
f.description =
format (0, "%U queue %u", format_dpdk_device_name, xd->port_id, q);
f.description = format (0, "%U queue %u", format_dpdk_device_name,
xd->device_index, q);
rxq->clib_file_index = clib_file_add (&file_main, &f);
vnet_hw_if_set_rx_queue_file_index (vnm, rxq->queue_index,
rxq->clib_file_index);
Expand Down Expand Up @@ -419,8 +419,8 @@ dpdk_device_start (dpdk_device_t * xd)

rte_eth_allmulticast_enable (xd->port_id);

dpdk_log_info ("Interface %U started",
format_dpdk_device_name, xd->port_id);
dpdk_log_info ("Interface %U started", format_dpdk_device_name,
xd->device_index);
}

void
Expand All @@ -433,8 +433,8 @@ dpdk_device_stop (dpdk_device_t * xd)
rte_eth_dev_stop (xd->port_id);
clib_memset (&xd->link, 0, sizeof (struct rte_eth_link));

dpdk_log_info ("Interface %U stopped",
format_dpdk_device_name, xd->port_id);
dpdk_log_info ("Interface %U stopped", format_dpdk_device_name,
xd->device_index);
}

void vl_api_force_rpc_call_main_thread (void *fp, u8 * data, u32 data_length);
Expand Down

0 comments on commit fc70a66

Please sign in to comment.