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/sbni/if_sbnivar.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-2001 Granch, Ltd. All rights reserved.
    3  * Author: Denis I.Timofeev <timofeev@granch.ru>
    4  *
    5  * Redistributon 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 unmodified, this list of conditions, and the following
   10  *    disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   23  * LIABILITY, OR TORT (INCLUDING NEIGENCE OR OTHERWISE) ARISING IN ANY WAY
   24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   25  * SUCH DAMAGE.
   26  *
   27  * $FreeBSD: src/sys/dev/sbni/if_sbnivar.h,v 1.1.2.3 2002/08/11 09:32:00 fjoe Exp $
   28  * $DragonFly: src/sys/dev/netif/sbni/if_sbnivar.h,v 1.3 2004/09/15 00:39:53 joerg Exp $
   29  */
   30 
   31 /*
   32  * SBNI12 definitions
   33  */
   34 
   35 #include <sys/ioccom.h>
   36 
   37 /*
   38  * CONFIGURATION PARAMETER:
   39  *
   40  *      Uncomment this if you want to use model SBNI12D-11/ISA with same IRQ
   41  *      for both first and second channels.
   42  */
   43 #define SBNI_DUAL_COMPOUND 1
   44 
   45 #define SBNI_DEBUG 0
   46 
   47 #if SBNI_DEBUG
   48 #define DP(A) A
   49 #else
   50 #define DP(A)
   51 #endif
   52 
   53 struct sbni_in_stats {
   54         u_int32_t       all_rx_number;
   55         u_int32_t       bad_rx_number;
   56         u_int32_t       timeout_number;
   57         u_int32_t       all_tx_number;
   58         u_int32_t       resend_tx_number;
   59 };
   60 
   61 struct sbni_flags {
   62         u_int   mac_addr        : 24;
   63         u_int   rxl             : 4;
   64         u_int   rate            : 2;
   65         u_int   fixed_rxl       : 1;
   66         u_int   fixed_rate      : 1;
   67 };
   68 
   69 
   70 #ifdef _KERNEL  /* to avoid compile this decls with sbniconfig */
   71 
   72 struct sbni_softc {
   73         struct  arpcom arpcom;          /* ethernet common */
   74 
   75         int     io_rid;
   76         struct  resource *io_res;
   77         int     io_off;
   78 
   79         int     irq_rid;
   80         struct  resource *irq_res;
   81         void    *irq_handle;
   82 
   83         struct  mbuf *rx_buf_p;         /* receive buffer ptr */
   84         struct  mbuf *tx_buf_p;         /* transmit buffer ptr */
   85         
   86         u_int   pktlen;                 /* length of transmitting pkt */
   87         u_int   framelen;               /* current frame length */
   88         u_int   maxframe;               /* maximum valid frame length */
   89         u_int   state;
   90         u_int   inppos;                 /* positions in rx/tx buffers */
   91         u_int   outpos;                 /* positions in rx/tx buffers */
   92 
   93         /* transmitting frame number - from frames qty to 1 */
   94         u_int   tx_frameno;
   95 
   96         /* expected number of next receiving frame */
   97         u_int   wait_frameno;
   98 
   99         /* count of failed attempts to frame send - 32 attempts do before
  100            error - while receiver tunes on opposite side of wire */
  101         u_int   trans_errors;
  102 
  103         /* idle time; send pong when limit exceeded */
  104         u_int   timer_ticks;
  105 
  106         /* fields used for receive level autoselection */
  107         int     delta_rxl;
  108         u_int   cur_rxl_index;
  109         u_int   timeout_rxl;
  110         u_int32_t       cur_rxl_rcvd;
  111         u_int32_t       prev_rxl_rcvd;
  112 
  113         struct  sbni_csr1 csr1;                 /* current value of CSR1 */
  114         struct  sbni_in_stats in_stats;         /* internal statistics */ 
  115 
  116         struct  callout sbni_stat_timer;
  117 
  118         struct  sbni_softc *slave_sc;
  119 
  120 #ifdef SBNI_DUAL_COMPOUND
  121         struct  sbni_softc *link;
  122 #endif
  123 };
  124 
  125 void    sbni_intr(void *);
  126 int     sbni_probe(struct sbni_softc *);
  127 void    sbni_attach(struct sbni_softc *, int, struct sbni_flags);
  128 
  129 extern u_int32_t next_sbni_unit;
  130 
  131 #ifdef SBNI_DUAL_COMPOUND
  132 extern struct sbni_softc *sbni_headlist;
  133 
  134 struct sbni_softc       *connect_to_master(struct sbni_softc *);
  135 #endif
  136 #endif  /* _KERNEL */
  137 
  138 /*
  139  * SBNI socket ioctl params
  140  */
  141 #define SIOCGHWFLAGS    _IOWR('i', 62, struct ifreq)    /* get flags */
  142 #define SIOCSHWFLAGS    _IOWR('i', 61, struct ifreq)    /* set flags */
  143 #define SIOCGINSTATS    _IOWR('i', 60, struct ifreq)    /* get internal stats */
  144 #define SIOCRINSTATS    _IOWR('i', 63, struct ifreq)    /* reset internal stats */
  145 
  146 
  147 /*
  148  * CRC-32 stuff
  149  */
  150 #define CRC32(c,crc) (crc32tab[((size_t)(crc) ^ (c)) & 0xff] ^ (((crc) >> 8) & 0x00ffffff))
  151       /* CRC generator EDB88320 */
  152       /* CRC remainder 2144DF1C */
  153       /* CRC initial value 0 */
  154 #define CRC32_REMAINDER 0x2144df1c
  155 #define CRC32_INITIAL 0x00000000

Cache object: fff9e7f700679fb1c7836545304ab21b


[ 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.