Page MenuHomeFreeBSD

netgraph/ng_source: Switch queuing framework
ClosedPublic

Authored by donner on Jan 28 2021, 10:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 10, 8:51 PM
Unknown Object (File)
Wed, Nov 6, 9:33 PM
Unknown Object (File)
Mon, Oct 28, 10:48 PM
Unknown Object (File)
Fri, Oct 25, 2:06 AM
Unknown Object (File)
Sun, Oct 20, 9:30 AM
Unknown Object (File)
Oct 15 2024, 10:30 PM
Unknown Object (File)
Oct 14 2024, 8:09 PM
Unknown Object (File)
Oct 14 2024, 7:05 AM

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 36599
Build 33488: arc lint + arc unit

Event Timeline

donner retitled this revision from netgraph/ng_sourche: Switch queuing framework to netgraph/ng_source: Switch queuing framework.Jan 28 2021, 10:17 PM
donner added inline comments.
sys/netgraph/ng_source.c
287

Is there a common idiom for that?
Do I need to initialize the mbufq?

This revision is now accepted and ready to land.Jan 29 2021, 5:33 AM
sys/netgraph/ng_source.c
805–811

Can't this hit the limit if another thread is doing ng_source_rcvdata() at the same time?

donner added inline comments.
sys/netgraph/ng_source.c
805–811

Usually the node is used in the mode "learn" or "send" exclusively. It's a debugging tool.

You are right, in principle there is the opportunity that new learned packets are inserted to the queue after the send routine here dequeued the packet. But it's only possible to add a single packet (because the queue is full), so the send function will try to re-add a single packet to a full queue but failed. So we end up with a modified list of packets in the queue, because existing and newly learned packets mix. But this is expected behavior.

Only in the case of mbufq_prepend the mbufq logic will not check the limits, so the queue can go up unlimited. This requires memory pressure (ENOBUFS).

In short: I do not see a problem here.

Approved by: kp (mentor)

sys/netgraph/ng_source.c
805–811

Okay. I wonder if it's worth adding a KASSERT() here, especially as we'd leak the mbuf if the enqueue fails.

donner added inline comments.
sys/netgraph/ng_source.c
805–811

That's a serious point. the semantics of mbufq_enqueue differs from _IF_ENQUEUE in this aspect, so the case needs to be handled explicitly.

donner marked an inline comment as done.
  • Explain, why it's safe to ignore the error code.
This revision now requires review to proceed.Jan 29 2021, 10:37 AM
sys/netgraph/ng_source.c
805–811

Forget it. This is a callout, which is always executed under a WRITER lock. So there is no interference possible. I'll document it.

sys/netgraph/ng_source.c
805–811

The KASSERT is an excellent way of documenting that it's impossible (and verifying assumption) :)

  • Make assumption explicit.

Approved by: kp (mentor)

This revision is now accepted and ready to land.Jan 29 2021, 11:08 AM
This revision was automatically updated to reflect the committed changes.