The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/netif/kue/if_kuereg.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 1997, 1998, 1999, 2000
    3  *      Bill Paul <wpaul@ee.columbia.edu>.  All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 3. All advertising materials mentioning features or use of this software
   14  *    must display the following acknowledgement:
   15  *      This product includes software developed by Bill Paul.
   16  * 4. Neither the name of the author nor the names of any co-contributors
   17  *    may be used to endorse or promote products derived from this software
   18  *    without specific prior written permission.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
   21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   23  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
   24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
   30  * THE POSSIBILITY OF SUCH DAMAGE.
   31  *
   32  * $FreeBSD: src/sys/dev/usb/if_kuereg.h,v 1.13 2003/10/04 21:41:01 joe Exp $
   33  * $DragonFly: src/sys/dev/netif/kue/if_kuereg.h,v 1.5 2007/11/05 13:32:27 hasso Exp $
   34  */
   35 
   36 /*
   37  * Definitions for the KLSI KL5KUSB101B USB to ethernet controller.
   38  * The KLSI part is controlled via vendor control requests, the structure
   39  * of which depend a bit on the firmware running on the internal
   40  * microcontroller. The one exception is the 'send scan data' command,
   41  * which is used to load the firmware.
   42  */
   43 
   44 #define KUE_CMD_GET_ETHER_DESCRIPTOR            0x00
   45 #define KUE_CMD_SET_MCAST_FILTERS               0x01
   46 #define KUE_CMD_SET_PKT_FILTER                  0x02
   47 #define KUE_CMD_GET_ETHERSTATS                  0x03
   48 #define KUE_CMD_GET_GPIO                        0x04
   49 #define KUE_CMD_SET_GPIO                        0x05
   50 #define KUE_CMD_SET_MAC                         0x06
   51 #define KUE_CMD_GET_MAC                         0x07
   52 #define KUE_CMD_SET_URB_SIZE                    0x08
   53 #define KUE_CMD_SET_SOFS                        0x09
   54 #define KUE_CMD_SET_EVEN_PKTS                   0x0A
   55 #define KUE_CMD_SEND_SCAN                       0xFF
   56 
   57 struct kue_ether_desc {
   58         u_int8_t                kue_len;
   59         u_int8_t                kue_rsvd0;
   60         u_int8_t                kue_rsvd1;
   61         u_int8_t                kue_macaddr[ETHER_ADDR_LEN];
   62         u_int8_t                kue_etherstats[4];
   63         u_int8_t                kue_maxseg[2];
   64         u_int8_t                kue_mcastfilt[2];
   65         u_int8_t                kue_rsvd2;
   66 };
   67 
   68 #define KUE_ETHERSTATS(x)       \
   69         (*(u_int32_t *)&(x)->kue_desc.kue_etherstats)
   70 #define KUE_MAXSEG(x)           \
   71         (*(u_int16_t *)&(x)->kue_desc.kue_maxseg)
   72 #define KUE_MCFILTCNT(x)        \
   73         ((*(u_int16_t *)&(x)->kue_desc.kue_mcastfilt) & 0x7FFF)
   74 #define KUE_MCFILT(x, y)        \
   75         (char *)&(sc->kue_mcfilters[y * ETHER_ADDR_LEN])
   76 
   77 #define KUE_STAT_TX_OK                  0x00000001
   78 #define KUE_STAT_RX_OK                  0x00000002
   79 #define KUE_STAT_TX_ERR                 0x00000004
   80 #define KUE_STAT_RX_ERR                 0x00000008
   81 #define KUE_STAT_RX_NOBUF               0x00000010
   82 #define KUE_STAT_TX_UCAST_BYTES         0x00000020
   83 #define KUE_STAT_TX_UCAST_FRAMES        0x00000040
   84 #define KUE_STAT_TX_MCAST_BYTES         0x00000080
   85 #define KUE_STAT_TX_MCAST_FRAMES        0x00000100
   86 #define KUE_STAT_TX_BCAST_BYTES         0x00000200
   87 #define KUE_STAT_TX_BCAST_FRAMES        0x00000400
   88 #define KUE_STAT_RX_UCAST_BYTES         0x00000800
   89 #define KUE_STAT_RX_UCAST_FRAMES        0x00001000
   90 #define KUE_STAT_RX_MCAST_BYTES         0x00002000
   91 #define KUE_STAT_RX_MCAST_FRAMES        0x00004000
   92 #define KUE_STAT_RX_BCAST_BYTES         0x00008000
   93 #define KUE_STAT_RX_BCAST_FRAMES        0x00010000
   94 #define KUE_STAT_RX_CRCERR              0x00020000
   95 #define KUE_STAT_TX_QUEUE_LENGTH        0x00040000
   96 #define KUE_STAT_RX_ALIGNERR            0x00080000
   97 #define KUE_STAT_TX_SINGLECOLL          0x00100000
   98 #define KUE_STAT_TX_MULTICOLL           0x00200000
   99 #define KUE_STAT_TX_DEFERRED            0x00400000
  100 #define KUE_STAT_TX_MAXCOLLS            0x00800000
  101 #define KUE_STAT_RX_OVERRUN             0x01000000
  102 #define KUE_STAT_TX_UNDERRUN            0x02000000
  103 #define KUE_STAT_TX_SQE_ERR             0x04000000
  104 #define KUE_STAT_TX_CARRLOSS            0x08000000
  105 #define KUE_STAT_RX_LATECOLL            0x10000000
  106 
  107 #define KUE_RXFILT_PROMISC              0x0001
  108 #define KUE_RXFILT_ALLMULTI             0x0002
  109 #define KUE_RXFILT_UNICAST              0x0004
  110 #define KUE_RXFILT_BROADCAST            0x0008
  111 #define KUE_RXFILT_MULTICAST            0x0010
  112 
  113 #define KUE_TIMEOUT             1000
  114 #define KUE_BUFSZ               1536
  115 #define KUE_MIN_FRAMELEN        60
  116 
  117 #define KUE_RX_LIST_CNT         1
  118 #define KUE_TX_LIST_CNT         1
  119 
  120 #define KUE_CTL_READ            0x01
  121 #define KUE_CTL_WRITE           0x02
  122 
  123 #define KUE_CONFIG_NO           1
  124 #define KUE_IFACE_IDX           0
  125 
  126 /*
  127  * The interrupt endpoint is currently unused
  128  * by the KLSI part.
  129  */
  130 #define KUE_ENDPT_RX            0x0
  131 #define KUE_ENDPT_TX            0x1
  132 #define KUE_ENDPT_INTR          0x2
  133 #define KUE_ENDPT_MAX           0x3
  134 
  135 struct kue_softc;
  136 
  137 struct kue_chain {
  138         struct kue_softc        *kue_sc;
  139         usbd_xfer_handle        kue_xfer;
  140         char                    *kue_buf;
  141         struct mbuf             *kue_mbuf;
  142         int                     kue_idx;
  143 };
  144 
  145 struct kue_cdata {
  146         struct kue_chain        kue_tx_chain[KUE_TX_LIST_CNT];
  147         struct kue_chain        kue_rx_chain[KUE_RX_LIST_CNT];
  148         int                     kue_tx_prod;
  149         int                     kue_tx_cons;
  150         int                     kue_tx_cnt;
  151         int                     kue_rx_prod;
  152 };
  153 
  154 #define KUE_INC(x, y)           (x) = (x + 1) % y
  155 
  156 struct kue_softc {
  157         struct arpcom           arpcom;
  158         usbd_device_handle      kue_udev;
  159         usbd_interface_handle   kue_iface;
  160         struct kue_ether_desc   kue_desc;
  161         int                     kue_ed[KUE_ENDPT_MAX];
  162         usbd_pipe_handle        kue_ep[KUE_ENDPT_MAX];
  163         int                     kue_unit;
  164         int                     kue_if_flags;
  165         u_int16_t               kue_rxfilt;
  166         u_int8_t                *kue_mcfilters;
  167         struct kue_cdata        kue_cdata;
  168 #if defined(__FreeBSD__) && __FreeBSD_version >= 500000
  169         struct mtx              kue_mtx;
  170 #endif
  171         char                    kue_dying;
  172         struct timeval          kue_rx_notice;
  173 };
  174 
  175 #if 0
  176 #define KUE_LOCK(_sc)           mtx_lock(&(_sc)->kue_mtx)
  177 #define KUE_UNLOCK(_sc)         mtx_unlock(&(_sc)->kue_mtx)
  178 #else
  179 #define KUE_LOCK(_sc)
  180 #define KUE_UNLOCK(_sc)
  181 #endif

Cache object: ef94660d0e783040cde4d7845684235a


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.