tcp_recv.c (ee58b57100ca953da7320c285315a95db2f7053d) tcp_recv.c (ea3b1ea53930879c9847044f5cb9c97411cae797)
1/*
2 * Copyright (c) 2006 Oracle. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

--- 283 unchanged lines hidden (view full) ---

292 release_sock(sock->sk);
293
294 return ret;
295}
296
297void rds_tcp_data_ready(struct sock *sk)
298{
299 void (*ready)(struct sock *sk);
1/*
2 * Copyright (c) 2006 Oracle. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

--- 283 unchanged lines hidden (view full) ---

292 release_sock(sock->sk);
293
294 return ret;
295}
296
297void rds_tcp_data_ready(struct sock *sk)
298{
299 void (*ready)(struct sock *sk);
300 struct rds_connection *conn;
300 struct rds_conn_path *cp;
301 struct rds_tcp_connection *tc;
302
303 rdsdebug("data ready sk %p\n", sk);
304
305 read_lock_bh(&sk->sk_callback_lock);
301 struct rds_tcp_connection *tc;
302
303 rdsdebug("data ready sk %p\n", sk);
304
305 read_lock_bh(&sk->sk_callback_lock);
306 conn = sk->sk_user_data;
307 if (!conn) { /* check for teardown race */
306 cp = sk->sk_user_data;
307 if (!cp) { /* check for teardown race */
308 ready = sk->sk_data_ready;
309 goto out;
310 }
311
308 ready = sk->sk_data_ready;
309 goto out;
310 }
311
312 tc = conn->c_transport_data;
312 tc = cp->cp_transport_data;
313 ready = tc->t_orig_data_ready;
314 rds_tcp_stats_inc(s_tcp_data_ready_calls);
315
313 ready = tc->t_orig_data_ready;
314 rds_tcp_stats_inc(s_tcp_data_ready_calls);
315
316 if (rds_tcp_read_sock(conn, GFP_ATOMIC) == -ENOMEM)
317 queue_delayed_work(rds_wq, &conn->c_recv_w, 0);
316 if (rds_tcp_read_sock(cp->cp_conn, GFP_ATOMIC) == -ENOMEM)
317 queue_delayed_work(rds_wq, &cp->cp_recv_w, 0);
318out:
319 read_unlock_bh(&sk->sk_callback_lock);
320 ready(sk);
321}
322
323int rds_tcp_recv_init(void)
324{
325 rds_tcp_incoming_slab = kmem_cache_create("rds_tcp_incoming",
326 sizeof(struct rds_tcp_incoming),
327 0, 0, NULL);
328 if (!rds_tcp_incoming_slab)
329 return -ENOMEM;
330 return 0;
331}
332
333void rds_tcp_recv_exit(void)
334{
335 kmem_cache_destroy(rds_tcp_incoming_slab);
336}
318out:
319 read_unlock_bh(&sk->sk_callback_lock);
320 ready(sk);
321}
322
323int rds_tcp_recv_init(void)
324{
325 rds_tcp_incoming_slab = kmem_cache_create("rds_tcp_incoming",
326 sizeof(struct rds_tcp_incoming),
327 0, 0, NULL);
328 if (!rds_tcp_incoming_slab)
329 return -ENOMEM;
330 return 0;
331}
332
333void rds_tcp_recv_exit(void)
334{
335 kmem_cache_destroy(rds_tcp_incoming_slab);
336}