Release 4.11 net/netrom/nr_timer.c
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk)
* Copyright (C) 2002 Ralf Baechle DO1GRB (ralf@gnu.org)
*/
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/kernel.h>
#include <linux/jiffies.h>
#include <linux/timer.h>
#include <linux/string.h>
#include <linux/sockios.h>
#include <linux/net.h>
#include <net/ax25.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <net/sock.h>
#include <net/tcp_states.h>
#include <linux/uaccess.h>
#include <linux/fcntl.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <net/netrom.h>
static void nr_heartbeat_expiry(unsigned long);
static void nr_t1timer_expiry(unsigned long);
static void nr_t2timer_expiry(unsigned long);
static void nr_t4timer_expiry(unsigned long);
static void nr_idletimer_expiry(unsigned long);
void nr_init_timers(struct sock *sk)
{
struct nr_sock *nr = nr_sk(sk);
setup_timer(&nr->t1timer, nr_t1timer_expiry, (unsigned long)sk);
setup_timer(&nr->t2timer, nr_t2timer_expiry, (unsigned long)sk);
setup_timer(&nr->t4timer, nr_t4timer_expiry, (unsigned long)sk);
setup_timer(&nr->idletimer, nr_idletimer_expiry, (unsigned long)sk);
/* initialized by sock_init_data */
sk->sk_timer.data = (unsigned long)sk;
sk->sk_timer.function = &nr_heartbeat_expiry;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 40 | 37.74% | 1 | 20.00% |
Vinay K. Nallamothu | 35 | 33.02% | 1 | 20.00% |
Pavel Emelyanov | 20 | 18.87% | 1 | 20.00% |
David S. Miller | 9 | 8.49% | 1 | 20.00% |
Ralf Bächle | 2 | 1.89% | 1 | 20.00% |
Total | 106 | 100.00% | 5 | 100.00% |
void nr_start_t1timer(struct sock *sk)
{
struct nr_sock *nr = nr_sk(sk);
mod_timer(&nr->t1timer, jiffies + nr->t1);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vinay K. Nallamothu | 25 | 73.53% | 1 | 33.33% |
Linus Torvalds (pre-git) | 7 | 20.59% | 1 | 33.33% |
Ralf Bächle | 2 | 5.88% | 1 | 33.33% |
Total | 34 | 100.00% | 3 | 100.00% |
void nr_start_t2timer(struct sock *sk)
{
struct nr_sock *nr = nr_sk(sk);
mod_timer(&nr->t2timer, jiffies + nr->t2);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 15 | 44.12% | 1 | 25.00% |
Vinay K. Nallamothu | 9 | 26.47% | 1 | 25.00% |
David S. Miller | 8 | 23.53% | 1 | 25.00% |
Ralf Bächle | 2 | 5.88% | 1 | 25.00% |
Total | 34 | 100.00% | 4 | 100.00% |
void nr_start_t4timer(struct sock *sk)
{
struct nr_sock *nr = nr_sk(sk);
mod_timer(&nr->t4timer, jiffies + nr->t4);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Vinay K. Nallamothu | 19 | 55.88% | 1 | 33.33% |
Linus Torvalds (pre-git) | 13 | 38.24% | 1 | 33.33% |
Ralf Bächle | 2 | 5.88% | 1 | 33.33% |
Total | 34 | 100.00% | 3 | 100.00% |
void nr_start_idletimer(struct sock *sk)
{
struct nr_sock *nr = nr_sk(sk);
if (nr->idle > 0)
mod_timer(&nr->idletimer, jiffies + nr->idle);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 29 | 69.05% | 1 | 25.00% |
David S. Miller | 8 | 19.05% | 1 | 25.00% |
Vinay K. Nallamothu | 3 | 7.14% | 1 | 25.00% |
Ralf Bächle | 2 | 4.76% | 1 | 25.00% |
Total | 42 | 100.00% | 4 | 100.00% |
void nr_start_heartbeat(struct sock *sk)
{
mod_timer(&sk->sk_timer, jiffies + 5 * HZ);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 21 | 87.50% | 1 | 33.33% |
Vinay K. Nallamothu | 2 | 8.33% | 1 | 33.33% |
Arnaldo Carvalho de Melo | 1 | 4.17% | 1 | 33.33% |
Total | 24 | 100.00% | 3 | 100.00% |
void nr_stop_t1timer(struct sock *sk)
{
del_timer(&nr_sk(sk)->t1timer);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 18 | 85.71% | 1 | 50.00% |
David S. Miller | 3 | 14.29% | 1 | 50.00% |
Total | 21 | 100.00% | 2 | 100.00% |
void nr_stop_t2timer(struct sock *sk)
{
del_timer(&nr_sk(sk)->t2timer);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 18 | 85.71% | 2 | 66.67% |
David S. Miller | 3 | 14.29% | 1 | 33.33% |
Total | 21 | 100.00% | 3 | 100.00% |
void nr_stop_t4timer(struct sock *sk)
{
del_timer(&nr_sk(sk)->t4timer);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 18 | 85.71% | 2 | 66.67% |
David S. Miller | 3 | 14.29% | 1 | 33.33% |
Total | 21 | 100.00% | 3 | 100.00% |
void nr_stop_idletimer(struct sock *sk)
{
del_timer(&nr_sk(sk)->idletimer);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 18 | 85.71% | 2 | 66.67% |
David S. Miller | 3 | 14.29% | 1 | 33.33% |
Total | 21 | 100.00% | 3 | 100.00% |
void nr_stop_heartbeat(struct sock *sk)
{
del_timer(&sk->sk_timer);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 17 | 94.44% | 2 | 66.67% |
Arnaldo Carvalho de Melo | 1 | 5.56% | 1 | 33.33% |
Total | 18 | 100.00% | 3 | 100.00% |
int nr_t1timer_running(struct sock *sk)
{
return timer_pending(&nr_sk(sk)->t1timer);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 19 | 86.36% | 2 | 66.67% |
David S. Miller | 3 | 13.64% | 1 | 33.33% |
Total | 22 | 100.00% | 3 | 100.00% |
static void nr_heartbeat_expiry(unsigned long param)
{
struct sock *sk = (struct sock *)param;
struct nr_sock *nr = nr_sk(sk);
bh_lock_sock(sk);
switch (nr->state) {
case NR_STATE_0:
/* Magic here: If we listen() and a new link dies before it
is accepted() it isn't 'dead' so doesn't get removed. */
if (sock_flag(sk, SOCK_DESTROY) ||
(sk->sk_state == TCP_LISTEN && sock_flag(sk, SOCK_DEAD))) {
sock_hold(sk);
bh_unlock_sock(sk);
nr_destroy_socket(sk);
sock_put(sk);
return;
}
break;
case NR_STATE_3:
/*
* Check for the state of the receive buffer.
*/
if (atomic_read(&sk->sk_rmem_alloc) < (sk->sk_rcvbuf / 2) &&
(nr->condition & NR_COND_OWN_RX_BUSY)) {
nr->condition &= ~NR_COND_OWN_RX_BUSY;
nr->condition &= ~NR_COND_ACK_PENDING;
nr->vl = nr->vr;
nr_write_internal(sk, NR_INFOACK);
break;
}
break;
}
nr_start_heartbeat(sk);
bh_unlock_sock(sk);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 119 | 70.00% | 5 | 35.71% |
Ralf Bächle | 16 | 9.41% | 4 | 28.57% |
Jeroen Vreeken | 14 | 8.24% | 1 | 7.14% |
Arnaldo Carvalho de Melo | 9 | 5.29% | 2 | 14.29% |
David S. Miller | 8 | 4.71% | 1 | 7.14% |
James Morris | 4 | 2.35% | 1 | 7.14% |
Total | 170 | 100.00% | 14 | 100.00% |
static void nr_t2timer_expiry(unsigned long param)
{
struct sock *sk = (struct sock *)param;
struct nr_sock *nr = nr_sk(sk);
bh_lock_sock(sk);
if (nr->condition & NR_COND_ACK_PENDING) {
nr->condition &= ~NR_COND_ACK_PENDING;
nr_enquiry_response(sk);
}
bh_unlock_sock(sk);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 44 | 68.75% | 3 | 50.00% |
Ralf Bächle | 12 | 18.75% | 2 | 33.33% |
David S. Miller | 8 | 12.50% | 1 | 16.67% |
Total | 64 | 100.00% | 6 | 100.00% |
static void nr_t4timer_expiry(unsigned long param)
{
struct sock *sk = (struct sock *)param;
bh_lock_sock(sk);
nr_sk(sk)->condition &= ~NR_COND_PEER_RX_BUSY;
bh_unlock_sock(sk);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 29 | 69.05% | 2 | 50.00% |
Ralf Bächle | 10 | 23.81% | 1 | 25.00% |
David S. Miller | 3 | 7.14% | 1 | 25.00% |
Total | 42 | 100.00% | 4 | 100.00% |
static void nr_idletimer_expiry(unsigned long param)
{
struct sock *sk = (struct sock *)param;
struct nr_sock *nr = nr_sk(sk);
bh_lock_sock(sk);
nr_clear_queues(sk);
nr->n2count = 0;
nr_write_internal(sk, NR_DISCREQ);
nr->state = NR_STATE_2;
nr_start_t1timer(sk);
nr_stop_t2timer(sk);
nr_stop_t4timer(sk);
sk->sk_state = TCP_CLOSE;
sk->sk_err = 0;
sk->sk_shutdown |= SEND_SHUTDOWN;
if (!sock_flag(sk, SOCK_DEAD)) {
sk->sk_state_change(sk);
sock_set_flag(sk, SOCK_DEAD);
}
bh_unlock_sock(sk);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 89 | 71.20% | 3 | 33.33% |
Ralf Bächle | 12 | 9.60% | 2 | 22.22% |
Arnaldo Carvalho de Melo | 12 | 9.60% | 2 | 22.22% |
David S. Miller | 8 | 6.40% | 1 | 11.11% |
James Morris | 4 | 3.20% | 1 | 11.11% |
Total | 125 | 100.00% | 9 | 100.00% |
static void nr_t1timer_expiry(unsigned long param)
{
struct sock *sk = (struct sock *)param;
struct nr_sock *nr = nr_sk(sk);
bh_lock_sock(sk);
switch (nr->state) {
case NR_STATE_1:
if (nr->n2count == nr->n2) {
nr_disconnect(sk, ETIMEDOUT);
bh_unlock_sock(sk);
return;
} else {
nr->n2count++;
nr_write_internal(sk, NR_CONNREQ);
}
break;
case NR_STATE_2:
if (nr->n2count == nr->n2) {
nr_disconnect(sk, ETIMEDOUT);
bh_unlock_sock(sk);
return;
} else {
nr->n2count++;
nr_write_internal(sk, NR_DISCREQ);
}
break;
case NR_STATE_3:
if (nr->n2count == nr->n2) {
nr_disconnect(sk, ETIMEDOUT);
bh_unlock_sock(sk);
return;
} else {
nr->n2count++;
nr_requeue_frames(sk);
}
break;
}
nr_start_t1timer(sk);
bh_unlock_sock(sk);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 150 | 81.08% | 3 | 42.86% |
Jeroen Vreeken | 15 | 8.11% | 1 | 14.29% |
Ralf Bächle | 12 | 6.49% | 2 | 28.57% |
David S. Miller | 8 | 4.32% | 1 | 14.29% |
Total | 185 | 100.00% | 7 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 762 | 70.04% | 7 | 33.33% |
Vinay K. Nallamothu | 93 | 8.55% | 1 | 4.76% |
David S. Miller | 77 | 7.08% | 1 | 4.76% |
Ralf Bächle | 73 | 6.71% | 4 | 19.05% |
Jeroen Vreeken | 29 | 2.67% | 1 | 4.76% |
Arnaldo Carvalho de Melo | 24 | 2.21% | 3 | 14.29% |
Pavel Emelyanov | 20 | 1.84% | 1 | 4.76% |
James Morris | 8 | 0.74% | 1 | 4.76% |
Rusty Russell | 1 | 0.09% | 1 | 4.76% |
Fabian Frederick | 1 | 0.09% | 1 | 4.76% |
Total | 1088 | 100.00% | 21 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.