Lines Matching refs:tp_vars

143 static void batadv_tp_update_cwnd(struct batadv_tp_vars *tp_vars, u32 mss)  in batadv_tp_update_cwnd()  argument
145 spin_lock_bh(&tp_vars->cwnd_lock); in batadv_tp_update_cwnd()
148 if (tp_vars->cwnd <= tp_vars->ss_threshold) { in batadv_tp_update_cwnd()
149 tp_vars->dec_cwnd = 0; in batadv_tp_update_cwnd()
150 tp_vars->cwnd = batadv_tp_cwnd(tp_vars->cwnd, mss, mss); in batadv_tp_update_cwnd()
151 spin_unlock_bh(&tp_vars->cwnd_lock); in batadv_tp_update_cwnd()
156 tp_vars->dec_cwnd += max_t(u32, 1U << 3, in batadv_tp_update_cwnd()
157 ((mss * mss) << 6) / (tp_vars->cwnd << 3)); in batadv_tp_update_cwnd()
158 if (tp_vars->dec_cwnd < (mss << 3)) { in batadv_tp_update_cwnd()
159 spin_unlock_bh(&tp_vars->cwnd_lock); in batadv_tp_update_cwnd()
163 tp_vars->cwnd = batadv_tp_cwnd(tp_vars->cwnd, mss, mss); in batadv_tp_update_cwnd()
164 tp_vars->dec_cwnd = 0; in batadv_tp_update_cwnd()
166 spin_unlock_bh(&tp_vars->cwnd_lock); in batadv_tp_update_cwnd()
174 static void batadv_tp_update_rto(struct batadv_tp_vars *tp_vars, in batadv_tp_update_rto() argument
185 if (tp_vars->srtt != 0) { in batadv_tp_update_rto()
186 m -= (tp_vars->srtt >> 3); /* m is now error in rtt est */ in batadv_tp_update_rto()
187 tp_vars->srtt += m; /* rtt = 7/8 srtt + 1/8 new */ in batadv_tp_update_rto()
191 m -= (tp_vars->rttvar >> 2); in batadv_tp_update_rto()
192 tp_vars->rttvar += m; /* mdev ~= 3/4 rttvar + 1/4 new */ in batadv_tp_update_rto()
195 tp_vars->srtt = m << 3; /* take the measured time to be srtt */ in batadv_tp_update_rto()
196 tp_vars->rttvar = m << 1; /* new_rtt / 2 */ in batadv_tp_update_rto()
202 tp_vars->rto = (tp_vars->srtt >> 3) + tp_vars->rttvar; in batadv_tp_update_rto()
265 struct batadv_tp_vars *pos, *tp_vars = NULL; in batadv_tp_list_find() local
279 tp_vars = pos; in batadv_tp_list_find()
284 return tp_vars; in batadv_tp_list_find()
304 struct batadv_tp_vars *pos, *tp_vars = NULL; in batadv_tp_list_find_session() local
321 tp_vars = pos; in batadv_tp_list_find_session()
326 return tp_vars; in batadv_tp_list_find_session()
336 struct batadv_tp_vars *tp_vars; in batadv_tp_vars_release() local
339 tp_vars = container_of(ref, struct batadv_tp_vars, refcount); in batadv_tp_vars_release()
344 spin_lock_bh(&tp_vars->unacked_lock); in batadv_tp_vars_release()
345 list_for_each_entry_safe(un, safe, &tp_vars->unacked_list, list) { in batadv_tp_vars_release()
349 spin_unlock_bh(&tp_vars->unacked_lock); in batadv_tp_vars_release()
351 kfree_rcu(tp_vars, rcu); in batadv_tp_vars_release()
359 static void batadv_tp_vars_put(struct batadv_tp_vars *tp_vars) in batadv_tp_vars_put() argument
361 if (!tp_vars) in batadv_tp_vars_put()
364 kref_put(&tp_vars->refcount, batadv_tp_vars_release); in batadv_tp_vars_put()
373 struct batadv_tp_vars *tp_vars) in batadv_tp_sender_cleanup() argument
375 cancel_delayed_work(&tp_vars->finish_work); in batadv_tp_sender_cleanup()
377 spin_lock_bh(&tp_vars->bat_priv->tp_list_lock); in batadv_tp_sender_cleanup()
378 hlist_del_rcu(&tp_vars->list); in batadv_tp_sender_cleanup()
379 spin_unlock_bh(&tp_vars->bat_priv->tp_list_lock); in batadv_tp_sender_cleanup()
382 batadv_tp_vars_put(tp_vars); in batadv_tp_sender_cleanup()
384 atomic_dec(&tp_vars->bat_priv->tp_num); in batadv_tp_sender_cleanup()
387 del_timer_sync(&tp_vars->timer); in batadv_tp_sender_cleanup()
393 del_timer(&tp_vars->timer); in batadv_tp_sender_cleanup()
394 batadv_tp_vars_put(tp_vars); in batadv_tp_sender_cleanup()
403 struct batadv_tp_vars *tp_vars) in batadv_tp_sender_end() argument
409 tp_vars->other_end, tp_vars->reason); in batadv_tp_sender_end()
413 tp_vars->srtt >> 3, tp_vars->rttvar >> 2, tp_vars->rto); in batadv_tp_sender_end()
417 tp_vars->cwnd, tp_vars->ss_threshold); in batadv_tp_sender_end()
419 session_cookie = batadv_tp_session_cookie(tp_vars->session, in batadv_tp_sender_end()
420 tp_vars->icmp_uid); in batadv_tp_sender_end()
422 batadv_tp_batctl_notify(tp_vars->reason, in batadv_tp_sender_end()
423 tp_vars->other_end, in batadv_tp_sender_end()
425 tp_vars->start_time, in batadv_tp_sender_end()
426 atomic64_read(&tp_vars->tot_sent), in batadv_tp_sender_end()
435 static void batadv_tp_sender_shutdown(struct batadv_tp_vars *tp_vars, in batadv_tp_sender_shutdown() argument
438 if (!atomic_dec_and_test(&tp_vars->sending)) in batadv_tp_sender_shutdown()
441 tp_vars->reason = reason; in batadv_tp_sender_shutdown()
451 struct batadv_tp_vars *tp_vars; in batadv_tp_sender_finish() local
454 tp_vars = container_of(delayed_work, struct batadv_tp_vars, in batadv_tp_sender_finish()
457 batadv_tp_sender_shutdown(tp_vars, BATADV_TP_REASON_COMPLETE); in batadv_tp_sender_finish()
466 static void batadv_tp_reset_sender_timer(struct batadv_tp_vars *tp_vars) in batadv_tp_reset_sender_timer() argument
471 if (unlikely(atomic_read(&tp_vars->sending) == 0)) in batadv_tp_reset_sender_timer()
475 mod_timer(&tp_vars->timer, jiffies + msecs_to_jiffies(tp_vars->rto)); in batadv_tp_reset_sender_timer()
488 struct batadv_tp_vars *tp_vars = from_timer(tp_vars, t, timer); in batadv_tp_sender_timeout() local
489 struct batadv_priv *bat_priv = tp_vars->bat_priv; in batadv_tp_sender_timeout()
491 if (atomic_read(&tp_vars->sending) == 0) in batadv_tp_sender_timeout()
495 if (unlikely(tp_vars->rto >= BATADV_TP_MAX_RTO)) { in batadv_tp_sender_timeout()
496 batadv_tp_sender_shutdown(tp_vars, in batadv_tp_sender_timeout()
504 tp_vars->rto <<= 1; in batadv_tp_sender_timeout()
506 spin_lock_bh(&tp_vars->cwnd_lock); in batadv_tp_sender_timeout()
508 tp_vars->ss_threshold = tp_vars->cwnd >> 1; in batadv_tp_sender_timeout()
509 if (tp_vars->ss_threshold < BATADV_TP_PLEN * 2) in batadv_tp_sender_timeout()
510 tp_vars->ss_threshold = BATADV_TP_PLEN * 2; in batadv_tp_sender_timeout()
514 tp_vars->other_end, tp_vars->cwnd, tp_vars->ss_threshold, in batadv_tp_sender_timeout()
515 atomic_read(&tp_vars->last_acked)); in batadv_tp_sender_timeout()
517 tp_vars->cwnd = BATADV_TP_PLEN * 3; in batadv_tp_sender_timeout()
519 spin_unlock_bh(&tp_vars->cwnd_lock); in batadv_tp_sender_timeout()
522 tp_vars->last_sent = atomic_read(&tp_vars->last_acked); in batadv_tp_sender_timeout()
523 wake_up(&tp_vars->more_bytes); in batadv_tp_sender_timeout()
525 batadv_tp_reset_sender_timer(tp_vars); in batadv_tp_sender_timeout()
534 static void batadv_tp_fill_prerandom(struct batadv_tp_vars *tp_vars, in batadv_tp_fill_prerandom() argument
542 spin_lock_bh(&tp_vars->prerandom_lock); in batadv_tp_fill_prerandom()
543 local_offset = tp_vars->prerandom_offset; in batadv_tp_fill_prerandom()
544 tp_vars->prerandom_offset += nbytes; in batadv_tp_fill_prerandom()
545 tp_vars->prerandom_offset %= sizeof(batadv_tp_prerandom); in batadv_tp_fill_prerandom()
546 spin_unlock_bh(&tp_vars->prerandom_lock); in batadv_tp_fill_prerandom()
577 static int batadv_tp_send_msg(struct batadv_tp_vars *tp_vars, const u8 *src, in batadv_tp_send_msg() argument
611 batadv_tp_fill_prerandom(tp_vars, data, data_len); in batadv_tp_send_msg()
633 struct batadv_tp_vars *tp_vars; in batadv_tp_recv_ack() local
645 tp_vars = batadv_tp_list_find_session(bat_priv, icmp->orig, in batadv_tp_recv_ack()
647 if (unlikely(!tp_vars)) in batadv_tp_recv_ack()
650 if (unlikely(atomic_read(&tp_vars->sending) == 0)) in batadv_tp_recv_ack()
655 (u32)atomic_read(&tp_vars->last_acked))) in batadv_tp_recv_ack()
669 batadv_tp_update_rto(tp_vars, rtt); in batadv_tp_recv_ack()
672 batadv_tp_reset_sender_timer(tp_vars); in batadv_tp_recv_ack()
677 if (atomic_read(&tp_vars->last_acked) == recv_ack) { in batadv_tp_recv_ack()
678 atomic_inc(&tp_vars->dup_acks); in batadv_tp_recv_ack()
679 if (atomic_read(&tp_vars->dup_acks) != 3) in batadv_tp_recv_ack()
682 if (recv_ack >= tp_vars->recover) in batadv_tp_recv_ack()
686 batadv_tp_send_msg(tp_vars, primary_if->net_dev->dev_addr, in batadv_tp_recv_ack()
691 spin_lock_bh(&tp_vars->cwnd_lock); in batadv_tp_recv_ack()
694 tp_vars->fast_recovery = true; in batadv_tp_recv_ack()
698 tp_vars->recover = tp_vars->last_sent; in batadv_tp_recv_ack()
699 tp_vars->ss_threshold = tp_vars->cwnd >> 1; in batadv_tp_recv_ack()
702 tp_vars->cwnd, tp_vars->ss_threshold, in batadv_tp_recv_ack()
703 tp_vars->last_sent, recv_ack); in batadv_tp_recv_ack()
704 tp_vars->cwnd = batadv_tp_cwnd(tp_vars->ss_threshold, 3 * mss, in batadv_tp_recv_ack()
706 tp_vars->dec_cwnd = 0; in batadv_tp_recv_ack()
707 tp_vars->last_sent = recv_ack; in batadv_tp_recv_ack()
709 spin_unlock_bh(&tp_vars->cwnd_lock); in batadv_tp_recv_ack()
712 atomic64_add(recv_ack - atomic_read(&tp_vars->last_acked), in batadv_tp_recv_ack()
713 &tp_vars->tot_sent); in batadv_tp_recv_ack()
715 atomic_set(&tp_vars->dup_acks, 0); in batadv_tp_recv_ack()
717 if (tp_vars->fast_recovery) { in batadv_tp_recv_ack()
719 if (batadv_seq_before(recv_ack, tp_vars->recover)) { in batadv_tp_recv_ack()
725 batadv_tp_send_msg(tp_vars, dev_addr, in batadv_tp_recv_ack()
730 tp_vars->cwnd = batadv_tp_cwnd(tp_vars->cwnd, in batadv_tp_recv_ack()
733 tp_vars->fast_recovery = false; in batadv_tp_recv_ack()
738 cwnd = batadv_tp_cwnd(tp_vars->ss_threshold, 0, in batadv_tp_recv_ack()
740 tp_vars->cwnd = cwnd; in batadv_tp_recv_ack()
745 if (recv_ack - atomic_read(&tp_vars->last_acked) >= mss) in batadv_tp_recv_ack()
746 batadv_tp_update_cwnd(tp_vars, mss); in batadv_tp_recv_ack()
749 atomic_set(&tp_vars->last_acked, recv_ack); in batadv_tp_recv_ack()
752 wake_up(&tp_vars->more_bytes); in batadv_tp_recv_ack()
756 batadv_tp_vars_put(tp_vars); in batadv_tp_recv_ack()
766 static bool batadv_tp_avail(struct batadv_tp_vars *tp_vars, in batadv_tp_avail() argument
771 win_limit = atomic_read(&tp_vars->last_acked) + tp_vars->cwnd; in batadv_tp_avail()
772 win_left = win_limit - tp_vars->last_sent; in batadv_tp_avail()
788 static int batadv_tp_wait_available(struct batadv_tp_vars *tp_vars, size_t plen) in batadv_tp_wait_available() argument
792 ret = wait_event_interruptible_timeout(tp_vars->more_bytes, in batadv_tp_wait_available()
793 batadv_tp_avail(tp_vars, plen), in batadv_tp_wait_available()
807 struct batadv_tp_vars *tp_vars = arg; in batadv_tp_send() local
808 struct batadv_priv *bat_priv = tp_vars->bat_priv; in batadv_tp_send()
814 if (unlikely(tp_vars->role != BATADV_TP_SENDER)) { in batadv_tp_send()
816 tp_vars->reason = err; in batadv_tp_send()
820 orig_node = batadv_orig_hash_find(bat_priv, tp_vars->other_end); in batadv_tp_send()
823 tp_vars->reason = err; in batadv_tp_send()
830 tp_vars->reason = err; in batadv_tp_send()
843 batadv_tp_reset_sender_timer(tp_vars); in batadv_tp_send()
846 queue_delayed_work(batadv_event_workqueue, &tp_vars->finish_work, in batadv_tp_send()
847 msecs_to_jiffies(tp_vars->test_length)); in batadv_tp_send()
849 while (atomic_read(&tp_vars->sending) != 0) { in batadv_tp_send()
850 if (unlikely(!batadv_tp_avail(tp_vars, payload_len))) { in batadv_tp_send()
851 batadv_tp_wait_available(tp_vars, payload_len); in batadv_tp_send()
860 err = batadv_tp_send_msg(tp_vars, primary_if->net_dev->dev_addr, in batadv_tp_send()
861 orig_node, tp_vars->last_sent, in batadv_tp_send()
863 tp_vars->session, tp_vars->icmp_uid, in batadv_tp_send()
872 if (atomic_dec_and_test(&tp_vars->sending)) in batadv_tp_send()
873 tp_vars->reason = err; in batadv_tp_send()
879 tp_vars->last_sent += payload_len; in batadv_tp_send()
888 batadv_tp_sender_end(bat_priv, tp_vars); in batadv_tp_send()
889 batadv_tp_sender_cleanup(bat_priv, tp_vars); in batadv_tp_send()
891 batadv_tp_vars_put(tp_vars); in batadv_tp_send()
901 static void batadv_tp_start_kthread(struct batadv_tp_vars *tp_vars) in batadv_tp_start_kthread() argument
904 struct batadv_priv *bat_priv = tp_vars->bat_priv; in batadv_tp_start_kthread()
907 kref_get(&tp_vars->refcount); in batadv_tp_start_kthread()
908 kthread = kthread_create(batadv_tp_send, tp_vars, "kbatadv_tp_meter"); in batadv_tp_start_kthread()
910 session_cookie = batadv_tp_session_cookie(tp_vars->session, in batadv_tp_start_kthread()
911 tp_vars->icmp_uid); in batadv_tp_start_kthread()
914 tp_vars->other_end, in batadv_tp_start_kthread()
918 batadv_tp_vars_put(tp_vars); in batadv_tp_start_kthread()
921 batadv_tp_sender_cleanup(bat_priv, tp_vars); in batadv_tp_start_kthread()
938 struct batadv_tp_vars *tp_vars; in batadv_tp_start() local
950 tp_vars = batadv_tp_list_find(bat_priv, dst); in batadv_tp_start()
951 if (tp_vars) { in batadv_tp_start()
953 batadv_tp_vars_put(tp_vars); in batadv_tp_start()
970 tp_vars = kmalloc(sizeof(*tp_vars), GFP_ATOMIC); in batadv_tp_start()
971 if (!tp_vars) { in batadv_tp_start()
982 ether_addr_copy(tp_vars->other_end, dst); in batadv_tp_start()
983 kref_init(&tp_vars->refcount); in batadv_tp_start()
984 tp_vars->role = BATADV_TP_SENDER; in batadv_tp_start()
985 atomic_set(&tp_vars->sending, 1); in batadv_tp_start()
986 memcpy(tp_vars->session, session_id, sizeof(session_id)); in batadv_tp_start()
987 tp_vars->icmp_uid = icmp_uid; in batadv_tp_start()
989 tp_vars->last_sent = BATADV_TP_FIRST_SEQ; in batadv_tp_start()
990 atomic_set(&tp_vars->last_acked, BATADV_TP_FIRST_SEQ); in batadv_tp_start()
991 tp_vars->fast_recovery = false; in batadv_tp_start()
992 tp_vars->recover = BATADV_TP_FIRST_SEQ; in batadv_tp_start()
998 tp_vars->cwnd = BATADV_TP_PLEN * 3; in batadv_tp_start()
1002 tp_vars->ss_threshold = BATADV_TP_AWND; in batadv_tp_start()
1007 tp_vars->rto = 1000; in batadv_tp_start()
1008 tp_vars->srtt = 0; in batadv_tp_start()
1009 tp_vars->rttvar = 0; in batadv_tp_start()
1011 atomic64_set(&tp_vars->tot_sent, 0); in batadv_tp_start()
1013 kref_get(&tp_vars->refcount); in batadv_tp_start()
1014 timer_setup(&tp_vars->timer, batadv_tp_sender_timeout, 0); in batadv_tp_start()
1016 tp_vars->bat_priv = bat_priv; in batadv_tp_start()
1017 tp_vars->start_time = jiffies; in batadv_tp_start()
1019 init_waitqueue_head(&tp_vars->more_bytes); in batadv_tp_start()
1021 spin_lock_init(&tp_vars->unacked_lock); in batadv_tp_start()
1022 INIT_LIST_HEAD(&tp_vars->unacked_list); in batadv_tp_start()
1024 spin_lock_init(&tp_vars->cwnd_lock); in batadv_tp_start()
1026 tp_vars->prerandom_offset = 0; in batadv_tp_start()
1027 spin_lock_init(&tp_vars->prerandom_lock); in batadv_tp_start()
1029 kref_get(&tp_vars->refcount); in batadv_tp_start()
1030 hlist_add_head_rcu(&tp_vars->list, &bat_priv->tp_list); in batadv_tp_start()
1033 tp_vars->test_length = test_length; in batadv_tp_start()
1034 if (!tp_vars->test_length) in batadv_tp_start()
1035 tp_vars->test_length = BATADV_TP_DEF_TEST_LENGTH; in batadv_tp_start()
1042 INIT_DELAYED_WORK(&tp_vars->finish_work, batadv_tp_sender_finish); in batadv_tp_start()
1047 batadv_tp_start_kthread(tp_vars); in batadv_tp_start()
1050 batadv_tp_vars_put(tp_vars); in batadv_tp_start()
1063 struct batadv_tp_vars *tp_vars; in batadv_tp_stop() local
1072 tp_vars = batadv_tp_list_find(bat_priv, orig_node->orig); in batadv_tp_stop()
1073 if (!tp_vars) { in batadv_tp_stop()
1079 batadv_tp_sender_shutdown(tp_vars, return_value); in batadv_tp_stop()
1080 batadv_tp_vars_put(tp_vars); in batadv_tp_stop()
1091 static void batadv_tp_reset_receiver_timer(struct batadv_tp_vars *tp_vars) in batadv_tp_reset_receiver_timer() argument
1093 mod_timer(&tp_vars->timer, in batadv_tp_reset_receiver_timer()
1104 struct batadv_tp_vars *tp_vars = from_timer(tp_vars, t, timer); in batadv_tp_receiver_shutdown() local
1108 bat_priv = tp_vars->bat_priv; in batadv_tp_receiver_shutdown()
1111 if (!batadv_has_timed_out(tp_vars->last_recv_time, in batadv_tp_receiver_shutdown()
1114 batadv_tp_reset_receiver_timer(tp_vars); in batadv_tp_receiver_shutdown()
1120 BATADV_TP_RECV_TIMEOUT, tp_vars->other_end); in batadv_tp_receiver_shutdown()
1122 spin_lock_bh(&tp_vars->bat_priv->tp_list_lock); in batadv_tp_receiver_shutdown()
1123 hlist_del_rcu(&tp_vars->list); in batadv_tp_receiver_shutdown()
1124 spin_unlock_bh(&tp_vars->bat_priv->tp_list_lock); in batadv_tp_receiver_shutdown()
1127 batadv_tp_vars_put(tp_vars); in batadv_tp_receiver_shutdown()
1131 spin_lock_bh(&tp_vars->unacked_lock); in batadv_tp_receiver_shutdown()
1132 list_for_each_entry_safe(un, safe, &tp_vars->unacked_list, list) { in batadv_tp_receiver_shutdown()
1136 spin_unlock_bh(&tp_vars->unacked_lock); in batadv_tp_receiver_shutdown()
1139 batadv_tp_vars_put(tp_vars); in batadv_tp_receiver_shutdown()
1223 static bool batadv_tp_handle_out_of_order(struct batadv_tp_vars *tp_vars, in batadv_tp_handle_out_of_order() argument
1241 spin_lock_bh(&tp_vars->unacked_lock); in batadv_tp_handle_out_of_order()
1243 if (list_empty(&tp_vars->unacked_list)) { in batadv_tp_handle_out_of_order()
1244 list_add(&new->list, &tp_vars->unacked_list); in batadv_tp_handle_out_of_order()
1255 list_for_each_entry_reverse(un, &tp_vars->unacked_list, list) { in batadv_tp_handle_out_of_order()
1280 list_add(&new->list, &tp_vars->unacked_list); in batadv_tp_handle_out_of_order()
1283 spin_unlock_bh(&tp_vars->unacked_lock); in batadv_tp_handle_out_of_order()
1293 static void batadv_tp_ack_unordered(struct batadv_tp_vars *tp_vars) in batadv_tp_ack_unordered() argument
1301 spin_lock_bh(&tp_vars->unacked_lock); in batadv_tp_ack_unordered()
1302 list_for_each_entry_safe(un, safe, &tp_vars->unacked_list, list) { in batadv_tp_ack_unordered()
1307 if (batadv_seq_before(tp_vars->last_recv, un->seqno)) in batadv_tp_ack_unordered()
1310 to_ack = un->seqno + un->len - tp_vars->last_recv; in batadv_tp_ack_unordered()
1312 if (batadv_seq_before(tp_vars->last_recv, un->seqno + un->len)) in batadv_tp_ack_unordered()
1313 tp_vars->last_recv += to_ack; in batadv_tp_ack_unordered()
1318 spin_unlock_bh(&tp_vars->unacked_lock); in batadv_tp_ack_unordered()
1332 struct batadv_tp_vars *tp_vars; in batadv_tp_init_recv() local
1335 tp_vars = batadv_tp_list_find_session(bat_priv, icmp->orig, in batadv_tp_init_recv()
1337 if (tp_vars) in batadv_tp_init_recv()
1346 tp_vars = kmalloc(sizeof(*tp_vars), GFP_ATOMIC); in batadv_tp_init_recv()
1347 if (!tp_vars) in batadv_tp_init_recv()
1350 ether_addr_copy(tp_vars->other_end, icmp->orig); in batadv_tp_init_recv()
1351 tp_vars->role = BATADV_TP_RECEIVER; in batadv_tp_init_recv()
1352 memcpy(tp_vars->session, icmp->session, sizeof(tp_vars->session)); in batadv_tp_init_recv()
1353 tp_vars->last_recv = BATADV_TP_FIRST_SEQ; in batadv_tp_init_recv()
1354 tp_vars->bat_priv = bat_priv; in batadv_tp_init_recv()
1355 kref_init(&tp_vars->refcount); in batadv_tp_init_recv()
1357 spin_lock_init(&tp_vars->unacked_lock); in batadv_tp_init_recv()
1358 INIT_LIST_HEAD(&tp_vars->unacked_list); in batadv_tp_init_recv()
1360 kref_get(&tp_vars->refcount); in batadv_tp_init_recv()
1361 hlist_add_head_rcu(&tp_vars->list, &bat_priv->tp_list); in batadv_tp_init_recv()
1363 kref_get(&tp_vars->refcount); in batadv_tp_init_recv()
1364 timer_setup(&tp_vars->timer, batadv_tp_receiver_shutdown, 0); in batadv_tp_init_recv()
1366 batadv_tp_reset_receiver_timer(tp_vars); in batadv_tp_init_recv()
1371 return tp_vars; in batadv_tp_init_recv()
1385 struct batadv_tp_vars *tp_vars; in batadv_tp_recv_msg() local
1396 tp_vars = batadv_tp_init_recv(bat_priv, icmp); in batadv_tp_recv_msg()
1397 if (!tp_vars) { in batadv_tp_recv_msg()
1403 tp_vars = batadv_tp_list_find_session(bat_priv, icmp->orig, in batadv_tp_recv_msg()
1405 if (!tp_vars) { in batadv_tp_recv_msg()
1413 if (unlikely(tp_vars->role != BATADV_TP_RECEIVER)) { in batadv_tp_recv_msg()
1416 tp_vars->role); in batadv_tp_recv_msg()
1420 tp_vars->last_recv_time = jiffies; in batadv_tp_recv_msg()
1425 if (batadv_seq_before(seqno, tp_vars->last_recv)) in batadv_tp_recv_msg()
1429 if (ntohl(icmp->seqno) != tp_vars->last_recv) { in batadv_tp_recv_msg()
1433 if (!batadv_tp_handle_out_of_order(tp_vars, skb)) in batadv_tp_recv_msg()
1442 tp_vars->last_recv += packet_size; in batadv_tp_recv_msg()
1445 batadv_tp_ack_unordered(tp_vars); in batadv_tp_recv_msg()
1452 batadv_tp_send_ack(bat_priv, icmp->orig, tp_vars->last_recv, in batadv_tp_recv_msg()
1455 batadv_tp_vars_put(tp_vars); in batadv_tp_recv_msg()