Lines Matching defs:ax25
20 #include <net/ax25.h>
35 ax25_cb *ax25;
55 if ((ax25 = ax25_find_cb(src, dest, digi, dev)) != NULL) {
56 ax25_output(ax25, paclen, skb);
57 return ax25; /* It already existed */
67 if ((ax25 = ax25_create_cb()) == NULL) {
71 ax25_fillin_cb(ax25, ax25_dev);
74 ax25->source_addr = *src;
75 ax25->dest_addr = *dest;
78 ax25->digipeat = kmemdup(digi, sizeof(*digi), GFP_ATOMIC);
79 if (ax25->digipeat == NULL) {
80 ax25_cb_put(ax25);
85 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) {
88 ax25_std_establish_data_link(ax25);
94 ax25_ds_establish_data_link(ax25);
96 ax25_std_establish_data_link(ax25);
105 ax25_cb_hold(ax25);
107 ax25_cb_add(ax25);
109 ax25->state = AX25_STATE_1;
111 ax25_start_heartbeat(ax25);
113 ax25_output(ax25, paclen, skb);
115 return ax25; /* We had to create it */
126 void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb)
191 skb_queue_tail(&ax25->write_queue, skbn); /* Throw it on the queue */
196 skb_queue_tail(&ax25->write_queue, skb); /* Throw it on the queue */
199 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) {
202 ax25_kick(ax25);
211 if (!ax25->ax25_dev->dama.slave) ax25_kick(ax25);
221 static void ax25_send_iframe(ax25_cb *ax25, struct sk_buff *skb, int poll_bit)
230 if (ax25->modulus == AX25_MODULUS) {
235 *frame |= (ax25->vr << 5);
236 *frame |= (ax25->vs << 1);
241 frame[0] |= (ax25->vs << 1);
243 frame[1] |= (ax25->vr << 1);
246 ax25_start_idletimer(ax25);
248 ax25_transmit_buffer(ax25, skb, AX25_COMMAND);
251 void ax25_kick(ax25_cb *ax25)
257 if (ax25->state != AX25_STATE_3 && ax25->state != AX25_STATE_4)
260 if (ax25->condition & AX25_COND_PEER_RX_BUSY)
263 if (skb_peek(&ax25->write_queue) == NULL)
266 start = (skb_peek(&ax25->ack_queue) == NULL) ? ax25->va : ax25->vs;
267 end = (ax25->va + ax25->window) % ax25->modulus;
282 skb = skb_dequeue(&ax25->write_queue);
286 ax25->vs = start;
290 skb_queue_head(&ax25->write_queue, skb);
297 next = (ax25->vs + 1) % ax25->modulus;
305 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) {
308 ax25_send_iframe(ax25, skbn, (last) ? AX25_POLLON : AX25_POLLOFF);
313 ax25_send_iframe(ax25, skbn, AX25_POLLOFF);
318 ax25->vs = next;
323 skb_queue_tail(&ax25->ack_queue, skb);
325 } while (!last && (skb = skb_dequeue(&ax25->write_queue)) != NULL);
327 ax25->condition &= ~AX25_COND_ACK_PENDING;
329 if (!ax25_t1timer_running(ax25)) {
330 ax25_stop_t3timer(ax25);
331 ax25_calculate_t1(ax25);
332 ax25_start_t1timer(ax25);
336 void ax25_transmit_buffer(ax25_cb *ax25, struct sk_buff *skb, int type)
341 if (ax25->ax25_dev == NULL) {
342 ax25_disconnect(ax25, ENETUNREACH);
346 headroom = ax25_addr_size(ax25->digipeat);
358 ax25_addr_build(ptr, &ax25->source_addr, &ax25->dest_addr, ax25->digipeat, type, ax25->modulus);
360 ax25_queue_xmit(skb, ax25->ax25_dev->dev);
381 int ax25_check_iframes_acked(ax25_cb *ax25, unsigned short nr)
383 if (ax25->vs == nr) {
384 ax25_frames_acked(ax25, nr);
385 ax25_calculate_rtt(ax25);
386 ax25_stop_t1timer(ax25);
387 ax25_start_t3timer(ax25);
390 if (ax25->va != nr) {
391 ax25_frames_acked(ax25, nr);
392 ax25_calculate_t1(ax25);
393 ax25_start_t1timer(ax25);