Skip to content

Commit

Permalink
import netmap_kring_on() from FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
jhk098 committed Aug 24, 2020
1 parent cd656a1 commit 42785fd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions sys/dev/netmap/netmap_kern.h
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,24 @@ nm_native_on(struct netmap_adapter *na)
return nm_netmap_on(na) && (na->na_flags & NAF_NATIVE);
}

static inline struct netmap_kring *
netmap_kring_on(struct netmap_adapter *na, u_int q, enum txrx t)
{
struct netmap_kring *kring = NULL;

if (!nm_native_on(na))
return NULL;

if (t == NR_RX && q < na->num_rx_rings)
kring = na->rx_rings[q];
else if (t == NR_TX && q < na->num_tx_rings)
kring = na->tx_rings[q];
else
return NULL;

return (kring->nr_mode == NKR_NETMAP_ON) ? kring : NULL;
}

static inline int
nm_iszombie(struct netmap_adapter *na)
{
Expand Down

0 comments on commit 42785fd

Please sign in to comment.