X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fbbdev_app%2Fmain.c;h=d68c06aefb1dd2edfd9be0ff5a2b2374178100d6;hb=8f2312474529;hp=2e5bd8c975b458f78e98a6c559c886b815a5f5c1;hpb=1ffee690eaa10b1b50deb230755ea4ceaa373e0f;p=dpdk.git diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index 2e5bd8c975..d68c06aefb 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -64,11 +64,6 @@ static const struct rte_eth_conf port_conf = { .mq_mode = ETH_MQ_RX_NONE, .max_rx_pkt_len = ETHER_MAX_LEN, .split_hdr_size = 0, - .header_split = 0, /**< Header Split disabled */ - .hw_ip_checksum = 0, /**< IP checksum offload disabled */ - .hw_vlan_filter = 0, /**< VLAN filtering disabled */ - .jumbo_frame = 0, /**< Jumbo Frame Support disabled */ - .hw_strip_crc = 0, /**< CRC stripped by hardware */ }, .txmode = { .mq_mode = ETH_MQ_TX_NONE, @@ -282,12 +277,12 @@ print_mac(unsigned int portid, struct ether_addr *bbdev_ports_eth_address) { printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n", (unsigned int) portid, - bbdev_ports_eth_address[portid].addr_bytes[0], - bbdev_ports_eth_address[portid].addr_bytes[1], - bbdev_ports_eth_address[portid].addr_bytes[2], - bbdev_ports_eth_address[portid].addr_bytes[3], - bbdev_ports_eth_address[portid].addr_bytes[4], - bbdev_ports_eth_address[portid].addr_bytes[5]); + bbdev_ports_eth_address->addr_bytes[0], + bbdev_ports_eth_address->addr_bytes[1], + bbdev_ports_eth_address->addr_bytes[2], + bbdev_ports_eth_address->addr_bytes[3], + bbdev_ports_eth_address->addr_bytes[4], + bbdev_ports_eth_address->addr_bytes[5]); } static inline void @@ -585,21 +580,28 @@ print_stats(struct stats_lcore_params *stats_lcore) "Failed to calloc memory for xstats"); ret = rte_eth_xstats_get(port_id, xstats, len); - if (ret < 0 || ret > len) + if (ret < 0 || ret > len) { + free(xstats); rte_exit(EXIT_FAILURE, "rte_eth_xstats_get(%u) len%i failed: %d", port_id, len, ret); + } xstats_names = calloc(len, sizeof(*xstats_names)); - if (xstats_names == NULL) + if (xstats_names == NULL) { + free(xstats); rte_exit(EXIT_FAILURE, "Failed to calloc memory for xstats_names"); + } ret = rte_eth_xstats_get_names(port_id, xstats_names, len); - if (ret < 0 || ret > len) + if (ret < 0 || ret > len) { + free(xstats); + free(xstats_names); rte_exit(EXIT_FAILURE, "rte_eth_xstats_get_names(%u) len%i failed: %d", port_id, len, ret); + } for (i = 0; i < len; i++) { if (xstats[i].value > 0) @@ -609,8 +611,16 @@ print_stats(struct stats_lcore_params *stats_lcore) xstats[i].value); } + ret = rte_bbdev_stats_get(bbdev_id, &bbstats); + if (ret < 0) { + free(xstats); + free(xstats_names); + rte_exit(EXIT_FAILURE, + "ERROR(%d): Failure to get BBDEV %u statistics\n", + ret, bbdev_id); + } + printf("\nBBDEV STATISTICS:\n=================\n"); - rte_bbdev_stats_get(bbdev_id, &bbstats); printf("BBDEV %u: %s enqueue count:\t\t%"PRIu64"\n", bbdev_id, stats_border, bbstats.enqueued_count); @@ -630,6 +640,9 @@ print_stats(struct stats_lcore_params *stats_lcore) continue; print_lcore_stats(stats_lcore->lconf[l_id].lcore_stats, l_id); } + + free(xstats); + free(xstats_names); } static int @@ -999,7 +1012,7 @@ int main(int argc, char **argv) { int ret; - unsigned int nb_bbdevs, nb_ports, flags, lcore_id; + unsigned int nb_bbdevs, flags, lcore_id; void *sigret; struct app_config_params app_params = def_app_config; struct rte_mempool *ethdev_mbuf_mempool, *bbdev_mbuf_mempool; @@ -1061,12 +1074,10 @@ main(int argc, char **argv) nb_bbdevs, app_params.bbdev_id); printf("Number of bbdevs detected: %d\n", nb_bbdevs); - /* Get the number of available ethdev devices */ - nb_ports = rte_eth_dev_count(); - if (nb_ports <= app_params.port_id) + if (!rte_eth_dev_is_valid_port(app_params.port_id)) rte_exit(EXIT_FAILURE, - "%u ports detected, cannot use port with ID %u!\n", - nb_ports, app_params.port_id); + "cannot use port with ID %u!\n", + app_params.port_id); /* create the mbuf mempool for ethdev pkts */ ethdev_mbuf_mempool = rte_pktmbuf_pool_create("ethdev_mbuf_pool",