Skip to content

Commit

Permalink
net: ethernet: prueth: fix hsr/prp timestamping mem offset
Browse files Browse the repository at this point in the history
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 <a-kramer@ti.com>
  • Loading branch information
Aaron Kramer committed May 30, 2019
1 parent 32e73c6 commit 14e3f30
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions drivers/net/ethernet/ti/prueth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 14e3f30

Please sign in to comment.