1 #ifndef _ATMMPC_H_
2 #define _ATMMPC_H_
3 
4 #include <linux/atmapi.h>
5 #include <linux/atmioc.h>
6 #include <linux/atm.h>
7 
8 #define ATMMPC_CTRL _IO('a', ATMIOC_MPOA)
9 #define ATMMPC_DATA _IO('a', ATMIOC_MPOA+1)
10 
11 #define MPC_SOCKET_INGRESS 1
12 #define MPC_SOCKET_EGRESS  2
13 
14 struct atmmpc_ioc {
15         int dev_num;
16         uint32_t ipaddr;              /* the IP address of the shortcut    */
17         int type;                     /* ingress or egress                 */
18 };
19 
20 typedef struct in_ctrl_info {
21         uint8_t   Last_NHRP_CIE_code;
22         uint8_t   Last_Q2931_cause_value;
23         uint8_t   eg_MPC_ATM_addr[ATM_ESA_LEN];
24         uint32_t  tag;
25         uint32_t  in_dst_ip;      /* IP address this ingress MPC sends packets to */
26         uint16_t  holding_time;
27         uint32_t  request_id;
28 } in_ctrl_info;
29 
30 typedef struct eg_ctrl_info {
31         uint8_t   DLL_header[256];
32         uint8_t   DH_length;
33         uint32_t  cache_id;
34         uint32_t  tag;
35         uint32_t  mps_ip;
36         uint32_t  eg_dst_ip;      /* IP address to which ingress MPC sends packets */
37         uint8_t   in_MPC_data_ATM_addr[ATM_ESA_LEN];
38         uint16_t  holding_time;
39 } eg_ctrl_info;
40 
41 struct mpc_parameters {
42         uint16_t mpc_p1;   /* Shortcut-Setup Frame Count    */
43         uint16_t mpc_p2;   /* Shortcut-Setup Frame Time     */
44         uint8_t mpc_p3[8]; /* Flow-detection Protocols      */
45         uint16_t mpc_p4;   /* MPC Initial Retry Time        */
46         uint16_t mpc_p5;   /* MPC Retry Time Maximum        */
47         uint16_t mpc_p6;   /* Hold Down Time                */
48 } ;
49 
50 struct k_message {
51         uint16_t type;
52         uint32_t ip_mask;
53         uint8_t  MPS_ctrl[ATM_ESA_LEN];
54         union {
55                 in_ctrl_info in_info;
56                 eg_ctrl_info eg_info;
57                 struct mpc_parameters params;
58         } content;
59         struct atm_qos qos;
60 } __ATM_API_ALIGN;
61 
62 struct llc_snap_hdr {
63 	/* RFC 1483 LLC/SNAP encapsulation for routed IP PDUs */
64         uint8_t  dsap;    /* Destination Service Access Point (0xAA)     */
65         uint8_t  ssap;    /* Source Service Access Point      (0xAA)     */
66         uint8_t  ui;      /* Unnumbered Information           (0x03)     */
67         uint8_t  org[3];  /* Organizational identification    (0x000000) */
68         uint8_t  type[2]; /* Ether type (for IP)              (0x0800)   */
69 };
70 
71 /* TLVs this MPC recognizes */
72 #define TLV_MPOA_DEVICE_TYPE         0x00a03e2a
73 
74 /* MPOA device types in MPOA Device Type TLV */
75 #define NON_MPOA    0
76 #define MPS         1
77 #define MPC         2
78 #define MPS_AND_MPC 3
79 
80 
81 /* MPC parameter defaults */
82 
83 #define MPC_P1 10  /* Shortcut-Setup Frame Count  */
84 #define MPC_P2 1   /* Shortcut-Setup Frame Time   */
85 #define MPC_P3 0   /* Flow-detection Protocols    */
86 #define MPC_P4 5   /* MPC Initial Retry Time      */
87 #define MPC_P5 40  /* MPC Retry Time Maximum      */
88 #define MPC_P6 160 /* Hold Down Time              */
89 #define HOLDING_TIME_DEFAULT 1200 /* same as MPS-p7 */
90 
91 /* MPC constants */
92 
93 #define MPC_C1 2   /* Retry Time Multiplier       */
94 #define MPC_C2 60  /* Initial Keep-Alive Lifetime */
95 
96 /* Message types - to MPOA daemon */
97 
98 #define SND_MPOA_RES_RQST    201
99 #define SET_MPS_CTRL_ADDR    202
100 #define SND_MPOA_RES_RTRY    203 /* Different type in a retry due to req id         */
101 #define STOP_KEEP_ALIVE_SM   204
102 #define EGRESS_ENTRY_REMOVED 205
103 #define SND_EGRESS_PURGE     206
104 #define DIE                  207 /* tell the daemon to exit()                       */
105 #define DATA_PLANE_PURGE     208 /* Data plane purge because of egress cache hit miss or dead MPS */
106 #define OPEN_INGRESS_SVC     209
107 
108 /* Message types - from MPOA daemon */
109 
110 #define MPOA_TRIGGER_RCVD     101
111 #define MPOA_RES_REPLY_RCVD   102
112 #define INGRESS_PURGE_RCVD    103
113 #define EGRESS_PURGE_RCVD     104
114 #define MPS_DEATH             105
115 #define CACHE_IMPOS_RCVD      106
116 #define SET_MPC_CTRL_ADDR     107 /* Our MPC's control ATM address   */
117 #define SET_MPS_MAC_ADDR      108
118 #define CLEAN_UP_AND_EXIT     109
119 #define SET_MPC_PARAMS        110 /* MPC configuration parameters    */
120 
121 /* Message types - bidirectional */
122 
123 #define RELOAD                301 /* kill -HUP the daemon for reload */
124 
125 #endif /* _ATMMPC_H_ */
126