Lines Matching refs:ax25
38 ax25_cb *ax25; in ax25_send_frame() local
54 if ((ax25 = ax25_find_cb(src, dest, digi, dev)) != NULL) { in ax25_send_frame()
55 ax25_output(ax25, paclen, skb); in ax25_send_frame()
56 return ax25; /* It already existed */ in ax25_send_frame()
62 if ((ax25 = ax25_create_cb()) == NULL) in ax25_send_frame()
65 ax25_fillin_cb(ax25, ax25_dev); in ax25_send_frame()
67 ax25->source_addr = *src; in ax25_send_frame()
68 ax25->dest_addr = *dest; in ax25_send_frame()
71 ax25->digipeat = kmemdup(digi, sizeof(*digi), GFP_ATOMIC); in ax25_send_frame()
72 if (ax25->digipeat == NULL) { in ax25_send_frame()
73 ax25_cb_put(ax25); in ax25_send_frame()
78 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_send_frame()
81 ax25_std_establish_data_link(ax25); in ax25_send_frame()
87 ax25_ds_establish_data_link(ax25); in ax25_send_frame()
89 ax25_std_establish_data_link(ax25); in ax25_send_frame()
98 ax25_cb_hold(ax25); in ax25_send_frame()
100 ax25_cb_add(ax25); in ax25_send_frame()
102 ax25->state = AX25_STATE_1; in ax25_send_frame()
104 ax25_start_heartbeat(ax25); in ax25_send_frame()
106 ax25_output(ax25, paclen, skb); in ax25_send_frame()
108 return ax25; /* We had to create it */ in ax25_send_frame()
119 void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb) in ax25_output() argument
184 skb_queue_tail(&ax25->write_queue, skbn); /* Throw it on the queue */ in ax25_output()
189 skb_queue_tail(&ax25->write_queue, skb); /* Throw it on the queue */ in ax25_output()
192 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_output()
195 ax25_kick(ax25); in ax25_output()
204 if (!ax25->ax25_dev->dama.slave) ax25_kick(ax25); in ax25_output()
214 static void ax25_send_iframe(ax25_cb *ax25, struct sk_buff *skb, int poll_bit) in ax25_send_iframe() argument
223 if (ax25->modulus == AX25_MODULUS) { in ax25_send_iframe()
228 *frame |= (ax25->vr << 5); in ax25_send_iframe()
229 *frame |= (ax25->vs << 1); in ax25_send_iframe()
234 frame[0] |= (ax25->vs << 1); in ax25_send_iframe()
236 frame[1] |= (ax25->vr << 1); in ax25_send_iframe()
239 ax25_start_idletimer(ax25); in ax25_send_iframe()
241 ax25_transmit_buffer(ax25, skb, AX25_COMMAND); in ax25_send_iframe()
244 void ax25_kick(ax25_cb *ax25) in ax25_kick() argument
250 if (ax25->state != AX25_STATE_3 && ax25->state != AX25_STATE_4) in ax25_kick()
253 if (ax25->condition & AX25_COND_PEER_RX_BUSY) in ax25_kick()
256 if (skb_peek(&ax25->write_queue) == NULL) in ax25_kick()
259 start = (skb_peek(&ax25->ack_queue) == NULL) ? ax25->va : ax25->vs; in ax25_kick()
260 end = (ax25->va + ax25->window) % ax25->modulus; in ax25_kick()
275 skb = skb_dequeue(&ax25->write_queue); in ax25_kick()
279 ax25->vs = start; in ax25_kick()
283 skb_queue_head(&ax25->write_queue, skb); in ax25_kick()
290 next = (ax25->vs + 1) % ax25->modulus; in ax25_kick()
298 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_kick()
301 ax25_send_iframe(ax25, skbn, (last) ? AX25_POLLON : AX25_POLLOFF); in ax25_kick()
306 ax25_send_iframe(ax25, skbn, AX25_POLLOFF); in ax25_kick()
311 ax25->vs = next; in ax25_kick()
316 skb_queue_tail(&ax25->ack_queue, skb); in ax25_kick()
318 } while (!last && (skb = skb_dequeue(&ax25->write_queue)) != NULL); in ax25_kick()
320 ax25->condition &= ~AX25_COND_ACK_PENDING; in ax25_kick()
322 if (!ax25_t1timer_running(ax25)) { in ax25_kick()
323 ax25_stop_t3timer(ax25); in ax25_kick()
324 ax25_calculate_t1(ax25); in ax25_kick()
325 ax25_start_t1timer(ax25); in ax25_kick()
329 void ax25_transmit_buffer(ax25_cb *ax25, struct sk_buff *skb, int type) in ax25_transmit_buffer() argument
335 if (ax25->ax25_dev == NULL) { in ax25_transmit_buffer()
336 ax25_disconnect(ax25, ENETUNREACH); in ax25_transmit_buffer()
340 headroom = ax25_addr_size(ax25->digipeat); in ax25_transmit_buffer()
358 ax25_addr_build(ptr, &ax25->source_addr, &ax25->dest_addr, ax25->digipeat, type, ax25->modulus); in ax25_transmit_buffer()
360 ax25_queue_xmit(skb, ax25->ax25_dev->dev); in ax25_transmit_buffer()
379 int ax25_check_iframes_acked(ax25_cb *ax25, unsigned short nr) in ax25_check_iframes_acked() argument
381 if (ax25->vs == nr) { in ax25_check_iframes_acked()
382 ax25_frames_acked(ax25, nr); in ax25_check_iframes_acked()
383 ax25_calculate_rtt(ax25); in ax25_check_iframes_acked()
384 ax25_stop_t1timer(ax25); in ax25_check_iframes_acked()
385 ax25_start_t3timer(ax25); in ax25_check_iframes_acked()
388 if (ax25->va != nr) { in ax25_check_iframes_acked()
389 ax25_frames_acked(ax25, nr); in ax25_check_iframes_acked()
390 ax25_calculate_t1(ax25); in ax25_check_iframes_acked()
391 ax25_start_t1timer(ax25); in ax25_check_iframes_acked()