diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2013-09-30 21:54:53 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2013-09-30 21:54:53 +0000 |
commit | 09f6bcf727008c2f65e4d692bf54627d4066c247 (patch) | |
tree | 84c09c52e50ba2b48ec6f65c467b1ac6fbb5acab /usr/src/uts/common/sys | |
parent | 6e9b3f5c7960aff925cedb83f71a64c153f8d89d (diff) | |
download | illumos-joyent-09f6bcf727008c2f65e4d692bf54627d4066c247.tar.gz |
OS-2495 add support for multiple mac addresses per client
Diffstat (limited to 'usr/src/uts/common/sys')
-rw-r--r-- | usr/src/uts/common/sys/mac.h | 15 | ||||
-rw-r--r-- | usr/src/uts/common/sys/mac_client.h | 5 | ||||
-rw-r--r-- | usr/src/uts/common/sys/mac_client_priv.h | 4 | ||||
-rw-r--r-- | usr/src/uts/common/sys/vnic_impl.h | 10 |
4 files changed, 28 insertions, 6 deletions
diff --git a/usr/src/uts/common/sys/mac.h b/usr/src/uts/common/sys/mac.h index 220446af65..38049b991e 100644 --- a/usr/src/uts/common/sys/mac.h +++ b/usr/src/uts/common/sys/mac.h @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, Joyent, Inc. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ #ifndef _SYS_MAC_H @@ -129,6 +129,13 @@ typedef struct mac_propval_range_s { */ #define MAXMACADDRLEN 20 +#define MPT_MAXMACADDR 32 + +typedef struct mac_secondary_addr_s { + uint32_t ms_addrcnt; + uint8_t ms_addrs[MPT_MAXMACADDR][MAXMACADDRLEN]; +} mac_secondary_addr_t; + typedef enum { MAC_LOGTYPE_LINK = 1, MAC_LOGTYPE_FLOW @@ -207,6 +214,7 @@ typedef enum { MAC_PROP_MAX_TXHWCLNT_AVAIL, MAC_PROP_IB_LINKMODE, MAC_PROP_VN_PROMISC_FILTERED, + MAC_PROP_SECONDARY_ADDRS, MAC_PROP_PRIVATE = -1 } mac_prop_id_t; @@ -314,13 +322,18 @@ typedef struct mac_info_s { * * This capability allows the MAC layer to detect when a VNIC is being * access, and implement the required shortcuts. + * + * In addition, this capability is used to keep the VNIC's secondary + * mac_clients in sync when the primary MAC is updated. */ typedef void *(*mac_client_handle_fn_t)(void *); +typedef void (*mac_client_update_fn_t)(void *); typedef struct mac_capab_vnic_s { void *mcv_arg; mac_client_handle_fn_t mcv_mac_client_handle; + mac_client_update_fn_t mcv_mac_secondary_update; } mac_capab_vnic_t; typedef void (*mac_rename_fn_t)(const char *, void *); diff --git a/usr/src/uts/common/sys/mac_client.h b/usr/src/uts/common/sys/mac_client.h index 40cd15a1b8..0fc4939503 100644 --- a/usr/src/uts/common/sys/mac_client.h +++ b/usr/src/uts/common/sys/mac_client.h @@ -22,6 +22,7 @@ /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2013 Joyent, Inc. All rights reserved. */ /* @@ -135,6 +136,8 @@ extern void mac_multicast_remove(mac_client_handle_t, const uint8_t *); extern void mac_rx_set(mac_client_handle_t, mac_rx_t, void *); extern void mac_rx_clear(mac_client_handle_t); +extern void mac_secondary_dup(mac_client_handle_t, mac_client_handle_t); +extern void mac_secondary_cleanup(mac_client_handle_t); extern mac_tx_cookie_t mac_tx(mac_client_handle_t, mblk_t *, uintptr_t, uint16_t, mblk_t **); extern boolean_t mac_tx_is_flow_blocked(mac_client_handle_t, mac_tx_cookie_t); @@ -158,6 +161,8 @@ extern int mac_unicast_primary_set(mac_handle_t, const uint8_t *); extern void mac_unicast_primary_get(mac_handle_t, uint8_t *); extern void mac_unicast_primary_info(mac_handle_t, char *, boolean_t *); +extern void mac_unicast_secondary_get(mac_client_handle_t, uint8_t *); + extern boolean_t mac_dst_get(mac_handle_t, uint8_t *); extern int mac_addr_random(mac_client_handle_t, uint_t, uint8_t *, diff --git a/usr/src/uts/common/sys/mac_client_priv.h b/usr/src/uts/common/sys/mac_client_priv.h index 0ddc1f074d..bed2e293b3 100644 --- a/usr/src/uts/common/sys/mac_client_priv.h +++ b/usr/src/uts/common/sys/mac_client_priv.h @@ -22,6 +22,7 @@ /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2013 Joyent, Inc. All rights reserved. */ /* @@ -91,9 +92,6 @@ extern boolean_t mac_client_is_vlan_vnic(mac_client_handle_t); extern void mac_client_poll_enable(mac_client_handle_t); extern void mac_client_poll_disable(mac_client_handle_t); -extern int mac_resource_ctl_set(mac_client_handle_t, mac_resource_props_t *); -extern void mac_resource_ctl_get(mac_client_handle_t, mac_resource_props_t *); - /* * Flow-related APIs for MAC clients. */ diff --git a/usr/src/uts/common/sys/vnic_impl.h b/usr/src/uts/common/sys/vnic_impl.h index 2bb48a60c6..ffaa2939f5 100644 --- a/usr/src/uts/common/sys/vnic_impl.h +++ b/usr/src/uts/common/sys/vnic_impl.h @@ -21,6 +21,7 @@ /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2013 Joyent, Inc. All rights reserved. */ #ifndef _SYS_VNIC_IMPL_H @@ -46,8 +47,10 @@ typedef struct vnic_s { mac_handle_t vn_mh; mac_handle_t vn_lower_mh; - mac_client_handle_t vn_mch; - mac_unicast_handle_t vn_muh; + uint_t vn_nhandles; /* # of secondary mac handles */ + /* The primary handle is always the first element in the array */ + mac_client_handle_t vn_mc_handles[MPT_MAXMACADDR]; + mac_unicast_handle_t vn_mu_handles[MPT_MAXMACADDR]; uint32_t vn_margin; int vn_slot_id; vnic_mac_addr_type_t vn_addr_type; @@ -63,6 +66,9 @@ typedef struct vnic_s { uint32_t vn_hcksum_txflags; } vnic_t; +#define vn_mch vn_mc_handles[0] +#define vn_muh vn_mu_handles[0] + extern int vnic_dev_create(datalink_id_t, datalink_id_t, vnic_mac_addr_type_t *, int *, uchar_t *, int *, uint_t, uint16_t, vrid_t, int, mac_resource_props_t *, uint32_t, vnic_ioc_diag_t *, cred_t *); |