From patchwork Mon Dec 11 16:37:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10105509 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 692CE602B3 for ; Mon, 11 Dec 2017 16:37:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59B1B29597 for ; Mon, 11 Dec 2017 16:37:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BC48297B7; Mon, 11 Dec 2017 16:37:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 074A829597 for ; Mon, 11 Dec 2017 16:37:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752963AbdLKQhn (ORCPT ); Mon, 11 Dec 2017 11:37:43 -0500 Received: from osg.samsung.com ([64.30.133.232]:47233 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752628AbdLKQhf (ORCPT ); Mon, 11 Dec 2017 11:37:35 -0500 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id AEE401AAD2; Mon, 11 Dec 2017 08:37:34 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at dev.s-opensource.com X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from osg.samsung.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OKQhVBMPMdXj; Mon, 11 Dec 2017 08:37:33 -0800 (PST) Received: from smtp.s-opensource.com (177.205.74.193.dynamic.adsl.gvt.net.br [177.205.74.193]) by osg.samsung.com (Postfix) with ESMTPSA id 468A11AAAE; Mon, 11 Dec 2017 08:37:32 -0800 (PST) Received: from mchehab by smtp.s-opensource.com with local (Exim 4.89) (envelope-from ) id 1eOR57-0009G9-KX; Mon, 11 Dec 2017 11:37:29 -0500 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab , Ron Economos , "David S. Miller" , Johannes Berg , Sakari Ailus , Arnd Bergmann Subject: [PATCH 3/3] media: dvb-core: allow users to enable DVB net ULE debug Date: Mon, 11 Dec 2017 11:37:26 -0500 Message-Id: <8359d14bcceb7516aeabfcaa518c134078132751.1513010227.git.mchehab@s-opensource.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <3749c9084b647a3ca80e78a9f5a3bd83ecb1e4cb.1513010227.git.mchehab@s-opensource.com> References: <3749c9084b647a3ca80e78a9f5a3bd83ecb1e4cb.1513010227.git.mchehab@s-opensource.com> In-Reply-To: <3749c9084b647a3ca80e78a9f5a3bd83ecb1e4cb.1513010227.git.mchehab@s-opensource.com> References: <3749c9084b647a3ca80e78a9f5a3bd83ecb1e4cb.1513010227.git.mchehab@s-opensource.com> 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 X-Virus-Scanned: ClamAV using ClamSMTP This debug option is there for a long time, but it is only enabled by editing the source code. Due to that, a breakage inside its code was only noticed years after a change at the ULE handling logic. Make it a Kconfig parameter, as it makes easier for advanced users to enable, and allow test if the compilation won't be broken in the future. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-core/Kconfig | 13 +++++++++++++ drivers/media/dvb-core/dvb_net.c | 14 +++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/media/dvb-core/Kconfig b/drivers/media/dvb-core/Kconfig index eeef94a0c84e..f004aea352e0 100644 --- a/drivers/media/dvb-core/Kconfig +++ b/drivers/media/dvb-core/Kconfig @@ -40,3 +40,16 @@ config DVB_DEMUX_SECTION_LOSS_LOG be very verbose. If you are unsure about this, say N here. + +config DVB_ULE_DEBUG + bool "Enable DVB net ULE packet debug messages" + depends on DVB_CORE + default n + help + Enable extra log messages meant to detect problems while + handling DVB network ULE packet loss inside the Kernel. + + Should not be enabled on normal cases, as logs can + be very verbose. + + If you are unsure about this, say N here. diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c index bf0bea5c21c1..d8adc968cbf2 100644 --- a/drivers/media/dvb-core/dvb_net.c +++ b/drivers/media/dvb-core/dvb_net.c @@ -38,7 +38,7 @@ * Competence Center for Advanced Satellite Communications. * Bugfixes and robustness improvements. * Filtering on dest MAC addresses, if present (D-Bit = 0) - * ULE_DEBUG compile-time option. + * DVB_ULE_DEBUG compile-time option. * Apr 2006: cp v3: Bugfixes and compliency with RFC 4326 (ULE) by * Christian Praehauser , * Paris Lodron University of Salzburg. @@ -78,12 +78,9 @@ static inline __u32 iov_crc32( __u32 c, struct kvec *iov, unsigned int cnt ) #define DVB_NET_MULTICAST_MAX 10 -#undef ULE_DEBUG - -#ifdef ULE_DEBUG - +#ifdef DVB_ULE_DEBUG /* - * The code inside ULE_DEBUG keeps a history of the + * The code inside DVB_ULE_DEBUG keeps a history of the * last 100 TS cells processed. */ static unsigned char ule_hist[100*TS_SZ] = { 0 }; @@ -93,7 +90,6 @@ static void hexdump(const unsigned char *buf, unsigned short len) { print_hex_dump_debug("", DUMP_PREFIX_OFFSET, 16, 1, buf, len, true); } - #endif struct dvb_net_priv { @@ -331,7 +327,7 @@ static int dvb_net_ule_new_ts_cell(struct dvb_net_ule_handle *h) { /* We are about to process a new TS cell. */ -#ifdef ULE_DEBUG +#ifdef DVB_ULE_DEBUG if (ule_where >= &ule_hist[100*TS_SZ]) ule_where = ule_hist; memcpy(ule_where, h->ts, TS_SZ); @@ -669,7 +665,7 @@ static void dvb_net_ule_check_crc(struct dvb_net_ule_handle *h, struct kvec iov[ h->ts_remain > 2 ? *(unsigned short *)h->from_where : 0); - #ifdef ULE_DEBUG + #ifdef DVB_ULE_DEBUG hexdump(iov[0].iov_base, iov[0].iov_len); hexdump(iov[1].iov_base, iov[1].iov_len); hexdump(iov[2].iov_base, iov[2].iov_len);