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/ic/rrunnervar.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 /*      $NetBSD: rrunnervar.h,v 1.7 2002/07/24 19:34:57 hannken Exp $   */
    2 
    3 /* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
    4  * All rights reserved.
    5  *
    6  * This code contributed to The NetBSD Foundation by Kevin M. Lahey
    7  * of the Numerical Aerospace Simulation Facility, NASA Ames Research 
    8  * Center.
    9  *
   10  * Partially based on a HIPPI driver written by Essential Communications 
   11  * Corporation.  Thanks to Jason Thorpe, Matt Jacob, and Fred Templin
   12  * for invaluable advice and encouragement!
   13  *
   14  * Redistribution and use in source and binary forms, with or without
   15  * modification, are permitted provided that the following conditions
   16  * are met:
   17  * 1. Redistributions of source code must retain the above copyright
   18  *    notice, this list of conditions and the following disclaimer.
   19  * 2. Redistributions in binary form must reproduce the above copyright
   20  *    notice, this list of conditions and the following disclaimer in the
   21  *    documentation and/or other materials provided with the distribution.
   22  * 3. All advertising materials mentioning features or use of this software
   23  *    must display the following acknowledgement:
   24  *      This product includes software developed by the NetBSD
   25  *      Foundation, Inc. and its contributors.
   26  * 4. Neither the name of The NetBSD Foundation nor the names of its
   27  *    contributors may be used to endorse or promote products derived
   28  *    from this software without specific prior written permission.
   29  *
   30  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   31  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   32  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   33  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   34  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   35  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   36  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   37  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   38  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   39  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   40  * POSSIBILITY OF SUCH DAMAGE.
   41  */
   42 
   43 /* RoadRunner software status per interface */
   44 
   45 struct rr_tuning {
   46 
   47         /* Performance tuning registers: */
   48 
   49         u_int32_t               rt_mode_and_status;
   50         u_int32_t               rt_conn_retry_count;
   51         u_int32_t               rt_conn_retry_timer;
   52         u_int32_t               rt_conn_timeout;
   53         u_int32_t               rt_stats_timer;
   54         u_int32_t               rt_interrupt_timer;
   55         u_int32_t               rt_tx_timeout;
   56         u_int32_t               rt_rx_timeout;
   57 
   58         /* DMA performance tuning registers: */
   59 
   60         u_int32_t               rt_pci_state;
   61         u_int32_t               rt_dma_write_state;
   62         u_int32_t               rt_dma_read_state;
   63         u_int32_t               rt_driver_param;
   64 };
   65 
   66 
   67 
   68 struct rr_eeprom {
   69         u_int32_t       ifr_offset;     /* initial offset in bytes */
   70         u_int32_t       ifr_length;     /* length in bytes to write */
   71         u_int32_t       *ifr_buffer;    /* data to be written */
   72 };
   73     
   74 #define EIOCGTUNE   1   /* retrieve tuning */
   75 #define EIOCSTUNE   2   /* set tuning */
   76 #define EIOCGEEPROM 3   /* get eeprom */
   77 #define EIOCSEEPROM 4   /* set eeprom */
   78 #define EIOCGSTATS  5   /* get statistics */
   79 #define EIOCRESET   6   /* reset the card */
   80 
   81 #ifdef _KERNEL
   82 
   83 /* Per-ring information for the SNAP (network) receive ring */
   84 
   85 struct esh_snap_ring_ctl {
   86         bus_dmamap_t ec_dma[RR_MAX_DESCR];
   87         struct mbuf *ec_m[RR_MAX_DESCR];
   88         struct mbuf *ec_cur_pkt;        /* current packet being processed */
   89         struct mbuf *ec_cur_mbuf;       /* current mbuf being processed */
   90         int ec_error;                   /* encountered error? */
   91         u_int16_t ec_producer;          /* latest buffer driver produced */
   92         u_int16_t ec_consumer;          /* latest buffer runcode consumed */
   93         struct rr_descr *ec_descr;      /* array of descriptors for ring */
   94 };
   95 
   96 TAILQ_HEAD(esh_dmainfo_list, esh_dmainfo);
   97 
   98 struct esh_dmainfo {
   99         u_int32_t ed_flags;
  100 #define ESH_DI_BUSY     0x1
  101 #define ESH_DI_READING  0x2
  102         bus_dmamap_t ed_dma;
  103         struct buf *ed_buf;
  104         int ed_read_len;
  105         int ed_error;
  106         TAILQ_ENTRY(esh_dmainfo) ed_list;
  107 };
  108 
  109 struct esh_send_ring_ctl {
  110         bus_dmamap_t ec_dma;            /* dmamap for data to transmit */
  111         int ec_offset;                  /* offset in dmamap to send next */
  112         size_t ec_len;                  /* total length of current buf */
  113         struct mbuf *ec_cur_mbuf;       /* current mbuf being processed */
  114         struct buf *ec_cur_buf;         /* current buf being processed */
  115         struct esh_dmainfo *ec_cur_dmainfo;     
  116                                         /* current dmainfo being processed */
  117         struct bufq_state ec_buf_queue; /* queue of bufs to send */
  118         int ec_error;                   /* encountered error? */
  119         u_int16_t ec_producer;          /* latest buffer driver produced */
  120         u_int16_t ec_consumer;          /* latest buffer runcode consumed */
  121         struct rr_descr *ec_descr;      /* array of descriptors for ring */
  122         struct esh_dmainfo_list ec_di_queue;
  123 };
  124 
  125 struct esh_fp_ring_ctl {
  126         struct esh_dmainfo *ec_dmainfo[RR_MAX_DESCR];
  127         struct esh_dmainfo *ec_cur_dmainfo;
  128         int ec_offset;                  /* offset of current buf */
  129         int ec_error;                   /* encountered error? */
  130         int ec_seen_end;                /* seen the end of the buffer? */
  131         int ec_dmainfo_count;           /* dmainfo buffers in use count */
  132         u_int16_t ec_producer;          /* latest buffer driver produced */
  133         u_int16_t ec_consumer;          /* latest buffer runcode consumed */
  134         u_int32_t ec_read_len;          /* length of packet being read in */
  135         struct rr_descr *ec_descr;      /* array of descriptors for ring */
  136         struct esh_dmainfo_list ec_queue;
  137         u_int ec_ulp;                   /* ULP for this ring */
  138         int ec_index;                   /* index into list of active rings */
  139         bus_dmamap_t ec_dma;
  140         bus_dma_segment_t ec_dmaseg;
  141 };
  142 
  143 
  144 struct esh_softc {
  145         struct device           sc_dev;
  146         struct ifnet            sc_if;
  147         struct ifmedia          sc_media;
  148 
  149         volatile int            sc_flags;
  150 #define ESH_FL_INITIALIZING     0x001
  151 #define ESH_FL_INITIALIZED      0x002
  152 #define ESH_FL_RUNCODE_UP       0x004
  153 #define ESH_FL_LINK_UP          0x008
  154 #define ESH_FL_SNAP_RING_UP     0x010
  155 #define ESH_FL_FP_RING_UP       0x020
  156 #define ESH_FL_EEPROM_BUSY      0x040
  157 #define ESH_FL_FP_OPEN          0x080
  158 #define ESH_FL_CRASHED          0x100
  159 #define ESH_FL_CLOSING_SNAP     0x200
  160 
  161         void                    *sc_ih;
  162 
  163         bus_space_tag_t         sc_iot;      /* bus cookie      */
  164         bus_space_handle_t      sc_ioh;      /* bus i/o handle  */
  165 
  166         bus_dma_tag_t           sc_dmat;     /* dma tag */
  167 
  168         bus_dma_segment_t       sc_dmaseg;   /* segment holding the various 
  169                                                 data structures in host memory
  170                                                 that are DMA'ed to the NIC */
  171         bus_dmamap_t            sc_dma;      /* dma map for the segment */
  172         caddr_t                 sc_dma_addr; /* address in kernel of DMA mem */
  173         bus_size_t              sc_dma_size; /* size of dma-able region */
  174 
  175         u_int8_t        (*sc_bist_read) __P((struct esh_softc *));
  176         void            (*sc_bist_write) __P((struct esh_softc *, u_int8_t));
  177 
  178         /* 
  179          * Definitions for the various driver structures that sit in host
  180          * memory and are read by the NIC via DMA:
  181          */
  182 
  183         struct rr_gen_info      *sc_gen_info;   /* gen info block pointer */
  184         bus_addr_t              sc_gen_info_dma;
  185     
  186         struct rr_ring_ctl      *sc_recv_ring_table;
  187         bus_addr_t              sc_recv_ring_table_dma;
  188 
  189         struct rr_event         *sc_event_ring;
  190         bus_addr_t              sc_event_ring_dma;
  191 
  192         struct rr_descr         *sc_send_ring;
  193         struct rr2_descr        *sc2_send_ring;
  194         bus_addr_t              sc_send_ring_dma;
  195 
  196         struct rr_descr         *sc_snap_recv_ring;
  197         struct rr2_descr        *sc2_snap_recv_ring;
  198         bus_addr_t              sc_snap_recv_ring_dma;
  199 
  200         /*
  201          * Control structures for the various rings that we definitely
  202          * know we want to keep track of.
  203          */
  204 
  205         struct esh_send_ring_ctl
  206                                 sc_send;
  207         struct esh_snap_ring_ctl
  208                                 sc_snap_recv;
  209         struct esh_fp_ring_ctl  *sc_fp_recv[RR_ULP_COUNT];
  210         struct esh_fp_ring_ctl  *sc_fp_recv_index[RR_MAX_RECV_RING];
  211         int                     sc_event_consumer;
  212         int                     sc_event_producer;
  213         int                     sc_cmd_consumer;
  214         int                     sc_cmd_producer;
  215 
  216         /*
  217          * Various maintainance values we need
  218          */
  219 
  220         int                     sc_watchdog;
  221 
  222         /*
  223          * Various hardware parameters we need to keep track of.
  224          */
  225 
  226         u_int32_t               sc_sram_size;
  227         u_int32_t               sc_runcode_start;
  228         u_int32_t               sc_runcode_version;
  229         u_int32_t               sc_version; /* interface of runcode (1 or 2) */
  230         u_int16_t               sc_options; /* options in current RunCode */
  231         u_int                   sc_max_rings;
  232 
  233         u_int32_t               sc_pci_latency;
  234         u_int32_t               sc_pci_lat_gnt;
  235         u_int32_t               sc_pci_cache_line;
  236 
  237         /* ULA assigned to hardware */
  238 
  239         u_int8_t                sc_ula[6];
  240 
  241         /* Tuning parameters */
  242 
  243         struct rr_tuning        sc_tune;
  244 
  245         /* Measure of how ugly this is. */
  246 
  247         u_int32_t               sc_misaligned_bufs;
  248         u_int32_t               sc_bad_lens;
  249 
  250         struct esh_dmainfo_list sc_dmainfo_freelist;
  251         u_int                   sc_dmainfo_freelist_count;
  252         u_int                   sc_fp_rings;
  253 };
  254 
  255 void    eshconfig __P((struct esh_softc *));
  256 int     eshintr __P((void *));
  257 #endif /* _KERNEL */
  258 
  259 /* Define a few constants for future use */
  260 
  261 #define ESH_MAX_NSEGS                   512     /* room for 2MB of data */
  262 #define ESH_STATS_TIMER_DEFAULT         1030900  
  263         /* 1000000 usecs / 0.97 usecs/tick */
  264 
  265 #define NEXT_EVENT(i)  (((i) + 1) & (RR_EVENT_RING_SIZE - 1))
  266 #define NEXT_SEND(i)  (((i) + 1) & (RR_SEND_RING_SIZE - 1))
  267 #define NEXT_RECV(i)  (((i) + 1) & (RR_SNAP_RECV_RING_SIZE - 1))
  268 
  269 #define PREV_SEND(i)  (((i) + RR_SEND_RING_SIZE - 1) & (RR_SEND_RING_SIZE - 1))
  270 #define PREV_RECV(i)  \
  271         (((i) + RR_SNAP_RECV_RING_SIZE - 1) & (RR_SNAP_RECV_RING_SIZE - 1))
  272 

Cache object: c0f20d1aa090f6dc5b761d86a3c05bc9


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