Page MenuHomeFreeBSD

Don't free mbufs when stopping an interface in netmap mode.
ClosedPublic

Authored by jhb on Apr 22 2015, 7:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 7, 9:41 PM
Unknown Object (File)
Thu, Dec 5, 8:11 PM
Unknown Object (File)
Sun, Nov 24, 1:41 AM
Unknown Object (File)
Nov 1 2024, 2:23 PM
Unknown Object (File)
Oct 26 2024, 4:51 PM
Unknown Object (File)
Oct 21 2024, 4:17 PM
Unknown Object (File)
Oct 9 2024, 8:42 AM
Unknown Object (File)
Oct 8 2024, 10:05 AM
Subscribers

Details

Summary

Don't free mbufs when stopping an interface in netmap mode.

Currently if you ifconfig down a vtnet interface while it is being used
via netmap, the kernel panics due to trying to treat the cookie values
in the virtio rings as mbufs to be freed. When netmap is enabled, these
cookie values are pointers to something else.

Note that other netmap-aware drivers don't seem to need this as they
store the mbuf pointers in the software rings that mirror the hardware
descriptor rings, and since netmap doesn't touch those, the software
state always has NULL mbuf pointers causing the loops to free mbufs to
not do anything. However, vtnet reuses the same state area for both
netmap and non-netmap mode, so it needs to explicitly avoid looking at
the rings and treating the cookie values as mbufs if netmap is
enabled.

Test Plan
  • start a vm with an extra vtnet1 interface
  • run pkt-gen -i vtnet1 -f rx
  • in another window, run 'ifconfig vtnet1 down'
  • currently this panics, with this patch it does not.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb retitled this revision from to Don't free mbufs when stopping an interface in netmap mode..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added a reviewer: bryanv.
jhb added a subscriber: adrian.
adrian added a reviewer: adrian.

I think this is fine as a short-term work around.

This revision is now accepted and ready to land.Apr 23 2015, 1:59 AM
bryanv edited edge metadata.
This revision was automatically updated to reflect the committed changes.