blob: 29369feea9916846ced5a8c01ccfb462773ffb8a [file] [log] [blame]
Thomas Gleixner2522fe42019-05-28 09:57:20 -07001/* SPDX-License-Identifier: GPL-2.0-only */
David Teiglande7fd4172006-01-18 09:30:29 +00002/******************************************************************************
3*******************************************************************************
4**
5** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
Christine Caulfield391fbdc2009-05-07 10:54:16 -05006** Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
David Teiglande7fd4172006-01-18 09:30:29 +00007**
David Teiglande7fd4172006-01-18 09:30:29 +00008**
9*******************************************************************************
10******************************************************************************/
11
12#ifndef __LOWCOMMS_DOT_H__
13#define __LOWCOMMS_DOT_H__
14
Alexander Aring489d8e52021-05-21 15:08:46 -040015#include "dlm_internal.h"
16
17#define DLM_MIDCOMMS_OPT_LEN sizeof(struct dlm_opts)
Alexander Aringd10a0b82021-06-02 09:45:20 -040018#define DLM_MAX_APP_BUFSIZE (DLM_MAX_SOCKET_BUFSIZE - \
Alexander Aring489d8e52021-05-21 15:08:46 -040019 DLM_MIDCOMMS_OPT_LEN)
20
Alexander Aring37a247d2021-05-21 15:08:44 -040021#define CONN_HASH_SIZE 32
22
23/* This is deliberately very simple because most clusters have simple
24 * sequential nodeids, so we should be able to go straight to a connection
25 * struct in the array
26 */
27static inline int nodeid_hash(int nodeid)
28{
29 return nodeid & (CONN_HASH_SIZE-1);
30}
Alexander Aring9f8f9c72020-11-02 20:04:17 -050031
Alexander Aring51746162021-03-01 17:05:13 -050032/* switch to check if dlm is running */
33extern int dlm_allow_conn;
34
David Teiglande7fd4172006-01-18 09:30:29 +000035int dlm_lowcomms_start(void);
Alexander Aring9d232462021-03-01 17:05:20 -050036void dlm_lowcomms_shutdown(void);
David Teiglande7fd4172006-01-18 09:30:29 +000037void dlm_lowcomms_stop(void);
David Teigland36b71a82012-07-26 12:44:30 -050038void dlm_lowcomms_exit(void);
David Teigland1c032c02006-04-28 10:50:41 -040039int dlm_lowcomms_close(int nodeid);
Alexander Aring8f2dc782021-05-21 15:08:42 -040040struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation,
Alexander Aring5c16feb2021-11-02 15:17:19 -040041 char **ppc, void (*cb)(void *data),
42 void *data);
Alexander Aring8f2dc782021-05-21 15:08:42 -040043void dlm_lowcomms_commit_msg(struct dlm_msg *msg);
44void dlm_lowcomms_put_msg(struct dlm_msg *msg);
Alexander Aring2874d1a2021-05-21 15:08:43 -040045int dlm_lowcomms_resend_msg(struct dlm_msg *msg);
Christine Caulfield391fbdc2009-05-07 10:54:16 -050046int dlm_lowcomms_connect_node(int nodeid);
Alexander Aringe125fbe2021-03-01 17:05:09 -050047int dlm_lowcomms_nodes_set_mark(int nodeid, unsigned int mark);
David Teigland36b71a82012-07-26 12:44:30 -050048int dlm_lowcomms_addr(int nodeid, struct sockaddr_storage *addr, int len);
Alexander Aringb97f8522021-08-18 16:27:13 -040049void dlm_midcomms_receive_done(int nodeid);
Alexander Aring3af23262021-11-30 14:47:19 -050050struct kmem_cache *dlm_lowcomms_writequeue_cache_create(void);
Alexander Aringe4dc81e2021-11-30 14:47:20 -050051struct kmem_cache *dlm_lowcomms_msg_cache_create(void);
David Teiglande7fd4172006-01-18 09:30:29 +000052
53#endif /* __LOWCOMMS_DOT_H__ */
54