summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorShengzhou Liu <Shengzhou.Liu@freescale.com>2013-04-09 08:04:25 (GMT)
committerFleming Andrew-AFLEMING <AFLEMING@freescale.com>2013-04-16 15:35:17 (GMT)
commitba3826a63a89a9efd73c984cc633bca4bdc2434c (patch)
tree40ac8e90f8cae588281db800bab852436b5627a0 /drivers
parent8cb17e991c16449546ca9b21a5bb0575e5b8c24a (diff)
downloadlinux-fsl-qoriq-ba3826a63a89a9efd73c984cc633bca4bdc2434c.tar.xz
powerpc/dpaa_1588: optimization for 1588 performance
In case of overloading the slaves, the performace will get worse since there are more and more outdated timestamps accumulated in Tx buffer, so we introduce a way to remove those older timestamps between the current matched one and the tail if they are more than TS_ACCUMULATION_THRESHOLD. In addition, we update the buffer size to 256 which is enough according to stress tests. Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com> Change-Id: I761dcabf71f27d47627ca835daf28562bfa37319 Reviewed-on: http://git.am.freescale.net:8181/1146 Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com> Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/freescale/dpa/dpaa_1588.c6
-rw-r--r--drivers/net/ethernet/freescale/dpa/dpaa_1588.h7
2 files changed, 10 insertions, 3 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_1588.c b/drivers/net/ethernet/freescale/dpa/dpaa_1588.c
index 8413b1e..89c7f15 100644
--- a/drivers/net/ethernet/freescale/dpa/dpaa_1588.c
+++ b/drivers/net/ethernet/freescale/dpa/dpaa_1588.c
@@ -147,6 +147,11 @@ static int dpa_ptp_find_and_remove(struct dpa_ptp_circ_buf *ptp_buf,
ts->nsec = tmp->ts.nsec;
if (idx != tail) {
+ if (CIRC_CNT(idx, tail, size) > TS_ACCUMULATION_THRESHOLD) {
+ tail = circ_buf->tail =
+ (idx - TS_ACCUMULATION_THRESHOLD) & (size - 1);
+ }
+
while (CIRC_CNT(idx, tail, size) > 0) {
tmp = (struct dpa_ptp_data *)(circ_buf->buf) + idx;
idx = (idx - 1) & (size - 1);
@@ -584,7 +589,6 @@ int dpa_ptp_init(struct dpa_priv_s *priv)
if (!tsu)
return -ENOMEM;
- memset(tsu, 0, sizeof(*tsu));
tsu->valid = TRUE;
tsu->dpa_priv = priv;
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_1588.h b/drivers/net/ethernet/freescale/dpa/dpaa_1588.h
index eda0e3a..85e2629 100644
--- a/drivers/net/ethernet/freescale/dpa/dpaa_1588.h
+++ b/drivers/net/ethernet/freescale/dpa/dpaa_1588.h
@@ -26,8 +26,8 @@
#include <linux/circ_buf.h>
#include <linux/fsl_qman.h>
-#define DEFAULT_PTP_RX_BUF_SZ 2048
-#define DEFAULT_PTP_TX_BUF_SZ 1024
+#define DEFAULT_PTP_RX_BUF_SZ 256
+#define DEFAULT_PTP_TX_BUF_SZ 256
/* 1588 private ioctl calls */
#define PTP_ENBL_TXTS_IOCTL SIOCDEVPRIVATE
@@ -92,6 +92,9 @@ enum {
#define DPA_PTP_NOMINAL_FREQ_PERIOD 5 /* 5ns -> 200M */
#define NANOSEC_PER_SECOND 1000000000
+/* The threshold between the current found one and the oldest one */
+#define TS_ACCUMULATION_THRESHOLD 50
+
/* Struct needed to identify a timestamp */
struct dpa_ptp_ident {
u8 version;