87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * CDDL HEADER START
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * The contents of this file are subject to the terms of the
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * Common Development and Distribution License (the "License").
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * You may not use this file except in compliance with the License.
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * See the License for the specific language governing permissions
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * and limitations under the License.
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * When distributing Covered Code, include this CDDL HEADER in each
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * If applicable, add the following below this CDDL HEADER, with the
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * fields enclosed by brackets "[]" replaced with your own identifying
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * information: Portions Copyright [yyyy] [name of copyright owner]
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * CDDL HEADER END
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * Use is subject to license terms.
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg#pragma ident "%Z%%M% %I% %E% SMI"
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * DL_IB MAC Type plugin for the Nemo mac module
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg "Infiniband MAC Type plugin 1.0"
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * So far, generic stats maintained by GLDv3 are sufficient for IB.
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg if ((err = mactype_unregister(MAC_PLUGIN_IDENT_IB)) != 0)
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * MAC Type plugin operations
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg/* ARGSUSED */
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * The address must not be a multicast address.
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg return (ntohl(ibaddr->ipoib_qpn) == IB_MC_QPN ? EINVAL : 0);
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg uint32_t bcst_gid[3] = { 0x0, 0x0, MAC_IB_BROADCAST_GID };
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * The address must be a multicast address.
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg if ((ntohl(ibaddr->ipoib_qpn) & IB_QPN_MASK) != IB_MC_QPN)
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * The address must not be the broadcast address.
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg if (bcmp(p_gid, (uint8_t *)bcst_gid + sizeof (bcst_gid) -
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg return (0);
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * Check the legality of a SAP value. The following values are
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * allowed, as specified by PSARC 2003/150:
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * min-ethertype-sap (256).. EtherType max(65535) ethertype semantics
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * (0) .. max-802-sap(255) IEEE 802 semantics
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896ggmac_ib_sap_verify(uint32_t sap, uint32_t *bind_sap, void *mac_pdata)
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg if (sap > MAC_IB_MAX_802_SAP && sap <= MAC_IB_ETHERTYPE_MAX) {
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg/* ARGSUSED */
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896ggmac_ib_header(const void *saddr, const void *daddr, uint32_t sap,
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg mp = allocb(sizeof (ib_header_info_t) + extra_len, BPRI_HI);
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg return (mp);
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896ggmac_ib_header_info(mblk_t *mp, void *mac_pdata, mac_header_info_t *hdr_info)
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg if (mac_ib_unicst_verify(hdr_info->mhi_daddr, mac_pdata) == 0) {
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg return (0);
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * Take the provided `mp' (which is expected to have a header "dst + type"),
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * and return a pointer to an mblk_t with a header "GRH + type".
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * If the conversion cannot be performed, return NULL.
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * The plugin framework guarantees that we have the only reference
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * to the mblk_t, so we can safely modify it.
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * Take the provided `mp' (which is expected to have a header "GRH + type"),
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * and return a pointer to an mblk_t with a header "type". If the conversion
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * cannot be performed, return NULL.
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * The plugin framework guarantees that we have the only reference to
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg * the mblk_t and the underlying dblk_t, so we can safely modify it.
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg return (mp);
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896ggmac_ib_link_details(char *buf, size_t sz, mac_handle_t mh, void *mac_pdata)
87ba907dbdcf5c1692d70a9b22fe1d0e718d9896gg /* convert to Mbps */