iflib: Improve return values of interrupt handlers.

iflib was returning FILTER_HANDLED, in cases where FILTER_STRAY was more
correct. This potentially caused issues with shared legacy interrupts.

Driver filters returning FILTER_STRAY are now properly handled.

Submitted by:	Augustin Cavalier <waddlesplash@gmail.com>
Reviewed by:	marius, gallatin
Obtained from:	Haiku (a84bb9, 4947d1)
MFC after:	1 week
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D19201
This commit is contained in:
Stephen Hurd 2019-02-15 18:51:43 +00:00
parent e49f2c66d1
commit ca62461bc6

View File

@ -1468,12 +1468,17 @@ iflib_fast_intr(void *arg)
{ {
iflib_filter_info_t info = arg; iflib_filter_info_t info = arg;
struct grouptask *gtask = info->ifi_task; struct grouptask *gtask = info->ifi_task;
int result;
if (!iflib_started) if (!iflib_started)
return (FILTER_HANDLED); return (FILTER_STRAY);
DBG_COUNTER_INC(fast_intrs); DBG_COUNTER_INC(fast_intrs);
if (info->ifi_filter != NULL && info->ifi_filter(info->ifi_filter_arg) == FILTER_HANDLED) if (info->ifi_filter != NULL) {
return (FILTER_HANDLED); result = info->ifi_filter(info->ifi_filter_arg);
if ((result & FILTER_SCHEDULE_THREAD) == 0)
return (result);
}
GROUPTASK_ENQUEUE(gtask); GROUPTASK_ENQUEUE(gtask);
return (FILTER_HANDLED); return (FILTER_HANDLED);
@ -1488,15 +1493,18 @@ iflib_fast_intr_rxtx(void *arg)
iflib_rxq_t rxq = (iflib_rxq_t)info->ifi_ctx; iflib_rxq_t rxq = (iflib_rxq_t)info->ifi_ctx;
iflib_txq_t txq; iflib_txq_t txq;
void *sc; void *sc;
int i, cidx; int i, cidx, result;
qidx_t txqid; qidx_t txqid;
if (!iflib_started) if (!iflib_started)
return (FILTER_HANDLED); return (FILTER_STRAY);
DBG_COUNTER_INC(fast_intrs); DBG_COUNTER_INC(fast_intrs);
if (info->ifi_filter != NULL && info->ifi_filter(info->ifi_filter_arg) == FILTER_HANDLED) if (info->ifi_filter != NULL) {
return (FILTER_HANDLED); result = info->ifi_filter(info->ifi_filter_arg);
if ((result & FILTER_SCHEDULE_THREAD) == 0)
return (result);
}
ctx = rxq->ifr_ctx; ctx = rxq->ifr_ctx;
sc = ctx->ifc_softc; sc = ctx->ifc_softc;
@ -1531,13 +1539,17 @@ iflib_fast_intr_ctx(void *arg)
{ {
iflib_filter_info_t info = arg; iflib_filter_info_t info = arg;
struct grouptask *gtask = info->ifi_task; struct grouptask *gtask = info->ifi_task;
int result;
if (!iflib_started) if (!iflib_started)
return (FILTER_HANDLED); return (FILTER_STRAY);
DBG_COUNTER_INC(fast_intrs); DBG_COUNTER_INC(fast_intrs);
if (info->ifi_filter != NULL && info->ifi_filter(info->ifi_filter_arg) == FILTER_HANDLED) if (info->ifi_filter != NULL) {
return (FILTER_HANDLED); result = info->ifi_filter(info->ifi_filter_arg);
if ((result & FILTER_SCHEDULE_THREAD) == 0)
return (result);
}
GROUPTASK_ENQUEUE(gtask); GROUPTASK_ENQUEUE(gtask);
return (FILTER_HANDLED); return (FILTER_HANDLED);