aboutsummaryrefslogtreecommitdiffstats
path: root/net/phonet/pep.c
diff options
context:
space:
mode:
authorRémi Denis-Courmont <remi.denis-courmont@nokia.com>2011-02-24 18:14:59 -0500
committerDavid S. Miller <davem@davemloft.net>2011-02-25 14:19:36 -0500
commit2feb61816f7f0be57f4bc61137555e9a8cb4f322 (patch)
treeed5a4b75bdc8ebb51bfecf25e96a5555583d8949 /net/phonet/pep.c
parent14ba8faebcc241e4d60a4ef4a7d3fdef1c2e846f (diff)
Phonet: remove redumdant pep->pipe_state
sk->sk_state already contains the pipe state. Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/phonet/pep.c')
-rw-r--r--net/phonet/pep.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index 4fce882d001a..15775a74b6f6 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -527,7 +527,6 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
527 527
528#ifdef CONFIG_PHONET_PIPECTRLR 528#ifdef CONFIG_PHONET_PIPECTRLR
529 case PNS_PEP_DISCONNECT_RESP: 529 case PNS_PEP_DISCONNECT_RESP:
530 pn->pipe_state = PIPE_IDLE;
531 sk->sk_state = TCP_CLOSE; 530 sk->sk_state = TCP_CLOSE;
532 break; 531 break;
533#endif 532#endif
@@ -539,7 +538,6 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
539 538
540#ifdef CONFIG_PHONET_PIPECTRLR 539#ifdef CONFIG_PHONET_PIPECTRLR
541 case PNS_PEP_ENABLE_RESP: 540 case PNS_PEP_ENABLE_RESP:
542 pn->pipe_state = PIPE_ENABLED;
543 pipe_handler_send_ind(sk, PNS_PIPE_ENABLED_IND_UTID, 541 pipe_handler_send_ind(sk, PNS_PIPE_ENABLED_IND_UTID,
544 PNS_PIPE_ENABLED_IND); 542 PNS_PIPE_ENABLED_IND);
545 543
@@ -574,7 +572,6 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
574 572
575#ifdef CONFIG_PHONET_PIPECTRLR 573#ifdef CONFIG_PHONET_PIPECTRLR
576 case PNS_PEP_DISABLE_RESP: 574 case PNS_PEP_DISABLE_RESP:
577 pn->pipe_state = PIPE_DISABLED;
578 atomic_set(&pn->tx_credits, 0); 575 atomic_set(&pn->tx_credits, 0);
579 pipe_handler_send_ind(sk, PNS_PIPE_DISABLED_IND_UTID, 576 pipe_handler_send_ind(sk, PNS_PIPE_DISABLED_IND_UTID,
580 PNS_PIPE_DISABLED_IND); 577 PNS_PIPE_DISABLED_IND);
@@ -692,7 +689,6 @@ static int pep_connresp_rcv(struct sock *sk, struct sk_buff *skb)
692 remote_pref_rx_fc, 689 remote_pref_rx_fc,
693 sizeof(host_pref_rx_fc)); 690 sizeof(host_pref_rx_fc));
694 691
695 pn->pipe_state = PIPE_DISABLED;
696 sk->sk_state = TCP_SYN_RECV; 692 sk->sk_state = TCP_SYN_RECV;
697 sk->sk_backlog_rcv = pipe_do_rcv; 693 sk->sk_backlog_rcv = pipe_do_rcv;
698 sk->sk_destruct = pipe_destruct; 694 sk->sk_destruct = pipe_destruct;
@@ -941,21 +937,18 @@ static void pep_sock_close(struct sock *sk, long timeout)
941 sk_for_each_safe(sknode, p, n, &pn->ackq) 937 sk_for_each_safe(sknode, p, n, &pn->ackq)
942 sk_del_node_init(sknode); 938 sk_del_node_init(sknode);
943 sk->sk_state = TCP_CLOSE; 939 sk->sk_state = TCP_CLOSE;
944 } else if ((1 << sk->sk_state) & (TCPF_SYN_RECV|TCPF_ESTABLISHED)) 940 } else if ((1 << sk->sk_state) & (TCPF_SYN_RECV|TCPF_ESTABLISHED)) {
941#ifndef CONFIG_PHONET_PIPECTRLR
945 /* Forcefully remove dangling Phonet pipe */ 942 /* Forcefully remove dangling Phonet pipe */
946 pipe_do_remove(sk); 943 pipe_do_remove(sk);
947 944#else
948#ifdef CONFIG_PHONET_PIPECTRLR
949 if (pn->pipe_state != PIPE_IDLE) {
950 /* send pep disconnect request */ 945 /* send pep disconnect request */
951 pipe_handler_send_req(sk, 946 pipe_handler_send_req(sk,
952 PNS_PEP_DISCONNECT_UTID, PNS_PEP_DISCONNECT_REQ, 947 PNS_PEP_DISCONNECT_UTID, PNS_PEP_DISCONNECT_REQ,
953 GFP_KERNEL); 948 GFP_KERNEL);
954
955 pn->pipe_state = PIPE_IDLE;
956 sk->sk_state = TCP_CLOSE; 949 sk->sk_state = TCP_CLOSE;
957 }
958#endif 950#endif
951 }
959 952
960 ifindex = pn->ifindex; 953 ifindex = pn->ifindex;
961 pn->ifindex = 0; 954 pn->ifindex = 0;
@@ -1101,10 +1094,6 @@ static int pep_setsockopt(struct sock *sk, int level, int optname,
1101#ifdef CONFIG_PHONET_PIPECTRLR 1094#ifdef CONFIG_PHONET_PIPECTRLR
1102 case PNPIPE_PIPE_HANDLE: 1095 case PNPIPE_PIPE_HANDLE:
1103 if (val) { 1096 if (val) {
1104 if (pn->pipe_state > PIPE_IDLE) {
1105 err = -EFAULT;
1106 break;
1107 }
1108 pn->pipe_handle = val; 1097 pn->pipe_handle = val;
1109 break; 1098 break;
1110 } 1099 }
@@ -1138,7 +1127,7 @@ static int pep_setsockopt(struct sock *sk, int level, int optname,
1138 1127
1139#ifdef CONFIG_PHONET_PIPECTRLR 1128#ifdef CONFIG_PHONET_PIPECTRLR
1140 case PNPIPE_ENABLE: 1129 case PNPIPE_ENABLE:
1141 if (pn->pipe_state <= PIPE_IDLE) { 1130 if ((1 << sk->sk_state) & ~(TCPF_SYN_RECV|TCPF_ESTABLISHED)) {
1142 err = -ENOTCONN; 1131 err = -ENOTCONN;
1143 break; 1132 break;
1144 } 1133 }
@@ -1177,9 +1166,7 @@ static int pep_getsockopt(struct sock *sk, int level, int optname,
1177 1166
1178#ifdef CONFIG_PHONET_PIPECTRLR 1167#ifdef CONFIG_PHONET_PIPECTRLR
1179 case PNPIPE_ENABLE: 1168 case PNPIPE_ENABLE:
1180 if (pn->pipe_state <= PIPE_IDLE) 1169 val = sk->sk_state == TCP_ESTABLISHED;
1181 return -ENOTCONN;
1182 val = pn->pipe_state != PIPE_DISABLED;
1183 break; 1170 break;
1184#endif 1171#endif
1185 1172