Reviewed-by: Petri Savolainen <petri.savolai...@nokia.com>
> -----Original Message----- > From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT > Matias Elo > Sent: Wednesday, October 21, 2015 1:29 PM > To: lng-odp@lists.linaro.org > Subject: [lng-odp] [API-NEXT PATCH] api: pktio: add odp_pktio_print() API > > Add API function for printing implementation specific pktio > debug information. > > Signed-off-by: Matias Elo <matias....@nokia.com> > --- > include/odp/api/packet_io.h | 9 ++++++++ > platform/linux-generic/odp_packet_io.c | 40 > ++++++++++++++++++++++++++++++++++ > 2 files changed, 49 insertions(+) > > diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h > index 3479af1..e8126b2 100644 > --- a/include/odp/api/packet_io.h > +++ b/include/odp/api/packet_io.h > @@ -358,6 +358,15 @@ uint64_t odp_pktio_to_u64(odp_pktio_t pktio); > void odp_pktio_param_init(odp_pktio_param_t *param); > > /** > + * Print pktio info to the console > + * > + * Print implementation-defined pktio debug information to the console. > + * > + * @param pktio Packet IO handle > + */ > +void odp_pktio_print(odp_pktio_t pktio); > + > +/** > * @} > */ > > diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux- > generic/odp_packet_io.c > index b3ca4c8..de08628 100644 > --- a/platform/linux-generic/odp_packet_io.c > +++ b/platform/linux-generic/odp_packet_io.c > @@ -820,3 +820,43 @@ void odp_pktio_param_init(odp_pktio_param_t *params) > { > memset(params, 0, sizeof(odp_pktio_param_t)); > } > + > +void odp_pktio_print(odp_pktio_t id) > +{ > + pktio_entry_t *entry; > + uint8_t addr[ETH_ALEN]; > + int max_len = 512; > + char str[max_len]; > + int len = 0; > + int n = max_len - 1; > + > + entry = get_pktio_entry(id); > + if (entry == NULL) { > + ODP_DBG("pktio entry %d does not exist\n", id); > + return; > + } > + > + len += snprintf(&str[len], n - len, > + "pktio\n"); > + len += snprintf(&str[len], n - len, > + " handle %" PRIu64 "\n", odp_pktio_to_u64(id)); > + len += snprintf(&str[len], n - len, > + " name %s\n", entry->s.name); > + len += snprintf(&str[len], n - len, > + " state %s\n", > + entry->s.state == STATE_START ? "start" : > + (entry->s.state == STATE_STOP ? "stop" : "unknown")); > + memset(addr, 0, sizeof(addr)); > + odp_pktio_mac_addr(id, addr, ETH_ALEN); > + len += snprintf(&str[len], n - len, > + " mac %02x:%02x:%02x:%02x:%02x:%02x\n", > + addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); > + len += snprintf(&str[len], n - len, > + " mtu %d\n", odp_pktio_mtu(id)); > + len += snprintf(&str[len], n - len, > + " promisc %s\n", > + odp_pktio_promisc_mode(id) ? "yes" : "no"); > + str[len] = '\0'; > + > + ODP_PRINT("\n%s\n", str); > +} > -- > 1.9.1 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp