Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Callbacks for the FSM |
| 3 | * |
| 4 | * Copyright (C) 1996 Universidade de Lisboa |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 5 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * Written by Pedro Roque Marques (roque@di.fc.ul.pt) |
| 7 | * |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 8 | * This software may be used and distributed according to the terms of |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * the GNU General Public License, incorporated herein by reference. |
| 10 | */ |
| 11 | |
| 12 | /* |
| 13 | * Fix: 19981230 - Carlos Morgado <chbm@techie.com> |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 14 | * Port of Nelson Escravana's <nelson.escravana@usa.net> fix to CalledPN |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | * NULL pointer dereference in cb_in_1 (originally fixed in 2.0) |
| 16 | */ |
| 17 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <linux/string.h> |
| 19 | #include <linux/kernel.h> |
| 20 | |
| 21 | #include <linux/types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include <linux/mm.h> |
| 23 | #include <linux/skbuff.h> |
| 24 | |
| 25 | #include <asm/io.h> |
| 26 | |
| 27 | #include <linux/isdnif.h> |
| 28 | |
| 29 | #include "pcbit.h" |
| 30 | #include "layer2.h" |
| 31 | #include "edss1.h" |
| 32 | #include "callbacks.h" |
| 33 | #include "capi.h" |
| 34 | |
| 35 | ushort last_ref_num = 1; |
| 36 | |
| 37 | /* |
| 38 | * send_conn_req |
| 39 | * |
| 40 | */ |
| 41 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 42 | void cb_out_1(struct pcbit_dev *dev, struct pcbit_chan *chan, |
| 43 | struct callb_data *cbdata) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | { |
| 45 | struct sk_buff *skb; |
| 46 | int len; |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 47 | ushort refnum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | |
| 49 | |
| 50 | #ifdef DEBUG |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 51 | printk(KERN_DEBUG "Called Party Number: %s\n", |
| 52 | cbdata->data.setup.CalledPN); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | #endif |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 54 | /* |
| 55 | * hdr - kmalloc in capi_conn_req |
| 56 | * - kfree when msg has been sent |
| 57 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 59 | if ((len = capi_conn_req(cbdata->data.setup.CalledPN, &skb, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | chan->proto)) < 0) |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 61 | { |
| 62 | printk("capi_conn_req failed\n"); |
| 63 | return; |
| 64 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | |
| 66 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 67 | refnum = last_ref_num++ & 0x7fffU; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 69 | chan->callref = 0; |
| 70 | chan->layer2link = 0; |
| 71 | chan->snum = 0; |
| 72 | chan->s_refnum = refnum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 74 | pcbit_l2_write(dev, MSG_CONN_REQ, refnum, skb, len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | /* |
| 78 | * rcv CONNECT |
| 79 | * will go into ACTIVE state |
| 80 | * send CONN_ACTIVE_RESP |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 81 | * send Select protocol request |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | */ |
| 83 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 84 | void cb_out_2(struct pcbit_dev *dev, struct pcbit_chan *chan, |
| 85 | struct callb_data *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | { |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 87 | isdn_ctrl ictl; |
| 88 | struct sk_buff *skb; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | int len; |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 90 | ushort refnum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 92 | if ((len = capi_conn_active_resp(chan, &skb)) < 0) |
| 93 | { |
| 94 | printk("capi_conn_active_req failed\n"); |
| 95 | return; |
| 96 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 98 | refnum = last_ref_num++ & 0x7fffU; |
| 99 | chan->s_refnum = refnum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 101 | pcbit_l2_write(dev, MSG_CONN_ACTV_RESP, refnum, skb, len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | |
| 103 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 104 | ictl.command = ISDN_STAT_DCONN; |
| 105 | ictl.driver = dev->id; |
| 106 | ictl.arg = chan->id; |
| 107 | dev->dev_if->statcallb(&ictl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 109 | /* ACTIVE D-channel */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 111 | /* Select protocol */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 113 | if ((len = capi_select_proto_req(chan, &skb, 1 /*outgoing*/)) < 0) { |
| 114 | printk("capi_select_proto_req failed\n"); |
| 115 | return; |
| 116 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 118 | refnum = last_ref_num++ & 0x7fffU; |
| 119 | chan->s_refnum = refnum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 121 | pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | |
| 125 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | * Incoming call received |
| 127 | * inform user |
| 128 | */ |
| 129 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 130 | void cb_in_1(struct pcbit_dev *dev, struct pcbit_chan *chan, |
| 131 | struct callb_data *cbdata) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | { |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 133 | isdn_ctrl ictl; |
| 134 | unsigned short refnum; |
| 135 | struct sk_buff *skb; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | int len; |
| 137 | |
| 138 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 139 | ictl.command = ISDN_STAT_ICALL; |
| 140 | ictl.driver = dev->id; |
| 141 | ictl.arg = chan->id; |
| 142 | |
| 143 | /* |
| 144 | * ictl.num >= strlen() + strlen() + 5 |
| 145 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | |
| 147 | if (cbdata->data.setup.CallingPN == NULL) { |
| 148 | printk(KERN_DEBUG "NULL CallingPN to phone; using 0\n"); |
| 149 | strcpy(ictl.parm.setup.phone, "0"); |
| 150 | } |
| 151 | else { |
| 152 | strcpy(ictl.parm.setup.phone, cbdata->data.setup.CallingPN); |
| 153 | } |
| 154 | if (cbdata->data.setup.CalledPN == NULL) { |
| 155 | printk(KERN_DEBUG "NULL CalledPN to eazmsn; using 0\n"); |
| 156 | strcpy(ictl.parm.setup.eazmsn, "0"); |
| 157 | } |
| 158 | else { |
| 159 | strcpy(ictl.parm.setup.eazmsn, cbdata->data.setup.CalledPN); |
| 160 | } |
| 161 | ictl.parm.setup.si1 = 7; |
| 162 | ictl.parm.setup.si2 = 0; |
| 163 | ictl.parm.setup.plan = 0; |
| 164 | ictl.parm.setup.screen = 0; |
| 165 | |
| 166 | #ifdef DEBUG |
| 167 | printk(KERN_DEBUG "statstr: %s\n", ictl.num); |
| 168 | #endif |
| 169 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 170 | dev->dev_if->statcallb(&ictl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 172 | |
| 173 | if ((len = capi_conn_resp(chan, &skb)) < 0) { |
| 174 | printk(KERN_DEBUG "capi_conn_resp failed\n"); |
| 175 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | } |
| 177 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 178 | refnum = last_ref_num++ & 0x7fffU; |
| 179 | chan->s_refnum = refnum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 181 | pcbit_l2_write(dev, MSG_CONN_RESP, refnum, skb, len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | /* |
| 185 | * user has replied |
| 186 | * open the channel |
| 187 | * send CONNECT message CONNECT_ACTIVE_REQ in CAPI |
| 188 | */ |
| 189 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 190 | void cb_in_2(struct pcbit_dev *dev, struct pcbit_chan *chan, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | struct callb_data *data) |
| 192 | { |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 193 | unsigned short refnum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | struct sk_buff *skb; |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 195 | int len; |
| 196 | |
| 197 | if ((len = capi_conn_active_req(chan, &skb)) < 0) { |
| 198 | printk(KERN_DEBUG "capi_conn_active_req failed\n"); |
| 199 | return; |
| 200 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | |
| 202 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 203 | refnum = last_ref_num++ & 0x7fffU; |
| 204 | chan->s_refnum = refnum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | |
| 206 | printk(KERN_DEBUG "sending MSG_CONN_ACTV_REQ\n"); |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 207 | pcbit_l2_write(dev, MSG_CONN_ACTV_REQ, refnum, skb, len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | /* |
| 211 | * CONN_ACK arrived |
| 212 | * start b-proto selection |
| 213 | * |
| 214 | */ |
| 215 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 216 | void cb_in_3(struct pcbit_dev *dev, struct pcbit_chan *chan, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | struct callb_data *data) |
| 218 | { |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 219 | unsigned short refnum; |
| 220 | struct sk_buff *skb; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | int len; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 223 | if ((len = capi_select_proto_req(chan, &skb, 0 /*incoming*/)) < 0) |
| 224 | { |
| 225 | printk("capi_select_proto_req failed\n"); |
| 226 | return; |
| 227 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 229 | refnum = last_ref_num++ & 0x7fffU; |
| 230 | chan->s_refnum = refnum; |
| 231 | |
| 232 | pcbit_l2_write(dev, MSG_SELP_REQ, refnum, skb, len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | |
| 234 | } |
| 235 | |
| 236 | |
| 237 | /* |
| 238 | * Received disconnect ind on active state |
| 239 | * send disconnect resp |
| 240 | * send msg to user |
| 241 | */ |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 242 | void cb_disc_1(struct pcbit_dev *dev, struct pcbit_chan *chan, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | struct callb_data *data) |
| 244 | { |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 245 | struct sk_buff *skb; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | int len; |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 247 | ushort refnum; |
| 248 | isdn_ctrl ictl; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 250 | if ((len = capi_disc_resp(chan, &skb)) < 0) { |
| 251 | printk("capi_disc_resp failed\n"); |
| 252 | return; |
| 253 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 255 | refnum = last_ref_num++ & 0x7fffU; |
| 256 | chan->s_refnum = refnum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 258 | pcbit_l2_write(dev, MSG_DISC_RESP, refnum, skb, len); |
| 259 | |
| 260 | ictl.command = ISDN_STAT_BHUP; |
| 261 | ictl.driver = dev->id; |
| 262 | ictl.arg = chan->id; |
| 263 | dev->dev_if->statcallb(&ictl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | } |
| 265 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 266 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | /* |
| 268 | * User HANGUP on active/call proceeding state |
| 269 | * send disc.req |
| 270 | */ |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 271 | void cb_disc_2(struct pcbit_dev *dev, struct pcbit_chan *chan, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | struct callb_data *data) |
| 273 | { |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 274 | struct sk_buff *skb; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | int len; |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 276 | ushort refnum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 278 | if ((len = capi_disc_req(chan->callref, &skb, CAUSE_NORMAL)) < 0) |
| 279 | { |
| 280 | printk("capi_disc_req failed\n"); |
| 281 | return; |
| 282 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 284 | refnum = last_ref_num++ & 0x7fffU; |
| 285 | chan->s_refnum = refnum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 287 | pcbit_l2_write(dev, MSG_DISC_REQ, refnum, skb, len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | /* |
| 291 | * Disc confirm received send BHUP |
| 292 | * Problem: when the HL driver sends the disc req itself |
| 293 | * LL receives BHUP |
| 294 | */ |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 295 | void cb_disc_3(struct pcbit_dev *dev, struct pcbit_chan *chan, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | struct callb_data *data) |
| 297 | { |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 298 | isdn_ctrl ictl; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 300 | ictl.command = ISDN_STAT_BHUP; |
| 301 | ictl.driver = dev->id; |
| 302 | ictl.arg = chan->id; |
| 303 | dev->dev_if->statcallb(&ictl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | } |
| 305 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 306 | void cb_notdone(struct pcbit_dev *dev, struct pcbit_chan *chan, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 307 | struct callb_data *data) |
| 308 | { |
| 309 | } |
| 310 | |
| 311 | /* |
| 312 | * send activate b-chan protocol |
| 313 | */ |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 314 | void cb_selp_1(struct pcbit_dev *dev, struct pcbit_chan *chan, |
| 315 | struct callb_data *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | { |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 317 | struct sk_buff *skb; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | int len; |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 319 | ushort refnum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 321 | if ((len = capi_activate_transp_req(chan, &skb)) < 0) |
| 322 | { |
| 323 | printk("capi_conn_activate_transp_req failed\n"); |
| 324 | return; |
| 325 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 327 | refnum = last_ref_num++ & 0x7fffU; |
| 328 | chan->s_refnum = refnum; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 330 | pcbit_l2_write(dev, MSG_ACT_TRANSP_REQ, refnum, skb, len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | } |
| 332 | |
| 333 | /* |
| 334 | * Inform User that the B-channel is available |
| 335 | */ |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 336 | void cb_open(struct pcbit_dev *dev, struct pcbit_chan *chan, |
| 337 | struct callb_data *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | { |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 339 | isdn_ctrl ictl; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | |
Joe Perches | 475be4d | 2012-02-19 19:52:38 -0800 | [diff] [blame] | 341 | ictl.command = ISDN_STAT_BCONN; |
| 342 | ictl.driver = dev->id; |
| 343 | ictl.arg = chan->id; |
| 344 | dev->dev_if->statcallb(&ictl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | } |