root/include/linux/if_frad.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * DLCI/FRAD    Definitions for Frame Relay Access Devices.  DLCI devices are
   3  *              created for each DLCI associated with a FRAD.  The FRAD driver
   4  *              is not truly a network device, but the lower level device
   5  *              handler.  This allows other FRAD manufacturers to use the DLCI
   6  *              code, including it's RFC1490 encapsulation along side the current
   7  *              implementation for the Sangoma cards.
   8  *
   9  * Version:     @(#)if_ifrad.h  0.15    31 Mar 96
  10  *
  11  * Author:      Mike McLagan <mike.mclagan@linux.org>
  12  *
  13  *              This program is free software; you can redistribute it and/or
  14  *              modify it under the terms of the GNU General Public License
  15  *              as published by the Free Software Foundation; either version
  16  *              2 of the License, or (at your option) any later version.
  17  */
  18 
  19 #ifndef _FRAD_H_
  20 #define _FRAD_H_
  21 
  22 /* Structures and constants associated with the DLCI device driver */
  23 
  24 #define DLCI_DEVADD     (SIOCDEVPRIVATE)
  25 #define DLCI_DEVDEL     (SIOCDEVPRIVATE + 1)
  26 
  27 struct dlci_add
  28 {
  29    char  devname[IFNAMSIZ];
  30    short dlci;
  31 };
  32 
  33 #define DLCI_GET_CONF   (SIOCDEVPRIVATE + 2)
  34 #define DLCI_SET_CONF   (SIOCDEVPRIVATE + 3)
  35 
  36 /* 
  37  * These are related to the Sangoma SDLA and should remain in order. 
  38  * Code within the SDLA module is based on the specifics of this 
  39  * structure.  Change at your own peril.
  40  */
  41 struct dlci_conf {
  42    short flags;
  43    short CIR_fwd;
  44    short Bc_fwd;
  45    short Be_fwd;
  46    short CIR_bwd;
  47    short Bc_bwd;
  48    short Be_bwd; 
  49 
  50 /* these are part of the status read */
  51    short Tc_fwd;
  52    short Tc_bwd;
  53    short Tf_max;
  54    short Tb_max;
  55 
  56 /* add any new fields here above is a mirror of sdla_dlci_conf */
  57 };
  58 
  59 #define DLCI_GET_SLAVE  (SIOCDEVPRIVATE + 4)
  60 
  61 /* configuration flags for DLCI */
  62 #define DLCI_IGNORE_CIR_OUT     0x0001
  63 #define DLCI_ACCOUNT_CIR_IN     0x0002
  64 #define DLCI_BUFFER_IF          0x0008
  65 
  66 #define DLCI_VALID_FLAGS        0x000B
  67 
  68 /* FRAD driver uses these to indicate what it did with packet */
  69 #define DLCI_RET_OK             0x00
  70 #define DLCI_RET_ERR            0x01
  71 #define DLCI_RET_DROP           0x02
  72 
  73 /* defines for the actual Frame Relay hardware */
  74 #define FRAD_GET_CONF   (SIOCDEVPRIVATE)
  75 #define FRAD_SET_CONF   (SIOCDEVPRIVATE + 1)
  76 
  77 #define FRAD_LAST_IOCTL FRAD_SET_CONF
  78 
  79 /*
  80  * Based on the setup for the Sangoma SDLA.  If changes are 
  81  * necessary to this structure, a routine will need to be 
  82  * added to that module to copy fields.
  83  */
  84 struct frad_conf 
  85 {
  86    short station;
  87    short flags;
  88    short kbaud;
  89    short clocking;
  90    short mtu;
  91    short T391;
  92    short T392;
  93    short N391;
  94    short N392;
  95    short N393;
  96    short CIR_fwd;
  97    short Bc_fwd;
  98    short Be_fwd;
  99    short CIR_bwd;
 100    short Bc_bwd;
 101    short Be_bwd;
 102 
 103 /* Add new fields here, above is a mirror of the sdla_conf */
 104 
 105 };
 106 
 107 #define FRAD_STATION_CPE        0x0000
 108 #define FRAD_STATION_NODE       0x0001
 109 
 110 #define FRAD_TX_IGNORE_CIR      0x0001
 111 #define FRAD_RX_ACCOUNT_CIR     0x0002
 112 #define FRAD_DROP_ABORTED       0x0004
 113 #define FRAD_BUFFERIF           0x0008
 114 #define FRAD_STATS              0x0010
 115 #define FRAD_MCI                0x0100
 116 #define FRAD_AUTODLCI           0x8000
 117 #define FRAD_VALID_FLAGS        0x811F
 118 
 119 #define FRAD_CLOCK_INT          0x0001
 120 #define FRAD_CLOCK_EXT          0x0000
 121 
 122 #ifdef __KERNEL__
 123 
 124 /* these are the fields of an RFC 1490 header */
 125 struct frhdr
 126 {
 127    unsigned char  control       __attribute__((packed));
 128 
 129    /* for IP packets, this can be the NLPID */
 130    unsigned char  pad           __attribute__((packed)); 
 131 
 132    unsigned char  NLPID         __attribute__((packed));
 133    unsigned char  OUI[3]        __attribute__((packed));
 134    unsigned short PID           __attribute__((packed));
 135 
 136 #define IP_NLPID pad 
 137 };
 138 
 139 /* see RFC 1490 for the definition of the following */
 140 #define FRAD_I_UI               0x03
 141 
 142 #define FRAD_P_PADDING          0x00
 143 #define FRAD_P_Q933             0x08
 144 #define FRAD_P_SNAP             0x80
 145 #define FRAD_P_CLNP             0x81
 146 #define FRAD_P_IP               0xCC
 147 
 148 struct dlci_local
 149 {
 150    struct enet_statistics stats;
 151    struct device          *slave;
 152    struct dlci_conf       config;
 153    int                    configured;
 154 
 155    /* callback function */
 156    void              (*receive)(struct sk_buff *skb, struct device *);
 157 };
 158 
 159 struct frad_local
 160 {
 161    struct enet_statistics stats;
 162 
 163    /* devices which this FRAD is slaved to */
 164    struct device     *master[CONFIG_DLCI_MAX];
 165    short             dlci[CONFIG_DLCI_MAX];
 166 
 167    struct frad_conf  config;
 168    int               configured;        /* has this device been configured */
 169    int               initialized;       /* mem_start, port, irq set ? */
 170 
 171    /* callback functions */
 172    int               (*activate)(struct device *, struct device *);
 173    int               (*deactivate)(struct device *, struct device *);
 174    int               (*assoc)(struct device *, struct device *);
 175    int               (*deassoc)(struct device *, struct device *);
 176    int               (*dlci_conf)(struct device *, struct device *, int get);
 177 
 178    /* fields that are used by the Sangoma SDLA cards */
 179    struct timer_list timer;
 180    int               type;              /* adapter type */
 181    int               state;             /* state of the S502/8 control latch */
 182    int               buffer;            /* current buffer for S508 firmware */
 183 };
 184 
 185 int register_frad(const char *name);
 186 int unregister_frad(const char *name);
 187 
 188 #endif __KERNEL__
 189 
 190 #endif

/* [previous][next][first][last][top][bottom][index][help] */