Deleted Added
full compact
sfxge_ev.c (301075) sfxge_ev.c (301105)
1/*-
2 * Copyright (c) 2010-2016 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

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

27 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * The views and conclusions contained in the software and documentation are
30 * those of the authors and should not be interpreted as representing official
31 * policies, either expressed or implied, of the FreeBSD Project.
32 */
33
34#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2010-2016 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

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

27 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * The views and conclusions contained in the software and documentation are
30 * those of the authors and should not be interpreted as representing official
31 * policies, either expressed or implied, of the FreeBSD Project.
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/dev/sfxge/sfxge_ev.c 301075 2016-05-31 20:54:42Z arybchik $");
35__FBSDID("$FreeBSD: head/sys/dev/sfxge/sfxge_ev.c 301105 2016-06-01 06:51:19Z arybchik $");
36
37#include <sys/param.h>
38#include <sys/kernel.h>
39#include <sys/malloc.h>
40#include <sys/param.h>
41#include <sys/queue.h>
42#include <sys/systm.h>
43#include <sys/taskqueue.h>

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

202
203static boolean_t
204sfxge_ev_rxq_flush_done(void *arg, uint32_t rxq_index)
205{
206 struct sfxge_evq *evq;
207 struct sfxge_softc *sc;
208 struct sfxge_rxq *rxq;
209 unsigned int index;
36
37#include <sys/param.h>
38#include <sys/kernel.h>
39#include <sys/malloc.h>
40#include <sys/param.h>
41#include <sys/queue.h>
42#include <sys/systm.h>
43#include <sys/taskqueue.h>

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

202
203static boolean_t
204sfxge_ev_rxq_flush_done(void *arg, uint32_t rxq_index)
205{
206 struct sfxge_evq *evq;
207 struct sfxge_softc *sc;
208 struct sfxge_rxq *rxq;
209 unsigned int index;
210 unsigned int label;
211 uint16_t magic;
212
213 evq = (struct sfxge_evq *)arg;
214 SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
215
216 sc = evq->sc;
217 rxq = sc->rxq[rxq_index];
218
219 KASSERT(rxq != NULL, ("rxq == NULL"));
220
221 /* Resend a software event on the correct queue */
222 index = rxq->index;
223 if (index == evq->index) {
224 sfxge_rx_qflush_done(rxq);
225 return (B_FALSE);
226 }
227
228 evq = sc->evq[index];
210 uint16_t magic;
211
212 evq = (struct sfxge_evq *)arg;
213 SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
214
215 sc = evq->sc;
216 rxq = sc->rxq[rxq_index];
217
218 KASSERT(rxq != NULL, ("rxq == NULL"));
219
220 /* Resend a software event on the correct queue */
221 index = rxq->index;
222 if (index == evq->index) {
223 sfxge_rx_qflush_done(rxq);
224 return (B_FALSE);
225 }
226
227 evq = sc->evq[index];
228 magic = sfxge_sw_ev_rxq_magic(SFXGE_SW_EV_RX_QFLUSH_DONE, rxq);
229
229
230 label = 0;
231 KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label,
232 ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != level"));
233 magic = SFXGE_SW_EV_MAGIC(SFXGE_SW_EV_RX_QFLUSH_DONE) | label;
234
235 KASSERT(evq->init_state == SFXGE_EVQ_STARTED,
236 ("evq not started"));
237 efx_ev_qpost(evq->common, magic);
238
239 return (B_FALSE);
240}
241
242static boolean_t
243sfxge_ev_rxq_flush_failed(void *arg, uint32_t rxq_index)
244{
245 struct sfxge_evq *evq;
246 struct sfxge_softc *sc;
247 struct sfxge_rxq *rxq;
248 unsigned int index;
230 KASSERT(evq->init_state == SFXGE_EVQ_STARTED,
231 ("evq not started"));
232 efx_ev_qpost(evq->common, magic);
233
234 return (B_FALSE);
235}
236
237static boolean_t
238sfxge_ev_rxq_flush_failed(void *arg, uint32_t rxq_index)
239{
240 struct sfxge_evq *evq;
241 struct sfxge_softc *sc;
242 struct sfxge_rxq *rxq;
243 unsigned int index;
249 unsigned int label;
250 uint16_t magic;
251
252 evq = (struct sfxge_evq *)arg;
253 SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
254
255 sc = evq->sc;
256 rxq = sc->rxq[rxq_index];
257
258 KASSERT(rxq != NULL, ("rxq == NULL"));
259
260 /* Resend a software event on the correct queue */
261 index = rxq->index;
262 evq = sc->evq[index];
244 uint16_t magic;
245
246 evq = (struct sfxge_evq *)arg;
247 SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
248
249 sc = evq->sc;
250 rxq = sc->rxq[rxq_index];
251
252 KASSERT(rxq != NULL, ("rxq == NULL"));
253
254 /* Resend a software event on the correct queue */
255 index = rxq->index;
256 evq = sc->evq[index];
257 magic = sfxge_sw_ev_rxq_magic(SFXGE_SW_EV_RX_QFLUSH_FAILED, rxq);
263
258
264 label = 0;
265 KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label,
266 ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != label"));
267 magic = SFXGE_SW_EV_MAGIC(SFXGE_SW_EV_RX_QFLUSH_FAILED) | label;
268
269 KASSERT(evq->init_state == SFXGE_EVQ_STARTED,
270 ("evq not started"));
271 efx_ev_qpost(evq->common, magic);
272
273 return (B_FALSE);
274}
275
276static struct sfxge_txq *

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

326}
327
328static boolean_t
329sfxge_ev_txq_flush_done(void *arg, uint32_t txq_index)
330{
331 struct sfxge_evq *evq;
332 struct sfxge_softc *sc;
333 struct sfxge_txq *txq;
259 KASSERT(evq->init_state == SFXGE_EVQ_STARTED,
260 ("evq not started"));
261 efx_ev_qpost(evq->common, magic);
262
263 return (B_FALSE);
264}
265
266static struct sfxge_txq *

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

316}
317
318static boolean_t
319sfxge_ev_txq_flush_done(void *arg, uint32_t txq_index)
320{
321 struct sfxge_evq *evq;
322 struct sfxge_softc *sc;
323 struct sfxge_txq *txq;
334 unsigned int label;
335 uint16_t magic;
336
337 evq = (struct sfxge_evq *)arg;
338 SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
339
340 sc = evq->sc;
341 txq = sc->txq[txq_index];
342
343 KASSERT(txq != NULL, ("txq == NULL"));
344 KASSERT(txq->init_state == SFXGE_TXQ_INITIALIZED,
345 ("txq not initialized"));
346
347 if (txq->evq_index == evq->index) {
348 sfxge_tx_qflush_done(txq);
349 return (B_FALSE);
350 }
351
352 /* Resend a software event on the correct queue */
353 evq = sc->evq[txq->evq_index];
324 uint16_t magic;
325
326 evq = (struct sfxge_evq *)arg;
327 SFXGE_EVQ_LOCK_ASSERT_OWNED(evq);
328
329 sc = evq->sc;
330 txq = sc->txq[txq_index];
331
332 KASSERT(txq != NULL, ("txq == NULL"));
333 KASSERT(txq->init_state == SFXGE_TXQ_INITIALIZED,
334 ("txq not initialized"));
335
336 if (txq->evq_index == evq->index) {
337 sfxge_tx_qflush_done(txq);
338 return (B_FALSE);
339 }
340
341 /* Resend a software event on the correct queue */
342 evq = sc->evq[txq->evq_index];
343 magic = sfxge_sw_ev_txq_magic(SFXGE_SW_EV_TX_QFLUSH_DONE, txq);
354
344
355 label = txq->type;
356 KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label,
357 ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != label"));
358 magic = SFXGE_SW_EV_MAGIC(SFXGE_SW_EV_TX_QFLUSH_DONE) | label;
359
360 KASSERT(evq->init_state == SFXGE_EVQ_STARTED,
361 ("evq not started"));
362 efx_ev_qpost(evq->common, magic);
363
364 return (B_FALSE);
365}
366
367static boolean_t

--- 594 unchanged lines hidden ---
345 KASSERT(evq->init_state == SFXGE_EVQ_STARTED,
346 ("evq not started"));
347 efx_ev_qpost(evq->common, magic);
348
349 return (B_FALSE);
350}
351
352static boolean_t

--- 594 unchanged lines hidden ---