From 6f327ba1a38eac5a27e2d7279132e07b1ca83f1d Mon Sep 17 00:00:00 2001 From: Harman Kalra Date: Tue, 30 Jul 2019 07:46:45 +0000 Subject: [PATCH] examples/rxtx_callbacks: fix HW timestamp config Since all PMDs doesn't implement per queue offload capabilities but supports RX timestamping and also since rx_offload_capa includes all rx_queue_offload_capa's. Hence moving the logic to enable HW timestamp via DEV_RX_OFFLOAD_TIMESTAMP flag before device configuration so that this application can work with all PMDs. Fixes: cd1dadeb9b2a ("examples/rxtx_callbacks: support HW timestamp") Signed-off-by: Harman Kalra Reviewed-by: Jerin Jacob --- examples/rxtx_callbacks/main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index c1abe9e1a2..dbcd9f4fc7 100644 --- a/examples/rxtx_callbacks/main.c +++ b/examples/rxtx_callbacks/main.c @@ -117,6 +117,15 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE; + if (hw_timestamping) { + if (!(dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP)) { + printf("\nERROR: Port %u does not support hardware timestamping\n" + , port); + return -1; + } + port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_TIMESTAMP; + } + retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf); if (retval != 0) return retval; @@ -127,15 +136,6 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) rxconf = dev_info.default_rxconf; - if (hw_timestamping) { - if (!(dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP)) { - printf("\nERROR: Port %u does not support hardware timestamping\n" - , port); - return -1; - } - rxconf.offloads |= DEV_RX_OFFLOAD_TIMESTAMP; - } - for (q = 0; q < rx_rings; q++) { retval = rte_eth_rx_queue_setup(port, q, nb_rxd, rte_eth_dev_socket_id(port), &rxconf, mbuf_pool); -- 2.20.1