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
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DLS_H
#define _SYS_DLS_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/stream.h>
#include <sys/mac.h>
/*
* Data-Link Services Module
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Module name.
*/
#define DLS_MODULE_NAME "dls"
/*
* Data-Link Services Information (text emitted by modinfo(1m))
*/
#define DLS_INFO "Data-Link Services v%I%"
/*
* Check the legality of a DLSAP value. The following values are allowed,
* as specified by PSARC 2003/150:
*
* 0 802 semantics
* ETHERTYPE_802_MIN (1536)..ETHERTYPE_MAX (65535) ethertype semantics
* 1..ETHERMTU (1500) 802 semantics, for
* DL_ETHER only.
*/
#define SAP_LEGAL(type, sap) \
(((sap) >= ETHERTYPE_802_MIN && (sap) < ETHERTYPE_MAX) || \
((sap) == 0) || \
((sap) <= ETHERMTU && (type) == DL_ETHER))
/*
* Macros for converting ppas to instance #s and to Vlan IDs.
*/
#define DLS_PPA2INST(ppa) ((int)((ppa) % 1000))
#define DLS_PPA2VID(ppa) ((uint16_t)((ppa) / 1000))
#ifdef _KERNEL
extern int dls_create(const char *, const char *, uint_t);
extern int dls_destroy(const char *);
typedef struct dls_t *dls_channel_t;
extern int dls_open(const char *, dls_channel_t *);
extern void dls_close(dls_channel_t);
extern mac_handle_t dls_mac(dls_channel_t);
extern uint16_t dls_vid(dls_channel_t);
#define DLS_SAP_LLC 0
#define DLS_SAP_PROMISC (1 << 16)
extern int dls_bind(dls_channel_t, uint16_t);
extern void dls_unbind(dls_channel_t);
#define DLS_PROMISC_SAP 0x00000001
#define DLS_PROMISC_MULTI 0x00000002
#define DLS_PROMISC_PHYS 0x00000004
extern int dls_promisc(dls_channel_t, uint32_t);
extern int dls_multicst_add(dls_channel_t, const uint8_t *);
extern int dls_multicst_remove(dls_channel_t, const uint8_t *);
extern mblk_t *dls_header(dls_channel_t, const uint8_t *, uint16_t, uint_t);
typedef struct dls_header_info {
size_t dhi_length;
const uint8_t *dhi_daddr;
const uint8_t *dhi_saddr;
uint16_t dhi_ethertype;
uint16_t dhi_vid;
boolean_t dhi_isgroup;
} dls_header_info_t;
extern void dls_header_info(dls_channel_t, mblk_t *, dls_header_info_t *);
typedef void (*dls_rx_t)(void *, mac_resource_handle_t, mblk_t *, size_t);
extern void dls_rx_set(dls_channel_t, dls_rx_t, void *);
extern mblk_t *dls_tx(dls_channel_t, mblk_t *);
extern boolean_t dls_active_set(dls_channel_t);
extern void dls_active_clear(dls_channel_t);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DLS_H */
|