Skip to content

Commit a142a0d

Browse files
port: do not unplug static ports
If some port is available since grout startup, don't try to remove the underlying device. This is to accomodate with buses that do not properly implement device hotplug. Signed-off-by: David Marchand <[email protected]>
1 parent 8511c27 commit a142a0d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

modules/infra/control/gr_port.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ struct __rte_aligned(alignof(void *)) iface_info_port {
3333

3434
uint16_t port_id;
3535
bool started;
36+
bool hotplugged;
3637
struct rte_mempool *pool;
3738
char *devargs;
3839
uint32_t pool_size;

modules/infra/control/port.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,15 +307,11 @@ static int iface_port_fini(struct iface *iface) {
307307
LOG(ERR, "rte_eth_dev_info_get: %s", rte_strerror(-ret));
308308
if ((ret = rte_eth_dev_stop(port->port_id)) < 0)
309309
LOG(ERR, "rte_eth_dev_stop: %s", rte_strerror(-ret));
310-
// XXX DPDK bus/fslmc VFIO constraint for dpaa2
311-
if (strcmp(info.driver_name, "net_dpaa2") == 0)
312-
goto fini;
313310
if ((ret = rte_eth_dev_close(port->port_id)) < 0)
314311
LOG(ERR, "rte_eth_dev_close: %s", rte_strerror(-ret));
315-
if (info.device != NULL && (ret = rte_dev_remove(info.device)) < 0)
312+
if (port->hotplugged && info.device != NULL && (ret = rte_dev_remove(info.device)) < 0)
316313
LOG(ERR, "rte_dev_remove: %s", rte_strerror(-ret));
317314

318-
fini:
319315
if (port->pool != NULL) {
320316
gr_pktmbuf_pool_release(port->pool, port->pool_size);
321317
port->pool = NULL;
@@ -331,6 +327,7 @@ static int iface_port_init(struct iface *iface, const void *api_info) {
331327
const struct gr_iface_info_port *api = api_info;
332328
uint16_t port_id = RTE_MAX_ETHPORTS;
333329
struct rte_dev_iterator iterator;
330+
bool hotplugged = false;
334331
const struct iface *i;
335332
struct gr_iface conf;
336333
int ret;
@@ -352,6 +349,7 @@ static int iface_port_init(struct iface *iface, const void *api_info) {
352349
return errno_set(-ret);
353350
RTE_ETH_FOREACH_MATCHING_DEV(port_id, api->devargs, &iterator) {
354351
rte_eth_iterator_cleanup(&iterator);
352+
hotplugged = true;
355353
break;
356354
}
357355
}
@@ -360,6 +358,7 @@ static int iface_port_init(struct iface *iface, const void *api_info) {
360358
return errno_set(EIDRM);
361359

362360
port->port_id = port_id;
361+
port->hotplugged = hotplugged;
363362
port->devargs = strndup(api->devargs, GR_PORT_DEVARGS_SIZE);
364363
if (port->devargs == NULL) {
365364
ret = errno_set(ENOMEM);

0 commit comments

Comments
 (0)