[v2] examples/rxtx_callbacks: fix HW timestamp enable
Checks
Commit Message
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")
Cc: barbette@kth.se
Signed-off-by: Harman Kalra <hkalra@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
---
V2:
* More detailed commit message.
examples/rxtx_callbacks/main.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
Comments
30/07/2019 09:46, Harman Kalra:
> 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")
> Cc: barbette@kth.se
>
> Signed-off-by: Harman Kalra <hkalra@marvell.com>
> Reviewed-by: Jerin Jacob <jerinj@marvell.com>
> ---
> V2:
> * More detailed commit message.
Applied, thanks.
Note: there is a discussion about dropping this example in next releases.
@@ -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);