Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 237469
b: refs/heads/master
c: 0165d69
h: refs/heads/master
i:
  237467: 330a056
v: v3
  • Loading branch information
Rémi Denis-Courmont authored and David S. Miller committed Feb 25, 2011
1 parent 280b39d commit 00ac8a2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 47 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2feb61816f7f0be57f4bc61137555e9a8cb4f322
refs/heads/master: 0165d69bcb18c5aa220538389c872852243f9725
11 changes: 0 additions & 11 deletions trunk/include/net/phonet/pep.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,4 @@ enum {
PEP_IND_READY,
};

#ifdef CONFIG_PHONET_PIPECTRLR
#define PNS_PEP_CONNECT_UTID 0x02
#define PNS_PIPE_CREATED_IND_UTID 0x04
#define PNS_PIPE_ENABLE_UTID 0x0A
#define PNS_PIPE_ENABLED_IND_UTID 0x0C
#define PNS_PIPE_DISABLE_UTID 0x0F
#define PNS_PIPE_DISABLED_IND_UTID 0x11
#define PNS_PEP_DISCONNECT_UTID 0x06

#endif /* CONFIG_PHONET_PIPECTRLR */

#endif
49 changes: 14 additions & 35 deletions trunk/net/phonet/pep.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ static int pipe_get_flow_info(struct sock *sk, struct sk_buff *skb,
return 0;
}

static int pipe_handler_send_req(struct sock *sk, u8 utid,
u8 msg_id, gfp_t priority)
static int pipe_handler_send_req(struct sock *sk, u8 msg_id, gfp_t priority)
{
int len;
struct pnpipehdr *ph;
Expand Down Expand Up @@ -212,16 +211,15 @@ static int pipe_handler_send_req(struct sock *sk, u8 utid,
__skb_push(skb, sizeof(*ph));
skb_reset_transport_header(skb);
ph = pnp_hdr(skb);
ph->utid = utid;
ph->utid = msg_id; /* whatever */
ph->message_id = msg_id;
ph->pipe_handle = pn->pipe_handle;
ph->error_code = PN_PIPE_NO_ERROR;

return pn_skb_send(sk, skb, NULL);
}

static int pipe_handler_send_created_ind(struct sock *sk,
u8 utid, u8 msg_id)
static int pipe_handler_send_created_ind(struct sock *sk, u8 msg_id)
{
int err_code;
struct pnpipehdr *ph;
Expand Down Expand Up @@ -254,15 +252,15 @@ static int pipe_handler_send_created_ind(struct sock *sk,
__skb_push(skb, sizeof(*ph));
skb_reset_transport_header(skb);
ph = pnp_hdr(skb);
ph->utid = utid;
ph->utid = 0;
ph->message_id = msg_id;
ph->pipe_handle = pn->pipe_handle;
ph->error_code = err_code;

return pn_skb_send(sk, skb, NULL);
}

static int pipe_handler_send_ind(struct sock *sk, u8 utid, u8 msg_id)
static int pipe_handler_send_ind(struct sock *sk, u8 msg_id)
{
int err_code;
struct pnpipehdr *ph;
Expand All @@ -287,7 +285,7 @@ static int pipe_handler_send_ind(struct sock *sk, u8 utid, u8 msg_id)
__skb_push(skb, sizeof(*ph));
skb_reset_transport_header(skb);
ph = pnp_hdr(skb);
ph->utid = utid;
ph->utid = 0;
ph->message_id = msg_id;
ph->pipe_handle = pn->pipe_handle;
ph->error_code = err_code;
Expand All @@ -297,16 +295,9 @@ static int pipe_handler_send_ind(struct sock *sk, u8 utid, u8 msg_id)

static int pipe_handler_enable_pipe(struct sock *sk, int enable)
{
int utid, req;

if (enable) {
utid = PNS_PIPE_ENABLE_UTID;
req = PNS_PEP_ENABLE_REQ;
} else {
utid = PNS_PIPE_DISABLE_UTID;
req = PNS_PEP_DISABLE_REQ;
}
return pipe_handler_send_req(sk, utid, req, GFP_ATOMIC);
u8 id = enable ? PNS_PEP_ENABLE_REQ : PNS_PEP_DISABLE_REQ;

return pipe_handler_send_req(sk, id, GFP_KERNEL);
}
#endif

Expand Down Expand Up @@ -538,8 +529,7 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)

#ifdef CONFIG_PHONET_PIPECTRLR
case PNS_PEP_ENABLE_RESP:
pipe_handler_send_ind(sk, PNS_PIPE_ENABLED_IND_UTID,
PNS_PIPE_ENABLED_IND);
pipe_handler_send_ind(sk, PNS_PIPE_ENABLED_IND);

if (!pn_flow_safe(pn->tx_fc)) {
atomic_set(&pn->tx_credits, 1);
Expand Down Expand Up @@ -573,8 +563,7 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
#ifdef CONFIG_PHONET_PIPECTRLR
case PNS_PEP_DISABLE_RESP:
atomic_set(&pn->tx_credits, 0);
pipe_handler_send_ind(sk, PNS_PIPE_DISABLED_IND_UTID,
PNS_PIPE_DISABLED_IND);
pipe_handler_send_ind(sk, PNS_PIPE_DISABLED_IND);
sk->sk_state = TCP_SYN_RECV;
pn->rx_credits = 0;
break;
Expand Down Expand Up @@ -678,7 +667,6 @@ static int pep_connresp_rcv(struct sock *sk, struct sk_buff *skb)
u8 host_pref_rx_fc[3] = {3, 2, 1}, host_req_tx_fc[3] = {3, 2, 1};
u8 remote_pref_rx_fc[3], remote_req_tx_fc[3];
u8 negotiated_rx_fc, negotiated_tx_fc;
int ret;

pipe_get_flow_info(sk, skb, remote_pref_rx_fc,
remote_req_tx_fc);
Expand All @@ -697,12 +685,7 @@ static int pep_connresp_rcv(struct sock *sk, struct sk_buff *skb)
pn->tx_fc = negotiated_tx_fc;
sk->sk_state_change(sk);

ret = pipe_handler_send_created_ind(sk,
PNS_PIPE_CREATED_IND_UTID,
PNS_PIPE_CREATED_IND
);

return ret;
return pipe_handler_send_created_ind(sk, PNS_PIPE_CREATED_IND);
}
#endif

Expand Down Expand Up @@ -943,9 +926,7 @@ static void pep_sock_close(struct sock *sk, long timeout)
pipe_do_remove(sk);
#else
/* send pep disconnect request */
pipe_handler_send_req(sk,
PNS_PEP_DISCONNECT_UTID, PNS_PEP_DISCONNECT_REQ,
GFP_KERNEL);
pipe_handler_send_req(sk, PNS_PEP_DISCONNECT_REQ, GFP_KERNEL);
sk->sk_state = TCP_CLOSE;
#endif
}
Expand Down Expand Up @@ -1034,9 +1015,7 @@ static int pep_sock_connect(struct sock *sk, struct sockaddr *addr, int len)

pn->pn_sk.dobject = pn_sockaddr_get_object(spn);
pn->pn_sk.resource = pn_sockaddr_get_resource(spn);
return pipe_handler_send_req(sk,
PNS_PEP_CONNECT_UTID, PNS_PEP_CONNECT_REQ,
GFP_ATOMIC);
return pipe_handler_send_req(sk, PNS_PEP_CONNECT_REQ, GFP_KERNEL);
}
#endif

Expand Down

0 comments on commit 00ac8a2

Please sign in to comment.