diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/phonet/pep.c | 49 |
1 files changed, 14 insertions, 35 deletions
diff --git a/net/phonet/pep.c b/net/phonet/pep.c index 15775a74b6f6..0ecab59963e0 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c | |||
@@ -172,8 +172,7 @@ static int pipe_get_flow_info(struct sock *sk, struct sk_buff *skb, | |||
172 | return 0; | 172 | return 0; |
173 | } | 173 | } |
174 | 174 | ||
175 | static int pipe_handler_send_req(struct sock *sk, u8 utid, | 175 | static int pipe_handler_send_req(struct sock *sk, u8 msg_id, gfp_t priority) |
176 | u8 msg_id, gfp_t priority) | ||
177 | { | 176 | { |
178 | int len; | 177 | int len; |
179 | struct pnpipehdr *ph; | 178 | struct pnpipehdr *ph; |
@@ -212,7 +211,7 @@ static int pipe_handler_send_req(struct sock *sk, u8 utid, | |||
212 | __skb_push(skb, sizeof(*ph)); | 211 | __skb_push(skb, sizeof(*ph)); |
213 | skb_reset_transport_header(skb); | 212 | skb_reset_transport_header(skb); |
214 | ph = pnp_hdr(skb); | 213 | ph = pnp_hdr(skb); |
215 | ph->utid = utid; | 214 | ph->utid = msg_id; /* whatever */ |
216 | ph->message_id = msg_id; | 215 | ph->message_id = msg_id; |
217 | ph->pipe_handle = pn->pipe_handle; | 216 | ph->pipe_handle = pn->pipe_handle; |
218 | ph->error_code = PN_PIPE_NO_ERROR; | 217 | ph->error_code = PN_PIPE_NO_ERROR; |
@@ -220,8 +219,7 @@ static int pipe_handler_send_req(struct sock *sk, u8 utid, | |||
220 | return pn_skb_send(sk, skb, NULL); | 219 | return pn_skb_send(sk, skb, NULL); |
221 | } | 220 | } |
222 | 221 | ||
223 | static int pipe_handler_send_created_ind(struct sock *sk, | 222 | static int pipe_handler_send_created_ind(struct sock *sk, u8 msg_id) |
224 | u8 utid, u8 msg_id) | ||
225 | { | 223 | { |
226 | int err_code; | 224 | int err_code; |
227 | struct pnpipehdr *ph; | 225 | struct pnpipehdr *ph; |
@@ -254,7 +252,7 @@ static int pipe_handler_send_created_ind(struct sock *sk, | |||
254 | __skb_push(skb, sizeof(*ph)); | 252 | __skb_push(skb, sizeof(*ph)); |
255 | skb_reset_transport_header(skb); | 253 | skb_reset_transport_header(skb); |
256 | ph = pnp_hdr(skb); | 254 | ph = pnp_hdr(skb); |
257 | ph->utid = utid; | 255 | ph->utid = 0; |
258 | ph->message_id = msg_id; | 256 | ph->message_id = msg_id; |
259 | ph->pipe_handle = pn->pipe_handle; | 257 | ph->pipe_handle = pn->pipe_handle; |
260 | ph->error_code = err_code; | 258 | ph->error_code = err_code; |
@@ -262,7 +260,7 @@ static int pipe_handler_send_created_ind(struct sock *sk, | |||
262 | return pn_skb_send(sk, skb, NULL); | 260 | return pn_skb_send(sk, skb, NULL); |
263 | } | 261 | } |
264 | 262 | ||
265 | static int pipe_handler_send_ind(struct sock *sk, u8 utid, u8 msg_id) | 263 | static int pipe_handler_send_ind(struct sock *sk, u8 msg_id) |
266 | { | 264 | { |
267 | int err_code; | 265 | int err_code; |
268 | struct pnpipehdr *ph; | 266 | struct pnpipehdr *ph; |
@@ -287,7 +285,7 @@ static int pipe_handler_send_ind(struct sock *sk, u8 utid, u8 msg_id) | |||
287 | __skb_push(skb, sizeof(*ph)); | 285 | __skb_push(skb, sizeof(*ph)); |
288 | skb_reset_transport_header(skb); | 286 | skb_reset_transport_header(skb); |
289 | ph = pnp_hdr(skb); | 287 | ph = pnp_hdr(skb); |
290 | ph->utid = utid; | 288 | ph->utid = 0; |
291 | ph->message_id = msg_id; | 289 | ph->message_id = msg_id; |
292 | ph->pipe_handle = pn->pipe_handle; | 290 | ph->pipe_handle = pn->pipe_handle; |
293 | ph->error_code = err_code; | 291 | ph->error_code = err_code; |
@@ -297,16 +295,9 @@ static int pipe_handler_send_ind(struct sock *sk, u8 utid, u8 msg_id) | |||
297 | 295 | ||
298 | static int pipe_handler_enable_pipe(struct sock *sk, int enable) | 296 | static int pipe_handler_enable_pipe(struct sock *sk, int enable) |
299 | { | 297 | { |
300 | int utid, req; | 298 | u8 id = enable ? PNS_PEP_ENABLE_REQ : PNS_PEP_DISABLE_REQ; |
301 | 299 | ||
302 | if (enable) { | 300 | return pipe_handler_send_req(sk, id, GFP_KERNEL); |
303 | utid = PNS_PIPE_ENABLE_UTID; | ||
304 | req = PNS_PEP_ENABLE_REQ; | ||
305 | } else { | ||
306 | utid = PNS_PIPE_DISABLE_UTID; | ||
307 | req = PNS_PEP_DISABLE_REQ; | ||
308 | } | ||
309 | return pipe_handler_send_req(sk, utid, req, GFP_ATOMIC); | ||
310 | } | 301 | } |
311 | #endif | 302 | #endif |
312 | 303 | ||
@@ -538,8 +529,7 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
538 | 529 | ||
539 | #ifdef CONFIG_PHONET_PIPECTRLR | 530 | #ifdef CONFIG_PHONET_PIPECTRLR |
540 | case PNS_PEP_ENABLE_RESP: | 531 | case PNS_PEP_ENABLE_RESP: |
541 | pipe_handler_send_ind(sk, PNS_PIPE_ENABLED_IND_UTID, | 532 | pipe_handler_send_ind(sk, PNS_PIPE_ENABLED_IND); |
542 | PNS_PIPE_ENABLED_IND); | ||
543 | 533 | ||
544 | if (!pn_flow_safe(pn->tx_fc)) { | 534 | if (!pn_flow_safe(pn->tx_fc)) { |
545 | atomic_set(&pn->tx_credits, 1); | 535 | atomic_set(&pn->tx_credits, 1); |
@@ -573,8 +563,7 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
573 | #ifdef CONFIG_PHONET_PIPECTRLR | 563 | #ifdef CONFIG_PHONET_PIPECTRLR |
574 | case PNS_PEP_DISABLE_RESP: | 564 | case PNS_PEP_DISABLE_RESP: |
575 | atomic_set(&pn->tx_credits, 0); | 565 | atomic_set(&pn->tx_credits, 0); |
576 | pipe_handler_send_ind(sk, PNS_PIPE_DISABLED_IND_UTID, | 566 | pipe_handler_send_ind(sk, PNS_PIPE_DISABLED_IND); |
577 | PNS_PIPE_DISABLED_IND); | ||
578 | sk->sk_state = TCP_SYN_RECV; | 567 | sk->sk_state = TCP_SYN_RECV; |
579 | pn->rx_credits = 0; | 568 | pn->rx_credits = 0; |
580 | break; | 569 | break; |
@@ -678,7 +667,6 @@ static int pep_connresp_rcv(struct sock *sk, struct sk_buff *skb) | |||
678 | u8 host_pref_rx_fc[3] = {3, 2, 1}, host_req_tx_fc[3] = {3, 2, 1}; | 667 | u8 host_pref_rx_fc[3] = {3, 2, 1}, host_req_tx_fc[3] = {3, 2, 1}; |
679 | u8 remote_pref_rx_fc[3], remote_req_tx_fc[3]; | 668 | u8 remote_pref_rx_fc[3], remote_req_tx_fc[3]; |
680 | u8 negotiated_rx_fc, negotiated_tx_fc; | 669 | u8 negotiated_rx_fc, negotiated_tx_fc; |
681 | int ret; | ||
682 | 670 | ||
683 | pipe_get_flow_info(sk, skb, remote_pref_rx_fc, | 671 | pipe_get_flow_info(sk, skb, remote_pref_rx_fc, |
684 | remote_req_tx_fc); | 672 | remote_req_tx_fc); |
@@ -697,12 +685,7 @@ static int pep_connresp_rcv(struct sock *sk, struct sk_buff *skb) | |||
697 | pn->tx_fc = negotiated_tx_fc; | 685 | pn->tx_fc = negotiated_tx_fc; |
698 | sk->sk_state_change(sk); | 686 | sk->sk_state_change(sk); |
699 | 687 | ||
700 | ret = pipe_handler_send_created_ind(sk, | 688 | return pipe_handler_send_created_ind(sk, PNS_PIPE_CREATED_IND); |
701 | PNS_PIPE_CREATED_IND_UTID, | ||
702 | PNS_PIPE_CREATED_IND | ||
703 | ); | ||
704 | |||
705 | return ret; | ||
706 | } | 689 | } |
707 | #endif | 690 | #endif |
708 | 691 | ||
@@ -943,9 +926,7 @@ static void pep_sock_close(struct sock *sk, long timeout) | |||
943 | pipe_do_remove(sk); | 926 | pipe_do_remove(sk); |
944 | #else | 927 | #else |
945 | /* send pep disconnect request */ | 928 | /* send pep disconnect request */ |
946 | pipe_handler_send_req(sk, | 929 | pipe_handler_send_req(sk, PNS_PEP_DISCONNECT_REQ, GFP_KERNEL); |
947 | PNS_PEP_DISCONNECT_UTID, PNS_PEP_DISCONNECT_REQ, | ||
948 | GFP_KERNEL); | ||
949 | sk->sk_state = TCP_CLOSE; | 930 | sk->sk_state = TCP_CLOSE; |
950 | #endif | 931 | #endif |
951 | } | 932 | } |
@@ -1034,9 +1015,7 @@ static int pep_sock_connect(struct sock *sk, struct sockaddr *addr, int len) | |||
1034 | 1015 | ||
1035 | pn->pn_sk.dobject = pn_sockaddr_get_object(spn); | 1016 | pn->pn_sk.dobject = pn_sockaddr_get_object(spn); |
1036 | pn->pn_sk.resource = pn_sockaddr_get_resource(spn); | 1017 | pn->pn_sk.resource = pn_sockaddr_get_resource(spn); |
1037 | return pipe_handler_send_req(sk, | 1018 | return pipe_handler_send_req(sk, PNS_PEP_CONNECT_REQ, GFP_KERNEL); |
1038 | PNS_PEP_CONNECT_UTID, PNS_PEP_CONNECT_REQ, | ||
1039 | GFP_ATOMIC); | ||
1040 | } | 1019 | } |
1041 | #endif | 1020 | #endif |
1042 | 1021 | ||