diff options
author | Thomas Gschwantner <tharre3@gmail.com> | 2018-07-18 17:47:50 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-18 19:48:17 +0200 |
commit | 1bd1d9660edf224c7b056a5df0b2ee4e526214c1 (patch) | |
tree | 47251ab6541a3bd77f4a602ba2c01d2462dcf008 /src/peer.c | |
parent | f230add201d4963d97a09dcd9223900711fd1085 (diff) |
recieve: disable NAPI busy polling
This avoids adding one reference per peer to the napi_hash hashtable, as
normally done by netif_napi_add(). Since we potentially could have up to
2^20 peers this would make busy polling very slow globally.
This approach is preferable to having only a single napi struct because
we get one gro_list per peer, which means packets can be combined nicely
even if we have a large number of peers.
This is also done by gro_cells_init() in net/core/gro_cells.c .
Signed-off-by: Thomas Gschwantner <tharre3@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/peer.c')
-rw-r--r-- | src/peer.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -56,6 +56,7 @@ struct wireguard_peer *peer_create(struct wireguard_device *wg, const u8 public_ list_add_tail(&peer->peer_list, &wg->peer_list); pubkey_hashtable_add(&wg->peer_hashtable, peer); peer->last_sent_handshake = ktime_get_boot_fast_ns() - (u64)(REKEY_TIMEOUT + 1) * NSEC_PER_SEC; + set_bit(NAPI_STATE_NO_BUSY_POLL, &peer->napi.state); netif_napi_add(wg->dev, &peer->napi, packet_rx_poll, NAPI_POLL_WEIGHT); napi_enable(&peer->napi); pr_debug("%s: Peer %llu created\n", wg->dev->name, peer->internal_id); |