Commit 795ec4f5 authored by Murali Karicheri's avatar Murali Karicheri Committed by David S. Miller

net: prp: enhance debugfs to display PRP info

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: default avatarMurali Karicheri <m-karicheri2@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 451d8123
...@@ -24,7 +24,7 @@ static struct dentry *hsr_debugfs_root_dir; ...@@ -24,7 +24,7 @@ static struct dentry *hsr_debugfs_root_dir;
static void print_mac_address(struct seq_file *sfp, unsigned char *mac) 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]); 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) ...@@ -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_priv *priv = (struct hsr_priv *)sfp->private;
struct hsr_node *node; struct hsr_node *node;
seq_puts(sfp, "Node Table entries\n"); seq_printf(sfp, "Node Table entries for (%s) device\n",
seq_puts(sfp, "MAC-Address-A, MAC-Address-B, time_in[A], "); (priv->prot_version == PRP_V1 ? "PRP" : "HSR"));
seq_puts(sfp, "time_in[B], Address-B port\n"); 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(); rcu_read_lock();
list_for_each_entry_rcu(node, &priv->node_db, mac_list) { list_for_each_entry_rcu(node, &priv->node_db, mac_list) {
/* skip self node */ /* skip self node */
if (hsr_addr_is_self(priv, node->macaddress_A)) if (hsr_addr_is_self(priv, node->macaddress_A))
continue; continue;
print_mac_address(sfp, &node->macaddress_A[0]); print_mac_address(sfp, &node->macaddress_A[0]);
seq_puts(sfp, " ");
print_mac_address(sfp, &node->macaddress_B[0]); print_mac_address(sfp, &node->macaddress_B[0]);
seq_printf(sfp, "0x%lx, ", node->time_in[HSR_PT_SLAVE_A]); seq_printf(sfp, "%10lx, ", node->time_in[HSR_PT_SLAVE_A]);
seq_printf(sfp, "0x%lx ", node->time_in[HSR_PT_SLAVE_B]); seq_printf(sfp, "%10lx, ", node->time_in[HSR_PT_SLAVE_B]);
seq_printf(sfp, "0x%x\n", node->addr_B_port); 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(); rcu_read_unlock();
return 0; return 0;
...@@ -57,7 +69,8 @@ hsr_node_table_show(struct seq_file *sfp, void *data) ...@@ -57,7 +69,8 @@ hsr_node_table_show(struct seq_file *sfp, void *data)
/* hsr_node_table_open - Open the node_table file /* hsr_node_table_open - Open the node_table file
* *
* Description: * 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 static int
hsr_node_table_open(struct inode *inode, struct file *filp) hsr_node_table_open(struct inode *inode, struct file *filp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment