d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * CDDL HEADER START
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * The contents of this file are subject to the terms of the
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Common Development and Distribution License (the "License").
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * You may not use this file except in compliance with the License.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * See the License for the specific language governing permissions
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * and limitations under the License.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * When distributing Covered Code, include this CDDL HEADER in each
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * If applicable, add the following below this CDDL HEADER, with the
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * fields enclosed by brackets "[]" replaced with your own identifying
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * information: Portions Copyright [yyyy] [name of copyright owner]
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * CDDL HEADER END
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Use is subject to license terms.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * This file is part of the Chelsio T1 Ethernet driver.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Copyright (C) 2003-2005 Chelsio Communications. All rights reserved.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Solaris Multithreaded STREAMS Chelsio PCI Ethernet Driver.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Interface code
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwstatic ch_esb_t *ch_alloc_small_esbbuf(ch_t *sa, uint32_t i);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwstatic ch_esb_t *ch_alloc_big_esbbuf(ch_t *sa, uint32_t i);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * CPL5 Defines (from netinet/cpl5_commands.h)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwstatic int pe_make_fake_arp(ch_t *chp, unsigned char *arpp);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * May be set in /etc/system to 0 to use default latency timer for 10G.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * See PCI register 0xc definition.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * May be set in /etc/system to 0 to disable hardware checksum for
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * TCP and UDP.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Multiplier for freelist pool.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Each setup struct will call this function to
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * initialize.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw int i = 0;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Need to count the number of times this routine is called
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * because we only want the resources to be allocated once.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * The 7500 has four ports and so this routine can be called
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * once for each port.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * We only want to initialize the line if it is down.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Enable/Disable checksum offloading.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* Notify that HW will do the checksum. */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* Notify that HW will do the checksum. */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* Notify that HW will do the checksum. */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Enable interrupts after starting the SGE so
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * that the SGE is ready to handle interrupts.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * set mtu (either 1500 or bigger)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * get the configured value of the MAC.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw (void) t1_tpi_read(sa, SUNI1x10GEXP_REG_TXXG_CONFIG_1 << 2,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw/* ARGSUSED */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwstatic void
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw mac->ops->enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * turn off interrupts...
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * we can still be running an interrupt thread in sge_data_in().
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * If we are, we'll block on the ch_intr lock
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * output mblk to SGE level and out to the wire.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw cmdQ_ce_t *hmp = &cm[0]; /* head of cm table (may be kmem_alloed) */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw int freeme = 0; /* we have an mblk to free in case of error */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw uint32_t ch_bind_dma_handle(ch_t *, int, caddr_t, cmdQ_ce_t *,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#if defined(__sparc)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw uint32_t ch_bind_dvma_handle(ch_t *, int, caddr_t, cmdQ_ce_t *,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* make sure data is flushed to physical memory */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw (void) ddi_dma_sync((ddi_dma_handle_t)((tbuf_t *)mp)->tb_dh,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * set a flag so we'll restart upper layer when
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * resources become available.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (1);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#endif /* CONFIG_CHELSIO_T1_OFFLOAD */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* writes from toe will always have CPL header in place */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* PR2928 & PR3309 */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * We assume here that the arp will be
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * contained in one mblk.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * if space in front of packet big enough for CPL
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * header, then use it. We'll allocate an mblk
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * otherwise.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw if ((mp->b_rptr - mp->b_datap->db_base) >= SZ_CPL_TX_PKT) {
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* fill in cpl header */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw while (mp) {
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* skip mlks with no data */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw if (len == 0) {
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * if we've run out of space on stack, then we
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * allocate a temporary buffer to hold the
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * information. This will kill the the performance,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * but since it shouldn't really occur, we can live
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * with it. Since jumbo frames may map multiple
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * descriptors, we reallocate the hmp[] array before
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * we reach the end.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw for (j = 0; j < nseg; j++)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * We've used up ch table on stack
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#if defined(__sparc)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * ran out of space. Gonna bale
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * we may have processed
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * previous mblks and have
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * descriptors. If so, we need
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * to free the meta struct
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * entries before freeing
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * the mblk.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * ran out of space. Gona bale
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * we may have processed previous
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * mblks and have descriptors. If so,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * we need to free the meta struct
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * entries before freeing the mblk.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#else /* defined(__sparc) */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * ran out of space. Gona bale
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * we may have processed previous mblks and
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * have descriptors. If so, we need to free
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * the meta struct entries before freeing
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * the mblk.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#endif /* defined(__sparc) */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * SHOULD NEVER OCCUR, BUT...
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * no data if nseg 0 or
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * nseg 1 and a CPL mblk (CPL mblk only with offload mode)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * and no data
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* we assume that we always have data with one packet */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#if defined(__sparc)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * ran out of space. Gona bale
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * ran out of space. Gona bale
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#else /* defined(__sparc) */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * ran out of space. Gona bale
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#endif /* defined(__sparc) */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * dummy arp message to handle PR3309 & PR2928
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * set a flag so we'll restart upper layer when
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * resources become available.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * unmap the physical addresses allocated earlier.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#if defined(__sparc)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* free the temporary array */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * if we've allocated an mblk above, then we need to free it
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * before returning. This is safe since we haven't done anything to
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * the original message. The caller, gld, will still have a pointer
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * to the original mblk.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* we had to allocate an mblk. Free it. */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* adjust the mblk back to original start */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (rv);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw/* KLUDGE ALERT. HARD WIRED TO PORT ZERO */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw sa->port[0].mac->ops->macaddress_set(sa->port[0].mac, ac_enaddr);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw/* KLUDGE ALERT. HARD WIRED TO PORT ZERO */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwunsigned char *
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw/* KLUDGE ALERT. HARD WIRED TO ONE PORT */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw switch (flag) {
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw case 0: /* turn off promiscuous mode */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw while (*p) {
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw *p = (*p)->cmc_next;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw kmem_free(q, sizeof (*q));
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw p = &(*p)->cmc_next;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: speed - bandwidth of interface
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: intrcnt - # interrupts
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: norcvbuf - # recedived packets dropped by driver
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: oerrors - # bad send packets
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: ierrors - # bad receive packets
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: underrun - # bad underrun xmit packets
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: overrun - # bad overrun recv packets
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: framing - # bad aligned recv packets
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: crc - # bad FCS (crc) recv packets
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: carrier - times carrier was lost
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: collisions - # xmit collisions
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: xcollisions - # xmit pkts dropped due to collisions
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: late - # late xmit collisions
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: defer - # deferred xmit packets
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: xerrs - # xmit dropped packets
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: rerrs - # recv dropped packets
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: toolong - # recv pkts too long
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: runt - # recv runt pkts
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: multixmt - # multicast pkts xmitted
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: multircv - # multicast pkts recved
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: brdcstxmt - # broadcast pkts xmitted
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * return: brdcstrcv - # broadcast pkts rcv
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwpe_get_stats(ch_t *sa, uint64_t *speed, uint32_t *intrcnt, uint32_t *norcvbuf,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw uint32_t *oerrors, uint32_t *ierrors, uint32_t *underrun,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw uint32_t *carrier, uint32_t *collisions, uint32_t *xcollisions,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw uint32_t *late, uint32_t *defer, uint32_t *xerrs, uint32_t *rerrs,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw uint32_t *toolong, uint32_t *runt, ulong_t *multixmt, ulong_t *multircv,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * kludge to get 10,000,000,000 constant (and keep
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * compiler happy).
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw v = 10000000;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw v *= 1000;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw sp = sa->port[0].mac->ops->statistics_update(sa->port[0].mac,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * not sure this is correct. # aborted at driver level +
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * # at hardware level
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw *oerrors = sa->oerr + sp->TxFramesAbortedDueToXSCollisions +
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw *rerrs = sp->RxSymbolErrors + sp->RxSequenceErrors + sp->RxRuntErrors +
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (1);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_gtm = 0; /* Default: Global Tunnel Mode off */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_global_config = 0x07000000; /* Default: errors, warnings, status */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_link_speed = PE_LINK_SPEED_AUTONEG; /* Default: auto-negoiate */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_tp_reset_cm = 1; /* Default: reset CM memory map */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_phy_tx_fifo = 0; /* Default: 0 phy tx fifo depth */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_phy_rx_fifo = 0; /* Default: 0 phy rx fifo depth */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_phy_force_master = 1; /* Default: link always master mode */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_mc5_rtbl_size = 2048; /* Default: TCAM routing table size */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_mc5_dbsvr_size = 128; /* Default: TCAM server size */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_mc5_parity = 1; /* Default: parity error checking */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_mc5_issue_syn = 0; /* Default: Allow transaction overlap */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_packet_tracing = 0; /* Default: no packet tracing */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_offload_ip_cksum = 0; /* Default: no checksum offloading */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_offload_udp_cksum = 1; /* Default: offload UDP ckecksum */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_offload_tcp_cksum = 1; /* Default: offload TCP checksum */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_sge_cmdq_threshold = 0; /* Default: threshold 0 */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_sge_flq_threshold = 0; /* Default: SGE flq threshold */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_sge_cmdq0_cnt = /* Default: cmd queue 0 size */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_sge_cmdq1_cnt = /* Default: cmd queue 1 size */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_sge_flq0_cnt = /* Default: free list queue-0 length */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_sge_flq1_cnt = /* Default: free list queue-1 length */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_sge_respq_cnt = /* Default: reqsponse queue size */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_stats = 1; /* Default: Automatic Update MAC stats */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_tx_delay_us = 0; /* Default: No Msec delay to Tx pkts */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwint32_t ch_chip = -1; /* Default: use hardware lookup tbl */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_exit_early = 0; /* Default: complete initialization */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_rb_num_of_entries = 1000; /* Default: number ring buffer entries */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_rb_size_of_entries = 64; /* Default: ring buffer entry size */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint32_t ch_timer_delay = 0; /* Default: use value from board entry */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw if (bi == 0)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (1);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (1);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (1);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (1);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * We gain significaint performance improvements when we
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * increase the PCI's maximum memory read byte count to
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * 2K(HW doesn't support 4K at this time) and set the PCI's
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * maximum outstanding split transactions to 4. We want to do
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * this for 10G. Done by software utility.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * if the burstsize is set, then use it instead of default
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * if the split transaction count is set, then use it.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * set ralaxed ordering flag as configured in chxge.conf
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * set the latency time to F8 for 10G cards.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Done by software utiltiy.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * update mtu table (regs: 0x404 - 0x420) with bigger values than
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * default.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Clear all interrupts now. Don't enable
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * them until later.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Function succeeded.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * DESC: Read variables set in /boot/loader.conf and save
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * them internally. These internal values are then
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * used to make decisions at run-time on behavior thus
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * allowing a certain level of customization.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * OUT: p_config - pointer to config structure that
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * contains all of the new values.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * RTN: 0 - Success;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw pe_config_data_t *p_config = (pe_config_data_t *)&chp->config_data;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Global Tunnel Mode configuration
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * MC5 configuration.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Link configuration.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * 5-auto-neg 2-1000Gbps; 1-100Gbps; 0-10Gbps
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Catp options
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * SGE configuration.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwstatic const struct board_info *
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw bi = t1_get_board_info_from_ids(device_id, device_subid);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw "The adapter with device_id %d %d is not supported.\n",
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (bi);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * allocate pool of small receive buffers (with vaddr & paddr) and
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * receiver buffer control structure (ch_esb_t *rbp).
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * XXX we should allow better tuning of the # of preallocated
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * free buffers against the # of freelist entries.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw mutex_init(&sa->ch_small_esbl, NULL, MUTEX_DRIVER, sa->ch_icookp);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw for (i = 0; i < size; i++) {
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * add entry to free list
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * add entry to owned list
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (1);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* free whatever we've already allocated */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * allocate pool of receive buffers (with vaddr & paddr) and
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * receiver buffer control structure (ch_esb_t *rbp).
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * XXX we should allow better tuning of the # of preallocated
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * free buffers against the # of freelist entries.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw mutex_init(&sa->ch_big_esbl, NULL, MUTEX_DRIVER, sa->ch_icookp);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw for (i = 0; i < size; i++) {
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * add entry to owned list
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (1);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* free whatever we've already allocated */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * allocate receive buffer structure and dma mapped buffer (SGE_SM_BUF_SZ bytes)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * note that we will DMA at a 2 byte offset for Solaris when checksum offload
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * is enabled.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw rbp = (ch_esb_t *)kmem_zalloc(sizeof (ch_esb_t), KM_SLEEP);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return ((ch_esb_t *)0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw rbp->cs_buf = (caddr_t)ch_alloc_dma_mem(sa, 1, DMA_STREAM|DMA_SMALN,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw SGE_SM_BUF_SZ(sa), &rbp->cs_pa, &rbp->cs_dh, &rbp->cs_ah);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw rbp->cs_buf = (caddr_t)ch_alloc_dma_mem(sa, 0, DMA_STREAM|DMA_SMALN,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw SGE_SM_BUF_SZ(sa), &rbp->cs_pa, &rbp->cs_dh, &rbp->cs_ah);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return ((ch_esb_t *)0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw rbp->cs_frtn.free_func = (void (*)())&ch_small_rbuf_recycle;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * allocate receive buffer structure and dma mapped buffer (SGE_BG_BUF_SZ bytes)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * note that we will DMA at a 2 byte offset for Solaris when checksum offload
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * is enabled.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw rbp = (ch_esb_t *)kmem_zalloc(sizeof (ch_esb_t), KM_SLEEP);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return ((ch_esb_t *)0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw rbp->cs_buf = (caddr_t)ch_alloc_dma_mem(sa, 1, DMA_STREAM|DMA_BGALN,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw SGE_BG_BUF_SZ(sa), &rbp->cs_pa, &rbp->cs_dh, &rbp->cs_ah);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw rbp->cs_buf = (caddr_t)ch_alloc_dma_mem(sa, 0, DMA_STREAM|DMA_BGALN,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw SGE_BG_BUF_SZ(sa), &rbp->cs_pa, &rbp->cs_dh, &rbp->cs_ah);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return ((ch_esb_t *)0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw rbp->cs_frtn.free_func = (void (*)())&ch_big_rbuf_recycle;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * free entries on the receive buffer list.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Now set-up the rest to commit suicide.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* advance head ptr to next entry */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* free private buffer allocated in ch_alloc_esbbuf() */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* free descripter buffer */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* destroy ch_esbl lock */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Now set-up the rest to commit suicide.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* advance head ptr to next entry */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* free private buffer allocated in ch_alloc_esbbuf() */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* free descripter buffer */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* destroy ch_esbl lock */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * free private buffer allocated in ch_alloc_esbbuf()
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * free descripter buffer
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * decrement count of receive buffers freed by callback
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * We decrement here so anyone trying to do fini will
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * only remove the driver once the counts go to 0.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * decrement count of receive buffers freed by callback
1a5e258f5471356ca102c7176637cdce45bac147Josef 'Jeff' Sipek atomic_dec_32(&buffers_in_use[rbp->cs_index]);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * callback function from freeb() when esballoced mblk freed.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * free private buffer allocated in ch_alloc_esbbuf()
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * free descripter buffer
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * decrement count of receive buffers freed by callback
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * We decrement here so anyone trying to do fini will
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * only remove the driver once the counts go to 0.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * decrement count of receive buffers freed by callback
1a5e258f5471356ca102c7176637cdce45bac147Josef 'Jeff' Sipek atomic_dec_32(&buffers_in_use[rbp->cs_index]);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * get a pre-allocated, pre-mapped receive buffer from free list.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * get a pre-allocated, pre-mapped receive buffer from free list.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwstatic void
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* free pool of receive buffers */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Processes elmer0 external interrupts in process context.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwstatic void
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* Now reenable external interrupts */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw t1_write_reg_4(adapter, A_PL_ENABLE, enable | F_PL_INTR_EXT);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Interrupt-context handler for elmer0 external interrupts.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw t1_write_reg_4(adapter, A_PL_ENABLE, enable & ~F_PL_INTR_EXT);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#if defined(__sparc)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw while (cnt--) {
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Write new values to the MTU table. Caller must validate that the new MTUs
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * are in ascending order. params.mtus[] is initialized by init_mtus()
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * called in t1_init_sw_modules().
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwstatic void
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw for (i = 0; i < NMTUS; ++i) {
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * PR2928 & PR3309
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * construct packet in mblk and attach it to sge structure.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw bp = allocb(sizeof (struct fake_arp) + SZ_CPL_TX_PKT, BPRI_HI);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (1);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw bzero(bp->b_rptr, sizeof (struct fake_arp) + SZ_CPL_TX_PKT);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw /* fill in cpl header */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw bcopy(arpp, fap, sizeof (*fap)); /* copy first arp to mblk */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw bp->b_wptr = bp->b_rptr + sizeof (struct fake_arp)+SZ_CPL_TX_PKT;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw return (0);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * PR2928 & PR3309
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * free the fake arp's mblk on sge structure.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * extract ip address of nic from first outgoing arp.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * first copy packet to buffer so we know
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * it will be properly aligned.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw bcopy(arpp, &fap, sizeof (fap)); /* copy first arp to buffer */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw/* ARGSUSED */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwt1_os_link_changed(ch_t *obj, int port_id, int link_status,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Link states should be reported to user
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * whenever it changes
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Link states should be reported to user
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * whenever it changes