X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Frxrpc%2Ftransport.c;h=dbe6105e83a54e1f9ce66b4466a2863e0d7f155f;hb=2890e71bef1c249b5ea6dcd68e9ec7851ae7740b;hp=92bcf9bf41452d229c487b6e4d9a465e55db65d1;hpb=70790a4b5cd6c0291e5b1a2836e2832d46036ac6;p=linux-2.6.git diff --git a/net/rxrpc/transport.c b/net/rxrpc/transport.c index 92bcf9bf4..dbe6105e8 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) @@ -39,7 +40,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); @@ -148,16 +149,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 @@ -340,7 +331,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) @@ -457,8 +448,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 +476,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,8 +599,7 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans, struct sockaddr_in sin; struct msghdr msghdr; struct kvec iov[2]; - mm_segment_t oldfs; - uint32_t _error; + __be32 _error; int len, ret; _enter("%p,%p,%d", trans, msg, error); @@ -649,12 +635,6 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans, msghdr.msg_name = &sin; msghdr.msg_namelen = sizeof(sin); - /* - * the following is safe, since for compiler definitions of kvec and - * iovec are identical, yielding the same in-core layout and alignment - */ - msghdr.msg_iov = (struct iovec *)iov; - msghdr.msg_iovlen = 2; msghdr.msg_control = NULL; msghdr.msg_controllen = 0; msghdr.msg_flags = MSG_DONTWAIT; @@ -662,14 +642,11 @@ 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 */ - oldfs = get_fs(); - set_fs(KERNEL_DS); - ret = sock_sendmsg(trans->socket, &msghdr, len); - set_fs(oldfs); + ret = kernel_sendmsg(trans->socket, &msghdr, iov, 2, len); _leave(" = %d", ret); return ret; @@ -688,8 +665,7 @@ static void rxrpc_trans_receive_error_report(struct rxrpc_transport *trans) struct list_head connq, *_p; struct errormsg emsg; struct msghdr msg; - mm_segment_t oldfs; - uint16_t port; + __be16 port; int local, err; _enter("%p", trans); @@ -700,17 +676,12 @@ static void rxrpc_trans_receive_error_report(struct rxrpc_transport *trans) /* try and receive an error message */ msg.msg_name = &sin; msg.msg_namelen = sizeof(sin); - msg.msg_iov = NULL; - msg.msg_iovlen = 0; msg.msg_control = &emsg; msg.msg_controllen = sizeof(emsg); msg.msg_flags = 0; - oldfs = get_fs(); - set_fs(KERNEL_DS); - err = sock_recvmsg(trans->socket, &msg, 0, + err = kernel_recvmsg(trans->socket, &msg, NULL, 0, 0, MSG_ERRQUEUE | MSG_DONTWAIT | MSG_TRUNC); - set_fs(oldfs); if (err == -EAGAIN) { _leave("");