Skip to content

Commit 432bc23

Browse files
committed
Merge branch 'hsr-next'
Murali Karicheri says: ==================== net: hsr: updates from internal tree This series picks commit from our internal kernel tree. Patch 1/3 fixes a file name issue introduced in my previous series. History: v2: fixed patch 3/3 by moving stats update to inside hsr_forward_skb() ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents dcdecdc + ee2c46f commit 432bc23

File tree

5 files changed

+36
-29
lines changed

5 files changed

+36
-29
lines changed

net/hsr/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ obj-$(CONFIG_HSR) += hsr.o
66

77
hsr-y := hsr_main.o hsr_framereg.o hsr_device.o \
88
hsr_netlink.o hsr_slave.o hsr_forward.o
9-
hsr-$(CONFIG_DEBUG_FS) += hsr_prp_debugfs.o
9+
hsr-$(CONFIG_DEBUG_FS) += hsr_debugfs.o

net/hsr/hsr_prp_debugfs.c renamed to net/hsr/hsr_debugfs.c

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
2-
* hsr_prp_debugfs code
3-
* Copyright (C) 2017 Texas Instruments Incorporated
2+
* hsr_debugfs code
3+
* Copyright (C) 2019 Texas Instruments Incorporated
44
*
55
* Author(s):
6-
* Murali Karicheri <[email protected]?
6+
* Murali Karicheri <[email protected]>
77
*
88
* This program is free software; you can redistribute it and/or
99
* modify it under the terms of the GNU General Public License as
@@ -26,9 +26,9 @@ static void print_mac_address(struct seq_file *sfp, unsigned char *mac)
2626
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
2727
}
2828

29-
/* hsr_prp_node_table_show - Formats and prints node_table entries */
29+
/* hsr_node_table_show - Formats and prints node_table entries */
3030
static int
31-
hsr_prp_node_table_show(struct seq_file *sfp, void *data)
31+
hsr_node_table_show(struct seq_file *sfp, void *data)
3232
{
3333
struct hsr_priv *priv = (struct hsr_priv *)sfp->private;
3434
struct hsr_node *node;
@@ -52,66 +52,65 @@ hsr_prp_node_table_show(struct seq_file *sfp, void *data)
5252
return 0;
5353
}
5454

55-
/* hsr_prp_node_table_open - Open the node_table file
55+
/* hsr_node_table_open - Open the node_table file
5656
*
5757
* Description:
5858
* This routine opens a debugfs file node_table of specific hsr device
5959
*/
6060
static int
61-
hsr_prp_node_table_open(struct inode *inode, struct file *filp)
61+
hsr_node_table_open(struct inode *inode, struct file *filp)
6262
{
63-
return single_open(filp, hsr_prp_node_table_show, inode->i_private);
63+
return single_open(filp, hsr_node_table_show, inode->i_private);
6464
}
6565

66-
static const struct file_operations hsr_prp_fops = {
66+
static const struct file_operations hsr_fops = {
6767
.owner = THIS_MODULE,
68-
.open = hsr_prp_node_table_open,
68+
.open = hsr_node_table_open,
6969
.read = seq_read,
7070
.llseek = seq_lseek,
7171
.release = single_release,
7272
};
7373

74-
/* hsr_prp_debugfs_init - create hsr-prp node_table file for dumping
74+
/* hsr_debugfs_init - create hsr node_table file for dumping
7575
* the node table
7676
*
7777
* Description:
7878
* When debugfs is configured this routine sets up the node_table file per
79-
* hsr/prp device for dumping the node_table entries
79+
* hsr device for dumping the node_table entries
8080
*/
81-
int hsr_prp_debugfs_init(struct hsr_priv *priv)
81+
int hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev)
8282
{
8383
int rc = -1;
8484
struct dentry *de = NULL;
8585

86-
de = debugfs_create_dir("hsr", NULL);
86+
de = debugfs_create_dir(hsr_dev->name, NULL);
8787
if (!de) {
88-
pr_err("Cannot create hsr-prp debugfs root\n");
88+
pr_err("Cannot create hsr debugfs root\n");
8989
return rc;
9090
}
9191

9292
priv->node_tbl_root = de;
9393

9494
de = debugfs_create_file("node_table", S_IFREG | 0444,
9595
priv->node_tbl_root, priv,
96-
&hsr_prp_fops);
96+
&hsr_fops);
9797
if (!de) {
98-
pr_err("Cannot create hsr-prp node_table directory\n");
98+
pr_err("Cannot create hsr node_table directory\n");
9999
return rc;
100100
}
101101
priv->node_tbl_file = de;
102-
rc = 0;
103102

104-
return rc;
103+
return 0;
105104
}
106105

107-
/* hsr_prp_debugfs_term - Tear down debugfs intrastructure
106+
/* hsr_debugfs_term - Tear down debugfs intrastructure
108107
*
109108
* Description:
110109
* When Debufs is configured this routine removes debugfs file system
111-
* elements that are specific to hsr-prp
110+
* elements that are specific to hsr
112111
*/
113112
void
114-
hsr_prp_debugfs_term(struct hsr_priv *priv)
113+
hsr_debugfs_term(struct hsr_priv *priv)
115114
{
116115
debugfs_remove(priv->node_tbl_file);
117116
priv->node_tbl_file = NULL;

net/hsr/hsr_device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static void hsr_dev_destroy(struct net_device *hsr_dev)
354354

355355
hsr = netdev_priv(hsr_dev);
356356

357-
hsr_prp_debugfs_term(hsr);
357+
hsr_debugfs_term(hsr);
358358

359359
rtnl_lock();
360360
hsr_for_each_port(hsr, port)
@@ -485,7 +485,7 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
485485
goto fail;
486486

487487
mod_timer(&hsr->prune_timer, jiffies + msecs_to_jiffies(PRUNE_PERIOD));
488-
res = hsr_prp_debugfs_init(hsr);
488+
res = hsr_debugfs_init(hsr, hsr_dev);
489489
if (res)
490490
goto fail;
491491

net/hsr/hsr_forward.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,13 @@ void hsr_forward_skb(struct sk_buff *skb, struct hsr_port *port)
359359
goto out_drop;
360360
hsr_register_frame_in(frame.node_src, port, frame.sequence_nr);
361361
hsr_forward_do(&frame);
362+
/* Gets called for ingress frames as well as egress from master port.
363+
* So check and increment stats for master port only here.
364+
*/
365+
if (port->type == HSR_PT_MASTER) {
366+
port->dev->stats.tx_packets++;
367+
port->dev->stats.tx_bytes += skb->len;
368+
}
362369

363370
if (frame.skb_hsr)
364371
kfree_skb(frame.skb_hsr);

net/hsr/hsr_main.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,16 @@ static inline u16 hsr_get_skb_sequence_nr(struct sk_buff *skb)
184184
}
185185

186186
#if IS_ENABLED(CONFIG_DEBUG_FS)
187-
int hsr_prp_debugfs_init(struct hsr_priv *priv);
188-
void hsr_prp_debugfs_term(struct hsr_priv *priv);
187+
int hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev);
188+
void hsr_debugfs_term(struct hsr_priv *priv);
189189
#else
190-
static inline int hsr_prp_debugfs_init(struct hsr_priv *priv)
190+
static inline int hsr_debugfs_init(struct hsr_priv *priv,
191+
struct net_device *hsr_dev)
191192
{
192193
return 0;
193194
}
194195

195-
static inline void hsr_prp_debugfs_term(struct hsr_priv *priv)
196+
static inline void hsr_debugfs_term(struct hsr_priv *priv)
196197
{}
197198
#endif
198199

0 commit comments

Comments
 (0)