aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorAkihiro Tsukada <tskd2@yahoo.co.jp>2012-03-10 09:38:14 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-03-19 14:47:15 -0400
commit6988111098d643653eca04ebc6dabe9a7f354baa (patch)
tree76885df0cb871753413c899005acde4172122b8b /drivers/media/dvb
parent847e87659620890bfc80ce7bf682f2a5354543b2 (diff)
[media] dvb: earth-pt1: add an error check/report on the incoming data
This patch adds a data integrity check using the sequence counter and error flags added by the bridge chip. Signed-off-by: Akihiro Tsukada <tskd2@yahoo.co.jp> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/pt1/pt1.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/media/dvb/pt1/pt1.c b/drivers/media/dvb/pt1/pt1.c
index 463f7849c44..8229a9150c5 100644
--- a/drivers/media/dvb/pt1/pt1.c
+++ b/drivers/media/dvb/pt1/pt1.c
@@ -28,6 +28,7 @@
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <linux/kthread.h> 29#include <linux/kthread.h>
30#include <linux/freezer.h> 30#include <linux/freezer.h>
31#include <linux/ratelimit.h>
31 32
32#include "dvbdev.h" 33#include "dvbdev.h"
33#include "dvb_demux.h" 34#include "dvb_demux.h"
@@ -92,6 +93,7 @@ struct pt1_adapter {
92 u8 *buf; 93 u8 *buf;
93 int upacket_count; 94 int upacket_count;
94 int packet_count; 95 int packet_count;
96 int st_count;
95 97
96 struct dvb_adapter adap; 98 struct dvb_adapter adap;
97 struct dvb_demux demux; 99 struct dvb_demux demux;
@@ -266,6 +268,7 @@ static int pt1_filter(struct pt1 *pt1, struct pt1_buffer_page *page)
266 struct pt1_adapter *adap; 268 struct pt1_adapter *adap;
267 int offset; 269 int offset;
268 u8 *buf; 270 u8 *buf;
271 int sc;
269 272
270 if (!page->upackets[PT1_NR_UPACKETS - 1]) 273 if (!page->upackets[PT1_NR_UPACKETS - 1])
271 return 0; 274 return 0;
@@ -282,6 +285,16 @@ static int pt1_filter(struct pt1 *pt1, struct pt1_buffer_page *page)
282 else if (!adap->upacket_count) 285 else if (!adap->upacket_count)
283 continue; 286 continue;
284 287
288 if (upacket >> 24 & 1)
289 printk_ratelimited(KERN_INFO "earth-pt1: device "
290 "buffer overflowing. table[%d] buf[%d]\n",
291 pt1->table_index, pt1->buf_index);
292 sc = upacket >> 26 & 0x7;
293 if (adap->st_count != -1 && sc != ((adap->st_count + 1) & 0x7))
294 printk_ratelimited(KERN_INFO "earth-pt1: data loss"
295 " in streamID(adapter)[%d]\n", index);
296 adap->st_count = sc;
297
285 buf = adap->buf; 298 buf = adap->buf;
286 offset = adap->packet_count * 188 + adap->upacket_count * 3; 299 offset = adap->packet_count * 188 + adap->upacket_count * 3;
287 buf[offset] = upacket >> 16; 300 buf[offset] = upacket >> 16;
@@ -652,6 +665,7 @@ pt1_alloc_adapter(struct pt1 *pt1)
652 adap->buf = buf; 665 adap->buf = buf;
653 adap->upacket_count = 0; 666 adap->upacket_count = 0;
654 adap->packet_count = 0; 667 adap->packet_count = 0;
668 adap->st_count = -1;
655 669
656 dvb_adap = &adap->adap; 670 dvb_adap = &adap->adap;
657 dvb_adap->priv = adap; 671 dvb_adap->priv = adap;