Files
genode/repos/dde_linux/patches/fec_tx_sync_dma_write.patch
Martin Stein ff128df131 dde_linux/fec: fix unsynchronized TX DMA write
Unfortunately, our current implementation of 'wmb()' doesn't seem to do what we
want it to do. On base-hw + imx6q_sabrelite, the write of bdp->cbd_sc seems to
get re-ordered after the write to txq->bd.reg_desc_active in the transmission
path of the contrib code. Due to this, the transmission of the packet is only
triggered the next time a packet is sent. However, we only quick-fix it by
enforcing the execution of the write with a volatile global read as we will
soon update the FEC NIC port with a new DDE approach anyway.

Fixes #4010
2021-06-25 11:41:44 +02:00

44 lines
1.7 KiB
Diff

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 3f72629..2b54f2b 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -428,7 +428,7 @@ static int fec_enet_txq_submit_skb(struct fec_enet_priv_tx_q *txq,
{
struct fec_enet_private *fep = netdev_priv(ndev);
int nr_frags = skb_shinfo(skb)->nr_frags;
- struct bufdesc *bdp, *last_bdp;
+ struct bufdesc *bdp, *last_bdp, *dummy_bdp;
void *bufaddr;
dma_addr_t addr;
unsigned short status;
@@ -532,6 +532,7 @@ static int fec_enet_txq_submit_skb(struct fec_enet_priv_tx_q *txq,
*/
status |= (BD_ENET_TX_READY | BD_ENET_TX_TC);
bdp->cbd_sc = cpu_to_fec16(status);
+ dummy_bdp = bdp;
/* If this was the last BD in the ring, start at the beginning again. */
bdp = fec_enet_get_nextdesc(last_bdp, &txq->bd);
@@ -542,6 +543,21 @@ static int fec_enet_txq_submit_skb(struct fec_enet_priv_tx_q *txq,
* txq->bd.cur.
*/
wmb();
+
+ /*
+ * Unfortunately, our current implementation of 'wmb()' doesn't seem
+ * to do what we want it to do. On base-hw + imx6q_sabrelite, the
+ * write of bdp->cbd_sc seems to get re-ordered after the write to
+ * txq->bd.reg_desc_active and, therefore, the transmission of the packet
+ * would only be triggered the next time we reach this point,
+ * i.e. when the next packet is sent. However, we only quick-fix it by
+ * enforcing the write with this volatile global read as we will
+ * soon update the FEC NIC port with a new DDE approach anyway
+ * (See Genode Github issue #4010).
+ */
+ static unsigned long volatile dummy_cbd_sc;
+ dummy_cbd_sc = *(unsigned long volatile *)&dummy_bdp->cbd_sc;
+
txq->bd.cur = bdp;
/* Trigger transmission start */