From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: unlisted-recipients:; (no To-header on input)@casper.infradead.org
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>,
Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: [PATCH RFCv9 2/4] dvb: the core logic to handle the DVBv5 QoS properties
Date: Mon, 7 Jan 2013 22:25:48 -0200 [thread overview]
Message-ID: <1357604750-772-3-git-send-email-mchehab@redhat.com> (raw)
In-Reply-To: <1357604750-772-1-git-send-email-mchehab@redhat.com>
Add the logic to poll, reset counters and report the QoS stats
to the end user.
The idea is that the core will periodically poll the frontend for
the stats. The frontend may return -EBUSY, if the previous collect
didn't finish, or it may fill the cached data.
The value returned to the end user is always the cached data.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
drivers/media/dvb-core/dvb_frontend.c | 56 +++++++++++++++++++++++++++++++++++
drivers/media/dvb-core/dvb_frontend.h | 12 ++++++++
2 files changed, 68 insertions(+)
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
index dd35fa9..66e066b 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -260,6 +260,9 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe,
return ret;
}
+ if (fe->ops.get_qos_stats)
+ fe->ops.get_qos_stats(fe);
+
mutex_lock(&events->mtx);
*event = events->events[events->eventr];
events->eventr = (events->eventr + 1) % MAX_EVENT;
@@ -1053,6 +1056,15 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
_DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_B, 0, 0),
_DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_C, 0, 0),
_DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_D, 0, 0),
+
+ /* Statistics API */
+ _DTV_CMD(DTV_QOS_ENUM, 0, 0),
+ _DTV_CMD(DTV_QOS_SIGNAL_STRENGTH, 0, 0),
+ _DTV_CMD(DTV_QOS_CNR, 0, 0),
+ _DTV_CMD(DTV_QOS_BIT_ERROR_COUNT, 0, 0),
+ _DTV_CMD(DTV_QOS_TOTAL_BITS_COUNT, 0, 0),
+ _DTV_CMD(DTV_QOS_ERROR_BLOCK_COUNT, 0, 0),
+ _DTV_CMD(DTV_QOS_TOTAL_BLOCKS_COUNT, 0, 0),
};
static void dtv_property_dump(struct dvb_frontend *fe, struct dtv_property *tvp)
@@ -1443,6 +1455,25 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
tvp->u.data = c->lna;
break;
+ /* Fill quality measures */
+ case DTV_QOS_SIGNAL_STRENGTH:
+ tvp->u.st = c->strength;
+ break;
+ case DTV_QOS_CNR:
+ tvp->u.st = c->cnr;
+ break;
+ case DTV_QOS_BIT_ERROR_COUNT:
+ tvp->u.st = c->bit_error;
+ break;
+ case DTV_QOS_TOTAL_BITS_COUNT:
+ tvp->u.st = c->bit_count;
+ break;
+ case DTV_QOS_ERROR_BLOCK_COUNT:
+ tvp->u.st = c->block_error;
+ break;
+ case DTV_QOS_TOTAL_BLOCKS_COUNT:
+ tvp->u.st = c->block_count;
+ break;
default:
return -EINVAL;
}
@@ -1646,6 +1677,26 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
return 0;
}
+static int reset_qos_counters(struct dvb_frontend *fe)
+{
+ struct dtv_frontend_properties *c = &fe->dtv_property_cache;
+
+ /* Reset QoS cache */
+
+ memset (&c->strength, 0, sizeof(c->strength));
+ memset (&c->cnr, 0, sizeof(c->cnr));
+ memset (&c->bit_error, 0, sizeof(c->bit_error));
+ memset (&c->bit_count, 0, sizeof(c->bit_count));
+ memset (&c->block_error, 0, sizeof(c->block_error));
+ memset (&c->block_count, 0, sizeof(c->block_count));
+
+ /* Call frontend reset counter method, if available */
+ if (fe->ops.reset_qos_counters)
+ return fe->ops.reset_qos_counters(fe);
+
+ return 0;
+}
+
static int dtv_property_process_set(struct dvb_frontend *fe,
struct dtv_property *tvp,
struct file *file)
@@ -1705,6 +1756,8 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
break;
case DTV_DELIVERY_SYSTEM:
r = set_delivery_system(fe, tvp->u.data);
+ if (r >= 0)
+ reset_qos_counters(fe);
break;
case DTV_VOLTAGE:
c->voltage = tvp->u.data;
@@ -2305,6 +2358,9 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
if (err)
break;
err = dtv_set_frontend(fe);
+ if (err >= 0)
+ reset_qos_counters(fe);
+
break;
case FE_GET_EVENT:
err = dvb_frontend_get_event (fe, parg, file->f_flags);
diff --git a/drivers/media/dvb-core/dvb_frontend.h b/drivers/media/dvb-core/dvb_frontend.h
index 97112cd..7bb49f1 100644
--- a/drivers/media/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb-core/dvb_frontend.h
@@ -315,6 +315,10 @@ struct dvb_frontend_ops {
int (*set_property)(struct dvb_frontend* fe, struct dtv_property* tvp);
int (*get_property)(struct dvb_frontend* fe, struct dtv_property* tvp);
+
+ /* QoS statistics callbacks */
+ int (*get_qos_stats)(struct dvb_frontend *fe);
+ int (*reset_qos_counters)(struct dvb_frontend *fe);
};
#ifdef __DVB_CORE__
@@ -393,6 +397,14 @@ struct dtv_frontend_properties {
u8 atscmh_sccc_code_mode_d;
u32 lna;
+
+ /* QoS statistics data */
+ struct dtv_fe_stats strength;
+ struct dtv_fe_stats cnr;
+ struct dtv_fe_stats bit_error;
+ struct dtv_fe_stats bit_count;
+ struct dtv_fe_stats block_error;
+ struct dtv_fe_stats block_count;
};
struct dvb_frontend {
--
1.7.11.7
next prev parent reply other threads:[~2013-01-08 0:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-08 0:25 [PATCH RFCv9 0/4] DVB QoS statistics API Mauro Carvalho Chehab
2013-01-08 0:25 ` [PATCH RFCv9 1/4] dvb: Add DVBv5 stats properties for Quality of Service Mauro Carvalho Chehab
2013-01-08 11:45 ` Simon Farnsworth
2013-01-08 18:00 ` Frank Schäfer
2013-01-08 23:18 ` Simon Farnsworth
2013-01-08 23:28 ` Devin Heitmueller
2013-01-09 11:02 ` Simon Farnsworth
2013-01-09 15:24 ` Mauro Carvalho Chehab
2013-01-10 10:19 ` Simon Farnsworth
2013-01-13 13:30 ` [linux-media] " Klaus Schmidinger
2013-01-08 12:33 ` Mauro Carvalho Chehab
2013-01-08 0:25 ` Mauro Carvalho Chehab [this message]
2013-01-08 0:25 ` [PATCH RFCv9 3/4] mb86a20s: provide signal strength via DVBv5 stats API Mauro Carvalho Chehab
2013-01-08 0:25 ` [PATCH RFCv9 4/4] mb86a20s: add BER measure Mauro Carvalho Chehab
2013-01-08 0:37 ` [PATCH RFCv9] " Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357604750-772-3-git-send-email-mchehab@redhat.com \
--to=mchehab@redhat.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).