blob: e7f75b7685c3f0d1a97a49d0d96e4648e100c1b1 [file] [log] [blame]
Skylar Chang9fbce062017-07-25 16:20:42 -07001/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
Amir Levy9659e592016-10-27 18:08:27 +03002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef _IPA_ODO_BRIDGE_H_
14#define _IPA_ODO_BRIDGE_H_
15
16#include <linux/ipa.h>
17
18/**
19 * struct odu_bridge_params - parameters for odu bridge initialization API
20 *
21 * @netdev_name: network interface name
22 * @priv: private data that will be supplied to client's callback
23 * @tx_dp_notify: callback for handling SKB. the following event are supported:
24 * IPA_WRITE_DONE: will be called after client called to odu_bridge_tx_dp()
25 * Client is expected to free the skb.
26 * IPA_RECEIVE: will be called for delivering skb to APPS.
27 * Client is expected to deliver the skb to network stack.
28 * @send_dl_skb: callback for sending skb on downlink direction to adapter.
29 * Client is expected to free the skb.
30 * @device_ethaddr: device Ethernet address in network order.
31 * @ipa_desc_size: IPA Sys Pipe Desc Size
32 */
33struct odu_bridge_params {
34 const char *netdev_name;
35 void *priv;
36 ipa_notify_cb tx_dp_notify;
37 int (*send_dl_skb)(void *priv, struct sk_buff *skb);
38 u8 device_ethaddr[ETH_ALEN];
39 u32 ipa_desc_size;
40};
41
Skylar Chang9fbce062017-07-25 16:20:42 -070042/**
43 * struct ipa_bridge_init_params - parameters for IPA bridge initialization API
44 *
45 * @info: structure contains initialization information
46 * @wakeup_request: callback to client to indicate there is downlink data
47 * available. Client is expected to call ipa_bridge_resume() to start
48 * receiving data
49 */
50struct ipa_bridge_init_params {
51 struct odu_bridge_params info;
52 void (*wakeup_request)(void *);
53};
54
55#ifdef CONFIG_IPA3
56
57int ipa_bridge_init(struct ipa_bridge_init_params *params, u32 *hdl);
58
59int ipa_bridge_connect(u32 hdl);
60
61int ipa_bridge_set_perf_profile(u32 hdl, u32 bandwidth);
62
63int ipa_bridge_disconnect(u32 hdl);
64
65int ipa_bridge_suspend(u32 hdl);
66
67int ipa_bridge_resume(u32 hdl);
68
69int ipa_bridge_tx_dp(u32 hdl, struct sk_buff *skb,
70 struct ipa_tx_meta *metadata);
71
72int ipa_bridge_cleanup(u32 hdl);
73
74#else
75
76static inline int ipa_bridge_init(struct odu_bridge_params *params, u32 *hdl)
77{
78 return -EPERM;
79}
80
81static inline int ipa_bridge_connect(u32 hdl)
82{
83 return -EPERM;
84}
85
86static inline int ipa_bridge_set_perf_profile(u32 hdl, u32 bandwidth)
87{
88 return -EPERM;
89}
90
91static inline int ipa_bridge_disconnect(u32 hdl)
92{
93 return -EPERM;
94}
95
96static inline int ipa_bridge_suspend(u32 hdl)
97{
98 return -EPERM;
99}
100
101static inline int ipa_bridge_resume(u32 hdl)
102{
103 return -EPERM;
104}
105
106static inline int ipa_bridge_tx_dp(u32 hdl, struct sk_buff *skb,
107struct ipa_tx_meta *metadata)
108{
109 return -EPERM;
110}
111
112static inline int ipa_bridge_cleanup(u32 hdl)
113{
114 return -EPERM;
115}
116
117#endif /* CONFIG_IPA3 */
118
119/* Below API is deprecated. Please use the API above */
120# if defined CONFIG_IPA || defined CONFIG_IPA3
Amir Levy9659e592016-10-27 18:08:27 +0300121
122int odu_bridge_init(struct odu_bridge_params *params);
123
124int odu_bridge_connect(void);
125
126int odu_bridge_disconnect(void);
127
128int odu_bridge_tx_dp(struct sk_buff *skb, struct ipa_tx_meta *metadata);
129
130int odu_bridge_cleanup(void);
131
132#else
133
134static inline int odu_bridge_init(struct odu_bridge_params *params)
135{
136 return -EPERM;
137}
138
139static inline int odu_bridge_disconnect(void)
140{
141 return -EPERM;
142}
143
144static inline int odu_bridge_connect(void)
145{
146 return -EPERM;
147}
148
149static inline int odu_bridge_tx_dp(struct sk_buff *skb,
150 struct ipa_tx_meta *metadata)
151{
152 return -EPERM;
153}
154
155static inline int odu_bridge_cleanup(void)
156{
157 return -EPERM;
158}
159
160#endif /* CONFIG_IPA || defined CONFIG_IPA3 */
161
162#endif /* _IPA_ODO_BRIDGE_H */