1 /* 2 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #ifndef _DP_IPA_H_ 18 #define _DP_IPA_H_ 19 20 #ifdef IPA_OFFLOAD 21 22 #define DP_IPA_MAX_IFACE 3 23 #define IPA_TCL_DATA_RING_IDX 2 24 #define IPA_TX_COMP_RING_IDX 2 25 #define IPA_REO_DEST_RING_IDX 3 26 #define IPA_RX_REFILL_BUF_RING_IDX 2 27 28 /** 29 * struct dp_ipa_uc_tx_hdr - full tx header registered to IPA hardware 30 * @eth: ether II header 31 */ 32 struct dp_ipa_uc_tx_hdr { 33 struct ethhdr eth; 34 } __packed; 35 36 /** 37 * struct dp_ipa_uc_rx_hdr - full rx header registered to IPA hardware 38 * @eth: ether II header 39 */ 40 struct dp_ipa_uc_rx_hdr { 41 struct ethhdr eth; 42 } __packed; 43 44 #define DP_IPA_UC_WLAN_TX_HDR_LEN sizeof(struct dp_ipa_uc_tx_hdr) 45 #define DP_IPA_UC_WLAN_RX_HDR_LEN sizeof(struct dp_ipa_uc_rx_hdr) 46 #define DP_IPA_UC_WLAN_HDR_DES_MAC_OFFSET 0 47 48 QDF_STATUS dp_ipa_get_resource(struct cdp_pdev *pdev); 49 QDF_STATUS dp_ipa_set_doorbell_paddr(struct cdp_pdev *pdev); 50 QDF_STATUS dp_ipa_uc_set_active(struct cdp_pdev *pdev, bool uc_active, 51 bool is_tx); 52 QDF_STATUS dp_ipa_op_response(struct cdp_pdev *pdev, uint8_t *op_msg); 53 QDF_STATUS dp_ipa_register_op_cb(struct cdp_pdev *pdev, ipa_uc_op_cb_type op_cb, 54 void *usr_ctxt); 55 QDF_STATUS dp_ipa_get_stat(struct cdp_pdev *pdev); 56 qdf_nbuf_t dp_tx_send_ipa_data_frame(struct cdp_vdev *vdev, qdf_nbuf_t skb); 57 QDF_STATUS dp_ipa_enable_autonomy(struct cdp_pdev *pdev); 58 QDF_STATUS dp_ipa_disable_autonomy(struct cdp_pdev *pdev); 59 #ifdef CONFIG_IPA_WDI_UNIFIED_API 60 QDF_STATUS dp_ipa_setup(struct cdp_pdev *pdev, void *ipa_i2w_cb, 61 void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb, 62 uint32_t ipa_desc_size, void *ipa_priv, 63 bool is_rm_enabled, uint32_t *tx_pipe_handle, 64 uint32_t *rx_pipe_handle, 65 bool is_smmu_enabled, 66 qdf_ipa_sys_connect_params_t *sys_in); 67 #else /* CONFIG_IPA_WDI_UNIFIED_API */ 68 QDF_STATUS dp_ipa_setup(struct cdp_pdev *pdev, void *ipa_i2w_cb, 69 void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb, 70 uint32_t ipa_desc_size, void *ipa_priv, 71 bool is_rm_enabled, uint32_t *tx_pipe_handle, 72 uint32_t *rx_pipe_handle); 73 #endif /* CONFIG_IPA_WDI_UNIFIED_API */ 74 QDF_STATUS dp_ipa_cleanup(uint32_t tx_pipe_handle, 75 uint32_t rx_pipe_handle); 76 QDF_STATUS dp_ipa_remove_header(char *name); 77 int dp_ipa_add_header_info(char *ifname, uint8_t *mac_addr, 78 uint8_t session_id, bool is_ipv6_enabled); 79 int dp_ipa_register_interface(char *ifname, bool is_ipv6_enabled); 80 QDF_STATUS dp_ipa_setup_iface(char *ifname, uint8_t *mac_addr, 81 qdf_ipa_client_type_t prod_client, 82 qdf_ipa_client_type_t cons_client, 83 uint8_t session_id, bool is_ipv6_enabled); 84 QDF_STATUS dp_ipa_cleanup_iface(char *ifname, bool is_ipv6_enabled); 85 QDF_STATUS dp_ipa_enable_pipes(struct cdp_pdev *pdev); 86 QDF_STATUS dp_ipa_disable_pipes(struct cdp_pdev *pdev); 87 QDF_STATUS dp_ipa_set_perf_level(int client, 88 uint32_t max_supported_bw_mbps); 89 int dp_ipa_uc_detach(struct dp_soc *soc, struct dp_pdev *pdev); 90 int dp_ipa_uc_attach(struct dp_soc *soc, struct dp_pdev *pdev); 91 int dp_ipa_ring_resource_setup(struct dp_soc *soc, 92 struct dp_pdev *pdev); 93 #else 94 static inline int dp_ipa_uc_detach(struct dp_soc *soc, struct dp_pdev *pdev) 95 { 96 return QDF_STATUS_SUCCESS; 97 } 98 99 static inline int dp_ipa_uc_attach(struct dp_soc *soc, struct dp_pdev *pdev) 100 { 101 return QDF_STATUS_SUCCESS; 102 } 103 104 static inline int dp_ipa_ring_resource_setup(struct dp_soc *soc, 105 struct dp_pdev *pdev) 106 { 107 return 0; 108 } 109 #endif 110 #endif /* _DP_IPA_H_ */ 111