Skip to content

Commit fc70a66

Browse files
danieldin95dwallacelf
authored andcommitted
dpdk: fix format device name using wrong index
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 <danieldin95@163.com>
1 parent bc4d5b0 commit fc70a66

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/plugins/dpdk/device/common.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ static struct
4747
void
4848
dpdk_device_error (dpdk_device_t * xd, char *str, int rv)
4949
{
50-
dpdk_log_err ("Interface %U error %d: %s",
51-
format_dpdk_device_name, xd->port_id, rv, rte_strerror (rv));
50+
dpdk_log_err ("Interface %U error %d: %s", format_dpdk_device_name,
51+
xd->device_index, rv, rte_strerror (rv));
5252
xd->errors = clib_error_return (xd->errors, "%s[port:%d, errno:%d]: %s",
5353
str, xd->port_id, rv, rte_strerror (rv));
5454
}
@@ -331,15 +331,15 @@ dpdk_setup_interrupts (dpdk_device_t *xd)
331331
if (rte_eth_dev_rx_intr_enable (xd->port_id, 0))
332332
{
333333
dpdk_log_info ("probe for interrupt mode for device %U. Failed.\n",
334-
format_dpdk_device_name, xd->port_id);
334+
format_dpdk_device_name, xd->device_index);
335335
}
336336
else
337337
{
338338
xd->flags |= DPDK_DEVICE_FLAG_INT_SUPPORTED;
339339
if (!(xd->flags & DPDK_DEVICE_FLAG_INT_UNMASKABLE))
340340
rte_eth_dev_rx_intr_disable (xd->port_id, 0);
341341
dpdk_log_info ("Probe for interrupt mode for device %U. Success.\n",
342-
format_dpdk_device_name, xd->port_id);
342+
format_dpdk_device_name, xd->device_index);
343343
}
344344

345345
if (xd->flags & DPDK_DEVICE_FLAG_INT_SUPPORTED)
@@ -360,8 +360,8 @@ dpdk_setup_interrupts (dpdk_device_t *xd)
360360
f.flags = UNIX_FILE_EVENT_EDGE_TRIGGERED;
361361
f.file_descriptor = rxq->efd;
362362
f.private_data = rxq->queue_index;
363-
f.description =
364-
format (0, "%U queue %u", format_dpdk_device_name, xd->port_id, q);
363+
f.description = format (0, "%U queue %u", format_dpdk_device_name,
364+
xd->device_index, q);
365365
rxq->clib_file_index = clib_file_add (&file_main, &f);
366366
vnet_hw_if_set_rx_queue_file_index (vnm, rxq->queue_index,
367367
rxq->clib_file_index);
@@ -419,8 +419,8 @@ dpdk_device_start (dpdk_device_t * xd)
419419

420420
rte_eth_allmulticast_enable (xd->port_id);
421421

422-
dpdk_log_info ("Interface %U started",
423-
format_dpdk_device_name, xd->port_id);
422+
dpdk_log_info ("Interface %U started", format_dpdk_device_name,
423+
xd->device_index);
424424
}
425425

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

436-
dpdk_log_info ("Interface %U stopped",
437-
format_dpdk_device_name, xd->port_id);
436+
dpdk_log_info ("Interface %U stopped", format_dpdk_device_name,
437+
xd->device_index);
438438
}
439439

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

0 commit comments

Comments
 (0)