Skip to content

Commit

Permalink
linux-gen: pktio: add debug prints
Browse files Browse the repository at this point in the history
Print interface name on open, start, stop and close calls. Also
print driver name and number of queues to ease check of correct
configuration.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
  • Loading branch information
Petri Savolainen authored and muvarov committed Mar 7, 2018
1 parent c67dcec commit c2a1c48
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions platform/linux-generic/odp_packet_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,6 @@ static odp_pktio_t setup_pktio_entry(const char *name, odp_pool_t pool,
pktio_entry->s.ops = pktio_if_ops[pktio_if];
unlock_entry(pktio_entry);

ODP_DBG("%s uses %s\n", name, pktio_if_ops[pktio_if]->name);

return hdl;
}

Expand All @@ -255,6 +253,18 @@ static int pool_type_is_packet(odp_pool_t pool)
return pool_info.params.type == ODP_POOL_PACKET;
}

static const char *driver_name(odp_pktio_t hdl)
{
pktio_entry_t *entry;

if (hdl != ODP_PKTIO_INVALID) {
entry = get_pktio_entry(hdl);
return entry->s.ops->name;
}

return "bad handle";
}

odp_pktio_t odp_pktio_open(const char *name, odp_pool_t pool,
const odp_pktio_param_t *param)
{
Expand All @@ -279,6 +289,8 @@ odp_pktio_t odp_pktio_open(const char *name, odp_pool_t pool,
hdl = setup_pktio_entry(name, pool, param);
odp_spinlock_unlock(&pktio_tbl->lock);

ODP_DBG("interface: %s, driver: %s\n", name, driver_name(hdl));

return hdl;
}

Expand Down Expand Up @@ -391,6 +403,8 @@ int odp_pktio_close(odp_pktio_t hdl)

unlock_entry(entry);

ODP_DBG("interface: %s\n", entry->s.name);

return 0;
}

Expand Down Expand Up @@ -488,6 +502,9 @@ int odp_pktio_start(odp_pktio_t hdl)
sched_fn->pktio_start(_odp_pktio_index(hdl), num, index, odpq);
}

ODP_DBG("interface: %s, input queues: %u, output queues: %u\n",
entry->s.name, entry->s.num_in_queue, entry->s.num_out_queue);

return res;
}

Expand Down Expand Up @@ -526,6 +543,8 @@ int odp_pktio_stop(odp_pktio_t hdl)
res = _pktio_stop(entry);
unlock_entry(entry);

ODP_DBG("interface: %s\n", entry->s.name);

return res;
}

Expand Down

0 comments on commit c2a1c48

Please sign in to comment.