aboutsummaryrefslogtreecommitdiff
path: root/include/soc/qcom/rmnet_ctl.h
blob: f961e51b81bd11d27dbdb9a25ea429c2c9df20ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* Copyright (c) 2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef _RMNET_CTL_H_
#define _RMNET_CTL_H_

#include <linux/skbuff.h>

enum rmnet_ctl_log_lvl {
	RMNET_CTL_LOG_CRIT,
	RMNET_CTL_LOG_ERR,
	RMNET_CTL_LOG_INFO,
	RMNET_CTL_LOG_DEBUG,
};

#define rmnet_ctl_log_err(msg, rc, data, len) \
		rmnet_ctl_log(RMNET_CTL_LOG_ERR, msg, rc, data, len)

#define rmnet_ctl_log_info(msg, data, len) \
		rmnet_ctl_log(RMNET_CTL_LOG_INFO, msg, 0, data, len)

#define rmnet_ctl_log_debug(msg, data, len) \
		rmnet_ctl_log(RMNET_CTL_LOG_DEBUG, msg, 0, data, len)

struct rmnet_ctl_client_hooks {
	void (*ctl_dl_client_hook)(struct sk_buff *);
};

#ifdef CONFIG_RMNET_CTL

void *rmnet_ctl_register_client(struct rmnet_ctl_client_hooks *hook);
int rmnet_ctl_unregister_client(void *handle);
int rmnet_ctl_send_client(void *handle, struct sk_buff *skb);
void rmnet_ctl_log(enum rmnet_ctl_log_lvl lvl, const char *msg,
		   int rc, const void *data, unsigned int len);

#else

static inline void *rmnet_ctl_register_client(
			struct rmnet_ctl_client_hooks *hook)
{
	return NULL;
}

static inline int rmnet_ctl_unregister_client(void *handle)
{
	return -EINVAL;
}

static inline int rmnet_ctl_send_client(void *handle, struct sk_buff *skb)
{
	return -EINVAL;
}

static inline void rmnet_ctl_log(enum rmnet_ctl_log_lvl lvl, const char *msg,
				 int rc, const void *data, unsigned int len)
{
}

#endif /* CONFIG_RMNET_CTL */

#endif /* _RMNET_CTL_H_ */