fsl/fman_port: support getting timestamp
authorYangbo Lu <yangbo.lu@nxp.com>
Mon, 25 Jun 2018 12:37:13 +0000 (20:37 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Jun 2018 13:15:14 +0000 (22:15 +0900)
This patch is to add fman_port_get_tstamp() interface
to get timestamp.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fman/fman_port.c
drivers/net/ethernet/freescale/fman/fman_port.h

index ce6e24c74978a22a1d22383f0a5b4f38ffec7c00..4a2d9605bd5ed5782b72d2413906a1ed1b4d333b 100644 (file)
@@ -1731,6 +1731,18 @@ int fman_port_get_hash_result_offset(struct fman_port *port, u32 *offset)
 }
 EXPORT_SYMBOL(fman_port_get_hash_result_offset);
 
+int fman_port_get_tstamp(struct fman_port *port, const void *data, u64 *tstamp)
+{
+       if (port->buffer_offsets.time_stamp_offset == ILLEGAL_BASE)
+               return -EINVAL;
+
+       *tstamp = be64_to_cpu(*(__be64 *)(data +
+                       port->buffer_offsets.time_stamp_offset));
+
+       return 0;
+}
+EXPORT_SYMBOL(fman_port_get_tstamp);
+
 static int fman_port_probe(struct platform_device *of_dev)
 {
        struct fman_port *port;
index e86ca6a34e4e296051258df2b4d268bf4ade09a6..9dbb69f4012160fb744372351a87c0d3ff595a10 100644 (file)
@@ -153,6 +153,8 @@ u32 fman_port_get_qman_channel_id(struct fman_port *port);
 
 int fman_port_get_hash_result_offset(struct fman_port *port, u32 *offset);
 
+int fman_port_get_tstamp(struct fman_port *port, const void *data, u64 *tstamp);
+
 struct fman_port *fman_port_bind(struct device *dev);
 
 #endif /* __FMAN_PORT_H */