Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1178582lqb; Thu, 18 Apr 2024 02:25:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWtyEvCoxVHCHVwr6fYbNCtO4dducx9BoVlrd0VEoHYrV56k/KMd1CFizmFtBrJLjBwQnqTQWZttcPQ4wZbq8jYeHJ2qH8Kkl4OwR2TIw== X-Google-Smtp-Source: AGHT+IFWRn2xE1wZZc3FIScRqsx2S/xE+2SlY88TRSWEztl5GSXgmS0wU/EQHIp8XDA97fNOhjsf X-Received: by 2002:a50:baaf:0:b0:570:1ddf:ab1b with SMTP id x44-20020a50baaf000000b005701ddfab1bmr1817216ede.2.1713432327830; Thu, 18 Apr 2024 02:25:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713432327; cv=pass; d=google.com; s=arc-20160816; b=Im7D7NLIV5jkCc7BPyBSBvkQlAzj462N5ivmZnKaQxOcWel+Koo8erRuqlVec05KJx j/sBD2XOqMlO3BtOV7brfYAx1O+/ZYdsPyLJIJYxVXpJ7G0ldMkDcn0kjtwHj+4MZ7Ne wsgOiUuVyP4QQ7KWjO2hlvHgsjrLndPzsL2wc42Asu8zTbhw7mRxNdNkRcxzyzXrm4Jx /LwX7fVx1DhdlLxFGQCG77XzTGFNv9MdOjioJ/mdJkROAJX2iLQJ/A4XGNGYSVwRjlAh oZlAm+84VH80QQzEhjLidX6FFMUscqwC0LOVb3VDZj3rvTyN0v5UFnleZa+WxW+xvSsE CyoQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:feedback-id:dkim-signature:dkim-signature; bh=HJ3aHw2ntpRqnqoos49E4hWJ+XH7yH2ocsiFtJ2lzRs=; fh=5EQyDiYgg+kua2A2AF9eJME8jasrrRA/Pgg86y+lzvY=; b=JnogC3Dd8xXI78Rlnh1KmgNqfCUWIxrGYPMhaFLqJv+az1SK5D6kHz4l7dZmqCzxpS JMAN4iRtT/sL1KOvCpChsA+oTdVm3Z8pMMFHfZ5MUs3T8K+gxfPimMMC1d0QYpuwJ5hS ifO8uIwp6hvcNUKOyaiizdnJ2kH8g7HyPggnVn1NtqtKrnI96wCSdHEDPcju9myr/1w2 jzjP259NOkauMMLvNuVm7nBOuN0xkntxMNQQA6wuDfR+ubzBSZ8KqjYkStQW4BSX6elk 5aTZLEtnnpefAExCQPqAz6AmuJ1GnoiLHz8VUzql5b6++JrKSYebSNEKd8QOWq7NJXKG vFCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm3 header.b=GVKFDobg; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=jYCnF71i; arc=pass (i=1 spf=pass spfdomain=sakamocchi.jp dkim=pass dkdomain=sakamocchi.jp dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=sakamocchi.jp); spf=pass (google.com: domain of linux-kernel+bounces-149799-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149799-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sakamocchi.jp Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k24-20020a056402049800b0056e0b92b647si646794edv.242.2024.04.18.02.25.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 02:25:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149799-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm3 header.b=GVKFDobg; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=jYCnF71i; arc=pass (i=1 spf=pass spfdomain=sakamocchi.jp dkim=pass dkdomain=sakamocchi.jp dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=sakamocchi.jp); spf=pass (google.com: domain of linux-kernel+bounces-149799-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149799-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sakamocchi.jp Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 663E11F2247E for ; Thu, 18 Apr 2024 09:25:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9631815E5B0; Thu, 18 Apr 2024 09:23:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="GVKFDobg"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="jYCnF71i" Received: from fout6-smtp.messagingengine.com (fout6-smtp.messagingengine.com [103.168.172.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B831815E1F0 for ; Thu, 18 Apr 2024 09:23:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.149 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713432205; cv=none; b=kz++oqlFlKpLkq0PHZOw0HlztXIxdCIZrv4AI+LBZz1JZODajdmCkL93opFgpxjfIhRA1cxMNmzw4eucOxeBNpQCm/HufJnd4iM4YrIuN6gb1v//eNhW7CvLCM7MsZ5CKMeTGwzbJSA96ow51sCmXRU34HJQi0tvKA4yseV4KpI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713432205; c=relaxed/simple; bh=YYd24lzdOEAiopxmzeWnvG3MqZg5713h5PUFbBbZh6g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HmxZ+5ygGIMDEiexaiRxjXzTm8WkcLixVozDXR49WY2/hsXcOVK+jrRjTlEfMpiLdbhB/Nr45UpxKcAqVDUG0x+nW0fzeJHocMa9/Kyxp8oQ2CKAGHh7cGlj89/+Zp1cuG4Y6AKxgKSwCKp0tWeEguKQwoWlXJF0PkoZaEHY3LA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp; spf=pass smtp.mailfrom=sakamocchi.jp; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b=GVKFDobg; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=jYCnF71i; arc=none smtp.client-ip=103.168.172.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sakamocchi.jp Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfout.nyi.internal (Postfix) with ESMTP id D4F8113800C6; Thu, 18 Apr 2024 05:23:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 18 Apr 2024 05:23:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm3; t=1713432202; x= 1713518602; bh=HJ3aHw2ntpRqnqoos49E4hWJ+XH7yH2ocsiFtJ2lzRs=; b=G VKFDobg+YjM+jyKPdvZmoV0f7KvXBLV406VfF0atmc3m9oWmhZ9lTiFupWZVMlFP q+dt3HrxboPkuGL8J9dInaMnM1ORs8taYxzD0AvacRmEzUNjF6Aah4KOCN3mNRAe xjyKshclp9phxPmKYqpr34MFcmTd84liMRvX7HLj5jnFlzRooibwF2QXs1yyQbCm XEkvbHL3qQHEKnqWf8qMTewIQoa5e02m0PI4xeXdF9KQE4inDvlD9AKr7S7imoB3 deKrGMoLd0QyPVrS0SjI2uOeV3rqzt4x5yMNB7iUvECvUf3lLMdPRc1CssRE1l+W c8twBKXdH0oKNULl1zPhQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1713432202; x= 1713518602; bh=HJ3aHw2ntpRqnqoos49E4hWJ+XH7yH2ocsiFtJ2lzRs=; b=j YCnF71imnzATdTUYfKxZAb4G+nE085BHkYhBbc+yV+bl0vHGgO5jXkMcxJh5Q6Va Doi94TxcACHQ92CPCN8QaCTOHCA+NA4ZW48kA2L6aoQWcaGLBlLFSubouqCi2X9Y gyluSsdUDQ98PXhQDKDzEKtdAWm0G5tBMjFt/PPhhsvlru7fkDvqt68Z1LTp4SmY banjcDHDBvO2E52oVbXkxFe/+VmdO2WFPprxA1Ro41Wk/ytMgiit6tAl9nCudW1y SvgwC3dWZ4fzLDXcVptjpUk03UWjuuhC8+fFHSP44N9/FVqcBoM7//QbQAFCn1CT eKcuzimtsQIf4T581wFtg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudektddgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgje euvdfguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 18 Apr 2024 05:23:21 -0400 (EDT) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org Subject: [RFC PATCH 11/13] firewire: core: add tracepoints event for asynchronous inbound response Date: Thu, 18 Apr 2024 18:23:01 +0900 Message-ID: <20240418092303.19725-12-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240418092303.19725-11-o-takashi@sakamocchi.jp> References: <20240418092303.19725-1-o-takashi@sakamocchi.jp> <20240418092303.19725-2-o-takashi@sakamocchi.jp> <20240418092303.19725-3-o-takashi@sakamocchi.jp> <20240418092303.19725-4-o-takashi@sakamocchi.jp> <20240418092303.19725-5-o-takashi@sakamocchi.jp> <20240418092303.19725-6-o-takashi@sakamocchi.jp> <20240418092303.19725-7-o-takashi@sakamocchi.jp> <20240418092303.19725-8-o-takashi@sakamocchi.jp> <20240418092303.19725-9-o-takashi@sakamocchi.jp> <20240418092303.19725-10-o-takashi@sakamocchi.jp> <20240418092303.19725-11-o-takashi@sakamocchi.jp> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In the transaction of IEEE 1394, the node to receive the asynchronous request transfers response packet to the requester. This commit adds an event for the incoming packet. Note that the code to decode the packet header is moved, against the note about the sanity check. Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-transaction.c | 54 +++++++++++++++-------------- drivers/firewire/trace.h | 48 +++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 26 deletions(-) diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c index 11a60094182a..977d8a36f969 100644 --- a/drivers/firewire/core-transaction.c +++ b/drivers/firewire/core-transaction.c @@ -1010,32 +1010,10 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) source = async_header_get_source(p->header); rcode = async_header_get_rcode(p->header); - spin_lock_irqsave(&card->lock, flags); - list_for_each_entry(iter, &card->transaction_list, link) { - if (iter->node_id == source && iter->tlabel == tlabel) { - if (!try_cancel_split_timeout(iter)) { - spin_unlock_irqrestore(&card->lock, flags); - goto timed_out; - } - list_del_init(&iter->link); - card->tlabel_mask &= ~(1ULL << iter->tlabel); - t = iter; - break; - } - } - spin_unlock_irqrestore(&card->lock, flags); - - if (!t) { - timed_out: - fw_notice(card, "unsolicited response (source %x, tlabel %x)\n", - source, tlabel); - return; - } - - /* - * FIXME: sanity check packet, is length correct, does tcodes - * and addresses match. - */ + // FIXME: sanity check packet, is length correct, does tcodes + // and addresses match to the transaction request queried later. + // + // For the tracepoints event, let us decode the header here against the concern. switch (tcode) { case TCODE_READ_QUADLET_RESPONSE: @@ -1061,6 +1039,30 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) break; } + spin_lock_irqsave(&card->lock, flags); + list_for_each_entry(iter, &card->transaction_list, link) { + if (iter->node_id == source && iter->tlabel == tlabel) { + if (!try_cancel_split_timeout(iter)) { + spin_unlock_irqrestore(&card->lock, flags); + goto timed_out; + } + list_del_init(&iter->link); + card->tlabel_mask &= ~(1ULL << iter->tlabel); + t = iter; + break; + } + } + spin_unlock_irqrestore(&card->lock, flags); + + trace_async_response_inbound(card, t, p, data, data_length / 4); + + if (!t) { + timed_out: + fw_notice(card, "unsolicited response (source %x, tlabel %x)\n", + source, tlabel); + return; + } + /* * The response handler may be executed while the request handler * is still pending. Cancel the request handler. diff --git a/drivers/firewire/trace.h b/drivers/firewire/trace.h index 0f7d176ba647..5187f5f2b140 100644 --- a/drivers/firewire/trace.h +++ b/drivers/firewire/trace.h @@ -88,6 +88,54 @@ TRACE_EVENT(async_request_outbound_complete, ) ) +TRACE_EVENT(async_response_inbound, + TP_PROTO(const struct fw_card *card, const struct fw_transaction *transaction, + const struct fw_packet *packet, u32 *data, unsigned int data_count), + TP_ARGS(card, transaction, packet, data, data_count), + TP_STRUCT__entry( + __field(u64, transaction) + __field(u8, scode) + __field(u8, generation) + __field(u16, timestamp) + __field(u16, destination) + __field(u8, tlabel) + __field(u8, retry) + __field(u8, tcode) + __field(u8, priority) + __field(u16, source) + __field(u8, rcode) + __dynamic_array(u32, data, data_count) + ), + TP_fast_assign( + __entry->transaction = (u64)transaction; + __entry->scode = packet->speed; + __entry->timestamp = packet->timestamp; + __entry->destination = async_header_get_destination(packet->header); + __entry->tlabel = async_header_get_tlabel(packet->header); + __entry->retry = async_header_get_retry(packet->header); + __entry->tcode = async_header_get_tcode(packet->header); + __entry->priority = async_header_get_priority(packet->header); + __entry->source = async_header_get_source(packet->header); + __entry->rcode = async_header_get_rcode(packet->header); + memcpy(__get_dynamic_array(data), data, __get_dynamic_array_len(data)); + ), + TP_printk( + "transaction=0x%llx scode=%u timestamp=0x%04x dst_id=0x%04x tlabel=%u retry=%u tcode=%u priority=%u src_id=0x%04x rcode=%u data=%s", + __entry->transaction, + __entry->scode, + __entry->timestamp, + __entry->destination, + __entry->tlabel, + __entry->retry, + __entry->tcode, + __entry->priority, + __entry->source, + __entry->rcode, + __print_array(__get_dynamic_array(data), + __get_dynamic_array_len(data) / sizeof(u32), sizeof(u32)) + ) +) + #endif // _FIREWIRE_TRACE_EVENT_H #define TRACE_INCLUDE_PATH . -- 2.43.0