netmap_kern.h (266974) | netmap_kern.h (267128) |
---|---|
1/* 2 * Copyright (C) 2011-2014 Matteo Landi, Luigi Rizzo. All rights reserved. 3 * Copyright (C) 2013-2014 Universita` di Pisa. 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 --- 11 unchanged lines hidden (view full) --- 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 27/* | 1/* 2 * Copyright (C) 2011-2014 Matteo Landi, Luigi Rizzo. All rights reserved. 3 * Copyright (C) 2013-2014 Universita` di Pisa. 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 --- 11 unchanged lines hidden (view full) --- 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 27/* |
28 * $FreeBSD: head/sys/dev/netmap/netmap_kern.h 266974 2014-06-02 17:54:39Z marcel $ | 28 * $FreeBSD: head/sys/dev/netmap/netmap_kern.h 267128 2014-06-05 21:12:41Z luigi $ |
29 * 30 * The header contains the definitions of constants and function 31 * prototypes used only in kernelspace. 32 */ 33 34#ifndef _NET_NETMAP_KERN_H_ 35#define _NET_NETMAP_KERN_H_ 36 --- 636 unchanged lines hidden (view full) --- 673#endif /* WITH_PIPES */ 674 675 676/* return slots reserved to rx clients; used in drivers */ 677static inline uint32_t 678nm_kr_rxspace(struct netmap_kring *k) 679{ 680 int space = k->nr_hwtail - k->nr_hwcur; | 29 * 30 * The header contains the definitions of constants and function 31 * prototypes used only in kernelspace. 32 */ 33 34#ifndef _NET_NETMAP_KERN_H_ 35#define _NET_NETMAP_KERN_H_ 36 --- 636 unchanged lines hidden (view full) --- 673#endif /* WITH_PIPES */ 674 675 676/* return slots reserved to rx clients; used in drivers */ 677static inline uint32_t 678nm_kr_rxspace(struct netmap_kring *k) 679{ 680 int space = k->nr_hwtail - k->nr_hwcur; |
681 if (space < 0) | 681 if (space < 0) |
682 space += k->nkr_num_slots; 683 ND("preserving %d rx slots %d -> %d", space, k->nr_hwcur, k->nr_hwtail); 684 685 return space; 686} 687 688 689/* True if no space in the tx ring. only valid after txsync_prologue */ --- 132 unchanged lines hidden (view full) --- 822/* 823 * update kring and ring at the end of txsync. 824 */ 825static inline void 826nm_txsync_finalize(struct netmap_kring *kring) 827{ 828 /* update ring tail to what the kernel knows */ 829 kring->ring->tail = kring->rtail = kring->nr_hwtail; | 682 space += k->nkr_num_slots; 683 ND("preserving %d rx slots %d -> %d", space, k->nr_hwcur, k->nr_hwtail); 684 685 return space; 686} 687 688 689/* True if no space in the tx ring. only valid after txsync_prologue */ --- 132 unchanged lines hidden (view full) --- 822/* 823 * update kring and ring at the end of txsync. 824 */ 825static inline void 826nm_txsync_finalize(struct netmap_kring *kring) 827{ 828 /* update ring tail to what the kernel knows */ 829 kring->ring->tail = kring->rtail = kring->nr_hwtail; |
830 | 830 |
831 /* note, head/rhead/hwcur might be behind cur/rcur 832 * if no carrier 833 */ 834 ND(5, "%s now hwcur %d hwtail %d head %d cur %d tail %d", 835 kring->name, kring->nr_hwcur, kring->nr_hwtail, 836 kring->rhead, kring->rcur, kring->rtail); 837} 838 --- 542 unchanged lines hidden --- | 831 /* note, head/rhead/hwcur might be behind cur/rcur 832 * if no carrier 833 */ 834 ND(5, "%s now hwcur %d hwtail %d head %d cur %d tail %d", 835 kring->name, kring->nr_hwcur, kring->nr_hwtail, 836 kring->rhead, kring->rcur, kring->rtail); 837} 838 --- 542 unchanged lines hidden --- |