X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Frxrpc%2Ftransport.c;h=4268b38d92d25e4d66a972e1b498793b6004400b;hb=refs%2Fheads%2Fvserver;hp=577001512db260bc7f317bb42f275c3bdb03ec4f;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/net/rxrpc/transport.c b/net/rxrpc/transport.c index 577001512..4268b38d9 100644 --- a/net/rxrpc/transport.c +++ b/net/rxrpc/transport.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) @@ -30,7 +31,6 @@ #endif #include #include -#include #include "internal.h" struct errormsg { @@ -39,7 +39,7 @@ struct errormsg { struct sockaddr_in icmp_src; /* ICMP packet source address */ }; -static spinlock_t rxrpc_transports_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(rxrpc_transports_lock); static struct list_head rxrpc_transports = LIST_HEAD_INIT(rxrpc_transports); __RXACCT_DECL(atomic_t rxrpc_transport_count); @@ -67,11 +67,10 @@ int rxrpc_create_transport(unsigned short port, _enter("%hu", port); - trans = kmalloc(sizeof(struct rxrpc_transport), GFP_KERNEL); + trans = kzalloc(sizeof(struct rxrpc_transport), GFP_KERNEL); if (!trans) return -ENOMEM; - memset(trans, 0, sizeof(struct rxrpc_transport)); atomic_set(&trans->usage, 1); INIT_LIST_HEAD(&trans->services); INIT_LIST_HEAD(&trans->link); @@ -148,16 +147,6 @@ int rxrpc_create_transport(unsigned short port, return ret; } /* end rxrpc_create_transport() */ -/*****************************************************************************/ -/* - * clear the connections on a transport endpoint - */ -void rxrpc_clear_transport(struct rxrpc_transport *trans) -{ - //struct rxrpc_connection *conn; - -} /* end rxrpc_clear_transport() */ - /*****************************************************************************/ /* * destroy a transport endpoint @@ -321,13 +310,12 @@ static int rxrpc_incoming_msg(struct rxrpc_transport *trans, _enter(""); - msg = kmalloc(sizeof(struct rxrpc_message), GFP_KERNEL); + msg = kzalloc(sizeof(struct rxrpc_message), GFP_KERNEL); if (!msg) { _leave(" = -ENOMEM"); return -ENOMEM; } - memset(msg, 0, sizeof(*msg)); atomic_set(&msg->usage, 1); list_add_tail(&msg->link,msgq); @@ -340,7 +328,7 @@ static int rxrpc_incoming_msg(struct rxrpc_transport *trans, msg->trans = trans; msg->state = RXRPC_MSG_RECEIVED; - msg->stamp = pkt->stamp; + skb_get_timestamp(pkt, &msg->stamp); if (msg->stamp.tv_sec == 0) { do_gettimeofday(&msg->stamp); if (pkt->sk) @@ -392,11 +380,10 @@ static int rxrpc_incoming_msg(struct rxrpc_transport *trans, /* allocate a new message record */ ret = -ENOMEM; - msg = kmalloc(sizeof(struct rxrpc_message), GFP_KERNEL); + msg = kmemdup(jumbomsg, sizeof(struct rxrpc_message), GFP_KERNEL); if (!msg) goto error; - memcpy(msg, jumbomsg, sizeof(*msg)); list_add_tail(&msg->link, msgq); /* adjust the jumbo packet */ @@ -457,8 +444,8 @@ void rxrpc_trans_receive_packet(struct rxrpc_transport *trans) struct rxrpc_peer *peer; struct sk_buff *pkt; int ret; - u32 addr; - u16 port; + __be32 addr; + __be16 port; LIST_HEAD(msgq); @@ -485,15 +472,11 @@ void rxrpc_trans_receive_packet(struct rxrpc_transport *trans) /* we'll probably need to checksum it (didn't call * sock_recvmsg) */ - if (pkt->ip_summed != CHECKSUM_UNNECESSARY) { - if ((unsigned short) - csum_fold(skb_checksum(pkt, 0, pkt->len, - pkt->csum))) { - kfree_skb(pkt); - rxrpc_krxiod_queue_transport(trans); - _leave(" CSUM failed"); - return; - } + if (skb_checksum_complete(pkt)) { + kfree_skb(pkt); + rxrpc_krxiod_queue_transport(trans); + _leave(" CSUM failed"); + return; } addr = pkt->nh.iph->saddr; @@ -612,7 +595,7 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans, struct sockaddr_in sin; struct msghdr msghdr; struct kvec iov[2]; - uint32_t _error; + __be32 _error; int len, ret; _enter("%p,%p,%d", trans, msg, error); @@ -655,8 +638,8 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans, _net("Sending message type %d of %d bytes to %08x:%d", ahdr.type, len, - htonl(sin.sin_addr.s_addr), - htons(sin.sin_port)); + ntohl(sin.sin_addr.s_addr), + ntohs(sin.sin_port)); /* send the message */ ret = kernel_sendmsg(trans->socket, &msghdr, iov, 2, len); @@ -678,7 +661,7 @@ static void rxrpc_trans_receive_error_report(struct rxrpc_transport *trans) struct list_head connq, *_p; struct errormsg emsg; struct msghdr msg; - uint16_t port; + __be16 port; int local, err; _enter("%p", trans);