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/netatm/atm_if.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  *
    3  * ===================================
    4  * HARP  |  Host ATM Research Platform
    5  * ===================================
    6  *
    7  *
    8  * This Host ATM Research Platform ("HARP") file (the "Software") is
    9  * made available by Network Computing Services, Inc. ("NetworkCS")
   10  * "AS IS".  NetworkCS does not provide maintenance, improvements or
   11  * support of any kind.
   12  *
   13  * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
   14  * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
   15  * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
   16  * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
   17  * In no event shall NetworkCS be responsible for any damages, including
   18  * but not limited to consequential damages, arising from or relating to
   19  * any use of the Software or related support.
   20  *
   21  * Copyright 1994-1998 Network Computing Services, Inc.
   22  *
   23  * Copies of this Software may be made, however, the above copyright
   24  * notice must be reproduced on all copies.
   25  *
   26  *      @(#) $FreeBSD$
   27  *
   28  */
   29 
   30 /*
   31  * Core ATM Services
   32  * -----------------
   33  *
   34  * ATM Physical and Network Interface definitions 
   35  *
   36  */
   37 
   38 #ifndef _NETATM_ATM_IF_H
   39 #define _NETATM_ATM_IF_H
   40 
   41 /*
   42  * Handy constants
   43  */
   44 #define ATM_NIF_MTU     9180            /* Default network interface MTU */
   45 
   46 #define ATM_PCR_TAXI100 227273          /* Peak Cell Rate for 100 Mbs TAXI */
   47 #define ATM_PCR_TAXI140 318181          /* Peak Cell Rate for 140 Mbs TAXI */
   48 #define ATM_PCR_OC3C    353207          /* Peak Cell Rate for OC3c */
   49 #define ATM_PCR_OC12C   1416905         /* Peak Cell Rate for OC12c */
   50 
   51 
   52 /*
   53  * Media Access Control (MAC) address
   54  */
   55 struct mac_addr {
   56         u_char          ma_data[6];     /* MAC address */
   57 };
   58 typedef struct mac_addr Mac_addr;
   59 
   60 
   61 /*
   62  * Adapter vendor identifiers
   63  */
   64 enum atm_vendor {
   65         VENDOR_UNKNOWN,                 /* Unknown vendor */
   66         VENDOR_FORE,                    /* FORE Systems, Inc. */
   67         VENDOR_ENI                      /* Efficient Networks, Inc. */
   68 };
   69 typedef enum atm_vendor Atm_vendor;
   70 
   71 
   72 /*
   73  * Adapter vendor interface identifiers
   74  */
   75 enum atm_vendapi {
   76         VENDAPI_UNKNOWN,                /* Unknown interface */
   77         VENDAPI_FORE_1,                 /* FORE - 200 Series */
   78         VENDAPI_ENI_1                   /* ENI - Midway */
   79 };
   80 typedef enum atm_vendapi        Atm_vendapi;
   81 
   82 
   83 /*
   84  * Adapter device model identifiers
   85  */
   86 enum atm_device {
   87         DEV_UNKNOWN,                    /* Unknown device */
   88         DEV_FORE_SBA200E,               /* FORE SBA-200E */
   89         DEV_FORE_SBA200,                /* FORE SBA-200 */
   90         DEV_FORE_PCA200E,               /* FORE PCA-200E */
   91         DEV_ENI_155P                    /* ENI-155p */
   92 };
   93 typedef enum atm_device Atm_device;
   94 
   95 
   96 /*
   97  * Adapter media identifiers
   98  */
   99 enum atm_media {
  100         MEDIA_UNKNOWN,                  /* Unknown media type */
  101         MEDIA_TAXI_100,                 /* TAXI - 100 Mbps */
  102         MEDIA_TAXI_140,                 /* TAXI - 140 Mbps */
  103         MEDIA_OC3C,                     /* OC-3C */
  104         MEDIA_OC12C,                    /* OC-12C */
  105         MEDIA_UTP155                    /* UTP-155 */
  106 };
  107 typedef enum atm_media  Atm_media;
  108 
  109 
  110 /*
  111  * Bus type identifiers
  112  */
  113 enum atm_bus {
  114         BUS_UNKNOWN,                    /* Unknown bus type */
  115         BUS_SBUS_B16,                   /* SBus: 16 byte (4 word) max burst */
  116         BUS_SBUS_B32,                   /* SBus: 32 byte (8 word) max burst */
  117         BUS_PCI                         /* PCI */
  118 };
  119 typedef enum atm_bus    Atm_bus;
  120 
  121 
  122 #define VERSION_LEN     16              /* Length of version info string */
  123 
  124 
  125 /*
  126  * ATM adapter configuration information structure
  127  */
  128 struct atm_config {
  129         Atm_vendor      ac_vendor;      /* Vendor */
  130         Atm_vendapi     ac_vendapi;     /* Vendor interface */
  131         Atm_device      ac_device;      /* Device model */
  132         Atm_media       ac_media;       /* Media type */
  133         u_long          ac_serial;      /* Serial number */
  134         Atm_bus         ac_bustype;     /* Bus type */
  135         u_long          ac_busslot;     /* Bus slot info (bus type dependent) */
  136         u_long          ac_ram;         /* Device ram offset */
  137         u_long          ac_ramsize;     /* Device ram size */
  138         Mac_addr        ac_macaddr;     /* MAC address */
  139         char            ac_hard_vers[VERSION_LEN];      /* Hardware version */
  140         char            ac_firm_vers[VERSION_LEN];      /* Firmware version */
  141 };
  142 typedef struct atm_config       Atm_config;
  143 
  144 
  145 #ifdef ATM_KERNEL
  146 /*
  147  * Common structure used to define each physical ATM device interface.
  148  * This structure will (normally) be embedded at the top of each driver's 
  149  * device-specific interface structure.  
  150  */
  151 struct  atm_pif {
  152         struct atm_pif  *pif_next;      /* Next registered atm interface */
  153         char            *pif_name;      /* Device name */
  154         short           pif_unit;       /* Device unit number */
  155         u_char          pif_flags;      /* Interface flags (see below) */
  156         struct sigmgr   *pif_sigmgr;    /* Signalling Manager for interface */
  157         struct siginst  *pif_siginst;   /* Signalling protocol instance */
  158         struct stack_defn       *pif_services;  /* Interface's stack services */
  159         struct mac_addr pif_macaddr;    /* Interface's MAC address */
  160         struct atm_nif  *pif_nif;       /* List of network interfaces */
  161         struct atm_pif  *pif_grnext;    /* Next atm device in group */
  162 
  163 /* Exported functions */
  164         int             (*pif_ioctl)    /* Interface ioctl handler */
  165                                 __P((int, caddr_t, caddr_t));
  166 
  167 /* Interface statistics */
  168         long            pif_ipdus;      /* PDUs received from interface */
  169         long            pif_opdus;      /* PDUs sent to interface */
  170         long            pif_ibytes;     /* Bytes received from interface */
  171         long            pif_obytes;     /* Bytes sent to interface */
  172         long            pif_ierrors;    /* Errors receiving from interface */
  173         long            pif_oerrors;    /* Errors sending to interface */
  174         long            pif_cmderrors;  /* Interface command errors */
  175         caddr_t         pif_cardstats;  /* Card specific statistics */
  176 
  177 /* Interface capabilities */
  178         u_short         pif_maxvpi;     /* Maximum VPI value supported */
  179         u_short         pif_maxvci;     /* Maximum VCI value supported */
  180         u_int           pif_pcr;        /* Peak Cell Rate */
  181 };
  182 
  183 /*
  184  * Physical interface flags
  185  */
  186 #define PIF_UP          0x01            /* Interface is up */
  187 #define PIF_LOOPBACK    0x02            /* Loopback local packets */
  188 
  189 
  190 /*
  191  * Structure defining an ATM network interface.  This structure is used as 
  192  * the hook between the standard BSD network layer interface mechanism and 
  193  * the ATM device layer.  There may be one or more network interfaces for 
  194  * each physical ATM interface.
  195  */
  196 struct  atm_nif {
  197         struct ifnet    nif_if;         /* Network interface */
  198         struct atm_pif  *nif_pif;       /* Our physical interface */
  199         char            nif_name[IFNAMSIZ];/* Network interface name */
  200         u_char          nif_sel;        /* Interface's address selector */
  201         struct atm_nif  *nif_pnext;     /* Next net interface on phys i/f */
  202 
  203 /* Interface statistics (in addition to ifnet stats) */
  204         long            nif_ibytes;     /* Bytes received from interface */
  205         long            nif_obytes;     /* Bytes sent to interface */
  206 };
  207 
  208 
  209 /*
  210  * Common Device VCC Entry
  211  *
  212  * Contains the common information for each VCC which is opened
  213  * through a particular device.
  214  */
  215 struct cmn_vcc {
  216         struct cmn_vcc  *cv_next;       /* Next in list */
  217         void            *cv_toku;       /* Upper layer's token */
  218         void            (*cv_upper)     /* Upper layer's interface */
  219                                 __P((int, void *, int, int));
  220         Atm_connvc      *cv_connvc;     /* Associated connection VCC */
  221         u_char          cv_state;       /* VCC state (see below) */
  222         u_char          cv_flags;       /* VCC flags (see below) */
  223 };
  224 typedef struct cmn_vcc  Cmn_vcc;
  225 
  226 /*
  227  * VCC States
  228  */
  229 #define CVS_FREE        0               /* Not allocated */
  230 #define CVS_INST        1               /* Instantiated, waiting for INIT */
  231 #define CVS_INITED      2               /* Initialized, waiting for driver */
  232 #define CVS_ACTIVE      3               /* Device activated by driver */
  233 #define CVS_PTERM       4               /* Waiting for TERM */
  234 #define CVS_TERM        5               /* Terminated */
  235 
  236 /*
  237  * VCC Flags
  238  */
  239 #define CVF_RSVD        0x0f            /* Reserved for device-specific use */
  240 
  241 
  242 /*
  243  * Common Device Unit Structure
  244  *
  245  * Contains the common information for a single device (adapter).
  246  */
  247 struct cmn_unit {
  248         struct atm_pif  cu_pif;         /* Physical interface */
  249         u_int           cu_unit;        /* Local unit number */
  250         u_char          cu_flags;       /* Device flags (see below) */
  251         u_int           cu_mtu;         /* Interface MTU */
  252 
  253         u_int           cu_open_vcc;    /* Open VCC count */
  254         Cmn_vcc         *cu_vcc;        /* List of VCC's on interface */
  255 
  256         u_int           cu_intrpri;     /* Highest unit interrupt priority */
  257         int             cu_savepri;     /* Saved priority for locking device */
  258 
  259         struct sp_info  *cu_vcc_pool;   /* Device VCC pool */
  260         struct sp_info  *cu_nif_pool;   /* Device NIF pool */
  261 
  262         int             (*cu_ioctl)     /* Interface ioctl handler */
  263                                 __P((int, caddr_t, caddr_t));
  264         int             (*cu_instvcc)   /* VCC stack instantion handler */
  265                                 __P((struct cmn_unit *, Cmn_vcc *));
  266         int             (*cu_openvcc)   /* Open VCC handler */
  267                                 __P((struct cmn_unit *, Cmn_vcc *));
  268         int             (*cu_closevcc)  /* Close VCC handler */
  269                                 __P((struct cmn_unit *, Cmn_vcc *));
  270         void            (*cu_output)    /* Data output handler */
  271                                 __P((struct cmn_unit *, Cmn_vcc *, KBuffer *));
  272 
  273         Atm_config      cu_config;      /* Device configuration data */
  274 };
  275 typedef struct cmn_unit Cmn_unit;
  276 
  277 /*
  278  * Device flags
  279  */
  280 #define CUF_REGISTER    0x01            /* Device is registered */
  281 #define CUF_INITED      0x02            /* Device is initialized */
  282 
  283 
  284 /*
  285  * Structure used to define a network convergence module and its associated
  286  * entry points.  A convergence module is used to provide the interface
  287  * translations necessary between the ATM system and the BSD network layer
  288  * interface mechanism.  There will be one network convergence module for
  289  * each protocol address family supporting ATM connections.
  290  */
  291 struct atm_ncm {
  292         struct atm_ncm  *ncm_next;      /* Next in registry list */
  293         u_short         ncm_family;     /* Protocol family */
  294 /* Exported functions */
  295         int             (*ncm_ifoutput) /* Interface if_output handler */
  296                                 __P((struct ifnet *, KBuffer *,
  297                                      struct sockaddr *));
  298         int             (*ncm_stat)     /* Network i/f status handler */
  299                                 __P((int, struct atm_nif *, int));
  300 };
  301 
  302 /*
  303  * ncm_stat() commands
  304  */
  305 #define NCM_ATTACH      1               /* Attaching a new net i/f */
  306 #define NCM_DETACH      2               /* Detaching a current net i/f */
  307 #define NCM_SETADDR     3               /* Net i/f address change */
  308 #define NCM_SIGATTACH   4               /* Attaching a signalling manager */
  309 #define NCM_SIGDETACH   5               /* Detaching a signalling manager */
  310 
  311 
  312 /*
  313  * atm_dev_alloc() parameters
  314  */
  315 #define ATM_DEV_NONCACHE        1       /* Allocate non-cacheable memory */
  316 
  317 /*
  318  * atm_dev_compress() buffer allocation sizes
  319  */
  320 #if defined(BSD)
  321 #define ATM_DEV_CMPR_LG MCLBYTES        /* Size of large buffers */
  322 #define ATM_DEV_CMPR_SM MLEN            /* Size of small buffers */
  323 #endif
  324 
  325 /*
  326  * Macros to manage DMA addresses
  327  */
  328 #if defined(sun4c)
  329 #define DMA_INIT()
  330 #define DMA_GET_ADDR(addr,len,align,flags)      ((void *)(addr))
  331 #define DMA_FREE_ADDR(addr,daddr,len,flags)
  332 #define DMA_RELEASE()
  333 
  334 #elif defined(sun4m)
  335 #define DMA_INIT()
  336 #define DMA_GET_ADDR(addr,len,align,flags)              \
  337                 (void *)atm_dma_map((addr),(len),(flags))
  338 #define DMA_FREE_ADDR(addr,daddr,len,flags)             \
  339                 (void)atm_dma_free((daddr),(flags))
  340 #define DMA_RELEASE()
  341 
  342 #elif defined(BSD) && defined(__i386__)
  343 #define DMA_INIT()
  344 #define DMA_GET_ADDR(addr,len,align,flags)      ((void *)vtophys(addr))
  345 #define DMA_FREE_ADDR(addr,daddr,len,flags)
  346 #define DMA_RELEASE()
  347 
  348 #else
  349         #error - Must define hardware-specific requirements here
  350 #endif
  351 
  352 
  353 /*
  354  * Macros to lock out device interrupts
  355  */
  356 #if defined(sun)
  357 #define DEVICE_LOCK(u)          ((u)->cu_savepri = splr((u)->cu_intrpri))
  358 #endif
  359 #if defined(__FreeBSD__)
  360 #define DEVICE_LOCK(u)          ((u)->cu_savepri = splimp())
  361 #endif
  362 #define DEVICE_UNLOCK(u)        ((void) splx((u)->cu_savepri))
  363 
  364 
  365 /*
  366  * SBus defines
  367  */
  368 #if defined(sun)
  369 #define SBUS_BURST32    0x20    /* Device supports 32-byte bursts */
  370 #endif
  371 
  372 
  373 /*
  374  * Macro to schedule the ATM interrupt queue handler
  375  */
  376 typedef void (atm_intr_t) __P((void *, KBuffer *)); /* Callback function type */
  377 typedef atm_intr_t      *atm_intr_func_t; /* Pointer to callback function */
  378 
  379 #ifdef sun
  380 #define SCHED_ATM       schednetisr(atm_intr) 
  381 #endif
  382 #ifdef __FreeBSD__
  383 #define NETISR_ATM      AF_ATM
  384 #define SCHED_ATM       schednetisr(NETISR_ATM) 
  385 #endif
  386 #ifdef sgi
  387 extern  int     atm_intr_index;
  388 #define SCHED_ATM       schednetisr(atm_intr_index) 
  389 #endif
  390 #endif /* ATM_KERNEL */
  391 
  392 #endif  /* _NETATM_ATM_IF_H */

Cache object: a932f1082d011529d2448f4b78ab9536


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