Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1 | /* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. |
| 2 | * |
| 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 | */ |
| 33 | struct 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 | |
| 42 | #if defined CONFIG_IPA || defined CONFIG_IPA3 |
| 43 | |
| 44 | int odu_bridge_init(struct odu_bridge_params *params); |
| 45 | |
| 46 | int odu_bridge_connect(void); |
| 47 | |
| 48 | int odu_bridge_disconnect(void); |
| 49 | |
| 50 | int odu_bridge_tx_dp(struct sk_buff *skb, struct ipa_tx_meta *metadata); |
| 51 | |
| 52 | int odu_bridge_cleanup(void); |
| 53 | |
| 54 | #else |
| 55 | |
| 56 | static inline int odu_bridge_init(struct odu_bridge_params *params) |
| 57 | { |
| 58 | return -EPERM; |
| 59 | } |
| 60 | |
| 61 | static inline int odu_bridge_disconnect(void) |
| 62 | { |
| 63 | return -EPERM; |
| 64 | } |
| 65 | |
| 66 | static inline int odu_bridge_connect(void) |
| 67 | { |
| 68 | return -EPERM; |
| 69 | } |
| 70 | |
| 71 | static inline int odu_bridge_tx_dp(struct sk_buff *skb, |
| 72 | struct ipa_tx_meta *metadata) |
| 73 | { |
| 74 | return -EPERM; |
| 75 | } |
| 76 | |
| 77 | static inline int odu_bridge_cleanup(void) |
| 78 | { |
| 79 | return -EPERM; |
| 80 | } |
| 81 | |
| 82 | #endif /* CONFIG_IPA || defined CONFIG_IPA3 */ |
| 83 | |
| 84 | #endif /* _IPA_ODO_BRIDGE_H */ |