diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2016-07-17 17:40:05 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-07-19 19:25:32 +0300 |
commit | 11065f8531ed33d5e847a36ad64231ee599d4996 (patch) | |
tree | b02f216395f726c0018ed0f8ffda3b5f746f2e16 /include/media | |
parent | 045344c3c1478f8d03a1a589d645fe10c3a23f77 (diff) | |
download | linux-11065f8531ed33d5e847a36ad64231ee599d4996.tar.xz |
[media] cec: limit the size of the transmit queue
The size of the transmit queue was unlimited, which meant that
in non-blocking mode you could flood the CEC adapter with messages
to be transmitted.
Limit this to 18 messages.
Also print the number of pending transmits and the timeout value
in the status debugfs file.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/cec.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/include/media/cec.h b/include/media/cec.h index 9a791c08a789..dc7854b855f3 100644 --- a/include/media/cec.h +++ b/include/media/cec.h @@ -126,12 +126,20 @@ struct cec_adap_ops { * With a transfer rate of at most 36 bytes per second this makes 18 messages * per second worst case. * - * We queue at most 3 seconds worth of messages. The CEC specification requires - * that messages are replied to within a second, so 3 seconds should give more - * than enough margin. Since most messages are actually more than 2 bytes, this - * is in practice a lot more than 3 seconds. + * We queue at most 3 seconds worth of received messages. The CEC specification + * requires that messages are replied to within a second, so 3 seconds should + * give more than enough margin. Since most messages are actually more than 2 + * bytes, this is in practice a lot more than 3 seconds. */ -#define CEC_MAX_MSG_QUEUE_SZ (18 * 3) +#define CEC_MAX_MSG_RX_QUEUE_SZ (18 * 3) + +/* + * The transmit queue is limited to 1 second worth of messages (worst case). + * Messages can be transmitted by userspace and kernel space. But for both it + * makes no sense to have a lot of messages queued up. One second seems + * reasonable. + */ +#define CEC_MAX_MSG_TX_QUEUE_SZ (18 * 1) struct cec_adapter { struct module *owner; @@ -141,6 +149,7 @@ struct cec_adapter { struct rc_dev *rc; struct list_head transmit_queue; + unsigned int transmit_queue_sz; struct list_head wait_queue; struct cec_data *transmitting; |