[2/9] net/dpaa2: support per port Rx mbuf timestamp

Message ID 20200710162137.22973-2-hemant.agrawal@nxp.com
State Accepted
Commit 724f79dff0a8667952f8e0f954eac1071448f08a
Headers show
Series
  • [1/9] net/dpaa2: remove Rx timestamp enable PMD API
Related show

Commit Message

Hemant Agrawal July 10, 2020, 4:21 p.m.
DEV_RX_OFFLOAD_TIMESTAMP is per port, so the internal implementation
shall enable it on per port basis only.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

---
 doc/guides/nics/features/dpaa2.ini | 2 ++
 drivers/net/dpaa2/dpaa2_ethdev.c   | 4 ++--
 drivers/net/dpaa2/dpaa2_ethdev.h   | 2 +-
 drivers/net/dpaa2/dpaa2_rxtx.c     | 2 +-
 4 files changed, 6 insertions(+), 4 deletions(-)

-- 
2.17.1

Patch

diff --git a/doc/guides/nics/features/dpaa2.ini b/doc/guides/nics/features/dpaa2.ini
index 3685e2e02..831883d21 100644
--- a/doc/guides/nics/features/dpaa2.ini
+++ b/doc/guides/nics/features/dpaa2.ini
@@ -21,6 +21,8 @@  VLAN offload         = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 Packet type parsing  = Y
+Timesync             = Y
+Timestamp offload    = Y
 Basic stats          = Y
 Extended stats       = Y
 FW version           = Y
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index c530596cd..3e5502de5 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -64,7 +64,7 @@  static uint64_t dev_tx_offloads_nodis =
 		DEV_TX_OFFLOAD_MULTI_SEGS;
 
 /* enable timestamp in mbuf */
-bool dpaa2_enable_ts;
+bool dpaa2_enable_ts[RTE_MAX_ETHPORTS];
 
 struct rte_dpaa2_xstats_name_off {
 	char name[RTE_ETH_XSTATS_NAME_SIZE];
@@ -525,7 +525,7 @@  dpaa2_eth_dev_configure(struct rte_eth_dev *dev)
 #if !defined(RTE_LIBRTE_IEEE1588)
 	if (rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP)
 #endif
-	dpaa2_enable_ts = true;
+		dpaa2_enable_ts[dev->data->port_id] = true;
 
 	if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM)
 		tx_l3_csum_offload = true;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index 2e6d26d4f..e577355d5 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -91,7 +91,7 @@ 
 #define DPAA2_PKT_TYPE_VLAN_2		0x0260
 
 /* enable timestamp in mbuf*/
-extern bool dpaa2_enable_ts;
+extern bool dpaa2_enable_ts[];
 
 #define DPAA2_QOS_TABLE_RECONFIGURE	1
 #define DPAA2_FS_TABLE_RECONFIGURE	2
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 86cb95268..4dd1d5f57 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -108,7 +108,7 @@  dpaa2_dev_rx_parse_new(struct rte_mbuf *m, const struct qbman_fd *fd,
 	m->hash.rss = fd->simple.flc_hi;
 	m->ol_flags |= PKT_RX_RSS_HASH;
 
-	if (dpaa2_enable_ts) {
+	if (dpaa2_enable_ts[m->port]) {
 		m->timestamp = annotation->word2;
 		m->ol_flags |= PKT_RX_TIMESTAMP;
 		DPAA2_PMD_DP_DEBUG("pkt timestamp:0x%" PRIx64 "", m->timestamp);