X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Frxrpc%2Ftransport.c;h=4268b38d92d25e4d66a972e1b498793b6004400b;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=7e015ceecee5fa8a6e254b4531f96a0ea0b2725b;hpb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;p=linux-2.6.git diff --git a/net/rxrpc/transport.c b/net/rxrpc/transport.c index 7e015ceec..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 */ @@ -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;