tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Unify bpf_mtap & if_ipackets++ on Rx



Hi,

This is another proposal that unifies bpf_mtap and
if_ipackets++, which are executed in each driver now,
into the percpuq if_input framework.

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
  - How if_ipackets is counted up
  - Well, actually some drivers periodically update
    packet statistics though
- We can run bpf_mtap in softint
  - This makes it easy to MP-ify bpf

Here is a patch:
  http://www.netbsd.org/~ozaki-r/unify-bpf_mtap-if_ipackets.diff

The patch is almost mechanically generated by spatch.
Let me know if there are mistakes.


We can move most bpf_mtap into softint by the patch
but there remain some bpf_mtap that can run in
hardware interrupt context.

Two of them that are executed from Tx interrupt and can be
moved if_start which is the usual place for bpf_mtap on Tx.

Here is a patch for the change:
  http://www.netbsd.org/~ozaki-r/move-bpf_mtap-txintr.diff

Is this kind of changes correct?


So there are five remaining bpf_mtap that cannot be solved
without big changes. I annotate them:
  http://www.netbsd.org/~ozaki-r/comment-bpf_mtap-hardintr.diff

One solution is to provide a deferred bpf_mtap mechanism that
duplicates mbuf and run bpf_mtap in softint (or workqueue).
It should work but it's perhaps a last resort.

Let me know if there is a better approach.


Any comments or suggestions?

Thanks,
  ozaki-r


Home | Main Index | Thread Index | Old Index