[dpdk-dev] [PATCH] examples/rxtx_callbacks: fix HW timestamp enable
Harman Kalra
hkalra at marvell.com
Thu Jul 25 17:51:57 CEST 2019
Offloafing Rx timestamp is a device capability than queue capability.
Hence the logic to enable HW timestamp via DEV_RX_OFFLOAD_TIMESTAMP
flag should be before device configuration.
Fixes: cd1dadeb9b2a ("examples/rxtx_callbacks: support HW timestamp")
Cc: barbette at kth.se
Signed-off-by: Harman Kalra <hkalra at marvell.com>
---
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 c1abe9e1a..dbcd9f4fc 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.18.0
More information about the dev
mailing list