diff options
author | Venugopal Iyer <Venu.Iyer@Sun.COM> | 2009-03-12 16:55:17 -0700 |
---|---|---|
committer | Venugopal Iyer <Venu.Iyer@Sun.COM> | 2009-03-12 16:55:17 -0700 |
commit | 4c91d6c6d1d6ebdbbead0feb5d56622622f0498d (patch) | |
tree | fbfabc1bf5dee2220798b0e12581bbd6d2d75100 /usr/src | |
parent | d1f855d73e0bf529109aa3dc1b967fc6ac19b4fc (diff) | |
download | illumos-gate-4c91d6c6d1d6ebdbbead0feb5d56622622f0498d.tar.gz |
6810953 vnic with vid on same physical link failed to ping each other on snv_109
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/uts/common/io/aggr/aggr_grp.c | 7 | ||||
-rw-r--r-- | usr/src/uts/common/io/aggr/aggr_port.c | 6 | ||||
-rw-r--r-- | usr/src/uts/common/io/dls/dls.c | 4 | ||||
-rw-r--r-- | usr/src/uts/common/io/dls/dls_link.c | 1 | ||||
-rw-r--r-- | usr/src/uts/common/io/mac/mac_client.c | 83 | ||||
-rw-r--r-- | usr/src/uts/common/sys/mac_client.h | 26 | ||||
-rw-r--r-- | usr/src/uts/common/xen/io/xnbo.c | 3 | ||||
-rw-r--r-- | usr/src/uts/sun4v/io/vsw_phys.c | 18 |
8 files changed, 91 insertions, 57 deletions
diff --git a/usr/src/uts/common/io/aggr/aggr_grp.c b/usr/src/uts/common/io/aggr/aggr_grp.c index 70bd89320a..8f60cc7024 100644 --- a/usr/src/uts/common/io/aggr/aggr_grp.c +++ b/usr/src/uts/common/io/aggr/aggr_grp.c @@ -2283,8 +2283,9 @@ aggr_set_port_sdu(aggr_grp_t *grp, aggr_port_t *port, uint32_t sdu, } err = mac_set_mtu(port->lp_mh, sdu, old_mtu); try_again: - if (removed && (rv = mac_unicast_primary_add(port->lp_mch, - &port->lp_mah, &diag)) != 0) { + if (removed && (rv = mac_unicast_add(port->lp_mch, NULL, + MAC_UNICAST_PRIMARY | MAC_UNICAST_DISABLE_TX_VID_CHECK, + &port->lp_mah, 0, &diag)) != 0) { /* * following is a workaround for a bug in 'bge' driver. * See CR 6794654 for more information and this work around @@ -2295,7 +2296,7 @@ try_again: goto try_again; } /* - * if mac_unicast_primary_add() failed while setting the MTU, + * if mac_unicast_add() failed while setting the MTU, * detach the port from the group. */ mac_perim_enter_by_mh(port->lp_mh, &mph); diff --git a/usr/src/uts/common/io/aggr/aggr_port.c b/usr/src/uts/common/io/aggr/aggr_port.c index 4097ba335e..4a5307b13f 100644 --- a/usr/src/uts/common/io/aggr/aggr_port.c +++ b/usr/src/uts/common/io/aggr/aggr_port.c @@ -185,8 +185,7 @@ aggr_port_create(aggr_grp_t *grp, const datalink_id_t linkid, boolean_t force, (void) snprintf(client_name, MAXNAMELEN, "%s-%s", aggr_name, port_name); if ((err = mac_client_open(mh, &mch, client_name, - MAC_OPEN_FLAGS_IS_AGGR_PORT | MAC_OPEN_FLAGS_EXCLUSIVE | - MAC_OPEN_FLAGS_DISABLE_TX_VID_CHECK)) != 0) { + MAC_OPEN_FLAGS_IS_AGGR_PORT | MAC_OPEN_FLAGS_EXCLUSIVE)) != 0) { goto fail; } @@ -205,7 +204,8 @@ aggr_port_create(aggr_grp_t *grp, const datalink_id_t linkid, boolean_t force, goto fail; } - if ((err = mac_unicast_primary_add(mch, &mah, &diag)) != 0) { + if ((err = mac_unicast_add(mch, NULL, MAC_UNICAST_PRIMARY | + MAC_UNICAST_DISABLE_TX_VID_CHECK, &mah, 0, &diag)) != 0) { VERIFY(mac_margin_remove(mh, margin) == 0); id_free(aggr_portids, portid); goto fail; diff --git a/usr/src/uts/common/io/dls/dls.c b/usr/src/uts/common/io/dls/dls.c index f7c4731680..e1f5a8dfb6 100644 --- a/usr/src/uts/common/io/dls/dls.c +++ b/usr/src/uts/common/io/dls/dls.c @@ -607,7 +607,9 @@ dls_mac_active_set(dls_link_t *dlp) mac_diag_t diag; /* request the primary MAC address */ - if ((err = mac_unicast_primary_add(dlp->dl_mch, &dlp->dl_mah, + if ((err = mac_unicast_add(dlp->dl_mch, NULL, + MAC_UNICAST_PRIMARY | MAC_UNICAST_TAG_DISABLE | + MAC_UNICAST_DISABLE_TX_VID_CHECK, &dlp->dl_mah, 0, &diag)) != 0) { return (err); } diff --git a/usr/src/uts/common/io/dls/dls_link.c b/usr/src/uts/common/io/dls/dls_link.c index 85aee7fe86..59f6ad611f 100644 --- a/usr/src/uts/common/io/dls/dls_link.c +++ b/usr/src/uts/common/io/dls/dls_link.c @@ -633,7 +633,6 @@ i_dls_link_create(const char *name, dls_link_t **dlpp) ASSERT(dlp->dl_mch == NULL); err = mac_client_open(dlp->dl_mh, &dlp->dl_mch, NULL, - MAC_OPEN_FLAGS_TAG_DISABLE | MAC_OPEN_FLAGS_DISABLE_TX_VID_CHECK | MAC_OPEN_FLAGS_USE_DATALINK_NAME); if (err != 0) goto bail; diff --git a/usr/src/uts/common/io/mac/mac_client.c b/usr/src/uts/common/io/mac/mac_client.c index 201fd00c65..5101d72948 100644 --- a/usr/src/uts/common/io/mac/mac_client.c +++ b/usr/src/uts/common/io/mac/mac_client.c @@ -1191,15 +1191,6 @@ mac_client_open(mac_handle_t mh, mac_client_handle_t *mchp, char *name, if ((flags & MAC_OPEN_FLAGS_IS_AGGR_PORT) != 0) mcip->mci_state_flags |= MCIS_IS_AGGR_PORT; - if ((flags & MAC_OPEN_FLAGS_TAG_DISABLE) != 0) - mcip->mci_state_flags |= MCIS_TAG_DISABLE; - - if ((flags & MAC_OPEN_FLAGS_STRIP_DISABLE) != 0) - mcip->mci_state_flags |= MCIS_STRIP_DISABLE; - - if ((flags & MAC_OPEN_FLAGS_DISABLE_TX_VID_CHECK) != 0) - mcip->mci_state_flags |= MCIS_DISABLE_TX_VID_CHECK; - if ((flags & MAC_OPEN_FLAGS_USE_DATALINK_NAME) != 0) { datalink_id_t linkid; @@ -1681,6 +1672,16 @@ i_mac_unicast_add(mac_client_handle_t mch, uint8_t *mac_addr, uint16_t flags, */ ASSERT(mcip->mci_unicast != NULL); + /* Check for VLAN flags, if present */ + if ((flags & MAC_UNICAST_TAG_DISABLE) != 0) + mcip->mci_state_flags |= MCIS_TAG_DISABLE; + + if ((flags & MAC_UNICAST_STRIP_DISABLE) != 0) + mcip->mci_state_flags |= MCIS_STRIP_DISABLE; + + if ((flags & MAC_UNICAST_DISABLE_TX_VID_CHECK) != 0) + mcip->mci_state_flags |= MCIS_DISABLE_TX_VID_CHECK; + /* * Ensure that the primary unicast address of the VNIC * is added only once. @@ -1813,6 +1814,16 @@ i_mac_unicast_add(mac_client_handle_t mch, uint8_t *mac_addr, uint16_t flags, mcip->mci_state_flags |= MCIS_UNICAST_HW; } + /* Check for VLAN flags, if present */ + if ((flags & MAC_UNICAST_TAG_DISABLE) != 0) + mcip->mci_state_flags |= MCIS_TAG_DISABLE; + + if ((flags & MAC_UNICAST_STRIP_DISABLE) != 0) + mcip->mci_state_flags |= MCIS_STRIP_DISABLE; + + if ((flags & MAC_UNICAST_DISABLE_TX_VID_CHECK) != 0) + mcip->mci_state_flags |= MCIS_DISABLE_TX_VID_CHECK; + MAC_CLIENT_SET_PRIORITY_RANGE(mcip, (mrp.mrp_mask & MRP_PRIORITY) ? mrp.mrp_priority : MPL_LINK_DEFAULT); @@ -1854,6 +1865,25 @@ i_mac_unicast_add(mac_client_handle_t mch, uint8_t *mac_addr, uint16_t flags, * the fdesc, everything will be used from in the 1st flent. */ + /* + * Assert that the specified flags are consistent with the + * flags specified by previous calls to mac_unicast_add(). + */ + ASSERT(((flags & MAC_UNICAST_TAG_DISABLE) != 0 && + (mcip->mci_state_flags & MCIS_TAG_DISABLE) != 0) || + ((flags & MAC_UNICAST_TAG_DISABLE) == 0 && + (mcip->mci_state_flags & MCIS_TAG_DISABLE) == 0)); + + ASSERT(((flags & MAC_UNICAST_STRIP_DISABLE) != 0 && + (mcip->mci_state_flags & MCIS_STRIP_DISABLE) != 0) || + ((flags & MAC_UNICAST_STRIP_DISABLE) == 0 && + (mcip->mci_state_flags & MCIS_STRIP_DISABLE) == 0)); + + ASSERT(((flags & MAC_UNICAST_DISABLE_TX_VID_CHECK) != 0 && + (mcip->mci_state_flags & MCIS_DISABLE_TX_VID_CHECK) != 0) || + ((flags & MAC_UNICAST_DISABLE_TX_VID_CHECK) == 0 && + (mcip->mci_state_flags & MCIS_DISABLE_TX_VID_CHECK) == 0)); + if (bcmp(mac_addr, map->ma_addr, map->ma_len) != 0) { err = EINVAL; goto bail; @@ -1961,23 +1991,6 @@ mac_unicast_add(mac_client_handle_t mch, uint8_t *mac_addr, uint16_t flags, } /* - * Add the primary MAC address to the MAC client. This is a convenience - * function which can be called by primary MAC clients which do not - * need to specify any other additional flags. - * - * It's called in one of following situations: - * * dls as the primary MAC client - * * aggr as an exclusive client - * * by VNIC's client - */ -int -mac_unicast_primary_add(mac_client_handle_t mch, mac_unicast_handle_t *mah, - mac_diag_t *diag) -{ - return (mac_unicast_add(mch, NULL, MAC_UNICAST_PRIMARY, mah, 0, diag)); -} - -/* * Remove a MAC address which was previously added by mac_unicast_add(). */ int @@ -2004,6 +2017,15 @@ mac_unicast_remove(mac_client_handle_t mch, mac_unicast_handle_t mah) mac_tx_client_flush(mcip); mcip->mci_flags &= ~MAC_CLIENT_FLAGS_VNIC_PRIMARY; + if (mcip->mci_state_flags & MCIS_TAG_DISABLE) + mcip->mci_state_flags &= ~MCIS_TAG_DISABLE; + + if (mcip->mci_state_flags & MCIS_STRIP_DISABLE) + mcip->mci_state_flags &= ~MCIS_STRIP_DISABLE; + + if (mcip->mci_state_flags & MCIS_DISABLE_TX_VID_CHECK) + mcip->mci_state_flags &= ~MCIS_DISABLE_TX_VID_CHECK; + kmem_free(muip, sizeof (mac_unicast_impl_t)); i_mac_perim_exit(mip); return (0); @@ -2152,6 +2174,15 @@ mac_unicast_remove(mac_client_handle_t mch, mac_unicast_handle_t mah) mip->mi_state_flags &= ~MIS_EXCLUSIVE; mcip->mci_state_flags &= ~MCIS_UNICAST_HW; + if (mcip->mci_state_flags & MCIS_TAG_DISABLE) + mcip->mci_state_flags &= ~MCIS_TAG_DISABLE; + + if (mcip->mci_state_flags & MCIS_STRIP_DISABLE) + mcip->mci_state_flags &= ~MCIS_STRIP_DISABLE; + + if (mcip->mci_state_flags & MCIS_DISABLE_TX_VID_CHECK) + mcip->mci_state_flags &= ~MCIS_DISABLE_TX_VID_CHECK; + mac_stop((mac_handle_t)mip); i_mac_perim_exit(mip); diff --git a/usr/src/uts/common/sys/mac_client.h b/usr/src/uts/common/sys/mac_client.h index 04f1f83006..2cb2b588a1 100644 --- a/usr/src/uts/common/sys/mac_client.h +++ b/usr/src/uts/common/sys/mac_client.h @@ -75,22 +75,22 @@ typedef enum { } mac_client_promisc_type_t; /* flags passed to mac_unicast_add() */ -#define MAC_UNICAST_NODUPCHECK 0x0001 -#define MAC_UNICAST_PRIMARY 0x0002 -#define MAC_UNICAST_HW 0x0004 -#define MAC_UNICAST_VNIC_PRIMARY 0x0008 +#define MAC_UNICAST_NODUPCHECK 0x0001 +#define MAC_UNICAST_PRIMARY 0x0002 +#define MAC_UNICAST_HW 0x0004 +#define MAC_UNICAST_VNIC_PRIMARY 0x0008 +#define MAC_UNICAST_TAG_DISABLE 0x0010 +#define MAC_UNICAST_STRIP_DISABLE 0x0020 +#define MAC_UNICAST_DISABLE_TX_VID_CHECK 0x0040 /* flags passed to mac_client_open */ #define MAC_OPEN_FLAGS_IS_VNIC 0x0001 #define MAC_OPEN_FLAGS_EXCLUSIVE 0x0002 -#define MAC_OPEN_FLAGS_TAG_DISABLE 0x0004 -#define MAC_OPEN_FLAGS_IS_AGGR_PORT 0x0008 -#define MAC_OPEN_FLAGS_STRIP_DISABLE 0x0010 -#define MAC_OPEN_FLAGS_NO_HWRINGS 0x0020 -#define MAC_OPEN_FLAGS_SHARES_DESIRED 0x0040 -#define MAC_OPEN_FLAGS_DISABLE_TX_VID_CHECK 0x0080 -#define MAC_OPEN_FLAGS_USE_DATALINK_NAME 0x0100 -#define MAC_OPEN_FLAGS_REQ_HWRINGS 0x0200 +#define MAC_OPEN_FLAGS_IS_AGGR_PORT 0x0004 +#define MAC_OPEN_FLAGS_NO_HWRINGS 0x0008 +#define MAC_OPEN_FLAGS_SHARES_DESIRED 0x0010 +#define MAC_OPEN_FLAGS_USE_DATALINK_NAME 0x0020 +#define MAC_OPEN_FLAGS_REQ_HWRINGS 0x0040 /* flags passed to mac_client_close */ #define MAC_CLOSE_FLAGS_IS_VNIC 0x0001 @@ -113,8 +113,6 @@ extern void mac_client_close(mac_client_handle_t, uint16_t); extern int mac_unicast_add(mac_client_handle_t, uint8_t *, uint16_t, mac_unicast_handle_t *, uint16_t, mac_diag_t *); -extern int mac_unicast_primary_add(mac_client_handle_t, mac_unicast_handle_t *, - mac_diag_t *); extern int mac_unicast_remove(mac_client_handle_t, mac_unicast_handle_t); extern int mac_multicast_add(mac_client_handle_t, const uint8_t *); diff --git a/usr/src/uts/common/xen/io/xnbo.c b/usr/src/uts/common/xen/io/xnbo.c index ee87c067d2..c87569a0f1 100644 --- a/usr/src/uts/common/xen/io/xnbo.c +++ b/usr/src/uts/common/xen/io/xnbo.c @@ -280,7 +280,8 @@ xnbo_open_mac(xnb_t *xnbp, char *mac) return (B_FALSE); } - err = mac_unicast_primary_add(xnbop->o_mch, &xnbop->o_mah, &diag); + err = mac_unicast_add(xnbop->o_mch, NULL, MAC_UNICAST_PRIMARY, + &xnbop->o_mah, 0, &diag); if (err != 0) { cmn_err(CE_WARN, "xnbo_open_mac: " "failed to get the primary MAC address of " diff --git a/usr/src/uts/sun4v/io/vsw_phys.c b/usr/src/uts/sun4v/io/vsw_phys.c index 127e1635c1..cd4f355e42 100644 --- a/usr/src/uts/sun4v/io/vsw_phys.c +++ b/usr/src/uts/sun4v/io/vsw_phys.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -479,11 +479,11 @@ vsw_mac_client_init(vsw_t *vswp, vsw_port_t *port, int type) * MAC layer to allocate a share and corresponding resources * ahead of time. * - * MAC_OPEN_FLAGS_TAG_DISABLE -- This flag is used for VLAN + * MAC_UNICAST_TAG_DISABLE -- This flag is used for VLAN * support. It will cause MAC to not add any tags, but expect * vsw to tag the packets. * - * MAC_OPEN_FLAGS_STRIP_DISABLE -- This flag is used for VLAN + * MAC_UNICAST_STRIP_DISABLE -- This flag is used for VLAN * support. It will case the MAC layer to not strip the tags. * Vsw may have to strip the tag for pvid case. */ @@ -495,9 +495,7 @@ vsw_maccl_open(vsw_t *vswp, vsw_port_t *port, int type) char mac_cl_name[MAXNAMELEN]; const char *dev_name; mac_client_handle_t *mchp; - uint64_t flags = (MAC_OPEN_FLAGS_NO_HWRINGS | - MAC_OPEN_FLAGS_TAG_DISABLE | - MAC_OPEN_FLAGS_STRIP_DISABLE); + uint64_t flags = MAC_OPEN_FLAGS_NO_HWRINGS; ASSERT(MUTEX_HELD(&vswp->mac_lock)); if (vswp->mh == NULL) { @@ -657,11 +655,12 @@ static int vsw_set_port_hw_addr(vsw_port_t *port) { vsw_t *vswp = port->p_vswp; - uint16_t mac_flags = 0; mac_diag_t diag; uint8_t *macaddr; uint16_t vid = VLAN_ID_NONE; int rv; + uint16_t mac_flags = MAC_UNICAST_TAG_DISABLE | + MAC_UNICAST_STRIP_DISABLE; D1(vswp, "%s: enter", __func__); @@ -720,12 +719,13 @@ vsw_set_port_hw_addr(vsw_port_t *port) static int vsw_set_if_hw_addr(vsw_t *vswp) { - uint16_t mac_flags = 0; mac_diag_t diag; uint8_t *macaddr; uint8_t primary_addr[ETHERADDRL]; uint16_t vid = VLAN_ID_NONE; int rv; + uint16_t mac_flags = MAC_UNICAST_TAG_DISABLE | + MAC_UNICAST_STRIP_DISABLE; D1(vswp, "%s: enter", __func__); @@ -1101,6 +1101,8 @@ vsw_mac_add_vlans(vsw_t *vswp, mac_client_handle_t mch, uint8_t *macaddr, int rv; int i; + flags |= MAC_UNICAST_TAG_DISABLE | MAC_UNICAST_STRIP_DISABLE; + /* Add vlans to the MAC layer */ for (i = 0; i < nvids; i++) { vidp = &vids[i]; |