lowcomms.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /******************************************************************************
  3. *******************************************************************************
  4. **
  5. ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
  6. ** Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
  7. **
  8. **
  9. *******************************************************************************
  10. ******************************************************************************/
  11. #ifndef __LOWCOMMS_DOT_H__
  12. #define __LOWCOMMS_DOT_H__
  13. #include "dlm_internal.h"
  14. #define DLM_MIDCOMMS_OPT_LEN sizeof(struct dlm_opts)
  15. #define DLM_MAX_APP_BUFSIZE (DLM_MAX_SOCKET_BUFSIZE - \
  16. DLM_MIDCOMMS_OPT_LEN)
  17. #define CONN_HASH_SIZE 32
  18. /* This is deliberately very simple because most clusters have simple
  19. * sequential nodeids, so we should be able to go straight to a connection
  20. * struct in the array
  21. */
  22. static inline int nodeid_hash(int nodeid)
  23. {
  24. return nodeid & (CONN_HASH_SIZE-1);
  25. }
  26. /* switch to check if dlm is running */
  27. extern int dlm_allow_conn;
  28. int dlm_lowcomms_start(void);
  29. void dlm_lowcomms_shutdown(void);
  30. void dlm_lowcomms_stop(void);
  31. void dlm_lowcomms_init(void);
  32. void dlm_lowcomms_exit(void);
  33. int dlm_lowcomms_close(int nodeid);
  34. struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation,
  35. char **ppc, void (*cb)(void *data),
  36. void *data);
  37. void dlm_lowcomms_commit_msg(struct dlm_msg *msg);
  38. void dlm_lowcomms_put_msg(struct dlm_msg *msg);
  39. int dlm_lowcomms_resend_msg(struct dlm_msg *msg);
  40. int dlm_lowcomms_connect_node(int nodeid);
  41. int dlm_lowcomms_nodes_set_mark(int nodeid, unsigned int mark);
  42. int dlm_lowcomms_addr(int nodeid, struct sockaddr_storage *addr, int len);
  43. void dlm_midcomms_receive_done(int nodeid);
  44. struct kmem_cache *dlm_lowcomms_writequeue_cache_create(void);
  45. struct kmem_cache *dlm_lowcomms_msg_cache_create(void);
  46. #endif /* __LOWCOMMS_DOT_H__ */