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)
Thu, Apr 18, 12:14 PM
Unknown Object (File)
Thu, Apr 18, 12:14 PM
Unknown Object (File)
Mar 8 2024, 1:20 AM
Unknown Object (File)
Mar 8 2024, 12:21 AM
Unknown Object (File)
Dec 21 2023, 12:17 AM
Unknown Object (File)
Dec 20 2023, 12:47 AM
Unknown Object (File)
May 27 2023, 10:49 PM
Unknown Object (File)
May 27 2023, 10:48 PM
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.