From 14e3f3061675348e4a492e7089c07ee5e7926884 Mon Sep 17 00:00:00 2001 From: Aaron Kramer Date: Fri, 24 May 2019 13:20:10 -0400 Subject: [PATCH] net: ethernet: prueth: fix hsr/prp timestamping mem offset The offset used for accessing timestamps should be the offset from the start of the buffer descriptor memory, not from the start of each ports buffer descriptor memory region, otherwise both ports are accessing timestamps from the same array of timestamps. An identical correction was needed in firmware to store the timestamps at the correct offsets and not have each port overwrite the other. Signed-off-by: Aaron Kramer --- drivers/net/ethernet/ti/prueth.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/ti/prueth.c b/drivers/net/ethernet/ti/prueth.c index 16d3a1452a10c1..5b98d7c2d1a1dd 100644 --- a/drivers/net/ethernet/ti/prueth.c +++ b/drivers/net/ethernet/ti/prueth.c @@ -2246,7 +2246,6 @@ static irqreturn_t red_emac_rx_thread(int irq, void *dev_id) const struct prueth_queue_info *rxqueue_p; void *ocmc_ram = (__force void *)emac->prueth->mem[PRUETH_MEM_OCMC].va; - int read_block, read_block_o; u32 pkt_ts, pkt_ts_o; u32 iep_wrap, iep_cmp_cfg; @@ -2326,15 +2325,10 @@ static irqreturn_t red_emac_rx_thread(int irq, void *dev_id) parse_packet_info(prueth, rd_buf_desc, &pkt_info); parse_packet_info(prueth, rd_buf_desc_o, &pkt_info_o); - read_block = (bd_rd_ptr - rxqueue->buffer_desc_offset) / - BD_SIZE; - read_block_o = (bd_rd_ptr_o - rxqueue_o->buffer_desc_offset) / - BD_SIZE; - pkt_ts = readl(ocmc_ram + TIMESTAMP_ARRAY_OFFSET + - (read_block * BD_SIZE)); + bd_rd_ptr - SRAM_START_OFFSET); pkt_ts_o = readl(ocmc_ram + TIMESTAMP_ARRAY_OFFSET + - (read_block_o * BD_SIZE)); + bd_rd_ptr_o - SRAM_START_OFFSET); if (!port0_q_empty && !port1_q_empty) { /* Packets in both port queues */