git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
net
/
rxrpc
/
connection.c
diff --git
a/net/rxrpc/connection.c
b/net/rxrpc/connection.c
index
a923806
..
93d2c55
100644
(file)
--- a/
net/rxrpc/connection.c
+++ b/
net/rxrpc/connection.c
@@
-30,6
+30,8
@@
LIST_HEAD(rxrpc_conns);
DECLARE_RWSEM(rxrpc_conns_sem);
unsigned long rxrpc_conn_timeout = 60 * 60;
DECLARE_RWSEM(rxrpc_conns_sem);
unsigned long rxrpc_conn_timeout = 60 * 60;
+static void rxrpc_conn_do_timeout(struct rxrpc_connection *conn);
+
static void __rxrpc_conn_timeout(rxrpc_timer_t *timer)
{
struct rxrpc_connection *conn =
static void __rxrpc_conn_timeout(rxrpc_timer_t *timer)
{
struct rxrpc_connection *conn =
@@
-56,13
+58,12
@@
static inline int __rxrpc_create_connection(struct rxrpc_peer *peer,
_enter("%p",peer);
/* allocate and initialise a connection record */
_enter("%p",peer);
/* allocate and initialise a connection record */
- conn = k
m
alloc(sizeof(struct rxrpc_connection), GFP_KERNEL);
+ conn = k
z
alloc(sizeof(struct rxrpc_connection), GFP_KERNEL);
if (!conn) {
_leave(" = -ENOMEM");
return -ENOMEM;
}
if (!conn) {
_leave(" = -ENOMEM");
return -ENOMEM;
}
- memset(conn, 0, sizeof(struct rxrpc_connection));
atomic_set(&conn->usage, 1);
INIT_LIST_HEAD(&conn->link);
atomic_set(&conn->usage, 1);
INIT_LIST_HEAD(&conn->link);
@@
-88,8
+89,8
@@
static inline int __rxrpc_create_connection(struct rxrpc_peer *peer,
* create a new connection record for outgoing connections
*/
int rxrpc_create_connection(struct rxrpc_transport *trans,
* create a new connection record for outgoing connections
*/
int rxrpc_create_connection(struct rxrpc_transport *trans,
-
uint16_t
port,
-
uint32_t
addr,
+
__be16
port,
+
__be32
addr,
uint16_t service_id,
void *security,
struct rxrpc_connection **_conn)
uint16_t service_id,
void *security,
struct rxrpc_connection **_conn)
@@
-97,7
+98,7
@@
int rxrpc_create_connection(struct rxrpc_transport *trans,
struct rxrpc_connection *candidate, *conn;
struct rxrpc_peer *peer;
struct list_head *_p;
struct rxrpc_connection *candidate, *conn;
struct rxrpc_peer *peer;
struct list_head *_p;
-
uint32_t
connid;
+
__be32
connid;
int ret;
_enter("%p{%hu},%u,%hu", trans, trans->port, ntohs(port), service_id);
int ret;
_enter("%p{%hu},%u,%hu", trans, trans->port, ntohs(port), service_id);
@@
-169,7
+170,7
@@
int rxrpc_create_connection(struct rxrpc_transport *trans,
spin_unlock(&peer->conn_gylock);
/* pick the new candidate */
spin_unlock(&peer->conn_gylock);
/* pick the new candidate */
- _debug("created connection: {%08x} [out]",
hton
l(candidate->conn_id));
+ _debug("created connection: {%08x} [out]",
ntoh
l(candidate->conn_id));
atomic_inc(&peer->conn_count);
conn = candidate;
candidate = NULL;
atomic_inc(&peer->conn_count);
conn = candidate;
candidate = NULL;
@@
-199,7
+200,7
@@
int rxrpc_create_connection(struct rxrpc_transport *trans,
/* handle resurrecting a connection from the graveyard */
found_in_graveyard:
/* handle resurrecting a connection from the graveyard */
found_in_graveyard:
- _debug("resurrecting connection: {%08x} [out]",
hton
l(conn->conn_id));
+ _debug("resurrecting connection: {%08x} [out]",
ntoh
l(conn->conn_id));
rxrpc_get_connection(conn);
rxrpc_krxtimod_del_timer(&conn->timeout);
list_del_init(&conn->link);
rxrpc_get_connection(conn);
rxrpc_krxtimod_del_timer(&conn->timeout);
list_del_init(&conn->link);
@@
-218,18
+219,20
@@
int rxrpc_connection_lookup(struct rxrpc_peer *peer,
{
struct rxrpc_connection *conn, *candidate = NULL;
struct list_head *_p;
{
struct rxrpc_connection *conn, *candidate = NULL;
struct list_head *_p;
+ struct sk_buff *pkt = msg->pkt;
int ret, fresh = 0;
int ret, fresh = 0;
- u32 x_epoch, x_connid;
- u16 x_port, x_secix, x_servid;
+ __be32 x_epoch, x_connid;
+ __be16 x_port, x_servid;
+ __u32 x_secix;
u8 x_clflag;
_enter("%p{{%hu}},%u,%hu",
peer,
peer->trans->port,
u8 x_clflag;
_enter("%p{{%hu}},%u,%hu",
peer,
peer->trans->port,
- ntohs(
msg->
pkt->h.uh->source),
+ ntohs(pkt->h.uh->source),
ntohs(msg->hdr.serviceId));
ntohs(msg->hdr.serviceId));
- x_port =
msg->
pkt->h.uh->source;
+ x_port = pkt->h.uh->source;
x_epoch = msg->hdr.epoch;
x_clflag = msg->hdr.flags & RXRPC_CLIENT_INITIATED;
x_connid = htonl(ntohl(msg->hdr.cid) & RXRPC_CIDMASK);
x_epoch = msg->hdr.epoch;
x_clflag = msg->hdr.flags & RXRPC_CLIENT_INITIATED;
x_connid = htonl(ntohl(msg->hdr.cid) & RXRPC_CIDMASK);
@@
-264,7
+267,7
@@
int rxrpc_connection_lookup(struct rxrpc_peer *peer,
/* fill in the specifics */
candidate->addr.sin_family = AF_INET;
candidate->addr.sin_port = x_port;
/* fill in the specifics */
candidate->addr.sin_family = AF_INET;
candidate->addr.sin_port = x_port;
- candidate->addr.sin_addr.s_addr =
msg->
pkt->nh.iph->saddr;
+ candidate->addr.sin_addr.s_addr = pkt->nh.iph->saddr;
candidate->in_epoch = x_epoch;
candidate->out_epoch = x_epoch;
candidate->in_clientflag = RXRPC_CLIENT_INITIATED;
candidate->in_epoch = x_epoch;
candidate->out_epoch = x_epoch;
candidate->in_clientflag = RXRPC_CLIENT_INITIATED;
@@
-310,7
+313,7
@@
int rxrpc_connection_lookup(struct rxrpc_peer *peer,
}
/* we can now add the new candidate to the list */
}
/* we can now add the new candidate to the list */
- _debug("created connection: {%08x} [in]",
hton
l(candidate->conn_id));
+ _debug("created connection: {%08x} [in]",
ntoh
l(candidate->conn_id));
rxrpc_get_peer(peer);
conn = candidate;
candidate = NULL;
rxrpc_get_peer(peer);
conn = candidate;
candidate = NULL;
@@
-351,7
+354,7
@@
int rxrpc_connection_lookup(struct rxrpc_peer *peer,
/* handle resurrecting a connection from the graveyard */
found_in_graveyard:
/* handle resurrecting a connection from the graveyard */
found_in_graveyard:
- _debug("resurrecting connection: {%08x} [in]",
hton
l(conn->conn_id));
+ _debug("resurrecting connection: {%08x} [in]",
ntoh
l(conn->conn_id));
rxrpc_get_peer(peer);
rxrpc_get_connection(conn);
rxrpc_krxtimod_del_timer(&conn->timeout);
rxrpc_get_peer(peer);
rxrpc_get_connection(conn);
rxrpc_krxtimod_del_timer(&conn->timeout);
@@
-397,9
+400,8
@@
void rxrpc_put_connection(struct rxrpc_connection *conn)
}
/* move to graveyard queue */
}
/* move to graveyard queue */
- _debug("burying connection: {%08x}", htonl(conn->conn_id));
- list_del(&conn->link);
- list_add_tail(&conn->link, &peer->conn_graveyard);
+ _debug("burying connection: {%08x}", ntohl(conn->conn_id));
+ list_move_tail(&conn->link, &peer->conn_graveyard);
rxrpc_krxtimod_add_timer(&conn->timeout, rxrpc_conn_timeout * HZ);
rxrpc_krxtimod_add_timer(&conn->timeout, rxrpc_conn_timeout * HZ);
@@
-414,7
+416,7
@@
void rxrpc_put_connection(struct rxrpc_connection *conn)
/*
* free a connection record
*/
/*
* free a connection record
*/
-void rxrpc_conn_do_timeout(struct rxrpc_connection *conn)
+
static
void rxrpc_conn_do_timeout(struct rxrpc_connection *conn)
{
struct rxrpc_peer *peer;
{
struct rxrpc_peer *peer;
@@
-442,7
+444,7
@@
void rxrpc_conn_do_timeout(struct rxrpc_connection *conn)
}
_debug("--- Destroying Connection %p{%08x} ---",
}
_debug("--- Destroying Connection %p{%08x} ---",
- conn,
hton
l(conn->conn_id));
+ conn,
ntoh
l(conn->conn_id));
down_write(&rxrpc_conns_sem);
list_del(&conn->proc_link);
down_write(&rxrpc_conns_sem);
list_del(&conn->proc_link);
@@
-518,8
+520,8
@@
int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
struct rxrpc_call *call,
uint8_t type,
int dcount,
struct rxrpc_call *call,
uint8_t type,
int dcount,
- struct
io
vec diov[],
-
in
t alloc_flags,
+ struct
k
vec diov[],
+
gfp_
t alloc_flags,
struct rxrpc_message **_msg)
{
struct rxrpc_message *msg;
struct rxrpc_message **_msg)
{
struct rxrpc_message *msg;
@@
-532,13
+534,12
@@
int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
return -EINVAL;
}
return -EINVAL;
}
- msg = k
m
alloc(sizeof(struct rxrpc_message), alloc_flags);
+ msg = k
z
alloc(sizeof(struct rxrpc_message), alloc_flags);
if (!msg) {
_leave(" = -ENOMEM");
return -ENOMEM;
}
if (!msg) {
_leave(" = -ENOMEM");
return -ENOMEM;
}
- memset(msg, 0, sizeof(*msg));
atomic_set(&msg->usage, 1);
INIT_LIST_HEAD(&msg->link);
atomic_set(&msg->usage, 1);
INIT_LIST_HEAD(&msg->link);
@@
-620,7
+621,6
@@
int rxrpc_conn_sendmsg(struct rxrpc_connection *conn,
struct rxrpc_message *msg)
{
struct msghdr msghdr;
struct rxrpc_message *msg)
{
struct msghdr msghdr;
- mm_segment_t oldfs;
int ret;
_enter("%p{%d}", conn, ntohs(conn->addr.sin_port));
int ret;
_enter("%p{%d}", conn, ntohs(conn->addr.sin_port));
@@
-634,8
+634,6
@@
int rxrpc_conn_sendmsg(struct rxrpc_connection *conn,
/* set up the message to be transmitted */
msghdr.msg_name = &conn->addr;
msghdr.msg_namelen = sizeof(conn->addr);
/* set up the message to be transmitted */
msghdr.msg_name = &conn->addr;
msghdr.msg_namelen = sizeof(conn->addr);
- msghdr.msg_iov = msg->data;
- msghdr.msg_iovlen = msg->dcount;
msghdr.msg_control = NULL;
msghdr.msg_controllen = 0;
msghdr.msg_flags = MSG_CONFIRM | MSG_DONTWAIT;
msghdr.msg_control = NULL;
msghdr.msg_controllen = 0;
msghdr.msg_flags = MSG_CONFIRM | MSG_DONTWAIT;
@@
-643,19
+641,15
@@
int rxrpc_conn_sendmsg(struct rxrpc_connection *conn,
_net("Sending message type %d of %Zd bytes to %08x:%d",
msg->hdr.type,
msg->dsize,
_net("Sending message type %d of %Zd bytes to %08x:%d",
msg->hdr.type,
msg->dsize,
-
hton
l(conn->addr.sin_addr.s_addr),
-
hton
s(conn->addr.sin_port));
+
ntoh
l(conn->addr.sin_addr.s_addr),
+
ntoh
s(conn->addr.sin_port));
/* send the message */
/* send the message */
- oldfs = get_fs();
- set_fs(KERNEL_DS);
- ret = sock_sendmsg(conn->trans->socket, &msghdr, msg->dsize);
- set_fs(oldfs);
-
+ ret = kernel_sendmsg(conn->trans->socket, &msghdr,
+ msg->data, msg->dcount, msg->dsize);
if (ret < 0) {
msg->state = RXRPC_MSG_ERROR;
if (ret < 0) {
msg->state = RXRPC_MSG_ERROR;
- }
- else {
+ } else {
msg->state = RXRPC_MSG_SENT;
ret = 0;
msg->state = RXRPC_MSG_SENT;
ret = 0;
@@
-679,6
+673,7
@@
int rxrpc_conn_receive_call_packet(struct rxrpc_connection *conn,
struct rxrpc_message *msg)
{
struct rxrpc_message *pmsg;
struct rxrpc_message *msg)
{
struct rxrpc_message *pmsg;
+ struct dst_entry *dst;
struct list_head *_p;
unsigned cix, seq;
int ret = 0;
struct list_head *_p;
unsigned cix, seq;
int ret = 0;
@@
-706,18
+701,18
@@
int rxrpc_conn_receive_call_packet(struct rxrpc_connection *conn,
}
_proto("Received packet %%%u [%u] on call %hu:%u:%u",
}
_proto("Received packet %%%u [%u] on call %hu:%u:%u",
-
hton
l(msg->hdr.serial),
-
hton
l(msg->hdr.seq),
-
hton
s(msg->hdr.serviceId),
-
hton
l(conn->conn_id),
-
hton
l(call->call_id));
+
ntoh
l(msg->hdr.serial),
+
ntoh
l(msg->hdr.seq),
+
ntoh
s(msg->hdr.serviceId),
+
ntoh
l(conn->conn_id),
+
ntoh
l(call->call_id));
call->pkt_rcv_count++;
call->pkt_rcv_count++;
- if (msg->pkt->dst && msg->pkt->dst->dev)
+ dst = msg->pkt->dst;
+ if (dst && dst->dev)
conn->peer->if_mtu =
conn->peer->if_mtu =
- msg->pkt->dst->dev->mtu -
- msg->pkt->dst->dev->hard_header_len;
+ dst->dev->mtu - dst->dev->hard_header_len;
/* queue on the call in seq order */
rxrpc_get_message(msg);
/* queue on the call in seq order */
rxrpc_get_message(msg);