1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_DLS_H 28 #define _SYS_DLS_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #include <sys/types.h> 33 #include <sys/stream.h> 34 #include <sys/ght.h> 35 #include <sys/mac.h> 36 37 /* 38 * Data-Link Services Module 39 */ 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 /* 46 * Module name. 47 */ 48 #define DLS_MODULE_NAME "dls" 49 50 /* 51 * Data-Link Services Information (text emitted by modinfo(1m)) 52 */ 53 #define DLS_INFO "Data-Link Services v%I%" 54 55 /* 56 * Check the legality of a DLSAP value. The following values are allowed, 57 * as specified by PSARC 2003/150: 58 * 59 * 0 802 semantics 60 * ETHERTYPE_802_MIN (1536)..ETHERTYPE_MAX (65535) ethertype semantics 61 * 1..ETHERMTU (1500) 802 semantics, for 62 * DL_ETHER only. 63 */ 64 #define SAP_LEGAL(type, sap) \ 65 (((sap) >= ETHERTYPE_802_MIN && (sap) < ETHERTYPE_MAX) || \ 66 ((sap) == 0) || \ 67 ((sap) <= ETHERMTU && (type) == DL_ETHER)) 68 69 #ifdef _KERNEL 70 71 extern int dls_create(const char *, const char *, uint_t, uint16_t); 72 extern int dls_destroy(const char *); 73 74 typedef struct dls_t *dls_channel_t; 75 76 extern int dls_open(const char *, dls_channel_t *); 77 extern void dls_close(dls_channel_t); 78 79 extern mac_handle_t dls_mac(dls_channel_t); 80 extern uint16_t dls_vid(dls_channel_t); 81 82 #define DLS_SAP_LLC 0 83 #define DLS_SAP_PROMISC (1 << 16) 84 85 extern int dls_bind(dls_channel_t, uint16_t); 86 extern void dls_unbind(dls_channel_t); 87 88 #define DLS_PROMISC_SAP 0x00000001 89 #define DLS_PROMISC_MULTI 0x00000002 90 #define DLS_PROMISC_PHYS 0x00000004 91 92 extern int dls_promisc(dls_channel_t, uint32_t); 93 94 extern int dls_multicst_add(dls_channel_t, const uint8_t *); 95 extern int dls_multicst_remove(dls_channel_t, const uint8_t *); 96 97 extern mblk_t *dls_header(dls_channel_t, const uint8_t *, uint16_t, uint_t); 98 99 typedef struct dls_header_info { 100 size_t dhi_length; 101 const uint8_t *dhi_daddr; 102 const uint8_t *dhi_saddr; 103 uint16_t dhi_ethertype; 104 uint16_t dhi_vid; 105 boolean_t dhi_isgroup; 106 } dls_header_info_t; 107 108 extern void dls_header_info(dls_channel_t, mblk_t *, dls_header_info_t *); 109 110 typedef void (*dls_rx_t)(void *, mac_resource_handle_t, mblk_t *, size_t); 111 112 extern void dls_rx_set(dls_channel_t, dls_rx_t, void *); 113 114 typedef mac_tx_t dls_tx_t; 115 116 extern mblk_t *dls_tx(dls_channel_t, mblk_t *); 117 118 extern boolean_t dls_active_set(dls_channel_t); 119 extern void dls_active_clear(dls_channel_t); 120 121 #endif /* _KERNEL */ 122 123 #ifdef __cplusplus 124 } 125 #endif 126 127 #endif /* _SYS_DLS_H */ 128