17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5ba2e4443Sseb * Common Development and Distribution License (the "License"). 6ba2e4443Sseb * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22f4b3ec61Sdh155122 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_DLD_H 277c478bd9Sstevel@tonic-gate #define _SYS_DLD_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate /* 327c478bd9Sstevel@tonic-gate * Data-Link Driver (public header). 337c478bd9Sstevel@tonic-gate */ 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <sys/types.h> 367c478bd9Sstevel@tonic-gate #include <sys/stream.h> 377c478bd9Sstevel@tonic-gate #include <sys/mac.h> 387c478bd9Sstevel@tonic-gate #include <sys/dls.h> 397c478bd9Sstevel@tonic-gate #include <net/if.h> 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #ifdef __cplusplus 427c478bd9Sstevel@tonic-gate extern "C" { 437c478bd9Sstevel@tonic-gate #endif 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate /* 467c478bd9Sstevel@tonic-gate * Data-Link Driver Information (text emitted by modinfo(1m)) 477c478bd9Sstevel@tonic-gate */ 487c478bd9Sstevel@tonic-gate #define DLD_INFO "Data-Link Driver v%I%" 497c478bd9Sstevel@tonic-gate 50210db224Sericheng #define DLD_MAX_PPA 999 51210db224Sericheng #define DLD_MAX_MINOR (DLD_MAX_PPA + 1) 52210db224Sericheng 537c478bd9Sstevel@tonic-gate /* 547c478bd9Sstevel@tonic-gate * Options: To enable an option set the property name to a non-zero value 557c478bd9Sstevel@tonic-gate * in kernel/drv/dld.conf. 567c478bd9Sstevel@tonic-gate */ 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate /* 597c478bd9Sstevel@tonic-gate * Prevent use of the IP fast-path (direct M_DATA transmit). 607c478bd9Sstevel@tonic-gate */ 617c478bd9Sstevel@tonic-gate #define DLD_PROP_NO_FASTPATH "no-fastpath" 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate /* 647c478bd9Sstevel@tonic-gate * Prevent advertising of the DL_CAPAB_POLL capability. 657c478bd9Sstevel@tonic-gate */ 667c478bd9Sstevel@tonic-gate #define DLD_PROP_NO_POLL "no-poll" 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate /* 697c478bd9Sstevel@tonic-gate * Prevent advertising of the DL_CAPAB_ZEROCOPY capability. 707c478bd9Sstevel@tonic-gate */ 717c478bd9Sstevel@tonic-gate #define DLD_PROP_NO_ZEROCOPY "no-zerocopy" 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate /* 74*9c175129Sja97890 * Prevent advertising of the DL_CAPAB_SOFTRING capability. 75*9c175129Sja97890 */ 76*9c175129Sja97890 #define DLD_PROP_NO_SOFTRING "no-softring" 77*9c175129Sja97890 78*9c175129Sja97890 /* 797c478bd9Sstevel@tonic-gate * The name of the driver. 807c478bd9Sstevel@tonic-gate */ 817c478bd9Sstevel@tonic-gate #define DLD_DRIVER_NAME "dld" 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate /* 847c478bd9Sstevel@tonic-gate * The name of the control minor node of dld. 857c478bd9Sstevel@tonic-gate */ 867c478bd9Sstevel@tonic-gate #define DLD_CONTROL_MINOR_NAME "ctl" 877c478bd9Sstevel@tonic-gate #define DLD_CONTROL_MINOR 0 887c478bd9Sstevel@tonic-gate #define DLD_CONTROL_DEV "/devices/pseudo/" DLD_DRIVER_NAME "@0:" \ 897c478bd9Sstevel@tonic-gate DLD_CONTROL_MINOR_NAME 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate /* 927c478bd9Sstevel@tonic-gate * IOCTL codes and data structures. 937c478bd9Sstevel@tonic-gate */ 947c478bd9Sstevel@tonic-gate #define DLDIOC ('D' << 24 | 'L' << 16 | 'D' << 8) 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate #define DLDIOCATTR (DLDIOC | 0x03) 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate typedef struct dld_ioc_attr { 997c478bd9Sstevel@tonic-gate char dia_name[IFNAMSIZ]; 1007c478bd9Sstevel@tonic-gate char dia_dev[MAXNAMELEN]; 101210db224Sericheng uint_t dia_max_sdu; 1027c478bd9Sstevel@tonic-gate uint16_t dia_vid; 1037c478bd9Sstevel@tonic-gate } dld_ioc_attr_t; 1047c478bd9Sstevel@tonic-gate 105210db224Sericheng #define DLDIOCVLAN (DLDIOC | 0x04) 106210db224Sericheng 107210db224Sericheng typedef struct dld_ioc_vlan { 108aae21359Skrgopi char div_name[IFNAMSIZ]; 109210db224Sericheng uint_t div_count; 110210db224Sericheng } dld_ioc_vlan_t; 111210db224Sericheng 112210db224Sericheng typedef struct dld_vlan_info { 113210db224Sericheng char dvi_name[IFNAMSIZ]; 114210db224Sericheng } dld_vlan_info_t; 115210db224Sericheng 116f4b3ec61Sdh155122 typedef struct dld_hold_vlan { 117f4b3ec61Sdh155122 char dhv_name[IFNAMSIZ]; 118f4b3ec61Sdh155122 zoneid_t dhv_zid; 119f4b3ec61Sdh155122 boolean_t dhv_docheck; 120f4b3ec61Sdh155122 } dld_hold_vlan_t; 121f4b3ec61Sdh155122 1220ba2cbe9Sxc151355 /* 1230ba2cbe9Sxc151355 * Secure objects ioctls 1240ba2cbe9Sxc151355 */ 1250ba2cbe9Sxc151355 typedef enum { 1260ba2cbe9Sxc151355 DLD_SECOBJ_CLASS_WEP = 1 1270ba2cbe9Sxc151355 } dld_secobj_class_t; 1280ba2cbe9Sxc151355 1290ba2cbe9Sxc151355 #define DLD_SECOBJ_OPT_CREATE 0x00000001 1300ba2cbe9Sxc151355 #define DLD_SECOBJ_NAME_MAX 32 1310ba2cbe9Sxc151355 #define DLD_SECOBJ_VAL_MAX 256 1320ba2cbe9Sxc151355 typedef struct dld_secobj { 1330ba2cbe9Sxc151355 char so_name[DLD_SECOBJ_NAME_MAX]; 1340ba2cbe9Sxc151355 dld_secobj_class_t so_class; 1350ba2cbe9Sxc151355 uint8_t so_val[DLD_SECOBJ_VAL_MAX]; 1360ba2cbe9Sxc151355 uint_t so_len; 1370ba2cbe9Sxc151355 } dld_secobj_t; 1380ba2cbe9Sxc151355 1390ba2cbe9Sxc151355 #define DLDIOCSECOBJSET (DLDIOC | 0x05) 1400ba2cbe9Sxc151355 typedef struct dld_ioc_secobj_set { 1410ba2cbe9Sxc151355 dld_secobj_t ss_obj; 1420ba2cbe9Sxc151355 uint_t ss_flags; 1430ba2cbe9Sxc151355 } dld_ioc_secobj_set_t; 1440ba2cbe9Sxc151355 1450ba2cbe9Sxc151355 #define DLDIOCSECOBJGET (DLDIOC | 0x06) 1460ba2cbe9Sxc151355 typedef struct dld_ioc_secobj_get { 1470ba2cbe9Sxc151355 dld_secobj_t sg_obj; 1480ba2cbe9Sxc151355 uint_t sg_count; 1490ba2cbe9Sxc151355 } dld_ioc_secobj_get_t; 1500ba2cbe9Sxc151355 1510ba2cbe9Sxc151355 #define DLDIOCSECOBJUNSET (DLDIOC | 0x07) 1520ba2cbe9Sxc151355 typedef struct dld_ioc_secobj_unset { 1530ba2cbe9Sxc151355 char su_name[DLD_SECOBJ_NAME_MAX]; 1540ba2cbe9Sxc151355 } dld_ioc_secobj_unset_t; 1550ba2cbe9Sxc151355 156f4b3ec61Sdh155122 /* 157f4b3ec61Sdh155122 * DLDIOCHOLDVLAN/DLDIOCRELEVLAN are added to support a "hold/release" 158f4b3ec61Sdh155122 * operation on a VLAN. A hold will cause a VLAN to be created or the 159f4b3ec61Sdh155122 * reference count will be increased, release will do the reverse. 160f4b3ec61Sdh155122 */ 161f4b3ec61Sdh155122 #define DLDIOCHOLDVLAN (DLDIOC | 0x08) 162f4b3ec61Sdh155122 163f4b3ec61Sdh155122 #define DLDIOCRELEVLAN (DLDIOC | 0x09) 164f4b3ec61Sdh155122 165f4b3ec61Sdh155122 #define DLDIOCZIDGET (DLDIOC | 0x0a) 166f4b3ec61Sdh155122 167210db224Sericheng #ifdef _KERNEL 168210db224Sericheng int dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **); 169210db224Sericheng int dld_open(queue_t *, dev_t *, int, int, cred_t *); 170210db224Sericheng int dld_close(queue_t *); 171210db224Sericheng void dld_wput(queue_t *, mblk_t *); 172210db224Sericheng void dld_wsrv(queue_t *); 173210db224Sericheng void dld_init_ops(struct dev_ops *, const char *); 174210db224Sericheng void dld_fini_ops(struct dev_ops *); 175210db224Sericheng #endif 176210db224Sericheng 1777c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1787c478bd9Sstevel@tonic-gate } 1797c478bd9Sstevel@tonic-gate #endif 1807c478bd9Sstevel@tonic-gate 1817c478bd9Sstevel@tonic-gate #endif /* _SYS_DLD_H */ 182