11991Sheppo /* 21991Sheppo * CDDL HEADER START 31991Sheppo * 41991Sheppo * The contents of this file are subject to the terms of the 51991Sheppo * Common Development and Distribution License (the "License"). 61991Sheppo * You may not use this file except in compliance with the License. 71991Sheppo * 81991Sheppo * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 91991Sheppo * or http://www.opensolaris.org/os/licensing. 101991Sheppo * See the License for the specific language governing permissions 111991Sheppo * and limitations under the License. 121991Sheppo * 131991Sheppo * When distributing Covered Code, include this CDDL HEADER in each 141991Sheppo * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 151991Sheppo * If applicable, add the following below this CDDL HEADER, with the 161991Sheppo * fields enclosed by brackets "[]" replaced with your own identifying 171991Sheppo * information: Portions Copyright [yyyy] [name of copyright owner] 181991Sheppo * 191991Sheppo * CDDL HEADER END 201991Sheppo */ 211991Sheppo 221991Sheppo /* 23*6419Ssb155480 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 241991Sheppo * Use is subject to license terms. 251991Sheppo */ 261991Sheppo 271991Sheppo #ifndef _VSW_FDB_H 281991Sheppo #define _VSW_FDB_H 291991Sheppo 301991Sheppo #pragma ident "%Z%%M% %I% %E% SMI" 311991Sheppo 321991Sheppo #ifdef __cplusplus 331991Sheppo extern "C" { 341991Sheppo #endif 351991Sheppo 361991Sheppo /* 371991Sheppo * Convert ethernet (mac) address to hash table key. 381991Sheppo */ 391991Sheppo #define KEY_HASH(key, addr) \ 40*6419Ssb155480 (key = ((((uint64_t)(addr)->ether_addr_octet[0]) << 40) | \ 41*6419Ssb155480 (((uint64_t)(addr)->ether_addr_octet[1]) << 32) | \ 42*6419Ssb155480 (((uint64_t)(addr)->ether_addr_octet[2]) << 24) | \ 43*6419Ssb155480 (((uint64_t)(addr)->ether_addr_octet[3]) << 16) | \ 44*6419Ssb155480 (((uint64_t)(addr)->ether_addr_octet[4]) << 8) | \ 45*6419Ssb155480 ((uint64_t)(addr)->ether_addr_octet[5]))); 46*6419Ssb155480 47*6419Ssb155480 #define VLAN_ID_KEY(key) ((mod_hash_key_t)(uintptr_t)(key)) 481991Sheppo 491991Sheppo /* 501991Sheppo * Multicast forwarding database (mFDB) is a hashtable 511991Sheppo * keyed off the mac address, with the value being a linked 521991Sheppo * list of mfdb_ent_t structures, each of which is a destination 531991Sheppo * (either a vsw_port or the vsw instance itself when plumbed as 541991Sheppo * a network device) to which the multicast pkt should be forwarded. 551991Sheppo */ 561991Sheppo typedef struct mfdb_ent { 571991Sheppo struct mfdb_ent *nextp; /* next entry in list */ 581991Sheppo void *d_addr; /* address of dest */ 591991Sheppo uint8_t d_type; /* destination type */ 601991Sheppo } mfdb_ent_t; 611991Sheppo 62*6419Ssb155480 /* 63*6419Ssb155480 * Forwarding database entry. Each member port of a vsw will have an entry in 64*6419Ssb155480 * the vsw's fdb. Ref count is bumped up while sending a packet destined to a 65*6419Ssb155480 * port corresponding to the fdb entry. 66*6419Ssb155480 */ 67*6419Ssb155480 typedef struct vsw_fdbe { 68*6419Ssb155480 void *portp; /* pointer to the vnet_port */ 69*6419Ssb155480 uint32_t refcnt; /* reference count */ 70*6419Ssb155480 } vsw_fdbe_t; 71*6419Ssb155480 721991Sheppo #ifdef __cplusplus 731991Sheppo } 741991Sheppo #endif 751991Sheppo 761991Sheppo #endif /* _VSW_FDB_H */ 77