From owner-svn-src-user@FreeBSD.ORG Sun Sep 18 07:21:00 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 358441065670; Sun, 18 Sep 2011 07:21:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23CAF8FC08; Sun, 18 Sep 2011 07:21:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8I7L0vp017937; Sun, 18 Sep 2011 07:21:00 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8I7Kx39017934; Sun, 18 Sep 2011 07:20:59 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109180720.p8I7Kx39017934@svn.freebsd.org> From: Adrian Chadd Date: Sun, 18 Sep 2011 07:20:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225645 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Sep 2011 07:21:00 -0000 Author: adrian Date: Sun Sep 18 07:20:59 2011 New Revision: 225645 URL: http://svn.freebsd.org/changeset/base/225645 Log: Begin an overhaul of the TXQ locking to avoid recursive locking. The linux and atheros reference driver keep the hardware TXQ locked for the duration of both the TXQ completion processing and TXQ drain. This unfortunately means the TXQ lock is held during completion callbacks and during ieee80211_free_node(). When the last node reference is removed, net80211 will free the node - which calls back into the driver and in this code, it flushes the node state and removes it from various lists. Unfortunately access to these lists is locked by the TXQ lock and trying to grab it whilst it's already being held causes a panic. The solution is to go back to how FreeBSD did the locking - hold the lock whilst doing TXQ manipulation (add/remove/state changes) and then reacquire it whilst fiddling with the per-TID state. The lock isn't to be held across TX buffer completion. This commit partially implements this: * the non-aggregation pathway doesn't hold the lock across the completion handler * the aggregation pathway for single packets doesn't hold the lock across the completion handler * the aggregation pathway for aggregate frames now delays calling the completion handler until the TID state (BAW, etc) has been updated; it's done at the end of the function. The error and cleanup pathways will be fixed in a subsequent commit. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Sat Sep 17 22:53:05 2011 (r225644) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Sun Sep 18 07:20:59 2011 (r225645) @@ -4350,11 +4350,12 @@ ath_tx_processq(struct ath_softc *sc, st (caddr_t)(uintptr_t) ath_hal_gettxbuf(sc->sc_ah, txq->axq_qnum), txq->axq_link); nacked = 0; - ATH_TXQ_LOCK(txq); for (;;) { + ATH_TXQ_LOCK(txq); txq->axq_intrcnt = 0; /* reset periodic desc intr count */ bf = TAILQ_FIRST(&txq->axq_q); if (bf == NULL) { + ATH_TXQ_UNLOCK(txq); break; } ds = bf->bf_lastds; /* XXX must be setup correctly! */ @@ -4366,6 +4367,7 @@ ath_tx_processq(struct ath_softc *sc, st status == HAL_OK); #endif if (status == HAL_EINPROGRESS) { + ATH_TXQ_UNLOCK(txq); break; } ATH_TXQ_REMOVE(txq, bf, bf_list); @@ -4402,6 +4404,7 @@ ath_tx_processq(struct ath_softc *sc, st ATH_RSSI_LPF(sc->sc_halstats.ns_avgtxrssi, ts->ts_rssi); } + ATH_TXQ_UNLOCK(txq); /* If unicast frame, update general statistics */ if (ni != NULL) { @@ -4458,6 +4461,7 @@ ath_tx_processq(struct ath_softc *sc, st #endif /* Kick the TXQ scheduler */ + ATH_TXQ_LOCK(txq); ath_txq_sched(sc, txq); ATH_TXQ_UNLOCK(txq); @@ -4633,11 +4637,12 @@ ath_tx_draintxq(struct ath_softc *sc, st bf->bf_flags &= ~ATH_BUF_BUSY; ATH_TXBUF_UNLOCK(sc); - ATH_TXQ_LOCK(txq); for (ix = 0;; ix++) { + ATH_TXQ_LOCK(txq); bf = TAILQ_FIRST(&txq->axq_q); if (bf == NULL) { txq->axq_link = NULL; + ATH_TXQ_UNLOCK(txq); break; } ATH_TXQ_REMOVE(txq, bf, bf_list); @@ -4664,6 +4669,7 @@ ath_tx_draintxq(struct ath_softc *sc, st * Clear ATH_BUF_BUSY; the completion handler * will free the buffer. */ + ATH_TXQ_UNLOCK(txq); bf->bf_flags &= ~ATH_BUF_BUSY; if (bf->bf_comp) bf->bf_comp(sc, bf, 1); @@ -4675,6 +4681,7 @@ ath_tx_draintxq(struct ath_softc *sc, st * Drain software queued frames which are on * active TIDs. */ + ATH_TXQ_LOCK(txq); ath_tx_txq_drain(sc, txq); ATH_TXQ_UNLOCK(txq); } Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sat Sep 17 22:53:05 2011 (r225644) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 18 07:20:59 2011 (r225645) @@ -2318,10 +2318,6 @@ ath_tx_tid_drain(struct ath_softc *sc, s * This occurs when a completion handler frees the last buffer * for a node, and the node is thus freed. This causes the node * to be cleaned up, which ends up calling ath_tx_node_flush. - * - * XXX Because the TXQ may be locked right now (when it's called - * XXX from a completion handler which frees the last node) - * XXX do a dirty recursive hack avoidance. */ void ath_tx_node_flush(struct ath_softc *sc, struct ath_node *an) @@ -2331,20 +2327,14 @@ ath_tx_node_flush(struct ath_softc *sc, for (tid = 0; tid < IEEE80211_TID_SIZE; tid++) { struct ath_tid *atid = &an->an_tid[tid]; struct ath_txq *txq = sc->sc_ac2q[atid->ac]; - int islocked = 0; /* Remove this tid from the list of active tids */ - /* XXX eww, this needs to be fixed */ - if (ATH_TXQ_IS_LOCKED(txq)) - islocked = 1; - else - ATH_TXQ_LOCK(txq); + ATH_TXQ_LOCK(txq); ath_tx_tid_unsched(sc, an, atid); /* Free packets */ ath_tx_tid_drain(sc, an, atid); - if (! islocked) - ATH_TXQ_UNLOCK(txq); + ATH_TXQ_UNLOCK(txq); } } @@ -2407,7 +2397,8 @@ ath_tx_normal_comp(struct ath_softc *sc, struct ath_tid *atid = &an->an_tid[tid]; struct ath_tx_status *ts = &bf->bf_status.ds_txstat; - ATH_TXQ_LOCK_ASSERT(sc->sc_ac2q[atid->ac]); + /* The TID state is protected behind the TXQ lock */ + ATH_TXQ_LOCK(sc->sc_ac2q[atid->ac]); DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: fail=%d, hwq_depth now %d\n", __func__, bf, fail, atid->hwq_depth - 1); @@ -2416,6 +2407,7 @@ ath_tx_normal_comp(struct ath_softc *sc, if (atid->hwq_depth < 0) device_printf(sc->sc_dev, "%s: hwq_depth < 0: %d\n", __func__, atid->hwq_depth); + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); /* * punt to rate control if we're not being cleaned up @@ -2898,6 +2890,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * struct ath_tx_status ts; struct ieee80211_tx_ampdu *tap; ath_bufhead bf_q; + ath_bufhead bf_cq; int seq_st, tx_ok; int hasba, isaggr; uint32_t ba[2]; @@ -2912,7 +2905,8 @@ ath_tx_aggr_comp_aggr(struct ath_softc * DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: called; hwq_depth=%d\n", __func__, atid->hwq_depth); - ATH_TXQ_LOCK_ASSERT(sc->sc_ac2q[atid->ac]); + /* The TID state is kept behind the TXQ lock */ + ATH_TXQ_LOCK(sc->sc_ac2q[atid->ac]); atid->hwq_depth--; if (atid->hwq_depth < 0) @@ -2924,6 +2918,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * */ if (0 && atid->cleanup_inprogress) { ath_tx_comp_cleanup_aggr(sc, bf_first); + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); return; } @@ -2943,10 +2938,12 @@ ath_tx_aggr_comp_aggr(struct ath_softc * */ if (ts.ts_status & HAL_TXERR_XRETRY) { ath_tx_comp_aggr_error(sc, bf_first, atid); + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); return; } TAILQ_INIT(&bf_q); + TAILQ_INIT(&bf_cq); tap = ath_tx_get_tx_tid(an, tid); /* @@ -2993,6 +2990,20 @@ ath_tx_aggr_comp_aggr(struct ath_softc * /* bf_first is going to be invalid once this list is walked */ bf_first = NULL; + /* + * Walk the list of completed frames and determine + * which need to be completed and which need to be + * retransmitted. + * + * For completed frames, the completion functions need + * to be called at the end of this function as the last + * node reference may free the node. + * + * Finally, since the TXQ lock can't be held during the + * completion callback (to avoid lock recursion), + * the completion calls have to be done outside of the + * lock. + */ while (bf) { nframes++; ba_index = ATH_BA_INDEX(seq_st, SEQNO(bf->bf_state.bfs_seqno)); @@ -3012,7 +3023,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * device_printf(sc->sc_dev, "%s: wasn't added: seqno %d\n", __func__, SEQNO(bf->bf_state.bfs_seqno)); - ath_tx_default_comp(sc, bf, 0); + TAILQ_INSERT_TAIL(&bf_cq, bf, bf_list); } else { drops += ath_tx_retry_subframe(sc, bf, &bf_q); nbad++; @@ -3020,6 +3031,9 @@ ath_tx_aggr_comp_aggr(struct ath_softc * bf = bf_next; } + /* Now that the BAW updates have been done, unlock */ + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); + if (nframes != nf) device_printf(sc->sc_dev, "%s: num frames seen=%d; bf nframes=%d\n", @@ -3054,15 +3068,23 @@ ath_tx_aggr_comp_aggr(struct ath_softc * #endif /* Prepend all frames to the beginning of the queue */ + ATH_TXQ_LOCK(sc->sc_ac2q[atid->ac]); while ((bf = TAILQ_LAST(&bf_q, ath_bufhead_s)) != NULL) { TAILQ_REMOVE(&bf_q, bf, bf_list); ATH_TXQ_INSERT_HEAD(atid, bf, bf_list); } ath_tx_tid_sched(sc, an, atid); + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, - "%s: finished; txa_start now %d\n", __func__, tap->txa_start); + "%s: txa_start now %d\n", __func__, tap->txa_start); + + /* Do deferred completion */ + while ((bf = TAILQ_FIRST(&bf_cq)) != NULL) { + TAILQ_REMOVE(&bf_cq, bf, bf_list); + ath_tx_default_comp(sc, bf, 0); + } } /* @@ -3081,7 +3103,7 @@ ath_tx_aggr_comp_unaggr(struct ath_softc struct ath_tid *atid = &an->an_tid[tid]; struct ath_tx_status *ts = &bf->bf_status.ds_txstat; - ATH_TXQ_LOCK_ASSERT(sc->sc_ac2q[atid->ac]); + ATH_TXQ_LOCK(sc->sc_ac2q[atid->ac]); if (tid == IEEE80211_NONQOS_TID) device_printf(sc->sc_dev, "%s: TID=16!\n", __func__); @@ -3112,6 +3134,7 @@ ath_tx_aggr_comp_unaggr(struct ath_softc */ if (atid->cleanup_inprogress) { ath_tx_comp_cleanup_unaggr(sc, bf); + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); return; } @@ -3121,6 +3144,7 @@ ath_tx_aggr_comp_unaggr(struct ath_softc */ if (fail == 0 && ts->ts_status & HAL_TXERR_XRETRY) { ath_tx_aggr_retry_unaggr(sc, bf); + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); return; } @@ -3136,6 +3160,8 @@ ath_tx_aggr_comp_unaggr(struct ath_softc __func__, SEQNO(bf->bf_state.bfs_seqno)); } + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); + ath_tx_default_comp(sc, bf, fail); /* bf is freed at this point */ } From owner-svn-src-user@FreeBSD.ORG Sun Sep 18 08:26:58 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3446B106566C; Sun, 18 Sep 2011 08:26:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 187448FC12; Sun, 18 Sep 2011 08:26:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8I8QvXG020471; Sun, 18 Sep 2011 08:26:57 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8I8QvXH020468; Sun, 18 Sep 2011 08:26:57 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109180826.p8I8QvXH020468@svn.freebsd.org> From: Adrian Chadd Date: Sun, 18 Sep 2011 08:26:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225646 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Sep 2011 08:26:58 -0000 Author: adrian Date: Sun Sep 18 08:26:57 2011 New Revision: 225646 URL: http://svn.freebsd.org/changeset/base/225646 Log: Part 2 of the locking/completion overhaul. Update the rest of the flush, error and cleanup functions to delay calling the completion functions until the TXQ lock has been released. The TXQ locking in some instances is quite inefficient and should be tidied up before this is merged into -HEAD. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Sun Sep 18 07:20:59 2011 (r225645) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Sun Sep 18 08:26:57 2011 (r225646) @@ -4681,9 +4681,7 @@ ath_tx_draintxq(struct ath_softc *sc, st * Drain software queued frames which are on * active TIDs. */ - ATH_TXQ_LOCK(txq); ath_tx_txq_drain(sc, txq); - ATH_TXQ_UNLOCK(txq); } static void Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 18 07:20:59 2011 (r225645) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 18 08:26:57 2011 (r225646) @@ -2225,7 +2225,8 @@ ath_tx_tid_txq_unmark(struct ath_softc * * forward. */ static void -ath_tx_tid_drain(struct ath_softc *sc, struct ath_node *an, struct ath_tid *tid) +ath_tx_tid_drain(struct ath_softc *sc, struct ath_node *an, struct ath_tid *tid, + ath_bufhead *bf_cq) { struct ath_buf *bf; struct ieee80211_tx_ampdu *tap; @@ -2284,7 +2285,7 @@ ath_tx_tid_drain(struct ath_softc *sc, s __func__, SEQNO(bf->bf_state.bfs_seqno)); } ATH_TXQ_REMOVE(tid, bf, bf_list); - ath_tx_default_comp(sc, bf, 0); + TAILQ_INSERT_TAIL(bf_cq, bf, bf_list); } /* @@ -2323,6 +2324,10 @@ void ath_tx_node_flush(struct ath_softc *sc, struct ath_node *an) { int tid; + ath_bufhead bf_cq; + struct ath_buf *bf; + + TAILQ_INIT(&bf_cq); for (tid = 0; tid < IEEE80211_TID_SIZE; tid++) { struct ath_tid *atid = &an->an_tid[tid]; @@ -2333,9 +2338,15 @@ ath_tx_node_flush(struct ath_softc *sc, ath_tx_tid_unsched(sc, an, atid); /* Free packets */ - ath_tx_tid_drain(sc, an, atid); + ath_tx_tid_drain(sc, an, atid, &bf_cq); ATH_TXQ_UNLOCK(txq); } + + /* Handle completed frames */ + while ((bf = TAILQ_FIRST(&bf_cq)) != NULL) { + TAILQ_REMOVE(&bf_cq, bf, bf_list); + ath_tx_default_comp(sc, bf, 0); + } } /* @@ -2345,8 +2356,11 @@ void ath_tx_txq_drain(struct ath_softc *sc, struct ath_txq *txq) { struct ath_tid *tid; + ath_bufhead bf_cq; + struct ath_buf *bf; - ATH_TXQ_LOCK_ASSERT(txq); + TAILQ_INIT(&bf_cq); + ATH_TXQ_LOCK(txq); /* * Iterate over all active tids for the given txq, @@ -2354,10 +2368,16 @@ ath_tx_txq_drain(struct ath_softc *sc, s */ while (! TAILQ_EMPTY(&txq->axq_tidq)) { tid = TAILQ_FIRST(&txq->axq_tidq); - ath_tx_tid_drain(sc, tid->an, tid); + ath_tx_tid_drain(sc, tid->an, tid, &bf_cq); ath_tx_tid_unsched(sc, tid->an, tid); } + ATH_TXQ_UNLOCK(txq); + + while ((bf = TAILQ_FIRST(&bf_cq)) != NULL) { + TAILQ_REMOVE(&bf_cq, bf, bf_list); + ath_tx_default_comp(sc, bf, 0); + } } /* @@ -2433,13 +2453,10 @@ ath_tx_comp_cleanup_unaggr(struct ath_so int tid = bf->bf_state.bfs_tid; struct ath_tid *atid = &an->an_tid[tid]; - ATH_TXQ_LOCK_ASSERT(sc->sc_ac2q[atid->ac]); - DPRINTF(sc, ATH_DEBUG_SW_TX_CTRL, "%s: TID %d: incomp=%d\n", __func__, tid, atid->incomp); - ath_tx_default_comp(sc, bf, 0); - + ATH_TXQ_LOCK(sc->sc_ac2q[atid->ac]); atid->incomp--; if (atid->incomp == 0) { DPRINTF(sc, ATH_DEBUG_SW_TX_CTRL, @@ -2448,7 +2465,9 @@ ath_tx_comp_cleanup_unaggr(struct ath_so atid->cleanup_inprogress = 0; ath_tx_tid_resume(sc, atid); } + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); + ath_tx_default_comp(sc, bf, 0); } /* @@ -2468,11 +2487,13 @@ ath_tx_cleanup(struct ath_softc *sc, str struct ath_tid *atid = &an->an_tid[tid]; struct ieee80211_tx_ampdu *tap; struct ath_buf *bf, *bf_next; + ath_bufhead bf_cq; DPRINTF(sc, ATH_DEBUG_SW_TX_CTRL, "%s: TID %d: called\n", __func__, tid); - ATH_TXQ_LOCK_ASSERT(sc->sc_ac2q[atid->ac]); + TAILQ_INIT(&bf_cq); + ATH_TXQ_LOCK(sc->sc_ac2q[atid->ac]); /* * Update the frames in the software TX queue: @@ -2499,7 +2520,7 @@ ath_tx_cleanup(struct ath_softc *sc, str * Call the default completion handler with "fail" just * so upper levels are suitably notified about this. */ - ath_tx_default_comp(sc, bf, 1); + TAILQ_INSERT_TAIL(&bf_cq, bf, bf_list); bf = bf_next; continue; } @@ -2544,6 +2565,13 @@ ath_tx_cleanup(struct ath_softc *sc, str DPRINTF(sc, ATH_DEBUG_SW_TX_CTRL, "%s: TID %d: cleanup needed: %d packets\n", __func__, tid, atid->incomp); + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); + + /* Handle completing frames and fail them */ + while ((bf = TAILQ_FIRST(&bf_cq)) != NULL) { + TAILQ_REMOVE(&bf_cq, bf, bf_list); + ath_tx_default_comp(sc, bf, 1); + } } static void @@ -2621,6 +2649,8 @@ ath_tx_aggr_retry_unaggr(struct ath_soft struct ath_tid *atid = &an->an_tid[tid]; struct ieee80211_tx_ampdu *tap; + ATH_TXQ_LOCK(sc->sc_ac2q[atid->ac]); + tap = ath_tx_get_tx_tid(an, tid); /* @@ -2683,8 +2713,8 @@ ath_tx_aggr_retry_unaggr(struct ath_soft #endif /* Free buffer, bf is free after this call */ + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); ath_tx_default_comp(sc, bf, 0); - return; } @@ -2701,6 +2731,8 @@ ath_tx_aggr_retry_unaggr(struct ath_soft */ ATH_TXQ_INSERT_HEAD(atid, bf, bf_list); ath_tx_tid_sched(sc, an, atid); + + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); } /* @@ -2755,8 +2787,6 @@ ath_tx_retry_subframe(struct ath_softc * "%s: wasn't added: seqno %d\n", __func__, SEQNO(bf->bf_state.bfs_seqno)); bf->bf_state.bfs_dobaw = 0; - /* XXX subframe completion status? is that valid here? */ - ath_tx_default_comp(sc, bf, 0); return 1; } @@ -2780,12 +2810,14 @@ ath_tx_comp_aggr_error(struct ath_softc ath_bufhead bf_q; int drops = 0; struct ieee80211_tx_ampdu *tap; + ath_bufhead bf_cq; - ATH_TXQ_LOCK_ASSERT(sc->sc_ac2q[tid->ac]); + ATH_TXQ_LOCK(sc->sc_ac2q[tid->ac]); tap = ath_tx_get_tx_tid(an, tid->tid); TAILQ_INIT(&bf_q); + TAILQ_INIT(&bf_cq); sc->sc_stats.ast_tx_aggrfail++; /* @@ -2804,7 +2836,11 @@ ath_tx_comp_aggr_error(struct ath_softc while (bf) { bf_next = bf->bf_next; bf->bf_next = NULL; /* Remove it from the aggr list */ - drops += ath_tx_retry_subframe(sc, bf, &bf_q); + if (ath_tx_retry_subframe(sc, bf, &bf_q)) { + drops++; + bf->bf_next = NULL; + TAILQ_INSERT_TAIL(&bf_cq, bf, bf_list); + } bf = bf_next; } @@ -2836,6 +2872,13 @@ ath_tx_comp_aggr_error(struct ath_softc } ath_tx_tid_sched(sc, an, tid); + ATH_TXQ_UNLOCK(sc->sc_ac2q[tid->ac]); + + /* Complete frames which errored out */ + while ((bf = TAILQ_FIRST(&bf_cq)) != NULL) { + TAILQ_REMOVE(&bf_cq, bf, bf_list); + ath_tx_default_comp(sc, bf, 0); + } } /* @@ -2853,12 +2896,12 @@ ath_tx_comp_cleanup_aggr(struct ath_soft bf = bf_first; + ATH_TXQ_LOCK(sc->sc_ac2q[atid->ac]); + + /* update incomp */ while (bf) { atid->incomp--; - bf_next = bf->bf_next; - bf->bf_next = NULL; /* Remove it from the aggr list */ - ath_tx_default_comp(sc, bf, 1); - bf = bf_next; + bf = bf->bf_next; } if (atid->incomp == 0) { @@ -2868,7 +2911,14 @@ ath_tx_comp_cleanup_aggr(struct ath_soft atid->cleanup_inprogress = 0; ath_tx_tid_resume(sc, atid); } + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); + /* Handle frame completion */ + while (bf) { + bf_next = bf->bf_next; + ath_tx_default_comp(sc, bf, 1); + bf = bf_next; + } } /* @@ -2917,8 +2967,8 @@ ath_tx_aggr_comp_aggr(struct ath_softc * * Punt cleanup to the relevant function, not our problem now */ if (0 && atid->cleanup_inprogress) { - ath_tx_comp_cleanup_aggr(sc, bf_first); ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); + ath_tx_comp_cleanup_aggr(sc, bf_first); return; } @@ -2937,8 +2987,8 @@ ath_tx_aggr_comp_aggr(struct ath_softc * * handle errors first */ if (ts.ts_status & HAL_TXERR_XRETRY) { - ath_tx_comp_aggr_error(sc, bf_first, atid); ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); + ath_tx_comp_aggr_error(sc, bf_first, atid); return; } @@ -3023,9 +3073,14 @@ ath_tx_aggr_comp_aggr(struct ath_softc * device_printf(sc->sc_dev, "%s: wasn't added: seqno %d\n", __func__, SEQNO(bf->bf_state.bfs_seqno)); + bf->bf_next = NULL; TAILQ_INSERT_TAIL(&bf_cq, bf, bf_list); } else { - drops += ath_tx_retry_subframe(sc, bf, &bf_q); + if (ath_tx_retry_subframe(sc, bf, &bf_q)) { + drops++; + bf->bf_next = NULL; + TAILQ_INSERT_TAIL(&bf_cq, bf, bf_list); + } nbad++; } bf = bf_next; @@ -3103,6 +3158,23 @@ ath_tx_aggr_comp_unaggr(struct ath_softc struct ath_tid *atid = &an->an_tid[tid]; struct ath_tx_status *ts = &bf->bf_status.ds_txstat; + /* + * Update rate control status here, before we possibly + * punt to retry or cleanup. + * + * Do it outside of the TXQ lock. + */ + if (fail == 0 && ((bf->bf_txflags & HAL_TXDESC_NOACK) == 0)) + ath_tx_update_ratectrl(sc, ni, bf->bf_state.bfs_rc, + &bf->bf_status.ds_txstat, + bf->bf_state.bfs_pktlen, + 1, (ts->ts_status == 0) ? 0 : 1); + + /* + * This is called early so atid->hwq_depth can be tracked. + * This unfortunately means that it's released and regrabbed + * during retry and cleanup. That's rather inefficient. + */ ATH_TXQ_LOCK(sc->sc_ac2q[atid->ac]); if (tid == IEEE80211_NONQOS_TID) @@ -3117,24 +3189,14 @@ ath_tx_aggr_comp_unaggr(struct ath_softc __func__, atid->hwq_depth); /* - * Update rate control status here, before we possibly - * punt to retry or cleanup. - */ - if (fail == 0 && ((bf->bf_txflags & HAL_TXDESC_NOACK) == 0)) - ath_tx_update_ratectrl(sc, ni, bf->bf_state.bfs_rc, - &bf->bf_status.ds_txstat, - bf->bf_state.bfs_pktlen, - 1, (ts->ts_status == 0) ? 0 : 1); - - /* * If a cleanup is in progress, punt to comp_cleanup; * rather than handling it here. It's thus their * responsibility to clean up, call the completion * function in net80211, etc. */ if (atid->cleanup_inprogress) { - ath_tx_comp_cleanup_unaggr(sc, bf); ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); + ath_tx_comp_cleanup_unaggr(sc, bf); return; } @@ -3143,8 +3205,8 @@ ath_tx_aggr_comp_unaggr(struct ath_softc * are being failed (eg during queue deletion.) */ if (fail == 0 && ts->ts_status & HAL_TXERR_XRETRY) { - ath_tx_aggr_retry_unaggr(sc, bf); ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); + ath_tx_aggr_retry_unaggr(sc, bf); return; } @@ -3668,14 +3730,12 @@ ath_addba_stop(struct ieee80211_node *ni /* There's no need to hold the TXQ lock here */ sc->sc_addba_stop(ni, tap); - ATH_TXQ_LOCK(sc->sc_ac2q[atid->ac]); /* * ath_tx_cleanup will resume the TID if possible, otherwise * it'll set the cleanup flag, and it'll be unpaused once * things have been cleaned up. */ ath_tx_cleanup(sc, an, tid); - ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); } /* From owner-svn-src-user@FreeBSD.ORG Sun Sep 18 09:05:43 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DC0A1065676; Sun, 18 Sep 2011 09:05:43 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A0728FC17; Sun, 18 Sep 2011 09:05:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8I95hkd023132; Sun, 18 Sep 2011 09:05:43 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8I95hbY023130; Sun, 18 Sep 2011 09:05:43 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109180905.p8I95hbY023130@svn.freebsd.org> From: Adrian Chadd Date: Sun, 18 Sep 2011 09:05:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225647 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Sep 2011 09:05:43 -0000 Author: adrian Date: Sun Sep 18 09:05:42 2011 New Revision: 225647 URL: http://svn.freebsd.org/changeset/base/225647 Log: Enable printf's where a BAR frame _would_ be TXed. I'm doing this so I (and testers) can keep track of when BAR's should be TXed. This way if traffic pauses are seen that coincide with this BAR message, we can (hopefully!) assume that a BAR frame exchange would've flushed things correctly. This also will let me implement/debug the "correct" sending of BAR frames - ie, sending them when the TID has been emptied rather than on each failed software retry attempt. That could get slightly spammy. There's a few places where BAR frames should likely be TX'ed, specifically when a TID flush is done (and the node isn't being deleted.) But that'll come in the next phase of work. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 18 08:26:57 2011 (r225646) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 18 09:05:42 2011 (r225647) @@ -2694,9 +2694,10 @@ ath_tx_aggr_retry_unaggr(struct ath_soft * This'll end up going into net80211 and back out * again, via ic->ic_raw_xmit(). */ + device_printf(sc->sc_dev, + "%s: TID %d: send BAR; seq %d\n", + __func__, tid, ni->ni_txseqs[tid]); #if 0 - DPRINTF(sc, ATH_DEBUG_SW_TX_CTRL, "%s: TID %d: send BAR\n", - __func__, tid); if (ieee80211_send_bar(ni, tap, ni->ni_txseqs[tid]) == 0) { /* * Pause the TID if this was successful. @@ -2844,11 +2845,15 @@ ath_tx_comp_aggr_error(struct ath_softc bf = bf_next; } -#if 0 /* * send bar if we dropped any frames */ if (drops) { + device_printf(sc->sc_dev, + "%s: TID %d: send BAR; seq %d\n", + __func__, tid->tid, + ni->ni_txseqs[tid->tid]); +#if 0 if (ieee80211_send_bar(ni, tap, ni->ni_txseqs[tid->tid]) == 0) { /* * Pause the TID if this was successful. @@ -2862,8 +2867,8 @@ ath_tx_comp_aggr_error(struct ath_softc "%s: TID %d: BAR TX failed\n", __func__, tid->tid); } - } #endif + } /* Prepend all frames to the beginning of the queue */ while ((bf = TAILQ_LAST(&bf_q, ath_bufhead_s)) != NULL) { From owner-svn-src-user@FreeBSD.ORG Sun Sep 18 09:42:21 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5497106566C; Sun, 18 Sep 2011 09:42:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A45018FC0A; Sun, 18 Sep 2011 09:42:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8I9gLB4024599; Sun, 18 Sep 2011 09:42:21 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8I9gLTc024597; Sun, 18 Sep 2011 09:42:21 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109180942.p8I9gLTc024597@svn.freebsd.org> From: Adrian Chadd Date: Sun, 18 Sep 2011 09:42:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225648 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Sep 2011 09:42:21 -0000 Author: adrian Date: Sun Sep 18 09:42:21 2011 New Revision: 225648 URL: http://svn.freebsd.org/changeset/base/225648 Log: Move the lock around so it happens after the rate control update is done. (That way the ath_node lock and txq lock aren't held at the same time.) Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 18 09:05:42 2011 (r225647) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 18 09:42:21 2011 (r225648) @@ -2813,10 +2813,6 @@ ath_tx_comp_aggr_error(struct ath_softc struct ieee80211_tx_ampdu *tap; ath_bufhead bf_cq; - ATH_TXQ_LOCK(sc->sc_ac2q[tid->ac]); - - tap = ath_tx_get_tx_tid(an, tid->tid); - TAILQ_INIT(&bf_q); TAILQ_INIT(&bf_cq); sc->sc_stats.ast_tx_aggrfail++; @@ -2832,6 +2828,9 @@ ath_tx_comp_aggr_error(struct ath_softc bf_first->bf_state.bfs_pktlen, bf_first->bf_state.bfs_nframes, bf_first->bf_state.bfs_nframes); + ATH_TXQ_LOCK(sc->sc_ac2q[tid->ac]); + tap = ath_tx_get_tx_tid(an, tid->tid); + /* Retry all subframes */ bf = bf_first; while (bf) { From owner-svn-src-user@FreeBSD.ORG Sun Sep 18 13:05:39 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A878F106564A; Sun, 18 Sep 2011 13:05:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E7278FC12; Sun, 18 Sep 2011 13:05:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8ID5dWl034712; Sun, 18 Sep 2011 13:05:39 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8ID5dn9034709; Sun, 18 Sep 2011 13:05:39 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109181305.p8ID5dn9034709@svn.freebsd.org> From: Adrian Chadd Date: Sun, 18 Sep 2011 13:05:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225650 - in user/adrian/if_ath_tx/sys/dev/ath/ath_hal: . ar5416 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Sep 2011 13:05:39 -0000 Author: adrian Date: Sun Sep 18 13:05:39 2011 New Revision: 225650 URL: http://svn.freebsd.org/changeset/base/225650 Log: Rename the RX clear hangs so I get a better idea of who/what is causing them. Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ah_internal.h user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ah_internal.h Sun Sep 18 11:07:51 2011 (r225649) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ah_internal.h Sun Sep 18 13:05:39 2011 (r225650) @@ -640,6 +640,10 @@ enum { HAL_BB_HANG_DFS = 0x0001, HAL_BB_HANG_RIFS = 0x0002, HAL_BB_HANG_RX_CLEAR = 0x0004, + HAL_BB_HANG_RX_CLEAR_1 = 0x0008, + HAL_BB_HANG_RX_CLEAR_2 = 0x0010, + HAL_BB_HANG_RX_CLEAR_3 = 0x0020, + HAL_BB_HANG_RX_CLEAR_4 = 0x0040, HAL_BB_HANG_UNKNOWN = 0x0080, HAL_MAC_HANG_SIG1 = 0x0100, @@ -649,6 +653,10 @@ enum { HAL_BB_HANGS = HAL_BB_HANG_DFS | HAL_BB_HANG_RIFS | HAL_BB_HANG_RX_CLEAR + | HAL_BB_HANG_RX_CLEAR_1 + | HAL_BB_HANG_RX_CLEAR_2 + | HAL_BB_HANG_RX_CLEAR_3 + | HAL_BB_HANG_RX_CLEAR_4 | HAL_BB_HANG_UNKNOWN, HAL_MAC_HANGS = HAL_MAC_HANG_SIG1 | HAL_MAC_HANG_SIG2 Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Sun Sep 18 11:07:51 2011 (r225649) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Sun Sep 18 13:05:39 2011 (r225650) @@ -649,10 +649,10 @@ ar5416DetectBBHang(struct ath_hal *ah) /* Reg Value Reg Mask Hang Code XXX */ { 0x1E000000, 0x7E000B00, HAL_BB_HANG_DFS }, { 0x52000B00, 0x7E000B00, HAL_BB_HANG_RIFS }, - { 0x18000B00, 0x7E000B00, HAL_BB_HANG_RX_CLEAR }, - { 0x00702400, 0x7E7FFFEF, HAL_BB_HANG_RX_CLEAR }, - { 0x18002313, 0x7EF3FFFF, HAL_BB_HANG_RX_CLEAR }, - { 0x00902400, 0x5DF3FFEE, HAL_BB_HANG_RX_CLEAR }, + { 0x18000B00, 0x7E000B00, HAL_BB_HANG_RX_CLEAR_1 }, + { 0x00702400, 0x7E7FFFEF, HAL_BB_HANG_RX_CLEAR_2 }, + { 0x18002313, 0x7EF3FFFF, HAL_BB_HANG_RX_CLEAR_3 }, + { 0x00902400, 0x5DF3FFEE, HAL_BB_HANG_RX_CLEAR_4 }, }; uint32_t hang_sig; int i; From owner-svn-src-user@FreeBSD.ORG Sun Sep 18 13:28:56 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7BD2106564A; Sun, 18 Sep 2011 13:28:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B786D8FC0C; Sun, 18 Sep 2011 13:28:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8IDSuv7035641; Sun, 18 Sep 2011 13:28:56 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8IDSuhq035639; Sun, 18 Sep 2011 13:28:56 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109181328.p8IDSuhq035639@svn.freebsd.org> From: Adrian Chadd Date: Sun, 18 Sep 2011 13:28:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225651 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Sep 2011 13:28:56 -0000 Author: adrian Date: Sun Sep 18 13:28:56 2011 New Revision: 225651 URL: http://svn.freebsd.org/changeset/base/225651 Log: Update the comment to reflect reality. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 18 13:05:39 2011 (r225650) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 18 13:28:56 2011 (r225651) @@ -2181,9 +2181,6 @@ ath_tx_tid_pause(struct ath_softc *sc, s /* * Unpause the current TID, and schedule it if needed. - * - * Since this is called from upper layers as well as the driver, - * it will get the TID lock and the TXQ lock if needed. */ static void ath_tx_tid_resume(struct ath_softc *sc, struct ath_tid *tid) From owner-svn-src-user@FreeBSD.ORG Sun Sep 18 14:17:16 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 393FD106564A; Sun, 18 Sep 2011 14:17:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 287C38FC15; Sun, 18 Sep 2011 14:17:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8IEHGUx037152; Sun, 18 Sep 2011 14:17:16 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8IEHGVj037149; Sun, 18 Sep 2011 14:17:16 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109181417.p8IEHGVj037149@svn.freebsd.org> From: Adrian Chadd Date: Sun, 18 Sep 2011 14:17:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225652 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Sep 2011 14:17:16 -0000 Author: adrian Date: Sun Sep 18 14:17:15 2011 New Revision: 225652 URL: http://svn.freebsd.org/changeset/base/225652 Log: Some TID sched/unsched changes to try and better balance per-node traffic. The reference driver does a basic FIFO implementation for scheduling traffic from TIDs to the hardware queue. This is an implementation of that, inspired by Linux ath9k. Whilst I'm at it, eliminate a unneeded parameter from the tid sched/unsched functions. Obtained from: Linux ath9k, Atheros Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 18 13:28:56 2011 (r225651) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 18 14:17:15 2011 (r225652) @@ -1902,8 +1902,7 @@ ath_tx_update_baw(struct ath_softc *sc, * The TXQ lock must be held. */ static void -ath_tx_tid_sched(struct ath_softc *sc, struct ath_node *an, - struct ath_tid *tid) +ath_tx_tid_sched(struct ath_softc *sc, struct ath_tid *tid) { struct ath_txq *txq = sc->sc_ac2q[tid->ac]; @@ -1927,8 +1926,7 @@ ath_tx_tid_sched(struct ath_softc *sc, s * The TXQ lock must be held. */ static void -ath_tx_tid_unsched(struct ath_softc *sc, struct ath_node *an, - struct ath_tid *tid) +ath_tx_tid_unsched(struct ath_softc *sc, struct ath_tid *tid) { struct ath_txq *txq = sc->sc_ac2q[tid->ac]; @@ -2021,7 +2019,7 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, SEQNO(bf->bf_state.bfs_seqno)))) { ATH_TXQ_INSERT_TAIL(tid, bf, bf_list); - ath_tx_tid_sched(sc, an, tid); + ath_tx_tid_sched(sc, tid); return; } @@ -2102,7 +2100,7 @@ ath_tx_swq(struct ath_softc *sc, struct ath_tx_xmit_aggr(sc, an, bf); else { ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); - ath_tx_tid_sched(sc, an, atid); + ath_tx_tid_sched(sc, atid); } } else if (txq->axq_depth < sc->sc_hwq_limit) { /* AMPDU not running, attempt direct dispatch */ @@ -2110,7 +2108,7 @@ ath_tx_swq(struct ath_softc *sc, struct } else { /* Busy; queue */ ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); - ath_tx_tid_sched(sc, an, atid); + ath_tx_tid_sched(sc, atid); } ATH_TXQ_UNLOCK(txq); } @@ -2196,7 +2194,7 @@ ath_tx_tid_resume(struct ath_softc *sc, return; } - ath_tx_tid_sched(sc, tid->an, tid); + ath_tx_tid_sched(sc, tid); } static void @@ -2332,7 +2330,7 @@ ath_tx_node_flush(struct ath_softc *sc, /* Remove this tid from the list of active tids */ ATH_TXQ_LOCK(txq); - ath_tx_tid_unsched(sc, an, atid); + ath_tx_tid_unsched(sc, atid); /* Free packets */ ath_tx_tid_drain(sc, an, atid, &bf_cq); @@ -2366,7 +2364,7 @@ ath_tx_txq_drain(struct ath_softc *sc, s while (! TAILQ_EMPTY(&txq->axq_tidq)) { tid = TAILQ_FIRST(&txq->axq_tidq); ath_tx_tid_drain(sc, tid->an, tid, &bf_cq); - ath_tx_tid_unsched(sc, tid->an, tid); + ath_tx_tid_unsched(sc, tid); } ATH_TXQ_UNLOCK(txq); @@ -2728,7 +2726,7 @@ ath_tx_aggr_retry_unaggr(struct ath_soft * retried before any current/subsequent frames. */ ATH_TXQ_INSERT_HEAD(atid, bf, bf_list); - ath_tx_tid_sched(sc, an, atid); + ath_tx_tid_sched(sc, atid); ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); } @@ -2872,7 +2870,7 @@ ath_tx_comp_aggr_error(struct ath_softc ATH_TXQ_INSERT_HEAD(tid, bf, bf_list); } - ath_tx_tid_sched(sc, an, tid); + ath_tx_tid_sched(sc, tid); ATH_TXQ_UNLOCK(sc->sc_ac2q[tid->ac]); /* Complete frames which errored out */ @@ -3130,7 +3128,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * ATH_TXQ_INSERT_HEAD(atid, bf, bf_list); } - ath_tx_tid_sched(sc, an, atid); + ath_tx_tid_sched(sc, atid); ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, @@ -3486,11 +3484,20 @@ ath_tx_tid_hw_queue_norm(struct ath_soft * This function walks the list of TIDs (ie, ath_node TIDs * with queued traffic) and attempts to schedule traffic * from them. + * + * TID's are rescheduled in a FIFO method - ie, once they've + * been handled, if they're removed and re-added to the end of + * the queue if they have more traffic. The hardware takes care + * of implementing the hardware side of WME QoS scheduling. + * + * Since the TXQ lock is held here, it should be safe to take + * a pointer to the last ath_tid in the TXQ array, as nothing + * in the scheduler should cause it to disappear. */ void ath_txq_sched(struct ath_softc *sc, struct ath_txq *txq) { - struct ath_tid *tid, *next; + struct ath_tid *tid, *next, *last_tid = NULL; ATH_TXQ_LOCK_ASSERT(txq); @@ -3504,35 +3511,43 @@ ath_txq_sched(struct ath_softc *sc, stru return; } - /* - * For now, let's not worry about QoS, fair-scheduling - * or the like. That's a later problem. Just throw - * packets at the hardware. - */ + last_tid = TAILQ_LAST(&txq->axq_tidq, axq_t_s); + TAILQ_FOREACH_SAFE(tid, &txq->axq_tidq, axq_qelem, next) { /* + * Remove the entry; we'll re-queue it at the end + * if it needs to be. + */ + ath_tx_tid_unsched(sc, tid); + + /* * Suspend paused queues here; they'll be resumed * once the addba completes or times out. */ DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: tid=%d, paused=%d\n", __func__, tid->tid, tid->paused); - if (tid->paused) { - ath_tx_tid_unsched(sc, tid->an, tid); + if (tid->paused) continue; - } + if (ath_tx_ampdu_running(sc, tid->an, tid->tid)) ath_tx_tid_hw_queue_aggr(sc, tid->an, tid); else ath_tx_tid_hw_queue_norm(sc, tid->an, tid); - /* Empty? Remove */ - if (tid->axq_depth == 0) - ath_tx_tid_unsched(sc, tid->an, tid); + /* Still has frames? Re-schedule */ + if (tid->axq_depth > 0) + ath_tx_tid_sched(sc, tid); /* Give the software queue time to aggregate more packets */ if (txq->axq_aggr_depth >= sc->sc_hwq_limit) { break; } + + /* + * If this is the last TID in the original list, break. + */ + if (tid == last_tid) + break; } } Modified: user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Sun Sep 18 13:28:56 2011 (r225651) +++ user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Sun Sep 18 14:17:15 2011 (r225652) @@ -282,7 +282,7 @@ struct ath_txq { char axq_name[12]; /* e.g. "ath0_txq4" */ /* Per-TID traffic queue for software -> hardware TX */ - TAILQ_HEAD(,ath_tid) axq_tidq; + TAILQ_HEAD(axq_t_s,ath_tid) axq_tidq; }; #define ATH_NODE_LOCK(_an) mtx_lock(&(_an)->an_mtx) From owner-svn-src-user@FreeBSD.ORG Sun Sep 18 15:11:54 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 683E7106566B; Sun, 18 Sep 2011 15:11:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 585D38FC13; Sun, 18 Sep 2011 15:11:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8IFBsHp038832; Sun, 18 Sep 2011 15:11:54 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8IFBsfH038830; Sun, 18 Sep 2011 15:11:54 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109181511.p8IFBsfH038830@svn.freebsd.org> From: Adrian Chadd Date: Sun, 18 Sep 2011 15:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225653 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Sep 2011 15:11:54 -0000 Author: adrian Date: Sun Sep 18 15:11:54 2011 New Revision: 225653 URL: http://svn.freebsd.org/changeset/base/225653 Log: Make sure a paused queue gets some frames re-scheduled to the hardware once it's unpaused or it'll hang until the next TX'ed frame occurs. Pointy hat to: adrian, for removing this call a while back and never remembering to restore it. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 18 14:17:15 2011 (r225652) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 18 15:11:54 2011 (r225653) @@ -2195,6 +2195,8 @@ ath_tx_tid_resume(struct ath_softc *sc, } ath_tx_tid_sched(sc, tid); + /* Punt some frames to the hardware if needed */ + ath_txq_sched(sc, sc->sc_ac2q[tid->ac]); } static void From owner-svn-src-user@FreeBSD.ORG Mon Sep 19 00:46:50 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 252BD106564A; Mon, 19 Sep 2011 00:46:50 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF6898FC18; Mon, 19 Sep 2011 00:46:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8J0knch056306; Mon, 19 Sep 2011 00:46:49 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8J0kn2R056304; Mon, 19 Sep 2011 00:46:49 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109190046.p8J0kn2R056304@svn.freebsd.org> From: Adrian Chadd Date: Mon, 19 Sep 2011 00:46:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225654 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 00:46:50 -0000 Author: adrian Date: Mon Sep 19 00:46:49 2011 New Revision: 225654 URL: http://svn.freebsd.org/changeset/base/225654 Log: Revert the FIFO TX scheduling part of the previous commit. There's a bug somewhere in the code which causes TX latency to jump dramatically and this indicates some scheduling bugs. I'll squeeze out those bugs and then re-commit the FIFO TX scheduling. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Sun Sep 18 15:11:54 2011 (r225653) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Mon Sep 19 00:46:49 2011 (r225654) @@ -3486,20 +3486,11 @@ ath_tx_tid_hw_queue_norm(struct ath_soft * This function walks the list of TIDs (ie, ath_node TIDs * with queued traffic) and attempts to schedule traffic * from them. - * - * TID's are rescheduled in a FIFO method - ie, once they've - * been handled, if they're removed and re-added to the end of - * the queue if they have more traffic. The hardware takes care - * of implementing the hardware side of WME QoS scheduling. - * - * Since the TXQ lock is held here, it should be safe to take - * a pointer to the last ath_tid in the TXQ array, as nothing - * in the scheduler should cause it to disappear. */ void ath_txq_sched(struct ath_softc *sc, struct ath_txq *txq) { - struct ath_tid *tid, *next, *last_tid = NULL; + struct ath_tid *tid, *next; ATH_TXQ_LOCK_ASSERT(txq); @@ -3513,43 +3504,35 @@ ath_txq_sched(struct ath_softc *sc, stru return; } - last_tid = TAILQ_LAST(&txq->axq_tidq, axq_t_s); - + /* + * For now, let's not worry about QoS, fair-scheduling + * or the like. That's a later problem. Just throw + * packets at the hardware. + */ TAILQ_FOREACH_SAFE(tid, &txq->axq_tidq, axq_qelem, next) { /* - * Remove the entry; we'll re-queue it at the end - * if it needs to be. - */ - ath_tx_tid_unsched(sc, tid); - - /* * Suspend paused queues here; they'll be resumed * once the addba completes or times out. */ DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: tid=%d, paused=%d\n", __func__, tid->tid, tid->paused); - if (tid->paused) + if (tid->paused) { + ath_tx_tid_unsched(sc, tid); continue; - + } if (ath_tx_ampdu_running(sc, tid->an, tid->tid)) ath_tx_tid_hw_queue_aggr(sc, tid->an, tid); else ath_tx_tid_hw_queue_norm(sc, tid->an, tid); - /* Still has frames? Re-schedule */ - if (tid->axq_depth > 0) - ath_tx_tid_sched(sc, tid); + /* Empty? Remove */ + if (tid->axq_depth == 0) + ath_tx_tid_unsched(sc, tid); /* Give the software queue time to aggregate more packets */ if (txq->axq_aggr_depth >= sc->sc_hwq_limit) { break; } - - /* - * If this is the last TID in the original list, break. - */ - if (tid == last_tid) - break; } } From owner-svn-src-user@FreeBSD.ORG Mon Sep 19 04:06:56 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDC75106564A; Mon, 19 Sep 2011 04:06:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE8D78FC08; Mon, 19 Sep 2011 04:06:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8J46ufg062531; Mon, 19 Sep 2011 04:06:56 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8J46uTs062528; Mon, 19 Sep 2011 04:06:56 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109190406.p8J46uTs062528@svn.freebsd.org> From: Adrian Chadd Date: Mon, 19 Sep 2011 04:06:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225655 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 04:06:56 -0000 Author: adrian Date: Mon Sep 19 04:06:56 2011 New Revision: 225655 URL: http://svn.freebsd.org/changeset/base/225655 Log: Flip on cleanup when disabling AMPDU. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Mon Sep 19 00:46:49 2011 (r225654) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Mon Sep 19 04:06:56 2011 (r225655) @@ -2967,7 +2967,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * /* * Punt cleanup to the relevant function, not our problem now */ - if (0 && atid->cleanup_inprogress) { + if (atid->cleanup_inprogress) { ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); ath_tx_comp_cleanup_aggr(sc, bf_first); return; From owner-svn-src-user@FreeBSD.ORG Mon Sep 19 04:08:52 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E17C3106564A; Mon, 19 Sep 2011 04:08:52 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D23058FC08; Mon, 19 Sep 2011 04:08:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8J48qj4062625; Mon, 19 Sep 2011 04:08:52 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8J48qNM062623; Mon, 19 Sep 2011 04:08:52 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109190408.p8J48qNM062623@svn.freebsd.org> From: Adrian Chadd Date: Mon, 19 Sep 2011 04:08:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225656 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 04:08:53 -0000 Author: adrian Date: Mon Sep 19 04:08:52 2011 New Revision: 225656 URL: http://svn.freebsd.org/changeset/base/225656 Log: Add a comment - there's no need to update the BAW here. It's likely I'll have to fiddle with the BAW flags though, or debugging messages will be triggered. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Mon Sep 19 04:06:56 2011 (r225655) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Mon Sep 19 04:08:52 2011 (r225656) @@ -2441,6 +2441,9 @@ ath_tx_normal_comp(struct ath_softc *sc, /* * Handle cleanup of aggregate session packets that aren't * an A-MPDU. + * + * There's no need to update the BAW here - the session is being + * torn down. */ static void ath_tx_comp_cleanup_unaggr(struct ath_softc *sc, struct ath_buf *bf) @@ -2884,7 +2887,9 @@ ath_tx_comp_aggr_error(struct ath_softc /* * Handle clean-up of packets from an aggregate list. - * XXX update BAW? + * + * There's no need to update the BAW here - the session is being + * torn down. */ static void ath_tx_comp_cleanup_aggr(struct ath_softc *sc, struct ath_buf *bf_first) From owner-svn-src-user@FreeBSD.ORG Mon Sep 19 08:01:21 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCB5A106566B; Mon, 19 Sep 2011 08:01:21 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABE3C8FC15; Mon, 19 Sep 2011 08:01:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8J81LxO069710; Mon, 19 Sep 2011 08:01:21 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8J81LqW069708; Mon, 19 Sep 2011 08:01:21 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109190801.p8J81LqW069708@svn.freebsd.org> From: Adrian Chadd Date: Mon, 19 Sep 2011 08:01:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225658 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 08:01:21 -0000 Author: adrian Date: Mon Sep 19 08:01:21 2011 New Revision: 225658 URL: http://svn.freebsd.org/changeset/base/225658 Log: First cut at enabling the TX of BAR frams. Currently ieee80211_send_bar() calls back into the driver via ic->ic_raw_xmit(). The driver has some special case code to directly dispatch BAR frames for this exact purpose. This means that the hardware TXQ lock is needed, so BAR frame TX must occur from _outside_ the TXQ lock. * Unlock the TXQ before attempting to send a BAR frame * Take a note of the txseq whilst inside the TXQ lock - although other contexts may allocate TX sequence numbers (and I'm about to stick that inside the TXQ lock too just to be safe), all frames from this point on have not yet attempted to be transmitted. So the TX sequence number at this point is fine as a left edge for the BAW. This has only received light testing due to some bugs I've introduced which make a fixed unicast rate no longer work (the multi-rate retry schedule is incorrectly being set.) This means that although I can trigger frame failure, it isn't predictable or guaranteed. I'll fix that in a subsequent commit and then properly test the aggregate and non-aggregate BAR pathways whilst traffic is ongoing. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Mon Sep 19 05:12:53 2011 (r225657) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Mon Sep 19 08:01:21 2011 (r225658) @@ -2648,6 +2648,7 @@ ath_tx_aggr_retry_unaggr(struct ath_soft int tid = bf->bf_state.bfs_tid; struct ath_tid *atid = &an->an_tid[tid]; struct ieee80211_tx_ampdu *tap; + int txseq; ATH_TXQ_LOCK(sc->sc_ac2q[atid->ac]); @@ -2694,11 +2695,18 @@ ath_tx_aggr_retry_unaggr(struct ath_soft * This'll end up going into net80211 and back out * again, via ic->ic_raw_xmit(). */ + txseq = ni->ni_txseqs[tid]; device_printf(sc->sc_dev, - "%s: TID %d: send BAR; seq %d\n", - __func__, tid, ni->ni_txseqs[tid]); -#if 0 - if (ieee80211_send_bar(ni, tap, ni->ni_txseqs[tid]) == 0) { + "%s: TID %d: send BAR; seq %d\n", __func__, tid, txseq); + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); + /* + * It's ok to unlock it now (and it's required at + * the moment!) since we are purging "holes" in the + * tx sequence up to this point; any subsequent + * sequence numbers haven't been yet attempted to + * TX. + */ + if (ieee80211_send_bar(ni, tap, txseq) == 0) { /* * Pause the TID if this was successful. * An un-successful BAR TX would never call @@ -2711,10 +2719,8 @@ ath_tx_aggr_retry_unaggr(struct ath_soft "%s: TID %d: BAR TX failed\n", __func__, tid); } -#endif /* Free buffer, bf is free after this call */ - ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); ath_tx_default_comp(sc, bf, 0); return; } @@ -2844,16 +2850,35 @@ ath_tx_comp_aggr_error(struct ath_softc bf = bf_next; } + /* Prepend all frames to the beginning of the queue */ + while ((bf = TAILQ_LAST(&bf_q, ath_bufhead_s)) != NULL) { + TAILQ_REMOVE(&bf_q, bf, bf_list); + ATH_TXQ_INSERT_HEAD(tid, bf, bf_list); + } + + ath_tx_tid_sched(sc, tid); + /* * send bar if we dropped any frames + * + * Keep the txq lock held for now, as we need to ensure + * that ni_txseqs[] is consistent (as it's being updated + * in the ifnet TX context or raw TX context.) */ if (drops) { + int txseq = ni->ni_txseqs[tid->tid]; device_printf(sc->sc_dev, "%s: TID %d: send BAR; seq %d\n", - __func__, tid->tid, - ni->ni_txseqs[tid->tid]); -#if 0 - if (ieee80211_send_bar(ni, tap, ni->ni_txseqs[tid->tid]) == 0) { + __func__, tid->tid, txseq); + ATH_TXQ_UNLOCK(sc->sc_ac2q[tid->ac]); + /* + * It's ok to unlock it now (and it's required at + * the moment!) since we are purging "holes" in the + * tx sequence up to this point; any subsequent + * sequence numbers haven't been yet attempted to + * TX. + */ + if (ieee80211_send_bar(ni, tap, txseq) == 0) { /* * Pause the TID if this was successful. * An un-successful BAR TX would never call @@ -2866,23 +2891,17 @@ ath_tx_comp_aggr_error(struct ath_softc "%s: TID %d: BAR TX failed\n", __func__, tid->tid); } -#endif + } else { + ATH_TXQ_UNLOCK(sc->sc_ac2q[tid->ac]); } - /* Prepend all frames to the beginning of the queue */ - while ((bf = TAILQ_LAST(&bf_q, ath_bufhead_s)) != NULL) { - TAILQ_REMOVE(&bf_q, bf, bf_list); - ATH_TXQ_INSERT_HEAD(tid, bf, bf_list); - } - - ath_tx_tid_sched(sc, tid); - ATH_TXQ_UNLOCK(sc->sc_ac2q[tid->ac]); - /* Complete frames which errored out */ while ((bf = TAILQ_FIRST(&bf_cq)) != NULL) { TAILQ_REMOVE(&bf_cq, bf, bf_list); ath_tx_default_comp(sc, bf, 0); } + + } /* @@ -2957,6 +2976,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * int pktlen; /* XXX there's too much on the stack? */ struct ath_rc_series rc[4]; + int txseq; DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: called; hwq_depth=%d\n", __func__, atid->hwq_depth); @@ -3092,7 +3112,15 @@ ath_tx_aggr_comp_aggr(struct ath_softc * bf = bf_next; } - /* Now that the BAW updates have been done, unlock */ + /* + * Now that the BAW updates have been done, unlock + * + * txseq is grabbed before the lock is released so we + * have a consistent view of what -was- in the BAW. + * Anything after this point will not yet have been + * TXed. + */ + txseq = ni->ni_txseqs[tid]; ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); if (nframes != nf) @@ -3107,12 +3135,13 @@ ath_tx_aggr_comp_aggr(struct ath_softc * if (fail == 0) ath_tx_update_ratectrl(sc, ni, rc, &ts, pktlen, nframes, nbad); -#if 0 /* * send bar if we dropped any frames */ if (drops) { - if (ieee80211_send_bar(ni, tap, ni->ni_txseqs[tid]) == 0) { + device_printf(sc->sc_dev, + "%s: TID %d: send BAR; seq %d\n", __func__, tid, txseq); + if (ieee80211_send_bar(ni, tap, txseq) == 0) { /* * Pause the TID if this was successful. * An un-successful BAR TX would never call @@ -3126,7 +3155,6 @@ ath_tx_aggr_comp_aggr(struct ath_softc * __func__, tid); } } -#endif /* Prepend all frames to the beginning of the queue */ ATH_TXQ_LOCK(sc->sc_ac2q[atid->ac]); @@ -3134,7 +3162,6 @@ ath_tx_aggr_comp_aggr(struct ath_softc * TAILQ_REMOVE(&bf_q, bf, bf_list); ATH_TXQ_INSERT_HEAD(atid, bf, bf_list); } - ath_tx_tid_sched(sc, atid); ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); From owner-svn-src-user@FreeBSD.ORG Mon Sep 19 09:52:03 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E353E106566C; Mon, 19 Sep 2011 09:52:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2A6C8FC14; Mon, 19 Sep 2011 09:52:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8J9q3N3073113; Mon, 19 Sep 2011 09:52:03 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8J9q3co073111; Mon, 19 Sep 2011 09:52:03 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109190952.p8J9q3co073111@svn.freebsd.org> From: Adrian Chadd Date: Mon, 19 Sep 2011 09:52:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225660 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 09:52:04 -0000 Author: adrian Date: Mon Sep 19 09:52:03 2011 New Revision: 225660 URL: http://svn.freebsd.org/changeset/base/225660 Log: Un-break the handling of multi-rate retry in the TX path. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Mon Sep 19 08:52:06 2011 (r225659) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Mon Sep 19 09:52:03 2011 (r225660) @@ -846,13 +846,21 @@ ath_tx_do_ratelookup(struct ath_softc *s if (! bf->bf_state.bfs_doratelookup) return; + /* Get rid of any previous state */ + bzero(bf->bf_state.bfs_rc, sizeof(bf->bf_state.bfs_rc)); + ATH_NODE_LOCK(ATH_NODE(bf->bf_node)); ath_rate_findrate(sc, ATH_NODE(bf->bf_node), bf->bf_state.bfs_shpream, bf->bf_state.bfs_pktlen, &rix, &try0, &rate); - /* XXX only do this if MRR is enabled for this frame? */ - /* XXX and blank the rest if not? */ - ath_rate_getxtxrates(sc, ATH_NODE(bf->bf_node), rix, - bf->bf_state.bfs_rc); + + /* In case MRR is disabled, make sure rc[0] is setup correctly */ + bf->bf_state.bfs_rc[0].rix = rix; + bf->bf_state.bfs_rc[0].ratecode = rate; + bf->bf_state.bfs_rc[0].tries = try0; + + if (bf->bf_state.bfs_ismrr && try0 != ATH_TXMAXTRY) + ath_rate_getxtxrates(sc, ATH_NODE(bf->bf_node), rix, + bf->bf_state.bfs_rc); ATH_NODE_UNLOCK(ATH_NODE(bf->bf_node)); sc->sc_txrix = rix; /* for LED blinking */ From owner-svn-src-user@FreeBSD.ORG Mon Sep 19 10:28:59 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E42711065673; Mon, 19 Sep 2011 10:28:59 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3F0B8FC0C; Mon, 19 Sep 2011 10:28:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8JASxOb074335; Mon, 19 Sep 2011 10:28:59 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8JASxVp074333; Mon, 19 Sep 2011 10:28:59 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201109191028.p8JASxVp074333@svn.freebsd.org> From: Gabor Kovesdan Date: Mon, 19 Sep 2011 10:28:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225661 - user/gabor/grep/trunk X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 10:29:00 -0000 Author: gabor Date: Mon Sep 19 10:28:59 2011 New Revision: 225661 URL: http://svn.freebsd.org/changeset/base/225661 Log: - Treat literal patterns really literal Submitted by: aakuusta@gmail.com Modified: user/gabor/grep/trunk/grep.c Modified: user/gabor/grep/trunk/grep.c ============================================================================== --- user/gabor/grep/trunk/grep.c Mon Sep 19 09:52:03 2011 (r225660) +++ user/gabor/grep/trunk/grep.c Mon Sep 19 10:28:59 2011 (r225661) @@ -672,6 +672,8 @@ main(int argc, char *argv[]) switch (grepbehave) { case GREP_FIXED: case GREP_BASIC: + /* XXX: header mess, REG_LITERAL not defined in gnu/regex.h */ + cflags |= 0020; break; case GREP_EXTENDED: cflags |= REG_EXTENDED; From owner-svn-src-user@FreeBSD.ORG Mon Sep 19 11:49:06 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5816B1065672; Mon, 19 Sep 2011 11:49:06 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3CFD18FC08; Mon, 19 Sep 2011 11:49:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8JBn6jl078575; Mon, 19 Sep 2011 11:49:06 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8JBn6iY078573; Mon, 19 Sep 2011 11:49:06 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109191149.p8JBn6iY078573@svn.freebsd.org> From: Adrian Chadd Date: Mon, 19 Sep 2011 11:49:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225664 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 11:49:06 -0000 Author: adrian Date: Mon Sep 19 11:49:05 2011 New Revision: 225664 URL: http://svn.freebsd.org/changeset/base/225664 Log: Add some further debugging to BAW add/remove. The current TX hangs I've seen with BAR TX are because I'm completely doing the wrong thing in choosing a new left-edge BAW. I'll look at fixing that in subsequent commits. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Mon Sep 19 11:08:31 2011 (r225663) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Mon Sep 19 11:49:05 2011 (r225664) @@ -1858,6 +1858,14 @@ ath_tx_addto_baw(struct ath_softc *sc, s "%s: ba packet dup (index=%d, cindex=%d, " "head=%d, tail=%d)\n", __func__, index, cindex, tid->baw_head, tid->baw_tail); + device_printf(sc->sc_dev, + "%s: BA bf: %p; seqno=%d ; new bf: %p; seqno=%d\n", + __func__, + tid->tx_buf[cindex], + SEQNO(tid->tx_buf[cindex]->bf_state.bfs_seqno), + bf, + SEQNO(bf->bf_state.bfs_seqno) + ); } tid->tx_buf[cindex] = bf; @@ -1876,10 +1884,11 @@ ath_tx_addto_baw(struct ath_softc *sc, s */ static void ath_tx_update_baw(struct ath_softc *sc, struct ath_node *an, - struct ath_tid *tid, int seqno) + struct ath_tid *tid, const struct ath_buf *bf) { int index, cindex; struct ieee80211_tx_ampdu *tap; + int seqno = SEQNO(bf->bf_state.bfs_seqno); ATH_TXQ_LOCK_ASSERT(sc->sc_ac2q[tid->ac]); @@ -1891,6 +1900,11 @@ ath_tx_update_baw(struct ath_softc *sc, "%s: tid=%d, baw=%d:%d, seqno=%d, index=%d, cindex=%d, baw head=%d, tail=%d\n", __func__, tid->tid, tap->txa_start, tap->txa_wnd, seqno, index, cindex, tid->baw_head, tid->baw_tail); + if (tid->tx_buf[cindex] != bf) { + device_printf(sc->sc_dev, "%s: seqno %d: tx_buf bf=%p; comp bf=%p!\n", + __func__, seqno, tid->tx_buf[cindex], bf); + } + tid->tx_buf[cindex] = NULL; while (tid->baw_head != tid->baw_tail && !tid->tx_buf[tid->baw_head]) { @@ -2277,8 +2291,7 @@ ath_tx_tid_drain(struct ath_softc *sc, s * the frame was in the BAW to begin with. */ if (bf->bf_state.bfs_retries > 0) { - ath_tx_update_baw(sc, an, tid, - SEQNO(bf->bf_state.bfs_seqno)); + ath_tx_update_baw(sc, an, tid, bf); bf->bf_state.bfs_dobaw = 0; } /* @@ -2516,8 +2529,7 @@ ath_tx_cleanup(struct ath_softc *sc, str TAILQ_REMOVE(&atid->axq_q, bf, bf_list); atid->axq_depth--; if (bf->bf_state.bfs_dobaw) { - ath_tx_update_baw(sc, an, atid, - SEQNO(bf->bf_state.bfs_seqno)); + ath_tx_update_baw(sc, an, atid, bf); if (! bf->bf_state.bfs_addedbaw) device_printf(sc->sc_dev, "%s: wasn't added: seqno %d\n", @@ -2689,8 +2701,7 @@ ath_tx_aggr_retry_unaggr(struct ath_soft /* Update BAW anyway */ if (bf->bf_state.bfs_dobaw) { - ath_tx_update_baw(sc, an, atid, - SEQNO(bf->bf_state.bfs_seqno)); + ath_tx_update_baw(sc, an, atid, bf); if (! bf->bf_state.bfs_addedbaw) device_printf(sc->sc_dev, "%s: wasn't added: seqno %d\n", @@ -2796,7 +2807,7 @@ ath_tx_retry_subframe(struct ath_softc * DPRINTF(sc, ATH_DEBUG_SW_TX_RETRIES, "%s: max retries: seqno %d\n", __func__, SEQNO(bf->bf_state.bfs_seqno)); - ath_tx_update_baw(sc, an, atid, SEQNO(bf->bf_state.bfs_seqno)); + ath_tx_update_baw(sc, an, atid, bf); if (! bf->bf_state.bfs_addedbaw) device_printf(sc->sc_dev, "%s: wasn't added: seqno %d\n", @@ -3100,8 +3111,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * ATH_BA_ISSET(ba, ba_index)); if (tx_ok && ATH_BA_ISSET(ba, ba_index)) { - ath_tx_update_baw(sc, an, atid, - SEQNO(bf->bf_state.bfs_seqno)); + ath_tx_update_baw(sc, an, atid, bf); bf->bf_state.bfs_dobaw = 0; if (! bf->bf_state.bfs_addedbaw) device_printf(sc->sc_dev, @@ -3255,7 +3265,7 @@ ath_tx_aggr_comp_unaggr(struct ath_softc DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: TID=%d, seqno %d\n", __func__, tid, SEQNO(bf->bf_state.bfs_seqno)); if (bf->bf_state.bfs_dobaw) { - ath_tx_update_baw(sc, an, atid, SEQNO(bf->bf_state.bfs_seqno)); + ath_tx_update_baw(sc, an, atid, bf); bf->bf_state.bfs_dobaw = 0; if (! bf->bf_state.bfs_addedbaw) device_printf(sc->sc_dev, From owner-svn-src-user@FreeBSD.ORG Mon Sep 19 13:39:40 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64054106566C; Mon, 19 Sep 2011 13:39:40 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5481A8FC13; Mon, 19 Sep 2011 13:39:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8JDdesx081990; Mon, 19 Sep 2011 13:39:40 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8JDdeHh081988; Mon, 19 Sep 2011 13:39:40 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201109191339.p8JDdeHh081988@svn.freebsd.org> From: Gabor Kovesdan Date: Mon, 19 Sep 2011 13:39:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225665 - user/gabor/grep/trunk/regex X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 13:39:40 -0000 Author: gabor Date: Mon Sep 19 13:39:40 2011 New Revision: 225665 URL: http://svn.freebsd.org/changeset/base/225665 Log: - Remove unused macro - Sort macros Modified: user/gabor/grep/trunk/regex/glue.h Modified: user/gabor/grep/trunk/regex/glue.h ============================================================================== --- user/gabor/grep/trunk/regex/glue.h Mon Sep 19 11:49:05 2011 (r225664) +++ user/gabor/grep/trunk/regex/glue.h Mon Sep 19 13:39:40 2011 (r225665) @@ -20,12 +20,10 @@ #define tre_isspace iswspace #define tre_isalnum iswalnum +#deifne REG_OK 0 #define REG_LITERAL 0020 #define REG_WORD 0100 #define REG_GNU 0400 -#define _REG_HEUR 01000 - -#define REG_OK 0 #define TRE_MB_CUR_MAX MB_CUR_MAX From owner-svn-src-user@FreeBSD.ORG Mon Sep 19 13:41:12 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98A781065672; Mon, 19 Sep 2011 13:41:12 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FF4C8FC18; Mon, 19 Sep 2011 13:41:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8JDfC8R082079; Mon, 19 Sep 2011 13:41:12 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8JDfCQB082077; Mon, 19 Sep 2011 13:41:12 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201109191341.p8JDfCQB082077@svn.freebsd.org> From: Gabor Kovesdan Date: Mon, 19 Sep 2011 13:41:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225666 - user/gabor/grep/trunk/regex X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 13:41:12 -0000 Author: gabor Date: Mon Sep 19 13:41:12 2011 New Revision: 225666 URL: http://svn.freebsd.org/changeset/base/225666 Log: - Fix typo Modified: user/gabor/grep/trunk/regex/glue.h Modified: user/gabor/grep/trunk/regex/glue.h ============================================================================== --- user/gabor/grep/trunk/regex/glue.h Mon Sep 19 13:39:40 2011 (r225665) +++ user/gabor/grep/trunk/regex/glue.h Mon Sep 19 13:41:12 2011 (r225666) @@ -20,7 +20,7 @@ #define tre_isspace iswspace #define tre_isalnum iswalnum -#deifne REG_OK 0 +#define REG_OK 0 #define REG_LITERAL 0020 #define REG_WORD 0100 #define REG_GNU 0400 From owner-svn-src-user@FreeBSD.ORG Mon Sep 19 13:55:19 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C240A1065677; Mon, 19 Sep 2011 13:55:19 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2F1C8FC08; Mon, 19 Sep 2011 13:55:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8JDtJea082558; Mon, 19 Sep 2011 13:55:19 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8JDtJi2082556; Mon, 19 Sep 2011 13:55:19 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201109191355.p8JDtJi2082556@svn.freebsd.org> From: Gabor Kovesdan Date: Mon, 19 Sep 2011 13:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225667 - user/gabor/grep/trunk X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 13:55:19 -0000 Author: gabor Date: Mon Sep 19 13:55:19 2011 New Revision: 225667 URL: http://svn.freebsd.org/changeset/base/225667 Log: - Fix regression introduced in r225661 Modified: user/gabor/grep/trunk/grep.c Modified: user/gabor/grep/trunk/grep.c ============================================================================== --- user/gabor/grep/trunk/grep.c Mon Sep 19 13:41:12 2011 (r225666) +++ user/gabor/grep/trunk/grep.c Mon Sep 19 13:55:19 2011 (r225667) @@ -670,8 +670,9 @@ main(int argc, char *argv[]) } switch (grepbehave) { - case GREP_FIXED: case GREP_BASIC: + break; + case GREP_FIXED: /* XXX: header mess, REG_LITERAL not defined in gnu/regex.h */ cflags |= 0020; break; From owner-svn-src-user@FreeBSD.ORG Mon Sep 19 15:31:13 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25F48106566C; Mon, 19 Sep 2011 15:31:13 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 171718FC16; Mon, 19 Sep 2011 15:31:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8JFVCBZ085609; Mon, 19 Sep 2011 15:31:12 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8JFVCIZ085607; Mon, 19 Sep 2011 15:31:12 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201109191531.p8JFVCIZ085607@svn.freebsd.org> From: Hiroki Sato Date: Mon, 19 Sep 2011 15:31:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225668 - user/hrs/ipv6/sys/netinet6 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 15:31:13 -0000 Author: hrs Date: Mon Sep 19 15:31:12 2011 New Revision: 225668 URL: http://svn.freebsd.org/changeset/base/225668 Log: Copy ip6po_minmtu and ip6po_prefer_tempaddr in ip6_copypktopts(). This fixes inconsistency when options are specified by both setsockopt() and ancillary data types. PR: kern/158307 Modified: user/hrs/ipv6/sys/netinet6/ip6_output.c Modified: user/hrs/ipv6/sys/netinet6/ip6_output.c ============================================================================== --- user/hrs/ipv6/sys/netinet6/ip6_output.c Mon Sep 19 13:55:19 2011 (r225667) +++ user/hrs/ipv6/sys/netinet6/ip6_output.c Mon Sep 19 15:31:12 2011 (r225668) @@ -2367,6 +2367,8 @@ copypktopts(struct ip6_pktopts *dst, str dst->ip6po_hlim = src->ip6po_hlim; dst->ip6po_tclass = src->ip6po_tclass; dst->ip6po_flags = src->ip6po_flags; + dst->ip6po_minmtu = src->ip6po_minmtu; + dst->ip6po_prefer_tempaddr = src->ip6po_prefer_tempaddr; if (src->ip6po_pktinfo) { dst->ip6po_pktinfo = malloc(sizeof(*dst->ip6po_pktinfo), M_IP6OPT, canwait); From owner-svn-src-user@FreeBSD.ORG Tue Sep 20 00:19:36 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7445F106564A; Tue, 20 Sep 2011 00:19:36 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 642748FC14; Tue, 20 Sep 2011 00:19:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8K0Jav1002343; Tue, 20 Sep 2011 00:19:36 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8K0JaOX002341; Tue, 20 Sep 2011 00:19:36 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201109200019.p8K0JaOX002341@svn.freebsd.org> From: Hiroki Sato Date: Tue, 20 Sep 2011 00:19:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225680 - user/hrs/ipv6/usr.sbin/rtadvd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 00:19:36 -0000 Author: hrs Date: Tue Sep 20 00:19:36 2011 New Revision: 225680 URL: http://svn.freebsd.org/changeset/base/225680 Log: Remove RA timer on an interface with !IFF_UP actively after starting to send clean-up RA messages for shutting down. The RA timers could prevent the rtadvd daemon from shutting down because ra_output() just ignored !IFF_UP interfaces and TRANSITIVE->UNCONFIGURED state transition never happend due to it. Spotted by: kib Modified: user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c Modified: user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c ============================================================================== --- user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c Mon Sep 19 23:49:59 2011 (r225679) +++ user/hrs/ipv6/usr.sbin/rtadvd/rtadvd.c Tue Sep 20 00:19:36 2011 (r225680) @@ -381,6 +381,21 @@ rtadvd_shutdown(void) "waiting expiration of the all RA timers."); TAILQ_FOREACH(ifi, &ifilist, ifi_next) { + /* + * Ignore !IFF_UP interfaces in waiting for shutdown. + */ + if (!(ifi->ifi_flags & IFF_UP) && + ifi->ifi_ra_timer != NULL) { + ifi->ifi_state = IFI_STATE_UNCONFIGURED; + rtadvd_remove_timer(ifi->ifi_ra_timer); + ifi->ifi_ra_timer = NULL; + syslog(LOG_DEBUG, "<%s> %s(idx=%d) is down. " + "Timer removed and marked as UNCONFIGURED.", + __func__, ifi->ifi_ifname, + ifi->ifi_ifindex); + } + } + TAILQ_FOREACH(ifi, &ifilist, ifi_next) { if (ifi->ifi_ra_timer != NULL) break; } From owner-svn-src-user@FreeBSD.ORG Tue Sep 20 04:20:56 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 159C81065670; Tue, 20 Sep 2011 04:20:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 05FA48FC19; Tue, 20 Sep 2011 04:20:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8K4KtWl009983; Tue, 20 Sep 2011 04:20:55 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8K4KtG3009981; Tue, 20 Sep 2011 04:20:55 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109200420.p8K4KtG3009981@svn.freebsd.org> From: Adrian Chadd Date: Tue, 20 Sep 2011 04:20:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225685 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 04:20:56 -0000 Author: adrian Date: Tue Sep 20 04:20:55 2011 New Revision: 225685 URL: http://svn.freebsd.org/changeset/base/225685 Log: Undo the BAR TX stuff (as it's broken); correct what the new LH edge of the BAW should be. The BAR TX stuff I committed earlier is just plain wrong. What should happen is this (in ADDBA mode): * If a software retransmit completely fails, all TX for that given TID should be paused until all existing TXes for said TID are completed (failed or not); * Once all the hardware-queued transmissions are completed, the left-hand edge of the BAW (from the TX point of view) should be correct. Ie, there may be further packets queued in the software TX queue, but the left-hand edge of the BAW will point to one frame past the last hardware-queued frame (again, successful or not, it doesn't matter.) * At that point, a BAR should be sent reflecting what the new BAW left hand edge is. * Once that's been received, TX on the given TID should resume. * If it fails, net80211 will cancel the addba session for us; we just need to resume TX'ing on the TID anyway (newly downgraded to non-aggregation.) Now, the things to keep in mind when implementing the correct-er solution: * There may be plenty of outstanding frames on the hardware TX queue, so you can't just send one BAR for each of those. * Whilst the BAR is being TXed, the node may be reset; this SHOULD correctly be handled (ie, cancelling the frame will cause net80211 to reschedule another one) * You can't just call pause() and resume() like I was doing, as multiple outstanding frames may be on the hardware queue (and multiples ones may fail.) A new method of marking a TID as "BAR pending" needs to be added first. That way the TID can be paused and unpaused a total of once, no matter how many outstanding frames fail before the TID has no more frames on the hardware queue. * Finally, this all only works if tid->hwq_depth is completely accurate. This needs to be verified! Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Tue Sep 20 00:37:35 2011 (r225684) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Tue Sep 20 04:20:55 2011 (r225685) @@ -2714,30 +2714,13 @@ ath_tx_aggr_retry_unaggr(struct ath_soft * This'll end up going into net80211 and back out * again, via ic->ic_raw_xmit(). */ - txseq = ni->ni_txseqs[tid]; + txseq = tap->txa_start; + ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); + device_printf(sc->sc_dev, "%s: TID %d: send BAR; seq %d\n", __func__, tid, txseq); - ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); - /* - * It's ok to unlock it now (and it's required at - * the moment!) since we are purging "holes" in the - * tx sequence up to this point; any subsequent - * sequence numbers haven't been yet attempted to - * TX. - */ - if (ieee80211_send_bar(ni, tap, txseq) == 0) { - /* - * Pause the TID if this was successful. - * An un-successful BAR TX would never call - * the BAR complete / timeout methods. - */ - ath_tx_tid_pause(sc, atid); - } else { - /* BAR TX failed */ - device_printf(sc->sc_dev, - "%s: TID %d: BAR TX failed\n", - __func__, tid); - } + + /* XXX TODO: send BAR */ /* Free buffer, bf is free after this call */ ath_tx_default_comp(sc, bf, 0); @@ -2885,31 +2868,13 @@ ath_tx_comp_aggr_error(struct ath_softc * in the ifnet TX context or raw TX context.) */ if (drops) { - int txseq = ni->ni_txseqs[tid->tid]; + int txseq = tap->txa_start; + ATH_TXQ_UNLOCK(sc->sc_ac2q[tid->ac]); device_printf(sc->sc_dev, "%s: TID %d: send BAR; seq %d\n", __func__, tid->tid, txseq); - ATH_TXQ_UNLOCK(sc->sc_ac2q[tid->ac]); - /* - * It's ok to unlock it now (and it's required at - * the moment!) since we are purging "holes" in the - * tx sequence up to this point; any subsequent - * sequence numbers haven't been yet attempted to - * TX. - */ - if (ieee80211_send_bar(ni, tap, txseq) == 0) { - /* - * Pause the TID if this was successful. - * An un-successful BAR TX would never call - * the BAR complete / timeout methods. - */ - ath_tx_tid_pause(sc, tid); - } else { - /* BAR TX failed */ - device_printf(sc->sc_dev, - "%s: TID %d: BAR TX failed\n", - __func__, tid->tid); - } + + /* XXX TODO: send BAR */ } else { ATH_TXQ_UNLOCK(sc->sc_ac2q[tid->ac]); } @@ -3138,7 +3103,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * * Anything after this point will not yet have been * TXed. */ - txseq = ni->ni_txseqs[tid]; + txseq = tap->txa_start; ATH_TXQ_UNLOCK(sc->sc_ac2q[atid->ac]); if (nframes != nf) @@ -3159,19 +3124,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * if (drops) { device_printf(sc->sc_dev, "%s: TID %d: send BAR; seq %d\n", __func__, tid, txseq); - if (ieee80211_send_bar(ni, tap, txseq) == 0) { - /* - * Pause the TID if this was successful. - * An un-successful BAR TX would never call - * the BAR complete / timeout methods. - */ - ath_tx_tid_pause(sc, atid); - } else { - /* BAR TX failed */ - device_printf(sc->sc_dev, - "%s: TID %d: BAR TX failed\n", - __func__, tid); - } + /* XXX TODO: send BAR */ } /* Prepend all frames to the beginning of the queue */ From owner-svn-src-user@FreeBSD.ORG Tue Sep 20 07:19:39 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 792B4106564A; Tue, 20 Sep 2011 07:19:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5033A8FC08; Tue, 20 Sep 2011 07:19:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8K7Jda6015752; Tue, 20 Sep 2011 07:19:39 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8K7JdKO015750; Tue, 20 Sep 2011 07:19:39 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109200719.p8K7JdKO015750@svn.freebsd.org> From: Adrian Chadd Date: Tue, 20 Sep 2011 07:19:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225689 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 07:19:39 -0000 Author: adrian Date: Tue Sep 20 07:19:39 2011 New Revision: 225689 URL: http://svn.freebsd.org/changeset/base/225689 Log: Whitespace Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Tue Sep 20 05:02:48 2011 (r225688) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Tue Sep 20 07:19:39 2011 (r225689) @@ -2884,8 +2884,6 @@ ath_tx_comp_aggr_error(struct ath_softc TAILQ_REMOVE(&bf_cq, bf, bf_list); ath_tx_default_comp(sc, bf, 0); } - - } /* From owner-svn-src-user@FreeBSD.ORG Tue Sep 20 08:01:44 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFC5F106564A; Tue, 20 Sep 2011 08:01:44 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC3A88FC08; Tue, 20 Sep 2011 08:01:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8K81iqq017116; Tue, 20 Sep 2011 08:01:44 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8K81iGQ017094; Tue, 20 Sep 2011 08:01:44 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201109200801.p8K81iGQ017094@svn.freebsd.org> From: Attilio Rao Date: Tue, 20 Sep 2011 08:01:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225690 - in user/attilio/vmcontention: contrib/smbfs/mount_smbfs contrib/top contrib/tzcode/stdtime etc/rc.d lib/libc/iconv lib/libusb sbin/ifconfig share/man/man5 share/mk sys/dev/cor... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 08:01:44 -0000 Author: attilio Date: Tue Sep 20 08:01:43 2011 New Revision: 225690 URL: http://svn.freebsd.org/changeset/base/225690 Log: MFC Modified: user/attilio/vmcontention/contrib/smbfs/mount_smbfs/mount_smbfs.8 user/attilio/vmcontention/contrib/tzcode/stdtime/localtime.c user/attilio/vmcontention/etc/rc.d/NETWORKING user/attilio/vmcontention/etc/rc.d/bridge user/attilio/vmcontention/etc/rc.d/resolv user/attilio/vmcontention/lib/libc/iconv/citrus_none.c user/attilio/vmcontention/lib/libusb/Makefile user/attilio/vmcontention/lib/libusb/libusb.3 user/attilio/vmcontention/lib/libusb/libusb.h user/attilio/vmcontention/lib/libusb/libusb10.c user/attilio/vmcontention/lib/libusb/libusb20.3 user/attilio/vmcontention/lib/libusb/libusb20.c user/attilio/vmcontention/lib/libusb/libusb20.h user/attilio/vmcontention/sbin/ifconfig/ifconfig.8 user/attilio/vmcontention/share/man/man5/rc.conf.5 user/attilio/vmcontention/sys/dev/coretemp/coretemp.c user/attilio/vmcontention/sys/dev/e1000/if_lem.c user/attilio/vmcontention/sys/dev/iwn/if_iwn.c user/attilio/vmcontention/sys/kern/kern_exit.c user/attilio/vmcontention/sys/kern/kern_fork.c user/attilio/vmcontention/sys/netinet/sctp_bsd_addr.c user/attilio/vmcontention/sys/netinet/sctp_structs.h user/attilio/vmcontention/sys/netinet/sctputil.c user/attilio/vmcontention/sys/netinet6/ip6_output.c user/attilio/vmcontention/sys/sparc64/sparc64/machdep.c user/attilio/vmcontention/sys/sparc64/sparc64/pmap.c user/attilio/vmcontention/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh user/attilio/vmcontention/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh user/attilio/vmcontention/usr.sbin/pc-sysinstall/backend/functions-disk.sh user/attilio/vmcontention/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh user/attilio/vmcontention/usr.sbin/pc-sysinstall/backend/functions-localize.sh user/attilio/vmcontention/usr.sbin/pc-sysinstall/backend/functions-newfs.sh user/attilio/vmcontention/usr.sbin/pc-sysinstall/backend/functions-parse.sh user/attilio/vmcontention/usr.sbin/pc-sysinstall/backend/functions-unmount.sh user/attilio/vmcontention/usr.sbin/pc-sysinstall/backend/functions.sh user/attilio/vmcontention/usr.sbin/pc-sysinstall/backend/parseconfig.sh user/attilio/vmcontention/usr.sbin/pc-sysinstall/examples/README user/attilio/vmcontention/usr.sbin/rtadvd/rtadvd.c Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/contrib/bind9/ (props changed) user/attilio/vmcontention/contrib/binutils/ (props changed) user/attilio/vmcontention/contrib/bzip2/ (props changed) user/attilio/vmcontention/contrib/compiler-rt/ (props changed) user/attilio/vmcontention/contrib/dialog/ (props changed) user/attilio/vmcontention/contrib/ee/ (props changed) user/attilio/vmcontention/contrib/expat/ (props changed) user/attilio/vmcontention/contrib/file/ (props changed) user/attilio/vmcontention/contrib/gcc/ (props changed) user/attilio/vmcontention/contrib/gdb/ (props changed) user/attilio/vmcontention/contrib/gdtoa/ (props changed) user/attilio/vmcontention/contrib/gnu-sort/ (props changed) user/attilio/vmcontention/contrib/groff/ (props changed) user/attilio/vmcontention/contrib/less/ (props changed) user/attilio/vmcontention/contrib/libpcap/ (props changed) user/attilio/vmcontention/contrib/libstdc++/ (props changed) user/attilio/vmcontention/contrib/llvm/ (props changed) user/attilio/vmcontention/contrib/llvm/tools/clang/ (props changed) user/attilio/vmcontention/contrib/ncurses/ (props changed) user/attilio/vmcontention/contrib/netcat/ (props changed) user/attilio/vmcontention/contrib/ntp/ (props changed) user/attilio/vmcontention/contrib/one-true-awk/ (props changed) user/attilio/vmcontention/contrib/openbsm/ (props changed) user/attilio/vmcontention/contrib/openpam/ (props changed) user/attilio/vmcontention/contrib/openresolv/ (props changed) user/attilio/vmcontention/contrib/pf/ (props changed) user/attilio/vmcontention/contrib/sendmail/ (props changed) user/attilio/vmcontention/contrib/tcpdump/ (props changed) user/attilio/vmcontention/contrib/tcsh/ (props changed) user/attilio/vmcontention/contrib/tnftp/ (props changed) user/attilio/vmcontention/contrib/top/ (props changed) user/attilio/vmcontention/contrib/top/install-sh (props changed) user/attilio/vmcontention/contrib/tzcode/stdtime/ (props changed) user/attilio/vmcontention/contrib/tzcode/zic/ (props changed) user/attilio/vmcontention/contrib/tzdata/ (props changed) user/attilio/vmcontention/contrib/wpa/ (props changed) user/attilio/vmcontention/contrib/xz/ (props changed) user/attilio/vmcontention/crypto/openssh/ (props changed) user/attilio/vmcontention/crypto/openssl/ (props changed) user/attilio/vmcontention/gnu/lib/ (props changed) user/attilio/vmcontention/gnu/usr.bin/binutils/ (props changed) user/attilio/vmcontention/gnu/usr.bin/cc/cc_tools/ (props changed) user/attilio/vmcontention/gnu/usr.bin/gdb/ (props changed) user/attilio/vmcontention/lib/libc/ (props changed) user/attilio/vmcontention/lib/libc/stdtime/ (props changed) user/attilio/vmcontention/lib/libutil/ (props changed) user/attilio/vmcontention/lib/libz/ (props changed) user/attilio/vmcontention/sbin/ (props changed) user/attilio/vmcontention/sbin/ipfw/ (props changed) user/attilio/vmcontention/share/mk/bsd.arch.inc.mk (props changed) user/attilio/vmcontention/share/zoneinfo/ (props changed) user/attilio/vmcontention/sys/ (props changed) user/attilio/vmcontention/sys/amd64/include/xen/ (props changed) user/attilio/vmcontention/sys/boot/ (props changed) user/attilio/vmcontention/sys/boot/i386/efi/ (props changed) user/attilio/vmcontention/sys/boot/ia64/efi/ (props changed) user/attilio/vmcontention/sys/boot/ia64/ski/ (props changed) user/attilio/vmcontention/sys/boot/powerpc/boot1.chrp/ (props changed) user/attilio/vmcontention/sys/boot/powerpc/ofw/ (props changed) user/attilio/vmcontention/sys/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/sys/conf/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/ (props changed) user/attilio/vmcontention/sys/contrib/octeon-sdk/ (props changed) user/attilio/vmcontention/sys/contrib/pf/ (props changed) user/attilio/vmcontention/sys/contrib/x86emu/ (props changed) user/attilio/vmcontention/usr.bin/calendar/ (props changed) user/attilio/vmcontention/usr.bin/csup/ (props changed) user/attilio/vmcontention/usr.bin/procstat/ (props changed) user/attilio/vmcontention/usr.sbin/ndiscvt/ (props changed) user/attilio/vmcontention/usr.sbin/rtadvctl/ (props changed) user/attilio/vmcontention/usr.sbin/rtadvd/ (props changed) user/attilio/vmcontention/usr.sbin/rtsold/ (props changed) user/attilio/vmcontention/usr.sbin/zic/ (props changed) Modified: user/attilio/vmcontention/contrib/smbfs/mount_smbfs/mount_smbfs.8 ============================================================================== --- user/attilio/vmcontention/contrib/smbfs/mount_smbfs/mount_smbfs.8 Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/contrib/smbfs/mount_smbfs/mount_smbfs.8 Tue Sep 20 08:01:43 2011 (r225690) @@ -1,6 +1,6 @@ .\" $Id: mount_smbfs.8,v 1.10 2002/04/16 02:47:41 bp Exp $ .\" $FreeBSD$ -.Dd January 21, 2008 +.Dd September 17, 2011 .Dt MOUNT_SMBFS 8 .Os .Sh NAME @@ -157,11 +157,11 @@ mount_smbfs -I samba.mydomain.com //gues mount_smbfs -I 192.168.20.3 -E koi8-r:cp866 //guest@samba/tmp /smb/tmp .Ed .Pp -It is possible to use +It is also possible to use .Xr fstab 5 -for smbfs mounts: +for smbfs mounts (the example below doesn't prompt for a password): .Pp -.Dl "//guest@samba/public /smb/public smbfs rw,noauto 0 0" +.Dl "//guest@samba/public /smb/public smbfs rw,noauto,-N 0 0" .Sh AUTHORS .An Boris Popov Aq bp@butya.kz , .Aq bp@FreeBSD.org Modified: user/attilio/vmcontention/contrib/tzcode/stdtime/localtime.c ============================================================================== --- user/attilio/vmcontention/contrib/tzcode/stdtime/localtime.c Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/contrib/tzcode/stdtime/localtime.c Tue Sep 20 08:01:43 2011 (r225690) @@ -380,13 +380,16 @@ register const int doextend; int fid; int stored; int nread; + int res; union { struct tzhead tzhead; char buf[2 * sizeof(struct tzhead) + 2 * sizeof *sp + 4 * TZ_MAX_TIMES]; - } u; + } *u; + u = NULL; + res = -1; sp->goback = sp->goahead = FALSE; /* XXX The following is from OpenBSD, and I'm not sure it is correct */ @@ -406,16 +409,24 @@ register const int doextend; ** to hold the longest file name string that the implementation ** guarantees can be opened." */ - char fullname[FILENAME_MAX + 1]; + char *fullname; + + fullname = malloc(FILENAME_MAX + 1); + if (fullname == NULL) + goto out; if (name[0] == ':') ++name; doaccess = name[0] == '/'; if (!doaccess) { - if ((p = TZDIR) == NULL) + if ((p = TZDIR) == NULL) { + free(fullname); return -1; - if ((strlen(p) + 1 + strlen(name) + 1) >= sizeof fullname) + } + if (strlen(p) + 1 + strlen(name) >= FILENAME_MAX) { + free(fullname); return -1; + } (void) strcpy(fullname, p); (void) strcat(fullname, "/"); (void) strcat(fullname, name); @@ -426,37 +437,45 @@ register const int doextend; doaccess = TRUE; name = fullname; } - if (doaccess && access(name, R_OK) != 0) + if (doaccess && access(name, R_OK) != 0) { + free(fullname); return -1; - if ((fid = _open(name, OPEN_MODE)) == -1) + } + if ((fid = _open(name, OPEN_MODE)) == -1) { + free(fullname); return -1; + } if ((_fstat(fid, &stab) < 0) || !S_ISREG(stab.st_mode)) { + free(fullname); _close(fid); return -1; } } - nread = _read(fid, u.buf, sizeof u.buf); + u = malloc(sizeof(*u)); + if (u == NULL) + goto out; + nread = _read(fid, u->buf, sizeof u->buf); if (_close(fid) < 0 || nread <= 0) - return -1; + goto out; for (stored = 4; stored <= 8; stored *= 2) { int ttisstdcnt; int ttisgmtcnt; - ttisstdcnt = (int) detzcode(u.tzhead.tzh_ttisstdcnt); - ttisgmtcnt = (int) detzcode(u.tzhead.tzh_ttisgmtcnt); - sp->leapcnt = (int) detzcode(u.tzhead.tzh_leapcnt); - sp->timecnt = (int) detzcode(u.tzhead.tzh_timecnt); - sp->typecnt = (int) detzcode(u.tzhead.tzh_typecnt); - sp->charcnt = (int) detzcode(u.tzhead.tzh_charcnt); - p = u.tzhead.tzh_charcnt + sizeof u.tzhead.tzh_charcnt; + ttisstdcnt = (int) detzcode(u->tzhead.tzh_ttisstdcnt); + ttisgmtcnt = (int) detzcode(u->tzhead.tzh_ttisgmtcnt); + sp->leapcnt = (int) detzcode(u->tzhead.tzh_leapcnt); + sp->timecnt = (int) detzcode(u->tzhead.tzh_timecnt); + sp->typecnt = (int) detzcode(u->tzhead.tzh_typecnt); + sp->charcnt = (int) detzcode(u->tzhead.tzh_charcnt); + p = u->tzhead.tzh_charcnt + sizeof u->tzhead.tzh_charcnt; if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS || sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES || sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES || sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS || (ttisstdcnt != sp->typecnt && ttisstdcnt != 0) || (ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0)) - return -1; - if (nread - (p - u.buf) < + goto out; + if (nread - (p - u->buf) < sp->timecnt * stored + /* ats */ sp->timecnt + /* types */ sp->typecnt * 6 + /* ttinfos */ @@ -464,7 +483,7 @@ register const int doextend; sp->leapcnt * (stored + 4) + /* lsinfos */ ttisstdcnt + /* ttisstds */ ttisgmtcnt) /* ttisgmts */ - return -1; + goto out; for (i = 0; i < sp->timecnt; ++i) { sp->ats[i] = (stored == 4) ? detzcode(p) : detzcode64(p); @@ -473,7 +492,7 @@ register const int doextend; for (i = 0; i < sp->timecnt; ++i) { sp->types[i] = (unsigned char) *p++; if (sp->types[i] >= sp->typecnt) - return -1; + goto out; } for (i = 0; i < sp->typecnt; ++i) { struct ttinfo * ttisp; @@ -483,11 +502,11 @@ register const int doextend; p += 4; ttisp->tt_isdst = (unsigned char) *p++; if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1) - return -1; + goto out; ttisp->tt_abbrind = (unsigned char) *p++; if (ttisp->tt_abbrind < 0 || ttisp->tt_abbrind > sp->charcnt) - return -1; + goto out; } for (i = 0; i < sp->charcnt; ++i) sp->chars[i] = *p++; @@ -512,7 +531,7 @@ register const int doextend; ttisp->tt_ttisstd = *p++; if (ttisp->tt_ttisstd != TRUE && ttisp->tt_ttisstd != FALSE) - return -1; + goto out; } } for (i = 0; i < sp->typecnt; ++i) { @@ -525,7 +544,7 @@ register const int doextend; ttisp->tt_ttisgmt = *p++; if (ttisp->tt_ttisgmt != TRUE && ttisp->tt_ttisgmt != FALSE) - return -1; + goto out; } } /* @@ -558,11 +577,11 @@ register const int doextend; /* ** If this is an old file, we're done. */ - if (u.tzhead.tzh_version[0] == '\0') + if (u->tzhead.tzh_version[0] == '\0') break; - nread -= p - u.buf; + nread -= p - u->buf; for (i = 0; i < nread; ++i) - u.buf[i] = p[i]; + u->buf[i] = p[i]; /* ** If this is a narrow integer time_t system, we're done. */ @@ -570,39 +589,43 @@ register const int doextend; break; } if (doextend && nread > 2 && - u.buf[0] == '\n' && u.buf[nread - 1] == '\n' && + u->buf[0] == '\n' && u->buf[nread - 1] == '\n' && sp->typecnt + 2 <= TZ_MAX_TYPES) { - struct state ts; + struct state *ts; register int result; - u.buf[nread - 1] = '\0'; - result = tzparse(&u.buf[1], &ts, FALSE); - if (result == 0 && ts.typecnt == 2 && - sp->charcnt + ts.charcnt <= TZ_MAX_CHARS) { + ts = malloc(sizeof(*ts)); + if (ts == NULL) + goto out; + u->buf[nread - 1] = '\0'; + result = tzparse(&u->buf[1], ts, FALSE); + if (result == 0 && ts->typecnt == 2 && + sp->charcnt + ts->charcnt <= TZ_MAX_CHARS) { for (i = 0; i < 2; ++i) - ts.ttis[i].tt_abbrind += + ts->ttis[i].tt_abbrind += sp->charcnt; - for (i = 0; i < ts.charcnt; ++i) + for (i = 0; i < ts->charcnt; ++i) sp->chars[sp->charcnt++] = - ts.chars[i]; + ts->chars[i]; i = 0; - while (i < ts.timecnt && - ts.ats[i] <= + while (i < ts->timecnt && + ts->ats[i] <= sp->ats[sp->timecnt - 1]) ++i; - while (i < ts.timecnt && + while (i < ts->timecnt && sp->timecnt < TZ_MAX_TIMES) { sp->ats[sp->timecnt] = - ts.ats[i]; + ts->ats[i]; sp->types[sp->timecnt] = sp->typecnt + - ts.types[i]; + ts->types[i]; ++sp->timecnt; ++i; } - sp->ttis[sp->typecnt++] = ts.ttis[0]; - sp->ttis[sp->typecnt++] = ts.ttis[1]; + sp->ttis[sp->typecnt++] = ts->ttis[0]; + sp->ttis[sp->typecnt++] = ts->ttis[1]; } + free(ts); } if (sp->timecnt > 1) { for (i = 1; i < sp->timecnt; ++i) @@ -620,7 +643,10 @@ register const int doextend; break; } } - return 0; + res = 0; +out: + free(u); + return (res); } static int Modified: user/attilio/vmcontention/etc/rc.d/NETWORKING ============================================================================== --- user/attilio/vmcontention/etc/rc.d/NETWORKING Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/etc/rc.d/NETWORKING Tue Sep 20 08:01:43 2011 (r225690) @@ -5,7 +5,7 @@ # PROVIDE: NETWORKING NETWORK # REQUIRE: netif netoptions routing ppp ipfw stf faith -# REQUIRE: defaultroute routed mrouted route6d mroute6d resolv +# REQUIRE: defaultroute routed mrouted route6d mroute6d resolv bridge # This is a dummy dependency, for services which require networking # to be operational before starting. Modified: user/attilio/vmcontention/etc/rc.d/bridge ============================================================================== --- user/attilio/vmcontention/etc/rc.d/bridge Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/etc/rc.d/bridge Tue Sep 20 08:01:43 2011 (r225690) @@ -26,7 +26,7 @@ # # PROVIDE: bridge -# REQUIRE: netif +# REQUIRE: netif faith ppp stf # KEYWORD: nojail . /etc/rc.subr Modified: user/attilio/vmcontention/etc/rc.d/resolv ============================================================================== --- user/attilio/vmcontention/etc/rc.d/resolv Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/etc/rc.d/resolv Tue Sep 20 08:01:43 2011 (r225690) @@ -28,7 +28,7 @@ # # PROVIDE: resolv -# REQUIRE: netif +# REQUIRE: netif var # KEYWORD: nojail . /etc/rc.subr @@ -41,17 +41,17 @@ load_rc_config $name # if the info is available via dhcp/kenv # build the resolv.conf # -if [ ! -e /etc/resolv.conf -a \ - -n "`/bin/kenv dhcp.domain-name-servers 2> /dev/null`" ]; then - > /etc/resolv.conf - +if [ -n "`/bin/kenv dhcp.domain-name-servers 2> /dev/null`" ]; then + interface="`/bin/kenv boot.netif.name`" + ( if [ -n "`/bin/kenv dhcp.domain-name 2> /dev/null`" ]; then - echo domain `/bin/kenv dhcp.domain-name` > /etc/resolv.conf + echo domain `/bin/kenv dhcp.domain-name` fi set -- `/bin/kenv dhcp.domain-name-servers` for ns in `IFS=','; echo $*`; do - echo nameserver $ns >> /etc/resolv.conf; + echo nameserver $ns done + ) | /sbin/resolvconf -a ${interface}:dhcp4 fi Modified: user/attilio/vmcontention/lib/libc/iconv/citrus_none.c ============================================================================== --- user/attilio/vmcontention/lib/libc/iconv/citrus_none.c Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/lib/libc/iconv/citrus_none.c Tue Sep 20 08:01:43 2011 (r225690) @@ -190,7 +190,6 @@ _citrus_NONE_stdenc_wctomb(struct _citru void * __restrict pspriv __unused, size_t * __restrict nresult, struct iconv_hooks *hooks __unused) { - int ret; if ((wc & ~0xFFU) != 0) { *nresult = (size_t)-1; @@ -198,7 +197,7 @@ _citrus_NONE_stdenc_wctomb(struct _citru } if (n == 0) { *nresult = (size_t)-1; - ret = E2BIG; + return (E2BIG); } *nresult = 1; Modified: user/attilio/vmcontention/lib/libusb/Makefile ============================================================================== --- user/attilio/vmcontention/lib/libusb/Makefile Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/lib/libusb/Makefile Tue Sep 20 08:01:43 2011 (r225690) @@ -40,6 +40,7 @@ CFLAGS+= -DCOMPAT_32BIT MLINKS += libusb.3 libusb_init.3 MLINKS += libusb.3 libusb_exit.3 MLINKS += libusb.3 libusb_strerror.3 +MLINKS += libusb.3 libusb_error_name.3 MLINKS += libusb.3 libusb_set_debug.3 MLINKS += libusb.3 libusb_get_device_list.3 MLINKS += libusb.3 libusb_free_device_list.3 @@ -210,3 +211,5 @@ MLINKS += libusb20.3 libusb20_me_get_2.3 MLINKS += libusb20.3 libusb20_me_encode.3 MLINKS += libusb20.3 libusb20_me_decode.3 MLINKS += libusb20.3 libusb20_desc_foreach.3 +MLINKS += libusb20.3 libusb20_strerror.3 +MLINKS += libusb20.3 libusb20_error_name.3 Modified: user/attilio/vmcontention/lib/libusb/libusb.3 ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb.3 Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/lib/libusb/libusb.3 Tue Sep 20 08:01:43 2011 (r225690) @@ -63,6 +63,14 @@ Other libusb routines may not be called Get the ASCII representation of the error given by the .Fa code argument. +This function does not return NULL. +.Pp +.Ft const char * +.Fn libusb_error_name "int code" +Get the ASCII representation of the error enum given by the +.Fa code +argument. +This function does not return NULL. .Pp .Ft void .Fn libusb_set_debug "libusb_context *ctx" "int level" @@ -502,7 +510,8 @@ The library is also compliant with LibUS .Sh SEE ALSO .Xr libusb20 3 , .Xr usb 4 , -.Xr usbconfig 8 +.Xr usbconfig 8 , +.Xr usbdump 8 .Pp .Pa http://libusb.sourceforge.net/ .Sh HISTORY Modified: user/attilio/vmcontention/lib/libusb/libusb.h ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb.h Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/lib/libusb/libusb.h Tue Sep 20 08:01:43 2011 (r225690) @@ -303,6 +303,7 @@ typedef struct libusb_transfer { void libusb_set_debug(libusb_context * ctx, int level); const char *libusb_strerror(int code); +const char *libusb_error_name(int code); int libusb_init(libusb_context ** context); void libusb_exit(struct libusb_context *ctx); Modified: user/attilio/vmcontention/lib/libusb/libusb10.c ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb10.c Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/lib/libusb/libusb10.c Tue Sep 20 08:01:43 2011 (r225690) @@ -1449,6 +1449,73 @@ libusb_le16_to_cpu(uint16_t x) const char * libusb_strerror(int code) { - /* TODO */ - return ("Unknown error"); + switch (code) { + case LIBUSB_SUCCESS: + return ("Success"); + case LIBUSB_ERROR_IO: + return ("I/O error"); + case LIBUSB_ERROR_INVALID_PARAM: + return ("Invalid parameter"); + case LIBUSB_ERROR_ACCESS: + return ("Permissions error"); + case LIBUSB_ERROR_NO_DEVICE: + return ("No device"); + case LIBUSB_ERROR_NOT_FOUND: + return ("Not found"); + case LIBUSB_ERROR_BUSY: + return ("Device busy"); + case LIBUSB_ERROR_TIMEOUT: + return ("Timeout"); + case LIBUSB_ERROR_OVERFLOW: + return ("Overflow"); + case LIBUSB_ERROR_PIPE: + return ("Pipe error"); + case LIBUSB_ERROR_INTERRUPTED: + return ("Interrupted"); + case LIBUSB_ERROR_NO_MEM: + return ("Out of memory"); + case LIBUSB_ERROR_NOT_SUPPORTED: + return ("Not supported"); + case LIBUSB_ERROR_OTHER: + return ("Other error"); + default: + return ("Unknown error"); + } +} + +const char * +libusb_error_name(int code) +{ + switch (code) { + case LIBUSB_SUCCESS: + return ("LIBUSB_SUCCESS"); + case LIBUSB_ERROR_IO: + return ("LIBUSB_ERROR_IO"); + case LIBUSB_ERROR_INVALID_PARAM: + return ("LIBUSB_ERROR_INVALID_PARAM"); + case LIBUSB_ERROR_ACCESS: + return ("LIBUSB_ERROR_ACCESS"); + case LIBUSB_ERROR_NO_DEVICE: + return ("LIBUSB_ERROR_NO_DEVICE"); + case LIBUSB_ERROR_NOT_FOUND: + return ("LIBUSB_ERROR_NOT_FOUND"); + case LIBUSB_ERROR_BUSY: + return ("LIBUSB_ERROR_BUSY"); + case LIBUSB_ERROR_TIMEOUT: + return ("LIBUSB_ERROR_TIMEOUT"); + case LIBUSB_ERROR_OVERFLOW: + return ("LIBUSB_ERROR_OVERFLOW"); + case LIBUSB_ERROR_PIPE: + return ("LIBUSB_ERROR_PIPE"); + case LIBUSB_ERROR_INTERRUPTED: + return ("LIBUSB_ERROR_INTERRUPTED"); + case LIBUSB_ERROR_NO_MEM: + return ("LIBUSB_ERROR_NO_MEM"); + case LIBUSB_ERROR_NOT_SUPPORTED: + return ("LIBUSB_ERROR_NOT_SUPPORTED"); + case LIBUSB_ERROR_OTHER: + return ("LIBUSB_ERROR_OTHER"); + default: + return ("LIBUSB_ERROR_UNKNOWN"); + } } Modified: user/attilio/vmcontention/lib/libusb/libusb20.3 ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb20.3 Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/lib/libusb/libusb20.3 Tue Sep 20 08:01:43 2011 (r225690) @@ -212,6 +212,10 @@ USB access library (libusb -lusb) .Fn libusb20_me_decode "const void *pdata" "uint16_t len" "void *pdecoded" .Ft "const uint8_t *" .Fn libusb20_desc_foreach "const struct libusb20_me_struct *me" "const uint8_t *pdesc" +.Ft "const char *" +.Fn libusb20_strerror "int code" +.Ft "const char *" +.Fn libusb20_error_name "int code" . . .Sh DESCRIPTION @@ -996,6 +1000,22 @@ The total decoded length is returned. The buffer pointer cannot be NULL. . . +.Sh USB DEBUGGING +.Pp +.Ft const char * +.Fn libusb20_strerror "int code" +Get the ASCII representation of the error given by the +.Fa code +argument. +This function does not return NULL. +.Pp +.Ft const char * +.Fn libusb20_error_name "int code" +Get the ASCII representation of the error enum given by the +.Fa code +argument. +This function does not return NULL. +. .Sh FILES . . @@ -1003,7 +1023,8 @@ The buffer pointer cannot be NULL. .Sh SEE ALSO .Xr usb 4 , .Xr libusb 3 , -.Xr usbconfig 8 +.Xr usbconfig 8 , +.Xr usbdump 8 . . .Sh HISTORY Modified: user/attilio/vmcontention/lib/libusb/libusb20.c ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb20.c Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/lib/libusb/libusb20.c Tue Sep 20 08:01:43 2011 (r225690) @@ -1244,3 +1244,77 @@ libusb20_be_dequeue_device(struct libusb { TAILQ_REMOVE(&(pbe->usb_devs), pdev, dev_entry); } + +const char * +libusb20_strerror(int code) +{ + switch (code) { + case LIBUSB20_SUCCESS: + return ("Success"); + case LIBUSB20_ERROR_IO: + return ("I/O error"); + case LIBUSB20_ERROR_INVALID_PARAM: + return ("Invalid parameter"); + case LIBUSB20_ERROR_ACCESS: + return ("Permissions error"); + case LIBUSB20_ERROR_NO_DEVICE: + return ("No device"); + case LIBUSB20_ERROR_NOT_FOUND: + return ("Not found"); + case LIBUSB20_ERROR_BUSY: + return ("Device busy"); + case LIBUSB20_ERROR_TIMEOUT: + return ("Timeout"); + case LIBUSB20_ERROR_OVERFLOW: + return ("Overflow"); + case LIBUSB20_ERROR_PIPE: + return ("Pipe error"); + case LIBUSB20_ERROR_INTERRUPTED: + return ("Interrupted"); + case LIBUSB20_ERROR_NO_MEM: + return ("Out of memory"); + case LIBUSB20_ERROR_NOT_SUPPORTED: + return ("Not supported"); + case LIBUSB20_ERROR_OTHER: + return ("Other error"); + default: + return ("Unknown error"); + } +} + +const char * +libusb20_error_name(int code) +{ + switch (code) { + case LIBUSB20_SUCCESS: + return ("LIBUSB20_SUCCESS"); + case LIBUSB20_ERROR_IO: + return ("LIBUSB20_ERROR_IO"); + case LIBUSB20_ERROR_INVALID_PARAM: + return ("LIBUSB20_ERROR_INVALID_PARAM"); + case LIBUSB20_ERROR_ACCESS: + return ("LIBUSB20_ERROR_ACCESS"); + case LIBUSB20_ERROR_NO_DEVICE: + return ("LIBUSB20_ERROR_NO_DEVICE"); + case LIBUSB20_ERROR_NOT_FOUND: + return ("LIBUSB20_ERROR_NOT_FOUND"); + case LIBUSB20_ERROR_BUSY: + return ("LIBUSB20_ERROR_BUSY"); + case LIBUSB20_ERROR_TIMEOUT: + return ("LIBUSB20_ERROR_TIMEOUT"); + case LIBUSB20_ERROR_OVERFLOW: + return ("LIBUSB20_ERROR_OVERFLOW"); + case LIBUSB20_ERROR_PIPE: + return ("LIBUSB20_ERROR_PIPE"); + case LIBUSB20_ERROR_INTERRUPTED: + return ("LIBUSB20_ERROR_INTERRUPTED"); + case LIBUSB20_ERROR_NO_MEM: + return ("LIBUSB20_ERROR_NO_MEM"); + case LIBUSB20_ERROR_NOT_SUPPORTED: + return ("LIBUSB20_ERROR_NOT_SUPPORTED"); + case LIBUSB20_ERROR_OTHER: + return ("LIBUSB20_ERROR_OTHER"); + default: + return ("LIBUSB20_ERROR_UNKNOWN"); + } +} Modified: user/attilio/vmcontention/lib/libusb/libusb20.h ============================================================================== --- user/attilio/vmcontention/lib/libusb/libusb20.h Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/lib/libusb/libusb20.h Tue Sep 20 08:01:43 2011 (r225690) @@ -293,6 +293,11 @@ void libusb20_be_dequeue_device(struct l void libusb20_be_enqueue_device(struct libusb20_backend *pbe, struct libusb20_device *pdev); void libusb20_be_free(struct libusb20_backend *pbe); +/* USB debugging */ + +const char *libusb20_strerror(int); +const char *libusb20_error_name(int); + #if 0 { /* style */ #endif Modified: user/attilio/vmcontention/sbin/ifconfig/ifconfig.8 ============================================================================== --- user/attilio/vmcontention/sbin/ifconfig/ifconfig.8 Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/sbin/ifconfig/ifconfig.8 Tue Sep 20 08:01:43 2011 (r225690) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd July 3, 2011 +.Dd September 13, 2011 .Dt IFCONFIG 8 .Os .Sh NAME @@ -626,12 +626,37 @@ is needed for them: .Bl -tag -width indent .It Cm accept_rtadv Set a flag to enable accepting ICMPv6 Router Advertisement messages. +The +.Xr sysctl 8 +variable +.Va net.inet6.ip6.accept_rtadv +controls whether this flag is set by default or not. .It Cm -accept_rtadv Clear a flag .Cm accept_rtadv . +.It Cm no_radr +Set a flag to control whether routers from which the system accepts +Router Advertisement messages will be added to the Default Router List +or not. +When the +.Cm accept_rtadv +flag is disabled, this flag has no effect. +The +.Xr sysctl 8 +variable +.Va net.inet6.ip6.no_radr +controls whether this flag is set by default or not. +.It Cm -no_radr +Clear a flag +.Cm no_radr . .It Cm auto_linklocal Set a flag to perform automatic link-local address configuration when the interface becomes available. +The +.Xr sysctl 8 +variable +.Va net.inet6.ip6.auto_linklocal +controls whether this flag is set by default or not. .It Cm -auto_linklocal Clear a flag .Cm auto_linklocal . Modified: user/attilio/vmcontention/share/man/man5/rc.conf.5 ============================================================================== --- user/attilio/vmcontention/share/man/man5/rc.conf.5 Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/share/man/man5/rc.conf.5 Tue Sep 20 08:01:43 2011 (r225690) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 19, 2011 +.Dd September 13, 2011 .Dt RC.CONF 5 .Os .Sh NAME @@ -1282,6 +1282,13 @@ ifconfig_ed0_name="net0" ifconfig_net0="inet 192.0.2.1 netmask 0xffffff00" .Ed .It Va ipv6_enable +This variable is deprecated. +Use +.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6 +and +.Va ipv6_activate_all_interfaces +if necessary. +.Pp .Pq Vt bool If the variable is .Dq Li YES , @@ -1292,13 +1299,12 @@ and the .Va ipv6_activate_all_interfaces is defined as .Dq Li YES . -.Pp -This variable is deprecated. Use -.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6 -and -.Va ipv6_activate_all_interfaces -if necessary. .It Va ipv6_prefer +This variable is deprecated. +Use +.Va ip6addrctl_policy +instead. +.Pp .Pq Vt bool If the variable is .Dq Li YES , @@ -1311,19 +1317,45 @@ If the variable is the default address selection policy table set by .Xr ip6addrctl 8 will be IPv4-preferred. -.Pp -This variable is deprecated. Use -.Va ip6addrctl_policy -instead. .It Va ipv6_activate_all_interfaces +.Pq Vt bool +This controls initial configuration on IPv6-capable +interfaces with no corresponding +.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6 +variable. +Note that it is not always necessary to set this variable to +.Dq YES +to use IPv6 functionality on +.Fx . +In most cases, just configuring +.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6 +variables works. +.Pp If the variable is .Dq Li NO , -all of interfaces which do not have the corrsponding +all interfaces which do not have a corresponding .Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6 variable will be marked as .Dq Li IFDISABLED -for security reason. This means only IPv6 functionality on that interface -is completely disabled. For more details of +at creation. +This means that all of IPv6 functionality on that interface +is completely disabled to enforce a security policy. +If the variable is set to +.Dq YES , +the flag will be cleared on all of the interfaces. +.Pp +In most cases, just defining an +.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6 +for an IPv6-capable interface should be sufficient. +However, if an interface is added dynamically +.Pq by some tunneling protocols such as PPP, for example , +it is often difficult to define the variable in advance. +In such a case, configuring the +.Dq Li IFDISABLED +flag can be disabled by setting this variable to +.Dq YES . +.Pp +For more details of the .Dq Li IFDISABLED flag and keywords .Dq Li inet6 ifdisabled , @@ -1344,6 +1376,47 @@ This is the IPv6 equivalent of .Va network_interfaces . Normally manual configuration of this variable is not needed. .Pp +.It Va ipv6_cpe_wanif +.Pq Vt str +If the variable is set to an interface name, +the +.Xr ifconfig 8 +options +.Dq inet6 -no_radr accept_rtadv +will be added to the specified interface automatically before evaluating +.Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6 , +and two +.Xr sysctl 8 +variables +.Va net.inet6.ip6.rfc6204w3 +and +.Va net.inet6.ip6.no_radr +will be set to 1. +.Pp +This means the specified interface will accept ICMPv6 Router +Advertisement messages on that link and add the discovered +routers into the Default Router List. +While the other interfaces can still accept RA messages if the +.Dq inet6 accept_rtadv +option is specified, adding +routes into the Default Router List will be disabled by +.Dq inet6 no_radr +option by default. +See +.Xr ifconfig 8 +for more details. +.Pp +Note that ICMPv6 Router Advertisement messages will be +accepted even when +.Va net.inet6.ip6.forwarding +is 1 +.Pq packet fowarding is enabled +when +.Va net.inet6.ip6.rfc6204w3 +is set to 1. +.Pp +Default is +.Dq Li NO . .It Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6 .Pq Vt str IPv6 functionality on an interface should be configured by @@ -1360,16 +1433,37 @@ ifconfig_ed0_ipv6="inet6 2001:db8:1::1 p ifconfig_ed0_alias0="inet6 2001:db8:2::1 prefixlen 64" .Ed .Pp +Note that a link-local address will be automatically configured in +addition to the configured global-scope addresses because the IPv6 +specifications require it on each link. +The address is calculated from the MAC address by using an algorithm +defined in +.Rs +.%T "RFC 4862" +.%O "Section 5.3" +.Re +.Pp +If only a link-local address is needed on the interface, +the following configuration can be used: +.Bd -literal +ifconfig_ed0_ipv6="inet6 auto_linklocal" +.Ed +.Pp +A link-local address can also be configured manually. +This is useful for the default router address of an IPv6 router +so that it does not change when the network interface +card is replaced. +For example: +.Bd -literal +ifconfig_ed0_ipv6="inet6 fe80::1 prefixlen 64" +.Ed +.Pp Interfaces that have an .Dq Li inet6 accept_rtadv keyword in .Va ifconfig_ Ns Ao Ar interface Ac Ns _ipv6 setting will be automatically configured by .Xr rtsol 8 . -Note that this automatic configuration is disabled if the -.Va ipv6_gateway_enable -is set to -.Dq Li YES . .It Va ipv6_prefix_ Ns Aq Ar interface .Pq Vt str If one or more prefixes are defined in @@ -2628,16 +2722,12 @@ If set to run the .Xr rtadvd 8 daemon at boot time. -.Xr rtadvd 8 -will only run if -.Va ipv6_gateway_enable -is also set to -.Dq Li YES . The .Xr rtadvd 8 -utility sends router advertisement packets to the interfaces specified in -.Va rtadvd_interfaces -and should only be enabled with great care. +utility sends ICMPv6 Router Advertisement messages to +the interfaces specified in +.Va rtadvd_interfaces . +This should only be enabled with great care. You may want to fine-tune .Xr rtadvd.conf 5 . .It Va rtadvd_interfaces Modified: user/attilio/vmcontention/sys/dev/coretemp/coretemp.c ============================================================================== --- user/attilio/vmcontention/sys/dev/coretemp/coretemp.c Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/sys/dev/coretemp/coretemp.c Tue Sep 20 08:01:43 2011 (r225690) @@ -384,6 +384,7 @@ coretemp_get_val_sysctl(SYSCTL_HANDLER_A } if (msr & THERM_STATUS_LOG) { + coretemp_clear_thermal_msr(device_get_unit(dev)); sc->sc_throttle_log = 1; /* @@ -424,8 +425,10 @@ coretemp_throttle_log_sysctl(SYSCTL_HAND msr = coretemp_get_thermal_msr(device_get_unit(dev)); sc = device_get_softc(dev); - if (msr & THERM_STATUS_LOG) + if (msr & THERM_STATUS_LOG) { + coretemp_clear_thermal_msr(device_get_unit(dev)); sc->sc_throttle_log = 1; + } val = sc->sc_throttle_log; Modified: user/attilio/vmcontention/sys/dev/e1000/if_lem.c ============================================================================== --- user/attilio/vmcontention/sys/dev/e1000/if_lem.c Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/sys/dev/e1000/if_lem.c Tue Sep 20 08:01:43 2011 (r225690) @@ -2654,6 +2654,7 @@ lem_setup_transmit_structures(struct ada } /* Reset state */ + adapter->last_hw_offload = 0; adapter->next_avail_tx_desc = 0; adapter->next_tx_to_clean = 0; adapter->num_tx_desc_avail = adapter->num_tx_desc; Modified: user/attilio/vmcontention/sys/dev/iwn/if_iwn.c ============================================================================== --- user/attilio/vmcontention/sys/dev/iwn/if_iwn.c Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/sys/dev/iwn/if_iwn.c Tue Sep 20 08:01:43 2011 (r225690) @@ -6952,12 +6952,24 @@ iwn_set_channel(struct ieee80211com *ic) const struct ieee80211_channel *c = ic->ic_curchan; struct ifnet *ifp = ic->ic_ifp; struct iwn_softc *sc = ifp->if_softc; + int error; IWN_LOCK(sc); sc->sc_rxtap.wr_chan_freq = htole16(c->ic_freq); sc->sc_rxtap.wr_chan_flags = htole16(c->ic_flags); sc->sc_txtap.wt_chan_freq = htole16(c->ic_freq); sc->sc_txtap.wt_chan_flags = htole16(c->ic_flags); + + /* + * Only need to set the channel in Monitor mode. AP scanning and auth + * are already taken care of by their respective firmware commands. + */ + if (ic->ic_opmode == IEEE80211_M_MONITOR) { + error = iwn_config(sc); + if (error != 0) + device_printf(sc->sc_dev, + "%s: error %d settting channel\n", __func__, error); + } IWN_UNLOCK(sc); } Modified: user/attilio/vmcontention/sys/kern/kern_exit.c ============================================================================== --- user/attilio/vmcontention/sys/kern/kern_exit.c Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/sys/kern/kern_exit.c Tue Sep 20 08:01:43 2011 (r225690) @@ -765,12 +765,12 @@ proc_reap(struct thread *td, struct proc /* * Destroy resource accounting information associated with the process. */ - racct_proc_exit(p); #ifdef RACCT - PROC_LOCK(p->p_pptr); - racct_sub(p->p_pptr, RACCT_NPROC, 1); - PROC_UNLOCK(p->p_pptr); + PROC_LOCK(p); + racct_sub(p, RACCT_NPROC, 1); + PROC_UNLOCK(p); #endif + racct_proc_exit(p); /* * Free credentials, arguments, and sigacts. @@ -929,25 +929,13 @@ loop: void proc_reparent(struct proc *child, struct proc *parent) { -#ifdef RACCT - int locked; -#endif sx_assert(&proctree_lock, SX_XLOCKED); PROC_LOCK_ASSERT(child, MA_OWNED); if (child->p_pptr == parent) return; -#ifdef RACCT - locked = PROC_LOCKED(parent); - if (!locked) - PROC_LOCK(parent); - racct_add_force(parent, RACCT_NPROC, 1); - if (!locked) - PROC_UNLOCK(parent); -#endif PROC_LOCK(child->p_pptr); - racct_sub(child->p_pptr, RACCT_NPROC, 1); sigqueue_take(child->p_ksi); PROC_UNLOCK(child->p_pptr); LIST_REMOVE(child, p_sibling); Modified: user/attilio/vmcontention/sys/kern/kern_fork.c ============================================================================== --- user/attilio/vmcontention/sys/kern/kern_fork.c Tue Sep 20 07:19:39 2011 (r225689) +++ user/attilio/vmcontention/sys/kern/kern_fork.c Tue Sep 20 08:01:43 2011 (r225690) @@ -806,14 +806,6 @@ fork1(struct thread *td, int flags, int return (fork_norfproc(td, flags)); } -#ifdef RACCT - PROC_LOCK(p1); - error = racct_add(p1, RACCT_NPROC, 1); - PROC_UNLOCK(p1); - if (error != 0) - return (EAGAIN); -#endif - #ifdef PROCDESC /* * If required, create a process descriptor in the parent first; we @@ -822,14 +814,8 @@ fork1(struct thread *td, int flags, int */ if (flags & RFPROCDESC) { error = falloc(td, &fp_procdesc, procdescp, 0); - if (error != 0) { -#ifdef RACCT *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Tue Sep 20 08:11:08 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E21F4106564A; Tue, 20 Sep 2011 08:11:07 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D0DD08FC14; Tue, 20 Sep 2011 08:11:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8K8B7df017447; Tue, 20 Sep 2011 08:11:07 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8K8B7af017443; Tue, 20 Sep 2011 08:11:07 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201109200811.p8K8B7af017443@svn.freebsd.org> From: Attilio Rao Date: Tue, 20 Sep 2011 08:11:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225691 - in user/attilio/vmcontention/sys/sparc64: include sparc64 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 08:11:08 -0000 Author: attilio Date: Tue Sep 20 08:11:07 2011 New Revision: 225691 URL: http://svn.freebsd.org/changeset/base/225691 Log: Replace the vm_page_queue_lock mis-usage with a global MD page rwlock that protects the TTE list and page coloring bits. Additively, bring out of any locking some calles to vm_page_aflag_clear() as it is no longer necessary now. Discussed with: alc Reviewed by: alc Tested by: flo Modified: user/attilio/vmcontention/sys/sparc64/include/pmap.h user/attilio/vmcontention/sys/sparc64/sparc64/pmap.c user/attilio/vmcontention/sys/sparc64/sparc64/tsb.c Modified: user/attilio/vmcontention/sys/sparc64/include/pmap.h ============================================================================== --- user/attilio/vmcontention/sys/sparc64/include/pmap.h Tue Sep 20 08:01:43 2011 (r225690) +++ user/attilio/vmcontention/sys/sparc64/include/pmap.h Tue Sep 20 08:11:07 2011 (r225691) @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -78,6 +79,12 @@ struct pmap { #define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx) #define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx) +#define MDPAGE_ASSERT_WLOCKED() rw_assert(&md_page_rwlock, RA_WLOCKED) +#define MDPAGE_RLOCK() rw_rlock(&md_page_rwlock) +#define MDPAGE_WLOCK() rw_wlock(&md_page_rwlock) +#define MDPAGE_RUNLOCK() rw_runlock(&md_page_rwlock) +#define MDPAGE_WUNLOCK() rw_wunlock(&md_page_rwlock) + #define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT #define pmap_page_set_memattr(m, ma) (void)0 @@ -101,6 +108,7 @@ void pmap_set_kctx(void); extern struct pmap kernel_pmap_store; #define kernel_pmap (&kernel_pmap_store) +extern struct rwlock md_page_rwlock; extern vm_paddr_t phys_avail[]; extern vm_offset_t virtual_avail; extern vm_offset_t virtual_end; Modified: user/attilio/vmcontention/sys/sparc64/sparc64/pmap.c ============================================================================== --- user/attilio/vmcontention/sys/sparc64/sparc64/pmap.c Tue Sep 20 08:01:43 2011 (r225690) +++ user/attilio/vmcontention/sys/sparc64/sparc64/pmap.c Tue Sep 20 08:11:07 2011 (r225691) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -188,6 +189,11 @@ extern int tl1_immu_miss_patch_tsb_mask_ extern int tl1_immu_miss_patch_tsb_mask_2[]; /* + * MD page read/write lock. + */ +struct rwlock md_page_rwlock; + +/* * If user pmap is processed with pmap_remove and with pmap_remove and the * resident count drops to 0, there are no more pages to remove, so we * need not continue. @@ -679,6 +685,11 @@ pmap_bootstrap(u_int cpu_impl) CPU_FILL(&pm->pm_active); /* + * Initialize the MD page lock. + */ + rw_init(&md_page_rwlock, "MD page"); + + /* * Flush all non-locked TLB entries possibly left over by the * firmware. */ @@ -888,7 +899,7 @@ pmap_cache_enter(vm_page_t m, vm_offset_ struct tte *tp; int color; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + MDPAGE_ASSERT_WLOCKED(); KASSERT((m->flags & PG_FICTITIOUS) == 0, ("pmap_cache_enter: fake page")); PMAP_STATS_INC(pmap_ncache_enter); @@ -963,7 +974,7 @@ pmap_cache_remove(vm_page_t m, vm_offset struct tte *tp; int color; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + MDPAGE_ASSERT_WLOCKED(); CTR3(KTR_PMAP, "pmap_cache_remove: m=%p va=%#lx c=%d", m, va, m->md.colors[DCACHE_COLOR(va)]); KASSERT((m->flags & PG_FICTITIOUS) == 0, @@ -1038,7 +1049,7 @@ pmap_kenter(vm_offset_t va, vm_page_t m) vm_page_t om; u_long data; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + MDPAGE_ASSERT_WLOCKED(); PMAP_STATS_INC(pmap_nkenter); tp = tsb_kvtotte(va); CTR4(KTR_PMAP, "pmap_kenter: va=%#lx pa=%#lx tp=%p data=%#lx", @@ -1100,7 +1111,7 @@ pmap_kremove(vm_offset_t va) struct tte *tp; vm_page_t m; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + MDPAGE_ASSERT_WLOCKED(); PMAP_STATS_INC(pmap_nkremove); tp = tsb_kvtotte(va); CTR3(KTR_PMAP, "pmap_kremove: va=%#lx tp=%p data=%#lx", va, tp, @@ -1151,19 +1162,16 @@ void pmap_qenter(vm_offset_t sva, vm_page_t *m, int count) { vm_offset_t va; - int locked; PMAP_STATS_INC(pmap_nqenter); va = sva; - if (!(locked = mtx_owned(&vm_page_queue_mtx))) - vm_page_lock_queues(); + MDPAGE_WLOCK(); while (count-- > 0) { pmap_kenter(va, *m); va += PAGE_SIZE; m++; } - if (!locked) - vm_page_unlock_queues(); + MDPAGE_WUNLOCK(); tlb_range_demap(kernel_pmap, sva, va); } @@ -1175,18 +1183,15 @@ void pmap_qremove(vm_offset_t sva, int count) { vm_offset_t va; - int locked; PMAP_STATS_INC(pmap_nqremove); va = sva; - if (!(locked = mtx_owned(&vm_page_queue_mtx))) - vm_page_lock_queues(); + MDPAGE_WLOCK(); while (count-- > 0) { pmap_kremove(va); va += PAGE_SIZE; } - if (!locked) - vm_page_unlock_queues(); + MDPAGE_WUNLOCK(); tlb_range_demap(kernel_pmap, sva, va); } @@ -1327,7 +1332,7 @@ pmap_remove_tte(struct pmap *pm, struct vm_page_t m; u_long data; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + MDPAGE_ASSERT_WLOCKED(); data = atomic_readandclear_long(&tp->tte_data); if ((data & TD_FAKE) == 0) { m = PHYS_TO_VM_PAGE(TD_PA(data)); @@ -1364,7 +1369,7 @@ pmap_remove(pmap_t pm, vm_offset_t start pm->pm_context[curcpu], start, end); if (PMAP_REMOVE_DONE(pm)) return; - vm_page_lock_queues(); + MDPAGE_WLOCK(); PMAP_LOCK(pm); if (end - start > PMAP_TSB_THRESH) { tsb_foreach(pm, NULL, start, end, pmap_remove_tte); @@ -1377,7 +1382,7 @@ pmap_remove(pmap_t pm, vm_offset_t start tlb_range_demap(pm, start, end - 1); } PMAP_UNLOCK(pm); - vm_page_unlock_queues(); + MDPAGE_WUNLOCK(); } void @@ -1390,7 +1395,7 @@ pmap_remove_all(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_all: page %p is not managed", m)); - vm_page_lock_queues(); + MDPAGE_WLOCK(); for (tp = TAILQ_FIRST(&m->md.tte_list); tp != NULL; tp = tpn) { tpn = TAILQ_NEXT(tp, tte_link); if ((tp->tte_data & TD_PV) == 0) @@ -1412,8 +1417,8 @@ pmap_remove_all(vm_page_t m) TTE_ZERO(tp); PMAP_UNLOCK(pm); } + MDPAGE_WUNLOCK(); vm_page_aflag_clear(m, PGA_WRITEABLE); - vm_page_unlock_queues(); } static int @@ -1475,11 +1480,11 @@ pmap_enter(pmap_t pm, vm_offset_t va, vm vm_prot_t prot, boolean_t wired) { - vm_page_lock_queues(); + MDPAGE_WLOCK(); PMAP_LOCK(pm); pmap_enter_locked(pm, va, m, prot, wired); - vm_page_unlock_queues(); PMAP_UNLOCK(pm); + MDPAGE_WUNLOCK(); } /* @@ -1498,7 +1503,7 @@ pmap_enter_locked(pmap_t pm, vm_offset_t vm_page_t real; u_long data; - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + MDPAGE_ASSERT_WLOCKED(); PMAP_LOCK_ASSERT(pm, MA_OWNED); KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 || VM_OBJECT_LOCKED(m->object), @@ -1641,27 +1646,27 @@ pmap_enter_object(pmap_t pm, vm_offset_t psize = atop(end - start); m = m_start; - vm_page_lock_queues(); + MDPAGE_WLOCK(); PMAP_LOCK(pm); while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { pmap_enter_locked(pm, start + ptoa(diff), m, prot & (VM_PROT_READ | VM_PROT_EXECUTE), FALSE); m = TAILQ_NEXT(m, listq); } - vm_page_unlock_queues(); PMAP_UNLOCK(pm); + MDPAGE_WUNLOCK(); } void pmap_enter_quick(pmap_t pm, vm_offset_t va, vm_page_t m, vm_prot_t prot) { - vm_page_lock_queues(); + MDPAGE_WLOCK(); PMAP_LOCK(pm); pmap_enter_locked(pm, va, m, prot & (VM_PROT_READ | VM_PROT_EXECUTE), FALSE); - vm_page_unlock_queues(); PMAP_UNLOCK(pm); + MDPAGE_WUNLOCK(); } void @@ -1706,6 +1711,8 @@ pmap_copy_tte(pmap_t src_pmap, pmap_t ds vm_page_t m; u_long data; + MDPAGE_ASSERT_WLOCKED(); + if ((tp->tte_data & TD_FAKE) != 0) return (1); if (tsb_tte_lookup(dst_pmap, va) == NULL) { @@ -1726,7 +1733,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm if (dst_addr != src_addr) return; - vm_page_lock_queues(); + MDPAGE_WLOCK(); if (dst_pmap < src_pmap) { PMAP_LOCK(dst_pmap); PMAP_LOCK(src_pmap); @@ -1744,9 +1751,9 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm pmap_copy_tte(src_pmap, dst_pmap, tp, va); tlb_range_demap(dst_pmap, src_addr, src_addr + len - 1); } - vm_page_unlock_queues(); PMAP_UNLOCK(src_pmap); PMAP_UNLOCK(dst_pmap); + MDPAGE_WUNLOCK(); } void @@ -1943,7 +1950,7 @@ pmap_page_exists_quick(pmap_t pm, vm_pag ("pmap_page_exists_quick: page %p is not managed", m)); loops = 0; rv = FALSE; - vm_page_lock_queues(); + MDPAGE_RLOCK(); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { if ((tp->tte_data & TD_PV) == 0) continue; @@ -1954,7 +1961,7 @@ pmap_page_exists_quick(pmap_t pm, vm_pag if (++loops >= 16) break; } - vm_page_unlock_queues(); + MDPAGE_RUNLOCK(); return (rv); } @@ -1971,11 +1978,11 @@ pmap_page_wired_mappings(vm_page_t m) count = 0; if ((m->oflags & VPO_UNMANAGED) != 0) return (count); - vm_page_lock_queues(); + MDPAGE_RLOCK(); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) if ((tp->tte_data & (TD_PV | TD_WIRED)) == (TD_PV | TD_WIRED)) count++; - vm_page_unlock_queues(); + MDPAGE_RUNLOCK(); return (count); } @@ -2002,13 +2009,13 @@ pmap_page_is_mapped(vm_page_t m) rv = FALSE; if ((m->oflags & VPO_UNMANAGED) != 0) return (rv); - vm_page_lock_queues(); + MDPAGE_RLOCK(); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) if ((tp->tte_data & TD_PV) != 0) { rv = TRUE; break; } - vm_page_unlock_queues(); + MDPAGE_RUNLOCK(); return (rv); } @@ -2034,7 +2041,7 @@ pmap_ts_referenced(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_ts_referenced: page %p is not managed", m)); count = 0; - vm_page_lock_queues(); + MDPAGE_WLOCK(); if ((tp = TAILQ_FIRST(&m->md.tte_list)) != NULL) { tpf = tp; do { @@ -2048,7 +2055,7 @@ pmap_ts_referenced(vm_page_t m) break; } while ((tp = tpn) != NULL && tp != tpf); } - vm_page_unlock_queues(); + MDPAGE_WUNLOCK(); return (count); } @@ -2071,7 +2078,7 @@ pmap_is_modified(vm_page_t m) if ((m->oflags & VPO_BUSY) == 0 && (m->aflags & PGA_WRITEABLE) == 0) return (rv); - vm_page_lock_queues(); + MDPAGE_RLOCK(); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { if ((tp->tte_data & TD_PV) == 0) continue; @@ -2080,7 +2087,7 @@ pmap_is_modified(vm_page_t m) break; } } - vm_page_unlock_queues(); + MDPAGE_RUNLOCK(); return (rv); } @@ -2114,7 +2121,7 @@ pmap_is_referenced(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_is_referenced: page %p is not managed", m)); rv = FALSE; - vm_page_lock_queues(); + MDPAGE_RLOCK(); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { if ((tp->tte_data & TD_PV) == 0) continue; @@ -2123,7 +2130,7 @@ pmap_is_referenced(vm_page_t m) break; } } - vm_page_unlock_queues(); + MDPAGE_RUNLOCK(); return (rv); } @@ -2146,7 +2153,7 @@ pmap_clear_modify(vm_page_t m) */ if ((m->aflags & PGA_WRITEABLE) == 0) return; - vm_page_lock_queues(); + MDPAGE_RLOCK(); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { if ((tp->tte_data & TD_PV) == 0) continue; @@ -2154,7 +2161,7 @@ pmap_clear_modify(vm_page_t m) if ((data & TD_W) != 0) tlb_page_demap(TTE_GET_PMAP(tp), TTE_GET_VA(tp)); } - vm_page_unlock_queues(); + MDPAGE_RUNLOCK(); } void @@ -2165,7 +2172,7 @@ pmap_clear_reference(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_clear_reference: page %p is not managed", m)); - vm_page_lock_queues(); + MDPAGE_RLOCK(); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { if ((tp->tte_data & TD_PV) == 0) continue; @@ -2173,7 +2180,7 @@ pmap_clear_reference(vm_page_t m) if ((data & TD_REF) != 0) tlb_page_demap(TTE_GET_PMAP(tp), TTE_GET_VA(tp)); } - vm_page_unlock_queues(); + MDPAGE_RUNLOCK(); } void @@ -2194,7 +2201,7 @@ pmap_remove_write(vm_page_t m) if ((m->oflags & VPO_BUSY) == 0 && (m->aflags & PGA_WRITEABLE) == 0) return; - vm_page_lock_queues(); + MDPAGE_RLOCK(); TAILQ_FOREACH(tp, &m->md.tte_list, tte_link) { if ((tp->tte_data & TD_PV) == 0) continue; @@ -2204,8 +2211,8 @@ pmap_remove_write(vm_page_t m) tlb_page_demap(TTE_GET_PMAP(tp), TTE_GET_VA(tp)); } } + MDPAGE_RUNLOCK(); vm_page_aflag_clear(m, PGA_WRITEABLE); - vm_page_unlock_queues(); } int Modified: user/attilio/vmcontention/sys/sparc64/sparc64/tsb.c ============================================================================== --- user/attilio/vmcontention/sys/sparc64/sparc64/tsb.c Tue Sep 20 08:01:43 2011 (r225690) +++ user/attilio/vmcontention/sys/sparc64/sparc64/tsb.c Tue Sep 20 08:11:07 2011 (r225691) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -131,7 +132,7 @@ tsb_tte_enter(pmap_t pm, vm_page_t m, vm PMAP_STATS_INC(tsb_nenter_u_oc); } - mtx_assert(&vm_page_queue_mtx, MA_OWNED); + MDPAGE_ASSERT_WLOCKED(); PMAP_LOCK_ASSERT(pm, MA_OWNED); if (pm == kernel_pmap) { PMAP_STATS_INC(tsb_nenter_k); From owner-svn-src-user@FreeBSD.ORG Tue Sep 20 12:46:07 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5FBC106566B; Tue, 20 Sep 2011 12:46:07 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB42F8FC12; Tue, 20 Sep 2011 12:46:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8KCk7Ye028890; Tue, 20 Sep 2011 12:46:07 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8KCk7NP028888; Tue, 20 Sep 2011 12:46:07 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201109201246.p8KCk7NP028888@svn.freebsd.org> From: Gabor Kovesdan Date: Tue, 20 Sep 2011 12:46:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225693 - user/gabor/tre-integration/contrib/tre/lib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 12:46:08 -0000 Author: gabor Date: Tue Sep 20 12:46:07 2011 New Revision: 225693 URL: http://svn.freebsd.org/changeset/base/225693 Log: - Clean up static function to have less arguments Modified: user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Modified: user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Tue Sep 20 08:34:15 2011 (r225692) +++ user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Tue Sep 20 12:46:07 2011 (r225693) @@ -44,8 +44,8 @@ #include "tre-internal.h" #include "xmalloc.h" -static int fastcmp(const void *, const bool *, const void *, size_t, - tre_str_type_t, bool, bool); +static int fastcmp(const fastmatch_t *fg, const void *data, + tre_str_type_t type); /* * Clean up if pattern compilation fails. @@ -99,24 +99,6 @@ static int fastcmp(const void *, const b fg->pattern[siz] = '\0'; \ } \ -/* - * Compares the pattern to the input string at the position - * stored in startptr. - */ -#define COMPARE \ - switch (type) \ - { \ - case STR_WIDE: \ - mismatch = fastcmp(fg->wpattern, fg->wescmap, startptr, \ - fg->wlen, type, \ - fg->icase, fg->newline); \ - break; \ - default: \ - mismatch = fastcmp(fg->pattern, fg->escmap, startptr, \ - fg->len, type, \ - fg->icase, fg->newline); \ - } \ - #define IS_OUT_OF_BOUNDS \ ((!fg->reversed \ ? ((type == STR_WIDE) ? ((j + fg->wlen) > len) \ @@ -935,7 +917,7 @@ tre_match_fast(const fastmatch_t *fg, co /* Determine where in data to start search at. */ j = fg->eol ? len - (type == STR_WIDE ? fg->wlen : fg->len) : 0; SKIP_CHARS(j); - COMPARE; + mismatch = fastcmp(fg, startptr, type); if (mismatch == REG_OK) { if (fg->word && !IS_ON_WORD_BOUNDARY) @@ -955,7 +937,7 @@ tre_match_fast(const fastmatch_t *fg, co do { SKIP_CHARS(j); - COMPARE; + mismatch = fastcmp(fg, startptr, type); if (mismatch == REG_OK) { if (fg->word) @@ -1011,14 +993,15 @@ tre_free_fast(fastmatch_t *fg) * REG_OK on success */ static inline int -fastcmp(const void *pat, const bool *escmap, const void *data, size_t len, - tre_str_type_t type, bool icase, bool newline) +fastcmp(const fastmatch_t *fg, const void *data, tre_str_type_t type) { const char *str_byte = data; - const char *pat_byte = pat; - int ret = REG_OK; + const char *pat_byte = fg->pattern; const tre_char_t *str_wide = data; - const tre_char_t *pat_wide = pat; + const tre_char_t *pat_wide = fg->wpattern; + const bool *escmap = (type == STR_WIDE) ? fg->wescmap : fg->escmap; + size_t len = (type == STR_WIDE) ? fg->wlen : fg->len; + int ret = REG_OK; /* Compare the pattern and the input char-by-char from the last position. */ for (int i = len - 1; i >= 0; i--) { @@ -1028,22 +1011,22 @@ fastcmp(const void *pat, const bool *esc /* Check dot */ if (pat_wide[i] == TRE_CHAR('.') && (!escmap || !escmap[i]) && - (!newline || (str_wide[i] != TRE_CHAR('\n')))) + (!fg->newline || (str_wide[i] != TRE_CHAR('\n')))) continue; /* Compare */ - if (icase ? (towlower(pat_wide[i]) == towlower(str_wide[i])) + if (fg->icase ? (towlower(pat_wide[i]) == towlower(str_wide[i])) : (pat_wide[i] == str_wide[i])) continue; break; default: /* Check dot */ if (pat_byte[i] == '.' && (!escmap || !escmap[i]) && - (!newline || (str_byte[i] != '\n'))) + (!fg->newline || (str_byte[i] != '\n'))) continue; /* Compare */ - if (icase ? (tolower(pat_byte[i]) == tolower(str_byte[i])) + if (fg->icase ? (tolower(pat_byte[i]) == tolower(str_byte[i])) : (pat_byte[i] == str_byte[i])) continue; } From owner-svn-src-user@FreeBSD.ORG Tue Sep 20 13:04:53 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2081B106564A; Tue, 20 Sep 2011 13:04:53 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10A988FC12; Tue, 20 Sep 2011 13:04:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8KD4qNc029472; Tue, 20 Sep 2011 13:04:52 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8KD4q9g029470; Tue, 20 Sep 2011 13:04:52 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201109201304.p8KD4q9g029470@svn.freebsd.org> From: Gabor Kovesdan Date: Tue, 20 Sep 2011 13:04:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225694 - user/gabor/tre-integration/contrib/tre/lib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 13:04:53 -0000 Author: gabor Date: Tue Sep 20 13:04:52 2011 New Revision: 225694 URL: http://svn.freebsd.org/changeset/base/225694 Log: - Dot is not special when dealing with a literal pattern Modified: user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Modified: user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Tue Sep 20 12:46:07 2011 (r225693) +++ user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Tue Sep 20 13:04:52 2011 (r225694) @@ -1010,7 +1010,8 @@ fastcmp(const fastmatch_t *fg, const voi case STR_WIDE: /* Check dot */ - if (pat_wide[i] == TRE_CHAR('.') && (!escmap || !escmap[i]) && + if (fg->hasdot && pat_wide[i] == TRE_CHAR('.') && + (!escmap || !escmap[i]) && (!fg->newline || (str_wide[i] != TRE_CHAR('\n')))) continue; @@ -1021,7 +1022,8 @@ fastcmp(const fastmatch_t *fg, const voi break; default: /* Check dot */ - if (pat_byte[i] == '.' && (!escmap || !escmap[i]) && + if (fg->hasdot && pat_byte[i] == '.' && + (!escmap || !escmap[i]) && (!fg->newline || (str_byte[i] != '\n'))) continue; From owner-svn-src-user@FreeBSD.ORG Tue Sep 20 21:53:47 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55FCD1065678; Tue, 20 Sep 2011 21:53:47 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 468608FC20; Tue, 20 Sep 2011 21:53:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8KLrlQb046185; Tue, 20 Sep 2011 21:53:47 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8KLrlj9046182; Tue, 20 Sep 2011 21:53:47 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201109202153.p8KLrlj9046182@svn.freebsd.org> From: Gabor Kovesdan Date: Tue, 20 Sep 2011 21:53:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225701 - user/gabor/tre-integration/contrib/tre/lib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 21:53:47 -0000 Author: gabor Date: Tue Sep 20 21:53:46 2011 New Revision: 225701 URL: http://svn.freebsd.org/changeset/base/225701 Log: - Remove a not very necessary sanity check and rely on the offets when REG_STARTEND is set. It is better to let the program segfault than hiding hard to find bugs. Modified: user/gabor/tre-integration/contrib/tre/lib/tre-internal.h Modified: user/gabor/tre-integration/contrib/tre/lib/tre-internal.h ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-internal.h Tue Sep 20 21:53:26 2011 (r225700) +++ user/gabor/tre-integration/contrib/tre/lib/tre-internal.h Tue Sep 20 21:53:46 2011 (r225701) @@ -265,8 +265,6 @@ struct tnfa { size_t offset = pmatch[0].rm_so; \ int ret; \ \ - if ((len != (unsigned)-1) && (pmatch[0].rm_eo > len)) \ - return REG_NOMATCH; \ if ((long long)pmatch[0].rm_eo - pmatch[0].rm_so < 0) \ return REG_NOMATCH; \ ret = fn; \ From owner-svn-src-user@FreeBSD.ORG Tue Sep 20 21:54:43 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 795E1106566B; Tue, 20 Sep 2011 21:54:43 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F7148FC0A; Tue, 20 Sep 2011 21:54:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8KLsh24046256; Tue, 20 Sep 2011 21:54:43 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8KLsh89046251; Tue, 20 Sep 2011 21:54:43 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201109202154.p8KLsh89046251@svn.freebsd.org> From: Gabor Kovesdan Date: Tue, 20 Sep 2011 21:54:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225702 - in user/gabor/grep/trunk: . regex X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 21:54:43 -0000 Author: gabor Date: Tue Sep 20 21:54:43 2011 New Revision: 225702 URL: http://svn.freebsd.org/changeset/base/225702 Log: - Merge improvements from TRE Modified: user/gabor/grep/trunk/Makefile user/gabor/grep/trunk/regex/fastmatch.c user/gabor/grep/trunk/regex/glue.h user/gabor/grep/trunk/regex/tre-fastmatch.c Modified: user/gabor/grep/trunk/Makefile ============================================================================== --- user/gabor/grep/trunk/Makefile Tue Sep 20 21:53:46 2011 (r225701) +++ user/gabor/grep/trunk/Makefile Tue Sep 20 21:54:43 2011 (r225702) @@ -17,7 +17,7 @@ SRCS= file.c grep.c queue.c util.c # Extra files ported backported form some regex improvements .PATH: ${.CURDIR}/regex -SRCS+= fastmatch.c hashtable.c tre-fastmatch.c xmalloc.c +SRCS+= fastmatch.c hashtable.c tre-compile.c tre-fastmatch.c xmalloc.c CFLAGS+=-I${.CURDIR}/regex .if ${MK_BSD_GREP} == "yes" Modified: user/gabor/grep/trunk/regex/fastmatch.c ============================================================================== --- user/gabor/grep/trunk/regex/fastmatch.c Tue Sep 20 21:53:46 2011 (r225701) +++ user/gabor/grep/trunk/regex/fastmatch.c Tue Sep 20 21:54:43 2011 (r225702) @@ -36,63 +36,6 @@ #include "tre-fastmatch.h" #include "xmalloc.h" -/* XXX: avoid duplication */ -#define CONV_PAT \ - { \ - wregex = xmalloc(sizeof(tre_char_t) * (n + 1)); \ - if (wregex == NULL) \ - return REG_ESPACE; \ - \ - if (TRE_MB_CUR_MAX == 1) \ - { \ - unsigned int i; \ - const unsigned char *str = (const unsigned char *)regex; \ - tre_char_t *wstr = wregex; \ - \ - for (i = 0; i < n; i++) \ - *(wstr++) = *(str++); \ - wlen = n; \ - } \ - else \ - { \ - int consumed; \ - tre_char_t *wcptr = wregex; \ - mbstate_t state; \ - memset(&state, '\0', sizeof(state)); \ - while (n > 0) \ - { \ - consumed = tre_mbrtowc(wcptr, regex, n, &state); \ - \ - switch (consumed) \ - { \ - case 0: \ - if (*regex == '\0') \ - consumed = 1; \ - else \ - { \ - xfree(wregex); \ - return REG_BADPAT; \ - } \ - break; \ - case -1: \ - DPRINT(("mbrtowc: error %d: %s.\n", errno, \ - strerror(errno))); \ - xfree(wregex); \ - return REG_BADPAT; \ - case -2: \ - consumed = n; \ - break; \ - } \ - regex += consumed; \ - n -= consumed; \ - wcptr++; \ - } \ - wlen = wcptr - wregex; \ - } \ - \ - wregex[wlen] = L'\0'; \ - } - int tre_fixncomp(fastmatch_t *preg, const char *regex, size_t n, int cflags) { @@ -101,14 +44,17 @@ tre_fixncomp(fastmatch_t *preg, const ch size_t wlen; if (n != 0) - CONV_PAT + { + ret = tre_convert_pattern(regex, n, &wregex, &wlen); + if (ret != REG_OK) + return ret; + else + ret = tre_compile_literal(preg, wregex, wlen, cflags); + tre_free_pattern(wregex); + return ret; + } else return tre_compile_literal(preg, NULL, 0, cflags); - - ret = tre_compile_literal(preg, wregex, wlen, cflags); - xfree(wregex); - - return ret; } int @@ -119,16 +65,19 @@ tre_fastncomp(fastmatch_t *preg, const c size_t wlen; if (n != 0) - CONV_PAT + { + ret = tre_convert_pattern(regex, n, &wregex, &wlen); + if (ret != REG_OK) + return ret; + else + ret = (cflags & REG_LITERAL) + ? tre_compile_literal(preg, wregex, wlen, cflags) + : tre_compile_fast(preg, wregex, wlen, cflags); + tre_free_pattern(wregex); + return ret; + } else return tre_compile_literal(preg, NULL, 0, cflags); - - ret = (cflags & REG_LITERAL) ? - tre_compile_literal(preg, wregex, wlen, cflags) : - tre_compile_fast(preg, wregex, wlen, cflags); - xfree(wregex); - - return ret; } @@ -176,30 +125,6 @@ tre_fastfree(fastmatch_t *preg) tre_free_fast(preg); } -/* XXX: avoid duplication */ -#define ADJUST_OFFSETS \ - { \ - size_t slen = (size_t)(pmatch[0].rm_eo - pmatch[0].rm_so); \ - size_t offset = pmatch[0].rm_so; \ - int ret; \ - \ - if ((pmatch[0].rm_so < 0) || (pmatch[0].rm_eo < 0)) \ - return REG_NOMATCH; \ - if ((len != (unsigned)-1) && ((unsigned long)pmatch[0].rm_eo > len))\ - return REG_NOMATCH; \ - if ((long long)pmatch[0].rm_eo - pmatch[0].rm_so < 0) \ - return REG_NOMATCH; \ - ret = tre_match_fast(preg, &string[offset], slen, type, nmatch, \ - pmatch, eflags); \ - for (unsigned i = 0; (i == 0) || (!(eflags & REG_NOSUB) && \ - (i < nmatch)); i++) \ - { \ - pmatch[i].rm_so += offset; \ - pmatch[i].rm_eo += offset; \ - } \ - return ret; \ - } - int tre_fastnexec(const fastmatch_t *preg, const char *string, size_t len, size_t nmatch, regmatch_t pmatch[], int eflags) @@ -207,7 +132,8 @@ tre_fastnexec(const fastmatch_t *preg, c tre_str_type_t type = (TRE_MB_CUR_MAX == 1) ? STR_BYTE : STR_MBS; if (eflags & REG_STARTEND) - ADJUST_OFFSETS + CALL_WITH_OFFSET(tre_match_fast(preg, &string[offset], slen, + type, nmatch, pmatch, eflags)); else return tre_match_fast(preg, string, len, type, nmatch, pmatch, eflags); @@ -227,7 +153,8 @@ tre_fastwnexec(const fastmatch_t *preg, tre_str_type_t type = STR_WIDE; if (eflags & REG_STARTEND) - ADJUST_OFFSETS + CALL_WITH_OFFSET(tre_match_fast(preg, &string[offset], slen, + type, nmatch, pmatch, eflags)); else return tre_match_fast(preg, string, len, type, nmatch, pmatch, eflags); Modified: user/gabor/grep/trunk/regex/glue.h ============================================================================== --- user/gabor/grep/trunk/regex/glue.h Tue Sep 20 21:53:46 2011 (r225701) +++ user/gabor/grep/trunk/regex/glue.h Tue Sep 20 21:54:43 2011 (r225702) @@ -11,6 +11,7 @@ #define TRE_WCHAR 1 #define TRE_MULTIBYTE 1 +#define HAVE_MBSTATE_T 1 #define TRE_CHAR(n) L##n @@ -37,4 +38,29 @@ #define MAX(a,b) ((a > b) ? (a) : (b)) typedef enum { STR_WIDE, STR_BYTE, STR_MBS, STR_USER } tre_str_type_t; + +#define CALL_WITH_OFFSET(fn) \ + do \ + { \ + size_t slen = (size_t)(pmatch[0].rm_eo - pmatch[0].rm_so); \ + size_t offset = pmatch[0].rm_so; \ + int ret; \ + \ + if ((long long)pmatch[0].rm_eo - pmatch[0].rm_so < 0) \ + return REG_NOMATCH; \ + ret = fn; \ + for (unsigned i = 0; (!(eflags & REG_NOSUB) && (i < nmatch)); i++)\ + { \ + pmatch[i].rm_so += offset; \ + pmatch[i].rm_eo += offset; \ + } \ + return ret; \ + } while (0 /*CONSTCOND*/) + +int +tre_convert_pattern(const char *regex, size_t n, tre_char_t **w, + size_t *wn); + +void +tre_free_pattern(tre_char_t *wregex); #endif Modified: user/gabor/grep/trunk/regex/tre-fastmatch.c ============================================================================== --- user/gabor/grep/trunk/regex/tre-fastmatch.c Tue Sep 20 21:53:46 2011 (r225701) +++ user/gabor/grep/trunk/regex/tre-fastmatch.c Tue Sep 20 21:54:43 2011 (r225702) @@ -42,8 +42,8 @@ #include "tre-fastmatch.h" #include "xmalloc.h" -static int fastcmp(const void *, const bool *, const void *, size_t, - tre_str_type_t, bool, bool); +static int fastcmp(const fastmatch_t *fg, const void *data, + tre_str_type_t type); /* * Clean up if pattern compilation fails. @@ -97,24 +97,6 @@ static int fastcmp(const void *, const b fg->pattern[siz] = '\0'; \ } \ -/* - * Compares the pattern to the input string at the position - * stored in startptr. - */ -#define COMPARE \ - switch (type) \ - { \ - case STR_WIDE: \ - mismatch = fastcmp(fg->wpattern, fg->wescmap, startptr, \ - fg->wlen, type, \ - fg->icase, fg->newline); \ - break; \ - default: \ - mismatch = fastcmp(fg->pattern, fg->escmap, startptr, \ - fg->len, type, \ - fg->icase, fg->newline); \ - } \ - #define IS_OUT_OF_BOUNDS \ ((!fg->reversed \ ? ((type == STR_WIDE) ? ((j + fg->wlen) > len) \ @@ -154,7 +136,7 @@ static int fastcmp(const void *, const b gs = fg->bmGs[mismatch]; \ } \ bc = (r == HASH_OK) ? bc : fg->defBc; \ - DPRINT(("tre_fast_match: mismatch on character %lc, " \ + DPRINT(("tre_fast_match: mismatch on character" CHF ", " \ "BC %d, GS %d\n", \ ((const tre_char_t *)startptr)[mismatch + 1], \ bc, gs)); \ @@ -297,7 +279,7 @@ static int fastcmp(const void *, const b r = hashtable_put(fg->qsBc_table, &fg->wpattern[i], &k); \ if ((r == HASH_FAIL) || (r == HASH_FULL)) \ FAIL_COMP(REG_ESPACE); \ - DPRINT(("BC shift for wide char %lc is %d\n", fg->wpattern[i], \ + DPRINT(("BC shift for wide char " CHF " is %d\n", fg->wpattern[i],\ k)); \ if (fg->icase) \ { \ @@ -306,7 +288,7 @@ static int fastcmp(const void *, const b r = hashtable_put(fg->qsBc_table, &wc, &k); \ if ((r == HASH_FAIL) || (r == HASH_FULL)) \ FAIL_COMP(REG_ESPACE); \ - DPRINT(("BC shift for wide char %lc is %d\n", wc, k)); \ + DPRINT(("BC shift for wide char " CHF " is %d\n", wc, k)); \ } \ } @@ -327,7 +309,7 @@ static int fastcmp(const void *, const b r = hashtable_put(fg->qsBc_table, &fg->wpattern[i], &k); \ if ((r == HASH_FAIL) || (r == HASH_FULL)) \ FAIL_COMP(REG_ESPACE); \ - DPRINT(("Reverse BC shift for wide char %lc is %d\n", \ + DPRINT(("Reverse BC shift for wide char " CHF " is %d\n", \ fg->wpattern[i], k)); \ if (fg->icase) \ { \ @@ -336,7 +318,8 @@ static int fastcmp(const void *, const b r = hashtable_put(fg->qsBc_table, &wc, &k); \ if ((r == HASH_FAIL) || (r == HASH_FULL)) \ FAIL_COMP(REG_ESPACE); \ - DPRINT(("Reverse BC shift for wide char %lc is %d\n", wc, k));\ + DPRINT(("Reverse BC shift for wide char " CHF " is %d\n", wc, \ + k)); \ } \ } @@ -853,7 +836,7 @@ badpat: */ int tre_match_fast(const fastmatch_t *fg, const void *data, size_t len, - tre_str_type_t type, int nmatch __unused, regmatch_t pmatch[], int eflags) + tre_str_type_t type, int nmatch, regmatch_t pmatch[], int eflags) { unsigned int shift, u = 0, v = 0; ssize_t j = 0; @@ -878,7 +861,7 @@ tre_match_fast(const fastmatch_t *fg, co /* Shortcut for empty pattern */ if (fg->matchall) { - if (!fg->nosub) + if (!fg->nosub && nmatch >= 1) { pmatch[0].rm_so = 0; pmatch[0].rm_eo = len; @@ -932,12 +915,12 @@ tre_match_fast(const fastmatch_t *fg, co /* Determine where in data to start search at. */ j = fg->eol ? len - (type == STR_WIDE ? fg->wlen : fg->len) : 0; SKIP_CHARS(j); - COMPARE; + mismatch = fastcmp(fg, startptr, type); if (mismatch == REG_OK) { if (fg->word && !IS_ON_WORD_BOUNDARY) return ret; - if (!fg->nosub) + if (!fg->nosub && nmatch >= 1) { pmatch[0].rm_so = j; pmatch[0].rm_eo = j + (type == STR_WIDE ? fg->wlen : fg->len); @@ -952,7 +935,7 @@ tre_match_fast(const fastmatch_t *fg, co do { SKIP_CHARS(j); - COMPARE; + mismatch = fastcmp(fg, startptr, type); if (mismatch == REG_OK) { if (fg->word) @@ -961,7 +944,7 @@ tre_match_fast(const fastmatch_t *fg, co CHECK_BOL_ANCHOR; if (fg->eol) CHECK_EOL_ANCHOR; - if (!fg->nosub) + if (!fg->nosub && nmatch >= 1) { pmatch[0].rm_so = j; pmatch[0].rm_eo = j + ((type == STR_WIDE) ? fg->wlen : fg->len); @@ -1008,14 +991,15 @@ tre_free_fast(fastmatch_t *fg) * REG_OK on success */ static inline int -fastcmp(const void *pat, const bool *escmap, const void *data, size_t len, - tre_str_type_t type, bool icase, bool newline) +fastcmp(const fastmatch_t *fg, const void *data, tre_str_type_t type) { const char *str_byte = data; - const char *pat_byte = pat; - int ret = REG_OK; + const char *pat_byte = fg->pattern; const tre_char_t *str_wide = data; - const tre_char_t *pat_wide = pat; + const tre_char_t *pat_wide = fg->wpattern; + const bool *escmap = (type == STR_WIDE) ? fg->wescmap : fg->escmap; + size_t len = (type == STR_WIDE) ? fg->wlen : fg->len; + int ret = REG_OK; /* Compare the pattern and the input char-by-char from the last position. */ for (int i = len - 1; i >= 0; i--) { @@ -1024,23 +1008,25 @@ fastcmp(const void *pat, const bool *esc case STR_WIDE: /* Check dot */ - if (pat_wide[i] == TRE_CHAR('.') && (!escmap || !escmap[i]) && - (!newline || (str_wide[i] != TRE_CHAR('\n')))) + if (fg->hasdot && pat_wide[i] == TRE_CHAR('.') && + (!escmap || !escmap[i]) && + (!fg->newline || (str_wide[i] != TRE_CHAR('\n')))) continue; /* Compare */ - if (icase ? (towlower(pat_wide[i]) == towlower(str_wide[i])) + if (fg->icase ? (towlower(pat_wide[i]) == towlower(str_wide[i])) : (pat_wide[i] == str_wide[i])) continue; break; default: /* Check dot */ - if (pat_byte[i] == '.' && (!escmap || !escmap[i]) && - (!newline || (str_byte[i] != '\n'))) + if (fg->hasdot && pat_byte[i] == '.' && + (!escmap || !escmap[i]) && + (!fg->newline || (str_byte[i] != '\n'))) continue; /* Compare */ - if (icase ? (tolower(pat_byte[i]) == tolower(str_byte[i])) + if (fg->icase ? (tolower(pat_byte[i]) == tolower(str_byte[i])) : (pat_byte[i] == str_byte[i])) continue; } From owner-svn-src-user@FreeBSD.ORG Wed Sep 21 06:35:05 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3194106564A; Wed, 21 Sep 2011 06:35:05 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9429B8FC13; Wed, 21 Sep 2011 06:35:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8L6Z5W3062679; Wed, 21 Sep 2011 06:35:05 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8L6Z5dh062677; Wed, 21 Sep 2011 06:35:05 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109210635.p8L6Z5dh062677@svn.freebsd.org> From: Adrian Chadd Date: Wed, 21 Sep 2011 06:35:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225711 - user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2011 06:35:05 -0000 Author: adrian Date: Wed Sep 21 06:35:05 2011 New Revision: 225711 URL: http://svn.freebsd.org/changeset/base/225711 Log: Undo an autosleep hack that I never finished porting. I'll revisit this when it's time to do autosleep. Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c Wed Sep 21 03:37:12 2011 (r225710) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c Wed Sep 21 06:35:05 2011 (r225711) @@ -107,10 +107,10 @@ ar5416SetupRxDesc(struct ath_hal *ah, st uint32_t size, u_int flags) { struct ar5416_desc *ads = AR5416DESC(ds); - HAL_CAPABILITIES *pCap = &AH_PRIVATE(ah)->ah_caps; HALASSERT((size &~ AR_BufLen) == 0); + ads->ds_ctl0 = 0; /* XXX just to be sure? -adrian */ ads->ds_ctl1 = size & AR_BufLen; if (flags & HAL_RXDESC_INTREQ) ads->ds_ctl1 |= AR_RxIntrReq; @@ -119,8 +119,7 @@ ar5416SetupRxDesc(struct ath_hal *ah, st ads->ds_rxstatus8 &= ~AR_RxDone; /* clear the rest of the status fields */ - if (! pCap->halAutoSleepSupport) - OS_MEMZERO(&(ads->u), sizeof(ads->u)); + OS_MEMZERO(&(ads->u), sizeof(ads->u)); return AH_TRUE; } From owner-svn-src-user@FreeBSD.ORG Wed Sep 21 13:15:18 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85D30106567D; Wed, 21 Sep 2011 13:15:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C3528FC17; Wed, 21 Sep 2011 13:15:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8LDFIhW077065; Wed, 21 Sep 2011 13:15:18 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8LDFIq3077060; Wed, 21 Sep 2011 13:15:18 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109211315.p8LDFIq3077060@svn.freebsd.org> From: Adrian Chadd Date: Wed, 21 Sep 2011 13:15:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225713 - in user/adrian/if_ath_tx/sys/dev/ath/ath_hal: ar5212 ar5416 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2011 13:15:18 -0000 Author: adrian Date: Wed Sep 21 13:15:18 2011 New Revision: 225713 URL: http://svn.freebsd.org/changeset/base/225713 Log: Save and restore the associate id on a reset. This is a candidate to merge into -HEAD. Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5212/ar5212.h user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5212/ar5212.h Wed Sep 21 07:31:16 2011 (r225712) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5212/ar5212.h Wed Sep 21 13:15:18 2011 (r225713) @@ -252,6 +252,7 @@ struct ath_hal_5212 { uint8_t ah_macaddr[IEEE80211_ADDR_LEN]; uint8_t ah_bssid[IEEE80211_ADDR_LEN]; uint8_t ah_bssidmask[IEEE80211_ADDR_LEN]; + uint16_t ah_assocId; /* * Runtime state. Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Wed Sep 21 07:31:16 2011 (r225712) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Wed Sep 21 13:15:18 2011 (r225713) @@ -218,8 +218,10 @@ ar5212WriteAssocid(struct ath_hal *ah, c { struct ath_hal_5212 *ahp = AH5212(ah); - /* XXX save bssid for possible re-use on reset */ + /* save bssid for possible re-use on reset */ OS_MEMCPY(ahp->ah_bssid, bssid, IEEE80211_ADDR_LEN); + ahp->ah_assocId = assocId; + OS_REG_WRITE(ah, AR_BSS_ID0, LE_READ_4(ahp->ah_bssid)); OS_REG_WRITE(ah, AR_BSS_ID1, LE_READ_2(ahp->ah_bssid+4) | ((assocId & 0x3fff)<ah_bssid)); - OS_REG_WRITE(ah, AR_BSS_ID1, LE_READ_2(ahp->ah_bssid + 4)); + OS_REG_WRITE(ah, AR_BSS_ID1, LE_READ_2(ahp->ah_bssid + 4) | + (ahp->ah_assocId & 0x3fff) << AR_BSS_ID1_AID_S); /* Restore bmiss rssi & count thresholds */ OS_REG_WRITE(ah, AR_RSSI_THR, ahp->ah_rssiThr); Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Wed Sep 21 07:31:16 2011 (r225712) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Wed Sep 21 13:15:18 2011 (r225713) @@ -278,9 +278,10 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO /* Restore previous antenna */ OS_REG_WRITE(ah, AR_DEF_ANTENNA, saveDefAntenna); - /* then our BSSID */ + /* then our BSSID and associate id */ OS_REG_WRITE(ah, AR_BSS_ID0, LE_READ_4(ahp->ah_bssid)); - OS_REG_WRITE(ah, AR_BSS_ID1, LE_READ_2(ahp->ah_bssid + 4)); + OS_REG_WRITE(ah, AR_BSS_ID1, LE_READ_2(ahp->ah_bssid + 4) | + (ahp->ah_assocId & 0x3fff) << AR_BSS_ID1_AID_S); /* Restore bmiss rssi & count thresholds */ OS_REG_WRITE(ah, AR_RSSI_THR, ahp->ah_rssiThr); From owner-svn-src-user@FreeBSD.ORG Wed Sep 21 13:19:46 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F0291065670; Wed, 21 Sep 2011 13:19:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F34EC8FC12; Wed, 21 Sep 2011 13:19:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8LDJjln077226; Wed, 21 Sep 2011 13:19:45 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8LDJjup077222; Wed, 21 Sep 2011 13:19:45 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109211319.p8LDJjup077222@svn.freebsd.org> From: Adrian Chadd Date: Wed, 21 Sep 2011 13:19:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225714 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2011 13:19:46 -0000 Author: adrian Date: Wed Sep 21 13:19:45 2011 New Revision: 225714 URL: http://svn.freebsd.org/changeset/base/225714 Log: Don't use the multicast key search key method in STA mode - just use it in adhoc/hostap mode for now. Obtained from: Atheros, Linux ath9k Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c user/adrian/if_ath_tx/sys/dev/ath/if_ath_keycache.c user/adrian/if_ath_tx/sys/dev/ath/if_ath_keycache.h Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Wed Sep 21 13:15:18 2011 (r225713) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Wed Sep 21 13:19:45 2011 (r225714) @@ -5322,7 +5322,7 @@ ath_setup_stationkey(struct ieee80211_no ni->ni_ucastkey.wk_flags |= IEEE80211_KEY_DEVKEY; IEEE80211_ADDR_COPY(ni->ni_ucastkey.wk_macaddr, ni->ni_macaddr); /* NB: this will create a pass-thru key entry */ - ath_keyset(sc, &ni->ni_ucastkey, vap->iv_bss); + ath_keyset(sc, vap, &ni->ni_ucastkey, vap->iv_bss); } } Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_keycache.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_keycache.c Wed Sep 21 13:15:18 2011 (r225713) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_keycache.c Wed Sep 21 13:19:45 2011 (r225714) @@ -178,7 +178,8 @@ ath_keyset_tkip(struct ath_softc *sc, co * cache slots for TKIP with hardware MIC support. */ int -ath_keyset(struct ath_softc *sc, const struct ieee80211_key *k, +ath_keyset(struct ath_softc *sc, struct ieee80211vap *vap, + const struct ieee80211_key *k, struct ieee80211_node *bss) { #define N(a) (sizeof(a)/sizeof(a[0])) @@ -212,7 +213,17 @@ ath_keyset(struct ath_softc *sc, const s } else hk.kv_type = HAL_CIPHER_CLR; - if ((k->wk_flags & IEEE80211_KEY_GROUP) && sc->sc_mcastkey) { + /* + * Group keys on hardware that supports multicast frame + * key search should only be done in adhoc/hostap mode, + * not STA mode. + * + * XXX TODO: what about mesh, tdma? + */ + if ((vap->iv_opmode == IEEE80211_M_HOSTAP || + vap->iv_opmode == IEEE80211_M_IBSS) && + (k->wk_flags & IEEE80211_KEY_GROUP) && + sc->sc_mcastkey) { /* * Group keys on hardware that supports multicast frame * key search use a MAC that is the sender's address with @@ -493,5 +504,5 @@ ath_key_set(struct ieee80211vap *vap, co { struct ath_softc *sc = vap->iv_ic->ic_ifp->if_softc; - return ath_keyset(sc, k, vap->iv_bss); + return ath_keyset(sc, vap, k, vap->iv_bss); } Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_keycache.h ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_keycache.h Wed Sep 21 13:15:18 2011 (r225713) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_keycache.h Wed Sep 21 13:19:45 2011 (r225714) @@ -37,7 +37,7 @@ extern int ath_key_alloc(struct ieee8021 extern int ath_key_delete(struct ieee80211vap *, const struct ieee80211_key *); extern int ath_key_set(struct ieee80211vap *, const struct ieee80211_key *, const u_int8_t mac[IEEE80211_ADDR_LEN]); -extern int ath_keyset(struct ath_softc *sc, const struct ieee80211_key *k, - struct ieee80211_node *bss); +extern int ath_keyset(struct ath_softc *sc, struct ieee80211vap *vap, + const struct ieee80211_key *k, struct ieee80211_node *bss); #endif From owner-svn-src-user@FreeBSD.ORG Wed Sep 21 13:22:36 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC068106564A; Wed, 21 Sep 2011 13:22:36 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCA1B8FC15; Wed, 21 Sep 2011 13:22:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8LDMasf077358; Wed, 21 Sep 2011 13:22:36 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8LDMa0H077356; Wed, 21 Sep 2011 13:22:36 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201109211322.p8LDMa0H077356@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 21 Sep 2011 13:22:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225715 - user/gabor/grep/trunk/regex X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2011 13:22:36 -0000 Author: gabor Date: Wed Sep 21 13:22:36 2011 New Revision: 225715 URL: http://svn.freebsd.org/changeset/base/225715 Log: - Do not allow trailing escape Modified: user/gabor/grep/trunk/regex/tre-fastmatch.c Modified: user/gabor/grep/trunk/regex/tre-fastmatch.c ============================================================================== --- user/gabor/grep/trunk/regex/tre-fastmatch.c Wed Sep 21 13:19:45 2011 (r225714) +++ user/gabor/grep/trunk/regex/tre-fastmatch.c Wed Sep 21 13:22:36 2011 (r225715) @@ -599,6 +599,8 @@ tre_compile_fast(fastmatch_t *fg, const case TRE_CHAR('\\'): if (escaped) STORE_CHAR; + else if (i == n - 1) + goto badpat; else escaped = true; continue; From owner-svn-src-user@FreeBSD.ORG Wed Sep 21 16:47:08 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED2901065672; Wed, 21 Sep 2011 16:47:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C4F5B8FC13; Wed, 21 Sep 2011 16:47:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8LGl8Jc083504; Wed, 21 Sep 2011 16:47:08 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8LGl8SQ083502; Wed, 21 Sep 2011 16:47:08 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109211647.p8LGl8SQ083502@svn.freebsd.org> From: Adrian Chadd Date: Wed, 21 Sep 2011 16:47:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225716 - user/adrian/if_ath_tx/sys/net80211 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2011 16:47:09 -0000 Author: adrian Date: Wed Sep 21 16:47:08 2011 New Revision: 225716 URL: http://svn.freebsd.org/changeset/base/225716 Log: Add a temporary workaround to filter out some of the STA issues I'm seeing in busy 11n tests. I'm occasionally seeing frames destined for other STA's pop up from the AR9160 NIC. But I'm not seeing it from an AR9280 NIC which is also in STA mode. What would thus happen: * the frame would most likely end up entering via ieee80211_input_all(); * It would be punted to the bss node of each VAP; * It would attempt to be decrypted, and may result in the rsc being bumped to a high value and thus causing subsequent frames to fail to be RX'ed due to a suspected replay attack; * It may also end up bumping the TID sequence number, causing subsequent valid frames to also be dropped for being out of sequence. It's quite possible that this is all the result of some subtle descriptor corruption in the ath driver.... Modified: user/adrian/if_ath_tx/sys/net80211/ieee80211_sta.c Modified: user/adrian/if_ath_tx/sys/net80211/ieee80211_sta.c ============================================================================== --- user/adrian/if_ath_tx/sys/net80211/ieee80211_sta.c Wed Sep 21 13:22:36 2011 (r225715) +++ user/adrian/if_ath_tx/sys/net80211/ieee80211_sta.c Wed Sep 21 16:47:08 2011 (r225716) @@ -50,6 +50,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -582,6 +584,25 @@ sta_input(struct ieee80211_node *ni, str vap->iv_stats.is_rx_wrongbss++; goto out; } + + /* + * Some devices may be in a promiscuous mode + * where they receive frames for multiple station + * addresses. + * + * If we receive a data frame that isn't + * destined to our VAP MAC, drop it. + */ + if (ni == vap->iv_bss + && (!(IEEE80211_IS_MULTICAST(wh->i_addr1))) + && (!IEEE80211_ADDR_EQ(wh->i_addr1, IF_LLADDR(ifp)))) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, + bssid, NULL, "not to cur sta: lladdr=%6D, addr1=%6D", + IF_LLADDR(ifp), ":", wh->i_addr1, ":"); + vap->iv_stats.is_rx_wrongbss++; + goto out; + } + IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi); ni->ni_noise = nf; if (HAS_SEQ(type) && !IEEE80211_IS_MULTICAST(wh->i_addr1)) { From owner-svn-src-user@FreeBSD.ORG Wed Sep 21 19:48:28 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29CA9106564A; Wed, 21 Sep 2011 19:48:28 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 196F38FC17; Wed, 21 Sep 2011 19:48:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8LJmRef089000; Wed, 21 Sep 2011 19:48:27 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8LJmRbQ088998; Wed, 21 Sep 2011 19:48:27 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201109211948.p8LJmRbQ088998@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 21 Sep 2011 19:48:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225717 - user/gabor/grep/trunk/regex X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2011 19:48:28 -0000 Author: gabor Date: Wed Sep 21 19:48:27 2011 New Revision: 225717 URL: http://svn.freebsd.org/changeset/base/225717 Log: - Add forgotten files Reported by: aakuusta@gmail.com Added: user/gabor/grep/trunk/regex/config.h (contents, props changed) user/gabor/grep/trunk/regex/tre-compile.c (contents, props changed) Added: user/gabor/grep/trunk/regex/config.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/gabor/grep/trunk/regex/config.h Wed Sep 21 19:48:27 2011 (r225717) @@ -0,0 +1,156 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GETOPT_H 1 + +/* Define to 1 if you have the `getopt_long' function. */ +#define HAVE_GETOPT_LONG 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `isascii' function. */ +#define HAVE_ISASCII 1 + +/* Define to 1 if you have the `isblank' function. */ +#define HAVE_ISBLANK 1 + +/* Define to 1 if you have the `iswascii' function or macro. */ +#define HAVE_ISWASCII 1 + +/* Define to 1 if you have the `iswblank' function or macro. */ +#define HAVE_ISWBLANK 1 + +/* Define to 1 if you have the `iswctype' function or macro. */ +#define HAVE_ISWCTYPE 1 + +/* Define to 1 if you have the `iswlower' function or macro. */ +#define HAVE_ISWLOWER 1 + +/* Define to 1 if you have the `iswupper' function or macro. */ +#define HAVE_ISWUPPER 1 + +/* Define to 1 if you have the `mbrtowc' function or macro. */ +#define HAVE_MBRTOWC 1 + +/* Define to 1 if the system has the type `mbstate_t'. */ +#define HAVE_MBSTATE_T 1 + +/* Define to 1 if you have the `mbtowc' function or macro. */ +#define HAVE_MBTOWC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the `towlower' function or macro. */ +#define HAVE_TOWLOWER 1 + +/* Define to 1 if you have the `towupper' function or macro. */ +#define HAVE_TOWUPPER 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define to 1 if the system has the type `wchar_t'. */ +#define HAVE_WCHAR_T 1 + +/* Define to 1 if you have the `wcschr' function or macro. */ +#define HAVE_WCSCHR 1 + +/* Define to 1 if you have the `wcscpy' function or macro. */ +#define HAVE_WCSCPY 1 + +/* Define to 1 if you have the `wcslen' function or macro. */ +#define HAVE_WCSLEN 1 + +/* Define to 1 if you have the `wcsncpy' function or macro. */ +#define HAVE_WCSNCPY 1 + +/* Define to 1 if you have the `wcsrtombs' function or macro. */ +#define HAVE_WCSRTOMBS 1 + +/* Define to 1 if you have the `wcstombs' function or macro. */ +#define HAVE_WCSTOMBS 1 + +/* Define to 1 if you have the `wctype' function or macro. */ +#define HAVE_WCTYPE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCTYPE_H 1 + +/* Define to 1 if the system has the type `wint_t'. */ +#define HAVE_WINT_T 1 + +/* Define if you want to disable debug assertions. */ +#define NDEBUG 1 + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you want to enable approximate matching functionality. */ +#undef TRE_APPROX + +/* Define to enable multibyte character set support. */ +#define TRE_MULTIBYTE 1 + +/* Define to a field in the regex_t struct where TRE should store a pointer to + the internal tre_tnfa_t structure */ +#define TRE_REGEX_T_FIELD value + +/* Define if you want TRE to use alloca() instead of malloc() when allocating + memory needed for regexec operations. */ +#define TRE_USE_ALLOCA 1 + +/* TRE version string. */ +#define TRE_VERSION "0.8.0" + +/* TRE version level 1. */ +#define TRE_VERSION_1 0 + +/* TRE version level 2. */ +#define TRE_VERSION_2 8 + +/* TRE version level 3. */ +#define TRE_VERSION_3 0 + +/* Define to enable wide character (wchar_t) support. */ +#define TRE_WCHAR 1 + +/* Version number of package */ +#define VERSION "0.8.0" Added: user/gabor/grep/trunk/regex/tre-compile.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/gabor/grep/trunk/regex/tre-compile.c Wed Sep 21 19:48:27 2011 (r225717) @@ -0,0 +1,100 @@ +#include "glue.h" + +#include +#include +#include +#include +#include + +#include "xmalloc.h" + +int +tre_convert_pattern(const char *regex, size_t n, tre_char_t **w, + size_t *wn) +{ +#if TRE_WCHAR + tre_char_t *wregex; + size_t wlen; + + wregex = xmalloc(sizeof(tre_char_t) * (n + 1)); + if (wregex == NULL) + return REG_ESPACE; + + /* If the current locale uses the standard single byte encoding of + characters, we don't do a multibyte string conversion. If we did, + many applications which use the default locale would break since + the default "C" locale uses the 7-bit ASCII character set, and + all characters with the eighth bit set would be considered invalid. */ +#if TRE_MULTIBYTE + if (TRE_MB_CUR_MAX == 1) +#endif /* TRE_MULTIBYTE */ + { + unsigned int i; + const unsigned char *str = (const unsigned char *)regex; + tre_char_t *wstr = wregex; + + for (i = 0; i < n; i++) + *(wstr++) = *(str++); + wlen = n; + } +#if TRE_MULTIBYTE + else + { + int consumed; + tre_char_t *wcptr = wregex; +#ifdef HAVE_MBSTATE_T + mbstate_t state; + memset(&state, '\0', sizeof(state)); +#endif /* HAVE_MBSTATE_T */ + while (n > 0) + { + consumed = tre_mbrtowc(wcptr, regex, n, &state); + + switch (consumed) + { + case 0: + if (*regex == '\0') + consumed = 1; + else + { + xfree(wregex); + return REG_BADPAT; + } + break; + case -1: + DPRINT(("mbrtowc: error %d: %s.\n", errno, strerror(errno))); + xfree(wregex); + return REG_BADPAT; + case -2: + /* The last character wasn't complete. Let's not call it a + fatal error. */ + consumed = n; + break; + } + regex += consumed; + n -= consumed; + wcptr++; + } + wlen = wcptr - wregex; + } +#endif /* TRE_MULTIBYTE */ + wregex[wlen] = L'\0'; + *w = wregex; + *wn = n; + return REG_OK; +#else /* !TRE_WCHAR */ + { + *w = (tre_char_t * const *)regex; + *wn = n; + return REG_OK; + } +#endif /* !TRE_WCHAR */ +} + +void +tre_free_pattern(tre_char_t *wregex) +{ +#if TRE_WCHAR + xfree(wregex); +#endif +} From owner-svn-src-user@FreeBSD.ORG Wed Sep 21 19:50:27 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10AF4106566C; Wed, 21 Sep 2011 19:50:27 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 011118FC0C; Wed, 21 Sep 2011 19:50:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8LJoQYM089095; Wed, 21 Sep 2011 19:50:26 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8LJoQWo089093; Wed, 21 Sep 2011 19:50:26 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201109211950.p8LJoQWo089093@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 21 Sep 2011 19:50:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225718 - user/gabor/grep/trunk/regex X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2011 19:50:27 -0000 Author: gabor Date: Wed Sep 21 19:50:26 2011 New Revision: 225718 URL: http://svn.freebsd.org/changeset/base/225718 Log: - Clean up that is actually unnecessary Deleted: user/gabor/grep/trunk/regex/config.h Modified: user/gabor/grep/trunk/regex/xmalloc.c Modified: user/gabor/grep/trunk/regex/xmalloc.c ============================================================================== --- user/gabor/grep/trunk/regex/xmalloc.c Wed Sep 21 19:48:27 2011 (r225717) +++ user/gabor/grep/trunk/regex/xmalloc.c Wed Sep 21 19:50:26 2011 (r225718) @@ -14,10 +14,6 @@ - group dumps by source location */ -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - #include #include #include From owner-svn-src-user@FreeBSD.ORG Wed Sep 21 23:38:16 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 432261065670; Wed, 21 Sep 2011 23:38:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32B9B8FC16; Wed, 21 Sep 2011 23:38:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8LNcGYn096166; Wed, 21 Sep 2011 23:38:16 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8LNcGUV096164; Wed, 21 Sep 2011 23:38:16 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109212338.p8LNcGUV096164@svn.freebsd.org> From: Adrian Chadd Date: Wed, 21 Sep 2011 23:38:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225719 - user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2011 23:38:16 -0000 Author: adrian Date: Wed Sep 21 23:38:15 2011 New Revision: 225719 URL: http://svn.freebsd.org/changeset/base/225719 Log: Return rx clear for the extension channel when requested instead of incorrectly returning rx clear for the control channel. This is a merge candidate to -HEAD. Obtained from: Atheros Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Wed Sep 21 19:50:26 2011 (r225718) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Wed Sep 21 23:38:15 2011 (r225719) @@ -329,7 +329,7 @@ ar5416Get11nRxClear(struct ath_hal *ah) rxclear |= HAL_RX_CLEAR_CTL_LOW; } /* extension channel */ - if (val & AR_DIAG_RXCLEAR_CTL_LOW) { + if (val & AR_DIAG_RXCLEAR_EXT_LOW) { rxclear |= HAL_RX_CLEAR_EXT_LOW; } return rxclear; From owner-svn-src-user@FreeBSD.ORG Wed Sep 21 23:48:20 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6750E1065675; Wed, 21 Sep 2011 23:48:20 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 567878FC18; Wed, 21 Sep 2011 23:48:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8LNmK5D096506; Wed, 21 Sep 2011 23:48:20 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8LNmK93096504; Wed, 21 Sep 2011 23:48:20 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109212348.p8LNmK93096504@svn.freebsd.org> From: Adrian Chadd Date: Wed, 21 Sep 2011 23:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225720 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2011 23:48:20 -0000 Author: adrian Date: Wed Sep 21 23:48:19 2011 New Revision: 225720 URL: http://svn.freebsd.org/changeset/base/225720 Log: Work around some issues seen with the AR9160 when RX'ing aggregate frames. It seems that the AR9160 in STA mode will occasionally pass A-MPDU subframes up to the driver which aren't destined for it. There's nothing obviously wrong - it's not occuring during scanning, AR_RX_FILTER is correct, AID is now being set correct, the STA ID and BSSID values are correct. It only occurs on aggregate frame RX. I've not seen it occur on normal MPDU RX. This commit: * backs out some previous debugging that snuck in; * adds some local debugging (which I'll make more useful, but still leave commented out by default) to dump descriptors which aren't for us; * removes the use of the crypto key cache id for determining the peer, as it's possible a valid looking frame will come in on a key id that is active. As an example of the last one: R[ 0] (DS.V:0xa0a13780 DS.P:0xa13780) L:00a137e0 D:045fb800 * 00000000 00000800 8d2a282a 000b806c 3e60da94 00000103 052c163d 00000000 00000000 00000000 80030143 FRDS 00:1c:c0:43:87:2b->d4:9a:20:5a:db:0c(00:1b:b1:58:f6:f0) data QoS [TID 0] WEP [IV ca 9c 00 e0 08 00 KID 0] 70M +5 8842 2c00 d49a 205a db0c 001b b158 f6f0 001c c043 872b c0c6 0000 c0ca ca9c 0020 e008 0000 aec7 45d1 e2b8 b6c2 cb04 ef91 f063 9fc6 8f61 f491 fc5e db4b cd0e a2c7 5ccc 9aaa ced2 0024 dcd9 d744 f9ba 0e2e d09d f43e 0f87 7ae6 5ff0 191c c7fb 2e38 0bc7 f78c 0f87 17e8 f63d fe71 That frame is to a STA address that isn't me. It's marked as valid and completed. The EVM values are all whacked though (see how they're all marked as 0x00000000 in the receive status) even though the received rate is an MCS rate (0x8d, high byte of the third status word.) This frame ends up being bumped to the BSS node for the VAP; it updates the CCMP crypto state: ccmp_decap: tid=0, keyix=4, wk_rxkeyix=4 (local debugging) .. and that causes subsequent frames to fail. This is only going to be merged back to -HEAD if I discover it's a hardware issue rather than a driver bug somewhere else. Finally, I've not yet seen this surface on Merlin (AR9280.) I've not yet tested the AR5416 but if it's a hardware bug, it's likely it has the same issue. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Wed Sep 21 23:38:15 2011 (r225719) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Wed Sep 21 23:48:19 2011 (r225720) @@ -3606,6 +3606,36 @@ ath_handle_micerror(struct ieee80211com } } +/* + * It seems that occasionally we receive packets for a sta + * that isn't us. This only occurs in aggregation mode. + * + * This is just a local hack I'm using to sniff an instance + * of these out. + */ +static void +ath_rx_dump_wtf(struct ath_softc *sc, struct ath_rx_status *rs, + struct ath_buf *bf, struct mbuf *m, int status) +{ +#if 0 + const HAL_RATE_TABLE *rt = sc->sc_currates; + uint8_t rix = rt->rateCodeToIndex[rs->rs_rate]; + const struct ieee80211_frame *wh; + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + + wh = mtod(m, const struct ieee80211_frame *); + if (wh->i_addr1[0] == 0xd4) { + device_printf(sc->sc_dev, + "%s: XXX shouldn't see this! keyidx=%d\n", + __func__, rs->rs_keyix); + ieee80211_dump_pkt(ic, mtod(m, caddr_t), m->m_len, + sc->sc_hwmap[rix].ieeerate, rs->rs_rssi); + ath_printrxbuf(sc, bf, 0, status == HAL_OK); + } +#endif +} + static void ath_rx_proc(void *arg, int npending) { @@ -3682,8 +3712,21 @@ ath_rx_proc(void *arg, int npending) #endif if (status == HAL_EINPROGRESS) break; + TAILQ_REMOVE(&sc->sc_rxbuf, bf, bf_list); + /* + * If the datalen is greater than the buffer itself, + * it's a corrupted status descriptor; skip. + * Yes, it may actually have data in it. + */ + if (rs->rs_datalen > m->m_len) { + device_printf(sc->sc_dev, + "%s: corrupt descriptor: datalen=%d, m_len=%d\n", + __func__, rs->rs_datalen, m->m_len); + goto rx_error; + } + /* These aren't specifically errors */ if (rs->rs_flags & HAL_RX_GI) sc->sc_stats.ast_rx_halfgi++; @@ -3760,6 +3803,11 @@ rx_error: * Cleanup any pending partial frame. */ if (sc->sc_rxpending != NULL) { +#if 0 + device_printf(sc->sc_dev, + "%s: error: rs_status=0x%.08x, len=%d, cleaning up pending frame\n", + __func__, rs->rs_status, rs->rs_datalen); +#endif m_freem(sc->sc_rxpending); sc->sc_rxpending = NULL; } @@ -3776,6 +3824,9 @@ rx_error: /* NB: bpf needs the mbuf length setup */ len = rs->rs_datalen; m->m_pkthdr.len = m->m_len = len; + + ath_rx_dump_wtf(sc, rs, bf, m, status); + ath_rx_tap(ifp, m, rs, tsf, nf); ieee80211_radiotap_rx_all(ic, m); } @@ -3798,7 +3849,13 @@ rx_accept: len = rs->rs_datalen; m->m_len = len; + ath_rx_dump_wtf(sc, rs, bf, m, status); + if (rs->rs_more) { +#if 0 + device_printf(sc->sc_dev, "%s: rs_more set; status=0x%.08x, datalen=%d?\n", + __func__, rs->rs_status, rs->rs_datalen); +#endif /* * Frame spans multiple descriptors; save * it for the next completed descriptor, it @@ -3814,6 +3871,10 @@ rx_accept: sc->sc_rxpending = m; goto rx_next; } else if (sc->sc_rxpending != NULL) { +#if 0 + device_printf(sc->sc_dev, "%s: second half? status=0x%.08x, datalen=%d\n", + __func__, rs->rs_status, rs->rs_datalen); +#endif /* * This is the second part of a jumbogram, * chain it to the first mbuf, adjust the @@ -3877,10 +3938,17 @@ rx_accept: * pass the (referenced) node up to the 802.11 layer * for its use. */ - ni = ieee80211_find_rxnode_withkey(ic, - mtod(m, const struct ieee80211_frame_min *), - rs->rs_keyix == HAL_RXKEYIX_INVALID ? - IEEE80211_KEYIX_NONE : rs->rs_keyix); + + /* + * For some reason, the MAC (AR9160?) returns frames + * destined for other STA's when in STA, non-promisc + * mode. Since sometimes these frames seem to look + * quite valid (including completed status, valid + * looking key entry, etc) let's not use the keyix + * as a shortcut. + */ + ni = ieee80211_find_rxnode(ic, + mtod(m, const struct ieee80211_frame_min *)); sc->sc_lastrs = rs; if (rs->rs_isaggr) From owner-svn-src-user@FreeBSD.ORG Thu Sep 22 02:07:29 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8349C1065673; Thu, 22 Sep 2011 02:07:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 744218FC15; Thu, 22 Sep 2011 02:07:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8M27TuC000931; Thu, 22 Sep 2011 02:07:29 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8M27TmD000929; Thu, 22 Sep 2011 02:07:29 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109220207.p8M27TmD000929@svn.freebsd.org> From: Adrian Chadd Date: Thu, 22 Sep 2011 02:07:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225722 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 02:07:29 -0000 Author: adrian Date: Thu Sep 22 02:07:29 2011 New Revision: 225722 URL: http://svn.freebsd.org/changeset/base/225722 Log: Add another WAR Modified: user/adrian/if_ath_tx/sys/dev/ath/README Modified: user/adrian/if_ath_tx/sys/dev/ath/README ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/README Thu Sep 22 01:13:40 2011 (r225721) +++ user/adrian/if_ath_tx/sys/dev/ath/README Thu Sep 22 02:07:29 2011 (r225722) @@ -1,6 +1,12 @@ Things to debug! ---------------- +* Implement a net80211 WAR for this upon association: + +wlan0: [00:1b:b1:58:f6:f0] discard duplicate frame, seqno <0,0> fragno <0,0> tid 0 + +.. basically, initialise the seqno's to be 4095 upon initial association. + * The txqactive bitmap (txeol, txurn, txok, etc) is setup at txq create time to a set of values, then it seems after a channel scan all of the bits are set to 1. I'm not yet sure why. Go in and fix these. From owner-svn-src-user@FreeBSD.ORG Thu Sep 22 03:03:40 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B087106566C; Thu, 22 Sep 2011 03:03:40 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7BB2C8FC08; Thu, 22 Sep 2011 03:03:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8M33efA002810; Thu, 22 Sep 2011 03:03:40 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8M33eei002808; Thu, 22 Sep 2011 03:03:40 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109220303.p8M33eei002808@svn.freebsd.org> From: Adrian Chadd Date: Thu, 22 Sep 2011 03:03:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225723 - user/adrian/if_ath_tx/sys/net80211 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 03:03:40 -0000 Author: adrian Date: Thu Sep 22 03:03:40 2011 New Revision: 225723 URL: http://svn.freebsd.org/changeset/base/225723 Log: Remove an unneeded check; tidy it up a bit, add comments about where things may still go pear-shaped. Modified: user/adrian/if_ath_tx/sys/net80211/ieee80211_sta.c Modified: user/adrian/if_ath_tx/sys/net80211/ieee80211_sta.c ============================================================================== --- user/adrian/if_ath_tx/sys/net80211/ieee80211_sta.c Thu Sep 22 02:07:29 2011 (r225722) +++ user/adrian/if_ath_tx/sys/net80211/ieee80211_sta.c Thu Sep 22 03:03:40 2011 (r225723) @@ -592,10 +592,15 @@ sta_input(struct ieee80211_node *ni, str * * If we receive a data frame that isn't * destined to our VAP MAC, drop it. + * + * XXX TODO: This is only enforced when not scanning; + * XXX it assumes a software-driven scan will put the NIC + * XXX into a "no data frames" mode before setting this + * XXX flag. Otherwise it may be possible that we'll still + * XXX process data frames whilst scanning. */ - if (ni == vap->iv_bss - && (!(IEEE80211_IS_MULTICAST(wh->i_addr1))) - && (!IEEE80211_ADDR_EQ(wh->i_addr1, IF_LLADDR(ifp)))) { + if ((! IEEE80211_IS_MULTICAST(wh->i_addr1)) + && (! IEEE80211_ADDR_EQ(wh->i_addr1, IF_LLADDR(ifp)))) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, bssid, NULL, "not to cur sta: lladdr=%6D, addr1=%6D", IF_LLADDR(ifp), ":", wh->i_addr1, ":"); From owner-svn-src-user@FreeBSD.ORG Thu Sep 22 07:29:46 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F33EE106567A; Thu, 22 Sep 2011 07:29:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1DB58FC08; Thu, 22 Sep 2011 07:29:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8M7Tjap010991; Thu, 22 Sep 2011 07:29:45 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8M7TjLk010989; Thu, 22 Sep 2011 07:29:45 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109220729.p8M7TjLk010989@svn.freebsd.org> From: Adrian Chadd Date: Thu, 22 Sep 2011 07:29:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225724 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 07:29:46 -0000 Author: adrian Date: Thu Sep 22 07:29:45 2011 New Revision: 225724 URL: http://svn.freebsd.org/changeset/base/225724 Log: Free the mbuf before recycling the current rx ath_buf when doing a radiotap. ath_rxbuf_init() doesn't free/realloc existing mbufs (if they do exist), it just passes the buffer pointer/length to the HAL rx descriptor setup code. When doing radiotap however, the mbuf length is overridden before passing it off to radiotap/bpf. This means that the buffer will stay bein potentially shorter until it's next used for a valid frame. I was seeing short frames show up in packet traces, along with seemingly invalid frame contents, probe requests and other random stuff that didn't make sense. These only show up when doing a background radiotap/tcpdump. This patch fixes this behaviour. This is a merge candidate to HEAD. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Thu Sep 22 03:03:40 2011 (r225723) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Thu Sep 22 07:29:45 2011 (r225724) @@ -3824,11 +3824,13 @@ rx_error: /* NB: bpf needs the mbuf length setup */ len = rs->rs_datalen; m->m_pkthdr.len = m->m_len = len; + bf->bf_m = NULL; ath_rx_dump_wtf(sc, rs, bf, m, status); ath_rx_tap(ifp, m, rs, tsf, nf); ieee80211_radiotap_rx_all(ic, m); + m_freem(m); } /* XXX pass MIC errors up for s/w reclaculation */ goto rx_next; From owner-svn-src-user@FreeBSD.ORG Thu Sep 22 08:24:33 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 780E2106566C; Thu, 22 Sep 2011 08:24:33 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DA578FC14; Thu, 22 Sep 2011 08:24:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8M8OXPN012675; Thu, 22 Sep 2011 08:24:33 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8M8OXax012674; Thu, 22 Sep 2011 08:24:33 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201109220824.p8M8OXax012674@svn.freebsd.org> From: "Jayachandran C." Date: Thu, 22 Sep 2011 08:24:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225725 - user/jchandra/mips-xlp-support X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 08:24:33 -0000 Author: jchandra Date: Thu Sep 22 08:24:33 2011 New Revision: 225725 URL: http://svn.freebsd.org/changeset/base/225725 Log: Delete the XLP merge branch, as the merge is done. Deleted: user/jchandra/mips-xlp-support/ From owner-svn-src-user@FreeBSD.ORG Thu Sep 22 10:52:14 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C9EB106564A; Thu, 22 Sep 2011 10:52:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BEAE8FC0A; Thu, 22 Sep 2011 10:52:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8MAqEvi019577; Thu, 22 Sep 2011 10:52:14 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8MAqEd9019575; Thu, 22 Sep 2011 10:52:14 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109221052.p8MAqEd9019575@svn.freebsd.org> From: Adrian Chadd Date: Thu, 22 Sep 2011 10:52:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225727 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 10:52:14 -0000 Author: adrian Date: Thu Sep 22 10:52:14 2011 New Revision: 225727 URL: http://svn.freebsd.org/changeset/base/225727 Log: Revert the STA keycache multicast entry fix for now; just so I can tinker with some other things that need it. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_keycache.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_keycache.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_keycache.c Thu Sep 22 08:39:20 2011 (r225726) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_keycache.c Thu Sep 22 10:52:14 2011 (r225727) @@ -214,14 +214,20 @@ ath_keyset(struct ath_softc *sc, struct hk.kv_type = HAL_CIPHER_CLR; /* + * XXX TODO: check this: + * * Group keys on hardware that supports multicast frame * key search should only be done in adhoc/hostap mode, * not STA mode. * * XXX TODO: what about mesh, tdma? */ +#if 0 if ((vap->iv_opmode == IEEE80211_M_HOSTAP || vap->iv_opmode == IEEE80211_M_IBSS) && +#else + if ( +#endif (k->wk_flags & IEEE80211_KEY_GROUP) && sc->sc_mcastkey) { /* From owner-svn-src-user@FreeBSD.ORG Thu Sep 22 12:53:28 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67B6C106564A; Thu, 22 Sep 2011 12:53:28 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 53CD28FC13; Thu, 22 Sep 2011 12:53:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8MCrSK9023630; Thu, 22 Sep 2011 12:53:28 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8MCrSWs023614; Thu, 22 Sep 2011 12:53:28 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201109221253.p8MCrSWs023614@svn.freebsd.org> From: Attilio Rao Date: Thu, 22 Sep 2011 12:53:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225729 - in user/attilio/vmcontention: contrib/top libexec/rtld-elf share/mk sys/dev/usb sys/dev/xen/blkfront sys/dev/xen/control sys/dev/xen/netfront sys/net sys/netinet6 sys/ufs/ffs ... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 12:53:28 -0000 Author: attilio Date: Thu Sep 22 12:53:27 2011 New Revision: 225729 URL: http://svn.freebsd.org/changeset/base/225729 Log: MFC Modified: user/attilio/vmcontention/libexec/rtld-elf/map_object.c user/attilio/vmcontention/sys/dev/usb/usb_transfer.c user/attilio/vmcontention/sys/dev/xen/blkfront/blkfront.c user/attilio/vmcontention/sys/dev/xen/blkfront/block.h user/attilio/vmcontention/sys/dev/xen/control/control.c user/attilio/vmcontention/sys/dev/xen/netfront/netfront.c user/attilio/vmcontention/sys/net/if_llatbl.h user/attilio/vmcontention/sys/net/radix.h user/attilio/vmcontention/sys/net/route.h user/attilio/vmcontention/sys/netinet6/in6.h user/attilio/vmcontention/sys/ufs/ffs/ffs_softdep.c user/attilio/vmcontention/sys/xen/xenbus/xenbusb.c user/attilio/vmcontention/sys/xen/xenbus/xenbusb_back.c user/attilio/vmcontention/sys/xen/xenbus/xenbusb_front.c user/attilio/vmcontention/sys/xen/xenstore/xenstore.c Directory Properties: user/attilio/vmcontention/ (props changed) user/attilio/vmcontention/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/contrib/bind9/ (props changed) user/attilio/vmcontention/contrib/binutils/ (props changed) user/attilio/vmcontention/contrib/bzip2/ (props changed) user/attilio/vmcontention/contrib/compiler-rt/ (props changed) user/attilio/vmcontention/contrib/dialog/ (props changed) user/attilio/vmcontention/contrib/ee/ (props changed) user/attilio/vmcontention/contrib/expat/ (props changed) user/attilio/vmcontention/contrib/file/ (props changed) user/attilio/vmcontention/contrib/gcc/ (props changed) user/attilio/vmcontention/contrib/gdb/ (props changed) user/attilio/vmcontention/contrib/gdtoa/ (props changed) user/attilio/vmcontention/contrib/gnu-sort/ (props changed) user/attilio/vmcontention/contrib/groff/ (props changed) user/attilio/vmcontention/contrib/less/ (props changed) user/attilio/vmcontention/contrib/libpcap/ (props changed) user/attilio/vmcontention/contrib/libstdc++/ (props changed) user/attilio/vmcontention/contrib/llvm/ (props changed) user/attilio/vmcontention/contrib/llvm/tools/clang/ (props changed) user/attilio/vmcontention/contrib/ncurses/ (props changed) user/attilio/vmcontention/contrib/netcat/ (props changed) user/attilio/vmcontention/contrib/ntp/ (props changed) user/attilio/vmcontention/contrib/one-true-awk/ (props changed) user/attilio/vmcontention/contrib/openbsm/ (props changed) user/attilio/vmcontention/contrib/openpam/ (props changed) user/attilio/vmcontention/contrib/openresolv/ (props changed) user/attilio/vmcontention/contrib/pf/ (props changed) user/attilio/vmcontention/contrib/sendmail/ (props changed) user/attilio/vmcontention/contrib/tcpdump/ (props changed) user/attilio/vmcontention/contrib/tcsh/ (props changed) user/attilio/vmcontention/contrib/tnftp/ (props changed) user/attilio/vmcontention/contrib/top/ (props changed) user/attilio/vmcontention/contrib/top/install-sh (props changed) user/attilio/vmcontention/contrib/tzcode/stdtime/ (props changed) user/attilio/vmcontention/contrib/tzcode/zic/ (props changed) user/attilio/vmcontention/contrib/tzdata/ (props changed) user/attilio/vmcontention/contrib/wpa/ (props changed) user/attilio/vmcontention/contrib/xz/ (props changed) user/attilio/vmcontention/crypto/openssh/ (props changed) user/attilio/vmcontention/crypto/openssl/ (props changed) user/attilio/vmcontention/gnu/lib/ (props changed) user/attilio/vmcontention/gnu/usr.bin/binutils/ (props changed) user/attilio/vmcontention/gnu/usr.bin/cc/cc_tools/ (props changed) user/attilio/vmcontention/gnu/usr.bin/gdb/ (props changed) user/attilio/vmcontention/lib/libc/ (props changed) user/attilio/vmcontention/lib/libc/stdtime/ (props changed) user/attilio/vmcontention/lib/libutil/ (props changed) user/attilio/vmcontention/lib/libz/ (props changed) user/attilio/vmcontention/sbin/ (props changed) user/attilio/vmcontention/sbin/ipfw/ (props changed) user/attilio/vmcontention/share/mk/bsd.arch.inc.mk (props changed) user/attilio/vmcontention/share/zoneinfo/ (props changed) user/attilio/vmcontention/sys/ (props changed) user/attilio/vmcontention/sys/amd64/include/xen/ (props changed) user/attilio/vmcontention/sys/boot/ (props changed) user/attilio/vmcontention/sys/boot/i386/efi/ (props changed) user/attilio/vmcontention/sys/boot/ia64/efi/ (props changed) user/attilio/vmcontention/sys/boot/ia64/ski/ (props changed) user/attilio/vmcontention/sys/boot/powerpc/boot1.chrp/ (props changed) user/attilio/vmcontention/sys/boot/powerpc/ofw/ (props changed) user/attilio/vmcontention/sys/cddl/contrib/opensolaris/ (props changed) user/attilio/vmcontention/sys/conf/ (props changed) user/attilio/vmcontention/sys/contrib/dev/acpica/ (props changed) user/attilio/vmcontention/sys/contrib/octeon-sdk/ (props changed) user/attilio/vmcontention/sys/contrib/pf/ (props changed) user/attilio/vmcontention/sys/contrib/x86emu/ (props changed) user/attilio/vmcontention/usr.bin/calendar/ (props changed) user/attilio/vmcontention/usr.bin/csup/ (props changed) user/attilio/vmcontention/usr.bin/procstat/ (props changed) user/attilio/vmcontention/usr.sbin/ndiscvt/ (props changed) user/attilio/vmcontention/usr.sbin/rtadvctl/ (props changed) user/attilio/vmcontention/usr.sbin/rtadvd/ (props changed) user/attilio/vmcontention/usr.sbin/rtsold/ (props changed) user/attilio/vmcontention/usr.sbin/zic/ (props changed) Modified: user/attilio/vmcontention/libexec/rtld-elf/map_object.c ============================================================================== --- user/attilio/vmcontention/libexec/rtld-elf/map_object.c Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/libexec/rtld-elf/map_object.c Thu Sep 22 12:53:27 2011 (r225729) @@ -215,8 +215,9 @@ map_object(int fd, const char *path, con bss_vlimit = round_page(segs[i]->p_vaddr + segs[i]->p_memsz); bss_addr = mapbase + (bss_vaddr - base_vaddr); if (bss_vlimit > bss_vaddr) { /* There is something to do */ - if (mprotect(bss_addr, bss_vlimit - bss_vaddr, data_prot) == -1) { - _rtld_error("%s: mprotect of bss failed: %s", path, + if (mmap(bss_addr, bss_vlimit - bss_vaddr, data_prot, + data_flags | MAP_ANON, -1, 0) == (caddr_t)-1) { + _rtld_error("%s: mmap of bss failed: %s", path, strerror(errno)); return NULL; } Modified: user/attilio/vmcontention/sys/dev/usb/usb_transfer.c ============================================================================== --- user/attilio/vmcontention/sys/dev/usb/usb_transfer.c Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/sys/dev/usb/usb_transfer.c Thu Sep 22 12:53:27 2011 (r225729) @@ -2417,8 +2417,9 @@ usbd_transfer_start_cb(void *arg) #if USB_HAVE_PF usbpf_xfertap(xfer, USBPF_XFERTAP_SUBMIT); #endif - /* start the transfer */ - (ep->methods->start) (xfer); + /* start USB transfer, if no error */ + if (xfer->error == 0) + (ep->methods->start) (xfer); xfer->flags_int.can_cancel_immed = 1; @@ -2597,8 +2598,9 @@ usbd_pipe_start(struct usb_xfer_queue *p #if USB_HAVE_PF usbpf_xfertap(xfer, USBPF_XFERTAP_SUBMIT); #endif - /* start USB transfer */ - (ep->methods->start) (xfer); + /* start USB transfer, if no error */ + if (xfer->error == 0) + (ep->methods->start) (xfer); xfer->flags_int.can_cancel_immed = 1; Modified: user/attilio/vmcontention/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- user/attilio/vmcontention/sys/dev/xen/blkfront/blkfront.c Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/sys/dev/xen/blkfront/blkfront.c Thu Sep 22 12:53:27 2011 (r225729) @@ -77,11 +77,8 @@ static int blkfront_detach(device_t); static int setup_blkring(struct xb_softc *); static void blkif_int(void *); static void blkfront_initialize(struct xb_softc *); -#if 0 -static void blkif_recover(struct xb_softc *); -#endif static int blkif_completion(struct xb_command *); -static void blkif_free(struct xb_softc *, int); +static void blkif_free(struct xb_softc *); static void blkif_queue_cb(void *, bus_dma_segment_t *, int, int); MALLOC_DEFINE(M_XENBLOCKFRONT, "xbd", "Xen Block Front driver data"); @@ -452,9 +449,6 @@ blkfront_attach(device_t dev) sc->vdevice = vdevice; sc->connected = BLKIF_STATE_DISCONNECTED; - /* Front end dir is a number, which is used as the id. */ - sc->handle = strtoul(strrchr(xenbus_get_node(dev),'/')+1, NULL, 0); - /* Wait for backend device to publish its protocol capabilities. */ xenbus_set_state(dev, XenbusStateInitialising); @@ -465,29 +459,40 @@ static int blkfront_suspend(device_t dev) { struct xb_softc *sc = device_get_softc(dev); + int retval; + int saved_state; /* Prevent new requests being issued until we fix things up. */ mtx_lock(&sc->xb_io_lock); + saved_state = sc->connected; sc->connected = BLKIF_STATE_SUSPENDED; + + /* Wait for outstanding I/O to drain. */ + retval = 0; + while (TAILQ_EMPTY(&sc->cm_busy) == 0) { + if (msleep(&sc->cm_busy, &sc->xb_io_lock, + PRIBIO, "blkf_susp", 30 * hz) == EWOULDBLOCK) { + retval = EBUSY; + break; + } + } mtx_unlock(&sc->xb_io_lock); - return (0); + if (retval != 0) + sc->connected = saved_state; + + return (retval); } static int blkfront_resume(device_t dev) { -#if 0 struct xb_softc *sc = device_get_softc(dev); DPRINTK("blkfront_resume: %s\n", xenbus_get_node(dev)); -/* XXX This can't work!!! */ - blkif_free(sc, 1); + blkif_free(sc); blkfront_initialize(sc); - if (sc->connected == BLKIF_STATE_SUSPENDED) - blkif_recover(sc); -#endif return (0); } @@ -499,8 +504,10 @@ blkfront_initialize(struct xb_softc *sc) int error; int i; - if (xenbus_get_state(sc->xb_dev) != XenbusStateInitialising) - return; + if (xenbus_get_state(sc->xb_dev) != XenbusStateInitialising) { + /* Initialization has already been performed. */ + return; + } /* * Protocol defaults valid even if negotiation for a @@ -593,8 +600,10 @@ blkfront_initialize(struct xb_softc *sc) sc->shadow = malloc(sizeof(*sc->shadow) * sc->max_requests, M_XENBLOCKFRONT, M_NOWAIT|M_ZERO); if (sc->shadow == NULL) { + bus_dma_tag_destroy(sc->xb_io_dmat); xenbus_dev_fatal(sc->xb_dev, error, "Cannot allocate request structures\n"); + return; } for (i = 0; i < sc->max_requests; i++) { @@ -755,10 +764,10 @@ blkfront_backend_changed(device_t dev, X break; case XenbusStateInitWait: + case XenbusStateInitialised: blkfront_initialize(sc); break; - case XenbusStateInitialised: case XenbusStateConnected: blkfront_initialize(sc); blkfront_connect(sc); @@ -775,7 +784,7 @@ blkfront_backend_changed(device_t dev, X } /* -** Invoked when the backend is finally 'ready' (and has told produced +** Invoked when the backend is finally 'ready' (and has published ** the details about the physical device - #sectors, size, etc). */ static void @@ -809,13 +818,15 @@ blkfront_connect(struct xb_softc *sc) if (!err || feature_barrier) sc->xb_flags |= XB_BARRIER; - device_printf(dev, "%juMB <%s> at %s", - (uintmax_t) sectors / (1048576 / sector_size), - device_get_desc(dev), - xenbus_get_node(dev)); - bus_print_child_footer(device_get_parent(dev), dev); + if (sc->xb_disk == NULL) { + device_printf(dev, "%juMB <%s> at %s", + (uintmax_t) sectors / (1048576 / sector_size), + device_get_desc(dev), + xenbus_get_node(dev)); + bus_print_child_footer(device_get_parent(dev), dev); - xlvbd_add(sc, sectors, sc->vdevice, binfo, sector_size); + xlvbd_add(sc, sectors, sc->vdevice, binfo, sector_size); + } (void)xenbus_set_state(dev, XenbusStateConnected); @@ -825,7 +836,6 @@ blkfront_connect(struct xb_softc *sc) xb_startio(sc); sc->xb_flags |= XB_READY; mtx_unlock(&sc->xb_io_lock); - } /** @@ -859,7 +869,7 @@ blkfront_detach(device_t dev) DPRINTK("blkfront_remove: %s removed\n", xenbus_get_node(dev)); - blkif_free(sc, 0); + blkif_free(sc); mtx_destroy(&sc->xb_io_lock); return 0; @@ -1140,6 +1150,9 @@ xb_startio(struct xb_softc *sc) mtx_assert(&sc->xb_io_lock, MA_OWNED); + if (sc->connected != BLKIF_STATE_CONNECTED) + return; + while (RING_FREE_REQUESTS(&sc->ring) >= sc->max_request_blocks) { if (sc->xb_flags & XB_FROZEN) break; @@ -1174,7 +1187,7 @@ blkif_int(void *xsc) mtx_lock(&sc->xb_io_lock); - if (unlikely(sc->connected != BLKIF_STATE_CONNECTED)) { + if (unlikely(sc->connected == BLKIF_STATE_DISCONNECTED)) { mtx_unlock(&sc->xb_io_lock); return; } @@ -1232,19 +1245,21 @@ blkif_int(void *xsc) xb_startio(sc); + if (unlikely(sc->connected == BLKIF_STATE_SUSPENDED)) + wakeup(&sc->cm_busy); + mtx_unlock(&sc->xb_io_lock); } static void -blkif_free(struct xb_softc *sc, int suspend) +blkif_free(struct xb_softc *sc) { uint8_t *sring_page_ptr; int i; /* Prevent new requests being issued until we fix things up. */ mtx_lock(&sc->xb_io_lock); - sc->connected = suspend ? - BLKIF_STATE_SUSPENDED : BLKIF_STATE_DISCONNECTED; + sc->connected = BLKIF_STATE_DISCONNECTED; mtx_unlock(&sc->xb_io_lock); /* Free resources associated with old device channel. */ @@ -1276,6 +1291,12 @@ blkif_free(struct xb_softc *sc, int susp } free(sc->shadow, M_XENBLOCKFRONT); sc->shadow = NULL; + + bus_dma_tag_destroy(sc->xb_io_dmat); + + xb_initq_free(sc); + xb_initq_ready(sc); + xb_initq_complete(sc); } if (sc->irq) { @@ -1292,21 +1313,6 @@ blkif_completion(struct xb_command *s) return (BLKIF_SEGS_TO_BLOCKS(s->nseg)); } -#if 0 -static void -blkif_recover(struct xb_softc *sc) -{ - /* - * XXX The whole concept of not quiescing and completing all i/o - * during suspend, and then hoping to recover and replay the - * resulting abandoned I/O during resume, is laughable. At best, - * it invalidates the i/o ordering rules required by just about - * every filesystem, and at worst it'll corrupt data. The code - * has been removed until further notice. - */ -} -#endif - /* ** Driver registration ** */ static device_method_t blkfront_methods[] = { /* Device interface */ Modified: user/attilio/vmcontention/sys/dev/xen/blkfront/block.h ============================================================================== --- user/attilio/vmcontention/sys/dev/xen/blkfront/block.h Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/sys/dev/xen/blkfront/block.h Thu Sep 22 12:53:27 2011 (r225729) @@ -142,7 +142,6 @@ struct xb_softc { #define XB_READY (1 << 2) /* Is ready */ #define XB_FROZEN (1 << 3) /* Waiting for resources */ int vdevice; - blkif_vdev_t handle; int connected; u_int ring_pages; uint32_t max_requests; Modified: user/attilio/vmcontention/sys/dev/xen/control/control.c ============================================================================== --- user/attilio/vmcontention/sys/dev/xen/control/control.c Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/sys/dev/xen/control/control.c Thu Sep 22 12:53:27 2011 (r225729) @@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -201,6 +202,8 @@ xctrl_suspend() int i, j, k, fpp; unsigned long max_pfn, start_info_mfn; + EVENTHANDLER_INVOKE(power_suspend); + #ifdef SMP struct thread *td; cpuset_t map; @@ -221,7 +224,13 @@ xctrl_suspend() stop_cpus(map); #endif + /* + * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since non-MPSAFE + * drivers need this. + */ + mtx_lock(&Giant); if (DEVICE_SUSPEND(root_bus) != 0) { + mtx_unlock(&Giant); printf("xen_suspend: device_suspend failed\n"); #ifdef SMP if (!CPU_EMPTY(&map)) @@ -229,6 +238,7 @@ xctrl_suspend() #endif return; } + mtx_unlock(&Giant); local_irq_disable(); @@ -283,11 +293,14 @@ xctrl_suspend() vcpu_prepare(i); #endif + /* * Only resume xenbus /after/ we've prepared our VCPUs; otherwise * the VCPU hotplug callback can race with our vcpu_prepare */ + mtx_lock(&Giant); DEVICE_RESUME(root_bus); + mtx_unlock(&Giant); #ifdef SMP thread_lock(curthread); @@ -296,6 +309,7 @@ xctrl_suspend() if (!CPU_EMPTY(&map)) restart_cpus(map); #endif + EVENTHANDLER_INVOKE(power_resume); } static void @@ -322,39 +336,47 @@ xctrl_suspend() { int suspend_cancelled; + EVENTHANDLER_INVOKE(power_suspend); + + /* + * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since non-MPSAFE + * drivers need this. + */ + mtx_lock(&Giant); if (DEVICE_SUSPEND(root_bus)) { + mtx_unlock(&Giant); printf("xen_suspend: device_suspend failed\n"); return; } - - /* - * Make sure we don't change cpus or switch to some other - * thread. for the duration. - */ - critical_enter(); + mtx_unlock(&Giant); /* * Prevent any races with evtchn_interrupt() handler. */ - irq_suspend(); disable_intr(); + irq_suspend(); suspend_cancelled = HYPERVISOR_suspend(0); - if (!suspend_cancelled) + if (suspend_cancelled) + irq_resume(); + else xenpci_resume(); /* * Re-enable interrupts and put the scheduler back to normal. */ enable_intr(); - critical_exit(); /* * FreeBSD really needs to add DEVICE_SUSPEND_CANCEL or * similar. */ + mtx_lock(&Giant); if (!suspend_cancelled) DEVICE_RESUME(root_bus); + mtx_unlock(&Giant); + + EVENTHANDLER_INVOKE(power_resume); } #endif Modified: user/attilio/vmcontention/sys/dev/xen/netfront/netfront.c ============================================================================== --- user/attilio/vmcontention/sys/dev/xen/netfront/netfront.c Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/sys/dev/xen/netfront/netfront.c Thu Sep 22 12:53:27 2011 (r225729) @@ -92,7 +92,8 @@ __FBSDID("$FreeBSD$"); #include "xenbus_if.h" -#define XN_CSUM_FEATURES (CSUM_TCP | CSUM_UDP | CSUM_TSO) +/* Features supported by all backends. TSO and LRO can be negotiated */ +#define XN_CSUM_FEATURES (CSUM_TCP | CSUM_UDP) #define NET_TX_RING_SIZE __RING_SIZE((netif_tx_sring_t *)0, PAGE_SIZE) #define NET_RX_RING_SIZE __RING_SIZE((netif_rx_sring_t *)0, PAGE_SIZE) @@ -159,6 +160,8 @@ static int xn_ioctl(struct ifnet *, u_l static void xn_ifinit_locked(struct netfront_info *); static void xn_ifinit(void *); static void xn_stop(struct netfront_info *); +static void xn_query_features(struct netfront_info *np); +static int xn_configure_features(struct netfront_info *np); #ifdef notyet static void xn_watchdog(struct ifnet *); #endif @@ -174,7 +177,7 @@ static int talk_to_backend(device_t dev, static int create_netdev(device_t dev); static void netif_disconnect_backend(struct netfront_info *info); static int setup_device(device_t dev, struct netfront_info *info); -static void end_access(int ref, void *page); +static void free_ring(int *ref, void *ring_ptr_ref); static int xn_ifmedia_upd(struct ifnet *ifp); static void xn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr); @@ -261,6 +264,7 @@ struct netfront_info { u_int irq; u_int copying_receiver; u_int carrier; + u_int maxfrags; /* Receive-ring batched refills. */ #define RX_MIN_TARGET 32 @@ -405,11 +409,33 @@ xen_net_read_mac(device_t dev, uint8_t m { int error, i; char *s, *e, *macstr; + const char *path; - error = xs_read(XST_NIL, xenbus_get_node(dev), "mac", NULL, - (void **) &macstr); - if (error) + path = xenbus_get_node(dev); + error = xs_read(XST_NIL, path, "mac", NULL, (void **) &macstr); + if (error == ENOENT) { + /* + * Deal with missing mac XenStore nodes on devices with + * HVM emulation (the 'ioemu' configuration attribute) + * enabled. + * + * The HVM emulator may execute in a stub device model + * domain which lacks the permission, only given to Dom0, + * to update the guest's XenStore tree. For this reason, + * the HVM emulator doesn't even attempt to write the + * front-side mac node, even when operating in Dom0. + * However, there should always be a mac listed in the + * backend tree. Fallback to this version if our query + * of the front side XenStore location doesn't find + * anything. + */ + path = xenbus_get_otherend_path(dev); + error = xs_read(XST_NIL, path, "mac", NULL, (void **) &macstr); + } + if (error != 0) { + xenbus_dev_fatal(dev, error, "parsing %s/mac", path); return (error); + } s = macstr; for (i = 0; i < ETHER_ADDR_LEN; i++) { @@ -450,7 +476,7 @@ netfront_attach(device_t dev) err = create_netdev(dev); if (err) { xenbus_dev_fatal(dev, err, "creating netdev"); - return err; + return (err); } #if __FreeBSD_version >= 700000 @@ -460,9 +486,21 @@ netfront_attach(device_t dev) &xn_enable_lro, 0, "Large Receive Offload"); #endif - return 0; + return (0); } +static int +netfront_suspend(device_t dev) +{ + struct netfront_info *info = device_get_softc(dev); + + XN_RX_LOCK(info); + XN_TX_LOCK(info); + netfront_carrier_off(info); + XN_TX_UNLOCK(info); + XN_RX_UNLOCK(info); + return (0); +} /** * We are reconnecting to the backend, due to a suspend/resume, or a backend @@ -749,10 +787,7 @@ netif_release_tx_bufs(struct netfront_in */ if (((uintptr_t)m) <= NET_TX_RING_SIZE) continue; - gnttab_grant_foreign_access_ref(np->grant_tx_ref[i], - xenbus_get_otherend_id(np->xbdev), - virt_to_mfn(mtod(m, vm_offset_t)), - GNTMAP_readonly); + gnttab_end_foreign_access_ref(np->grant_tx_ref[i]); gnttab_release_grant_reference(&np->gref_tx_head, np->grant_tx_ref[i]); np->grant_tx_ref[i] = GRANT_REF_INVALID; @@ -761,7 +796,7 @@ netif_release_tx_bufs(struct netfront_in if (np->xn_cdata.xn_tx_chain_cnt < 0) { panic("netif_release_tx_bufs: tx_chain_cnt must be >= 0"); } - m_freem(m); + m_free(m); } } @@ -1494,7 +1529,7 @@ xn_assemble_tx_request(struct netfront_i * deal with nfrags > MAX_TX_REQ_FRAGS, which is a quirk of * the Linux network stack. */ - if (nfrags > MAX_TX_REQ_FRAGS) { + if (nfrags > sc->maxfrags) { m = m_defrag(m_head, M_DONTWAIT); if (!m) { /* @@ -1911,6 +1946,8 @@ network_connect(struct netfront_info *np return (error); /* Step 1: Reinitialise variables. */ + xn_query_features(np); + xn_configure_features(np); netif_release_tx_bufs(np); /* Step 2: Rebuild the RX buffer freelist and the RX ring itself. */ @@ -1978,6 +2015,67 @@ show_device(struct netfront_info *sc) #endif } +static void +xn_query_features(struct netfront_info *np) +{ + int val; + + device_printf(np->xbdev, "backend features:"); + + if (xs_scanf(XST_NIL, xenbus_get_otherend_path(np->xbdev), + "feature-sg", NULL, "%d", &val) < 0) + val = 0; + + np->maxfrags = 1; + if (val) { + np->maxfrags = MAX_TX_REQ_FRAGS; + printf(" feature-sg"); + } + + if (xs_scanf(XST_NIL, xenbus_get_otherend_path(np->xbdev), + "feature-gso-tcpv4", NULL, "%d", &val) < 0) + val = 0; + + np->xn_ifp->if_capabilities &= ~(IFCAP_TSO4|IFCAP_LRO); + if (val) { + np->xn_ifp->if_capabilities |= IFCAP_TSO4|IFCAP_LRO; + printf(" feature-gso-tcp4"); + } + + printf("\n"); +} + +static int +xn_configure_features(struct netfront_info *np) +{ + int err; + + err = 0; +#if __FreeBSD_version >= 700000 + if ((np->xn_ifp->if_capenable & IFCAP_LRO) != 0) + tcp_lro_free(&np->xn_lro); +#endif + np->xn_ifp->if_capenable = + np->xn_ifp->if_capabilities & ~(IFCAP_LRO|IFCAP_TSO4); + np->xn_ifp->if_hwassist &= ~CSUM_TSO; +#if __FreeBSD_version >= 700000 + if (xn_enable_lro && (np->xn_ifp->if_capabilities & IFCAP_LRO) != 0) { + err = tcp_lro_init(&np->xn_lro); + if (err) { + device_printf(np->xbdev, "LRO initialization failed\n"); + } else { + np->xn_lro.ifp = np->xn_ifp; + np->xn_ifp->if_capenable |= IFCAP_LRO; + } + } + if ((np->xn_ifp->if_capabilities & IFCAP_TSO4) != 0) { + np->xn_ifp->if_capenable |= IFCAP_TSO4; + np->xn_ifp->if_hwassist |= CSUM_TSO; + } +#endif + return (err); +} + /** Create a network device. * @param handle device handle */ @@ -2002,7 +2100,7 @@ create_netdev(device_t dev) np->rx_target = RX_MIN_TARGET; np->rx_min_target = RX_MIN_TARGET; np->rx_max_target = RX_MAX_TARGET; - + /* Initialise {tx,rx}_skbs to be a free chain containing every entry. */ for (i = 0; i <= NET_TX_RING_SIZE; i++) { np->tx_mbufs[i] = (void *) ((u_long) i+1); @@ -2032,11 +2130,8 @@ create_netdev(device_t dev) } err = xen_net_read_mac(dev, np->mac); - if (err) { - xenbus_dev_fatal(dev, err, "parsing %s/mac", - xenbus_get_node(dev)); + if (err) goto out; - } /* Set up ifnet structure */ ifp = np->xn_ifp = if_alloc(IFT_ETHER); @@ -2055,19 +2150,6 @@ create_netdev(device_t dev) ifp->if_hwassist = XN_CSUM_FEATURES; ifp->if_capabilities = IFCAP_HWCSUM; -#if __FreeBSD_version >= 700000 - ifp->if_capabilities |= IFCAP_TSO4; - if (xn_enable_lro) { - int err = tcp_lro_init(&np->xn_lro); - if (err) { - device_printf(dev, "LRO initialization failed\n"); - goto exit; - } - np->xn_lro.ifp = ifp; - ifp->if_capabilities |= IFCAP_LRO; - } -#endif - ifp->if_capenable = ifp->if_capabilities; ether_ifattach(ifp, np->mac); callout_init(&np->xn_stat_ch, CALLOUT_MPSAFE); @@ -2078,8 +2160,7 @@ create_netdev(device_t dev) exit: gnttab_free_grant_references(np->gref_tx_head); out: - panic("do something smart"); - + return (err); } /** @@ -2133,12 +2214,8 @@ netif_disconnect_backend(struct netfront XN_TX_UNLOCK(info); XN_RX_UNLOCK(info); - end_access(info->tx_ring_ref, info->tx.sring); - end_access(info->rx_ring_ref, info->rx.sring); - info->tx_ring_ref = GRANT_REF_INVALID; - info->rx_ring_ref = GRANT_REF_INVALID; - info->tx.sring = NULL; - info->rx.sring = NULL; + free_ring(&info->tx_ring_ref, &info->tx.sring); + free_ring(&info->rx_ring_ref, &info->rx.sring); if (info->irq) unbind_from_irqhandler(info->irq); @@ -2146,12 +2223,17 @@ netif_disconnect_backend(struct netfront info->irq = 0; } - static void -end_access(int ref, void *page) +free_ring(int *ref, void *ring_ptr_ref) { - if (ref != GRANT_REF_INVALID) - gnttab_end_foreign_access(ref, page); + void **ring_ptr_ptr = ring_ptr_ref; + + if (*ref != GRANT_REF_INVALID) { + /* This API frees the associated storage. */ + gnttab_end_foreign_access(*ref, *ring_ptr_ptr); + *ref = GRANT_REF_INVALID; + } + *ring_ptr_ptr = NULL; } static int @@ -2174,7 +2256,7 @@ static device_method_t netfront_methods[ DEVMETHOD(device_attach, netfront_attach), DEVMETHOD(device_detach, netfront_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_suspend, netfront_suspend), DEVMETHOD(device_resume, netfront_resume), /* Xenbus interface */ Modified: user/attilio/vmcontention/sys/net/if_llatbl.h ============================================================================== --- user/attilio/vmcontention/sys/net/if_llatbl.h Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/sys/net/if_llatbl.h Thu Sep 22 12:53:27 2011 (r225729) @@ -59,6 +59,7 @@ struct llentry { struct rwlock lle_lock; struct lltable *lle_tbl; struct llentries *lle_head; + void (*lle_free)(struct lltable *, struct llentry *); struct mbuf *la_hold; int la_numheld; /* # of packets currently held */ time_t la_expire; Modified: user/attilio/vmcontention/sys/net/radix.h ============================================================================== --- user/attilio/vmcontention/sys/net/radix.h Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/sys/net/radix.h Thu Sep 22 12:53:27 2011 (r225729) @@ -105,6 +105,8 @@ typedef int walktree_f_t(struct radix_no struct radix_node_head { struct radix_node *rnh_treetop; + u_int rnh_gen; /* generation counter */ + int rnh_multipath; /* multipath capable ? */ int rnh_addrsize; /* permit, but not require fixed keys */ int rnh_pktsize; /* permit, but not require fixed keys */ struct radix_node *(*rnh_addaddr) /* add based on sockaddr */ @@ -131,8 +133,6 @@ struct radix_node_head { void (*rnh_close) /* do something when the last ref drops */ (struct radix_node *rn, struct radix_node_head *head); struct radix_node rnh_nodes[3]; /* empty tree for common case */ - int rnh_multipath; /* multipath capable ? */ - u_int rnh_spare; /* route caching */ #ifdef _KERNEL struct rwlock rnh_lock; /* locks entire radix tree */ #endif Modified: user/attilio/vmcontention/sys/net/route.h ============================================================================== --- user/attilio/vmcontention/sys/net/route.h Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/sys/net/route.h Thu Sep 22 12:53:27 2011 (r225729) @@ -49,9 +49,13 @@ struct route { struct rtentry *ro_rt; struct llentry *ro_lle; + struct in_ifaddr *ro_ia; + int ro_flags; struct sockaddr ro_dst; }; +#define RT_CACHING_CONTEXT 0x1 + /* * These numbers are used by reliable protocols for determining * retransmission behavior and are included in the routing structure. Modified: user/attilio/vmcontention/sys/netinet6/in6.h ============================================================================== --- user/attilio/vmcontention/sys/netinet6/in6.h Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/sys/netinet6/in6.h Thu Sep 22 12:53:27 2011 (r225729) @@ -376,6 +376,8 @@ extern const struct in6_addr in6addr_lin struct route_in6 { struct rtentry *ro_rt; struct llentry *ro_lle; + struct in6_addr *ro_ia6; + int ro_flags; struct sockaddr_in6 ro_dst; }; #endif Modified: user/attilio/vmcontention/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- user/attilio/vmcontention/sys/ufs/ffs/ffs_softdep.c Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/sys/ufs/ffs/ffs_softdep.c Thu Sep 22 12:53:27 2011 (r225729) @@ -12648,7 +12648,7 @@ retry: MNT_ILOCK(mp); continue; } - (void) ffs_syncvnode(lvp, MNT_WAIT); + (void) ffs_syncvnode(lvp, MNT_NOWAIT); vput(lvp); MNT_ILOCK(mp); } Modified: user/attilio/vmcontention/sys/xen/xenbus/xenbusb.c ============================================================================== --- user/attilio/vmcontention/sys/xen/xenbus/xenbusb.c Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/sys/xen/xenbus/xenbusb.c Thu Sep 22 12:53:27 2011 (r225729) @@ -773,7 +773,7 @@ xenbusb_resume(device_t dev) ivars = device_get_ivars(kids[i]); xs_unregister_watch(&ivars->xd_otherend_watch); - ivars->xd_state = XenbusStateInitialising; + xenbus_set_state(kids[i], XenbusStateInitialising); /* * Find the new backend details and @@ -783,16 +783,16 @@ xenbusb_resume(device_t dev) if (error) return (error); - DEVICE_RESUME(kids[i]); - statepath = malloc(ivars->xd_otherend_path_len + strlen("/state") + 1, M_XENBUS, M_WAITOK); sprintf(statepath, "%s/state", ivars->xd_otherend_path); free(ivars->xd_otherend_watch.node, M_XENBUS); ivars->xd_otherend_watch.node = statepath; - xs_register_watch(&ivars->xd_otherend_watch); + DEVICE_RESUME(kids[i]); + + xs_register_watch(&ivars->xd_otherend_watch); #if 0 /* * Can't do this yet since we are running in Modified: user/attilio/vmcontention/sys/xen/xenbus/xenbusb_back.c ============================================================================== --- user/attilio/vmcontention/sys/xen/xenbus/xenbusb_back.c Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/sys/xen/xenbus/xenbusb_back.c Thu Sep 22 12:53:27 2011 (r225729) @@ -292,7 +292,7 @@ static device_method_t xenbusb_back_meth DEVMETHOD(device_detach, bus_generic_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_resume, xenbusb_resume), /* Bus Interface */ DEVMETHOD(bus_print_child, xenbusb_print_child), Modified: user/attilio/vmcontention/sys/xen/xenbus/xenbusb_front.c ============================================================================== --- user/attilio/vmcontention/sys/xen/xenbus/xenbusb_front.c Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/sys/xen/xenbus/xenbusb_front.c Thu Sep 22 12:53:27 2011 (r225729) @@ -171,7 +171,7 @@ static device_method_t xenbusb_front_met DEVMETHOD(device_detach, bus_generic_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_resume, xenbusb_resume), /* Bus Interface */ DEVMETHOD(bus_print_child, xenbusb_print_child), Modified: user/attilio/vmcontention/sys/xen/xenstore/xenstore.c ============================================================================== --- user/attilio/vmcontention/sys/xen/xenstore/xenstore.c Thu Sep 22 11:07:11 2011 (r225728) +++ user/attilio/vmcontention/sys/xen/xenstore/xenstore.c Thu Sep 22 12:53:27 2011 (r225729) @@ -721,8 +721,8 @@ xs_reply_filter(uint32_t request_msg_typ /* * The count of transactions drops if we attempted * to end a transaction (even if that attempt fails - * in error), we receive a transaction end acknowledgement - * or if our attempt to begin a transactionfails. + * in error), we receive a transaction end acknowledgement, + * or if our attempt to begin a transaction fails. */ if (request_msg_type == XS_TRANSACTION_END || (request_reply_error == 0 && reply_msg_type == XS_TRANSACTION_END) @@ -1194,8 +1194,14 @@ xs_attach(device_t dev) * all transactions and individual requests have completed. */ static int -xs_suspend(device_t dev __unused) +xs_suspend(device_t dev) { + int error; + + /* Suspend child Xen devices. */ + error = bus_generic_suspend(dev); + if (error != 0) + return (error); sx_xlock(&xs.suspend_mutex); sx_xlock(&xs.request_mutex); @@ -1227,6 +1233,9 @@ xs_resume(device_t dev __unused) sx_xunlock(&xs.suspend_mutex); + /* Resume child Xen devices. */ + bus_generic_resume(dev); + return (0); } From owner-svn-src-user@FreeBSD.ORG Thu Sep 22 22:52:24 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CC9A106566B; Thu, 22 Sep 2011 22:52:24 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C6BA8FC13; Thu, 22 Sep 2011 22:52:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8MMqOS4042289; Thu, 22 Sep 2011 22:52:24 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8MMqOT5042283; Thu, 22 Sep 2011 22:52:24 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109222252.p8MMqOT5042283@svn.freebsd.org> From: Adrian Chadd Date: Thu, 22 Sep 2011 22:52:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225734 - in user/adrian/if_ath_tx/sys/dev/ath: . ath_hal ath_hal/ar5416 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 22:52:24 -0000 Author: adrian Date: Thu Sep 22 22:52:24 2011 New Revision: 225734 URL: http://svn.freebsd.org/changeset/base/225734 Log: Now that I've found the root cause missing TX interrupt issue, revert this previous commit. Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ah.h user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416.h user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ah.h ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ah.h Thu Sep 22 22:08:09 2011 (r225733) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ah.h Thu Sep 22 22:52:24 2011 (r225734) @@ -1001,7 +1001,7 @@ struct ath_hal { /* 802.11n Functions */ HAL_BOOL __ahdecl(*ah_chainTxDesc)(struct ath_hal *, - struct ath_desc *, u_int, u_int, u_int, + struct ath_desc *, u_int, u_int, HAL_PKT_TYPE, u_int, HAL_CIPHER, uint8_t, u_int, HAL_BOOL, HAL_BOOL); HAL_BOOL __ahdecl(*ah_setupFirstTxDesc)(struct ath_hal *, Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416.h Thu Sep 22 22:08:09 2011 (r225733) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416.h Thu Sep 22 22:52:24 2011 (r225734) @@ -330,7 +330,7 @@ extern int ar5416SetupTxQueue(struct ath const HAL_TXQ_INFO *qInfo); extern HAL_BOOL ar5416ChainTxDesc(struct ath_hal *ah, struct ath_desc *ds, - u_int flags, u_int pktLen, u_int hdrLen, HAL_PKT_TYPE type, u_int keyIx, + u_int pktLen, u_int hdrLen, HAL_PKT_TYPE type, u_int keyIx, HAL_CIPHER cipher, uint8_t delims, u_int segLen, HAL_BOOL firstSeg, HAL_BOOL lastSeg); extern HAL_BOOL ar5416SetupFirstTxDesc(struct ath_hal *ah, struct ath_desc *ds, Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Thu Sep 22 22:08:09 2011 (r225733) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c Thu Sep 22 22:52:24 2011 (r225734) @@ -338,7 +338,6 @@ ar5416FillTxDesc(struct ath_hal *ah, str */ HAL_BOOL ar5416ChainTxDesc(struct ath_hal *ah, struct ath_desc *ds, - u_int flags, u_int pktLen, u_int hdrLen, HAL_PKT_TYPE type, @@ -380,7 +379,7 @@ ar5416ChainTxDesc(struct ath_hal *ah, st /* * Note: VEOL should only be for the last descriptor in the chain. */ - ads->ds_ctl0 = 0; /* XXX TODO: optimise uncached descriptor writes */ + ads->ds_ctl0 = (pktLen & AR_FrameLen); ads->ds_ctl1 = (type << AR_FrameType_S) | (isaggr ? (AR_IsAggr | AR_MoreAggr) : 0); ads->ds_ctl2 = 0; @@ -397,24 +396,15 @@ ar5416ChainTxDesc(struct ath_hal *ah, st } if (firstSeg) { - ads->ds_ctl0 |= (pktLen & AR_FrameLen) - | (flags & HAL_TXDESC_CLRDMASK ? AR_ClrDestMask : 0) - | (flags & HAL_TXDESC_INTREQ ? AR_TxIntrReq : 0) - ; ads->ds_ctl1 |= segLen | (lastSeg ? 0 : AR_TxMore); } else if (lastSeg) { /* !firstSeg && lastSeg */ - ads->ds_ctl0 = 0 - | (flags & HAL_TXDESC_VEOL ? AR_VEOL : 0) - | (flags & HAL_TXDESC_INTREQ ? AR_TxIntrReq : 0) - ; + ads->ds_ctl0 = 0; ads->ds_ctl1 |= segLen; } else { /* !firstSeg && !lastSeg */ /* * Intermediate descriptor in a multi-descriptor frame. */ - ads->ds_ctl0 = 0 - | (flags & HAL_TXDESC_INTREQ ? AR_TxIntrReq : 0) - ; + ads->ds_ctl0 = 0; ads->ds_ctl1 |= segLen | AR_TxMore; } ds_txstatus[0] = ds_txstatus[1] = 0; Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Thu Sep 22 22:08:09 2011 (r225733) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Thu Sep 22 22:52:24 2011 (r225734) @@ -355,7 +355,6 @@ ath_tx_chaindesclist_subframe(struct ath * This includes enabling the aggregate flags if needed. */ ath_hal_chaintxdesc(ah, ds, - bf->bf_state.bfs_flags | HAL_TXDESC_INTREQ, bf->bf_state.bfs_pktlen, bf->bf_state.bfs_hdrlen, HAL_PKT_TYPE_AMPDU, /* forces aggregate bits to be set */ Modified: user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Thu Sep 22 22:08:09 2011 (r225733) +++ user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Thu Sep 22 22:52:24 2011 (r225734) @@ -847,9 +847,9 @@ void ath_intr(void *); _txr0, _txtr0, _antm, _rcr, _rcd) \ ((*(_ah)->ah_setupFirstTxDesc)((_ah), (_ds), (_aggrlen), (_flags), \ (_txpower), (_txr0), (_txtr0), (_antm), (_rcr), (_rcd))) -#define ath_hal_chaintxdesc(_ah, _ds, _flags, _pktlen, _hdrlen, _type, _keyix, \ +#define ath_hal_chaintxdesc(_ah, _ds, _pktlen, _hdrlen, _type, _keyix, \ _cipher, _delims, _seglen, _first, _last) \ - ((*(_ah)->ah_chainTxDesc)((_ah), (_ds), (_flags), (_pktlen), (_hdrlen), \ + ((*(_ah)->ah_chainTxDesc)((_ah), (_ds), (_pktlen), (_hdrlen), \ (_type), (_keyix), (_cipher), (_delims), (_seglen), \ (_first), (_last))) #define ath_hal_setuplasttxdesc(_ah, _ds, _ds0) \ From owner-svn-src-user@FreeBSD.ORG Fri Sep 23 13:53:29 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B2BC106566C; Fri, 23 Sep 2011 13:53:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4236F8FC0C; Fri, 23 Sep 2011 13:53:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8NDrT3H074666; Fri, 23 Sep 2011 13:53:29 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8NDrTVF074664; Fri, 23 Sep 2011 13:53:29 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109231353.p8NDrTVF074664@svn.freebsd.org> From: Adrian Chadd Date: Fri, 23 Sep 2011 13:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225740 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2011 13:53:29 -0000 Author: adrian Date: Fri Sep 23 13:53:28 2011 New Revision: 225740 URL: http://svn.freebsd.org/changeset/base/225740 Log: Re-introduce the FIFO packet scheduling code. This makes TX packet scheduling slightly fairer in hostap mode where multiple nodes and multiple TIDs may be actively TX'ing. Obtained from: Linux ath9k, Atheros Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Fri Sep 23 05:35:24 2011 (r225739) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Fri Sep 23 13:53:28 2011 (r225740) @@ -3486,11 +3486,15 @@ ath_tx_tid_hw_queue_norm(struct ath_soft * This function walks the list of TIDs (ie, ath_node TIDs * with queued traffic) and attempts to schedule traffic * from them. + * + * TID scheduling is implemented as a FIFO, with TIDs being + * added to the end of the queue after some frames have been + * scheduled. */ void ath_txq_sched(struct ath_softc *sc, struct ath_txq *txq) { - struct ath_tid *tid, *next; + struct ath_tid *tid, *next, *last; ATH_TXQ_LOCK_ASSERT(txq); @@ -3504,11 +3508,8 @@ ath_txq_sched(struct ath_softc *sc, stru return; } - /* - * For now, let's not worry about QoS, fair-scheduling - * or the like. That's a later problem. Just throw - * packets at the hardware. - */ + last = TAILQ_LAST(&txq->axq_tidq, axq_t_s); + TAILQ_FOREACH_SAFE(tid, &txq->axq_tidq, axq_qelem, next) { /* * Suspend paused queues here; they'll be resumed @@ -3516,8 +3517,8 @@ ath_txq_sched(struct ath_softc *sc, stru */ DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: tid=%d, paused=%d\n", __func__, tid->tid, tid->paused); + ath_tx_tid_unsched(sc, tid); if (tid->paused) { - ath_tx_tid_unsched(sc, tid); continue; } if (ath_tx_ampdu_running(sc, tid->an, tid->tid)) @@ -3525,14 +3526,22 @@ ath_txq_sched(struct ath_softc *sc, stru else ath_tx_tid_hw_queue_norm(sc, tid->an, tid); - /* Empty? Remove */ - if (tid->axq_depth == 0) - ath_tx_tid_unsched(sc, tid); + /* Not empty? Re-schedule */ + if (tid->axq_depth != 0) + ath_tx_tid_sched(sc, tid); /* Give the software queue time to aggregate more packets */ if (txq->axq_aggr_depth >= sc->sc_hwq_limit) { break; } + + /* + * If this was the last entry on the original list, stop. + * Otherwise nodes that have been rescheduled onto the end + * of the TID FIFO list will just keep being rescheduled. + */ + if (tid == last) + break; } } From owner-svn-src-user@FreeBSD.ORG Fri Sep 23 14:55:27 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 334DE106564A; Fri, 23 Sep 2011 14:55:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23B2A8FC0A; Fri, 23 Sep 2011 14:55:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8NEtRLc076618; Fri, 23 Sep 2011 14:55:27 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8NEtR5R076616; Fri, 23 Sep 2011 14:55:27 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109231455.p8NEtR5R076616@svn.freebsd.org> From: Adrian Chadd Date: Fri, 23 Sep 2011 14:55:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225741 - user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2011 14:55:27 -0000 Author: adrian Date: Fri Sep 23 14:55:26 2011 New Revision: 225741 URL: http://svn.freebsd.org/changeset/base/225741 Log: Revert these values; the ath9k values work better. Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Fri Sep 23 13:53:28 2011 (r225740) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Fri Sep 23 14:55:26 2011 (r225741) @@ -361,9 +361,8 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO OS_REG_WRITE(ah, AR_MIRT, 0); #ifdef AH_AR5416_INTERRUPT_MITIGATION - - OS_REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, 250); - OS_REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, 700); + OS_REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, 500); + OS_REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, 2000); OS_REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_LAST, 300); OS_REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_FIRST, 750); #endif From owner-svn-src-user@FreeBSD.ORG Fri Sep 23 15:32:03 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE1B7106564A; Fri, 23 Sep 2011 15:32:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A42848FC0C; Fri, 23 Sep 2011 15:32:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8NFW3Nr077782; Fri, 23 Sep 2011 15:32:03 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8NFW3MY077780; Fri, 23 Sep 2011 15:32:03 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109231532.p8NFW3MY077780@svn.freebsd.org> From: Adrian Chadd Date: Fri, 23 Sep 2011 15:32:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225742 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2011 15:32:03 -0000 Author: adrian Date: Fri Sep 23 15:32:03 2011 New Revision: 225742 URL: http://svn.freebsd.org/changeset/base/225742 Log: Use fast taskqueues here. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Fri Sep 23 14:55:26 2011 (r225741) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Fri Sep 23 15:32:03 2011 (r225742) @@ -372,7 +372,7 @@ ath_attach(u_int16_t devid, struct ath_s ATH_TXBUF_LOCK_INIT(sc); - sc->sc_tq = taskqueue_create("ath_taskq", M_NOWAIT, + sc->sc_tq = taskqueue_create_fast("ath_taskq", M_NOWAIT, taskqueue_thread_enqueue, &sc->sc_tq); taskqueue_start_threads(&sc->sc_tq, 1, PI_NET, "%s taskq", ifp->if_xname); @@ -1405,7 +1405,7 @@ ath_intr(void *arg) * traffic so any frames held on the staging * queue are aged and potentially flushed. */ - taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask); + taskqueue_enqueue_fast(sc->sc_tq, &sc->sc_rxtask); #endif } } @@ -1433,7 +1433,7 @@ ath_intr(void *arg) * is in the RX queue. * This will then kick the PCU. */ - taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask); + taskqueue_enqueue_fast(sc->sc_tq, &sc->sc_rxtask); sc->sc_rxlink = NULL; sc->sc_kickpcu = 1; } @@ -1444,15 +1444,15 @@ ath_intr(void *arg) } if (status & HAL_INT_RX) { sc->sc_stats.ast_rx_intr++; - taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask); + taskqueue_enqueue_fast(sc->sc_tq, &sc->sc_rxtask); } if (status & HAL_INT_TX) { sc->sc_stats.ast_tx_intr++; - taskqueue_enqueue(sc->sc_tq, &sc->sc_txtask); + taskqueue_enqueue_fast(sc->sc_tq, &sc->sc_txtask); } if (status & HAL_INT_BMISS) { sc->sc_stats.ast_bmiss++; - taskqueue_enqueue(sc->sc_tq, &sc->sc_bmisstask); + taskqueue_enqueue_fast(sc->sc_tq, &sc->sc_bmisstask); } if (status & HAL_INT_GTT) sc->sc_stats.ast_tx_timeout++; @@ -2579,7 +2579,7 @@ ath_beacon_proc(void *arg, int pending) "%s: missed %u consecutive beacons\n", __func__, sc->sc_bmisscount); if (sc->sc_bmisscount >= ath_bstuck_threshold) - taskqueue_enqueue(sc->sc_tq, &sc->sc_bstucktask); + taskqueue_enqueue_fast(sc->sc_tq, &sc->sc_bstucktask); return; } if (sc->sc_bmisscount != 0) { @@ -3719,6 +3719,7 @@ ath_rx_proc(void *arg, int npending) * If the datalen is greater than the buffer itself, * it's a corrupted status descriptor; skip. * Yes, it may actually have data in it. + * XXX this may not actually be needed. */ if (rs->rs_datalen > m->m_len) { device_printf(sc->sc_dev, @@ -4029,7 +4030,7 @@ rx_next: /* Queue DFS tasklet if needed */ if (ath_dfs_tasklet_needed(sc, sc->sc_curchan)) - taskqueue_enqueue(sc->sc_tq, &sc->sc_dfstask); + taskqueue_enqueue_fast(sc->sc_tq, &sc->sc_dfstask); /* * Now that all the RX frames were handled that @@ -6166,7 +6167,7 @@ ath_tdma_beacon_send(struct ath_softc *s "%s: missed %u consecutive beacons\n", __func__, sc->sc_bmisscount); if (sc->sc_bmisscount >= ath_bstuck_threshold) - taskqueue_enqueue(sc->sc_tq, &sc->sc_bstucktask); + taskqueue_enqueue_fast(sc->sc_tq, &sc->sc_bstucktask); return; } if (sc->sc_bmisscount != 0) { From owner-svn-src-user@FreeBSD.ORG Fri Sep 23 15:36:53 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23FE7106566B; Fri, 23 Sep 2011 15:36:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 148008FC14; Fri, 23 Sep 2011 15:36:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8NFaqc7077967; Fri, 23 Sep 2011 15:36:52 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8NFaq9A077964; Fri, 23 Sep 2011 15:36:52 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109231536.p8NFaq9A077964@svn.freebsd.org> From: Adrian Chadd Date: Fri, 23 Sep 2011 15:36:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225743 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2011 15:36:53 -0000 Author: adrian Date: Fri Sep 23 15:36:52 2011 New Revision: 225743 URL: http://svn.freebsd.org/changeset/base/225743 Log: For now, break out the beacon processing task into a separate task so it doesn't interrupt TX or RX completion. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Fri Sep 23 15:32:03 2011 (r225742) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Fri Sep 23 15:36:52 2011 (r225743) @@ -380,6 +380,7 @@ ath_attach(u_int16_t devid, struct ath_s TASK_INIT(&sc->sc_rxtask, 0, ath_rx_proc, sc); TASK_INIT(&sc->sc_bmisstask, 0, ath_bmiss_proc, sc); TASK_INIT(&sc->sc_bstucktask,0, ath_bstuck_proc, sc); + TASK_INIT(&sc->sc_bproctask, 0, ath_beacon_proc, sc); /* * Allocate hardware transmit queues: one queue for @@ -1398,7 +1399,7 @@ ath_intr(void *arg) } else #endif { - ath_beacon_proc(sc, 0); + taskqueue_enqueue_fast(sc->sc_tq, &sc->sc_bproctask); #ifdef IEEE80211_SUPPORT_SUPERG /* * Schedule the rx taskq in case there's no Modified: user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Fri Sep 23 15:32:03 2011 (r225742) +++ user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Fri Sep 23 15:36:52 2011 (r225743) @@ -461,6 +461,7 @@ struct ath_softc { struct ath_txq *sc_cabq; /* tx q for cab frames */ struct task sc_bmisstask; /* bmiss int processing */ struct task sc_bstucktask; /* stuck beacon processing */ + struct task sc_bproctask; /* beacon processing */ enum { OK, /* no change needed */ UPDATE, /* update pending */ From owner-svn-src-user@FreeBSD.ORG Fri Sep 23 21:01:45 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29AA7106566C; Fri, 23 Sep 2011 21:01:45 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1981F8FC12; Fri, 23 Sep 2011 21:01:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8NL1iIm087971; Fri, 23 Sep 2011 21:01:44 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8NL1i9w087969; Fri, 23 Sep 2011 21:01:44 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201109232101.p8NL1i9w087969@svn.freebsd.org> From: Gabor Kovesdan Date: Fri, 23 Sep 2011 21:01:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225745 - user/gabor/tre-integration/lib/libc/regex X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2011 21:01:45 -0000 Author: gabor Date: Fri Sep 23 21:01:44 2011 New Revision: 225745 URL: http://svn.freebsd.org/changeset/base/225745 Log: - Minor improvements to the manual Modified: user/gabor/tre-integration/lib/libc/regex/regex.3 Modified: user/gabor/tre-integration/lib/libc/regex/regex.3 ============================================================================== --- user/gabor/tre-integration/lib/libc/regex/regex.3 Fri Sep 23 16:37:28 2011 (r225744) +++ user/gabor/tre-integration/lib/libc/regex/regex.3 Fri Sep 23 21:01:44 2011 (r225745) @@ -33,7 +33,7 @@ .\" @(#)regex.3 8.4 (Berkeley) 3/20/94 .\" $FreeBSD$ .\" -.Dd September 17, 2011 +.Dd September 24, 2011 .Dt REGEX 3 .Os .Sh NAME @@ -106,7 +106,7 @@ manual can be consulted for their syntax The .Fn regcomp function -compiles a regular expression written as a string into an internal form. +compiles a regular expression from a string into an internal form. The .Fn regncomp function works in the very same way, @@ -121,7 +121,8 @@ the wide string form. .Pp The .Fn regexec -function matches that internal form against a string and reports results. +function matches the compiled regular expression against a string +and reports results. The .Fn regnexec function works in the same way but takes another argument to specify @@ -185,6 +186,12 @@ Compile extended regular expressions rather than the obsolete basic regular expressions .Pq Dq BREs that are the default. +It may not be used together with +.Dv REG_NOSPEC +or +.Dv REG_LITERAL +in the same call to +.Fn regcomp . .It Dv REG_BASIC This is a synonym for 0, provided as a counterpart to @@ -197,18 +204,11 @@ so the reqular expression is a literal s .It Dv REG_LITERAL Synonym for .Dv REG_NOSPEC. -.It Dv REG_EXTENDED -may not be used together with -.Dv REG_NOSPEC -or -.Dv REG_LITERAL -in the same call to -.Fn regcomp . .It Dv REG_ICASE -Compile for matching that ignores upper/lower case distinctions. +Compile for case insensitive matching. .It Dv REG_NOSUB -Compile for matching that need only report success or failure, -not what was matched. +Compile for only reporting match or mismatch´with no regard to +the matching offset. .It Dv REG_NEWLINE Compile for newline-sensitive matching. By default, newline is a completely ordinary character with no special @@ -282,7 +282,7 @@ against the when using the variants that take the input length), subject to the flags in .Fa eflags -and reports whether the input matches through its return value. +and reports through its return value whether the input matches. The .Fa pmatch argument is also filled in to hold submatches unless the pattern was @@ -302,7 +302,8 @@ multiple threads, and it can be used with any variant of the .Fn regexec functions. -(I.e. a multi-byte pattern can be matched to wide string input and +(That is, +a multi-byte pattern can be matched to wide string input and vice versa.) .Pp The @@ -318,7 +319,7 @@ anchor should not match before it. This does not affect the behavior of newlines under .Dv REG_NEWLINE . .It Dv REG_NOTEOL -The NUL terminating +The NUL character terminating the string does not end a line, so the .Ql $\& @@ -330,11 +331,11 @@ The string is considered to start at .Fa string + .Fa pmatch Ns [0]. Ns Va rm_so -and to have a terminating NUL located at +and to have a terminating NUL character located at .Fa string + .Fa pmatch Ns [0]. Ns Va rm_eo -(there need not actually be a NUL at that location), +(there need not actually be a NUL character at that location), regardless of the value of .Fa nmatch . See below for the definition of @@ -348,7 +349,7 @@ does not imply .Dv REG_STARTEND affects only the location of the string, not how it is matched. -.Pp +.El The function indicates a match by returning .Dv REG_OK , no match with @@ -362,7 +363,7 @@ for a detailed description of error code .Pp If .Dv REG_NOSUB -was specified in the compilation of the RE, +was specified in the compilation of the regular expression, or if .Fa nmatch is 0, @@ -401,7 +402,7 @@ The 0th member of the .Fa pmatch array is filled in to indicate what substring of .Fa string -was matched by the entire RE. +was matched by the entire regular expression. Remaining members report what substring was matched by parenthesized subexpressions within the regular expression; member @@ -484,11 +485,11 @@ it should have been the result from the .Fn regcomp using that .Ft regex_t . -The -.Fn ( regerror -may be able to supply a more detailed message using information +(The +.Fn regerror +function may be able to supply a more detailed message using information from the -.Ft regex_t . ) +.Ft regex_t .) The .Fn regerror function @@ -523,9 +524,7 @@ or .Fn regerror is undefined. .Pp -None of these functions references global variables except for tables -of constants; -thus all of them are thread-safe. +All of the functions described above are thread-safe. .Sh RETURN VALUES Non-zero error codes from the .Fn regcomp From owner-svn-src-user@FreeBSD.ORG Sat Sep 24 07:33:30 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB52D106564A; Sat, 24 Sep 2011 07:33:30 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 48CA28FC08; Sat, 24 Sep 2011 07:33:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8O7XUwO007405; Sat, 24 Sep 2011 07:33:30 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8O7XU21007403; Sat, 24 Sep 2011 07:33:30 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109240733.p8O7XU21007403@svn.freebsd.org> From: Adrian Chadd Date: Sat, 24 Sep 2011 07:33:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225746 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Sep 2011 07:33:30 -0000 Author: adrian Date: Sat Sep 24 07:33:29 2011 New Revision: 225746 URL: http://svn.freebsd.org/changeset/base/225746 Log: Change how RXEOL/RXORN is handled. * If the condition is hit on chips where it isn't fatal, don't restart the PCU by stopping/starting; this introduces quite long pauses and it doesn't look like it's needed (at least for AR9160 hostap.) * Add some debugging to see what's going on. It turns out that I either see a full RX queue (512 packets) or an empty RX queue (0); I'll have to do some further poking to see why that is. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Fri Sep 23 21:01:44 2011 (r225745) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Sat Sep 24 07:33:29 2011 (r225746) @@ -3656,6 +3656,7 @@ ath_rx_proc(void *arg, int npending) HAL_STATUS status; int16_t nf; u_int64_t tsf; + int npkts = 0; DPRINTF(sc, ATH_DEBUG_RX_PROC, "%s: pending %u\n", __func__, npending); ngood = 0; @@ -3715,6 +3716,7 @@ ath_rx_proc(void *arg, int npending) break; TAILQ_REMOVE(&sc->sc_rxbuf, bf, bf_list); + npkts++; /* * If the datalen is greater than the buffer itself, @@ -4045,6 +4047,9 @@ rx_next: * XXX is it really needed? Or is it just enough to * XXX kick the PCU again to continue RXing? */ + device_printf(sc->sc_dev, "%s: kickpcu; handled %d packets\n", + __func__, npkts); +#if 0 ath_stoprecv(sc); sc->sc_imask |= (HAL_INT_RXEOL | HAL_INT_RXORN); if (ath_startrecv(sc) != 0) { @@ -4054,6 +4059,15 @@ rx_next: ath_reset(ifp); return; } +#endif + + /* XXX rxslink? */ + bf = TAILQ_FIRST(&sc->sc_rxbuf); + ath_hal_putrxbuf(ah, bf->bf_daddr); + ath_hal_rxena(ah); /* enable recv descriptors */ + ath_mode_init(sc); /* set filters, etc. */ + ath_hal_startpcurecv(ah); /* re-enable PCU/DMA engine */ + ath_hal_intrset(ah, sc->sc_imask); }