fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / net / rxrpc / transport.c
index 7e015ce..4268b38 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/in.h>
 #include <linux/in6.h>
 #include <linux/icmp.h>
+#include <linux/skbuff.h>
 #include <net/sock.h>
 #include <net/ip.h>
 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
@@ -30,7 +31,6 @@
 #endif
 #include <linux/errqueue.h>
 #include <asm/uaccess.h>
-#include <asm/checksum.h>
 #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 */
@@ -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;