Browse Source

net: hsr/prp: Add SV frame counts in the rx direction

Add rx Supervision (SV) frame count for Link A and B to
debug stats. This is needed as the LRE rx stats is inclusive
of SV frames and user may want to count how many rx non SV
frames received for debug purpose. So add these counters to
the lre_info debugfs and update it in the packet processing
code.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Murali Karicheri 6 years ago
parent
commit
1440fd5f25
3 changed files with 13 additions and 0 deletions
  1. 2 0
      net/hsr-prp/hsr_prp_debugfs.c
  2. 7 0
      net/hsr-prp/hsr_prp_forward.c
  3. 4 0
      net/hsr-prp/hsr_prp_main.h

+ 2 - 0
net/hsr-prp/hsr_prp_debugfs.c

@@ -47,6 +47,8 @@ hsr_prp_lre_info_show(struct seq_file *sfp, void *data)
 			   priv->sv_frame_dei);
 	}
 	seq_printf(sfp, "cnt_tx_sup = %d\n", priv->dbg_stats.cnt_tx_sup);
+	seq_printf(sfp, "cnt_rx_sup_A = %d\n", priv->dbg_stats.cnt_rx_sup_a);
+	seq_printf(sfp, "cnt_rx_sup_B = %d\n", priv->dbg_stats.cnt_rx_sup_b);
 	seq_printf(sfp, "disable SV Frame = %d\n", priv->disable_sv_frame);
 	seq_puts(sfp, "\n");
 	return 0;

+ 7 - 0
net/hsr-prp/hsr_prp_forward.c

@@ -687,6 +687,13 @@ static int fill_frame_info(struct hsr_prp_frame_info *frame,
 	    port->type != HSR_PRP_PT_MASTER)
 		return -1;
 
+	if (frame->is_supervision) {
+		if (port->type == HSR_PRP_PT_SLAVE_A)
+			INC_CNT_RX_SUP_A(priv);
+		else if (port->type == HSR_PRP_PT_SLAVE_B)
+			INC_CNT_RX_SUP_B(priv);
+	}
+
 	/* For Offloaded case, there is no need for node list since
 	 * firmware/hardware implements LRE function.
 	 */

+ 4 - 0
net/hsr-prp/hsr_prp_main.h

@@ -199,6 +199,8 @@ static inline void set_prp_LSDU_size(struct prp_rct *rct, u16 LSDU_size)
 
 struct hsr_prp_debug_stats {
 	u32	cnt_tx_sup;
+	u32	cnt_rx_sup_a;
+	u32	cnt_rx_sup_b;
 };
 
 struct hsr_prp_port {
@@ -349,6 +351,8 @@ void hsr_prp_unregister_notifier(u8 proto);
 		(priv)->lre_stats.cnt_own_rx_a++ : \
 		(priv)->lre_stats.cnt_own_rx_b++)
 #define INC_CNT_TX_SUP(priv) ((priv)->dbg_stats.cnt_tx_sup++)
+#define INC_CNT_RX_SUP_A(priv) ((priv)->dbg_stats.cnt_rx_sup_a++)
+#define INC_CNT_RX_SUP_B(priv) ((priv)->dbg_stats.cnt_rx_sup_b++)
 
 #if IS_ENABLED(CONFIG_DEBUG_FS)
 int hsr_prp_debugfs_init(struct hsr_prp_priv *priv, struct net_device *ndev);