Lines Matching +full:cpu +full:- +full:offset

1 /* SPDX-License-Identifier: GPL-2.0 */
5 * Copyright (C) 2002, 2003 - Tom Zanussi (zanussi@us.ibm.com), IBM Corp
6 * Copyright (C) 1999, 2000, 2001, 2002 - Karim Yaghmour (karim@opersys.com)
32 * Per-cpu relay channel buffer
37 void *data; /* start of current sub-buffer */
38 size_t offset; /* current offset into sub-buffer */ member
39 size_t subbufs_produced; /* count of sub-buffers produced */
40 size_t subbufs_consumed; /* count of sub-buffers consumed */
49 size_t *padding; /* padding counts per sub-buffer */
53 unsigned int cpu; /* this buf's cpu */ member
62 size_t subbuf_size; /* sub-buffer size */
63 size_t n_subbufs; /* number of sub-buffers per buffer */
67 void *private_data; /* for user-defined data */
69 struct rchan_buf * __percpu *buf; /* per-cpu channel buffers */
83 * subbuf_start - called on buffer-switch to a new sub-buffer
84 * @buf: the channel buffer containing the new sub-buffer
85 * @subbuf: the start of the new sub-buffer
86 * @prev_subbuf: the start of the previous sub-buffer
87 * @prev_padding: unused space at the end of previous sub-buffer
93 * created, so that the first sub-buffer can be initialized
97 * sub-buffer by calling subbuf_start_reserve() in this callback.
105 * buf_mapped - relay buffer mmap notification
115 * buf_unmapped - relay buffer unmap notification
124 * create_buf_file - create file to represent a relay channel buffer
129 * @is_global: outparam - set non-zero if the buffer should be global
131 * Called during relay_open(), once for each per-cpu buffer,
140 * Setting the is_global outparam to a non-zero value will
142 * than the default set of per-cpu buffers.
153 * remove_buf_file - remove file representing a relay channel buffer
156 * Called during relay_close(), once for each per-cpu buffer,
181 unsigned int cpu,
190 * relay_write - write data into the channel
195 * Writes data into the current cpu's channel buffer.
210 buf = *this_cpu_ptr(chan->buf); in relay_write()
211 if (unlikely(buf->offset + length > chan->subbuf_size)) in relay_write()
213 memcpy(buf->data + buf->offset, data, length); in relay_write()
214 buf->offset += length; in relay_write()
219 * __relay_write - write data into the channel
224 * Writes data into the current cpu's channel buffer.
236 buf = *get_cpu_ptr(chan->buf); in __relay_write()
237 if (unlikely(buf->offset + length > buf->chan->subbuf_size)) in __relay_write()
239 memcpy(buf->data + buf->offset, data, length); in __relay_write()
240 buf->offset += length; in __relay_write()
241 put_cpu_ptr(chan->buf); in __relay_write()
245 * relay_reserve - reserve slot in channel buffer
251 * Reserves a slot in the current cpu's channel buffer.
252 * Does not protect the buffer at all - caller must provide
258 struct rchan_buf *buf = *get_cpu_ptr(chan->buf); in relay_reserve()
260 if (unlikely(buf->offset + length > buf->chan->subbuf_size)) { in relay_reserve()
265 reserved = buf->data + buf->offset; in relay_reserve()
266 buf->offset += length; in relay_reserve()
269 put_cpu_ptr(chan->buf); in relay_reserve()
274 * subbuf_start_reserve - reserve bytes at the start of a sub-buffer
279 * a sub-buffer in the subbuf_start() callback.
284 BUG_ON(length >= buf->chan->subbuf_size - 1); in subbuf_start_reserve()
285 buf->offset = length; in subbuf_start_reserve()
294 int relay_prepare_cpu(unsigned int cpu);