![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 0003 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. 0004 * Copyright (C) 2019-2020 Linaro Ltd. 0005 */ 0006 #ifndef _IPA_ENDPOINT_H_ 0007 #define _IPA_ENDPOINT_H_ 0008 0009 #include <linux/types.h> 0010 #include <linux/workqueue.h> 0011 #include <linux/if_ether.h> 0012 0013 #include "gsi.h" 0014 #include "ipa_reg.h" 0015 0016 struct net_device; 0017 struct sk_buff; 0018 0019 struct ipa; 0020 struct ipa_gsi_endpoint_data; 0021 0022 /* Non-zero granularity of counter used to implement aggregation timeout */ 0023 #define IPA_AGGR_GRANULARITY 500 /* microseconds */ 0024 0025 #define IPA_MTU ETH_DATA_LEN 0026 0027 enum ipa_endpoint_name { 0028 IPA_ENDPOINT_AP_COMMAND_TX, 0029 IPA_ENDPOINT_AP_LAN_RX, 0030 IPA_ENDPOINT_AP_MODEM_TX, 0031 IPA_ENDPOINT_AP_MODEM_RX, 0032 IPA_ENDPOINT_MODEM_COMMAND_TX, 0033 IPA_ENDPOINT_MODEM_LAN_TX, 0034 IPA_ENDPOINT_MODEM_LAN_RX, 0035 IPA_ENDPOINT_MODEM_AP_TX, 0036 IPA_ENDPOINT_MODEM_AP_RX, 0037 IPA_ENDPOINT_MODEM_DL_NLO_TX, 0038 IPA_ENDPOINT_COUNT, /* Number of names (not an index) */ 0039 }; 0040 0041 #define IPA_ENDPOINT_MAX 32 /* Max supported by driver */ 0042 0043 /** 0044 * struct ipa_endpoint_tx - Endpoint configuration for TX endpoints 0045 * @seq_type: primary packet processing sequencer type 0046 * @seq_rep_type: sequencer type for replication processing 0047 * @status_endpoint: endpoint to which status elements are sent 0048 * 0049 * The @status_endpoint is only valid if the endpoint's @status_enable 0050 * flag is set. 0051 */ 0052 struct ipa_endpoint_tx { 0053 enum ipa_seq_type seq_type; 0054 enum ipa_seq_rep_type seq_rep_type; 0055 enum ipa_endpoint_name status_endpoint; 0056 }; 0057 0058 /** 0059 * struct ipa_endpoint_rx - Endpoint configuration for RX endpoints 0060 * @buffer_size: requested receive buffer size (bytes) 0061 * @pad_align: power-of-2 boundary to which packet payload is aligned 0062 * @aggr_time_limit: time before aggregation closes (microseconds) 0063 * @aggr_hard_limit: whether aggregation closes before or after boundary 0064 * @aggr_close_eof: whether aggregation closes on end-of-frame 0065 * @holb_drop: whether to drop packets to avoid head-of-line blocking 0066 * 0067 * The actual size of the receive buffer is rounded up if necessary 0068 * to be a power-of-2 number of pages. 0069 * 0070 * With each packet it transfers, the IPA hardware can perform certain 0071 * transformations of its packet data. One of these is adding pad bytes 0072 * to the end of the packet data so the result ends on a power-of-2 boundary. 0073 * 0074 * It is also able to aggregate multiple packets into a single receive buffer. 0075 * Aggregation is "open" while a buffer is being filled, and "closes" when 0076 * certain criteria are met. 0077 * 0078 * A time limit can be specified to close aggregation. Aggregation will be 0079 * closed if this period passes after data is first written into a receive 0080 * buffer. If not specified, no time limit is imposed. 0081 * 0082 * Insufficient space available in the receive buffer can close aggregation. 0083 * The aggregation byte limit defines the point (in units of 1024 bytes) in 0084 * the buffer where aggregation closes. With a "soft" aggregation limit, 0085 * aggregation closes when a packet written to the buffer *crosses* that 0086 * aggregation limit. With a "hard" aggregation limit, aggregation will 0087 * close *before* writing a packet that would cross that boundary. 0088 */ 0089 struct ipa_endpoint_rx { 0090 u32 buffer_size; 0091 u32 pad_align; 0092 u32 aggr_time_limit; 0093 bool aggr_hard_limit; 0094 bool aggr_close_eof; 0095 bool holb_drop; 0096 }; 0097 0098 /** 0099 * struct ipa_endpoint_config - IPA endpoint hardware configuration 0100 * @resource_group: resource group to assign endpoint to 0101 * @checksum: whether checksum offload is enabled 0102 * @qmap: whether endpoint uses QMAP protocol 0103 * @aggregation: whether endpoint supports aggregation 0104 * @status_enable: whether endpoint uses status elements 0105 * @dma_mode: whether endpoint operates in DMA mode 0106 * @dma_endpoint: peer endpoint, if operating in DMA mode 0107 * @tx: TX-specific endpoint information (see above) 0108 * @rx: RX-specific endpoint information (see above) 0109 */ 0110 struct ipa_endpoint_config { 0111 u32 resource_group; 0112 bool checksum; 0113 bool qmap; 0114 bool aggregation; 0115 bool status_enable; 0116 bool dma_mode; 0117 enum ipa_endpoint_name dma_endpoint; 0118 union { 0119 struct ipa_endpoint_tx tx; 0120 struct ipa_endpoint_rx rx; 0121 }; 0122 }; 0123 0124 /** 0125 * enum ipa_replenish_flag: RX buffer replenish flags 0126 * 0127 * @IPA_REPLENISH_ENABLED: Whether receive buffer replenishing is enabled 0128 * @IPA_REPLENISH_ACTIVE: Whether replenishing is underway 0129 * @IPA_REPLENISH_COUNT: Number of defined replenish flags 0130 */ 0131 enum ipa_replenish_flag { 0132 IPA_REPLENISH_ENABLED, 0133 IPA_REPLENISH_ACTIVE, 0134 IPA_REPLENISH_COUNT, /* Number of flags (must be last) */ 0135 }; 0136 0137 /** 0138 * struct ipa_endpoint - IPA endpoint information 0139 * @ipa: IPA pointer 0140 * @ee_id: Execution environmnent endpoint is associated with 0141 * @channel_id: GSI channel used by the endpoint 0142 * @endpoint_id: IPA endpoint number 0143 * @toward_ipa: Endpoint direction (true = TX, false = RX) 0144 * @config: Default endpoint configuration 0145 * @skb_frag_max: Maximum allowed number of TX SKB fragments 0146 * @evt_ring_id: GSI event ring used by the endpoint 0147 * @netdev: Network device pointer, if endpoint uses one 0148 * @replenish_flags: Replenishing state flags 0149 * @replenish_count: Total number of replenish transactions committed 0150 * @replenish_work: Work item used for repeated replenish failures 0151 */ 0152 struct ipa_endpoint { 0153 struct ipa *ipa; 0154 enum gsi_ee_id ee_id; 0155 u32 channel_id; 0156 u32 endpoint_id; 0157 bool toward_ipa; 0158 struct ipa_endpoint_config config; 0159 0160 u32 skb_frag_max; /* Used for netdev TX only */ 0161 u32 evt_ring_id; 0162 0163 /* Net device this endpoint is associated with, if any */ 0164 struct net_device *netdev; 0165 0166 /* Receive buffer replenishing for RX endpoints */ 0167 DECLARE_BITMAP(replenish_flags, IPA_REPLENISH_COUNT); 0168 u64 replenish_count; 0169 struct delayed_work replenish_work; /* global wq */ 0170 }; 0171 0172 void ipa_endpoint_modem_hol_block_clear_all(struct ipa *ipa); 0173 0174 void ipa_endpoint_modem_pause_all(struct ipa *ipa, bool enable); 0175 0176 int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa); 0177 0178 int ipa_endpoint_skb_tx(struct ipa_endpoint *endpoint, struct sk_buff *skb); 0179 0180 int ipa_endpoint_enable_one(struct ipa_endpoint *endpoint); 0181 void ipa_endpoint_disable_one(struct ipa_endpoint *endpoint); 0182 0183 void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint); 0184 void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint); 0185 0186 void ipa_endpoint_suspend(struct ipa *ipa); 0187 void ipa_endpoint_resume(struct ipa *ipa); 0188 0189 void ipa_endpoint_setup(struct ipa *ipa); 0190 void ipa_endpoint_teardown(struct ipa *ipa); 0191 0192 int ipa_endpoint_config(struct ipa *ipa); 0193 void ipa_endpoint_deconfig(struct ipa *ipa); 0194 0195 void ipa_endpoint_default_route_set(struct ipa *ipa, u32 endpoint_id); 0196 void ipa_endpoint_default_route_clear(struct ipa *ipa); 0197 0198 u32 ipa_endpoint_init(struct ipa *ipa, u32 count, 0199 const struct ipa_gsi_endpoint_data *data); 0200 void ipa_endpoint_exit(struct ipa *ipa); 0201 0202 void ipa_endpoint_trans_complete(struct ipa_endpoint *ipa, 0203 struct gsi_trans *trans); 0204 void ipa_endpoint_trans_release(struct ipa_endpoint *ipa, 0205 struct gsi_trans *trans); 0206 0207 #endif /* _IPA_ENDPOINT_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |