[PATCH] s390: spin lock retry
[linux/fpc-iii.git] / include / rxrpc / transport.h
blob7c7b9683fa3960763c7fef2a9be13a0ec4b6a585
1 /* transport.h: Rx transport management
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
12 #ifndef _LINUX_RXRPC_TRANSPORT_H
13 #define _LINUX_RXRPC_TRANSPORT_H
15 #include <rxrpc/types.h>
16 #include <rxrpc/krxiod.h>
17 #include <rxrpc/rxrpc.h>
18 #include <linux/skbuff.h>
19 #include <linux/rwsem.h>
21 typedef int (*rxrpc_newcall_fnx_t)(struct rxrpc_call *call);
23 extern wait_queue_head_t rxrpc_krxiod_wq;
25 /*****************************************************************************/
27 * Rx operation specification
28 * - tables of these must be sorted by op ID so that they can be binary-chop searched
30 struct rxrpc_operation
32 unsigned id; /* operation ID */
33 size_t asize; /* minimum size of argument block */
34 const char *name; /* name of operation */
35 void *user; /* initial user data */
38 /*****************************************************************************/
40 * Rx transport service record
42 struct rxrpc_service
44 struct list_head link; /* link in services list on transport */
45 struct module *owner; /* owner module */
46 rxrpc_newcall_fnx_t new_call; /* new call handler function */
47 const char *name; /* name of service */
48 unsigned short service_id; /* Rx service ID */
49 rxrpc_call_attn_func_t attn_func; /* call requires attention callback */
50 rxrpc_call_error_func_t error_func; /* call error callback */
51 rxrpc_call_aemap_func_t aemap_func; /* abort -> errno mapping callback */
53 const struct rxrpc_operation *ops_begin; /* beginning of operations table */
54 const struct rxrpc_operation *ops_end; /* end of operations table */
57 /*****************************************************************************/
59 * Rx transport endpoint record
61 struct rxrpc_transport
63 atomic_t usage;
64 struct socket *socket; /* my UDP socket */
65 struct list_head services; /* services listening on this socket */
66 struct list_head link; /* link in transport list */
67 struct list_head proc_link; /* link in transport proc list */
68 struct list_head krxiodq_link; /* krxiod attention queue link */
69 spinlock_t lock; /* access lock */
70 struct list_head peer_active; /* active peers connected to over this socket */
71 struct list_head peer_graveyard; /* inactive peer list */
72 spinlock_t peer_gylock; /* peer graveyard lock */
73 wait_queue_head_t peer_gy_waitq; /* wait queue hit when peer graveyard is empty */
74 rwlock_t peer_lock; /* peer list access lock */
75 atomic_t peer_count; /* number of peers */
76 struct rxrpc_peer_ops *peer_ops; /* default peer operations */
77 unsigned short port; /* port upon which listening */
78 volatile char error_rcvd; /* T if received ICMP error outstanding */
81 extern int rxrpc_create_transport(unsigned short port,
82 struct rxrpc_transport **_trans);
84 static inline void rxrpc_get_transport(struct rxrpc_transport *trans)
86 BUG_ON(atomic_read(&trans->usage) <= 0);
87 atomic_inc(&trans->usage);
88 //printk("rxrpc_get_transport(%p{u=%d})\n",
89 // trans, atomic_read(&trans->usage));
92 extern void rxrpc_put_transport(struct rxrpc_transport *trans);
94 extern int rxrpc_add_service(struct rxrpc_transport *trans,
95 struct rxrpc_service *srv);
97 extern void rxrpc_del_service(struct rxrpc_transport *trans,
98 struct rxrpc_service *srv);
100 extern void rxrpc_trans_receive_packet(struct rxrpc_transport *trans);
102 extern int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
103 struct rxrpc_message *msg,
104 int error);
106 #endif /* _LINUX_RXRPC_TRANSPORT_H */