From: Raslan Darawsheh Date: Tue, 10 Oct 2017 14:37:05 +0000 (+0300) Subject: ethdev: add Rx HW timestamp capability X-Git-Tag: spdx-start~1466 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=42ffc45aa340bf3bf2b88d904988a88c0160a13a;p=dpdk.git ethdev: add Rx HW timestamp capability Add a new offload capability flag for Rx HW timestamp and enabling/disabling this via rte_eth_rxmode. Signed-off-by: Raslan Darawsheh Reviewed-by: Shahaf Shuler Acked-by: Yongseok Koh --- diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst index 8641893219..bfeae80eff 100644 --- a/doc/guides/nics/features.rst +++ b/doc/guides/nics/features.rst @@ -574,6 +574,17 @@ Supports L4 checksum offload. * **[provides] rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa:DEV_RX_OFFLOAD_UDP_CKSUM,DEV_RX_OFFLOAD_TCP_CKSUM``, ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_UDP_CKSUM,DEV_TX_OFFLOAD_TCP_CKSUM,DEV_TX_OFFLOAD_SCTP_CKSUM``. +.. _nic_features_hw_timestamp: + +Timestamp offload +----------------- + +Supports Timestamp. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:DEV_RX_OFFLOAD_TIMESTAMP``. +* **[provides] mbuf**: ``mbuf.ol_flags:PKT_RX_TIMESTAMP``. +* **[provides] mbuf**: ``mbuf.timestamp``. +* **[provides] rte_eth_dev_info**: ``rx_offload_capa,rx_queue_offload_capa: DEV_RX_OFFLOAD_TIMESTAMP``. .. _nic_features_macsec_offload: diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini index 9a59901955..dc527ddf9e 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -48,6 +48,7 @@ VLAN offload = QinQ offload = L3 checksum offload = L4 checksum offload = +Timestamp offload = MACsec offload = Inner L3 checksum = Inner L4 checksum = diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 3c5441e4de..ea56978eb8 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -715,6 +715,8 @@ rte_eth_convert_rx_offload_bitfield(const struct rte_eth_rxmode *rxmode, offloads |= DEV_RX_OFFLOAD_SCATTER; if (rxmode->enable_lro == 1) offloads |= DEV_RX_OFFLOAD_TCP_LRO; + if (rxmode->hw_timestamp == 1) + offloads |= DEV_RX_OFFLOAD_TIMESTAMP; *rx_offloads = offloads; } @@ -763,6 +765,10 @@ rte_eth_convert_rx_offloads(const uint64_t rx_offloads, rxmode->enable_lro = 1; else rxmode->enable_lro = 0; + if (rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) + rxmode->hw_timestamp = 1; + else + rxmode->hw_timestamp = 0; } int diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 8e928da807..0b731bb3f4 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -369,6 +369,7 @@ struct rte_eth_rxmode { hw_strip_crc : 1, /**< Enable CRC stripping by hardware. */ enable_scatter : 1, /**< Enable scatter packets rx handler */ enable_lro : 1, /**< Enable LRO */ + hw_timestamp : 1, /**< Enable HW timestamp */ /** * When set the offload bitfield should be ignored. * Instead per-port Rx offloads should be set on offloads @@ -961,6 +962,7 @@ struct rte_eth_conf { #define DEV_RX_OFFLOAD_JUMBO_FRAME 0x00000800 #define DEV_RX_OFFLOAD_CRC_STRIP 0x00001000 #define DEV_RX_OFFLOAD_SCATTER 0x00002000 +#define DEV_RX_OFFLOAD_TIMESTAMP 0x00004000 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \ DEV_RX_OFFLOAD_UDP_CKSUM | \ DEV_RX_OFFLOAD_TCP_CKSUM)