Deleted Added
full compact
if_malo.c (267992) if_malo.c (271849)
1/*-
2 * Copyright (c) 2008 Weongyo Jeong <weongyo@freebsd.org>
3 * Copyright (c) 2007 Marvell Semiconductor, Inc.
4 * Copyright (c) 2007 Sam Leffler, Errno Consulting
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 17 unchanged lines hidden (view full) ---

26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
27 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29 * THE POSSIBILITY OF SUCH DAMAGES.
30 */
31
32#include <sys/cdefs.h>
33#ifdef __FreeBSD__
1/*-
2 * Copyright (c) 2008 Weongyo Jeong <weongyo@freebsd.org>
3 * Copyright (c) 2007 Marvell Semiconductor, Inc.
4 * Copyright (c) 2007 Sam Leffler, Errno Consulting
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 17 unchanged lines hidden (view full) ---

26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
27 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29 * THE POSSIBILITY OF SUCH DAMAGES.
30 */
31
32#include <sys/cdefs.h>
33#ifdef __FreeBSD__
34__FBSDID("$FreeBSD: head/sys/dev/malo/if_malo.c 267992 2014-06-28 03:56:17Z hselasky $");
34__FBSDID("$FreeBSD: head/sys/dev/malo/if_malo.c 271849 2014-09-19 03:51:26Z glebius $");
35#endif
36
37#include "opt_malo.h"
38
39#include <sys/param.h>
40#include <sys/endian.h>
41#include <sys/kernel.h>
42#include <sys/socket.h>

--- 1197 unchanged lines hidden (view full) ---

1240
1241 MALO_TXQ_LOCK(txq);
1242 if (!IS_DATA_FRAME(wh))
1243 ds->status |= htole32(1);
1244 ds->status |= htole32(MALO_TXD_STATUS_FW_OWNED);
1245 STAILQ_INSERT_TAIL(&txq->active, bf, bf_list);
1246 MALO_TXDESC_SYNC(txq, ds, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
1247
35#endif
36
37#include "opt_malo.h"
38
39#include <sys/param.h>
40#include <sys/endian.h>
41#include <sys/kernel.h>
42#include <sys/socket.h>

--- 1197 unchanged lines hidden (view full) ---

1240
1241 MALO_TXQ_LOCK(txq);
1242 if (!IS_DATA_FRAME(wh))
1243 ds->status |= htole32(1);
1244 ds->status |= htole32(MALO_TXD_STATUS_FW_OWNED);
1245 STAILQ_INSERT_TAIL(&txq->active, bf, bf_list);
1246 MALO_TXDESC_SYNC(txq, ds, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
1247
1248 ifp->if_opackets++;
1248 if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
1249 sc->malo_timer = 5;
1250 MALO_TXQ_UNLOCK(txq);
1251 return 0;
1252#undef IEEE80211_DIR_DSTODS
1253}
1254
1255static void
1256malo_start(struct ifnet *ifp)

--- 21 unchanged lines hidden (view full) ---

1278 ifp->if_drv_flags |= IFF_DRV_OACTIVE;
1279 sc->malo_stats.mst_tx_qstop++;
1280 break;
1281 }
1282 /*
1283 * Pass the frame to the h/w for transmission.
1284 */
1285 if (malo_tx_start(sc, ni, bf, m)) {
1249 sc->malo_timer = 5;
1250 MALO_TXQ_UNLOCK(txq);
1251 return 0;
1252#undef IEEE80211_DIR_DSTODS
1253}
1254
1255static void
1256malo_start(struct ifnet *ifp)

--- 21 unchanged lines hidden (view full) ---

1278 ifp->if_drv_flags |= IFF_DRV_OACTIVE;
1279 sc->malo_stats.mst_tx_qstop++;
1280 break;
1281 }
1282 /*
1283 * Pass the frame to the h/w for transmission.
1284 */
1285 if (malo_tx_start(sc, ni, bf, m)) {
1286 ifp->if_oerrors++;
1286 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
1287 if (bf != NULL) {
1288 bf->bf_m = NULL;
1289 bf->bf_node = NULL;
1290 MALO_TXQ_LOCK(txq);
1291 STAILQ_INSERT_HEAD(&txq->free, bf, bf_list);
1292 MALO_TXQ_UNLOCK(txq);
1293 }
1294 ieee80211_free_node(ni);

--- 41 unchanged lines hidden (view full) ---

1336 return;
1337
1338 ifp = sc->malo_ifp;
1339 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && !sc->malo_invalid) {
1340 if_printf(ifp, "watchdog timeout\n");
1341
1342 /* XXX no way to reset h/w. now */
1343
1287 if (bf != NULL) {
1288 bf->bf_m = NULL;
1289 bf->bf_node = NULL;
1290 MALO_TXQ_LOCK(txq);
1291 STAILQ_INSERT_HEAD(&txq->free, bf, bf_list);
1292 MALO_TXQ_UNLOCK(txq);
1293 }
1294 ieee80211_free_node(ni);

--- 41 unchanged lines hidden (view full) ---

1336 return;
1337
1338 ifp = sc->malo_ifp;
1339 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && !sc->malo_invalid) {
1340 if_printf(ifp, "watchdog timeout\n");
1341
1342 /* XXX no way to reset h/w. now */
1343
1344 ifp->if_oerrors++;
1344 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
1345 sc->malo_stats.mst_watchdog++;
1346 }
1347}
1348
1349static int
1350malo_hal_reset(struct malo_softc *sc)
1351{
1352 static int first = 0;

--- 512 unchanged lines hidden (view full) ---

1865 m_freem(m);
1866 return ENOBUFS;
1867 }
1868
1869 /*
1870 * Pass the frame to the h/w for transmission.
1871 */
1872 if (malo_tx_start(sc, ni, bf, m) != 0) {
1345 sc->malo_stats.mst_watchdog++;
1346 }
1347}
1348
1349static int
1350malo_hal_reset(struct malo_softc *sc)
1351{
1352 static int first = 0;

--- 512 unchanged lines hidden (view full) ---

1865 m_freem(m);
1866 return ENOBUFS;
1867 }
1868
1869 /*
1870 * Pass the frame to the h/w for transmission.
1871 */
1872 if (malo_tx_start(sc, ni, bf, m) != 0) {
1873 ifp->if_oerrors++;
1873 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
1874 bf->bf_m = NULL;
1875 bf->bf_node = NULL;
1876 MALO_TXQ_LOCK(txq);
1877 STAILQ_INSERT_HEAD(&txq->free, bf, bf_list);
1878 txq->nfree++;
1879 MALO_TXQ_UNLOCK(txq);
1880
1881 ieee80211_free_node(ni);

--- 191 unchanged lines hidden (view full) ---

2073 readptr = le32toh(ds->physnext);
2074
2075#ifdef MALO_DEBUG
2076 if (sc->malo_debug & MALO_DEBUG_RECV_DESC)
2077 malo_printrxbuf(bf, 0);
2078#endif
2079 status = ds->status;
2080 if (status & MALO_RXD_STATUS_DECRYPT_ERR_MASK) {
1874 bf->bf_m = NULL;
1875 bf->bf_node = NULL;
1876 MALO_TXQ_LOCK(txq);
1877 STAILQ_INSERT_HEAD(&txq->free, bf, bf_list);
1878 txq->nfree++;
1879 MALO_TXQ_UNLOCK(txq);
1880
1881 ieee80211_free_node(ni);

--- 191 unchanged lines hidden (view full) ---

2073 readptr = le32toh(ds->physnext);
2074
2075#ifdef MALO_DEBUG
2076 if (sc->malo_debug & MALO_DEBUG_RECV_DESC)
2077 malo_printrxbuf(bf, 0);
2078#endif
2079 status = ds->status;
2080 if (status & MALO_RXD_STATUS_DECRYPT_ERR_MASK) {
2081 ifp->if_ierrors++;
2081 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
2082 goto rx_next;
2083 }
2084 /*
2085 * Sync the data buffer.
2086 */
2087 len = le16toh(ds->pktlen);
2088 bus_dmamap_sync(sc->malo_dmat, bf->bf_dmamap,
2089 BUS_DMASYNC_POSTREAD);

--- 22 unchanged lines hidden (view full) ---

2112 * the front. Hence there's no need to vet the packet length.
2113 * If the frame in fact is too small it should be discarded
2114 * at the net80211 layer.
2115 */
2116
2117 /* XXX don't need mbuf, just dma buffer */
2118 mnew = malo_getrxmbuf(sc, bf);
2119 if (mnew == NULL) {
2082 goto rx_next;
2083 }
2084 /*
2085 * Sync the data buffer.
2086 */
2087 len = le16toh(ds->pktlen);
2088 bus_dmamap_sync(sc->malo_dmat, bf->bf_dmamap,
2089 BUS_DMASYNC_POSTREAD);

--- 22 unchanged lines hidden (view full) ---

2112 * the front. Hence there's no need to vet the packet length.
2113 * If the frame in fact is too small it should be discarded
2114 * at the net80211 layer.
2115 */
2116
2117 /* XXX don't need mbuf, just dma buffer */
2118 mnew = malo_getrxmbuf(sc, bf);
2119 if (mnew == NULL) {
2120 ifp->if_ierrors++;
2120 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
2121 goto rx_next;
2122 }
2123 /*
2124 * Attach the dma buffer to the mbuf; malo_rxbuf_init will
2125 * re-setup the rx descriptor using the replacement dma
2126 * buffer we just installed above.
2127 */
2128 bf->bf_m = mnew;

--- 24 unchanged lines hidden (view full) ---

2153 sc->malo_rx_th.wr_antnoise = ds->nf;
2154 }
2155#ifdef MALO_DEBUG
2156 if (IFF_DUMPPKTS_RECV(sc, wh)) {
2157 ieee80211_dump_pkt(ic, mtod(m, caddr_t),
2158 len, ds->rate, rssi);
2159 }
2160#endif
2121 goto rx_next;
2122 }
2123 /*
2124 * Attach the dma buffer to the mbuf; malo_rxbuf_init will
2125 * re-setup the rx descriptor using the replacement dma
2126 * buffer we just installed above.
2127 */
2128 bf->bf_m = mnew;

--- 24 unchanged lines hidden (view full) ---

2153 sc->malo_rx_th.wr_antnoise = ds->nf;
2154 }
2155#ifdef MALO_DEBUG
2156 if (IFF_DUMPPKTS_RECV(sc, wh)) {
2157 ieee80211_dump_pkt(ic, mtod(m, caddr_t),
2158 len, ds->rate, rssi);
2159 }
2160#endif
2161 ifp->if_ipackets++;
2161 if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
2162
2163 /* dispatch */
2164 ni = ieee80211_find_rxnode(ic,
2165 (struct ieee80211_frame_min *)wh);
2166 if (ni != NULL) {
2167 (void) ieee80211_input(ni, m, rssi, ds->nf);
2168 ieee80211_free_node(ni);
2169 } else

--- 108 unchanged lines hidden ---
2162
2163 /* dispatch */
2164 ni = ieee80211_find_rxnode(ic,
2165 (struct ieee80211_frame_min *)wh);
2166 if (ni != NULL) {
2167 (void) ieee80211_input(ni, m, rssi, ds->nf);
2168 ieee80211_free_node(ni);
2169 } else

--- 108 unchanged lines hidden ---