• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/net/rxrpc/

Lines Matching defs:bundle

28  * allocate a new client connection bundle
32 struct rxrpc_conn_bundle *bundle;
36 bundle = kzalloc(sizeof(struct rxrpc_conn_bundle), gfp);
37 if (bundle) {
38 INIT_LIST_HEAD(&bundle->unused_conns);
39 INIT_LIST_HEAD(&bundle->avail_conns);
40 INIT_LIST_HEAD(&bundle->busy_conns);
41 init_waitqueue_head(&bundle->chanwait);
42 atomic_set(&bundle->usage, 1);
45 _leave(" = %p", bundle);
46 return bundle;
50 * compare bundle parameters with what we're looking for
54 int rxrpc_cmp_bundle(const struct rxrpc_conn_bundle *bundle,
57 return (bundle->service_id - service_id) ?:
58 ((unsigned long) bundle->key - (unsigned long) key);
62 * get bundle of client connections that a client socket can make use of
70 struct rxrpc_conn_bundle *bundle, *candidate;
76 if (rx->trans == trans && rx->bundle) {
77 atomic_inc(&rx->bundle->usage);
78 return rx->bundle;
87 bundle = rb_entry(p, struct rxrpc_conn_bundle, node);
89 if (rxrpc_cmp_bundle(bundle, key, service_id) < 0)
91 else if (rxrpc_cmp_bundle(bundle, key, service_id) > 0)
116 bundle = rb_entry(parent, struct rxrpc_conn_bundle, node);
118 if (rxrpc_cmp_bundle(bundle, key, service_id) < 0)
120 else if (rxrpc_cmp_bundle(bundle, key, service_id) > 0)
126 /* second search also failed; add the new bundle */
127 bundle = candidate;
130 rb_link_node(&bundle->node, parent, pp);
131 rb_insert_color(&bundle->node, &trans->bundles);
134 if (!rx->bundle && rx->sk.sk_state == RXRPC_CLIENT_CONNECTED) {
135 atomic_inc(&bundle->usage);
136 rx->bundle = bundle;
138 _leave(" = %p [new]", bundle);
139 return bundle;
141 /* we found the bundle in the list immediately */
143 atomic_inc(&bundle->usage);
146 if (!rx->bundle && rx->sk.sk_state == RXRPC_CLIENT_CONNECTED) {
147 atomic_inc(&bundle->usage);
148 rx->bundle = bundle;
150 _leave(" = %p [extant %d]", bundle, atomic_read(&bundle->usage));
151 return bundle;
153 /* we found the bundle on the second time through the list */
155 atomic_inc(&bundle->usage);
159 if (!rx->bundle && rx->sk.sk_state == RXRPC_CLIENT_CONNECTED) {
160 atomic_inc(&bundle->usage);
161 rx->bundle = bundle;
163 _leave(" = %p [second %d]", bundle, atomic_read(&bundle->usage));
164 return bundle;
168 * release a bundle
171 struct rxrpc_conn_bundle *bundle)
173 _enter("%p,%p{%d}",trans, bundle, atomic_read(&bundle->usage));
175 if (atomic_dec_and_lock(&bundle->usage, &trans->client_lock)) {
176 _debug("Destroy bundle");
177 rb_erase(&bundle->node, &trans->bundles);
179 ASSERT(list_empty(&bundle->unused_conns));
180 ASSERT(list_empty(&bundle->avail_conns));
181 ASSERT(list_empty(&bundle->busy_conns));
182 ASSERTCMP(bundle->num_conns, ==, 0);
183 key_put(bundle->key);
184 kfree(bundle);
352 conn->bundle = NULL;
424 struct rxrpc_conn_bundle *bundle,
436 return rxrpc_connect_exclusive(rx, trans, bundle->service_id,
441 /* see if the bundle has a call slot available */
442 if (!list_empty(&bundle->avail_conns)) {
444 conn = list_entry(bundle->avail_conns.next,
449 &bundle->busy_conns);
459 if (!list_empty(&bundle->unused_conns)) {
461 conn = list_entry(bundle->unused_conns.next,
471 list_move(&conn->bundle_link, &bundle->avail_conns);
476 _debug("get new conn [%d]", bundle->num_conns);
483 if (bundle->num_conns >= 20) {
491 add_wait_queue(&bundle->chanwait, &myself);
494 if (bundle->num_conns < 20 ||
495 !list_empty(&bundle->unused_conns) ||
496 !list_empty(&bundle->avail_conns))
502 remove_wait_queue(&bundle->chanwait, &myself);
517 candidate->bundle = bundle;
518 candidate->service_id = bundle->service_id;
526 candidate->key = key_get(bundle->key);
542 list_add(&candidate->bundle_link, &bundle->unused_conns);
543 bundle->num_conns++;
544 atomic_inc(&bundle->usage);
555 * bundle until we're ready for it */
564 * - we're holding a reference on the bundle
594 remove_wait_queue(&bundle->chanwait, &myself);
814 if (conn->bundle)
815 rxrpc_put_bundle(conn->trans, conn->bundle);
864 if (conn->bundle) {
866 conn->bundle->num_conns--;