svn commit: r306878 - head/sys/dev/wpi

Andriy Voskoboinyk avos at FreeBSD.org
Sat Oct 8 20:41:09 UTC 2016


Author: avos
Date: Sat Oct  8 20:41:08 2016
New Revision: 306878
URL: https://svnweb.freebsd.org/changeset/base/306878

Log:
  wpi: restore frame header before submitting an mbuf to
  ieee80211_tx_complete()
  
  This change allows to pass packet length to rate control modules and
  fixes IFCOUNTER_OBYTES calculation.
  
  Tested with Intel 3945BG, STA mode.

Modified:
  head/sys/dev/wpi/if_wpi.c
  head/sys/dev/wpi/if_wpivar.h

Modified: head/sys/dev/wpi/if_wpi.c
==============================================================================
--- head/sys/dev/wpi/if_wpi.c	Sat Oct  8 19:54:01 2016	(r306877)
+++ head/sys/dev/wpi/if_wpi.c	Sat Oct  8 20:41:08 2016	(r306878)
@@ -527,7 +527,8 @@ wpi_attach(device_t dev)
 	wpi_radiotap_attach(sc);
 
 	/* Setup Tx status flags (constant). */
-	sc->sc_txs.flags = IEEE80211_RATECTL_STATUS_SHORT_RETRY |
+	sc->sc_txs.flags = IEEE80211_RATECTL_STATUS_PKTLEN |
+	    IEEE80211_RATECTL_STATUS_SHORT_RETRY |
 	    IEEE80211_RATECTL_STATUS_LONG_RETRY;
 
 	callout_init_mtx(&sc->calib_to, &sc->rxon_mtx, 0);
@@ -2079,9 +2080,15 @@ wpi_tx_done(struct wpi_softc *sc, struct
 	m = data->m, data->m = NULL;
 	ni = data->ni, data->ni = NULL;
 
+	/* Restore frame header. */
+	KASSERT(M_LEADINGSPACE(m) >= data->hdrlen, ("no frame header!"));
+	M_PREPEND(m, data->hdrlen, M_NOWAIT);
+	KASSERT(m != NULL, ("%s: m is NULL\n", __func__));
+
 	/*
 	 * Update rate control statistics for the node.
 	 */
+	txs->pktlen = m->m_pkthdr.len;
 	txs->short_retries = stat->rtsfailcnt;
 	txs->long_retries = stat->ackfailcnt / WPI_NTRIES_DEFAULT;
 	if (!(status & WPI_TX_STATUS_FAIL))
@@ -2721,6 +2728,7 @@ wpi_cmd2(struct wpi_softc *sc, struct wp
 
 	data->m = buf->m;
 	data->ni = buf->ni;
+	data->hdrlen = hdrlen;
 
 	DPRINTF(sc, WPI_DEBUG_XMIT, "%s: qid %d idx %d len %d nsegs %d\n",
 	    __func__, ring->qid, cur, totlen, nsegs);

Modified: head/sys/dev/wpi/if_wpivar.h
==============================================================================
--- head/sys/dev/wpi/if_wpivar.h	Sat Oct  8 19:54:01 2016	(r306877)
+++ head/sys/dev/wpi/if_wpivar.h	Sat Oct  8 20:41:08 2016	(r306878)
@@ -63,6 +63,7 @@ struct wpi_tx_data {
 	bus_addr_t		cmd_paddr;
 	struct mbuf		*m;
 	struct ieee80211_node	*ni;
+	int			hdrlen;
 };
 
 struct wpi_tx_ring {


More information about the svn-src-all mailing list