13147Sxc151355 /* 23147Sxc151355 * CDDL HEADER START 33147Sxc151355 * 43147Sxc151355 * The contents of this file are subject to the terms of the 53147Sxc151355 * Common Development and Distribution License (the "License"). 63147Sxc151355 * You may not use this file except in compliance with the License. 73147Sxc151355 * 83147Sxc151355 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 93147Sxc151355 * or http://www.opensolaris.org/os/licensing. 103147Sxc151355 * See the License for the specific language governing permissions 113147Sxc151355 * and limitations under the License. 123147Sxc151355 * 133147Sxc151355 * When distributing Covered Code, include this CDDL HEADER in each 143147Sxc151355 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 153147Sxc151355 * If applicable, add the following below this CDDL HEADER, with the 163147Sxc151355 * fields enclosed by brackets "[]" replaced with your own identifying 173147Sxc151355 * information: Portions Copyright [yyyy] [name of copyright owner] 183147Sxc151355 * 193147Sxc151355 * CDDL HEADER END 203147Sxc151355 */ 213147Sxc151355 /* 225895Syz147064 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 233147Sxc151355 * Use is subject to license terms. 243147Sxc151355 */ 253147Sxc151355 263147Sxc151355 #ifndef _LIBDLADM_IMPL_H 273147Sxc151355 #define _LIBDLADM_IMPL_H 283147Sxc151355 293147Sxc151355 #include <libdladm.h> 303147Sxc151355 #include <stdio.h> 313147Sxc151355 323147Sxc151355 #ifdef __cplusplus 333147Sxc151355 extern "C" { 343147Sxc151355 #endif 353147Sxc151355 363147Sxc151355 #define MAXLINELEN 1024 373147Sxc151355 #define BUFLEN(lim, ptr) (((lim) > (ptr)) ? ((lim) - (ptr)) : 0) 383147Sxc151355 393147Sxc151355 extern dladm_status_t dladm_errno2status(int); 405895Syz147064 extern dladm_status_t i_dladm_rw_db(const char *, mode_t, 413147Sxc151355 dladm_status_t (*)(void *, FILE *, FILE *), 423147Sxc151355 void *, boolean_t); 433147Sxc151355 44*8275SEric Cheng extern const char *dladm_pri2str(mac_priority_level_t, char *); 45*8275SEric Cheng extern dladm_status_t dladm_str2pri(char *, mac_priority_level_t *); 46*8275SEric Cheng extern dladm_status_t dladm_parse_args(char *, dladm_arg_list_t **, 47*8275SEric Cheng boolean_t); 48*8275SEric Cheng extern void dladm_free_args(dladm_arg_list_t *); 49*8275SEric Cheng 505895Syz147064 /* 515895Syz147064 * Link attributes persisted by dlmgmtd. 525895Syz147064 */ 535895Syz147064 /* 545895Syz147064 * Set for VLANs only 555895Syz147064 */ 565895Syz147064 #define FVLANID "vid" /* uint64_t */ 575895Syz147064 #define FLINKOVER "linkover" /* uint64_t */ 585895Syz147064 595895Syz147064 /* 605895Syz147064 * Set for AGGRs only 615895Syz147064 */ 625895Syz147064 #define FKEY "key" /* uint64_t */ 635895Syz147064 #define FNPORTS "nports" /* uint64_t */ 645895Syz147064 #define FPORTS "portnames" /* string */ 655895Syz147064 #define FPOLICY "policy" /* uint64_t */ 665895Syz147064 #define FFIXMACADDR "fix_macaddr" /* boolean_t */ 675895Syz147064 #define FFORCE "force" /* boolean_t */ 685895Syz147064 #define FLACPMODE "lacp_mode" /* uint64_t */ 695895Syz147064 #define FLACPTIMER "lacp_timer" /* uint64_t */ 705895Syz147064 71*8275SEric Cheng /* 72*8275SEric Cheng * Set for VNICs only 73*8275SEric Cheng */ 74*8275SEric Cheng #define FMADDRTYPE "maddrtype" /* uint64_t */ 75*8275SEric Cheng #define FMADDRLEN "maddrlen" /* uint64_t */ 76*8275SEric Cheng #define FMADDRSLOT "maddrslot" /* uint64_t */ 77*8275SEric Cheng #define FMADDRPREFIXLEN "maddrpreflen" /* uint64_t */ 78*8275SEric Cheng #define FHWRINGS "hwrings" /* boolean_t */ 79*8275SEric Cheng 80*8275SEric Cheng /* 81*8275SEric Cheng * Common fields 82*8275SEric Cheng */ 83*8275SEric Cheng #define FMACADDR "macaddr" /* string */ 84*8275SEric Cheng 85*8275SEric Cheng /* 86*8275SEric Cheng * Data structures used for implementing temporary properties 87*8275SEric Cheng */ 88*8275SEric Cheng 89*8275SEric Cheng typedef struct val_desc { 90*8275SEric Cheng char *vd_name; 91*8275SEric Cheng uintptr_t vd_val; 92*8275SEric Cheng } val_desc_t; 93*8275SEric Cheng 94*8275SEric Cheng #define VALCNT(vals) (sizeof ((vals)) / sizeof (val_desc_t)) 95*8275SEric Cheng 96*8275SEric Cheng extern dladm_status_t dladm_link_proplist_extract(dladm_arg_list_t *, 97*8275SEric Cheng mac_resource_props_t *); 98*8275SEric Cheng 99*8275SEric Cheng extern dladm_status_t dladm_flow_proplist_extract(dladm_arg_list_t *, 100*8275SEric Cheng mac_resource_props_t *); 101*8275SEric Cheng 102*8275SEric Cheng /* 103*8275SEric Cheng * The prop extract() callback. 104*8275SEric Cheng * 105*8275SEric Cheng * rp_extract extracts the kernel structure from the val_desc_t created 106*8275SEric Cheng * by the pd_check function. 107*8275SEric Cheng */ 108*8275SEric Cheng typedef dladm_status_t rp_extractf_t(val_desc_t *propval, void *arg, 109*8275SEric Cheng uint_t cnt); 110*8275SEric Cheng extern rp_extractf_t do_extract_maxbw, do_extract_priority, 111*8275SEric Cheng do_extract_cpus; 112*8275SEric Cheng 113*8275SEric Cheng typedef struct resource_prop_s { 114*8275SEric Cheng /* 115*8275SEric Cheng * resource property name 116*8275SEric Cheng */ 117*8275SEric Cheng char *rp_name; 118*8275SEric Cheng 119*8275SEric Cheng /* 120*8275SEric Cheng * callback to extract kernel structure 121*8275SEric Cheng */ 122*8275SEric Cheng rp_extractf_t *rp_extract; 123*8275SEric Cheng } resource_prop_t; 124*8275SEric Cheng 1253147Sxc151355 #ifdef __cplusplus 1263147Sxc151355 } 1273147Sxc151355 #endif 1283147Sxc151355 1293147Sxc151355 #endif /* _LIBDLADM_IMPL_H */ 130