Skip to content

Commit 996defd

Browse files
robhancockseddavem330
authored andcommitted
net: axienet: Fix TX ring slot available check
The check for whether a TX ring slot was available was incorrect, since a slot which had been loaded with transmit data but the device had not started transmitting would be treated as available, potentially causing non-transmitted slots to be overwritten. The control field in the descriptor should be checked, rather than the status field (which may only be updated when the device completes the entry). Fixes: 8a3b7a2 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Robert Hancock <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 70f5817 commit 996defd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/xilinx/xilinx_axienet_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,14 +643,14 @@ static int axienet_free_tx_chain(struct net_device *ndev, u32 first_bd,
643643
if (cur_p->skb && (status & XAXIDMA_BD_STS_COMPLETE_MASK))
644644
dev_consume_skb_irq(cur_p->skb);
645645

646-
cur_p->cntrl = 0;
647646
cur_p->app0 = 0;
648647
cur_p->app1 = 0;
649648
cur_p->app2 = 0;
650649
cur_p->app4 = 0;
651650
cur_p->skb = NULL;
652651
/* ensure our transmit path and device don't prematurely see status cleared */
653652
wmb();
653+
cur_p->cntrl = 0;
654654
cur_p->status = 0;
655655

656656
if (sizep)
@@ -713,7 +713,7 @@ static inline int axienet_check_tx_bd_space(struct axienet_local *lp,
713713
/* Ensure we see all descriptor updates from device or TX IRQ path */
714714
rmb();
715715
cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num];
716-
if (cur_p->status & XAXIDMA_BD_STS_ALL_MASK)
716+
if (cur_p->cntrl)
717717
return NETDEV_TX_BUSY;
718718
return 0;
719719
}

0 commit comments

Comments
 (0)