From patchwork Mon Sep 11 04:28:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13378764 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E1A4EE801F for ; Mon, 11 Sep 2023 04:30:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233572AbjIKEad (ORCPT ); Mon, 11 Sep 2023 00:30:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233550AbjIKEac (ORCPT ); Mon, 11 Sep 2023 00:30:32 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53D0110D for ; Sun, 10 Sep 2023 21:30:25 -0700 (PDT) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38B49cud028465; Mon, 11 Sep 2023 04:29:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=/y92d+RCnxKfc5pwj36KazoiOHCerE5IcaCSyr3vVJc=; b=Q3hl/M2hyCv7AKjVUb46oxOcozIBGgOkBcjsudj+aE7sy433QcyFysnMIl84TIjJbJVz 3uTOpQZno+rJC+EnM2MnkPBwHN+e46QyANP1emP0aGpEc8mqYFlIThE0LWoawhadDiqE F++FHgKvpNPRAooMqW6s054lxfnsrmfGRZva97VFLfYAzNBTYbf7+9LhhWvHmuQbGoXp Z+fnW1FxlGM3Y6DZ8dTRl58Nd3u1pTeBGeDor3eCoaJj11h0HoQSOeoFsuY7GfUEGIn4 7Dv5cdlHr8X3/IPOIPpl368pLNXjUZn0pzZCKw1p1UyldAJSCmJIAaw+TqNdGjYBazKa iA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t0edmjw5a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:29:40 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38B4T9P6015489 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:29:09 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Sun, 10 Sep 2023 21:29:02 -0700 From: Linyu Yuan To: Thinh Nguyen , Peter Chen , Pawel Laszczak , Roger Quadros , Linus Walleij , Chunfeng Yun , Neal Liu , "Cristian Birsan" , Bin Liu , "Kevin Cernekee" , Justin Chen , "Al Cooper" , Li Yang , "Vladimir Zapolskiy" , Daniel Mack , Haojian Zhuang , Robert Jarzmik , "Philipp Zabel" , Herve Codina , hierry Reding , Jonathan Hunter , Michal Simek , Rui Miguel Silva , Valentina Manea , "Shuah Khan" , Hongren Zheng , Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH 01/11] usb: gadget: add anonymous definition in struct usb_gadget Date: Mon, 11 Sep 2023 12:28:33 +0800 Message-ID: <20230911042843.2711-2-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230911042843.2711-1-quic_linyyuan@quicinc.com> References: <20230911042843.2711-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: c6HQiKlgbLYPyWJMrVBYphOYS1AABoLV X-Proofpoint-GUID: c6HQiKlgbLYPyWJMrVBYphOYS1AABoLV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_01,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 priorityscore=1501 mlxlogscore=762 malwarescore=0 spamscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110041 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Some UDC trace event will save usb gadget information, but it will use one int size buffer to save one bit information of usb gadget, so more than one int buffer to save several bit fields which is not good. Add one anonymous union have three u32 members which can be used by trace event during fast assign stage to reduce trace buffer usage, and add related macro to extract bit fields from u32 members for later trace event output state usage. Also move sg_supported and other bit fields into one anonymous struct which inside anonymous union and Change bit fields from unsigned to u32 type, it will make sure union member have expected u32 size. Signed-off-by: Linyu Yuan --- include/linux/usb/gadget.h | 63 ++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 75bda0783395..cdf62e7f34e7 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -357,6 +357,7 @@ struct usb_gadget_ops { * @in_epnum: last used in ep number * @mA: last set mA value * @otg_caps: OTG capabilities of this gadget. + * @dw1: trace event purpose * @sg_supported: true if we can handle scatter-gather * @is_otg: True if the USB device port uses a Mini-AB jack, so that the * gadget driver must provide a USB OTG descriptor. @@ -432,25 +433,49 @@ struct usb_gadget { unsigned mA; struct usb_otg_caps *otg_caps; - unsigned sg_supported:1; - unsigned is_otg:1; - unsigned is_a_peripheral:1; - unsigned b_hnp_enable:1; - unsigned a_hnp_support:1; - unsigned a_alt_hnp_support:1; - unsigned hnp_polling_support:1; - unsigned host_request_flag:1; - unsigned quirk_ep_out_aligned_size:1; - unsigned quirk_altset_not_supp:1; - unsigned quirk_stall_not_supp:1; - unsigned quirk_zlp_not_supp:1; - unsigned quirk_avoids_skb_reserve:1; - unsigned is_selfpowered:1; - unsigned deactivated:1; - unsigned connected:1; - unsigned lpm_capable:1; - unsigned wakeup_capable:1; - unsigned wakeup_armed:1; + union { + struct { + u32 sg_supported:1; + u32 is_otg:1; + u32 is_a_peripheral:1; + u32 b_hnp_enable:1; + u32 a_hnp_support:1; + u32 a_alt_hnp_support:1; + u32 hnp_polling_support:1; + u32 host_request_flag:1; + u32 quirk_ep_out_aligned_size:1; + u32 quirk_altset_not_supp:1; + u32 quirk_stall_not_supp:1; + u32 quirk_zlp_not_supp:1; + u32 quirk_avoids_skb_reserve:1; + u32 is_selfpowered:1; + u32 deactivated:1; + u32 connected:1; + u32 lpm_capable:1; + u32 wakeup_capable:1; + u32 wakeup_armed:1; + } __packed; + u32 dw1; +#define USB_GADGET_SG_SUPPORTED(n) ((n) & BIT(0)) +#define USB_GADGET_IS_OTG(n) ((n) & BIT(1)) +#define USB_GADGET_IS_A_PERIPHERAL(n) ((n) & BIT(2)) +#define USB_GADGET_B_HNP_ENABLE(n) ((n) & BIT(3)) +#define USB_GADGET_A_HNP_SUPPORT(n) ((n) & BIT(4)) +#define USB_GADGET_A_ALT_HNP_SUPPORT(n) ((n) & BIT(5)) +#define USB_GADGET_HNP_POLLING_SUPPORT(n) ((n) & BIT(6)) +#define USB_GADGET_HOST_REQUEST_FLAG(n) ((n) & BIT(7)) +#define USB_GADGET_QUIRK_EP_OUT_ALIGNED_SIZE(n) ((n) & BIT(8)) +#define USB_GADGET_QUIRK_ALTSET_NOT_SUPP(n) ((n) & BIT(9)) +#define USB_GADGET_QUIRK_STALL_NOT_SUPP(n) ((n) & BIT(10)) +#define USB_GADGET_QUIRK_ZLP_NOT_SUPP(n) ((n) & BIT(11)) +#define USB_GADGET_QUIRK_AVOIDS_SKB_RESERVE(n) ((n) & BIT(12)) +#define USB_GADGET_IS_SELFPOWERED(n) ((n) & BIT(13)) +#define USB_GADGET_DEACTIVATED(n) ((n) & BIT(14)) +#define USB_GADGET_CONNECTED(n) ((n) & BIT(15)) +#define USB_GADGET_LPM_CAPABLE(n) ((n) & BIT(16)) +#define USB_GADGET_WAKEUP_CAPABLE(n) ((n) & BIT(17)) +#define USB_GADGET_WAKEUP_ARMED(n) ((n) & BIT(18)) + }; int irq; int id_number; }; From patchwork Mon Sep 11 04:28:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13378758 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9ED1AEE7FF4 for ; Mon, 11 Sep 2023 04:30:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233450AbjIKEaH (ORCPT ); Mon, 11 Sep 2023 00:30:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232022AbjIKEaE (ORCPT ); Mon, 11 Sep 2023 00:30:04 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 944FF19C for ; Sun, 10 Sep 2023 21:29:59 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38B4BDl0027988; Mon, 11 Sep 2023 04:29:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=wrRchE3PqfEAvXWcyNncQzXjPTD1W0RhzF2VGVrekFE=; b=N1Ma07RGwwz82DxTp43sAJA0m2F5Gdp3Diapps6GYMkuhsE1+THMLhGdjnHNox+ihsLf t0umXB8bJPxHj7EFC35pNVjlO219dVazribwe1LA3EyoqTQhPnmfo81stsuFlMbdYGmr WmRZAOtgLRL1eKcqUGyY7G76VYXir4N8sEIQ0WP/8bXDTgnnuycqiGIP2tRj2nOxq5Mw SGAmqr9+GP1KuTJc4LodwH9sSSi++XTHPl1XP6j8eSPsuX/+FupcAuoq7tqSN1XhABOv zPJ7KVBuAQTRfyWHa3ItpOcJv5sc+J29gE+yTdFjs9/ruPkE8tYbKNx97AIteq+fQsV1 UA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t0g1rjh8a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:29:18 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38B4TGae031546 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:29:16 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Sun, 10 Sep 2023 21:29:09 -0700 From: Linyu Yuan To: Thinh Nguyen , Peter Chen , Pawel Laszczak , Roger Quadros , Linus Walleij , Chunfeng Yun , Neal Liu , "Cristian Birsan" , Bin Liu , "Kevin Cernekee" , Justin Chen , "Al Cooper" , Li Yang , "Vladimir Zapolskiy" , Daniel Mack , Haojian Zhuang , Robert Jarzmik , "Philipp Zabel" , Herve Codina , hierry Reding , Jonathan Hunter , Michal Simek , Rui Miguel Silva , Valentina Manea , "Shuah Khan" , Hongren Zheng , Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH 02/11] usb: gadget: add anonymous definition in struct usb_request Date: Mon, 11 Sep 2023 12:28:34 +0800 Message-ID: <20230911042843.2711-3-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230911042843.2711-1-quic_linyyuan@quicinc.com> References: <20230911042843.2711-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: o8lnhos5vIZ-KDDqUPK6rt1v9SvQ6ksv X-Proofpoint-ORIG-GUID: o8lnhos5vIZ-KDDqUPK6rt1v9SvQ6ksv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-10_18,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 malwarescore=0 suspectscore=0 mlxscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 spamscore=0 mlxlogscore=566 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110040 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Some UDC trace event will save usb request information, but it will use one int size buffer to save one bit information of usb request, so more than one int buffer to save several bit fields which is not good. First add an anonymous union which have one u32 member dw1 which can be used by trace event during fast assign stage to reduce trace buffer usage, add related macro to extract bit fields from dw1 for later trace event output state usage. Also move exist stread_id and other bit fields into one anonymous struct which inside anonymous union, Change them from unsigned to u32 type, it will make sure union member have same memory size as dw1. Signed-off-by: Linyu Yuan --- include/linux/usb/gadget.h | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index cdf62e7f34e7..045ebd4637c5 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -41,6 +41,7 @@ struct usb_ep; * @num_sgs: number of SG entries * @num_mapped_sgs: number of SG entries mapped to DMA (internal) * @length: Length of that data + * @dw1: trace event purpose * @stream_id: The stream id, when USB3.0 bulk streams are being used * @is_last: Indicates if this is the last request of a stream_id before * switching to a different stream (required for DWC3 controllers). @@ -105,12 +106,23 @@ struct usb_request { unsigned num_sgs; unsigned num_mapped_sgs; - unsigned stream_id:16; - unsigned is_last:1; - unsigned no_interrupt:1; - unsigned zero:1; - unsigned short_not_ok:1; - unsigned dma_mapped:1; + union { + struct { + u32 stream_id:16; + u32 is_last:1; + u32 no_interrupt:1; + u32 zero:1; + u32 short_not_ok:1; + u32 dma_mapped:1; + } __packed; + u32 dw1; +#define USB_REQ_STREAM_ID(n) ((n) & 0xffff) +#define USB_REQ_IS_LAST(n) (((n) >> 16) & 1) +#define USB_REQ_NO_INTERRUPT(n) (((n) >> 17) & 1) +#define USB_REQ_ZERO(n) (((n) >> 18) & 1) +#define USB_REQ_SHORT_NOT_OK(n) (((n) >> 19) & 1) +#define USB_REQ_DMA_MAPPED(n) (((n) >> 20) & 1) + }; void (*complete)(struct usb_ep *ep, struct usb_request *req); From patchwork Mon Sep 11 04:28:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13378757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C02D6EE801F for ; Mon, 11 Sep 2023 04:30:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232654AbjIKEaF (ORCPT ); Mon, 11 Sep 2023 00:30:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233427AbjIKE37 (ORCPT ); Mon, 11 Sep 2023 00:29:59 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2821810C for ; Sun, 10 Sep 2023 21:29:54 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38B3rNgU026019; Mon, 11 Sep 2023 04:29:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=B1YEQUITE/Sk1BQXOT9ElxJ0s3CIOsJ8dklYA87MdaU=; b=MxjPajn/MQaKnqoOZ9aZObTwfGyUId15jBdYOytuar8nogplwhcAaiSrbzmhaxrGkF0Q XMSz3gyG4/lmS7s1TFtGBqoSa2i/wOr/ByXrs9yQPZAy/AbcXrNSnzXUJVF42ZOYJ7x/ hjjjCEZhjcVVukMTWJikrxST+I6jZoyTcgbdg64257zfCsza2VkXb0vu6q7NprFnJHX8 UaVY1m4xO6n/TX7x7hD+dTnNl8JNsa0mD6BT41ZI3mo4f9rOOLVcaXfG9iLz7ps1dJ0q 3dhPLGhrsUCwHCCHsQ2LO96WRdqySmlKKtYHxKhnzKPoxYXGKbfS0+agi+sHbQqgJ7+W Lg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t0gt1ag5u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:29:25 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38B4TONK012888 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:29:24 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Sun, 10 Sep 2023 21:29:16 -0700 From: Linyu Yuan To: Thinh Nguyen , Peter Chen , Pawel Laszczak , Roger Quadros , Linus Walleij , Chunfeng Yun , Neal Liu , "Cristian Birsan" , Bin Liu , "Kevin Cernekee" , Justin Chen , "Al Cooper" , Li Yang , "Vladimir Zapolskiy" , Daniel Mack , Haojian Zhuang , Robert Jarzmik , "Philipp Zabel" , Herve Codina , hierry Reding , Jonathan Hunter , Michal Simek , Rui Miguel Silva , Valentina Manea , "Shuah Khan" , Hongren Zheng , Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH 03/11] usb: gadget: add anonymous definition in struct usb_ep Date: Mon, 11 Sep 2023 12:28:35 +0800 Message-ID: <20230911042843.2711-4-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230911042843.2711-1-quic_linyyuan@quicinc.com> References: <20230911042843.2711-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 8NFlz1jXIjzzKi4uL0P7stabBT2DHNym X-Proofpoint-GUID: 8NFlz1jXIjzzKi4uL0P7stabBT2DHNym X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_01,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 suspectscore=0 malwarescore=0 clxscore=1015 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110040 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Some UDC trace event will save usb endpoint information, but it will use one int size buffer to save one bit information of usb endpoint, so more than one int buffer to save several bit fields which is not good. Add some anonymous union have three u32 members which can be used by trace event during fast assign stage to reduce trace buffer usage, and add related macro to extract bit fields from u32 members for later trace event output state usage. Also move exist maxpacket and other bit field into anonymous struct which inside anonymous union and Change them from unsigned to u32 type. Signed-off-by: Linyu Yuan --- include/linux/usb/gadget.h | 74 +++++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 16 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 045ebd4637c5..8529d49ed05d 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -175,13 +175,13 @@ struct usb_ep_ops { * @dir_out:Endpoint supports OUT direction. */ struct usb_ep_caps { - unsigned type_control:1; - unsigned type_iso:1; - unsigned type_bulk:1; - unsigned type_int:1; - unsigned dir_in:1; - unsigned dir_out:1; -}; + u8 type_control:1; + u8 type_iso:1; + u8 type_bulk:1; + u8 type_int:1; + u8 dir_in:1; + u8 dir_out:1; +} __packed; #define USB_EP_CAPS_TYPE_CONTROL 0x01 #define USB_EP_CAPS_TYPE_ISO 0x02 @@ -211,6 +211,11 @@ struct usb_ep_caps { * @caps:The structure describing types and directions supported by endpoint. * @enabled: The current endpoint enabled/disabled state. * @claimed: True if this endpoint is claimed by a function. + * @dw1: trace event purpose + * @dw2: trace event purpose + * @epnum: trace event purpose + * @u1: trace event purpose + * @u2: trace event purpose * @maxpacket:The maximum packet size used on this endpoint. The initial * value can sometimes be reduced (hardware allowing), according to * the endpoint descriptor used to configure the endpoint. @@ -240,19 +245,56 @@ struct usb_ep { const char *name; const struct usb_ep_ops *ops; struct list_head ep_list; - struct usb_ep_caps caps; - bool claimed; - bool enabled; - unsigned maxpacket:16; - unsigned maxpacket_limit:16; - unsigned max_streams:16; - unsigned mult:2; - unsigned maxburst:5; - u8 address; + union { + struct { + u32 maxpacket:16; + u32 maxpacket_limit:16; + u32 max_streams:16; + u32 mult:2; + u32 maxburst:5; + } __packed; + struct { + u32 dw1; + u32 dw2; + }; +#define USB_EP_MAXPACKET(n) ((n) & 0xffff) +#define USB_EP_MAXPACKET_LIMIT(n) (((n) >> 16) & 0xffff) +#define USB_EP_MAX_STREAMS(n) ((n) & 0xffff) +#define USB_EP_MULT(n) (((n) >> 16) & 0x3) +#define USB_EP_MAXBURST(n) (((n) >> 18) & 0x1f) + }; + union { + struct { + union { + struct usb_ep_caps caps; + u8 u1; + }; + union { + struct { + u8 claimed:1; + u8 enabled:1; + } __packed; + u8 u2; + }; + u8 address; + u8 epnum; + } __packed; + u32 dw3; +#define USB_EP_NUM(n) (((n) >> 24) & 0xff) +#define USB_EP_DIR_BI(n) ((((n) >> 4) & 0x3) == 0x3) +#define USB_EP_DIR_IN(n) (((n) >> 4) & 0x1) + }; const struct usb_endpoint_descriptor *desc; const struct usb_ss_ep_comp_descriptor *comp_desc; }; +/* NOTE: it need UDC set epnum and dir info when init endpoints */ +#define USB_EP_NAME(n) \ + ({char __s[9]; /* max 8: ep127out */\ + snprintf(__s, 9, "ep%d%s", USB_EP_NUM(n), \ + USB_EP_DIR_BI(n) ? "" : (USB_EP_DIR_IN(n) ? "in" : "out"));\ + __s; }) + /*-------------------------------------------------------------------------*/ #if IS_ENABLED(CONFIG_USB_GADGET) From patchwork Mon Sep 11 04:28:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13378762 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EAE3EE7FF4 for ; Mon, 11 Sep 2023 04:30:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233523AbjIKEac (ORCPT ); Mon, 11 Sep 2023 00:30:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233520AbjIKEab (ORCPT ); Mon, 11 Sep 2023 00:30:31 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E10C9CD7 for ; Sun, 10 Sep 2023 21:30:21 -0700 (PDT) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38B4M2tj009242; Mon, 11 Sep 2023 04:29:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=n5+ix5S+vyXmRTSbao5OKH99zO5rWRekoDCUIXjDMHU=; b=NhaeQv/1bYBgPJlPgtrn40+KXv7VdzDftHn34AfGWf6LtxooA6YfTjP86mW753khYza8 aj0MOZhLmqMvCa94r+D58HRxQLjEegfpfOAx1QuVjLm4BJRDzSLmGbXrU9CeMN9cUqPG 7A95ywvw7gXqktM3+oI+k+qBX48p6LRUTVSfde1ZmWhSxUgnAZE/CXPmb2qyXYI6i7qG Ar1hCXj+7JO1NpeasX0PEBcNE/3yeqzLIy2VR1Exvlz0kUQUhGjLxCK0ayevgflM3zvg ls0Y4EC5rELiCfQfgUNGzSxsHkCWXL5kCg6U1l43bxi41vlTkoQtW5ZdIJHWk2gh7OHx gQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t0j0fjmjx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:29:32 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38B4TV4J021488 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:29:31 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Sun, 10 Sep 2023 21:29:24 -0700 From: Linyu Yuan To: Thinh Nguyen , Peter Chen , Pawel Laszczak , Roger Quadros , Linus Walleij , Chunfeng Yun , Neal Liu , "Cristian Birsan" , Bin Liu , "Kevin Cernekee" , Justin Chen , "Al Cooper" , Li Yang , "Vladimir Zapolskiy" , Daniel Mack , Haojian Zhuang , Robert Jarzmik , "Philipp Zabel" , Herve Codina , hierry Reding , Jonathan Hunter , Michal Simek , Rui Miguel Silva , Valentina Manea , "Shuah Khan" , Hongren Zheng , Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH 04/11] usb: udc: assign epnum for each usb endpoint Date: Mon, 11 Sep 2023 12:28:36 +0800 Message-ID: <20230911042843.2711-5-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230911042843.2711-1-quic_linyyuan@quicinc.com> References: <20230911042843.2711-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 7kILNNFOllPjedNRqq9gZqWCM1KduqEz X-Proofpoint-GUID: 7kILNNFOllPjedNRqq9gZqWCM1KduqEz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_01,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 malwarescore=0 clxscore=1015 impostorscore=0 mlxlogscore=584 bulkscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110041 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org When record trace event in UDC core layer, it will reduce trace ring buffer usage if record one u32 variable including epnum, use USB_EP_NAME() macro will generate endpoint name from epnum. Signed-off-by: Linyu Yuan --- drivers/usb/cdns3/cdns3-gadget.c | 1 + drivers/usb/cdns3/cdnsp-gadget.c | 1 + drivers/usb/chipidea/udc.c | 1 + drivers/usb/dwc2/gadget.c | 2 +- drivers/usb/dwc3/gadget.c | 1 + drivers/usb/fotg210/fotg210-udc.c | 1 + drivers/usb/gadget/udc/aspeed-vhub/epn.c | 1 + drivers/usb/gadget/udc/aspeed_udc.c | 1 + drivers/usb/gadget/udc/at91_udc.c | 1 + drivers/usb/gadget/udc/atmel_usba_udc.c | 1 + drivers/usb/gadget/udc/bcm63xx_udc.c | 1 + drivers/usb/gadget/udc/bdc/bdc_ep.c | 1 + drivers/usb/gadget/udc/cdns2/cdns2-gadget.c | 2 +- drivers/usb/gadget/udc/dummy_hcd.c | 1 + drivers/usb/gadget/udc/fsl_qe_udc.c | 1 + drivers/usb/gadget/udc/fsl_udc_core.c | 1 + drivers/usb/gadget/udc/fusb300_udc.c | 1 + drivers/usb/gadget/udc/goku_udc.c | 1 + drivers/usb/gadget/udc/gr_udc.c | 1 + drivers/usb/gadget/udc/lpc32xx_udc.c | 1 + drivers/usb/gadget/udc/m66592-udc.c | 1 + drivers/usb/gadget/udc/max3420_udc.c | 1 + drivers/usb/gadget/udc/mv_u3d_core.c | 2 ++ drivers/usb/gadget/udc/mv_udc_core.c | 2 ++ drivers/usb/gadget/udc/net2272.c | 1 + drivers/usb/gadget/udc/net2280.c | 2 ++ drivers/usb/gadget/udc/omap_udc.c | 1 + drivers/usb/gadget/udc/pch_udc.c | 1 + drivers/usb/gadget/udc/pxa25x_udc.c | 1 + drivers/usb/gadget/udc/pxa27x_udc.c | 1 + drivers/usb/gadget/udc/r8a66597-udc.c | 1 + drivers/usb/gadget/udc/renesas_usb3.c | 1 + drivers/usb/gadget/udc/renesas_usbf.c | 1 + drivers/usb/gadget/udc/snps_udc_core.c | 1 + drivers/usb/gadget/udc/tegra-xudc.c | 2 ++ drivers/usb/gadget/udc/udc-xilinx.c | 1 + drivers/usb/isp1760/isp1760-udc.c | 1 + drivers/usb/mtu3/mtu3_gadget.c | 1 + drivers/usb/musb/musb_gadget.c | 1 + drivers/usb/renesas_usbhs/mod_gadget.c | 1 + drivers/usb/usbip/vudc_dev.c | 1 + 41 files changed, 45 insertions(+), 2 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c index 11a5b3437c32..6abd3a1593bb 100644 --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -3109,6 +3109,7 @@ static int cdns3_init_eps(struct cdns3_device *priv_dev) priv_ep->num = ep_number; priv_ep->dir = ep_dir ? USB_DIR_IN : USB_DIR_OUT; + priv_ep->endpoint.epnum = ep_number; if (!ep_number) { ret = cdns3_init_ep0(priv_dev, priv_ep); if (ret) { diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c index fff9ec9c391f..4225d3c1d0c4 100644 --- a/drivers/usb/cdns3/cdnsp-gadget.c +++ b/drivers/usb/cdns3/cdnsp-gadget.c @@ -1622,6 +1622,7 @@ static int cdnsp_gadget_init_endpoints(struct cdnsp_device *pdev) pep->number = epnum; pep->direction = direction; /* 0 for OUT, 1 for IN. */ + pep->endpoint.epnum = epnum; /* * Ep0 is bidirectional, so ep0in and ep0out are represented by * pdev->eps[0] diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 0b7bd3c643c3..be05027edbfd 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1857,6 +1857,7 @@ static int init_eps(struct ci_hdrc *ci) hwep->lock = &ci->lock; hwep->td_pool = ci->td_pool; + hwep->ep.epnum = i; hwep->ep.name = hwep->name; hwep->ep.ops = &usb_ep_ops; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index b517a7216de2..a92931b21b9e 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -4805,7 +4805,7 @@ static void dwc2_hsotg_initep(struct dwc2_hsotg *hsotg, INIT_LIST_HEAD(&hs_ep->queue); INIT_LIST_HEAD(&hs_ep->ep.ep_list); - + hs_ep->ep.epnum = epnum; /* add to the list of endpoints known by the gadget driver */ if (epnum) list_add_tail(&hs_ep->ep.ep_list, &hsotg->gadget.ep_list); diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 858fe4c299b7..325d299713f7 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -3267,6 +3267,7 @@ static int dwc3_gadget_init_endpoint(struct dwc3 *dwc, u8 epnum) dep->endpoint.name = dep->name; + dep->endpoint.epnum = num; if (!(dep->number > 1)) { dep->endpoint.desc = &dwc3_gadget_ep0_desc; dep->endpoint.comp_desc = NULL; diff --git a/drivers/usb/fotg210/fotg210-udc.c b/drivers/usb/fotg210/fotg210-udc.c index f7ea84070554..f48d57672010 100644 --- a/drivers/usb/fotg210/fotg210-udc.c +++ b/drivers/usb/fotg210/fotg210-udc.c @@ -1238,6 +1238,7 @@ int fotg210_udc_probe(struct platform_device *pdev, struct fotg210 *fotg) ep->fotg210 = fotg210; INIT_LIST_HEAD(&ep->queue); ep->ep.name = fotg210_ep_name[i]; + ep->ep.epnum = i; ep->ep.ops = &fotg210_ep_ops; usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0); diff --git a/drivers/usb/gadget/udc/aspeed-vhub/epn.c b/drivers/usb/gadget/udc/aspeed-vhub/epn.c index 148d7ec3ebf4..c5f4ec58f520 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/epn.c +++ b/drivers/usb/gadget/udc/aspeed-vhub/epn.c @@ -825,6 +825,7 @@ struct ast_vhub_ep *ast_vhub_alloc_epn(struct ast_vhub_dev *d, u8 addr) ep->d_idx = addr; ep->vhub = vhub; ep->ep.ops = &ast_vhub_epn_ops; + ep->ep.epnum = addr; ep->ep.name = kasprintf(GFP_KERNEL, "ep%d", addr); d->epns[addr-1] = ep; ep->epn.g_idx = i; diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c index 2ef89a442f50..50c57f86dc4f 100644 --- a/drivers/usb/gadget/udc/aspeed_udc.c +++ b/drivers/usb/gadget/udc/aspeed_udc.c @@ -1355,6 +1355,7 @@ static void ast_udc_init_ep(struct ast_udc_dev *udc) for (i = 0; i < AST_UDC_NUM_ENDPOINTS; i++) { ep = &udc->ep[i]; + ep->ep.epnum = i; ep->ep.name = ast_ep_name[i]; if (i == 0) { ep->ep.caps.type_control = true; diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c index 922b4187004b..2905bc60be75 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c @@ -1819,6 +1819,7 @@ static int at91udc_probe(struct platform_device *pdev) for (i = 0; i < NUM_ENDPOINTS; i++) { ep = &udc->ep[i]; + ep->ep.epnum = i; ep->ep.name = ep_info[i].name; ep->ep.caps = ep_info[i].caps; ep->ep.ops = &at91_ep_ops; diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index 02b1bef5e22e..045b732ac467 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -2217,6 +2217,7 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev, ep->can_dma = ep_cfg->can_dma; ep->can_isoc = ep_cfg->can_isoc; + ep->ep.epnum = ep->index; sprintf(ep->name, "ep%d", ep->index); ep->ep.name = ep->name; diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c index da7011d906e0..325d37ac2fae 100644 --- a/drivers/usb/gadget/udc/bcm63xx_udc.c +++ b/drivers/usb/gadget/udc/bcm63xx_udc.c @@ -952,6 +952,7 @@ static int bcm63xx_init_udc_hw(struct bcm63xx_udc *udc) for (i = 0; i < BCM63XX_NUM_EP; i++) { struct bcm63xx_ep *bep = &udc->bep[i]; + bep->ep.epnum = i; bep->ep.name = bcm63xx_ep_info[i].name; bep->ep.caps = bcm63xx_ep_info[i].caps; bep->ep_num = i; diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c index fa88f210ecd5..2fc32349823a 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_ep.c +++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c @@ -1977,6 +1977,7 @@ static int init_ep(struct bdc *bdc, u32 epnum, u32 dir) snprintf(ep->name, sizeof(ep->name), "ep%d%s", epnum - 1, dir & 1 ? "in" : "out"); + ep->usb_ep.epnum = epnum - 1; usb_ep_set_maxpacket_limit(&ep->usb_ep, 1024); ep->usb_ep.caps.type_iso = true; ep->usb_ep.caps.type_bulk = true; diff --git a/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c b/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c index 0eed0e03842c..81dcad43025f 100644 --- a/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c +++ b/drivers/usb/gadget/udc/cdns2/cdns2-gadget.c @@ -2213,7 +2213,7 @@ static int cdns2_init_eps(struct cdns2_device *pdev) } else { snprintf(pep->name, sizeof(pep->name), "ep%d%s", epnum, !!direction ? "in" : "out"); - pep->endpoint.name = pep->name; + pep->endpoint.epnum = epnum; usb_ep_set_maxpacket_limit(&pep->endpoint, 1024); pep->endpoint.ops = &cdns2_gadget_ep_ops; diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c index 0953e1b5c030..b2c919e46cc5 100644 --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c @@ -1049,6 +1049,7 @@ static void init_dummy_udc_hw(struct dummy *dum) if (!ep_info[i].name) break; + ep->ep.epnum = i; ep->ep.name = ep_info[i].name; ep->ep.caps = ep_info[i].caps; ep->ep.ops = &dummy_ep_ops; diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c index 4aae86b47edf..48a32f8b903d 100644 --- a/drivers/usb/gadget/udc/fsl_qe_udc.c +++ b/drivers/usb/gadget/udc/fsl_qe_udc.c @@ -2411,6 +2411,7 @@ static int qe_ep_config(struct qe_udc *udc, unsigned char pipe_num) ep->udc = udc; strcpy(ep->name, ep_name[pipe_num]); ep->ep.name = ep_name[pipe_num]; + ep->ep.epnum = pipe_num; if (pipe_num == 0) { ep->ep.caps.type_control = true; diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c index ee5705d336e3..78f4948bfc9f 100644 --- a/drivers/usb/gadget/udc/fsl_udc_core.c +++ b/drivers/usb/gadget/udc/fsl_udc_core.c @@ -2331,6 +2331,7 @@ static int struct_ep_setup(struct fsl_udc *udc, unsigned char index, else ep->ep.caps.dir_out = true; + ep->ep.epunm = index / 2; /* for ep0: maxP defined in desc * for other eps, maxP is set by epautoconfig() called by gadget layer */ diff --git a/drivers/usb/gadget/udc/fusb300_udc.c b/drivers/usb/gadget/udc/fusb300_udc.c index bd03d475f927..a2cc2237c3b1 100644 --- a/drivers/usb/gadget/udc/fusb300_udc.c +++ b/drivers/usb/gadget/udc/fusb300_udc.c @@ -1445,6 +1445,7 @@ static int fusb300_probe(struct platform_device *pdev) } ep->fusb300 = fusb300; INIT_LIST_HEAD(&ep->queue); + ep->ep.epnum = i; ep->ep.name = fusb300_ep_name[i]; ep->ep.ops = &fusb300_ep_ops; usb_ep_set_maxpacket_limit(&ep->ep, HS_BULK_MAX_PACKET_SIZE); diff --git a/drivers/usb/gadget/udc/goku_udc.c b/drivers/usb/gadget/udc/goku_udc.c index 5ffb3d5c635b..9757c886dd72 100644 --- a/drivers/usb/gadget/udc/goku_udc.c +++ b/drivers/usb/gadget/udc/goku_udc.c @@ -1266,6 +1266,7 @@ static void udc_reinit (struct goku_udc *dev) struct goku_ep *ep = &dev->ep[i]; ep->num = i; + ep->ep.epnum = i; ep->ep.name = names[i]; ep->reg_fifo = &dev->regs->ep_fifo [i]; ep->reg_status = &dev->regs->ep_status [i]; diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c index c6dfa7cccc11..674de5aea8ed 100644 --- a/drivers/usb/gadget/udc/gr_udc.c +++ b/drivers/usb/gadget/udc/gr_udc.c @@ -1976,6 +1976,7 @@ static int gr_ep_init(struct gr_udc *dev, int num, int is_in, u32 maxplimit) ep->num = num; ep->is_in = is_in; ep->dev = dev; + ep->ep.epnum = num; ep->ep.ops = &gr_ep_ops; INIT_LIST_HEAD(&ep->queue); diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c index fe62db32dd0e..1d436450adc8 100644 --- a/drivers/usb/gadget/udc/lpc32xx_udc.c +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c @@ -1385,6 +1385,7 @@ static void udc_reinit(struct lpc32xx_udc *udc) if (i != 0) list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list); + ep->ep.epnum = i; usb_ep_set_maxpacket_limit(&ep->ep, ep->maxpacket); INIT_LIST_HEAD(&ep->queue); ep->req_pending = 0; diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c index e05f45a4b56b..4070b466e109 100644 --- a/drivers/usb/gadget/udc/m66592-udc.c +++ b/drivers/usb/gadget/udc/m66592-udc.c @@ -1622,6 +1622,7 @@ static int m66592_probe(struct platform_device *pdev) } ep->m66592 = m66592; INIT_LIST_HEAD(&ep->queue); + ep->ep.epnum = i; ep->ep.name = m66592_ep_name[i]; ep->ep.ops = &m66592_ep_ops; usb_ep_set_maxpacket_limit(&ep->ep, 512); diff --git a/drivers/usb/gadget/udc/max3420_udc.c b/drivers/usb/gadget/udc/max3420_udc.c index 2d57786d3db7..09bf310df9fa 100644 --- a/drivers/usb/gadget/udc/max3420_udc.c +++ b/drivers/usb/gadget/udc/max3420_udc.c @@ -1162,6 +1162,7 @@ static void max3420_eps_init(struct max3420_udc *udc) ep->id = idx; ep->halted = 0; ep->maxpacket = 0; + ep->ep_usb.epnum = idx; ep->ep_usb.name = ep->name; ep->ep_usb.ops = &max3420_ep_ops; usb_ep_set_maxpacket_limit(&ep->ep_usb, MAX3420_EP_MAX_PACKET); diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c b/drivers/usb/gadget/udc/mv_u3d_core.c index 2a421f0ff931..c77c949edd06 100644 --- a/drivers/usb/gadget/udc/mv_u3d_core.c +++ b/drivers/usb/gadget/udc/mv_u3d_core.c @@ -1308,6 +1308,7 @@ static int mv_u3d_eps_init(struct mv_u3d *u3d) ep = &u3d->eps[1]; ep->u3d = u3d; strncpy(ep->name, "ep0", sizeof(ep->name)); + ep->ep.epnum = 0; ep->ep.name = ep->name; ep->ep.ops = &mv_u3d_ep_ops; ep->wedge = 0; @@ -1339,6 +1340,7 @@ static int mv_u3d_eps_init(struct mv_u3d *u3d) ep->u3d = u3d; strncpy(ep->name, name, sizeof(ep->name)); ep->ep.name = ep->name; + ep->ep.epnum = i / 2; ep->ep.caps.type_iso = true; ep->ep.caps.type_bulk = true; diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c index d888dcda2bc8..fdd8dd52d89d 100644 --- a/drivers/usb/gadget/udc/mv_udc_core.c +++ b/drivers/usb/gadget/udc/mv_udc_core.c @@ -1244,6 +1244,7 @@ static int eps_init(struct mv_udc *udc) ep = &udc->eps[0]; ep->udc = udc; strncpy(ep->name, "ep0", sizeof(ep->name)); + ep->ep.epnum = 0; ep->ep.name = ep->name; ep->ep.ops = &mv_ep_ops; ep->wedge = 0; @@ -1273,6 +1274,7 @@ static int eps_init(struct mv_udc *udc) ep->udc = udc; strncpy(ep->name, name, sizeof(ep->name)); ep->ep.name = ep->name; + ep->ep.epnum = i / 2; ep->ep.caps.type_iso = true; ep->ep.caps.type_bulk = true; diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c index 12e76bb62c20..766aabcbd3d1 100644 --- a/drivers/usb/gadget/udc/net2272.c +++ b/drivers/usb/gadget/udc/net2272.c @@ -1373,6 +1373,7 @@ net2272_usb_reinit(struct net2272 *dev) struct net2272_ep *ep = &dev->ep[i]; ep->ep.name = ep_name[i]; + ep->ep.epnum = i; ep->dev = dev; ep->num = i; ep->not_empty = 0; diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c index 1b929c519cd7..b6b3722c0ae6 100644 --- a/drivers/usb/gadget/udc/net2280.c +++ b/drivers/usb/gadget/udc/net2280.c @@ -2158,6 +2158,7 @@ static void usb_reinit_228x(struct net2280 *dev) ep->ep.name = ep_info_dft[tmp].name; ep->ep.caps = ep_info_dft[tmp].caps; + ep->ep.epnum = tmp; ep->dev = dev; ep->num = tmp; @@ -2201,6 +2202,7 @@ static void usb_reinit_338x(struct net2280 *dev) ep_info_dft[i].name; ep->ep.caps = dev->enhanced_mode ? ep_info_adv[i].caps : ep_info_dft[i].caps; + ep->ep.epnum = i; ep->dev = dev; ep->num = i; diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c index 10c5d7f726a1..8baf996fa65a 100644 --- a/drivers/usb/gadget/udc/omap_udc.c +++ b/drivers/usb/gadget/udc/omap_udc.c @@ -2582,6 +2582,7 @@ omap_ep_setup(char *name, u8 addr, u8 type, else ep->ep.caps.dir_out = true; + ep->ep.epnum = addr & 0xf; ep->ep.name = ep->name; ep->ep.ops = &omap_ep_ops; ep->maxpacket = maxp; diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c index 4f8617210d85..05247d6f5c61 100644 --- a/drivers/usb/gadget/udc/pch_udc.c +++ b/drivers/usb/gadget/udc/pch_udc.c @@ -2788,6 +2788,7 @@ static void pch_udc_pcd_reinit(struct pch_udc_dev *dev) ep->halted = 1; ep->num = i / 2; ep->in = ~i & 1; + ep->ep.epnum = i / 2; ep->ep.name = ep_string[i]; ep->ep.ops = &pch_udc_ep_ops; if (ep->in) { diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c index df0551ecc810..b4e2f018216c 100644 --- a/drivers/usb/gadget/udc/pxa25x_udc.c +++ b/drivers/usb/gadget/udc/pxa25x_udc.c @@ -1392,6 +1392,7 @@ static void udc_reinit(struct pxa25x_udc *dev) if (i != 0) list_add_tail (&ep->ep.ep_list, &dev->gadget.ep_list); + ep->ep.epnum = i; ep->ep.desc = NULL; ep->stopped = 0; INIT_LIST_HEAD (&ep->queue); diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c index 61424cfd2e1c..8f05937414ca 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c @@ -1677,6 +1677,7 @@ static void udc_init_data(struct pxa_udc *dev) /* USB endpoints init */ for (i = 1; i < NR_USB_ENDPOINTS; i++) { + dev->udc_usb_ep[i].usb_ep.epnum = i; list_add_tail(&dev->udc_usb_ep[i].usb_ep.ep_list, &dev->gadget.ep_list); usb_ep_set_maxpacket_limit(&dev->udc_usb_ep[i].usb_ep, diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c index 51b665f15c8e..eb3cd4446e39 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.c +++ b/drivers/usb/gadget/udc/r8a66597-udc.c @@ -1912,6 +1912,7 @@ static int r8a66597_probe(struct platform_device *pdev) } ep->r8a66597 = r8a66597; INIT_LIST_HEAD(&ep->queue); + ep->ep.epnum = i; ep->ep.name = r8a66597_ep_name[i]; ep->ep.ops = &r8a66597_ep_ops; usb_ep_set_maxpacket_limit(&ep->ep, 512); diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c index 3b01734ce1b7..f1bf719022fb 100644 --- a/drivers/usb/gadget/udc/renesas_usb3.c +++ b/drivers/usb/gadget/udc/renesas_usb3.c @@ -2700,6 +2700,7 @@ static int renesas_usb3_init_ep(struct renesas_usb3 *usb3, struct device *dev, snprintf(usb3_ep->ep_name, sizeof(usb3_ep->ep_name), "ep%d", i); usb3_ep->usb3 = usb3; usb3_ep->num = i; + usb3_ep->ep.epnum = i; usb3_ep->ep.name = usb3_ep->ep_name; usb3_ep->ep.ops = &renesas_usb3_ep_ops; INIT_LIST_HEAD(&usb3_ep->queue); diff --git a/drivers/usb/gadget/udc/renesas_usbf.c b/drivers/usb/gadget/udc/renesas_usbf.c index 657f265ac7cc..cb741e54ea4c 100644 --- a/drivers/usb/gadget/udc/renesas_usbf.c +++ b/drivers/usb/gadget/udc/renesas_usbf.c @@ -3308,6 +3308,7 @@ static int usbf_probe(struct platform_device *pdev) ep->id = i; ep->disabled = 1; ep->udc = udc; + ep->ep.epnum = i; ep->ep.ops = &usbf_ep_ops; ep->ep.name = usbf_ep_info[i].name; ep->ep.caps = usbf_ep_info[i].caps; diff --git a/drivers/usb/gadget/udc/snps_udc_core.c b/drivers/usb/gadget/udc/snps_udc_core.c index 2fc5d4d277bc..feeea53787ee 100644 --- a/drivers/usb/gadget/udc/snps_udc_core.c +++ b/drivers/usb/gadget/udc/snps_udc_core.c @@ -1538,6 +1538,7 @@ static void udc_setup_endpoints(struct udc *dev) for (tmp = 0; tmp < UDC_EP_NUM; tmp++) { ep = &dev->ep[tmp]; ep->dev = dev; + ep->ep.epnum = tmp; ep->ep.name = ep_info[tmp].name; ep->ep.caps = ep_info[tmp].caps; ep->num = tmp; diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c index cb85168fd00c..3e95d1486674 100644 --- a/drivers/usb/gadget/udc/tegra-xudc.c +++ b/drivers/usb/gadget/udc/tegra-xudc.c @@ -3173,6 +3173,7 @@ static int tegra_xudc_alloc_ep(struct tegra_xudc *xudc, unsigned int index) if (index) { snprintf(ep->name, sizeof(ep->name), "ep%u%s", index / 2, (index % 2 == 0) ? "out" : "in"); + ep->ep.epnum = index / 2; ep->usb_ep.name = ep->name; usb_ep_set_maxpacket_limit(&ep->usb_ep, 1024); ep->usb_ep.max_streams = 16; @@ -3186,6 +3187,7 @@ static int tegra_xudc_alloc_ep(struct tegra_xudc *xudc, unsigned int index) list_add_tail(&ep->usb_ep.ep_list, &xudc->gadget.ep_list); } else { strscpy(ep->name, "ep0", 3); + ep->ep.epnum = 0; ep->usb_ep.name = ep->name; usb_ep_set_maxpacket_limit(&ep->usb_ep, 512); ep->usb_ep.ops = &tegra_xudc_ep0_ops; diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c index 56b8286a8009..f04e26a8f6d3 100644 --- a/drivers/usb/gadget/udc/udc-xilinx.c +++ b/drivers/usb/gadget/udc/udc-xilinx.c @@ -1324,6 +1324,7 @@ static void xudc_eps_init(struct xusb_udc *udc) ep->ep_usb.caps.type_control = true; } + ep->ep_usb.epnum = ep_number; ep->ep_usb.caps.dir_in = true; ep->ep_usb.caps.dir_out = true; diff --git a/drivers/usb/isp1760/isp1760-udc.c b/drivers/usb/isp1760/isp1760-udc.c index 5cafd23345ca..a6f83ff661ad 100644 --- a/drivers/usb/isp1760/isp1760-udc.c +++ b/drivers/usb/isp1760/isp1760-udc.c @@ -1466,6 +1466,7 @@ static void isp1760_udc_init_eps(struct isp1760_udc *udc) ep->ep.ops = &isp1760_ep_ops; ep->ep.name = ep->name; + ep->ep.epnum = ep_num; /* * Hardcode the maximum packet sizes for now, to 64 bytes for * the control endpoint and 512 bytes for all other endpoints. diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c index ad0eeac4332d..bc76339eef16 100644 --- a/drivers/usb/mtu3/mtu3_gadget.c +++ b/drivers/usb/mtu3/mtu3_gadget.c @@ -655,6 +655,7 @@ static void init_hw_ep(struct mtu3 *mtu, struct mtu3_ep *mep, sprintf(mep->name, "ep%d%s", epnum, !epnum ? "" : (is_in ? "in" : "out")); + mep->ep.epnum = epnum; mep->ep.name = mep->name; INIT_LIST_HEAD(&mep->ep.ep_list); diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 051c6da7cf6d..1aab514d39f2 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -1709,6 +1709,7 @@ init_peripheral_ep(struct musb *musb, struct musb_ep *ep, u8 epnum, int is_in) (!epnum || hw_ep->is_shared_fifo) ? "" : ( is_in ? "in" : "out")); ep->end_point.name = ep->name; + ep->end_point.epnum = epnum; INIT_LIST_HEAD(&ep->end_point.ep_list); if (!epnum) { usb_ep_set_maxpacket_limit(&ep->end_point, 64); diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 105132ae87ac..648bee7e5198 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -1139,6 +1139,7 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) uep->pipe = NULL; snprintf(uep->ep_name, EP_NAME_SIZE, "ep%d", i); + uep->ep.epnum = i; uep->ep.name = uep->ep_name; uep->ep.ops = &usbhsg_ep_ops; INIT_LIST_HEAD(&uep->ep.ep_list); diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c index 44b04c54c086..05c95d9ebd8e 100644 --- a/drivers/usb/usbip/vudc_dev.c +++ b/drivers/usb/usbip/vudc_dev.c @@ -535,6 +535,7 @@ static int init_vudc_hw(struct vudc *udc) i ? (is_out ? "out" : "in") : ""); ep->ep.name = ep->name; + ep->ep.epnum = num; ep->ep.ops = &vep_ops; usb_ep_set_maxpacket_limit(&ep->ep, ~0); From patchwork Mon Sep 11 04:28:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13378759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BB31EE7FF4 for ; Mon, 11 Sep 2023 04:30:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233495AbjIKEaO (ORCPT ); Mon, 11 Sep 2023 00:30:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233441AbjIKEaO (ORCPT ); Mon, 11 Sep 2023 00:30:14 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D21B6CCA for ; Sun, 10 Sep 2023 21:30:08 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38B4QqXK022887; Mon, 11 Sep 2023 04:29:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=L5mlsSgqy8/xmNgiQe2CnbvmSKFZ6tFi3TQX+H39DW8=; b=BBz0NrFH/S41lgh4ssw6TGFSWLSsA9s0hkgVZ/Jdv5Imi/BFKKbiXvbwXP4HyFZx6aCH vN0LSN++vvJutrwju8buTuIpdBE1yABQ1Ll/ykfPHWR9C+r/agAMsfCqrIudmyjeTXBw qDZHO4lnzz57MsAz4vZEh+EEpjtKpQOaZeDw0cpsPzRhYIL72VNWIuszRB4SLa6NihcX B50bex4Zx/CnFm2isth3tvQZlAvXq7vXiTds0iKMIVqEyZ14ov9Lfa1KorXlaXRQZRv4 mEUxcmZSusjC7DKTzXcMV7xmKg/NE6yz5j1ND1CaIEvDbb5IyVMuSOfgL4ztNLAnS5DM ag== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t0g1rjh8v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:29:40 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38B4TdQi013407 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:29:39 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Sun, 10 Sep 2023 21:29:31 -0700 From: Linyu Yuan To: Thinh Nguyen , Peter Chen , Pawel Laszczak , Roger Quadros , Linus Walleij , Chunfeng Yun , Neal Liu , "Cristian Birsan" , Bin Liu , "Kevin Cernekee" , Justin Chen , "Al Cooper" , Li Yang , "Vladimir Zapolskiy" , Daniel Mack , Haojian Zhuang , Robert Jarzmik , "Philipp Zabel" , Herve Codina , hierry Reding , Jonathan Hunter , Michal Simek , Rui Miguel Silva , Valentina Manea , "Shuah Khan" , Hongren Zheng , Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH 05/11] usb: udc: trace: reduce buffer usage of trace event Date: Mon, 11 Sep 2023 12:28:37 +0800 Message-ID: <20230911042843.2711-6-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230911042843.2711-1-quic_linyyuan@quicinc.com> References: <20230911042843.2711-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: F70MH0fVAtHSL1DnrZa1sKOD-Qku9-_W X-Proofpoint-ORIG-GUID: F70MH0fVAtHSL1DnrZa1sKOD-Qku9-_W X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-10_18,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 malwarescore=0 suspectscore=0 mlxscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 spamscore=0 mlxlogscore=598 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110040 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Save u32 members into trace event ring buffer and parse it for possible bit fields. Signed-off-by: Linyu Yuan --- drivers/usb/gadget/udc/trace.h | 106 +++++++++++---------------------- 1 file changed, 35 insertions(+), 71 deletions(-) diff --git a/drivers/usb/gadget/udc/trace.h b/drivers/usb/gadget/udc/trace.h index a5ed26fbc2da..10cc6437432d 100644 --- a/drivers/usb/gadget/udc/trace.h +++ b/drivers/usb/gadget/udc/trace.h @@ -25,20 +25,7 @@ DECLARE_EVENT_CLASS(udc_log_gadget, __field(enum usb_device_speed, max_speed) __field(enum usb_device_state, state) __field(unsigned, mA) - __field(unsigned, sg_supported) - __field(unsigned, is_otg) - __field(unsigned, is_a_peripheral) - __field(unsigned, b_hnp_enable) - __field(unsigned, a_hnp_support) - __field(unsigned, hnp_polling_support) - __field(unsigned, host_request_flag) - __field(unsigned, quirk_ep_out_aligned_size) - __field(unsigned, quirk_altset_not_supp) - __field(unsigned, quirk_stall_not_supp) - __field(unsigned, quirk_zlp_not_supp) - __field(unsigned, is_selfpowered) - __field(unsigned, deactivated) - __field(unsigned, connected) + __field(u32, gdw1) __field(int, ret) ), TP_fast_assign( @@ -46,38 +33,25 @@ DECLARE_EVENT_CLASS(udc_log_gadget, __entry->max_speed = g->max_speed; __entry->state = g->state; __entry->mA = g->mA; - __entry->sg_supported = g->sg_supported; - __entry->is_otg = g->is_otg; - __entry->is_a_peripheral = g->is_a_peripheral; - __entry->b_hnp_enable = g->b_hnp_enable; - __entry->a_hnp_support = g->a_hnp_support; - __entry->hnp_polling_support = g->hnp_polling_support; - __entry->host_request_flag = g->host_request_flag; - __entry->quirk_ep_out_aligned_size = g->quirk_ep_out_aligned_size; - __entry->quirk_altset_not_supp = g->quirk_altset_not_supp; - __entry->quirk_stall_not_supp = g->quirk_stall_not_supp; - __entry->quirk_zlp_not_supp = g->quirk_zlp_not_supp; - __entry->is_selfpowered = g->is_selfpowered; - __entry->deactivated = g->deactivated; - __entry->connected = g->connected; + __entry->gdw1 = g->dw1; __entry->ret = ret; ), TP_printk("speed %d/%d state %d %dmA [%s%s%s%s%s%s%s%s%s%s%s%s%s%s] --> %d", __entry->speed, __entry->max_speed, __entry->state, __entry->mA, - __entry->sg_supported ? "sg:" : "", - __entry->is_otg ? "OTG:" : "", - __entry->is_a_peripheral ? "a_peripheral:" : "", - __entry->b_hnp_enable ? "b_hnp:" : "", - __entry->a_hnp_support ? "a_hnp:" : "", - __entry->hnp_polling_support ? "hnp_poll:" : "", - __entry->host_request_flag ? "hostreq:" : "", - __entry->quirk_ep_out_aligned_size ? "out_aligned:" : "", - __entry->quirk_altset_not_supp ? "no_altset:" : "", - __entry->quirk_stall_not_supp ? "no_stall:" : "", - __entry->quirk_zlp_not_supp ? "no_zlp" : "", - __entry->is_selfpowered ? "self-powered:" : "bus-powered:", - __entry->deactivated ? "deactivated:" : "activated:", - __entry->connected ? "connected" : "disconnected", + USB_GADGET_SG_SUPPORTED(__entry->gdw1) ? "sg:" : "", + USB_GADGET_IS_OTG(__entry->gdw1) ? "OTG:" : "", + USB_GADGET_IS_A_PERIPHERAL(__entry->gdw1) ? "a_peripheral:" : "", + USB_GADGET_B_HNP_ENABLE(__entry->gdw1) ? "b_hnp:" : "", + USB_GADGET_A_HNP_SUPPORT(__entry->gdw1) ? "a_hnp:" : "", + USB_GADGET_HNP_POLLING_SUPPORT(__entry->gdw1) ? "hnp_poll:" : "", + USB_GADGET_HOST_REQUEST_FLAG(__entry->gdw1) ? "hostreq:" : "", + USB_GADGET_QUIRK_EP_OUT_ALIGNED_SIZE(__entry->gdw1) ? "out_aligned:" : "", + USB_GADGET_QUIRK_ALTSET_NOT_SUPP(__entry->gdw1) ? "no_altset:" : "", + USB_GADGET_QUIRK_STALL_NOT_SUPP(__entry->gdw1) ? "no_stall:" : "", + USB_GADGET_QUIRK_ZLP_NOT_SUPP(__entry->gdw1) ? "no_zlp" : "", + USB_GADGET_IS_SELFPOWERED(__entry->gdw1) ? "self-powered:" : "bus-powered:", + USB_GADGET_DEACTIVATED(__entry->gdw1) ? "deactivated:" : "activated:", + USB_GADGET_CONNECTED(__entry->gdw1) ? "connected" : "disconnected", __entry->ret) ); @@ -145,32 +119,28 @@ DECLARE_EVENT_CLASS(udc_log_ep, TP_PROTO(struct usb_ep *ep, int ret), TP_ARGS(ep, ret), TP_STRUCT__entry( - __string(name, ep->name) - __field(unsigned, maxpacket) - __field(unsigned, maxpacket_limit) - __field(unsigned, max_streams) - __field(unsigned, mult) - __field(unsigned, maxburst) + __field(u32, edw3) + __field(u32, edw1) + __field(u32, edw2) __field(u8, address) __field(bool, claimed) __field(bool, enabled) __field(int, ret) ), TP_fast_assign( - __assign_str(name, ep->name); - __entry->maxpacket = ep->maxpacket; - __entry->maxpacket_limit = ep->maxpacket_limit; - __entry->max_streams = ep->max_streams; - __entry->mult = ep->mult; - __entry->maxburst = ep->maxburst; + __entry->edw3 = ep->dw3; + __entry->edw1 = ep->dw1; + __entry->edw2 = ep->dw2; __entry->address = ep->address, __entry->claimed = ep->claimed; __entry->enabled = ep->enabled; __entry->ret = ret; ), TP_printk("%s: mps %d/%d streams %d mult %d burst %d addr %02x %s%s --> %d", - __get_str(name), __entry->maxpacket, __entry->maxpacket_limit, - __entry->max_streams, __entry->mult, __entry->maxburst, + USB_EP_NAME(__entry->edw3), USB_EP_MAXPACKET(__entry->edw1), + USB_EP_MAXPACKET_LIMIT(__entry->edw1), + USB_EP_MAX_STREAMS(__entry->edw2), USB_EP_MULT(__entry->edw2), + USB_EP_MAXBURST(__entry->edw2), __entry->address, __entry->claimed ? "claimed:" : "released:", __entry->enabled ? "enabled" : "disabled", ret) ); @@ -219,39 +189,33 @@ DECLARE_EVENT_CLASS(udc_log_req, TP_PROTO(struct usb_ep *ep, struct usb_request *req, int ret), TP_ARGS(ep, req, ret), TP_STRUCT__entry( - __string(name, ep->name) + __field(u32, edw3) __field(unsigned, length) __field(unsigned, actual) __field(unsigned, num_sgs) __field(unsigned, num_mapped_sgs) - __field(unsigned, stream_id) - __field(unsigned, no_interrupt) - __field(unsigned, zero) - __field(unsigned, short_not_ok) + __field(u32, rdw1) __field(int, status) __field(int, ret) __field(struct usb_request *, req) ), TP_fast_assign( - __assign_str(name, ep->name); + __entry->edw3 = ep->dw3; __entry->length = req->length; __entry->actual = req->actual; __entry->num_sgs = req->num_sgs; __entry->num_mapped_sgs = req->num_mapped_sgs; - __entry->stream_id = req->stream_id; - __entry->no_interrupt = req->no_interrupt; - __entry->zero = req->zero; - __entry->short_not_ok = req->short_not_ok; + __entry->rdw1 = req->dw1; __entry->status = req->status; __entry->ret = ret; __entry->req = req; ), TP_printk("%s: req %p length %d/%d sgs %d/%d stream %d %s%s%s status %d --> %d", - __get_str(name),__entry->req, __entry->actual, __entry->length, - __entry->num_mapped_sgs, __entry->num_sgs, __entry->stream_id, - __entry->zero ? "Z" : "z", - __entry->short_not_ok ? "S" : "s", - __entry->no_interrupt ? "i" : "I", + USB_EP_NAME(__entry->edw3), __entry->req, __entry->actual, __entry->length, + __entry->num_mapped_sgs, __entry->num_sgs, USB_REQ_STREAM_ID(__entry->rdw1), + USB_REQ_ZERO(__entry->rdw1) ? "Z" : "z", + USB_REQ_SHORT_NOT_OK(__entry->rdw1) ? "S" : "s", + USB_REQ_NO_INTERRUPT(__entry->rdw1) ? "i" : "I", __entry->status, __entry->ret ) ); From patchwork Mon Sep 11 04:28:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13378760 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 009D0EE7FF4 for ; Mon, 11 Sep 2023 04:30:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233507AbjIKEaU (ORCPT ); Mon, 11 Sep 2023 00:30:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233441AbjIKEaT (ORCPT ); Mon, 11 Sep 2023 00:30:19 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E7591B4 for ; Sun, 10 Sep 2023 21:30:14 -0700 (PDT) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38B3w4eD011317; Mon, 11 Sep 2023 04:29:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=5smdYf7uwMDEeyU6XDC2KvR4ge0TcOEfRgDmxVUL+bo=; b=YzvVQqGq7Wphti6XvSLS196JL/M0lrB2x5fkWi0XW7e+/CxGjdiy/OI1kCKVdAMqfLqF JwulkHd8RyDl32R1rpsST1goJlnE4rf01xFkHlkFmYDr6fNS6V1Fu1unFDf2ewh3OgUT PYikmIOWS688DMzHn/qfDqFZI6ZbReRlk2MgG0VwhQas4Iii8n7Ko22c/k81nBZsxuWQ wA4st+dnYNgUHkjDZeINukzERV7GJeOC4uWezI74ggRYUaCS4w9F+O2GViRy3N9sw6EY MIQ62r20ZLFGrjvupOsqNhrH0jb9Mo6AREbPwZOOlLj8xCvqk66xtfwZ8gIyEEY9xfFY TQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t0ga6jfmn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:29:47 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38B4TkUd021591 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:29:46 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Sun, 10 Sep 2023 21:29:39 -0700 From: Linyu Yuan To: Thinh Nguyen , Peter Chen , Pawel Laszczak , Roger Quadros , Linus Walleij , Chunfeng Yun , Neal Liu , "Cristian Birsan" , Bin Liu , "Kevin Cernekee" , Justin Chen , "Al Cooper" , Li Yang , "Vladimir Zapolskiy" , Daniel Mack , Haojian Zhuang , Robert Jarzmik , "Philipp Zabel" , Herve Codina , hierry Reding , Jonathan Hunter , Michal Simek , Rui Miguel Silva , Valentina Manea , "Shuah Khan" , Hongren Zheng , Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH 06/11] usb: cdns3: cdnsp: reduce buffer usage of trace event Date: Mon, 11 Sep 2023 12:28:38 +0800 Message-ID: <20230911042843.2711-7-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230911042843.2711-1-quic_linyyuan@quicinc.com> References: <20230911042843.2711-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: NPjgdeEheMsP2qLC4cK0gvpWWcMbaHex X-Proofpoint-ORIG-GUID: NPjgdeEheMsP2qLC4cK0gvpWWcMbaHex X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-10_18,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 priorityscore=1501 adultscore=0 malwarescore=0 mlxscore=0 mlxlogscore=386 clxscore=1015 spamscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110040 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Save u32 members into trace event ring buffer and parse it for possible bit information. Signed-off-by: Linyu Yuan --- drivers/usb/cdns3/cdnsp-trace.h | 45 +++++++++++++++------------------ 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/drivers/usb/cdns3/cdnsp-trace.h b/drivers/usb/cdns3/cdnsp-trace.h index 4b51011eb00b..b1ceb6755e6d 100644 --- a/drivers/usb/cdns3/cdnsp-trace.h +++ b/drivers/usb/cdns3/cdnsp-trace.h @@ -38,7 +38,7 @@ DECLARE_EVENT_CLASS(cdnsp_log_ep, TP_PROTO(struct cdnsp_ep *pep, u32 stream_id), TP_ARGS(pep, stream_id), TP_STRUCT__entry( - __string(name, pep->name) + __field(u32, edw3) __field(unsigned int, state) __field(u32, stream_id) __field(u8, enabled) @@ -48,7 +48,7 @@ DECLARE_EVENT_CLASS(cdnsp_log_ep, __field(u8, drbls_count) ), TP_fast_assign( - __assign_str(name, pep->name); + __entry->edw3 = pep->endpoint.dw3; __entry->state = pep->ep_state; __entry->stream_id = stream_id; __entry->enabled = pep->ep_state & EP_HAS_STREAMS; @@ -59,7 +59,7 @@ DECLARE_EVENT_CLASS(cdnsp_log_ep, ), TP_printk("%s: SID: %08x, ep state: %x, stream: enabled: %d num %d " "tds %d, first prime: %d drbls %d", - __get_str(name), __entry->stream_id, __entry->state, + USB_EP_NAME(__entry->edw3), __entry->stream_id, __entry->state, __entry->enabled, __entry->num_streams, __entry->td_count, __entry->first_prime_det, __entry->drbls_count) ); @@ -296,21 +296,21 @@ DECLARE_EVENT_CLASS(cdnsp_log_bounce, dma_addr_t dma, unsigned int unalign), TP_ARGS(preq, new_buf_len, offset, dma, unalign), TP_STRUCT__entry( - __string(name, preq->pep->name) + __field(u32, edw3) __field(u32, new_buf_len) __field(u32, offset) __field(dma_addr_t, dma) __field(unsigned int, unalign) ), TP_fast_assign( - __assign_str(name, preq->pep->name); + __entry->edw3 = preq->pep->endpoint.dw3; __entry->new_buf_len = new_buf_len; __entry->offset = offset; __entry->dma = dma; __entry->unalign = unalign; ), TP_printk("%s buf len %d, offset %d, dma %pad, unalign %d", - __get_str(name), __entry->new_buf_len, + USB_EP_NAME(__entry->edw3), __entry->new_buf_len, __entry->offset, &__entry->dma, __entry->unalign ) ); @@ -452,7 +452,7 @@ DECLARE_EVENT_CLASS(cdnsp_log_request, TP_PROTO(struct cdnsp_request *req), TP_ARGS(req), TP_STRUCT__entry( - __string(name, req->pep->name) + __field(u32, edw3) __field(struct usb_request *, request) __field(struct cdnsp_request *, preq) __field(void *, buf) @@ -460,17 +460,14 @@ DECLARE_EVENT_CLASS(cdnsp_log_request, __field(unsigned int, length) __field(int, status) __field(dma_addr_t, dma) - __field(unsigned int, stream_id) - __field(unsigned int, zero) - __field(unsigned int, short_not_ok) - __field(unsigned int, no_interrupt) + __field(u32, rdw1) __field(struct scatterlist*, sg) __field(unsigned int, num_sgs) __field(unsigned int, num_mapped_sgs) ), TP_fast_assign( - __assign_str(name, req->pep->name); + __entry->edw3 = req->pep->endpoint.dw3; __entry->request = &req->request; __entry->preq = req; __entry->buf = req->request.buf; @@ -478,10 +475,7 @@ DECLARE_EVENT_CLASS(cdnsp_log_request, __entry->length = req->request.length; __entry->status = req->request.status; __entry->dma = req->request.dma; - __entry->stream_id = req->request.stream_id; - __entry->zero = req->request.zero; - __entry->short_not_ok = req->request.short_not_ok; - __entry->no_interrupt = req->request.no_interrupt; + __entry->rdw1 = req->request.dw1; __entry->sg = req->request.sg; __entry->num_sgs = req->request.num_sgs; __entry->num_mapped_sgs = req->request.num_mapped_sgs; @@ -489,12 +483,12 @@ DECLARE_EVENT_CLASS(cdnsp_log_request, TP_printk("%s; req U:%p/P:%p, req buf %p, length %u/%u, status %d, " "buf dma (%pad), SID %u, %s%s%s, sg %p, num_sg %d," " num_m_sg %d", - __get_str(name), __entry->request, __entry->preq, + USB_EP_NAME(__entry->edw3), __entry->request, __entry->preq, __entry->buf, __entry->actual, __entry->length, __entry->status, &__entry->dma, - __entry->stream_id, __entry->zero ? "Z" : "z", - __entry->short_not_ok ? "S" : "s", - __entry->no_interrupt ? "I" : "i", + USB_REQ_STREAM_ID(__entry->rdw1), USB_REQ_ZERO(__entry->rdw1) ? "Z" : "z", + USB_REQ_SHORT_NOT_OK(__entry->rdw1) ? "S" : "s", + USB_REQ_NO_INTERRUPT(__entry->rdw1) ? "I" : "i", __entry->sg, __entry->num_sgs, __entry->num_mapped_sgs ) ); @@ -666,7 +660,7 @@ DECLARE_EVENT_CLASS(cdnsp_log_td_info, TP_PROTO(struct cdnsp_request *preq), TP_ARGS(preq), TP_STRUCT__entry( - __string(name, preq->pep->name) + __field(u32, edw3) __field(struct usb_request *, request) __field(struct cdnsp_request *, preq) __field(union cdnsp_trb *, first_trb) @@ -674,7 +668,7 @@ DECLARE_EVENT_CLASS(cdnsp_log_td_info, __field(dma_addr_t, trb_dma) ), TP_fast_assign( - __assign_str(name, preq->pep->name); + __entry->edw3 = preq->pep->endpoint.dw3; __entry->request = &preq->request; __entry->preq = preq; __entry->first_trb = preq->td.first_trb; @@ -683,7 +677,7 @@ DECLARE_EVENT_CLASS(cdnsp_log_td_info, preq->td.first_trb) ), TP_printk("%s req/preq: %p/%p, first trb %p[vir]/%pad(dma), last trb %p", - __get_str(name), __entry->request, __entry->preq, + USB_EP_NAME(__entry->edw3), __entry->request, __entry->preq, __entry->first_trb, &__entry->trb_dma, __entry->last_trb ) @@ -800,16 +794,17 @@ TRACE_EVENT(cdnsp_stream_number, TP_PROTO(struct cdnsp_ep *pep, int num_stream_ctxs, int num_streams), TP_ARGS(pep, num_stream_ctxs, num_streams), TP_STRUCT__entry( - __string(name, pep->name) + __field(u32, edw3) __field(int, num_stream_ctxs) __field(int, num_streams) ), TP_fast_assign( + __entry->edw3 = pep->endpoint.dw3; __entry->num_stream_ctxs = num_stream_ctxs; __entry->num_streams = num_streams; ), TP_printk("%s Need %u stream ctx entries for %u stream IDs.", - __get_str(name), __entry->num_stream_ctxs, + USB_EP_NAME(__entry->edw3), __entry->num_stream_ctxs, __entry->num_streams) ); From patchwork Mon Sep 11 04:28:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13378761 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DB7DC71153 for ; Mon, 11 Sep 2023 04:30:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233586AbjIKEac (ORCPT ); Mon, 11 Sep 2023 00:30:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233441AbjIKEab (ORCPT ); Mon, 11 Sep 2023 00:30:31 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E492114 for ; Sun, 10 Sep 2023 21:30:22 -0700 (PDT) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38B4ARPN028709; Mon, 11 Sep 2023 04:29:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=blnruwchVzSqcGB3p/HxMlfMel6o5r+f6uJXG3O50SY=; b=iFXiZ3+MFG2c8QlN4HPw0Ar+oMSo3F7cFbC4JtFnq2L8HrhSx0nNpYHyeKRrFe2XLbFG 5iH7EP5VKevCLXaDZxIVKf4HiQStNlRx3vHiyQm4eL8o1EsETzbf9IlbdDBZQ+vzPYyE XS+SyM2cfyxPlnCzts0xqhDgjDWmmvlBnX8QjZfF3rsISTIb2E4m0gq85+zRn4ecWMu0 cxT/YQyZ92ffkE20J6kdOM5utaC+GsGYL0HD4NQVNlwj2O0isKdPxKDlHvHwkA54d0yW 4bYzUDhFAieBd8xlt7+U99Z+WmyHv03MvPocEwzO9EiKJjAPosfEdz6WI+AqL5JZlDZg 0w== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t1u3yr283-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:29:54 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38B4TrwD022043 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:29:53 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Sun, 10 Sep 2023 21:29:46 -0700 From: Linyu Yuan To: Thinh Nguyen , Peter Chen , Pawel Laszczak , Roger Quadros , Linus Walleij , Chunfeng Yun , Neal Liu , "Cristian Birsan" , Bin Liu , "Kevin Cernekee" , Justin Chen , "Al Cooper" , Li Yang , "Vladimir Zapolskiy" , Daniel Mack , Haojian Zhuang , Robert Jarzmik , "Philipp Zabel" , Herve Codina , hierry Reding , Jonathan Hunter , Michal Simek , Rui Miguel Silva , Valentina Manea , "Shuah Khan" , Hongren Zheng , Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH 07/11] usb: cdns3: trace: reduce buffer usage of trace event Date: Mon, 11 Sep 2023 12:28:39 +0800 Message-ID: <20230911042843.2711-8-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230911042843.2711-1-quic_linyyuan@quicinc.com> References: <20230911042843.2711-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: fGi11yjBmp7z9T02qxTgFQsG_iE9y46_ X-Proofpoint-ORIG-GUID: fGi11yjBmp7z9T02qxTgFQsG_iE9y46_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_01,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 clxscore=1015 phishscore=0 impostorscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=474 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110040 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Save u32 members into trace event ring buffer and parse it for possible bit information. Signed-off-by: Linyu Yuan --- drivers/usb/cdns3/cdns3-trace.h | 93 +++++++++++++++------------------ 1 file changed, 42 insertions(+), 51 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-trace.h b/drivers/usb/cdns3/cdns3-trace.h index 40db89e3333c..391547546530 100644 --- a/drivers/usb/cdns3/cdns3-trace.h +++ b/drivers/usb/cdns3/cdns3-trace.h @@ -28,45 +28,45 @@ TRACE_EVENT(cdns3_halt, TP_PROTO(struct cdns3_endpoint *ep_priv, u8 halt, u8 flush), TP_ARGS(ep_priv, halt, flush), TP_STRUCT__entry( - __string(name, ep_priv->name) + __field(u32, edw3) __field(u8, halt) __field(u8, flush) ), TP_fast_assign( - __assign_str(name, ep_priv->name); + __entry->edw3 = ep_priv->endpoint.dw3; __entry->halt = halt; __entry->flush = flush; ), TP_printk("Halt %s for %s: %s", __entry->flush ? " and flush" : "", - __get_str(name), __entry->halt ? "set" : "cleared") + USB_EP_NAME(__entry->edw3), __entry->halt ? "set" : "cleared") ); TRACE_EVENT(cdns3_wa1, TP_PROTO(struct cdns3_endpoint *ep_priv, char *msg), TP_ARGS(ep_priv, msg), TP_STRUCT__entry( - __string(ep_name, ep_priv->name) + __field(u32, edw3) __string(msg, msg) ), TP_fast_assign( - __assign_str(ep_name, ep_priv->name); + __entry->edw3 = ep_priv->endpoint.dw3; __assign_str(msg, msg); ), - TP_printk("WA1: %s %s", __get_str(ep_name), __get_str(msg)) + TP_printk("WA1: %s %s", USB_EP_NAME(__entry->edw3), __get_str(msg)) ); TRACE_EVENT(cdns3_wa2, TP_PROTO(struct cdns3_endpoint *ep_priv, char *msg), TP_ARGS(ep_priv, msg), TP_STRUCT__entry( - __string(ep_name, ep_priv->name) + __field(u32, edw3) __string(msg, msg) ), TP_fast_assign( - __assign_str(ep_name, ep_priv->name); + __entry->edw3 = ep_priv->endpoint.dw3; __assign_str(msg, msg); ), - TP_printk("WA2: %s %s", __get_str(ep_name), __get_str(msg)) + TP_printk("WA2: %s %s", USB_EP_NAME(__entry->edw3), __get_str(msg)) ); DECLARE_EVENT_CLASS(cdns3_log_doorbell, @@ -118,14 +118,14 @@ DECLARE_EVENT_CLASS(cdns3_log_epx_irq, TP_PROTO(struct cdns3_device *priv_dev, struct cdns3_endpoint *priv_ep), TP_ARGS(priv_dev, priv_ep), TP_STRUCT__entry( - __string(ep_name, priv_ep->name) + __field(u32, edw3) __field(u32, ep_sts) __field(u32, ep_traddr) __field(u32, ep_last_sid) __field(u32, use_streams) ), TP_fast_assign( - __assign_str(ep_name, priv_ep->name); + __entry->edw3 = priv_ep->endpoint.dw3; __entry->ep_sts = readl(&priv_dev->regs->ep_sts); __entry->ep_traddr = readl(&priv_dev->regs->ep_traddr); __entry->ep_last_sid = priv_ep->last_stream_id; @@ -133,7 +133,7 @@ DECLARE_EVENT_CLASS(cdns3_log_epx_irq, ), TP_printk("%s, ep_traddr: %08x ep_last_sid: %08x use_streams: %d", cdns3_decode_epx_irq(__get_buf(CDNS3_MSG_MAX), - __get_str(ep_name), + USB_EP_NAME(__entry->edw3), __entry->ep_sts), __entry->ep_traddr, __entry->ep_last_sid, @@ -199,47 +199,42 @@ DECLARE_EVENT_CLASS(cdns3_log_request, TP_PROTO(struct cdns3_request *req), TP_ARGS(req), TP_STRUCT__entry( - __string(name, req->priv_ep->name) + __field(u32, edw3) __field(struct cdns3_request *, req) __field(void *, buf) __field(unsigned int, actual) __field(unsigned int, length) __field(int, status) - __field(int, zero) - __field(int, short_not_ok) - __field(int, no_interrupt) + __field(u32, rdw1) __field(int, start_trb) __field(int, end_trb) __field(int, flags) __field(unsigned int, stream_id) ), TP_fast_assign( - __assign_str(name, req->priv_ep->name); + __entry->edw3 = req->priv_ep->endpoint.dw3; __entry->req = req; __entry->buf = req->request.buf; __entry->actual = req->request.actual; __entry->length = req->request.length; __entry->status = req->request.status; - __entry->zero = req->request.zero; - __entry->short_not_ok = req->request.short_not_ok; - __entry->no_interrupt = req->request.no_interrupt; + __entry->rdw1 = req->request.dw1; __entry->start_trb = req->start_trb; __entry->end_trb = req->end_trb; __entry->flags = req->flags; - __entry->stream_id = req->request.stream_id; ), TP_printk("%s: req: %p, req buff %p, length: %u/%u %s%s%s, status: %d," " trb: [start:%d, end:%d], flags:%x SID: %u", - __get_str(name), __entry->req, __entry->buf, __entry->actual, + USB_EP_NAME(__entry->edw3), __entry->req, __entry->buf, __entry->actual, __entry->length, - __entry->zero ? "Z" : "z", - __entry->short_not_ok ? "S" : "s", - __entry->no_interrupt ? "I" : "i", + USB_REQ_ZERO(__entry->rdw1) ? "Z" : "z", + USB_REQ_SHORT_NOT_OK(__entry->rdw1) ? "S" : "s", + USB_REQ_NO_INTERRUPT(__entry->rdw1) ? "I" : "i", __entry->status, __entry->start_trb, __entry->end_trb, __entry->flags, - __entry->stream_id + USB_REQ_STREAM_ID(__entry->rdw1) ) ); @@ -287,21 +282,21 @@ DECLARE_EVENT_CLASS(cdns3_stream_split_transfer_len, TP_PROTO(struct cdns3_request *req), TP_ARGS(req), TP_STRUCT__entry( - __string(name, req->priv_ep->name) + __field(u32, edw3) __field(struct cdns3_request *, req) __field(unsigned int, length) __field(unsigned int, actual) __field(unsigned int, stream_id) ), TP_fast_assign( - __assign_str(name, req->priv_ep->name); + __entry->edw3 = req->priv_ep->endpoint.dw3; __entry->req = req; __entry->actual = req->request.length; __entry->length = req->request.actual; __entry->stream_id = req->request.stream_id; ), TP_printk("%s: req: %p,request length: %u actual length: %u SID: %u", - __get_str(name), __entry->req, __entry->length, + USB_EP_NAME(__entry->edw3), __entry->req, __entry->length, __entry->actual, __entry->stream_id) ); @@ -320,7 +315,7 @@ DECLARE_EVENT_CLASS(cdns3_log_aligned_request, TP_PROTO(struct cdns3_request *priv_req), TP_ARGS(priv_req), TP_STRUCT__entry( - __string(name, priv_req->priv_ep->name) + __field(u32, edw3) __field(struct usb_request *, req) __field(void *, buf) __field(dma_addr_t, dma) @@ -329,7 +324,7 @@ DECLARE_EVENT_CLASS(cdns3_log_aligned_request, __field(u32, aligned_buf_size) ), TP_fast_assign( - __assign_str(name, priv_req->priv_ep->name); + __entry->edw3 = priv_req->priv_ep->endpoint.dw3; __entry->req = &priv_req->request; __entry->buf = priv_req->request.buf; __entry->dma = priv_req->request.dma; @@ -338,7 +333,7 @@ DECLARE_EVENT_CLASS(cdns3_log_aligned_request, __entry->aligned_buf_size = priv_req->aligned_buf->size; ), TP_printk("%s: req: %p, req buf %p, dma %pad a_buf %p a_dma %pad, size %d", - __get_str(name), __entry->req, __entry->buf, &__entry->dma, + USB_EP_NAME(__entry->edw3), __entry->req, __entry->buf, &__entry->dma, __entry->aligned_buf, &__entry->aligned_dma, __entry->aligned_buf_size ) @@ -358,19 +353,19 @@ DECLARE_EVENT_CLASS(cdns3_log_map_request, TP_PROTO(struct cdns3_request *priv_req), TP_ARGS(priv_req), TP_STRUCT__entry( - __string(name, priv_req->priv_ep->name) + __field(u32, edw3) __field(struct usb_request *, req) __field(void *, buf) __field(dma_addr_t, dma) ), TP_fast_assign( - __assign_str(name, priv_req->priv_ep->name); + __entry->edw3 = priv_req->priv_ep->endpoint.dw3; __entry->req = &priv_req->request; __entry->buf = priv_req->request.buf; __entry->dma = priv_req->request.dma; ), TP_printk("%s: req: %p, req buf %p, dma %p", - __get_str(name), __entry->req, __entry->buf, &__entry->dma + USB_EP_NAME(__entry->edw3), __entry->req, __entry->buf, &__entry->dma ) ); DEFINE_EVENT(cdns3_log_map_request, cdns3_map_request, @@ -386,7 +381,7 @@ DECLARE_EVENT_CLASS(cdns3_log_trb, TP_PROTO(struct cdns3_endpoint *priv_ep, struct cdns3_trb *trb), TP_ARGS(priv_ep, trb), TP_STRUCT__entry( - __string(name, priv_ep->name) + __field(u32, edw3) __field(struct cdns3_trb *, trb) __field(u32, buffer) __field(u32, length) @@ -395,7 +390,7 @@ DECLARE_EVENT_CLASS(cdns3_log_trb, __field(unsigned int, last_stream_id) ), TP_fast_assign( - __assign_str(name, priv_ep->name); + __entry->edw3 = priv_ep->endpoint.dw3; __entry->trb = trb; __entry->buffer = le32_to_cpu(trb->buffer); __entry->length = le32_to_cpu(trb->length); @@ -404,7 +399,7 @@ DECLARE_EVENT_CLASS(cdns3_log_trb, __entry->last_stream_id = priv_ep->last_stream_id; ), TP_printk("%s: trb %p, dma buf: 0x%08x, size: %ld, burst: %d ctrl: 0x%08x (%s%s%s%s%s%s%s) SID:%lu LAST_SID:%u", - __get_str(name), __entry->trb, __entry->buffer, + USB_EP_NAME(__entry->edw3), __entry->trb, __entry->buffer, TRB_LEN(__entry->length), (u8)TRB_BURST_LEN_GET(__entry->length), __entry->control, @@ -455,24 +450,20 @@ DECLARE_EVENT_CLASS(cdns3_log_ep, TP_PROTO(struct cdns3_endpoint *priv_ep), TP_ARGS(priv_ep), TP_STRUCT__entry( - __string(name, priv_ep->name) - __field(unsigned int, maxpacket) - __field(unsigned int, maxpacket_limit) - __field(unsigned int, max_streams) + __field(u32, edw3) + __field(u32, edw1) + __field(u32, edw2) __field(unsigned int, use_streams) - __field(unsigned int, maxburst) __field(unsigned int, flags) __field(unsigned int, dir) __field(u8, enqueue) __field(u8, dequeue) ), TP_fast_assign( - __assign_str(name, priv_ep->name); - __entry->maxpacket = priv_ep->endpoint.maxpacket; - __entry->maxpacket_limit = priv_ep->endpoint.maxpacket_limit; - __entry->max_streams = priv_ep->endpoint.max_streams; + __entry->edw3 = priv_ep->endpoint.dw3; + __entry->edw2 = priv_ep->endpoint.dw2; + __entry->edw1 = priv_ep->endpoint.dw1; __entry->use_streams = priv_ep->use_streams; - __entry->maxburst = priv_ep->endpoint.maxburst; __entry->flags = priv_ep->flags; __entry->dir = priv_ep->dir; __entry->enqueue = priv_ep->enqueue; @@ -480,10 +471,10 @@ DECLARE_EVENT_CLASS(cdns3_log_ep, ), TP_printk("%s: mps: %d/%d. streams: %d, stream enable: %d, burst: %d, " "enq idx: %d, deq idx: %d, flags %s%s%s%s%s%s%s%s, dir: %s", - __get_str(name), __entry->maxpacket, - __entry->maxpacket_limit, __entry->max_streams, + USB_EP_NAME(__entry->edw3), USB_EP_MAXPACKET(__entry->edw1), + USB_EP_MAXPACKET_LIMIT(__entry->edw1), USB_EP_MAX_STREAMS(__entry->edw2), __entry->use_streams, - __entry->maxburst, __entry->enqueue, + USB_EP_MAXBURST(__entry->edw2), __entry->enqueue, __entry->dequeue, __entry->flags & EP_ENABLED ? "EN | " : "", __entry->flags & EP_STALLED ? "STALLED | " : "", From patchwork Mon Sep 11 04:28:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13378763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 810D1EEB580 for ; Mon, 11 Sep 2023 04:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233605AbjIKEae (ORCPT ); Mon, 11 Sep 2023 00:30:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233520AbjIKEad (ORCPT ); Mon, 11 Sep 2023 00:30:33 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 217311B9 for ; Sun, 10 Sep 2023 21:30:27 -0700 (PDT) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38B3cMwo001546; Mon, 11 Sep 2023 04:30:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=lQCHFsm32bQIeiu/M9SO+qll0UlK2LHjqV3g7opua08=; b=alxG9RAJ9XGy0Q39fg4bW3HX0M1lSCkxnKtwPZ/R/HklF35LgH/LhLVAFa8oeSR8e0uH p3qGx554Fd3j8W/zVPs0yvXYgcOlzL4cDOi+VkbXGiqcJGtymiX9UEWqOY8FYLaKt8u2 78lalfS3bfnEKAKl9wTGzEGqi07aRvHMWVnDfwO5Ru8hlIzUGnKYbPzV9e8pLpcEHR+b 8gnbuu9EC9aCvBYoqMbYmPogOJ442QIUvtlYPxowSVjJk0CCs3RyIuQoRpN+yeYl0Pkm IqULkRHNC3E7X6sHRxylT1PpYEnt+FZTZcNTLqgXeBgAN3sc9M6UNqlM5kU/HGchWJjt UA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t0h3dtfed-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:30:01 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38B4U022007742 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:30:00 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Sun, 10 Sep 2023 21:29:53 -0700 From: Linyu Yuan To: Thinh Nguyen , Peter Chen , Pawel Laszczak , Roger Quadros , Linus Walleij , Chunfeng Yun , Neal Liu , "Cristian Birsan" , Bin Liu , "Kevin Cernekee" , Justin Chen , "Al Cooper" , Li Yang , "Vladimir Zapolskiy" , Daniel Mack , Haojian Zhuang , Robert Jarzmik , "Philipp Zabel" , Herve Codina , hierry Reding , Jonathan Hunter , Michal Simek , Rui Miguel Silva , Valentina Manea , "Shuah Khan" , Hongren Zheng , Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH 08/11] usb: dwc3: trace: reduce buffer usage of trace event Date: Mon, 11 Sep 2023 12:28:40 +0800 Message-ID: <20230911042843.2711-9-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230911042843.2711-1-quic_linyyuan@quicinc.com> References: <20230911042843.2711-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: JrdhnnM36navAOgPZFeAsHFgMgVt5V-h X-Proofpoint-ORIG-GUID: JrdhnnM36navAOgPZFeAsHFgMgVt5V-h X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_01,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 phishscore=0 mlxlogscore=517 adultscore=0 spamscore=0 suspectscore=0 impostorscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110040 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Save u32 members into trace event ring buffer and parse it for possible bit information. Signed-off-by: Linyu Yuan --- drivers/usb/dwc3/trace.h | 54 +++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h index d2997d17cfbe..e1885b83fff8 100644 --- a/drivers/usb/dwc3/trace.h +++ b/drivers/usb/dwc3/trace.h @@ -102,30 +102,26 @@ DECLARE_EVENT_CLASS(dwc3_log_request, TP_PROTO(struct dwc3_request *req), TP_ARGS(req), TP_STRUCT__entry( - __string(name, req->dep->name) + __field(u32, edw3) __field(struct dwc3_request *, req) __field(unsigned int, actual) __field(unsigned int, length) __field(int, status) - __field(int, zero) - __field(int, short_not_ok) - __field(int, no_interrupt) + __field(u32, rdw1) ), TP_fast_assign( - __assign_str(name, req->dep->name); + __entry->edw3 = req->dep->endpoint.dw3; __entry->req = req; __entry->actual = req->request.actual; __entry->length = req->request.length; __entry->status = req->request.status; - __entry->zero = req->request.zero; - __entry->short_not_ok = req->request.short_not_ok; - __entry->no_interrupt = req->request.no_interrupt; + __entry->rdw1 = req->request.dw1; ), TP_printk("%s: req %p length %u/%u %s%s%s ==> %d", - __get_str(name), __entry->req, __entry->actual, __entry->length, - __entry->zero ? "Z" : "z", - __entry->short_not_ok ? "S" : "s", - __entry->no_interrupt ? "i" : "I", + USB_EP_NAME(__entry->edw3), __entry->req, __entry->actual, __entry->length, + USB_REQ_ZERO(__entry->rdw1) ? "Z" : "z", + USB_REQ_SHORT_NOT_OK(__entry->rdw1) ? "S" : "s", + USB_REQ_NO_INTERRUPT(__entry->rdw1) ? "i" : "I", __entry->status ) ); @@ -185,7 +181,7 @@ DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd, struct dwc3_gadget_ep_cmd_params *params, int cmd_status), TP_ARGS(dep, cmd, params, cmd_status), TP_STRUCT__entry( - __string(name, dep->name) + __field(u32, edw3) __field(unsigned int, cmd) __field(u32, param0) __field(u32, param1) @@ -193,7 +189,7 @@ DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd, __field(int, cmd_status) ), TP_fast_assign( - __assign_str(name, dep->name); + __entry->edw3 = dep->endpoint.dw3; __entry->cmd = cmd; __entry->param0 = params->param0; __entry->param1 = params->param1; @@ -201,7 +197,7 @@ DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd, __entry->cmd_status = cmd_status; ), TP_printk("%s: cmd '%s' [%x] params %08x %08x %08x --> status: %s", - __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd), + USB_EP_NAME(__entry->edw3), dwc3_gadget_ep_cmd_string(__entry->cmd), __entry->cmd, __entry->param0, __entry->param1, __entry->param2, dwc3_ep_cmd_status_string(__entry->cmd_status) @@ -218,7 +214,7 @@ DECLARE_EVENT_CLASS(dwc3_log_trb, TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), TP_ARGS(dep, trb), TP_STRUCT__entry( - __string(name, dep->name) + __field(u32, edw3) __field(struct dwc3_trb *, trb) __field(u32, bpl) __field(u32, bph) @@ -229,7 +225,7 @@ DECLARE_EVENT_CLASS(dwc3_log_trb, __field(u32, dequeue) ), TP_fast_assign( - __assign_str(name, dep->name); + __entry->edw3 = dep->endpoint.dw3; __entry->trb = trb; __entry->bpl = trb->bpl; __entry->bph = trb->bph; @@ -240,7 +236,7 @@ DECLARE_EVENT_CLASS(dwc3_log_trb, __entry->dequeue = dep->trb_dequeue; ), TP_printk("%s: trb %p (E%d:D%d) buf %08x%08x size %s%d ctrl %08x sofn %08x (%c%c%c%c:%c%c:%s)", - __get_str(name), __entry->trb, __entry->enqueue, + USB_EP_NAME(__entry->edw3), __entry->trb, __entry->enqueue, __entry->dequeue, __entry->bph, __entry->bpl, ({char *s; int pcm = ((__entry->size >> 24) & 3) + 1; @@ -290,31 +286,27 @@ DECLARE_EVENT_CLASS(dwc3_log_ep, TP_PROTO(struct dwc3_ep *dep), TP_ARGS(dep), TP_STRUCT__entry( - __string(name, dep->name) - __field(unsigned int, maxpacket) - __field(unsigned int, maxpacket_limit) - __field(unsigned int, max_streams) - __field(unsigned int, maxburst) + __field(u32, edw3) + __field(u32, edw1) + __field(u32, edw2) __field(unsigned int, flags) __field(unsigned int, direction) __field(u8, trb_enqueue) __field(u8, trb_dequeue) ), TP_fast_assign( - __assign_str(name, dep->name); - __entry->maxpacket = dep->endpoint.maxpacket; - __entry->maxpacket_limit = dep->endpoint.maxpacket_limit; - __entry->max_streams = dep->endpoint.max_streams; - __entry->maxburst = dep->endpoint.maxburst; + __entry->edw3 = dep->endpoint.dw3; + __entry->edw1 = dep->endpoint.dw1; + __entry->edw2 = dep->endpoint.dw2; __entry->flags = dep->flags; __entry->direction = dep->direction; __entry->trb_enqueue = dep->trb_enqueue; __entry->trb_dequeue = dep->trb_dequeue; ), TP_printk("%s: mps %d/%d streams %d burst %d ring %d/%d flags %c:%c%c%c%c:%c", - __get_str(name), __entry->maxpacket, - __entry->maxpacket_limit, __entry->max_streams, - __entry->maxburst, __entry->trb_enqueue, + USB_EP_NAME(__entry->edw3), USB_EP_MAXPACKET(__entry->edw1), + USB_EP_MAXPACKET_LIMIT(__entry->edw1), USB_EP_MAX_STREAMS(__entry->edw2), + USB_EP_MAXBURST(__entry->edw2), __entry->trb_enqueue, __entry->trb_dequeue, __entry->flags & DWC3_EP_ENABLED ? 'E' : 'e', __entry->flags & DWC3_EP_STALL ? 'S' : 's', From patchwork Mon Sep 11 04:28:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13378766 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EB27EE801F for ; Mon, 11 Sep 2023 04:30:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233603AbjIKEay (ORCPT ); Mon, 11 Sep 2023 00:30:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233610AbjIKEax (ORCPT ); Mon, 11 Sep 2023 00:30:53 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 023E61B8 for ; Sun, 10 Sep 2023 21:30:47 -0700 (PDT) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38B30Bgs003697; Mon, 11 Sep 2023 04:30:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=uL7MgyLPZFAv135B6ZvdmmWkCEIUfI9QS85TJy6OYtw=; b=Vf7e9nV+Q7D3NGVgnhVmFXw1rpQyGyrQGMiKeuqO2p5yYbhjIwurnLlinYC3F9MxxFRO SO6v0l7jQyCSTN7/blaNmTohz+NFvPi1fcv0KL4i5IxdnGrqOwd4s5PD/93RYMWha7GF GWUc95iBEKa+lzcFdmMvDUrFPMzIOPyMLToCwGNHkN7nHhSihzXmbiga6rVDqh8kbZKG 8qJqtb1zd9SvNhMnkORql6gdLLQRgsPZUHWtbbwTpoeJ7lxMXd/xzXXEiQ5O3O6GtiNO CO2iPFnwtyLgGZ74nYnjv/QL/HrHurAYbw72ddbZ5dr65sxrp0bnPgEF3sJ+95osPbDb Rw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t0hfqjms2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:30:08 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38B4U7xf008230 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:30:07 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Sun, 10 Sep 2023 21:30:00 -0700 From: Linyu Yuan To: Thinh Nguyen , Peter Chen , Pawel Laszczak , Roger Quadros , Linus Walleij , Chunfeng Yun , Neal Liu , "Cristian Birsan" , Bin Liu , "Kevin Cernekee" , Justin Chen , "Al Cooper" , Li Yang , "Vladimir Zapolskiy" , Daniel Mack , Haojian Zhuang , Robert Jarzmik , "Philipp Zabel" , Herve Codina , hierry Reding , Jonathan Hunter , Michal Simek , Rui Miguel Silva , Valentina Manea , "Shuah Khan" , Hongren Zheng , Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH 09/11] usb: cdns2: trace: reduce buffer usage of trace event Date: Mon, 11 Sep 2023 12:28:41 +0800 Message-ID: <20230911042843.2711-10-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230911042843.2711-1-quic_linyyuan@quicinc.com> References: <20230911042843.2711-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: fcIbC-TZeMSapnmOnVx7SbzlsAPo2VFd X-Proofpoint-GUID: fcIbC-TZeMSapnmOnVx7SbzlsAPo2VFd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_01,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 suspectscore=0 phishscore=0 mlxlogscore=552 malwarescore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 clxscore=1015 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110041 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Save u32 members into trace event ring buffer and parse it for possible bit information. Signed-off-by: Linyu Yuan --- drivers/usb/gadget/udc/cdns2/cdns2-trace.h | 77 ++++++++++------------ 1 file changed, 35 insertions(+), 42 deletions(-) diff --git a/drivers/usb/gadget/udc/cdns2/cdns2-trace.h b/drivers/usb/gadget/udc/cdns2/cdns2-trace.h index 61f241634ea5..23d15597dbaa 100644 --- a/drivers/usb/gadget/udc/cdns2/cdns2-trace.h +++ b/drivers/usb/gadget/udc/cdns2/cdns2-trace.h @@ -98,46 +98,45 @@ TRACE_EVENT(cdns2_ep_halt, TP_PROTO(struct cdns2_endpoint *ep_priv, u8 halt, u8 flush), TP_ARGS(ep_priv, halt, flush), TP_STRUCT__entry( - __string(name, ep_priv->name) + __field(u32, edw3) __field(u8, halt) __field(u8, flush) ), TP_fast_assign( - __assign_str(name, ep_priv->name); + __entry->edw3 = ep_priv->endpoint.dw3; __entry->halt = halt; __entry->flush = flush; ), TP_printk("Halt %s for %s: %s", __entry->flush ? " and flush" : "", - __get_str(name), __entry->halt ? "set" : "cleared") + USB_EP_NAME(__entry->edw3), __entry->halt ? "set" : "cleared") ); TRACE_EVENT(cdns2_wa1, TP_PROTO(struct cdns2_endpoint *ep_priv, char *msg), TP_ARGS(ep_priv, msg), TP_STRUCT__entry( - __string(ep_name, ep_priv->name) + __field(u32, edw3) __string(msg, msg) ), TP_fast_assign( - __assign_str(ep_name, ep_priv->name); + __entry->edw3 = ep_priv->endpoint.dw3; __assign_str(msg, msg); ), - TP_printk("WA1: %s %s", __get_str(ep_name), __get_str(msg)) + TP_printk("WA1: %s %s", USB_EP_NAME(__entry->edw3), __get_str(msg)) ); DECLARE_EVENT_CLASS(cdns2_log_doorbell, TP_PROTO(struct cdns2_endpoint *pep, u32 ep_trbaddr), TP_ARGS(pep, ep_trbaddr), TP_STRUCT__entry( - __string(name, pep->num ? pep->name : - (pep->dir ? "ep0in" : "ep0out")) + __field(u32, edw3) __field(u32, ep_trbaddr) ), TP_fast_assign( - __assign_str(name, pep->name); + __entry->edw3 = pep->endpoint.dw3; __entry->ep_trbaddr = ep_trbaddr; ), - TP_printk("%s, ep_trbaddr %08x", __get_str(name), + TP_printk("%s, ep_trbaddr %08x", USB_EP_NAME(__entry->edw3), __entry->ep_trbaddr) ); @@ -190,20 +189,20 @@ DECLARE_EVENT_CLASS(cdns2_log_epx_irq, TP_PROTO(struct cdns2_device *pdev, struct cdns2_endpoint *pep), TP_ARGS(pdev, pep), TP_STRUCT__entry( - __string(ep_name, pep->name) + __field(u32, edw3) __field(u32, ep_sts) __field(u32, ep_ists) __field(u32, ep_traddr) ), TP_fast_assign( - __assign_str(ep_name, pep->name); + __entry->edw3 = pep->endpoint.dw3; __entry->ep_sts = readl(&pdev->adma_regs->ep_sts); __entry->ep_ists = readl(&pdev->adma_regs->ep_ists); __entry->ep_traddr = readl(&pdev->adma_regs->ep_traddr); ), TP_printk("%s, ep_traddr: %08x", cdns2_decode_epx_irq(__get_buf(CDNS2_MSG_MAX), CDNS2_MSG_MAX, - __get_str(ep_name), + USB_EP_NAME(__entry->edw3), __entry->ep_ists, __entry->ep_sts), __entry->ep_traddr) ); @@ -270,7 +269,7 @@ DECLARE_EVENT_CLASS(cdns2_log_request, TP_PROTO(struct cdns2_request *preq), TP_ARGS(preq), TP_STRUCT__entry( - __string(name, preq->pep->name) + __field(u32, edw3) __field(struct usb_request *, request) __field(struct cdns2_request *, preq) __field(void *, buf) @@ -278,9 +277,7 @@ DECLARE_EVENT_CLASS(cdns2_log_request, __field(unsigned int, length) __field(int, status) __field(dma_addr_t, dma) - __field(int, zero) - __field(int, short_not_ok) - __field(int, no_interrupt) + __field(u32, rdw1) __field(struct scatterlist*, sg) __field(unsigned int, num_sgs) __field(unsigned int, num_mapped_sgs) @@ -288,7 +285,7 @@ DECLARE_EVENT_CLASS(cdns2_log_request, __field(int, end_trb) ), TP_fast_assign( - __assign_str(name, preq->pep->name); + __entry->edw3 = preq->pep->endpoint.dw3; __entry->request = &preq->request; __entry->preq = preq; __entry->buf = preq->request.buf; @@ -296,9 +293,7 @@ DECLARE_EVENT_CLASS(cdns2_log_request, __entry->length = preq->request.length; __entry->status = preq->request.status; __entry->dma = preq->request.dma; - __entry->zero = preq->request.zero; - __entry->short_not_ok = preq->request.short_not_ok; - __entry->no_interrupt = preq->request.no_interrupt; + __entry->rdw1 = preq->request.dw1; __entry->sg = preq->request.sg; __entry->num_sgs = preq->request.num_sgs; __entry->num_mapped_sgs = preq->request.num_mapped_sgs; @@ -308,12 +303,12 @@ DECLARE_EVENT_CLASS(cdns2_log_request, TP_printk("%s: req: %p, preq: %p, req buf: %p, length: %u/%u, status: %d," "buf dma: (%pad), %s%s%s, sg: %p, num_sgs: %d, num_m_sgs: %d," "trb: [start: %d, end: %d]", - __get_str(name), __entry->request, __entry->preq, + USB_EP_NAME(__entry->edw3), __entry->request, __entry->preq, __entry->buf, __entry->actual, __entry->length, __entry->status, &__entry->dma, - __entry->zero ? "Z" : "z", - __entry->short_not_ok ? "S" : "s", - __entry->no_interrupt ? "I" : "i", + USB_REQ_ZERO(__entry->rdw1) ? "Z" : "z", + USB_REQ_SHORT_NOT_OK(__entry->rdw1) ? "S" : "s", + USB_REQ_NO_INTERRUPT(__entry->rdw1) ? "I" : "i", __entry->sg, __entry->num_sgs, __entry->num_mapped_sgs, __entry->start_trb, __entry->end_trb @@ -374,19 +369,19 @@ DECLARE_EVENT_CLASS(cdns2_log_map_request, TP_PROTO(struct cdns2_request *priv_req), TP_ARGS(priv_req), TP_STRUCT__entry( - __string(name, priv_req->pep->name) + __field(u32, edw3) __field(struct usb_request *, req) __field(void *, buf) __field(dma_addr_t, dma) ), TP_fast_assign( - __assign_str(name, priv_req->pep->name); + __entry->edw3 = priv_req->pep->endpoint.dw3; __entry->req = &priv_req->request; __entry->buf = priv_req->request.buf; __entry->dma = priv_req->request.dma; ), TP_printk("%s: req: %p, req buf %p, dma %p", - __get_str(name), __entry->req, __entry->buf, &__entry->dma + USB_EP_NAME(__entry->edw3), __entry->req, __entry->buf, &__entry->dma ) ); @@ -403,7 +398,7 @@ DECLARE_EVENT_CLASS(cdns2_log_trb, TP_PROTO(struct cdns2_endpoint *pep, struct cdns2_trb *trb), TP_ARGS(pep, trb), TP_STRUCT__entry( - __string(name, pep->name) + __field(u32, edw3) __field(struct cdns2_trb *, trb) __field(u32, buffer) __field(u32, length) @@ -411,7 +406,7 @@ DECLARE_EVENT_CLASS(cdns2_log_trb, __field(u32, type) ), TP_fast_assign( - __assign_str(name, pep->name); + __entry->edw3 = pep->endpoint.dw3; __entry->trb = trb; __entry->buffer = le32_to_cpu(trb->buffer); __entry->length = le32_to_cpu(trb->length); @@ -419,7 +414,7 @@ DECLARE_EVENT_CLASS(cdns2_log_trb, __entry->type = usb_endpoint_type(pep->endpoint.desc); ), TP_printk("%s: trb V: %p, dma buf: P: 0x%08x, %s", - __get_str(name), __entry->trb, __entry->buffer, + USB_EP_NAME(__entry->edw3), __entry->trb, __entry->buffer, cdns2_decode_trb(__get_buf(CDNS2_MSG_MAX), CDNS2_MSG_MAX, __entry->control, __entry->length, __entry->buffer)) @@ -467,18 +462,16 @@ DECLARE_EVENT_CLASS(cdns2_log_ep, TP_PROTO(struct cdns2_endpoint *pep), TP_ARGS(pep), TP_STRUCT__entry( - __string(name, pep->name) - __field(unsigned int, maxpacket) - __field(unsigned int, maxpacket_limit) + __field(u32, edw3) + __field(u32, edw1) __field(unsigned int, flags) __field(unsigned int, dir) __field(u8, enqueue) __field(u8, dequeue) ), TP_fast_assign( - __assign_str(name, pep->name); - __entry->maxpacket = pep->endpoint.maxpacket; - __entry->maxpacket_limit = pep->endpoint.maxpacket_limit; + __entry->edw3 = pep->endpoint.dw3; + __entry->edw1 = pep->endpoint.dw1; __entry->flags = pep->ep_state; __entry->dir = pep->dir; __entry->enqueue = pep->ring.enqueue; @@ -486,8 +479,8 @@ DECLARE_EVENT_CLASS(cdns2_log_ep, ), TP_printk("%s: mps: %d/%d, enq idx: %d, deq idx: %d, " "flags: %s%s%s%s, dir: %s", - __get_str(name), __entry->maxpacket, - __entry->maxpacket_limit, __entry->enqueue, + USB_EP_NAME(__entry->edw3), USB_EP_MAXPACKET(__entry->edw1), + USB_EP_MAXPACKET_LIMIT(__entry->edw1), __entry->enqueue, __entry->dequeue, __entry->flags & EP_ENABLED ? "EN | " : "", __entry->flags & EP_STALLED ? "STALLED | " : "", @@ -559,7 +552,7 @@ DECLARE_EVENT_CLASS(cdns2_log_epx_reg_config, TP_PROTO(struct cdns2_device *pdev, struct cdns2_endpoint *pep), TP_ARGS(pdev, pep), TP_STRUCT__entry( - __string(ep_name, pep->name) + __field(u32, edw3) __field(u8, burst_size) __field(__le16, maxpack_reg) __field(__u8, con_reg) @@ -568,7 +561,7 @@ DECLARE_EVENT_CLASS(cdns2_log_epx_reg_config, __field(u32, ep_cfg_reg) ), TP_fast_assign( - __assign_str(ep_name, pep->name); + __entry->edw3 = pep->endpoint.dw3; __entry->burst_size = pep->trb_burst_size; __entry->maxpack_reg = pep->dir ? readw(&pdev->epx_regs->txmaxpack[pep->num - 1]) : readw(&pdev->epx_regs->rxmaxpack[pep->num - 1]); @@ -581,7 +574,7 @@ DECLARE_EVENT_CLASS(cdns2_log_epx_reg_config, TP_printk("%s, maxpack: %d, con: %02x, dma_ep_sel: %08x, dma_ep_sts_en: %08x" " dma_ep_cfg %08x", - __get_str(ep_name), __entry->maxpack_reg, __entry->con_reg, + USB_EP_NAME(__entry->edw3), __entry->maxpack_reg, __entry->con_reg, __entry->ep_sel_reg, __entry->ep_sts_en_reg, __entry->ep_cfg_reg ) From patchwork Mon Sep 11 04:28:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13378765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12740EE7FF4 for ; Mon, 11 Sep 2023 04:30:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233550AbjIKEaw (ORCPT ); Mon, 11 Sep 2023 00:30:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230319AbjIKEaw (ORCPT ); Mon, 11 Sep 2023 00:30:52 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 610571B9 for ; Sun, 10 Sep 2023 21:30:44 -0700 (PDT) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38B4HI9a010288; Mon, 11 Sep 2023 04:30:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=KqccIIGNtnfdoDGOJUnJYUqRKTvMrrfiH2X4BnobNU4=; b=RIbIMkOvurZy3zrpFxMibaEFECJ3MYXtPR/tYnDx9m1aGgra3CG9AmfA8kg6oOw0MGAG U/rJd8s2ogrBdwhPyoVtos/pDtFJMsyWW28WgXes/H+93U2uyJAYUVIAZSgM6juDRJAj dqLW71INomvfnjchEGWmRSHX0l7Ursj7xGuFrbPoquUeTnA41PMxF3Gh0nEhM8o7hOou sUFNReGlOhBR2MMrYdYoYYXp5d7lEc61pMdttXwi0thZC/htcnxn99QqUbZ68mT2UPGQ pY1xpll4A0zaIdzsZXfPmEfvBGwH+pFTZ32imVm9sFPgCpzPvan98pkODjXhT//4Tb2t Rg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t1u3yr295-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:30:16 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38B4UFXn022653 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:30:15 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Sun, 10 Sep 2023 21:30:07 -0700 From: Linyu Yuan To: Thinh Nguyen , Peter Chen , Pawel Laszczak , Roger Quadros , Linus Walleij , Chunfeng Yun , Neal Liu , "Cristian Birsan" , Bin Liu , "Kevin Cernekee" , Justin Chen , "Al Cooper" , Li Yang , "Vladimir Zapolskiy" , Daniel Mack , Haojian Zhuang , Robert Jarzmik , "Philipp Zabel" , Herve Codina , hierry Reding , Jonathan Hunter , Michal Simek , Rui Miguel Silva , Valentina Manea , "Shuah Khan" , Hongren Zheng , Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH 10/11] usb: mtu3: trace: reduce buffer usage of trace event Date: Mon, 11 Sep 2023 12:28:42 +0800 Message-ID: <20230911042843.2711-11-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230911042843.2711-1-quic_linyyuan@quicinc.com> References: <20230911042843.2711-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: bVR6iDAVAusPnMHKQk9-jolUKiP8NpXc X-Proofpoint-ORIG-GUID: bVR6iDAVAusPnMHKQk9-jolUKiP8NpXc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_01,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 clxscore=1015 phishscore=0 impostorscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=486 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110040 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Save u32 members into trace event ring buffer and parse it for possible bit information. Signed-off-by: Linyu Yuan --- drivers/usb/mtu3/mtu3_trace.h | 42 ++++++++++++++++------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_trace.h b/drivers/usb/mtu3/mtu3_trace.h index 03d2a9bac27e..bfd97958c8a6 100644 --- a/drivers/usb/mtu3/mtu3_trace.h +++ b/drivers/usb/mtu3/mtu3_trace.h @@ -117,30 +117,28 @@ DECLARE_EVENT_CLASS(mtu3_log_request, TP_PROTO(struct mtu3_request *mreq), TP_ARGS(mreq), TP_STRUCT__entry( - __string(name, mreq->mep->name) + __field(u32, edw3) __field(struct mtu3_request *, mreq) __field(struct qmu_gpd *, gpd) __field(unsigned int, actual) __field(unsigned int, length) __field(int, status) - __field(int, zero) - __field(int, no_interrupt) + __field(u32, rdw1) ), TP_fast_assign( - __assign_str(name, mreq->mep->name); + __entry->edw3 = mreq->mep->ep.dw3; __entry->mreq = mreq; __entry->gpd = mreq->gpd; __entry->actual = mreq->request.actual; __entry->length = mreq->request.length; __entry->status = mreq->request.status; - __entry->zero = mreq->request.zero; - __entry->no_interrupt = mreq->request.no_interrupt; + __entry->rdw1 = mreq->request.dw1; ), TP_printk("%s: req %p gpd %p len %u/%u %s%s --> %d", - __get_str(name), __entry->mreq, __entry->gpd, + USB_EP_NAME(__entry->edw3), __entry->mreq, __entry->gpd, __entry->actual, __entry->length, - __entry->zero ? "Z" : "z", - __entry->no_interrupt ? "i" : "I", + USB_REQ_ZERO(__entry->rdw1) ? "Z" : "z", + USB_REQ_NO_INTERRUPT(__entry->rdw1) ? "i" : "I", __entry->status ) ); @@ -174,7 +172,7 @@ DECLARE_EVENT_CLASS(mtu3_log_gpd, TP_PROTO(struct mtu3_ep *mep, struct qmu_gpd *gpd), TP_ARGS(mep, gpd), TP_STRUCT__entry( - __string(name, mep->name) + __field(u32, edw3) __field(struct qmu_gpd *, gpd) __field(u32, dw0) __field(u32, dw1) @@ -182,7 +180,7 @@ DECLARE_EVENT_CLASS(mtu3_log_gpd, __field(u32, dw3) ), TP_fast_assign( - __assign_str(name, mep->name); + __entry->edw3 = mep->ep.dw3; __entry->gpd = gpd; __entry->dw0 = le32_to_cpu(gpd->dw0_info); __entry->dw1 = le32_to_cpu(gpd->next_gpd); @@ -190,7 +188,7 @@ DECLARE_EVENT_CLASS(mtu3_log_gpd, __entry->dw3 = le32_to_cpu(gpd->dw3_info); ), TP_printk("%s: gpd %p - %08x %08x %08x %08x", - __get_str(name), __entry->gpd, + USB_EP_NAME(__entry->edw3), __entry->gpd, __entry->dw0, __entry->dw1, __entry->dw2, __entry->dw3 ) @@ -215,31 +213,29 @@ DECLARE_EVENT_CLASS(mtu3_log_ep, TP_PROTO(struct mtu3_ep *mep), TP_ARGS(mep), TP_STRUCT__entry( - __string(name, mep->name) + __field(u32, edw3) __field(unsigned int, type) __field(unsigned int, slot) - __field(unsigned int, maxp) - __field(unsigned int, mult) - __field(unsigned int, maxburst) + __field(u32, edw1) + __field(u32, edw2) __field(unsigned int, flags) __field(unsigned int, direction) __field(struct mtu3_gpd_ring *, gpd_ring) ), TP_fast_assign( - __assign_str(name, mep->name); + __entry->edw3 = mep->ep.dw3; __entry->type = mep->type; __entry->slot = mep->slot; - __entry->maxp = mep->ep.maxpacket; - __entry->mult = mep->ep.mult; - __entry->maxburst = mep->ep.maxburst; + __entry->edw1 = mep->ep.dw1; + __entry->edw2 = mep->ep.dw2; __entry->flags = mep->flags; __entry->direction = mep->is_in; __entry->gpd_ring = &mep->gpd_ring; ), TP_printk("%s: type %s maxp %d slot %d mult %d burst %d ring %p/%pad flags %c:%c%c%c:%c", - __get_str(name), usb_ep_type_string(__entry->type), - __entry->maxp, __entry->slot, - __entry->mult, __entry->maxburst, + USB_EP_NAME(__entry->edw3), usb_ep_type_string(__entry->type), + USB_EP_MAXPACKET(__entry->edw1), __entry->slot, + USB_EP_MULT(__entry->edw2), USB_EP_MAXBURST(__entry->edw2), __entry->gpd_ring, &__entry->gpd_ring->dma, __entry->flags & MTU3_EP_ENABLED ? 'E' : 'e', __entry->flags & MTU3_EP_STALL ? 'S' : 's', From patchwork Mon Sep 11 04:28:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linyu Yuan X-Patchwork-Id: 13378767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 193AEC71153 for ; Mon, 11 Sep 2023 04:31:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233625AbjIKEbH (ORCPT ); Mon, 11 Sep 2023 00:31:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232202AbjIKEbG (ORCPT ); Mon, 11 Sep 2023 00:31:06 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A3261B8 for ; Sun, 10 Sep 2023 21:30:59 -0700 (PDT) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38B3RDD6026054; Mon, 11 Sep 2023 04:30:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=vogQ9BdTbk1jbLRfLkAnjtnxtgl/Xd0k2IYPo76tphE=; b=NHE9UI2aAg4cayWE3MxHlQ7iI0D5ACYxbw1eEqcnKKwVanDBx2dclkRSpQwuXxdmGqd6 PztOoCG2X/oXGhlGT21fBejOgTKOhCKwf6X+bOS/AOqNv32LXm0QNw2E4vxw8vEtJGtB j3pno0qrua+qyXnPlZP9rVb8SA8hWLXWwk2MTxCdvPABLKxE/zwiZPJfIwGHhA4m+E0u 1Sn0208cL/5RTswYhhij9n9E9Jg6x+K+cE2MGih9ESC8hBumdUOCbCVFYUWrHLVXcspI szCEuMkaJHNDvrqk1x5rIIghJLIfAsECCJ0unZGOxFc9Sp4QoZXudSLyLUoTlsbmkLa3 mQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t0hfqjmsf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:30:23 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38B4UM4N017111 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Sep 2023 04:30:22 GMT Received: from linyyuan-gv.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Sun, 10 Sep 2023 21:30:15 -0700 From: Linyu Yuan To: Thinh Nguyen , Peter Chen , Pawel Laszczak , Roger Quadros , Linus Walleij , Chunfeng Yun , Neal Liu , "Cristian Birsan" , Bin Liu , "Kevin Cernekee" , Justin Chen , "Al Cooper" , Li Yang , "Vladimir Zapolskiy" , Daniel Mack , Haojian Zhuang , Robert Jarzmik , "Philipp Zabel" , Herve Codina , hierry Reding , Jonathan Hunter , Michal Simek , Rui Miguel Silva , Valentina Manea , "Shuah Khan" , Hongren Zheng , Greg Kroah-Hartman CC: , Linyu Yuan Subject: [PATCH 11/11] usb: musb: trace: reduce buffer usage of trace event Date: Mon, 11 Sep 2023 12:28:43 +0800 Message-ID: <20230911042843.2711-12-quic_linyyuan@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230911042843.2711-1-quic_linyyuan@quicinc.com> References: <20230911042843.2711-1-quic_linyyuan@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: Ji19IHwdPBhjOpMAu4QnfMeQyNpY4av2 X-Proofpoint-GUID: Ji19IHwdPBhjOpMAu4QnfMeQyNpY4av2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_01,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 suspectscore=0 phishscore=0 mlxlogscore=446 malwarescore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 clxscore=1015 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110041 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Save u32 member into trace event ring buffer and parse it for possible bit information. Signed-off-by: Linyu Yuan --- drivers/usb/musb/musb_trace.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/usb/musb/musb_trace.h b/drivers/usb/musb/musb_trace.h index f246b14394c4..6986a89767a2 100644 --- a/drivers/usb/musb/musb_trace.h +++ b/drivers/usb/musb/musb_trace.h @@ -243,9 +243,7 @@ DECLARE_EVENT_CLASS(musb_req, __field(int, status) __field(unsigned int, buf_len) __field(unsigned int, actual_len) - __field(unsigned int, zero) - __field(unsigned int, short_not_ok) - __field(unsigned int, no_interrupt) + __field(u32, rdw1) ), TP_fast_assign( __entry->req = &req->request; @@ -254,16 +252,14 @@ DECLARE_EVENT_CLASS(musb_req, __entry->status = req->request.status; __entry->buf_len = req->request.length; __entry->actual_len = req->request.actual; - __entry->zero = req->request.zero; - __entry->short_not_ok = req->request.short_not_ok; - __entry->no_interrupt = req->request.no_interrupt; + __entry->rdw1 = req->request.dw1; ), TP_printk("%p, ep%d %s, %s%s%s, len %d/%d, status %d", __entry->req, __entry->epnum, __entry->is_tx ? "tx/IN" : "rx/OUT", - __entry->zero ? "Z" : "z", - __entry->short_not_ok ? "S" : "s", - __entry->no_interrupt ? "I" : "i", + USB_REQ_ZERO(__entry->rdw1) ? "Z" : "z", + USB_REQ_SHORT_NOT_OK(__entry->rdw1) ? "S" : "s", + USB_REQ_NO_INTERRUPT(__entry->rdw1) ? "I" : "i", __entry->actual_len, __entry->buf_len, __entry->status )