• Home
  • Raw
  • Download

Lines Matching refs:lapb

48 static void lapb_free_cb(struct lapb_cb *lapb)  in lapb_free_cb()  argument
50 kfree(lapb); in lapb_free_cb()
53 static __inline__ void lapb_hold(struct lapb_cb *lapb) in lapb_hold() argument
55 atomic_inc(&lapb->refcnt); in lapb_hold()
58 static __inline__ void lapb_put(struct lapb_cb *lapb) in lapb_put() argument
60 if (atomic_dec_and_test(&lapb->refcnt)) in lapb_put()
61 lapb_free_cb(lapb); in lapb_put()
67 static void __lapb_remove_cb(struct lapb_cb *lapb) in __lapb_remove_cb() argument
69 if (lapb->node.next) { in __lapb_remove_cb()
70 list_del(&lapb->node); in __lapb_remove_cb()
71 lapb_put(lapb); in __lapb_remove_cb()
78 static void __lapb_insert_cb(struct lapb_cb *lapb) in __lapb_insert_cb() argument
80 list_add(&lapb->node, &lapb_list); in __lapb_insert_cb()
81 lapb_hold(lapb); in __lapb_insert_cb()
87 struct lapb_cb *lapb, *use = NULL; in __lapb_devtostruct() local
90 lapb = list_entry(entry, struct lapb_cb, node); in __lapb_devtostruct()
91 if (lapb->dev == dev) { in __lapb_devtostruct()
92 use = lapb; in __lapb_devtostruct()
118 struct lapb_cb *lapb = kzalloc(sizeof(*lapb), GFP_ATOMIC); in lapb_create_cb() local
121 if (!lapb) in lapb_create_cb()
124 skb_queue_head_init(&lapb->write_queue); in lapb_create_cb()
125 skb_queue_head_init(&lapb->ack_queue); in lapb_create_cb()
127 init_timer(&lapb->t1timer); in lapb_create_cb()
128 init_timer(&lapb->t2timer); in lapb_create_cb()
130 lapb->t1 = LAPB_DEFAULT_T1; in lapb_create_cb()
131 lapb->t2 = LAPB_DEFAULT_T2; in lapb_create_cb()
132 lapb->n2 = LAPB_DEFAULT_N2; in lapb_create_cb()
133 lapb->mode = LAPB_DEFAULT_MODE; in lapb_create_cb()
134 lapb->window = LAPB_DEFAULT_WINDOW; in lapb_create_cb()
135 lapb->state = LAPB_STATE_0; in lapb_create_cb()
136 atomic_set(&lapb->refcnt, 1); in lapb_create_cb()
138 return lapb; in lapb_create_cb()
143 struct lapb_cb *lapb; in lapb_register() local
148 lapb = __lapb_devtostruct(dev); in lapb_register()
149 if (lapb) { in lapb_register()
150 lapb_put(lapb); in lapb_register()
154 lapb = lapb_create_cb(); in lapb_register()
156 if (!lapb) in lapb_register()
159 lapb->dev = dev; in lapb_register()
160 lapb->callbacks = *callbacks; in lapb_register()
162 __lapb_insert_cb(lapb); in lapb_register()
164 lapb_start_t1timer(lapb); in lapb_register()
174 struct lapb_cb *lapb; in lapb_unregister() local
178 lapb = __lapb_devtostruct(dev); in lapb_unregister()
179 if (!lapb) in lapb_unregister()
182 lapb_stop_t1timer(lapb); in lapb_unregister()
183 lapb_stop_t2timer(lapb); in lapb_unregister()
185 lapb_clear_queues(lapb); in lapb_unregister()
187 __lapb_remove_cb(lapb); in lapb_unregister()
189 lapb_put(lapb); in lapb_unregister()
199 struct lapb_cb *lapb = lapb_devtostruct(dev); in lapb_getparms() local
201 if (!lapb) in lapb_getparms()
204 parms->t1 = lapb->t1 / HZ; in lapb_getparms()
205 parms->t2 = lapb->t2 / HZ; in lapb_getparms()
206 parms->n2 = lapb->n2; in lapb_getparms()
207 parms->n2count = lapb->n2count; in lapb_getparms()
208 parms->state = lapb->state; in lapb_getparms()
209 parms->window = lapb->window; in lapb_getparms()
210 parms->mode = lapb->mode; in lapb_getparms()
212 if (!timer_pending(&lapb->t1timer)) in lapb_getparms()
215 parms->t1timer = (lapb->t1timer.expires - jiffies) / HZ; in lapb_getparms()
217 if (!timer_pending(&lapb->t2timer)) in lapb_getparms()
220 parms->t2timer = (lapb->t2timer.expires - jiffies) / HZ; in lapb_getparms()
222 lapb_put(lapb); in lapb_getparms()
231 struct lapb_cb *lapb = lapb_devtostruct(dev); in lapb_setparms() local
233 if (!lapb) in lapb_setparms()
240 if (lapb->state == LAPB_STATE_0) { in lapb_setparms()
248 lapb->mode = parms->mode; in lapb_setparms()
249 lapb->window = parms->window; in lapb_setparms()
252 lapb->t1 = parms->t1 * HZ; in lapb_setparms()
253 lapb->t2 = parms->t2 * HZ; in lapb_setparms()
254 lapb->n2 = parms->n2; in lapb_setparms()
258 lapb_put(lapb); in lapb_setparms()
265 struct lapb_cb *lapb = lapb_devtostruct(dev); in lapb_connect_request() local
268 if (!lapb) in lapb_connect_request()
272 if (lapb->state == LAPB_STATE_1) in lapb_connect_request()
276 if (lapb->state == LAPB_STATE_3 || lapb->state == LAPB_STATE_4) in lapb_connect_request()
279 lapb_establish_data_link(lapb); in lapb_connect_request()
282 printk(KERN_DEBUG "lapb: (%p) S0 -> S1\n", lapb->dev); in lapb_connect_request()
284 lapb->state = LAPB_STATE_1; in lapb_connect_request()
288 lapb_put(lapb); in lapb_connect_request()
295 struct lapb_cb *lapb = lapb_devtostruct(dev); in lapb_disconnect_request() local
298 if (!lapb) in lapb_disconnect_request()
301 switch (lapb->state) { in lapb_disconnect_request()
308 printk(KERN_DEBUG "lapb: (%p) S1 TX DISC(1)\n", lapb->dev); in lapb_disconnect_request()
311 printk(KERN_DEBUG "lapb: (%p) S1 -> S0\n", lapb->dev); in lapb_disconnect_request()
313 lapb_send_control(lapb, LAPB_DISC, LAPB_POLLON, LAPB_COMMAND); in lapb_disconnect_request()
314 lapb->state = LAPB_STATE_0; in lapb_disconnect_request()
315 lapb_start_t1timer(lapb); in lapb_disconnect_request()
324 lapb_clear_queues(lapb); in lapb_disconnect_request()
325 lapb->n2count = 0; in lapb_disconnect_request()
326 lapb_send_control(lapb, LAPB_DISC, LAPB_POLLON, LAPB_COMMAND); in lapb_disconnect_request()
327 lapb_start_t1timer(lapb); in lapb_disconnect_request()
328 lapb_stop_t2timer(lapb); in lapb_disconnect_request()
329 lapb->state = LAPB_STATE_2; in lapb_disconnect_request()
332 printk(KERN_DEBUG "lapb: (%p) S3 DISC(1)\n", lapb->dev); in lapb_disconnect_request()
335 printk(KERN_DEBUG "lapb: (%p) S3 -> S2\n", lapb->dev); in lapb_disconnect_request()
340 lapb_put(lapb); in lapb_disconnect_request()
347 struct lapb_cb *lapb = lapb_devtostruct(dev); in lapb_data_request() local
350 if (!lapb) in lapb_data_request()
354 if (lapb->state != LAPB_STATE_3 && lapb->state != LAPB_STATE_4) in lapb_data_request()
357 skb_queue_tail(&lapb->write_queue, skb); in lapb_data_request()
358 lapb_kick(lapb); in lapb_data_request()
361 lapb_put(lapb); in lapb_data_request()
368 struct lapb_cb *lapb = lapb_devtostruct(dev); in lapb_data_received() local
371 if (lapb) { in lapb_data_received()
372 lapb_data_input(lapb, skb); in lapb_data_received()
373 lapb_put(lapb); in lapb_data_received()
380 void lapb_connect_confirmation(struct lapb_cb *lapb, int reason) in lapb_connect_confirmation() argument
382 if (lapb->callbacks.connect_confirmation) in lapb_connect_confirmation()
383 lapb->callbacks.connect_confirmation(lapb->dev, reason); in lapb_connect_confirmation()
386 void lapb_connect_indication(struct lapb_cb *lapb, int reason) in lapb_connect_indication() argument
388 if (lapb->callbacks.connect_indication) in lapb_connect_indication()
389 lapb->callbacks.connect_indication(lapb->dev, reason); in lapb_connect_indication()
392 void lapb_disconnect_confirmation(struct lapb_cb *lapb, int reason) in lapb_disconnect_confirmation() argument
394 if (lapb->callbacks.disconnect_confirmation) in lapb_disconnect_confirmation()
395 lapb->callbacks.disconnect_confirmation(lapb->dev, reason); in lapb_disconnect_confirmation()
398 void lapb_disconnect_indication(struct lapb_cb *lapb, int reason) in lapb_disconnect_indication() argument
400 if (lapb->callbacks.disconnect_indication) in lapb_disconnect_indication()
401 lapb->callbacks.disconnect_indication(lapb->dev, reason); in lapb_disconnect_indication()
404 int lapb_data_indication(struct lapb_cb *lapb, struct sk_buff *skb) in lapb_data_indication() argument
406 if (lapb->callbacks.data_indication) in lapb_data_indication()
407 return lapb->callbacks.data_indication(lapb->dev, skb); in lapb_data_indication()
413 int lapb_data_transmit(struct lapb_cb *lapb, struct sk_buff *skb) in lapb_data_transmit() argument
417 if (lapb->callbacks.data_transmit) { in lapb_data_transmit()
418 lapb->callbacks.data_transmit(lapb->dev, skb); in lapb_data_transmit()