fix ethdev ports enumeration
[dpdk.git] / examples / ptpclient / ptpclient.c
index 1cf2519..ad98a39 100644 (file)
@@ -194,6 +194,8 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
+       /* Force full Tx path in the driver, required for IEEE1588 */
+       port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MULTI_SEGS;
 
        /* Configure the Ethernet device. */
        retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
@@ -735,7 +737,7 @@ main(int argc, char *argv[])
                rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
 
        /* Initialize all ports. */
-       for (portid = 0; portid < nb_ports; portid++) {
+       RTE_ETH_FOREACH_DEV(portid) {
                if ((ptp_enabled_port_mask & (1 << portid)) != 0) {
                        if (port_init(portid, mbuf_pool) == 0) {
                                ptp_enabled_ports[ptp_enabled_port_nb] = portid;