Commit 2feb6181 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by David S. Miller

Phonet: remove redumdant pep->pipe_state

sk->sk_state already contains the pipe state.
Signed-off-by: default avatarRémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 14ba8fae
...@@ -45,9 +45,6 @@ struct pep_sock { ...@@ -45,9 +45,6 @@ struct pep_sock {
u8 tx_fc; /* TX flow control */ u8 tx_fc; /* TX flow control */
u8 init_enable; /* auto-enable at creation */ u8 init_enable; /* auto-enable at creation */
u8 aligned; u8 aligned;
#ifdef CONFIG_PHONET_PIPECTRLR
u8 pipe_state;
#endif
}; };
static inline struct pep_sock *pep_sk(struct sock *sk) static inline struct pep_sock *pep_sk(struct sock *sk)
...@@ -177,12 +174,6 @@ enum { ...@@ -177,12 +174,6 @@ enum {
#define PNS_PIPE_DISABLED_IND_UTID 0x11 #define PNS_PIPE_DISABLED_IND_UTID 0x11
#define PNS_PEP_DISCONNECT_UTID 0x06 #define PNS_PEP_DISCONNECT_UTID 0x06
/* Used for tracking state of a pipe */
enum {
PIPE_IDLE,
PIPE_DISABLED,
PIPE_ENABLED,
};
#endif /* CONFIG_PHONET_PIPECTRLR */ #endif /* CONFIG_PHONET_PIPECTRLR */
#endif #endif
...@@ -527,7 +527,6 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -527,7 +527,6 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
#ifdef CONFIG_PHONET_PIPECTRLR #ifdef CONFIG_PHONET_PIPECTRLR
case PNS_PEP_DISCONNECT_RESP: case PNS_PEP_DISCONNECT_RESP:
pn->pipe_state = PIPE_IDLE;
sk->sk_state = TCP_CLOSE; sk->sk_state = TCP_CLOSE;
break; break;
#endif #endif
...@@ -539,7 +538,6 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -539,7 +538,6 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
#ifdef CONFIG_PHONET_PIPECTRLR #ifdef CONFIG_PHONET_PIPECTRLR
case PNS_PEP_ENABLE_RESP: case PNS_PEP_ENABLE_RESP:
pn->pipe_state = PIPE_ENABLED;
pipe_handler_send_ind(sk, PNS_PIPE_ENABLED_IND_UTID, pipe_handler_send_ind(sk, PNS_PIPE_ENABLED_IND_UTID,
PNS_PIPE_ENABLED_IND); PNS_PIPE_ENABLED_IND);
...@@ -574,7 +572,6 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -574,7 +572,6 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
#ifdef CONFIG_PHONET_PIPECTRLR #ifdef CONFIG_PHONET_PIPECTRLR
case PNS_PEP_DISABLE_RESP: case PNS_PEP_DISABLE_RESP:
pn->pipe_state = PIPE_DISABLED;
atomic_set(&pn->tx_credits, 0); atomic_set(&pn->tx_credits, 0);
pipe_handler_send_ind(sk, PNS_PIPE_DISABLED_IND_UTID, pipe_handler_send_ind(sk, PNS_PIPE_DISABLED_IND_UTID,
PNS_PIPE_DISABLED_IND); PNS_PIPE_DISABLED_IND);
...@@ -692,7 +689,6 @@ static int pep_connresp_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -692,7 +689,6 @@ static int pep_connresp_rcv(struct sock *sk, struct sk_buff *skb)
remote_pref_rx_fc, remote_pref_rx_fc,
sizeof(host_pref_rx_fc)); sizeof(host_pref_rx_fc));
pn->pipe_state = PIPE_DISABLED;
sk->sk_state = TCP_SYN_RECV; sk->sk_state = TCP_SYN_RECV;
sk->sk_backlog_rcv = pipe_do_rcv; sk->sk_backlog_rcv = pipe_do_rcv;
sk->sk_destruct = pipe_destruct; sk->sk_destruct = pipe_destruct;
...@@ -941,21 +937,18 @@ static void pep_sock_close(struct sock *sk, long timeout) ...@@ -941,21 +937,18 @@ static void pep_sock_close(struct sock *sk, long timeout)
sk_for_each_safe(sknode, p, n, &pn->ackq) sk_for_each_safe(sknode, p, n, &pn->ackq)
sk_del_node_init(sknode); sk_del_node_init(sknode);
sk->sk_state = TCP_CLOSE; sk->sk_state = TCP_CLOSE;
} else if ((1 << sk->sk_state) & (TCPF_SYN_RECV|TCPF_ESTABLISHED)) } else if ((1 << sk->sk_state) & (TCPF_SYN_RECV|TCPF_ESTABLISHED)) {
#ifndef CONFIG_PHONET_PIPECTRLR
/* Forcefully remove dangling Phonet pipe */ /* Forcefully remove dangling Phonet pipe */
pipe_do_remove(sk); pipe_do_remove(sk);
#else
#ifdef CONFIG_PHONET_PIPECTRLR
if (pn->pipe_state != PIPE_IDLE) {
/* send pep disconnect request */ /* send pep disconnect request */
pipe_handler_send_req(sk, pipe_handler_send_req(sk,
PNS_PEP_DISCONNECT_UTID, PNS_PEP_DISCONNECT_REQ, PNS_PEP_DISCONNECT_UTID, PNS_PEP_DISCONNECT_REQ,
GFP_KERNEL); GFP_KERNEL);
pn->pipe_state = PIPE_IDLE;
sk->sk_state = TCP_CLOSE; sk->sk_state = TCP_CLOSE;
}
#endif #endif
}
ifindex = pn->ifindex; ifindex = pn->ifindex;
pn->ifindex = 0; pn->ifindex = 0;
...@@ -1101,10 +1094,6 @@ static int pep_setsockopt(struct sock *sk, int level, int optname, ...@@ -1101,10 +1094,6 @@ static int pep_setsockopt(struct sock *sk, int level, int optname,
#ifdef CONFIG_PHONET_PIPECTRLR #ifdef CONFIG_PHONET_PIPECTRLR
case PNPIPE_PIPE_HANDLE: case PNPIPE_PIPE_HANDLE:
if (val) { if (val) {
if (pn->pipe_state > PIPE_IDLE) {
err = -EFAULT;
break;
}
pn->pipe_handle = val; pn->pipe_handle = val;
break; break;
} }
...@@ -1138,7 +1127,7 @@ static int pep_setsockopt(struct sock *sk, int level, int optname, ...@@ -1138,7 +1127,7 @@ static int pep_setsockopt(struct sock *sk, int level, int optname,
#ifdef CONFIG_PHONET_PIPECTRLR #ifdef CONFIG_PHONET_PIPECTRLR
case PNPIPE_ENABLE: case PNPIPE_ENABLE:
if (pn->pipe_state <= PIPE_IDLE) { if ((1 << sk->sk_state) & ~(TCPF_SYN_RECV|TCPF_ESTABLISHED)) {
err = -ENOTCONN; err = -ENOTCONN;
break; break;
} }
...@@ -1177,9 +1166,7 @@ static int pep_getsockopt(struct sock *sk, int level, int optname, ...@@ -1177,9 +1166,7 @@ static int pep_getsockopt(struct sock *sk, int level, int optname,
#ifdef CONFIG_PHONET_PIPECTRLR #ifdef CONFIG_PHONET_PIPECTRLR
case PNPIPE_ENABLE: case PNPIPE_ENABLE:
if (pn->pipe_state <= PIPE_IDLE) val = sk->sk_state == TCP_ESTABLISHED;
return -ENOTCONN;
val = pn->pipe_state != PIPE_DISABLED;
break; break;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment