Deleted Added
full compact
sfxge_ev.c (279182) sfxge_ev.c (279351)
1/*-
2 * Copyright (c) 2010-2011 Solarflare Communications, Inc.
3 * All rights reserved.
4 *
5 * This software was developed in part by Philip Paeps under contract for
6 * Solarflare Communications, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2010-2011 Solarflare Communications, Inc.
3 * All rights reserved.
4 *
5 * This software was developed in part by Philip Paeps under contract for
6 * Solarflare Communications, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/sfxge/sfxge_ev.c 279182 2015-02-22 19:13:52Z arybchik $");
31__FBSDID("$FreeBSD: head/sys/dev/sfxge/sfxge_ev.c 279351 2015-02-27 07:39:09Z arybchik $");
32
33#include <sys/param.h>
34#include <sys/kernel.h>
35#include <sys/malloc.h>
36#include <sys/param.h>
37#include <sys/queue.h>
38#include <sys/systm.h>
39#include <sys/taskqueue.h>

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

98 if (evq->exception)
99 goto done;
100
101 rxq = sc->rxq[label];
102 KASSERT(rxq != NULL, ("rxq == NULL"));
103 KASSERT(evq->index == rxq->index,
104 ("evq->index != rxq->index"));
105
32
33#include <sys/param.h>
34#include <sys/kernel.h>
35#include <sys/malloc.h>
36#include <sys/param.h>
37#include <sys/queue.h>
38#include <sys/systm.h>
39#include <sys/taskqueue.h>

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

98 if (evq->exception)
99 goto done;
100
101 rxq = sc->rxq[label];
102 KASSERT(rxq != NULL, ("rxq == NULL"));
103 KASSERT(evq->index == rxq->index,
104 ("evq->index != rxq->index"));
105
106 if (rxq->init_state != SFXGE_RXQ_STARTED)
106 if (__predict_false(rxq->init_state != SFXGE_RXQ_STARTED))
107 goto done;
108
109 expected = rxq->pending++ & rxq->ptr_mask;
110 if (id != expected) {
111 evq->exception = B_TRUE;
112
113 device_printf(sc->dev, "RX completion out of order"
114 " (id=%#x expected=%#x flags=%#x); resetting\n",

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

251 SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
252
253 txq = sfxge_get_txq_by_label(evq, label);
254
255 KASSERT(txq != NULL, ("txq == NULL"));
256 KASSERT(evq->index == txq->evq_index,
257 ("evq->index != txq->evq_index"));
258
107 goto done;
108
109 expected = rxq->pending++ & rxq->ptr_mask;
110 if (id != expected) {
111 evq->exception = B_TRUE;
112
113 device_printf(sc->dev, "RX completion out of order"
114 " (id=%#x expected=%#x flags=%#x); resetting\n",

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

251 SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
252
253 txq = sfxge_get_txq_by_label(evq, label);
254
255 KASSERT(txq != NULL, ("txq == NULL"));
256 KASSERT(evq->index == txq->evq_index,
257 ("evq->index != txq->evq_index"));
258
259 if (txq->init_state != SFXGE_TXQ_STARTED)
259 if (__predict_false(txq->init_state != SFXGE_TXQ_STARTED))
260 goto done;
261
262 stop = (id + 1) & txq->ptr_mask;
263 id = txq->pending & txq->ptr_mask;
264
265 delta = (stop >= id) ? (stop - id) : (txq->entries - id + stop);
266 txq->pending += delta;
267

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

428sfxge_ev_stat_update(struct sfxge_softc *sc)
429{
430 struct sfxge_evq *evq;
431 unsigned int index;
432 clock_t now;
433
434 SFXGE_ADAPTER_LOCK(sc);
435
260 goto done;
261
262 stop = (id + 1) & txq->ptr_mask;
263 id = txq->pending & txq->ptr_mask;
264
265 delta = (stop >= id) ? (stop - id) : (txq->entries - id + stop);
266 txq->pending += delta;
267

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

428sfxge_ev_stat_update(struct sfxge_softc *sc)
429{
430 struct sfxge_evq *evq;
431 unsigned int index;
432 clock_t now;
433
434 SFXGE_ADAPTER_LOCK(sc);
435
436 if (sc->evq[0]->init_state != SFXGE_EVQ_STARTED)
436 if (__predict_false(sc->evq[0]->init_state != SFXGE_EVQ_STARTED))
437 goto out;
438
439 now = ticks;
440 if (now - sc->ev_stats_update_time < hz)
441 goto out;
442
443 sc->ev_stats_update_time = now;
444

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

593
594int
595sfxge_ev_qpoll(struct sfxge_evq *evq)
596{
597 int rc;
598
599 SFXGE_EVQ_LOCK(evq);
600
437 goto out;
438
439 now = ticks;
440 if (now - sc->ev_stats_update_time < hz)
441 goto out;
442
443 sc->ev_stats_update_time = now;
444

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

593
594int
595sfxge_ev_qpoll(struct sfxge_evq *evq)
596{
597 int rc;
598
599 SFXGE_EVQ_LOCK(evq);
600
601 if (evq->init_state != SFXGE_EVQ_STARTING &&
602 evq->init_state != SFXGE_EVQ_STARTED) {
601 if (__predict_false(evq->init_state != SFXGE_EVQ_STARTING &&
602 evq->init_state != SFXGE_EVQ_STARTED)) {
603 rc = EINVAL;
604 goto fail;
605 }
606
607 /* Synchronize the DMA memory for reading */
608 bus_dmamap_sync(evq->mem.esm_tag, evq->mem.esm_map,
609 BUS_DMASYNC_POSTREAD);
610

--- 317 unchanged lines hidden ---
603 rc = EINVAL;
604 goto fail;
605 }
606
607 /* Synchronize the DMA memory for reading */
608 bus_dmamap_sync(evq->mem.esm_tag, evq->mem.esm_map,
609 BUS_DMASYNC_POSTREAD);
610

--- 317 unchanged lines hidden ---