Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
e91b3b6
Documentation
LICENSES
arch
block
certs
crypto
drivers
accessibility
acpi
amba
android
ata
atm
auxdisplay
base
bcma
block
bluetooth
bus
cdrom
char
clk
clocksource
comedi
connector
counter
cpufreq
cpuidle
crypto
cxl
dax
dca
devfreq
dio
dma-buf
dma
edac
eisa
extcon
firewire
firmware
fpga
fsi
gnss
gpio
gpu
greybus
hid
hsi
hte
hv
hwmon
hwspinlock
hwtracing
i2c
i3c
idle
iio
infiniband
input
interconnect
iommu
ipack
irqchip
isdn
leds
macintosh
mailbox
mcb
md
media
memory
memstick
message
mfd
misc
mmc
most
mtd
mux
net
appletalk
arcnet
bonding
caif
can
dsa
ethernet
fddi
fjes
hamradio
hippi
hyperv
ieee802154
ipa
Kconfig
Makefile
gsi.c
gsi.h
gsi_private.h
gsi_reg.h
gsi_trans.c
gsi_trans.h
ipa.h
ipa_cmd.c
ipa_cmd.h
ipa_data-v3.1.c
ipa_data-v3.5.1.c
ipa_data-v4.11.c
ipa_data-v4.2.c
ipa_data-v4.5.c
ipa_data-v4.9.c
ipa_data.h
ipa_endpoint.c
ipa_endpoint.h
ipa_gsi.c
ipa_gsi.h
ipa_interrupt.c
ipa_interrupt.h
ipa_main.c
ipa_mem.c
ipa_mem.h
ipa_modem.c
ipa_modem.h
ipa_power.c
ipa_power.h
ipa_qmi.c
ipa_qmi.h
ipa_qmi_msg.c
ipa_qmi_msg.h
ipa_reg.c
ipa_reg.h
ipa_resource.c
ipa_resource.h
ipa_smp2p.c
ipa_smp2p.h
ipa_sysfs.c
ipa_sysfs.h
ipa_table.c
ipa_table.h
ipa_uc.c
ipa_uc.h
ipa_version.h
ipvlan
mctp
mdio
netdevsim
pcs
phy
plip
ppp
slip
team
usb
vmxnet3
vxlan
wan
wireguard
wireless
wwan
xen-netback
Kconfig
LICENSE.SRC
Makefile
Space.c
amt.c
bareudp.c
dummy.c
eql.c
geneve.c
gtp.c
ifb.c
loopback.c
macsec.c
macvlan.c
macvtap.c
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
sungem_phy.c
tap.c
thunderbolt.c
tun.c
veth.c
virtio_net.c
vrf.c
vsockmon.c
xen-netfront.c
nfc
ntb
nubus
nvdimm
nvme
nvmem
of
opp
parisc
parport
pci
pcmcia
peci
perf
phy
pinctrl
platform
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390
sbus
scsi
sh
siox
slimbus
soc
soundwire
spi
spmi
ssb
staging
target
tc
tee
thermal
thunderbolt
tty
ufs
uio
usb
vdpa
vfio
vhost
video
virt
virtio
vlynq
vme
w1
watchdog
xen
zorro
Kconfig
Makefile
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
drivers
/
net
/
ipa
/
gsi_trans.h
Blame
Blame
Latest commit
History
History
233 lines (203 loc) · 7.38 KB
Breadcrumbs
linux
/
drivers
/
net
/
ipa
/
gsi_trans.h
Top
File metadata and controls
Code
Blame
233 lines (203 loc) · 7.38 KB
Raw
/* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. * Copyright (C) 2019-2020 Linaro Ltd. */ #ifndef _GSI_TRANS_H_ #define _GSI_TRANS_H_ #include <linux/types.h> #include <linux/refcount.h> #include <linux/completion.h> #include <linux/dma-direction.h> #include "ipa_cmd.h" struct page; struct scatterlist; struct device; struct sk_buff; struct gsi; struct gsi_trans; struct gsi_trans_pool; /* Maximum number of TREs in an IPA immediate command transaction */ #define IPA_COMMAND_TRANS_TRE_MAX 8 /** * struct gsi_trans - a GSI transaction * * Most fields in this structure for internal use by the transaction core code: * @links: Links for channel transaction lists by state * @gsi: GSI pointer * @channel_id: Channel number transaction is associated with * @cancelled: If set by the core code, transaction was cancelled * @rsvd_count: Number of TREs reserved for this transaction * @used_count: Number of TREs *used* (could be less than rsvd_count) * @len: Number of bytes sent or received by the transaction * @data: Preserved but not touched by the core transaction code * @cmd_opcode: Array of command opcodes (command channel only) * @sgl: An array of scatter/gather entries managed by core code * @direction: DMA transfer direction (DMA_NONE for commands) * @refcount: Reference count used for destruction * @completion: Completed when the transaction completes * @byte_count: TX channel byte count recorded when transaction committed * @trans_count: Channel transaction count when committed (for BQL accounting) * * The @len field is set when the transaction is committed. For RX * transactions it is updated later to reflect the actual number of bytes * received. */ struct gsi_trans { struct list_head links; /* gsi_channel lists */ struct gsi *gsi; u8 channel_id; bool cancelled; /* true if transaction was cancelled */ u8 rsvd_count; /* # TREs requested */ u8 used_count; /* # entries used in sgl[] */ u32 len; /* total # bytes across sgl[] */ union { void *data; u8 cmd_opcode[IPA_COMMAND_TRANS_TRE_MAX]; }; struct scatterlist *sgl; enum dma_data_direction direction; refcount_t refcount; struct completion completion; u64 byte_count; /* channel byte_count when committed */ u64 trans_count; /* channel trans_count when committed */ }; /** * gsi_trans_pool_init() - Initialize a pool of structures for transactions * @pool: GSI transaction poll pointer * @size: Size of elements in the pool * @count: Minimum number of elements in the pool * @max_alloc: Maximum number of elements allocated at a time from pool * * Return: 0 if successful, or a negative error code */ int gsi_trans_pool_init(struct gsi_trans_pool *pool, size_t size, u32 count, u32 max_alloc); /** * gsi_trans_pool_alloc() - Allocate one or more elements from a pool * @pool: Pool pointer * @count: Number of elements to allocate from the pool * * Return: Virtual address of element(s) allocated from the pool */ void *gsi_trans_pool_alloc(struct gsi_trans_pool *pool, u32 count); /** * gsi_trans_pool_exit() - Inverse of gsi_trans_pool_init() * @pool: Pool pointer */ void gsi_trans_pool_exit(struct gsi_trans_pool *pool); /** * gsi_trans_pool_init_dma() - Initialize a pool of DMA-able structures * @dev: Device used for DMA * @pool: Pool pointer * @size: Size of elements in the pool * @count: Minimum number of elements in the pool * @max_alloc: Maximum number of elements allocated at a time from pool * * Return: 0 if successful, or a negative error code * * Structures in this pool reside in DMA-coherent memory. */ int gsi_trans_pool_init_dma(struct device *dev, struct gsi_trans_pool *pool, size_t size, u32 count, u32 max_alloc); /** * gsi_trans_pool_alloc_dma() - Allocate an element from a DMA pool * @pool: DMA pool pointer * @addr: DMA address "handle" associated with the allocation * * Return: Virtual address of element allocated from the pool * * Only one element at a time may be allocated from a DMA pool. */ void *gsi_trans_pool_alloc_dma(struct gsi_trans_pool *pool, dma_addr_t *addr); /** * gsi_trans_pool_exit_dma() - Inverse of gsi_trans_pool_init_dma() * @dev: Device used for DMA * @pool: Pool pointer */ void gsi_trans_pool_exit_dma(struct device *dev, struct gsi_trans_pool *pool); /** * gsi_channel_trans_idle() - Return whether no transactions are allocated * @gsi: GSI pointer * @channel_id: Channel the transaction is associated with * * Return: True if no transactions are allocated, false otherwise * */ bool gsi_channel_trans_idle(struct gsi *gsi, u32 channel_id); /** * gsi_channel_trans_alloc() - Allocate a GSI transaction on a channel * @gsi: GSI pointer * @channel_id: Channel the transaction is associated with * @tre_count: Number of elements in the transaction * @direction: DMA direction for entire SGL (or DMA_NONE) * * Return: A GSI transaction structure, or a null pointer if all * available transactions are in use */ struct gsi_trans *gsi_channel_trans_alloc(struct gsi *gsi, u32 channel_id, u32 tre_count, enum dma_data_direction direction); /** * gsi_trans_free() - Free a previously-allocated GSI transaction * @trans: Transaction to be freed */ void gsi_trans_free(struct gsi_trans *trans); /** * gsi_trans_cmd_add() - Add an immediate command to a transaction * @trans: Transaction * @buf: Buffer pointer for command payload * @size: Number of bytes in buffer * @addr: DMA address for payload * @opcode: IPA immediate command opcode */ void gsi_trans_cmd_add(struct gsi_trans *trans, void *buf, u32 size, dma_addr_t addr, enum ipa_cmd_opcode opcode); /** * gsi_trans_page_add() - Add a page transfer to a transaction * @trans: Transaction * @page: Page pointer * @size: Number of bytes (starting at offset) to transfer * @offset: Offset within page for start of transfer */ int gsi_trans_page_add(struct gsi_trans *trans, struct page *page, u32 size, u32 offset); /** * gsi_trans_skb_add() - Add a socket transfer to a transaction * @trans: Transaction * @skb: Socket buffer for transfer (outbound) * * Return: 0, or -EMSGSIZE if socket data won't fit in transaction. */ int gsi_trans_skb_add(struct gsi_trans *trans, struct sk_buff *skb); /** * gsi_trans_commit() - Commit a GSI transaction * @trans: Transaction to commit * @ring_db: Whether to tell the hardware about these queued transfers */ void gsi_trans_commit(struct gsi_trans *trans, bool ring_db); /** * gsi_trans_commit_wait() - Commit a GSI transaction and wait for it * to complete * @trans: Transaction to commit */ void gsi_trans_commit_wait(struct gsi_trans *trans); /** * gsi_trans_read_byte() - Issue a single byte read TRE on a channel * @gsi: GSI pointer * @channel_id: Channel on which to read a byte * @addr: DMA address into which to transfer the one byte * * This is not a transaction operation at all. It's defined here because * it needs to be done in coordination with other transaction activity. */ int gsi_trans_read_byte(struct gsi *gsi, u32 channel_id, dma_addr_t addr); /** * gsi_trans_read_byte_done() - Clean up after a single byte read TRE * @gsi: GSI pointer * @channel_id: Channel on which byte was read * * This function needs to be called to signal that the work related * to reading a byte initiated by gsi_trans_read_byte() is complete. */ void gsi_trans_read_byte_done(struct gsi *gsi, u32 channel_id); #endif /* _GSI_TRANS_H_ */
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
You can’t perform that action at this time.