Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Mar 2016 20:04:35 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r297041 - head/sys/arm/ti/cpsw
Message-ID:  <201603182004.u2IK4Zki069767@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: loos
Date: Fri Mar 18 20:04:34 2016
New Revision: 297041
URL: https://svnweb.freebsd.org/changeset/base/297041

Log:
  Set the destination port in all TX segments.
  
  Sponsored by:	Rubicon Communications (Netgate)

Modified:
  head/sys/arm/ti/cpsw/if_cpsw.c

Modified: head/sys/arm/ti/cpsw/if_cpsw.c
==============================================================================
--- head/sys/arm/ti/cpsw/if_cpsw.c	Fri Mar 18 20:03:09 2016	(r297040)
+++ head/sys/arm/ti/cpsw/if_cpsw.c	Fri Mar 18 20:04:34 2016	(r297041)
@@ -1730,8 +1730,13 @@ cpswp_tx_enqueue(struct cpswp_softc *sc)
 	struct cpsw_slot *slot, *prev_slot = NULL;
 	struct cpsw_slot *last_old_slot, *first_new_slot;
 	struct mbuf *m0;
-	int error, nsegs, seg, added = 0, padlen;
+	int error, flags, nsegs, seg, added = 0, padlen;
 
+	flags = 0;
+	if (sc->swsc->dualemac) {
+		flags = CPDMA_BD_TO_PORT |
+		    ((sc->unit + 1) & CPDMA_BD_PORT_MASK);
+	}
 	/* Pull pending packets from IF queue and prep them for DMA. */
 	while ((slot = STAILQ_FIRST(&sc->swsc->tx.avail)) != NULL) {
 		IF_DEQUEUE(&sc->ifp->if_snd, m0);
@@ -1793,11 +1798,7 @@ cpswp_tx_enqueue(struct cpswp_softc *sc)
 		bd.bufoff = 0;
 		bd.buflen = segs[0].ds_len;
 		bd.pktlen = m_length(slot->mbuf, NULL) + padlen;
-		bd.flags =  CPDMA_BD_SOP | CPDMA_BD_OWNER;
-		if (sc->swsc->dualemac) {
-			bd.flags |= CPDMA_BD_TO_PORT |
-			    ((sc->unit + 1) & CPDMA_BD_PORT_MASK);
-		}
+		bd.flags =  CPDMA_BD_SOP | CPDMA_BD_OWNER | flags;
 		for (seg = 1; seg < nsegs; ++seg) {
 			/* Save the previous buffer (which isn't EOP) */
 			cpsw_cpdma_write_bd(sc->swsc, slot, &bd);
@@ -1818,7 +1819,7 @@ cpswp_tx_enqueue(struct cpswp_softc *sc)
 			bd.bufoff = 0;
 			bd.buflen = segs[seg].ds_len;
 			bd.pktlen = 0;
-			bd.flags = CPDMA_BD_OWNER;
+			bd.flags = CPDMA_BD_OWNER | flags;
 		}
 		/* Save the final buffer. */
 		if (padlen <= 0)
@@ -1847,7 +1848,7 @@ cpswp_tx_enqueue(struct cpswp_softc *sc)
 			bd.bufoff = 0;
 			bd.buflen = padlen;
 			bd.pktlen = 0;
-			bd.flags = CPDMA_BD_EOP | CPDMA_BD_OWNER;
+			bd.flags = CPDMA_BD_EOP | CPDMA_BD_OWNER | flags;
 			cpsw_cpdma_write_bd(sc->swsc, slot, &bd);
 			++nsegs;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603182004.u2IK4Zki069767>