Lines Matching refs:ax25
35 ax25_cb *ax25; in ax25_send_frame() local
51 if ((ax25 = ax25_find_cb(src, dest, digi, dev)) != NULL) { in ax25_send_frame()
52 ax25_output(ax25, paclen, skb); in ax25_send_frame()
53 return ax25; /* It already existed */ in ax25_send_frame()
59 if ((ax25 = ax25_create_cb()) == NULL) in ax25_send_frame()
62 ax25_fillin_cb(ax25, ax25_dev); in ax25_send_frame()
64 ax25->source_addr = *src; in ax25_send_frame()
65 ax25->dest_addr = *dest; in ax25_send_frame()
68 ax25->digipeat = kmemdup(digi, sizeof(*digi), GFP_ATOMIC); in ax25_send_frame()
69 if (ax25->digipeat == NULL) { in ax25_send_frame()
70 ax25_cb_put(ax25); in ax25_send_frame()
75 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_send_frame()
78 ax25_std_establish_data_link(ax25); in ax25_send_frame()
84 ax25_ds_establish_data_link(ax25); in ax25_send_frame()
86 ax25_std_establish_data_link(ax25); in ax25_send_frame()
95 ax25_cb_hold(ax25); in ax25_send_frame()
97 ax25_cb_add(ax25); in ax25_send_frame()
99 ax25->state = AX25_STATE_1; in ax25_send_frame()
101 ax25_start_heartbeat(ax25); in ax25_send_frame()
103 ax25_output(ax25, paclen, skb); in ax25_send_frame()
105 return ax25; /* We had to create it */ in ax25_send_frame()
116 void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb) in ax25_output() argument
181 skb_queue_tail(&ax25->write_queue, skbn); /* Throw it on the queue */ in ax25_output()
186 skb_queue_tail(&ax25->write_queue, skb); /* Throw it on the queue */ in ax25_output()
189 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_output()
192 ax25_kick(ax25); in ax25_output()
201 if (!ax25->ax25_dev->dama.slave) ax25_kick(ax25); in ax25_output()
211 static void ax25_send_iframe(ax25_cb *ax25, struct sk_buff *skb, int poll_bit) in ax25_send_iframe() argument
220 if (ax25->modulus == AX25_MODULUS) { in ax25_send_iframe()
225 *frame |= (ax25->vr << 5); in ax25_send_iframe()
226 *frame |= (ax25->vs << 1); in ax25_send_iframe()
231 frame[0] |= (ax25->vs << 1); in ax25_send_iframe()
233 frame[1] |= (ax25->vr << 1); in ax25_send_iframe()
236 ax25_start_idletimer(ax25); in ax25_send_iframe()
238 ax25_transmit_buffer(ax25, skb, AX25_COMMAND); in ax25_send_iframe()
241 void ax25_kick(ax25_cb *ax25) in ax25_kick() argument
247 if (ax25->state != AX25_STATE_3 && ax25->state != AX25_STATE_4) in ax25_kick()
250 if (ax25->condition & AX25_COND_PEER_RX_BUSY) in ax25_kick()
253 if (skb_peek(&ax25->write_queue) == NULL) in ax25_kick()
256 start = (skb_peek(&ax25->ack_queue) == NULL) ? ax25->va : ax25->vs; in ax25_kick()
257 end = (ax25->va + ax25->window) % ax25->modulus; in ax25_kick()
272 skb = skb_dequeue(&ax25->write_queue); in ax25_kick()
276 ax25->vs = start; in ax25_kick()
280 skb_queue_head(&ax25->write_queue, skb); in ax25_kick()
287 next = (ax25->vs + 1) % ax25->modulus; in ax25_kick()
295 switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { in ax25_kick()
298 ax25_send_iframe(ax25, skbn, (last) ? AX25_POLLON : AX25_POLLOFF); in ax25_kick()
303 ax25_send_iframe(ax25, skbn, AX25_POLLOFF); in ax25_kick()
308 ax25->vs = next; in ax25_kick()
313 skb_queue_tail(&ax25->ack_queue, skb); in ax25_kick()
315 } while (!last && (skb = skb_dequeue(&ax25->write_queue)) != NULL); in ax25_kick()
317 ax25->condition &= ~AX25_COND_ACK_PENDING; in ax25_kick()
319 if (!ax25_t1timer_running(ax25)) { in ax25_kick()
320 ax25_stop_t3timer(ax25); in ax25_kick()
321 ax25_calculate_t1(ax25); in ax25_kick()
322 ax25_start_t1timer(ax25); in ax25_kick()
326 void ax25_transmit_buffer(ax25_cb *ax25, struct sk_buff *skb, int type) in ax25_transmit_buffer() argument
331 if (ax25->ax25_dev == NULL) { in ax25_transmit_buffer()
332 ax25_disconnect(ax25, ENETUNREACH); in ax25_transmit_buffer()
336 headroom = ax25_addr_size(ax25->digipeat); in ax25_transmit_buffer()
348 ax25_addr_build(ptr, &ax25->source_addr, &ax25->dest_addr, ax25->digipeat, type, ax25->modulus); in ax25_transmit_buffer()
350 ax25_queue_xmit(skb, ax25->ax25_dev->dev); in ax25_transmit_buffer()
369 int ax25_check_iframes_acked(ax25_cb *ax25, unsigned short nr) in ax25_check_iframes_acked() argument
371 if (ax25->vs == nr) { in ax25_check_iframes_acked()
372 ax25_frames_acked(ax25, nr); in ax25_check_iframes_acked()
373 ax25_calculate_rtt(ax25); in ax25_check_iframes_acked()
374 ax25_stop_t1timer(ax25); in ax25_check_iframes_acked()
375 ax25_start_t3timer(ax25); in ax25_check_iframes_acked()
378 if (ax25->va != nr) { in ax25_check_iframes_acked()
379 ax25_frames_acked(ax25, nr); in ax25_check_iframes_acked()
380 ax25_calculate_t1(ax25); in ax25_check_iframes_acked()
381 ax25_start_t1timer(ax25); in ax25_check_iframes_acked()