Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: dvb: add continuity error indicators for memory mapped buffers

While userspace can detect discontinuity errors, it is useful to
also let Kernelspace reporting discontinuity, as it can help to
identify if the data loss happened either at Kernel or userspace side.

Update documentation accordingly.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

+49 -7
+10 -4
Documentation/media/dmx.h.rst.exceptions
··· 50 50 replace typedef dmx_pes_type_t :c:type:`dmx_pes_type` 51 51 replace typedef dmx_input_t :c:type:`dmx_input` 52 52 53 - ignore symbol DMX_OUT_DECODER 54 - ignore symbol DMX_OUT_TAP 55 - ignore symbol DMX_OUT_TS_TAP 56 - ignore symbol DMX_OUT_TSDEMUX_TAP 53 + replace symbol DMX_BUFFER_FLAG_HAD_CRC32_DISCARD :c:type:`dmx_buffer_flags` 54 + replace symbol DMX_BUFFER_FLAG_TEI :c:type:`dmx_buffer_flags` 55 + replace symbol DMX_BUFFER_PKT_COUNTER_MISMATCH :c:type:`dmx_buffer_flags` 56 + replace symbol DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED :c:type:`dmx_buffer_flags` 57 + replace symbol DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR :c:type:`dmx_buffer_flags` 58 + 59 + replace symbol DMX_OUT_DECODER :c:type:`dmx_output` 60 + replace symbol DMX_OUT_TAP :c:type:`dmx_output` 61 + replace symbol DMX_OUT_TS_TAP :c:type:`dmx_output` 62 + replace symbol DMX_OUT_TSDEMUX_TAP :c:type:`dmx_output` 57 63 58 64 replace ioctl DMX_DQBUF dmx_qbuf
+4 -3
Documentation/media/uapi/dvb/dmx-qbuf.rst
··· 51 51 the device is closed. 52 52 53 53 Applications call the ``DMX_DQBUF`` ioctl to dequeue a filled 54 - (capturing) buffer from the driver's outgoing queue. They just set the ``reserved`` field array to zero. When ``DMX_DQBUF`` is called with a 55 - pointer to this structure, the driver fills the remaining fields or 56 - returns an error code. 54 + (capturing) buffer from the driver's outgoing queue. 55 + They just set the ``index`` field withe the buffer ID to be queued. 56 + When ``DMX_DQBUF`` is called with a pointer to struct :c:type:`dmx_buffer`, 57 + the driver fills the remaining fields or returns an error code. 57 58 58 59 By default ``DMX_DQBUF`` blocks when no buffer is in the outgoing 59 60 queue. When the ``O_NONBLOCK`` flag was given to the
+35
include/uapi/linux/dvb/dmx.h
··· 212 212 }; 213 213 214 214 /** 215 + * enum dmx_buffer_flags - DMX memory-mapped buffer flags 216 + * 217 + * @DMX_BUFFER_FLAG_HAD_CRC32_DISCARD: 218 + * Indicates that the Kernel discarded one or more frames due to wrong 219 + * CRC32 checksum. 220 + * @DMX_BUFFER_FLAG_TEI: 221 + * Indicates that the Kernel has detected a Transport Error indicator 222 + * (TEI) on a filtered pid. 223 + * @DMX_BUFFER_PKT_COUNTER_MISMATCH: 224 + * Indicates that the Kernel has detected a packet counter mismatch 225 + * on a filtered pid. 226 + * @DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED: 227 + * Indicates that the Kernel has detected one or more frame discontinuity. 228 + * @DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR: 229 + * Received at least one packet with a frame discontinuity indicator. 230 + */ 231 + 232 + enum dmx_buffer_flags { 233 + DMX_BUFFER_FLAG_HAD_CRC32_DISCARD = 1 << 0, 234 + DMX_BUFFER_FLAG_TEI = 1 << 1, 235 + DMX_BUFFER_PKT_COUNTER_MISMATCH = 1 << 2, 236 + DMX_BUFFER_FLAG_DISCONTINUITY_DETECTED = 1 << 3, 237 + DMX_BUFFER_FLAG_DISCONTINUITY_INDICATOR = 1 << 4, 238 + }; 239 + 240 + /** 215 241 * struct dmx_buffer - dmx buffer info 216 242 * 217 243 * @index: id number of the buffer ··· 246 220 * offset from the start of the device memory for this plane, 247 221 * (or a "cookie" that should be passed to mmap() as offset) 248 222 * @length: size in bytes of the buffer 223 + * @flags: bit array of buffer flags as defined by &enum dmx_buffer_flags. 224 + * Filled only at &DMX_DQBUF. 225 + * @count: monotonic counter for filled buffers. Helps to identify 226 + * data stream loses. Filled only at &DMX_DQBUF. 249 227 * 250 228 * Contains data exchanged by application and driver using one of the streaming 251 229 * I/O methods. 230 + * 231 + * Please notice that, for &DMX_QBUF, only @index should be filled. 232 + * On &DMX_DQBUF calls, all fields will be filled by the Kernel. 252 233 */ 253 234 struct dmx_buffer { 254 235 __u32 index; 255 236 __u32 bytesused; 256 237 __u32 offset; 257 238 __u32 length; 239 + __u32 flags; 240 + __u32 count; 258 241 }; 259 242 260 243 /**