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: releng/6.2/sys/netatm/atm_if.h 147256 2005-06-10 16:49:24Z brooks $
   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_25      59111           /* Peak Cell Rate for 25.6 Mbs */
   47 #define ATM_PCR_DS3     (12*8000)       /* 12 cells in 1/8000 sec */
   48 #define ATM_PCR_TAXI100 227273          /* Peak Cell Rate for 100 Mbs TAXI */
   49 #define ATM_PCR_TAXI140 318181          /* Peak Cell Rate for 140 Mbs TAXI */
   50 #define ATM_PCR_OC3C    353207          /* Peak Cell Rate for OC3c */
   51 #define ATM_PCR_OC12C   1416905         /* Peak Cell Rate for OC12c */
   52 
   53 
   54 /*
   55  * Media Access Control (MAC) address
   56  */
   57 struct mac_addr {
   58         u_char          ma_data[6];     /* MAC address */
   59 };
   60 typedef struct mac_addr Mac_addr;
   61 
   62 
   63 /*
   64  * Adapter vendor identifiers
   65  */
   66 enum atm_vendor {
   67         VENDOR_UNKNOWN,                 /* Unknown vendor */
   68         VENDOR_FORE,                    /* FORE Systems, Inc. */
   69         VENDOR_ENI,                     /* Efficient Networks, Inc. */
   70         VENDOR_IDT,                     /* Integrated Device Technology, Inc. */
   71         VENDOR_PROSUM,                  /* Prosum, Inc. */
   72         VENDOR_NETGRAPH                 /* Netgraph device */
   73 };
   74 typedef enum atm_vendor Atm_vendor;
   75 
   76 
   77 /*
   78  * Adapter vendor interface identifiers
   79  */
   80 enum atm_vendapi {
   81         VENDAPI_UNKNOWN,                /* Unknown interface */
   82         VENDAPI_FORE_1,                 /* FORE - 200 Series */
   83         VENDAPI_ENI_1,                  /* ENI - Midway */
   84         VENDAPI_IDT_1,                  /* IDT - NICStAR */
   85         VENDAPI_IDT_2,                  /* IDT 77252 */
   86         VENDAPI_NETGRAPH_1,             /* Netgraph API v1 */
   87         VENDAPI_FORE_2,                 /* FORE - HE Series */
   88 };
   89 typedef enum atm_vendapi        Atm_vendapi;
   90 
   91 
   92 /*
   93  * Adapter device model identifiers
   94  */
   95 enum atm_device {
   96         DEV_UNKNOWN,                    /* Unknown device */
   97         DEV_FORE_SBA200E,               /* FORE SBA-200E */
   98         DEV_FORE_SBA200,                /* FORE SBA-200 */
   99         DEV_FORE_PCA200E,               /* FORE PCA-200E */
  100         DEV_FORE_ESA200E,               /* FORE ESA-200E */
  101         DEV_ENI_155P,                   /* ENI-155p */
  102         DEV_IDT_155,                    /* IDT NICStAR */
  103         DEV_PROATM_25,                  /* Prosum boards based on IDT 77252 */
  104         DEV_PROATM_155,                 /* Prosum boards based on IDT 77252 */
  105         DEV_VATMPIF,                    /* Virtual ATM Physical IF */
  106         DEV_FORE_LE25,                  /* ForeLE-25 */
  107         DEV_FORE_LE155,                 /* ForeLE-155 */
  108         DEV_IDT_25,                     /* IDT NICStAR */
  109         DEV_IDTABR_25,                  /* IDT 77252 evaluation board */
  110         DEV_IDTABR_155,                 /* IDT 77252 evaluation board */
  111         DEV_FORE_HE155,                 /* ForeRunnerHE-155 */
  112         DEV_FORE_HE622,                 /* ForeRunnerHE-622 */
  113 };
  114 typedef enum atm_device Atm_device;
  115 
  116 
  117 /*
  118  * Adapter media identifiers
  119  */
  120 enum atm_media {
  121         MEDIA_UNKNOWN,                  /* Unknown media type */
  122         MEDIA_TAXI_100,                 /* TAXI - 100 Mbps */
  123         MEDIA_TAXI_140,                 /* TAXI - 140 Mbps */
  124         MEDIA_OC3C,                     /* OC-3C */
  125         MEDIA_OC12C,                    /* OC-12C */
  126         MEDIA_UTP155,                   /* UTP-155 */
  127         MEDIA_UTP25,                    /* UTP-25.6 */
  128         MEDIA_VIRTUAL,                  /* Virtual Link */
  129         MEDIA_DSL                       /* xDSL */
  130 };
  131 typedef enum atm_media  Atm_media;
  132 
  133 
  134 /*
  135  * Bus type identifiers
  136  */
  137 enum atm_bus {
  138         BUS_UNKNOWN,                    /* Unknown bus type */
  139         BUS_SBUS_B16,                   /* SBus: 16 byte (4 word) max burst */
  140         BUS_SBUS_B32,                   /* SBus: 32 byte (8 word) max burst */
  141         BUS_PCI,                        /* PCI */
  142         BUS_EISA,                       /* EISA */
  143         BUS_USB,                        /* USB */
  144         BUS_VIRTUAL                     /* Virtual Bus */
  145 };
  146 typedef enum atm_bus    Atm_bus;
  147 
  148 
  149 #define VERSION_LEN     16              /* Length of version info string */
  150 
  151 
  152 /*
  153  * ATM adapter configuration information structure
  154  */
  155 struct atm_config {
  156         Atm_vendor      ac_vendor;      /* Vendor */
  157         Atm_vendapi     ac_vendapi;     /* Vendor interface */
  158         Atm_device      ac_device;      /* Device model */
  159         Atm_media       ac_media;       /* Media type */
  160         u_long          ac_serial;      /* Serial number */
  161         Atm_bus         ac_bustype;     /* Bus type */
  162         u_long          ac_busslot;     /* Bus slot info (bus type dependent) */
  163         u_long          ac_ram;         /* Device ram offset */
  164         u_long          ac_ramsize;     /* Device ram size */
  165         Mac_addr        ac_macaddr;     /* MAC address */
  166         char            ac_hard_vers[VERSION_LEN];      /* Hardware version */
  167         char            ac_firm_vers[VERSION_LEN];      /* Firmware version */
  168 };
  169 typedef struct atm_config       Atm_config;
  170 
  171 
  172 #ifdef _KERNEL
  173 
  174 #include <vm/uma.h>
  175 
  176 /*
  177  * Common structure used to define each physical ATM device interface.
  178  * This structure will (normally) be embedded at the top of each driver's 
  179  * device-specific interface structure.  
  180  */
  181 struct  atm_pif {
  182         struct atm_pif  *pif_next;      /* Next registered atm interface */
  183         const char      *pif_name;      /* Device name */
  184         short           pif_unit;       /* Device unit number */
  185         u_char          pif_flags;      /* Interface flags (see below) */
  186         struct sigmgr   *pif_sigmgr;    /* Signalling Manager for interface */
  187         struct siginst  *pif_siginst;   /* Signalling protocol instance */
  188         struct stack_defn       *pif_services;  /* Interface's stack services */
  189         struct mac_addr pif_macaddr;    /* Interface's MAC address */
  190         struct atm_nif  *pif_nif;       /* List of network interfaces */
  191         struct atm_pif  *pif_grnext;    /* Next atm device in group */
  192 
  193 /* Exported functions */
  194         int             (*pif_ioctl)    /* Interface ioctl handler */
  195                                 (int, caddr_t, caddr_t);
  196 
  197 /* Interface statistics */
  198         u_quad_t        pif_ipdus;      /* PDUs received from interface */
  199         u_quad_t        pif_opdus;      /* PDUs sent to interface */
  200         u_quad_t        pif_ibytes;     /* Bytes received from interface */
  201         u_quad_t        pif_obytes;     /* Bytes sent to interface */
  202         u_quad_t        pif_ierrors;    /* Errors receiving from interface */
  203         u_quad_t        pif_oerrors;    /* Errors sending to interface */
  204         u_quad_t        pif_cmderrors;  /* Interface command errors */
  205         caddr_t         pif_cardstats;  /* Card specific statistics */
  206 
  207 /* Interface capabilities */
  208         u_short         pif_maxvpi;     /* Maximum VPI value supported */
  209         u_short         pif_maxvci;     /* Maximum VCI value supported */
  210         u_int           pif_pcr;        /* Peak Cell Rate */
  211 };
  212 
  213 /*
  214  * Physical interface flags
  215  */
  216 #define PIF_UP          0x01            /* Interface is up */
  217 #define PIF_LOOPBACK    0x02            /* Loopback local packets */
  218 
  219 
  220 /*
  221  * Structure defining an ATM network interface.  This structure is used as 
  222  * the hook between the standard BSD network layer interface mechanism and 
  223  * the ATM device layer.  There may be one or more network interfaces for 
  224  * each physical ATM interface.
  225  */
  226 struct  atm_nif {
  227         struct ifnet    *nif_ifp;       /* Network interface */
  228         struct atm_pif  *nif_pif;       /* Our physical interface */
  229         char            nif_name[IFNAMSIZ];/* Network interface name */
  230         u_char          nif_sel;        /* Interface's address selector */
  231         struct atm_nif  *nif_pnext;     /* Next net interface on phys i/f */
  232 
  233 /* Interface statistics (in addition to ifnet stats) */
  234         long            nif_ibytes;     /* Bytes received from interface */
  235         long            nif_obytes;     /* Bytes sent to interface */
  236 };
  237 #define ANIF2IFP(an)    ((an)->nif_ifp)
  238 #define IFP2ANIF(ifp)   ((struct atm_nif *)(ifp)->if_softc)
  239 
  240 /*
  241  * Common Device VCC Entry
  242  *
  243  * Contains the common information for each VCC which is opened
  244  * through a particular device.
  245  */
  246 struct cmn_vcc {
  247         struct cmn_vcc  *cv_next;       /* Next in list */
  248         void            *cv_toku;       /* Upper layer's token */
  249         void            (*cv_upper)     /* Upper layer's interface */
  250                                 (int, void *, intptr_t, intptr_t);
  251         Atm_connvc      *cv_connvc;     /* Associated connection VCC */
  252         u_char          cv_state;       /* VCC state (see below) */
  253         u_char          cv_flags;       /* VCC flags (see below) */
  254 };
  255 typedef struct cmn_vcc  Cmn_vcc;
  256 
  257 /*
  258  * VCC States
  259  */
  260 #define CVS_FREE        0               /* Not allocated */
  261 #define CVS_INST        1               /* Instantiated, waiting for INIT */
  262 #define CVS_INITED      2               /* Initialized, waiting for driver */
  263 #define CVS_ACTIVE      3               /* Device activated by driver */
  264 #define CVS_PTERM       4               /* Waiting for TERM */
  265 #define CVS_TERM        5               /* Terminated */
  266 
  267 /*
  268  * VCC Flags
  269  */
  270 #define CVF_RSVD        0x0f            /* Reserved for device-specific use */
  271 
  272 
  273 /*
  274  * Common Device Unit Structure
  275  *
  276  * Contains the common information for a single device (adapter).
  277  */
  278 struct cmn_unit {
  279         struct atm_pif  cu_pif;         /* Physical interface */
  280         u_int           cu_unit;        /* Local unit number */
  281         u_char          cu_flags;       /* Device flags (see below) */
  282         u_int           cu_mtu;         /* Interface MTU */
  283 
  284         u_int           cu_open_vcc;    /* Open VCC count */
  285         Cmn_vcc         *cu_vcc;        /* List of VCC's on interface */
  286 
  287         u_int           cu_intrpri;     /* Highest unit interrupt priority */
  288         int             cu_savepri;     /* Saved priority for locking device */
  289 
  290         uma_zone_t      cu_vcc_zone;    /* Device VCC zone */
  291         uma_zone_t      cu_nif_zone;    /* Device NIF zone */
  292 
  293         int             (*cu_ioctl)     /* Interface ioctl handler */
  294                                 (int, caddr_t, caddr_t);
  295         int             (*cu_instvcc)   /* VCC stack instantion handler */
  296                                 (struct cmn_unit *, Cmn_vcc *);
  297         int             (*cu_openvcc)   /* Open VCC handler */
  298                                 (struct cmn_unit *, Cmn_vcc *);
  299         int             (*cu_closevcc)  /* Close VCC handler */
  300                                 (struct cmn_unit *, Cmn_vcc *);
  301         void            (*cu_output)    /* Data output handler */
  302                                 (struct cmn_unit *, Cmn_vcc *, KBuffer *);
  303 
  304         Atm_config      cu_config;      /* Device configuration data */
  305 
  306         void *          cu_softc;       /* pointer to driver state */
  307 };
  308 typedef struct cmn_unit Cmn_unit;
  309 
  310 /*
  311  * Device flags
  312  */
  313 #define CUF_REGISTER    0x01            /* Device is registered */
  314 #define CUF_INITED      0x02            /* Device is initialized */
  315 
  316 
  317 /*
  318  * Structure used to define a network convergence module and its associated
  319  * entry points.  A convergence module is used to provide the interface
  320  * translations necessary between the ATM system and the BSD network layer
  321  * interface mechanism.  There will be one network convergence module for
  322  * each protocol address family supporting ATM connections.
  323  */
  324 struct atm_ncm {
  325         struct atm_ncm  *ncm_next;      /* Next in registry list */
  326         u_short         ncm_family;     /* Protocol family */
  327 /* Exported functions */
  328         int             (*ncm_ifoutput) /* Interface if_output handler */
  329                                 (struct ifnet *, KBuffer *, struct sockaddr *);
  330         int             (*ncm_stat)     /* Network i/f status handler */
  331                                 (int, struct atm_nif *, intptr_t);
  332 };
  333 
  334 /*
  335  * ncm_stat() commands
  336  */
  337 #define NCM_ATTACH      1               /* Attaching a new net i/f */
  338 #define NCM_DETACH      2               /* Detaching a current net i/f */
  339 #define NCM_SETADDR     3               /* Net i/f address change */
  340 #define NCM_SIGATTACH   4               /* Attaching a signalling manager */
  341 #define NCM_SIGDETACH   5               /* Detaching a signalling manager */
  342 
  343 
  344 /*
  345  * atm_dev_alloc() parameters
  346  */
  347 #define ATM_DEV_NONCACHE        1       /* Allocate non-cacheable memory */
  348 
  349 /*
  350  * atm_dev_compress() buffer allocation sizes
  351  */
  352 #define ATM_DEV_CMPR_LG MCLBYTES        /* Size of large buffers */
  353 #define ATM_DEV_CMPR_SM MLEN            /* Size of small buffers */
  354 
  355 /*
  356  * Macros to lock out device interrupts
  357  */
  358 #define DEVICE_LOCK(u)          ((u)->cu_savepri = splimp())
  359 #define DEVICE_UNLOCK(u)        ((void) splx((u)->cu_savepri))
  360 
  361 /*
  362  * Macro to schedule the ATM interrupt queue handler
  363  */
  364 typedef void (atm_intr_t)(void *, KBuffer *); /* Callback function type */
  365 typedef atm_intr_t      *atm_intr_func_t; /* Pointer to callback function */
  366 
  367 #endif /* _KERNEL */
  368 
  369 #endif  /* _NETATM_ATM_IF_H */

Cache object: e5052d640efbf00e7cda3b91afa88fc1


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