This would have been just one small patch, but there was a deficiency
in the low level functions to save and restore pre-existing state of a
virtual function.
I have tested these patches on a RHEL6 machine with an SR-IOV adapter,
and it properly handled the save/set .. [attach-to-guest] .. [detach]
.. restore cycle both when the original state of the VF had a vlan tag
and not, and when the guest was requesting a vlan tag, and not.
(Now I'm wondering if this would also work for macvtap "passthrough"
mode when the adapter used is a VF - it looks like the only thing
stopping it is that the code to save / set / restore in that mode uses
the device name of the vf, rather than referring to it as <physical
device> vf <n>; since only VFs understand setting the vlan tag, the
lower level code just assumes it can't be done)