ucm.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (c) 2005 Topspin Communications. All rights reserved.
  3. * Copyright (c) 2005 Intel Corporation. All rights reserved.
  4. *
  5. * This software is available to you under a choice of one of two
  6. * licenses. You may choose to be licensed under the terms of the GNU
  7. * General Public License (GPL) Version 2, available from the file
  8. * COPYING in the main directory of this source tree, or the
  9. * OpenIB.org BSD license below:
  10. *
  11. * Redistribution and use in source and binary forms, with or
  12. * without modification, are permitted provided that the following
  13. * conditions are met:
  14. *
  15. * - Redistributions of source code must retain the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer.
  18. *
  19. * - Redistributions in binary form must reproduce the above
  20. * copyright notice, this list of conditions and the following
  21. * disclaimer in the documentation and/or other materials
  22. * provided with the distribution.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  28. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  29. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  30. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  31. * SOFTWARE.
  32. *
  33. * $Id: ucm.h 2208 2005-04-22 23:24:31Z libor $
  34. */
  35. #ifndef UCM_H
  36. #define UCM_H
  37. #include <linux/fs.h>
  38. #include <linux/device.h>
  39. #include <linux/cdev.h>
  40. #include <linux/idr.h>
  41. #include <rdma/ib_cm.h>
  42. #include <rdma/ib_user_cm.h>
  43. struct ib_ucm_file {
  44. struct semaphore mutex;
  45. struct file *filp;
  46. struct list_head ctxs; /* list of active connections */
  47. struct list_head events; /* list of pending events */
  48. wait_queue_head_t poll_wait;
  49. };
  50. struct ib_ucm_context {
  51. int id;
  52. wait_queue_head_t wait;
  53. atomic_t ref;
  54. int events_reported;
  55. struct ib_ucm_file *file;
  56. struct ib_cm_id *cm_id;
  57. __u64 uid;
  58. struct list_head events; /* list of pending events. */
  59. struct list_head file_list; /* member in file ctx list */
  60. };
  61. struct ib_ucm_event {
  62. struct ib_ucm_context *ctx;
  63. struct list_head file_list; /* member in file event list */
  64. struct list_head ctx_list; /* member in ctx event list */
  65. struct ib_cm_id *cm_id;
  66. struct ib_ucm_event_resp resp;
  67. void *data;
  68. void *info;
  69. int data_len;
  70. int info_len;
  71. };
  72. #endif /* UCM_H */