Skip to content

Commit

Permalink
make sure that na->nm_register() is called at least once
Browse files Browse the repository at this point in the history
Some adapters (e.g., generic) do all their initialization the
first time nm_register(,1) is called. Before this patch, however
nm_register(,1) was not called at all when only host rings where beeing
put in netmap mode. On the other end, nm_register(,0) is always called
when the adapter is released, irrespective of the kind of rings that
were beeing used. This caused the generic adapter (and possibily
others) to try to release resources that had never been allocated,
resulting in warnings and panics.

This patch makes sure that nm_register(0,1) is called at least once
when any ring of the adapter is put in netmap mode, thus restoring
symmetry with the release path.
  • Loading branch information
giuseppelettieri committed Feb 7, 2022
1 parent d76ec11 commit 7490d02
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sys/dev/netmap/netmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2654,7 +2654,7 @@ netmap_do_regif(struct netmap_priv_d *priv, struct netmap_adapter *na,
*/
netmap_update_hostrings_mode(na);

if (nm_kring_pending(priv)) {
if (na->active_fds == 0 || nm_kring_pending(priv)) {
/* Some kring is switching mode, tell the adapter to
* react on this. */
netmap_set_all_rings(na, NM_KR_LOCKED);
Expand Down

0 comments on commit 7490d02

Please sign in to comment.