X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fl2fwd%2Fmain.c;h=3bf3b28b1c7e151976cc0248957cc519825ddd35;hb=f8244c6399d9;hp=1426335844029ca3cfae9bc18a03b92b220bab8d;hpb=2db978d04ba91e18fc8647f125f4d7b15965c57c;p=dpdk.git diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 1426335844..3bf3b28b1c 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -304,7 +304,7 @@ l2fwd_main_loop(void) for (i = 0; i < qconf->n_rx_port; i++) { portid = qconf->rx_port_list[i]; - nb_rx = rte_eth_rx_burst((uint8_t) portid, 0, + nb_rx = rte_eth_rx_burst(portid, 0, pkts_burst, MAX_PKT_BURST); port_statistics[portid].rx += nb_rx; @@ -480,11 +480,12 @@ l2fwd_parse_args(int argc, char **argv) /* Check the link status of all ports in up to 9s, and print them finally */ static void -check_all_ports_link_status(uint8_t port_num, uint32_t port_mask) +check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) { #define CHECK_INTERVAL 100 /* 100ms */ #define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */ - uint8_t portid, count, all_ports_up, print_flag = 0; + uint16_t portid; + uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; printf("\nChecking link status"); @@ -503,14 +504,13 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask) /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) - printf("Port %d Link Up - speed %u " - "Mbps - %s\n", (uint8_t)portid, - (unsigned)link.link_speed, + printf( + "Port%d Link Up. Speed %u Mbps - %s\n", + portid, link.link_speed, (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? ("full-duplex") : ("half-duplex\n")); else - printf("Port %d Link Down\n", - (uint8_t)portid); + printf("Port %d Link Down\n", portid); continue; } /* clear all_ports_up flag if any link down */ @@ -553,9 +553,9 @@ main(int argc, char **argv) struct lcore_queue_conf *qconf; struct rte_eth_dev_info dev_info; int ret; - uint8_t nb_ports; - uint8_t nb_ports_available; - uint8_t portid, last_port; + uint16_t nb_ports; + uint16_t nb_ports_available; + uint16_t portid, last_port; unsigned lcore_id, rx_lcore_id; unsigned nb_ports_in_mask = 0; @@ -644,7 +644,7 @@ main(int argc, char **argv) qconf->rx_port_list[qconf->n_rx_port] = portid; qconf->n_rx_port++; - printf("Lcore %u: RX port %u\n", rx_lcore_id, (unsigned) portid); + printf("Lcore %u: RX port %u\n", rx_lcore_id, portid); } nb_ports_available = nb_ports; @@ -653,24 +653,24 @@ main(int argc, char **argv) for (portid = 0; portid < nb_ports; portid++) { /* skip ports that are not enabled */ if ((l2fwd_enabled_port_mask & (1 << portid)) == 0) { - printf("Skipping disabled port %u\n", (unsigned) portid); + printf("Skipping disabled port %u\n", portid); nb_ports_available--; continue; } /* init port */ - printf("Initializing port %u... ", (unsigned) portid); + printf("Initializing port %u... ", portid); fflush(stdout); ret = rte_eth_dev_configure(portid, 1, 1, &port_conf); if (ret < 0) rte_exit(EXIT_FAILURE, "Cannot configure device: err=%d, port=%u\n", - ret, (unsigned) portid); + ret, portid); ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd, &nb_txd); if (ret < 0) rte_exit(EXIT_FAILURE, "Cannot adjust number of descriptors: err=%d, port=%u\n", - ret, (unsigned) portid); + ret, portid); rte_eth_macaddr_get(portid,&l2fwd_ports_eth_addr[portid]); @@ -682,7 +682,7 @@ main(int argc, char **argv) l2fwd_pktmbuf_pool); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup:err=%d, port=%u\n", - ret, (unsigned) portid); + ret, portid); /* init one TX queue on each port */ fflush(stdout); @@ -691,7 +691,7 @@ main(int argc, char **argv) NULL); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup:err=%d, port=%u\n", - ret, (unsigned) portid); + ret, portid); /* Initialize TX buffers */ tx_buffer[portid] = rte_zmalloc_socket("tx_buffer", @@ -699,7 +699,7 @@ main(int argc, char **argv) rte_eth_dev_socket_id(portid)); if (tx_buffer[portid] == NULL) rte_exit(EXIT_FAILURE, "Cannot allocate buffer for tx on port %u\n", - (unsigned) portid); + portid); rte_eth_tx_buffer_init(tx_buffer[portid], MAX_PKT_BURST); @@ -707,21 +707,22 @@ main(int argc, char **argv) rte_eth_tx_buffer_count_callback, &port_statistics[portid].dropped); if (ret < 0) - rte_exit(EXIT_FAILURE, "Cannot set error callback for " - "tx buffer on port %u\n", (unsigned) portid); + rte_exit(EXIT_FAILURE, + "Cannot set error callback for tx buffer on port %u\n", + portid); /* Start device */ ret = rte_eth_dev_start(portid); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_dev_start:err=%d, port=%u\n", - ret, (unsigned) portid); + ret, portid); printf("done: \n"); rte_eth_promiscuous_enable(portid); printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n", - (unsigned) portid, + portid, l2fwd_ports_eth_addr[portid].addr_bytes[0], l2fwd_ports_eth_addr[portid].addr_bytes[1], l2fwd_ports_eth_addr[portid].addr_bytes[2],