diff options
author | Jesper Juhl <jesper.juhl@gmail.com> | 2006-01-10 16:07:44 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-01-10 16:07:44 -0500 |
commit | ea2e90dfcee2c09eff8a180976ace071922663a5 (patch) | |
tree | 8456c8a4b735d12eb4a0c06d10c7e26301dcaa75 /net/rxrpc | |
parent | ad8e4b75c8a7bed475d72ce09bf5267188621961 (diff) |
[RXRPC]: Decrease number of pointer derefs in connection.c
Decrease the number of pointer derefs in net/rxrpc/connection.c
Benefits of the patch:
- Fewer pointer dereferences should make the code slightly faster.
- Size of generated code is smaller
- improved readability
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rxrpc')
-rw-r--r-- | net/rxrpc/connection.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/rxrpc/connection.c b/net/rxrpc/connection.c index 2ba14a75dbb..0e0a4553499 100644 --- a/net/rxrpc/connection.c +++ b/net/rxrpc/connection.c | |||
@@ -220,6 +220,7 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer, | |||
220 | { | 220 | { |
221 | struct rxrpc_connection *conn, *candidate = NULL; | 221 | struct rxrpc_connection *conn, *candidate = NULL; |
222 | struct list_head *_p; | 222 | struct list_head *_p; |
223 | struct sk_buff *pkt = msg->pkt; | ||
223 | int ret, fresh = 0; | 224 | int ret, fresh = 0; |
224 | __be32 x_epoch, x_connid; | 225 | __be32 x_epoch, x_connid; |
225 | __be16 x_port, x_servid; | 226 | __be16 x_port, x_servid; |
@@ -229,10 +230,10 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer, | |||
229 | _enter("%p{{%hu}},%u,%hu", | 230 | _enter("%p{{%hu}},%u,%hu", |
230 | peer, | 231 | peer, |
231 | peer->trans->port, | 232 | peer->trans->port, |
232 | ntohs(msg->pkt->h.uh->source), | 233 | ntohs(pkt->h.uh->source), |
233 | ntohs(msg->hdr.serviceId)); | 234 | ntohs(msg->hdr.serviceId)); |
234 | 235 | ||
235 | x_port = msg->pkt->h.uh->source; | 236 | x_port = pkt->h.uh->source; |
236 | x_epoch = msg->hdr.epoch; | 237 | x_epoch = msg->hdr.epoch; |
237 | x_clflag = msg->hdr.flags & RXRPC_CLIENT_INITIATED; | 238 | x_clflag = msg->hdr.flags & RXRPC_CLIENT_INITIATED; |
238 | x_connid = htonl(ntohl(msg->hdr.cid) & RXRPC_CIDMASK); | 239 | x_connid = htonl(ntohl(msg->hdr.cid) & RXRPC_CIDMASK); |
@@ -267,7 +268,7 @@ int rxrpc_connection_lookup(struct rxrpc_peer *peer, | |||
267 | /* fill in the specifics */ | 268 | /* fill in the specifics */ |
268 | candidate->addr.sin_family = AF_INET; | 269 | candidate->addr.sin_family = AF_INET; |
269 | candidate->addr.sin_port = x_port; | 270 | candidate->addr.sin_port = x_port; |
270 | candidate->addr.sin_addr.s_addr = msg->pkt->nh.iph->saddr; | 271 | candidate->addr.sin_addr.s_addr = pkt->nh.iph->saddr; |
271 | candidate->in_epoch = x_epoch; | 272 | candidate->in_epoch = x_epoch; |
272 | candidate->out_epoch = x_epoch; | 273 | candidate->out_epoch = x_epoch; |
273 | candidate->in_clientflag = RXRPC_CLIENT_INITIATED; | 274 | candidate->in_clientflag = RXRPC_CLIENT_INITIATED; |
@@ -675,6 +676,7 @@ int rxrpc_conn_receive_call_packet(struct rxrpc_connection *conn, | |||
675 | struct rxrpc_message *msg) | 676 | struct rxrpc_message *msg) |
676 | { | 677 | { |
677 | struct rxrpc_message *pmsg; | 678 | struct rxrpc_message *pmsg; |
679 | struct dst_entry *dst; | ||
678 | struct list_head *_p; | 680 | struct list_head *_p; |
679 | unsigned cix, seq; | 681 | unsigned cix, seq; |
680 | int ret = 0; | 682 | int ret = 0; |
@@ -710,10 +712,10 @@ int rxrpc_conn_receive_call_packet(struct rxrpc_connection *conn, | |||
710 | 712 | ||
711 | call->pkt_rcv_count++; | 713 | call->pkt_rcv_count++; |
712 | 714 | ||
713 | if (msg->pkt->dst && msg->pkt->dst->dev) | 715 | dst = msg->pkt->dst; |
716 | if (dst && dst->dev) | ||
714 | conn->peer->if_mtu = | 717 | conn->peer->if_mtu = |
715 | msg->pkt->dst->dev->mtu - | 718 | dst->dev->mtu - dst->dev->hard_header_len; |
716 | msg->pkt->dst->dev->hard_header_len; | ||
717 | 719 | ||
718 | /* queue on the call in seq order */ | 720 | /* queue on the call in seq order */ |
719 | rxrpc_get_message(msg); | 721 | rxrpc_get_message(msg); |