From patchwork Sun Jan 6 16:52:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 1937771 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 27506DF2A2 for ; Sun, 6 Jan 2013 16:53:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756056Ab3AFQxV (ORCPT ); Sun, 6 Jan 2013 11:53:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53630 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756053Ab3AFQxU (ORCPT ); Sun, 6 Jan 2013 11:53:20 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r06GrKZW029127 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 6 Jan 2013 11:53:20 -0500 Received: from pedra (vpn1-6-252.gru2.redhat.com [10.97.6.252]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r06GrJV2009133 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 6 Jan 2013 11:53:20 -0500 Received: from v4l by pedra with local (Exim 4.76) (envelope-from ) id 1TrtSq-0001CO-A5; Sun, 06 Jan 2013 14:52:49 -0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List Subject: [PATCH RFCv6] dvb: Add DVBv5 stats properties for Quality of Service Date: Sun, 6 Jan 2013 14:52:47 -0200 Message-Id: <1357491167-4502-1-git-send-email-mchehab@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The DVBv3 quality parameters are limited on several ways: - Doesn't provide any way to indicate the used measure, so userspace need to guess how to calculate the measure; - Only a limited set of stats are supported; - Can't be called in a way to require them to be filled all at once (atomic reads from the hardware), with may cause troubles on interpreting them on userspace; - On some OFDM delivery systems, the carriers can be independently modulated, having different properties. Currently, there's no way to report per-layer stats. To address the above issues, adding a new DVBv5-based stats API. Signed-off-by: Mauro Carvalho Chehab --- v6: Add DocBook documentation. TODO: - Add methods at the core to periodically collect, store the statistics and reset the counters; - Add a driver implementation. --- Documentation/DocBook/media/dvb/dvbproperty.xml | 105 +++++++++++++++++++++++- include/uapi/linux/dvb/frontend.h | 67 ++++++++++++++- 2 files changed, 169 insertions(+), 3 deletions(-) diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index 957e3ac..5413775 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -7,16 +7,29 @@ the capability ioctls weren't implemented yet via the new way. The typical usage for the FE_GET_PROPERTY/FE_SET_PROPERTY API is to replace the ioctl's were the struct dvb_frontend_parameters were used. +
+DTV stats type + +struct dtv_stats { + __u16 value; + __u8 scale; +} __attribute__ ((packed)); + +
DTV property type /* Reserved fields should be set to 0 */ + struct dtv_property { __u32 cmd; union { __u32 data; struct { - __u8 data[32]; + union { + __u8 data[32]; + __u16 data[16]; + } __u32 len; __u32 reserved1[3]; void *reserved2; @@ -850,6 +863,86 @@ enum fe_interleaving { use the special macro LNA_AUTO to set LNA auto
+ +
+ Frontend Quality of Service/Statistics indicators + Except for DTV_QOS_ENUM, + the values are returned via dtv_property.stat. + For most delivery systems, this will return a single value for each parameter. + It should be noticed, however, that new OFDM delivery systems + like ISDB can use different modulation types for each group of carriers. + On such standards, up to 8 groups of statistics can be provided, one + for each carrier group (called "layer" on ISDB). + In order to be consistent with other delivery systems, the first + value at dtv_property.stat.dtv_stats array refers to + a global indicator, if any. The other elements of the array represent + each layer, starting from layer A(index 1), layer B (index 2) and so on + The number of filled elements are stored at dtv_property.stat.len. + Each element of the dtv_property.stat.dtv_stats array consists on two elements: + + value - Value of the measure + scale - Scale for the value. It can be: +
+ + FE_SCALE_NOT_AVAILABLE - If it is not possible to collect a given parameter (could be a transitory or permanent condition) + FE_SCALE_DECIBEL - parameter is a signed value, measured in 0.1 dB + FE_SCALE_RELATIVE - parameter is a unsigned value, where 0 means 0% and 65535 means 100%. + +
+
+
+
+ <constant>DTV_QOS_ENUM</constant> + A frontend needs to advertise the statistics it provides. This property allows to enumerate all + DTV QoS statistics that are + supported by a given frontend. + + dtv_property.len indicates the number of supported + DTV QoS statistics. + dtv_property.data16 is an 16 bits array of the supported properties. +
+
+ <constant>DTV_QOS_TUNER_SIGNAL</constant> + Indicates the signal strength level at the analog part of the tuner. +
+
+ <constant>DTV_QOS_CNR</constant> + Indicates the signal to noise relation for the main carrier. + +
+
+ <constant>DTV_QOS_BIT_ERROR_COUNT</constant> + Measures the number of bit errors since the last counter reset. + In order to get the bit error rate, it should be divided by + DTV_QOS_BIT_ERROR_COUNT_TIME, if + available. Otherwise, it should be divided by the time lapsed since the previous call for + DTV_QOS_BIT_ERROR_COUNT. +
+
+ <constant>DTV_QOS_BIT_ERROR_COUNT_TIME</constant> + measures the time since the last DTV_QOS_BIT_ERROR_COUNT reset. + It might not be available on certain frontends, even when + DTV_QOS_BIT_ERROR_COUNT + is provided, due to the lack of frontend's documentation when the driver was developed. +
+
+ <constant>DTV_QOS_ERROR_BLOCK_COUNT</constant> + Measures the number of block errors since the last counter reset. + In order to get the bit error rate, it should be divided by + DTV_QOS_ERROR_BLOCK_COUNT_TIME, if + available. Otherwise, it should be divided by the time lapsed since the previous call for + DTV_QOS_ERROR_BLOCK_COUNT. + +
+
+ <constant>DTV_QOS_ERROR_BLOCK_COUNT_TIME</constant> + measures the time since the last DTV_QOS_ERROR_BLOCK_COUNT reset. + It might not be available on certain frontends, even when + DTV_QOS_BIT_ERROR_BLOCK_COUNT + is provided, due to the lack of frontend's documentation when the driver was developed. +
+
+
Properties used on terrestrial delivery systems
@@ -871,6 +964,7 @@ enum fe_interleaving { DTV_HIERARCHY DTV_LNA + In addition, the DTV QoS statistics are also valid.
DVB-T2 delivery system @@ -895,6 +989,7 @@ enum fe_interleaving { DTV_STREAM_ID DTV_LNA + In addition, the DTV QoS statistics are also valid.
ISDB-T delivery system @@ -948,6 +1043,7 @@ enum fe_interleaving { DTV_ISDBT_LAYERC_SEGMENT_COUNT DTV_ISDBT_LAYERC_TIME_INTERLEAVING + In addition, the DTV QoS statistics are also valid.
ATSC delivery system @@ -961,6 +1057,7 @@ enum fe_interleaving { DTV_MODULATION DTV_BANDWIDTH_HZ + In addition, the DTV QoS statistics are also valid.
ATSC-MH delivery system @@ -988,6 +1085,7 @@ enum fe_interleaving { DTV_ATSCMH_SCCC_CODE_MODE_C DTV_ATSCMH_SCCC_CODE_MODE_D + In addition, the DTV QoS statistics are also valid.
DTMB delivery system @@ -1007,6 +1105,7 @@ enum fe_interleaving { DTV_INTERLEAVING DTV_LNA + In addition, the DTV QoS statistics are also valid.
@@ -1028,6 +1127,7 @@ enum fe_interleaving { DTV_INNER_FEC DTV_LNA + In addition, the DTV QoS statistics are also valid.
DVB-C Annex B delivery system @@ -1043,6 +1143,7 @@ enum fe_interleaving { DTV_INVERSION DTV_LNA + In addition, the DTV QoS statistics are also valid.
@@ -1062,6 +1163,7 @@ enum fe_interleaving { DTV_VOLTAGE DTV_TONE + In addition, the DTV QoS statistics are also valid. Future implementations might add those two missing parameters: DTV_DISEQC_MASTER @@ -1077,6 +1179,7 @@ enum fe_interleaving { DTV_ROLLOFF DTV_STREAM_ID + In addition, the DTV QoS statistics are also valid.
Turbo code delivery system diff --git a/include/uapi/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h index c12d452..843dbcd 100644 --- a/include/uapi/linux/dvb/frontend.h +++ b/include/uapi/linux/dvb/frontend.h @@ -365,7 +365,16 @@ struct dvb_frontend_event { #define DTV_INTERLEAVING 60 #define DTV_LNA 61 -#define DTV_MAX_COMMAND DTV_LNA +/* Quality parameters */ +#define DTV_QOS_ENUM 62 +#define DTV_QOS_TUNER_SIGNAL 63 +#define DTV_QOS_CNR 64 +#define DTV_QOS_BIT_ERROR_COUNT 65 +#define DTV_QOS_BIT_ERROR_COUNT_TIME 66 +#define DTV_QOS_ERROR_BLOCK_COUNT 67 +#define DTV_QOS_ERROR_BLOCK_COUNT_TIME 68 + +#define DTV_MAX_COMMAND DTV_ERROR_BLOCK_COUNT_TIME typedef enum fe_pilot { PILOT_ON, @@ -452,13 +461,67 @@ struct dtv_cmds_h { __u32 reserved:30; /* Align */ }; +/** + * Scale types for the quality parameters. + * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That + * could indicate a temporary or a permanent + * condition. + * @FE_SCALE_DECIBEL: The scale is measured in 0.1 dB steps, typically + * used on signal measures. + * @FE_SCALE_RELATIVE: The scale is a relative percentual measure, + * ranging from 0 (0%) to 0xffff (100%). + */ +enum fecap_scale_params { + FE_SCALE_NOT_AVAILABLE, + FE_SCALE_DECIBEL, + FE_SCALE_RELATIVE +}; + +/** + * struct dtv_stats - Used for reading a DTV status property + * + * @value: value of the measure. Should range from 0 to 0xffff; + * @scale: Filled with enum fecap_scale_params - the scale + * in usage for that parameter + * + * For most delivery systems, this will return a single value for each + * parameter. + * It should be noticed, however, that new OFDM delivery systems like + * ISDB can use different modulation types for each group of carriers. + * On such standards, up to 8 groups of statistics can be provided, one + * for each carrier group (called "layer" on ISDB). + * In order to be consistent with other delivery systems, the first + * value refers to the entire set of carriers ("global"). + * dtv_status:scale should use the value FE_SCALE_NOT_AVAILABLE when + * the value for the entire group of carriers or from one specific layer + * is not provided by the hardware. + * In other words, for ISDB, those values should be filled like: + * stat.status[0] = global statistics; + * stat.scale[0] = FE_SCALE_NOT_AVAILABLE (if not available); + * stat.status[1] = layer A statistics; + * stat.status[2] = layer B statistics; + * stat.status[3] = layer C statistics. + * and stat.len should be filled with the latest filled status + 1. + */ +struct dtv_stats { + __u16 value; + __u8 scale; +} __attribute__ ((packed)); + struct dtv_property { __u32 cmd; __u32 reserved[3]; union { __u32 data; struct { - __u8 data[32]; + __u8 len; + struct dtv_stats status[4]; + } stat; + struct { + union { + __u8 data[32]; + __u16 data16[16]; + } __u32 len; __u32 reserved1[3]; void *reserved2;