netmap: enter NET_EPOCH on generic txsync

After r353292, netmap generic adapter on if_vlan interfaces panics on
asserting the NET_EPOCH. In more detail, this happens when
nm_os_generic_xmit_frame() is called, that is in the generic txsync
routine.
Fix the issue by entering the NET_EPOCH during the generic txsync.
We amortize the cost of entering/exiting over a whole batch of
transmissions.

PR:		241489
Reported by:	Aleksandr Fedorov <aleksandr.fedorov@itglobal.com>
This commit is contained in:
Vincenzo Maffione 2019-10-28 19:00:27 +00:00
parent f5ef5f675d
commit 484456b2d8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=354137

View File

@ -669,6 +669,11 @@ generic_netmap_txsync(struct netmap_kring *kring, int flags)
if (nm_i != head) { /* we have new packets to send */
struct nm_os_gen_arg a;
u_int event = -1;
#ifdef __FreeBSD__
struct epoch_tracker et;
NET_EPOCH_ENTER(et);
#endif
if (gna->txqdisc && nm_kr_txempty(kring)) {
/* In txqdisc mode, we ask for a delayed notification,
@ -776,6 +781,10 @@ generic_netmap_txsync(struct netmap_kring *kring, int flags)
/* Update hwcur to the next slot to transmit. Here nm_i
* is not necessarily head, we could break early. */
kring->nr_hwcur = nm_i;
#ifdef __FreeBSD__
NET_EPOCH_EXIT(et);
#endif
}
/*