1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DLS_IMPL_H
#define _SYS_DLS_IMPL_H
#include <sys/stream.h>
#include <sys/dls.h>
#include <sys/mac_provider.h>
#include <sys/mac_client.h>
#include <sys/mac_client_priv.h>
#include <sys/modhash.h>
#include <sys/kstat.h>
#include <net/if.h>
#include <net/bpf.h>
#include <net/bpfdesc.h>
#include <sys/dlpi.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct dls_multicst_addr_s {
struct dls_multicst_addr_s *dma_nextp; /* ds_rw_lock */
uint8_t dma_addr[MAXMACADDRLEN];
} dls_multicst_addr_t;
struct dls_link_s { /* Protected by */
char dl_name[MAXNAMELEN]; /* SL */
uint_t dl_ddi_instance; /* SL */
mac_handle_t dl_mh; /* SL */
mac_client_handle_t dl_mch; /* SL */
mac_unicast_handle_t dl_mah; /* SL */
const mac_info_t *dl_mip; /* SL */
uint_t dl_ref; /* SL */
mod_hash_t *dl_str_hash; /* SL, modhash lock */
uint_t dl_impl_count; /* SL */
uint_t dl_nactive; /* SL */
uint32_t dl_unknowns; /* atomic */
zoneid_t dl_zid;
uint_t dl_zone_ref;
link_tagmode_t dl_tagmode; /* atomic */
};
typedef struct dls_head_s {
kmutex_t dh_lock;
struct dld_str_s *dh_list; /* dh_ref */
uint_t dh_ref; /* dh_lock */
mod_hash_key_t dh_key; /* SL */
kcondvar_t dh_cv; /* dh_lock */
uint_t dh_removing; /* dh_lock */
} dls_head_t;
extern mod_hash_t *i_dls_link_hash;
extern void dls_link_init(void);
extern int dls_link_fini(void);
extern int dls_link_hold(const char *, dls_link_t **);
extern int dls_link_hold_create(const char *, dls_link_t **);
extern int dls_link_hold_by_dev(dev_t, dls_link_t **);
extern void dls_link_rele(dls_link_t *);
extern int dls_link_rele_by_name(const char *);
extern void dls_link_add(dls_link_t *, uint32_t, dld_str_t *);
extern void dls_link_remove(dls_link_t *, dld_str_t *);
extern int dls_link_getzid(const char *, zoneid_t *);
extern int dls_link_setzid(const char *, zoneid_t);
extern dev_info_t *dls_link_devinfo(dev_t);
extern dev_t dls_link_dev(dls_link_t *);
extern void i_dls_head_rele(dls_head_t *);
extern int dls_mac_active_set(dls_link_t *i);
extern void dls_mac_active_clear(dls_link_t *);
extern void dls_create_str_kstats(dld_str_t *);
extern int dls_stat_update(kstat_t *, dls_link_t *, int);
extern int dls_stat_create(const char *, int, const char *,
zoneid_t, int (*)(struct kstat *, int), void *,
kstat_t **);
extern int dls_devnet_open_by_dev(dev_t, dls_link_t **,
dls_dl_handle_t *);
extern int dls_devnet_hold_link(datalink_id_t, dls_dl_handle_t *,
dls_link_t **);
extern void dls_devnet_rele_link(dls_dl_handle_t, dls_link_t *);
extern void dls_init(void);
extern int dls_fini(void);
extern void dls_link_txloop(void *, mblk_t *);
extern boolean_t dls_accept(dld_str_t *, mac_header_info_t *,
dls_rx_t *, void **);
extern boolean_t dls_accept_loopback(dld_str_t *, mac_header_info_t *,
dls_rx_t *, void **);
extern boolean_t dls_accept_promisc(dld_str_t *, mac_header_info_t *,
dls_rx_t *, void **, boolean_t);
extern void i_dls_link_rx(void *, mac_resource_handle_t, mblk_t *,
boolean_t);
extern void dls_rx_promisc(void *, mac_resource_handle_t, mblk_t *,
boolean_t);
extern void dls_rx_vlan_promisc(void *, mac_resource_handle_t,
mblk_t *, boolean_t);
extern int dls_active_set(dld_str_t *);
extern void dls_active_clear(dld_str_t *, boolean_t);
extern void dls_mgmt_init(void);
extern void dls_mgmt_fini(void);
extern int dls_mgmt_get_phydev(datalink_id_t, dev_t *);
extern bpf_attach_fn_t dls_bpfattach_fn;
extern bpf_detach_fn_t dls_bpfdetach_fn;
extern void dls_set_bpfattach(bpf_attach_fn_t, bpf_detach_fn_t);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DLS_IMPL_H */
|