From patchwork Wed Jul 22 14:40:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 247016 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp595280ilg; Wed, 22 Jul 2020 07:40:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyC9ESKkBym8JOKZkL+rB7rX71Ws01eJhzyBQv0AgEzibPy8Lm8ITNaCNxl0MMCWnW0o9Ff X-Received: by 2002:a17:906:1756:: with SMTP id d22mr1376986eje.29.1595428849722; Wed, 22 Jul 2020 07:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595428849; cv=none; d=google.com; s=arc-20160816; b=vbgrxKNhgg+XISzVXLl47yy8I01kgDQqGGUTqZJ94tp9vAt0nj+E96rqt3s8QGwx8d NCEPnPWh8SnhdlXYKcepLvBAJtAPYoubv/oizSe3kzA2oTwZ/yimP5PubBL/6+mjha0S yjGkRMvlXgWDBThTVOHfpJfZwq49TNzVMFfqxL7dZLfODlpJAFnvTP1KBHkF/AALtIDW OWsAVxk4fPFgJQlerfqlVHXFdL9jne8myF5wU+lu3awEsVgU8HHiCOSM675FuhQ/o7C9 A7qUHrr41riRIBXP7cBqQgO1iIqJiTgsqVK+UQRrHxGgQoaybKxdAgzgfI2dZLVzOIcr GeMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=DIxOOQwIi12wLQSGUItZsPXBRsZgdqTGMtvo+XZ3cO0=; b=gSRuBgEi3IHQbyQBRz37QFDuaHSHvI0h+v65PCLNeOttYnhdqI/fxNwui2XkIgtocZ mJV7BVM8YFDT/72OZ/zHNAwdjWBFDz2V7uX9ZiHRL5zwGWtodpUXYjjJ/89L32Zlr/jC iJ6X1G7X6N3AR0oSIzAXpcfNZA39Qy2uTnOWVX2CpPSK+kHU9U6Dqe/pD9D9rFk5FlJJ ELz5nwrMViqzihzLNe0gUe0W4Wwad3spjmd3sKUulvE3JXmGJhyhnpquv0kdWlBa/o5q vcv1uSwSHMUN/FvqlKN0fUrsOvdd7K8ujYFIy3XyVHf/lSFhUoJh1i8AVOVLylH6MeIi p6Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=HNIL8Zlz; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y16si123161ejq.260.2020.07.22.07.40.49; Wed, 22 Jul 2020 07:40:49 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=HNIL8Zlz; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732703AbgGVOkm (ORCPT + 9 others); Wed, 22 Jul 2020 10:40:42 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:48442 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732657AbgGVOkb (ORCPT ); Wed, 22 Jul 2020 10:40:31 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06MEeQSd111116; Wed, 22 Jul 2020 09:40:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1595428826; bh=DIxOOQwIi12wLQSGUItZsPXBRsZgdqTGMtvo+XZ3cO0=; h=From:To:Subject:Date:In-Reply-To:References; b=HNIL8ZlzDxm7H3H1awpXNdTzi5TO+oUo172vVcxxsVGIU1G5Z3v4J34r9uALBIxOn WoOML6D8gA86X6jj7HidLdotXPDxIOH6pTw2Byw8ZZDTXAnOtZii3CsGWQxJk3g+C9 bxfyvaJniIQJePPFc8wBeGvFGhvGkG0VR9U1Cqs4= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 06MEeQSC073594 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 22 Jul 2020 09:40:26 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 22 Jul 2020 09:40:26 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 22 Jul 2020 09:40:26 -0500 Received: from uda0868495.fios-router.home (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06MEeMLF043940; Wed, 22 Jul 2020 09:40:26 -0500 From: Murali Karicheri To: , , , , , , , Subject: [net-next v5 PATCH 7/7] net: prp: enhance debugfs to display PRP info Date: Wed, 22 Jul 2020 10:40:22 -0400 Message-ID: <20200722144022.15746-8-m-karicheri2@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200722144022.15746-1-m-karicheri2@ti.com> References: <20200722144022.15746-1-m-karicheri2@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Print PRP specific information from node table as part of debugfs node table display. Also display the node as DAN-H or DAN-P depending on the info from node table. Signed-off-by: Murali Karicheri --- net/hsr/hsr_debugfs.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/net/hsr/hsr_debugfs.c b/net/hsr/hsr_debugfs.c index c1932c0a15be..3b6f675bd55a 100644 --- a/net/hsr/hsr_debugfs.c +++ b/net/hsr/hsr_debugfs.c @@ -24,7 +24,7 @@ static struct dentry *hsr_debugfs_root_dir; static void print_mac_address(struct seq_file *sfp, unsigned char *mac) { - seq_printf(sfp, "%02x:%02x:%02x:%02x:%02x:%02x:", + seq_printf(sfp, "%02x:%02x:%02x:%02x:%02x:%02x ", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } @@ -35,20 +35,32 @@ hsr_node_table_show(struct seq_file *sfp, void *data) struct hsr_priv *priv = (struct hsr_priv *)sfp->private; struct hsr_node *node; - seq_puts(sfp, "Node Table entries\n"); - seq_puts(sfp, "MAC-Address-A, MAC-Address-B, time_in[A], "); - seq_puts(sfp, "time_in[B], Address-B port\n"); + seq_printf(sfp, "Node Table entries for (%s) device\n", + (priv->prot_version == PRP_V1 ? "PRP" : "HSR")); + seq_puts(sfp, "MAC-Address-A, MAC-Address-B, time_in[A], "); + seq_puts(sfp, "time_in[B], Address-B port, "); + if (priv->prot_version == PRP_V1) + seq_puts(sfp, "SAN-A, SAN-B, DAN-P\n"); + else + seq_puts(sfp, "DAN-H\n"); + rcu_read_lock(); list_for_each_entry_rcu(node, &priv->node_db, mac_list) { /* skip self node */ if (hsr_addr_is_self(priv, node->macaddress_A)) continue; print_mac_address(sfp, &node->macaddress_A[0]); - seq_puts(sfp, " "); print_mac_address(sfp, &node->macaddress_B[0]); - seq_printf(sfp, "0x%lx, ", node->time_in[HSR_PT_SLAVE_A]); - seq_printf(sfp, "0x%lx ", node->time_in[HSR_PT_SLAVE_B]); - seq_printf(sfp, "0x%x\n", node->addr_B_port); + seq_printf(sfp, "%10lx, ", node->time_in[HSR_PT_SLAVE_A]); + seq_printf(sfp, "%10lx, ", node->time_in[HSR_PT_SLAVE_B]); + seq_printf(sfp, "%14x, ", node->addr_B_port); + + if (priv->prot_version == PRP_V1) + seq_printf(sfp, "%5x, %5x, %5x\n", + node->san_a, node->san_b, + (node->san_a == 0 && node->san_b == 0)); + else + seq_printf(sfp, "%5x\n", 1); } rcu_read_unlock(); return 0; @@ -57,7 +69,8 @@ hsr_node_table_show(struct seq_file *sfp, void *data) /* hsr_node_table_open - Open the node_table file * * Description: - * This routine opens a debugfs file node_table of specific hsr device + * This routine opens a debugfs file node_table of specific hsr + * or prp device */ static int hsr_node_table_open(struct inode *inode, struct file *filp)