10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52311Sseb * Common Development and Distribution License (the "License"). 62311Sseb * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 223448Sdh155122 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_DLD_H 270Sstevel@tonic-gate #define _SYS_DLD_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate /* 320Sstevel@tonic-gate * Data-Link Driver (public header). 330Sstevel@tonic-gate */ 340Sstevel@tonic-gate 350Sstevel@tonic-gate #include <sys/types.h> 360Sstevel@tonic-gate #include <sys/stream.h> 370Sstevel@tonic-gate #include <sys/mac.h> 380Sstevel@tonic-gate #include <sys/dls.h> 390Sstevel@tonic-gate #include <net/if.h> 400Sstevel@tonic-gate 410Sstevel@tonic-gate #ifdef __cplusplus 420Sstevel@tonic-gate extern "C" { 430Sstevel@tonic-gate #endif 440Sstevel@tonic-gate 450Sstevel@tonic-gate /* 460Sstevel@tonic-gate * Data-Link Driver Information (text emitted by modinfo(1m)) 470Sstevel@tonic-gate */ 480Sstevel@tonic-gate #define DLD_INFO "Data-Link Driver v%I%" 490Sstevel@tonic-gate 50269Sericheng #define DLD_MAX_PPA 999 51269Sericheng #define DLD_MAX_MINOR (DLD_MAX_PPA + 1) 52269Sericheng 530Sstevel@tonic-gate /* 540Sstevel@tonic-gate * Options: To enable an option set the property name to a non-zero value 550Sstevel@tonic-gate * in kernel/drv/dld.conf. 560Sstevel@tonic-gate */ 570Sstevel@tonic-gate 580Sstevel@tonic-gate /* 590Sstevel@tonic-gate * Prevent use of the IP fast-path (direct M_DATA transmit). 600Sstevel@tonic-gate */ 610Sstevel@tonic-gate #define DLD_PROP_NO_FASTPATH "no-fastpath" 620Sstevel@tonic-gate 630Sstevel@tonic-gate /* 640Sstevel@tonic-gate * Prevent advertising of the DL_CAPAB_POLL capability. 650Sstevel@tonic-gate */ 660Sstevel@tonic-gate #define DLD_PROP_NO_POLL "no-poll" 670Sstevel@tonic-gate 680Sstevel@tonic-gate /* 690Sstevel@tonic-gate * Prevent advertising of the DL_CAPAB_ZEROCOPY capability. 700Sstevel@tonic-gate */ 710Sstevel@tonic-gate #define DLD_PROP_NO_ZEROCOPY "no-zerocopy" 720Sstevel@tonic-gate 730Sstevel@tonic-gate /* 74*4114Sja97890 * Prevent advertising of the DL_CAPAB_SOFTRING capability. 75*4114Sja97890 */ 76*4114Sja97890 #define DLD_PROP_NO_SOFTRING "no-softring" 77*4114Sja97890 78*4114Sja97890 /* 790Sstevel@tonic-gate * The name of the driver. 800Sstevel@tonic-gate */ 810Sstevel@tonic-gate #define DLD_DRIVER_NAME "dld" 820Sstevel@tonic-gate 830Sstevel@tonic-gate /* 840Sstevel@tonic-gate * The name of the control minor node of dld. 850Sstevel@tonic-gate */ 860Sstevel@tonic-gate #define DLD_CONTROL_MINOR_NAME "ctl" 870Sstevel@tonic-gate #define DLD_CONTROL_MINOR 0 880Sstevel@tonic-gate #define DLD_CONTROL_DEV "/devices/pseudo/" DLD_DRIVER_NAME "@0:" \ 890Sstevel@tonic-gate DLD_CONTROL_MINOR_NAME 900Sstevel@tonic-gate 910Sstevel@tonic-gate /* 920Sstevel@tonic-gate * IOCTL codes and data structures. 930Sstevel@tonic-gate */ 940Sstevel@tonic-gate #define DLDIOC ('D' << 24 | 'L' << 16 | 'D' << 8) 950Sstevel@tonic-gate 960Sstevel@tonic-gate #define DLDIOCATTR (DLDIOC | 0x03) 970Sstevel@tonic-gate 980Sstevel@tonic-gate typedef struct dld_ioc_attr { 990Sstevel@tonic-gate char dia_name[IFNAMSIZ]; 1000Sstevel@tonic-gate char dia_dev[MAXNAMELEN]; 101269Sericheng uint_t dia_max_sdu; 1020Sstevel@tonic-gate uint16_t dia_vid; 1030Sstevel@tonic-gate } dld_ioc_attr_t; 1040Sstevel@tonic-gate 105269Sericheng #define DLDIOCVLAN (DLDIOC | 0x04) 106269Sericheng 107269Sericheng typedef struct dld_ioc_vlan { 108733Skrgopi char div_name[IFNAMSIZ]; 109269Sericheng uint_t div_count; 110269Sericheng } dld_ioc_vlan_t; 111269Sericheng 112269Sericheng typedef struct dld_vlan_info { 113269Sericheng char dvi_name[IFNAMSIZ]; 114269Sericheng } dld_vlan_info_t; 115269Sericheng 1163448Sdh155122 typedef struct dld_hold_vlan { 1173448Sdh155122 char dhv_name[IFNAMSIZ]; 1183448Sdh155122 zoneid_t dhv_zid; 1193448Sdh155122 boolean_t dhv_docheck; 1203448Sdh155122 } dld_hold_vlan_t; 1213448Sdh155122 1223147Sxc151355 /* 1233147Sxc151355 * Secure objects ioctls 1243147Sxc151355 */ 1253147Sxc151355 typedef enum { 1263147Sxc151355 DLD_SECOBJ_CLASS_WEP = 1 1273147Sxc151355 } dld_secobj_class_t; 1283147Sxc151355 1293147Sxc151355 #define DLD_SECOBJ_OPT_CREATE 0x00000001 1303147Sxc151355 #define DLD_SECOBJ_NAME_MAX 32 1313147Sxc151355 #define DLD_SECOBJ_VAL_MAX 256 1323147Sxc151355 typedef struct dld_secobj { 1333147Sxc151355 char so_name[DLD_SECOBJ_NAME_MAX]; 1343147Sxc151355 dld_secobj_class_t so_class; 1353147Sxc151355 uint8_t so_val[DLD_SECOBJ_VAL_MAX]; 1363147Sxc151355 uint_t so_len; 1373147Sxc151355 } dld_secobj_t; 1383147Sxc151355 1393147Sxc151355 #define DLDIOCSECOBJSET (DLDIOC | 0x05) 1403147Sxc151355 typedef struct dld_ioc_secobj_set { 1413147Sxc151355 dld_secobj_t ss_obj; 1423147Sxc151355 uint_t ss_flags; 1433147Sxc151355 } dld_ioc_secobj_set_t; 1443147Sxc151355 1453147Sxc151355 #define DLDIOCSECOBJGET (DLDIOC | 0x06) 1463147Sxc151355 typedef struct dld_ioc_secobj_get { 1473147Sxc151355 dld_secobj_t sg_obj; 1483147Sxc151355 uint_t sg_count; 1493147Sxc151355 } dld_ioc_secobj_get_t; 1503147Sxc151355 1513147Sxc151355 #define DLDIOCSECOBJUNSET (DLDIOC | 0x07) 1523147Sxc151355 typedef struct dld_ioc_secobj_unset { 1533147Sxc151355 char su_name[DLD_SECOBJ_NAME_MAX]; 1543147Sxc151355 } dld_ioc_secobj_unset_t; 1553147Sxc151355 1563448Sdh155122 /* 1573448Sdh155122 * DLDIOCHOLDVLAN/DLDIOCRELEVLAN are added to support a "hold/release" 1583448Sdh155122 * operation on a VLAN. A hold will cause a VLAN to be created or the 1593448Sdh155122 * reference count will be increased, release will do the reverse. 1603448Sdh155122 */ 1613448Sdh155122 #define DLDIOCHOLDVLAN (DLDIOC | 0x08) 1623448Sdh155122 1633448Sdh155122 #define DLDIOCRELEVLAN (DLDIOC | 0x09) 1643448Sdh155122 1653448Sdh155122 #define DLDIOCZIDGET (DLDIOC | 0x0a) 1663448Sdh155122 167269Sericheng #ifdef _KERNEL 168269Sericheng int dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **); 169269Sericheng int dld_open(queue_t *, dev_t *, int, int, cred_t *); 170269Sericheng int dld_close(queue_t *); 171269Sericheng void dld_wput(queue_t *, mblk_t *); 172269Sericheng void dld_wsrv(queue_t *); 173269Sericheng void dld_init_ops(struct dev_ops *, const char *); 174269Sericheng void dld_fini_ops(struct dev_ops *); 175269Sericheng #endif 176269Sericheng 1770Sstevel@tonic-gate #ifdef __cplusplus 1780Sstevel@tonic-gate } 1790Sstevel@tonic-gate #endif 1800Sstevel@tonic-gate 1810Sstevel@tonic-gate #endif /* _SYS_DLD_H */ 182