Deleted Added
full compact
if.c (206637) if.c (207369)
1/*-
2 * Copyright (c) 1980, 1986, 1993
3 * The Regents of the University of California. 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

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

22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)if.c 8.5 (Berkeley) 1/9/95
1/*-
2 * Copyright (c) 1980, 1986, 1993
3 * The Regents of the University of California. 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

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

22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)if.c 8.5 (Berkeley) 1/9/95
30 * $FreeBSD: head/sys/net/if.c 206637 2010-04-14 22:02:19Z delphij $
30 * $FreeBSD: head/sys/net/if.c 207369 2010-04-29 11:52:42Z bz $
31 */
32
33#include "opt_compat.h"
34#include "opt_inet6.h"
35#include "opt_inet.h"
36#include "opt_carp.h"
37#include "opt_ddb.h"
38

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

158#ifdef INET6
159/*
160 * XXX: declare here to avoid to include many inet6 related files..
161 * should be more generalized?
162 */
163extern void nd6_setmtu(struct ifnet *);
164#endif
165
31 */
32
33#include "opt_compat.h"
34#include "opt_inet6.h"
35#include "opt_inet.h"
36#include "opt_carp.h"
37#include "opt_ddb.h"
38

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

158#ifdef INET6
159/*
160 * XXX: declare here to avoid to include many inet6 related files..
161 * should be more generalized?
162 */
163extern void nd6_setmtu(struct ifnet *);
164#endif
165
166VNET_DEFINE(int, if_index);
167int ifqmaxlen = IFQ_MAXLEN;
166VNET_DEFINE(struct ifnethead, ifnet); /* depend on static init XXX */
167VNET_DEFINE(struct ifgrouphead, ifg_head);
168VNET_DEFINE(struct ifnethead, ifnet); /* depend on static init XXX */
169VNET_DEFINE(struct ifgrouphead, ifg_head);
168VNET_DEFINE(int, if_index);
170
169static VNET_DEFINE(int, if_indexlim) = 8;
170
171/* Table of ifnet by index. */
172static VNET_DEFINE(struct ifindex_entry *, ifindex_table);
173
174#define V_if_indexlim VNET(if_indexlim)
175#define V_ifindex_table VNET(ifindex_table)
176
171static VNET_DEFINE(int, if_indexlim) = 8;
172
173/* Table of ifnet by index. */
174static VNET_DEFINE(struct ifindex_entry *, ifindex_table);
175
176#define V_if_indexlim VNET(if_indexlim)
177#define V_ifindex_table VNET(ifindex_table)
178
177int ifqmaxlen = IFQ_MAXLEN;
178
179/*
180 * The global network interface list (V_ifnet) and related state (such as
181 * if_index, if_indexlim, and ifindex_table) are protected by an sxlock and
182 * an rwlock. Either may be acquired shared to stablize the list, but both
183 * must be acquired writable to modify the list. This model allows us to
184 * both stablize the interface list during interrupt thread processing, but
185 * also to stablize it over long-running ioctls, without introducing priority
186 * inversions and deadlocks.

--- 3233 unchanged lines hidden ---
179/*
180 * The global network interface list (V_ifnet) and related state (such as
181 * if_index, if_indexlim, and ifindex_table) are protected by an sxlock and
182 * an rwlock. Either may be acquired shared to stablize the list, but both
183 * must be acquired writable to modify the list. This model allows us to
184 * both stablize the interface list during interrupt thread processing, but
185 * also to stablize it over long-running ioctls, without introducing priority
186 * inversions and deadlocks.

--- 3233 unchanged lines hidden ---