Commit 557ccd54 authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by Paolo Abeni
Browse files

net: stmmac: use first_desc for TBS



Rather than freshly getting a pointer for the TBS descriptor (because
we want to access its enhanced fields) convert the existing first_desc
basic descriptor to a pointer to the enhanced descriptor.

Add a comment explaining why it is safe to convert from the basic
descriptor pointer to the enhanced descriptor pointer.

Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1w3d0W-0000000DfM7-2BMA@rmk-PC.armlinux.org.uk


Tested-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
[pabeni@redhat.com: fixed comment typo]
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 2e3bfeb1
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -4794,10 +4794,15 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
	if (priv->sarc_type)
		stmmac_set_desc_sarc(priv, first_desc, priv->sarc_type);

	/* STMMAC_TBS_EN can only be set if STMMAC_TBS_AVAIL has already
	 * been set, which means the underlying type of the descriptors
	 * will be struct stmmac_edesc. Therefore, it is safe to convert
	 * the basic descriptor to the enhanced descriptor here.
	 */
	if (tx_q->tbs & STMMAC_TBS_EN) {
		struct timespec64 ts = ns_to_timespec64(skb->tstamp);

		tbs_desc = &tx_q->dma_entx[first_entry];
		tbs_desc = dma_desc_to_edesc(first_desc);
		stmmac_set_desc_tbs(priv, tbs_desc, ts.tv_sec, ts.tv_nsec);
	}