Deleted Added
full compact
netmap_legacy.c (344047) netmap_legacy.c (364756)
1/*
2 * Copyright (C) 2018 Vincenzo Maffione
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
1/*
2 * Copyright (C) 2018 Vincenzo Maffione
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26/* $FreeBSD: stable/11/sys/dev/netmap/netmap_legacy.c 344047 2019-02-12 09:26:05Z vmaffione $ */
26/* $FreeBSD: stable/11/sys/dev/netmap/netmap_legacy.c 364756 2020-08-25 11:12:30Z vmaffione $ */
27
28#if defined(__FreeBSD__)
29#include <sys/cdefs.h> /* prerequisite */
30#include <sys/types.h>
31#include <sys/param.h> /* defines used in kernel.h */
32#include <sys/filio.h> /* FIONBIO */
33#include <sys/malloc.h>
34#include <sys/socketvar.h> /* struct socket */

--- 31 unchanged lines hidden (view full) ---

66 req->nr_tx_rings = nmr->nr_tx_rings;
67 req->nr_rx_rings = nmr->nr_rx_rings;
68 req->nr_mem_id = nmr->nr_arg2;
69 req->nr_ringid = nmr->nr_ringid & NETMAP_RING_MASK;
70 if ((nmr->nr_flags & NR_REG_MASK) == NR_REG_DEFAULT) {
71 /* Convert the older nmr->nr_ringid (original
72 * netmap control API) to nmr->nr_flags. */
73 u_int regmode = NR_REG_DEFAULT;
27
28#if defined(__FreeBSD__)
29#include <sys/cdefs.h> /* prerequisite */
30#include <sys/types.h>
31#include <sys/param.h> /* defines used in kernel.h */
32#include <sys/filio.h> /* FIONBIO */
33#include <sys/malloc.h>
34#include <sys/socketvar.h> /* struct socket */

--- 31 unchanged lines hidden (view full) ---

66 req->nr_tx_rings = nmr->nr_tx_rings;
67 req->nr_rx_rings = nmr->nr_rx_rings;
68 req->nr_mem_id = nmr->nr_arg2;
69 req->nr_ringid = nmr->nr_ringid & NETMAP_RING_MASK;
70 if ((nmr->nr_flags & NR_REG_MASK) == NR_REG_DEFAULT) {
71 /* Convert the older nmr->nr_ringid (original
72 * netmap control API) to nmr->nr_flags. */
73 u_int regmode = NR_REG_DEFAULT;
74 if (req->nr_ringid & NETMAP_SW_RING) {
74 if (nmr->nr_ringid & NETMAP_SW_RING) {
75 regmode = NR_REG_SW;
75 regmode = NR_REG_SW;
76 } else if (req->nr_ringid & NETMAP_HW_RING) {
76 } else if (nmr->nr_ringid & NETMAP_HW_RING) {
77 regmode = NR_REG_ONE_NIC;
78 } else {
79 regmode = NR_REG_ALL_NIC;
80 }
81 req->nr_mode = regmode;
82 } else {
83 req->nr_mode = nmr->nr_flags & NR_REG_MASK;
84 }

--- 348 unchanged lines hidden ---
77 regmode = NR_REG_ONE_NIC;
78 } else {
79 regmode = NR_REG_ALL_NIC;
80 }
81 req->nr_mode = regmode;
82 } else {
83 req->nr_mode = nmr->nr_flags & NR_REG_MASK;
84 }

--- 348 unchanged lines hidden ---