diff options
author | bz <bz@FreeBSD.org> | 2009-06-14 17:15:18 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2009-06-14 17:15:18 +0000 |
commit | 56983733aae4f7a2c06cbf59c81da67cde90790f (patch) | |
tree | 2692a18160e587aed5bdcbd2d8eac925ca8d7076 /sys/net/netisr.c | |
parent | ced07ef3b3639a83761cd0e5bb0df9418adc1d4d (diff) | |
download | FreeBSD-src-56983733aae4f7a2c06cbf59c81da67cde90790f.zip FreeBSD-src-56983733aae4f7a2c06cbf59c81da67cde90790f.tar.gz |
Add an optional callback function that will be invoked when a per-CPU
queue was drained. It will never fire for a directly dispatched packet.
You will most likely never want to use this for any ordinary netisr usage
and you will never blame netisr in case you try to use it and it does
not work as expected.
Reviewed by: rwatson
Diffstat (limited to 'sys/net/netisr.c')
-rw-r--r-- | sys/net/netisr.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/net/netisr.c b/sys/net/netisr.c index da5dac4..5dc4c90 100644 --- a/sys/net/netisr.c +++ b/sys/net/netisr.c @@ -197,6 +197,7 @@ struct netisr_proto { netisr_handler_t *np_handler; /* Protocol handler. */ netisr_m2flow_t *np_m2flow; /* Query flow for untagged packet. */ netisr_m2cpuid_t *np_m2cpuid; /* Query CPU to process packet on. */ + netisr_drainedcpu_t *np_drainedcpu; /* Callback when drained a queue. */ u_int np_qlimit; /* Maximum per-CPU queue depth. */ u_int np_policy; /* Work placement policy. */ }; @@ -380,6 +381,7 @@ netisr_register(const struct netisr_handler *nhp) np[proto].np_handler = nhp->nh_handler; np[proto].np_m2flow = nhp->nh_m2flow; np[proto].np_m2cpuid = nhp->nh_m2cpuid; + np[proto].np_drainedcpu = nhp->nh_drainedcpu; if (nhp->nh_qlimit == 0) np[proto].np_qlimit = netisr_defaultqlimit; else if (nhp->nh_qlimit > netisr_maxqlimit) { @@ -705,6 +707,8 @@ netisr_process_workstream_proto(struct netisr_workstream *nwsp, u_int proto) } KASSERT(local_npw.nw_len == 0, ("%s(%u): len %u", __func__, proto, local_npw.nw_len)); + if (np[proto].np_drainedcpu) + np[proto].np_drainedcpu(nwsp->nws_cpu); NWS_LOCK(nwsp); npwp->nw_handled += handled; return (handled); |