Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1 | /* Copyright (c) 2013-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 _RNDIS_IPA_H_ |
| 14 | #define _RNDIS_IPA_H_ |
| 15 | |
| 16 | #include <linux/ipa.h> |
| 17 | |
| 18 | /* |
| 19 | * @priv: private data given upon ipa_connect |
| 20 | * @evt: event enum, should be IPA_WRITE_DONE |
| 21 | * @data: for tx path the data field is the sent socket buffer. |
| 22 | */ |
| 23 | typedef void (*ipa_callback)(void *priv, |
| 24 | enum ipa_dp_evt_type evt, |
| 25 | unsigned long data); |
| 26 | |
| 27 | /* |
| 28 | * struct ipa_usb_init_params - parameters for driver initialization API |
| 29 | * |
| 30 | * @device_ready_notify: callback supplied by USB core driver |
| 31 | * This callback shall be called by the Netdev once the device |
| 32 | * is ready to receive data from tethered PC. |
| 33 | * @ipa_rx_notify: The network driver will set this callback (out parameter). |
| 34 | * this callback shall be supplied for ipa_connect upon pipe |
| 35 | * connection (USB->IPA), once IPA driver receive data packets |
| 36 | * from USB pipe destined for Apps this callback will be called. |
| 37 | * @ipa_tx_notify: The network driver will set this callback (out parameter). |
| 38 | * this callback shall be supplied for ipa_connect upon pipe |
| 39 | * connection (IPA->USB), once IPA driver send packets destined |
| 40 | * for USB, IPA BAM will notify for Tx-complete. |
| 41 | * @host_ethaddr: host Ethernet address in network order |
| 42 | * @device_ethaddr: device Ethernet address in network order |
| 43 | * @private: The network driver will set this pointer (out parameter). |
| 44 | * This pointer will hold the network device for later interaction |
| 45 | * with between USB driver and the network driver. |
| 46 | * @skip_ep_cfg: boolean field that determines if Apps-processor |
| 47 | * should or should not configure this end-point. |
| 48 | */ |
| 49 | struct ipa_usb_init_params { |
| 50 | void (*device_ready_notify)(void); |
| 51 | ipa_callback ipa_rx_notify; |
| 52 | ipa_callback ipa_tx_notify; |
| 53 | u8 host_ethaddr[ETH_ALEN]; |
| 54 | u8 device_ethaddr[ETH_ALEN]; |
| 55 | void *private; |
| 56 | bool skip_ep_cfg; |
| 57 | }; |
| 58 | |
| 59 | #ifdef CONFIG_RNDIS_IPA |
| 60 | |
| 61 | int rndis_ipa_init(struct ipa_usb_init_params *params); |
| 62 | |
| 63 | int rndis_ipa_pipe_connect_notify(u32 usb_to_ipa_hdl, |
| 64 | u32 ipa_to_usb_hdl, |
| 65 | u32 max_xfer_size_bytes_to_dev, |
| 66 | u32 max_packet_number_to_dev, |
| 67 | u32 max_xfer_size_bytes_to_host, |
| 68 | void *private); |
| 69 | |
| 70 | int rndis_ipa_pipe_disconnect_notify(void *private); |
| 71 | |
| 72 | void rndis_ipa_cleanup(void *private); |
| 73 | |
| 74 | #else /* CONFIG_RNDIS_IPA*/ |
| 75 | |
| 76 | static inline int rndis_ipa_init(struct ipa_usb_init_params *params) |
| 77 | { |
| 78 | return -ENOMEM; |
| 79 | } |
| 80 | |
| 81 | static inline int rndis_ipa_pipe_connect_notify(u32 usb_to_ipa_hdl, |
| 82 | u32 ipa_to_usb_hdl, |
| 83 | u32 max_xfer_size_bytes_to_dev, |
| 84 | u32 max_packet_number_to_dev, |
| 85 | u32 max_xfer_size_bytes_to_host, |
| 86 | void *private) |
| 87 | { |
| 88 | return -ENOMEM; |
| 89 | } |
| 90 | |
| 91 | static inline int rndis_ipa_pipe_disconnect_notify(void *private) |
| 92 | { |
| 93 | return -ENOMEM; |
| 94 | } |
| 95 | |
| 96 | static inline void rndis_ipa_cleanup(void *private) |
| 97 | { |
| 98 | |
| 99 | } |
| 100 | #endif /* CONFIG_RNDIS_IPA */ |
| 101 | |
| 102 | #endif /* _RNDIS_IPA_H_ */ |