diff options
author | Martin Hundebøll <martin@hundeboll.net> | 2012-04-20 11:02:45 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-06-18 12:00:58 -0400 |
commit | f8214865a55f805e65c33350bc0f1eb46dd8433d (patch) | |
tree | 0fb4582b2ec3b045a094acd6063f5559e6d4dcb5 /net/batman-adv/bat_iv_ogm.c | |
parent | 66a1b2bcb34b0c74a3422968b15a7ea853ea5a2d (diff) |
batman-adv: Add get_ethtool_stats() support
Added additional counters in a bat_stats structure, which are exported
through the ethtool api. The counters are specific to batman-adv and
includes:
forwarded packets and bytes
management packets and bytes (aggregated OGMs at this point)
translation table packets
New counters are added by extending "enum bat_counters" in types.h and
adding corresponding descriptive string(s) to bat_counters_strings in
soft-iface.c.
Counters are increased by calling batadv_add_counter() and incremented
by one by calling batadv_inc_counter().
Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/bat_iv_ogm.c')
-rw-r--r-- | net/batman-adv/bat_iv_ogm.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index ec351199c652..99ec218df7f2 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -196,8 +196,12 @@ static void bat_iv_ogm_send_to_if(struct forw_packet *forw_packet, | |||
196 | 196 | ||
197 | /* create clone because function is called more than once */ | 197 | /* create clone because function is called more than once */ |
198 | skb = skb_clone(forw_packet->skb, GFP_ATOMIC); | 198 | skb = skb_clone(forw_packet->skb, GFP_ATOMIC); |
199 | if (skb) | 199 | if (skb) { |
200 | batadv_inc_counter(bat_priv, BAT_CNT_MGMT_TX); | ||
201 | batadv_add_counter(bat_priv, BAT_CNT_MGMT_TX_BYTES, | ||
202 | skb->len + ETH_HLEN); | ||
200 | send_skb_packet(skb, hard_iface, broadcast_addr); | 203 | send_skb_packet(skb, hard_iface, broadcast_addr); |
204 | } | ||
201 | } | 205 | } |
202 | 206 | ||
203 | /* send a batman ogm packet */ | 207 | /* send a batman ogm packet */ |
@@ -1203,6 +1207,10 @@ static int bat_iv_ogm_receive(struct sk_buff *skb, | |||
1203 | if (bat_priv->bat_algo_ops->bat_ogm_emit != bat_iv_ogm_emit) | 1207 | if (bat_priv->bat_algo_ops->bat_ogm_emit != bat_iv_ogm_emit) |
1204 | return NET_RX_DROP; | 1208 | return NET_RX_DROP; |
1205 | 1209 | ||
1210 | batadv_inc_counter(bat_priv, BAT_CNT_MGMT_RX); | ||
1211 | batadv_add_counter(bat_priv, BAT_CNT_MGMT_RX_BYTES, | ||
1212 | skb->len + ETH_HLEN); | ||
1213 | |||
1206 | packet_len = skb_headlen(skb); | 1214 | packet_len = skb_headlen(skb); |
1207 | ethhdr = (struct ethhdr *)skb_mac_header(skb); | 1215 | ethhdr = (struct ethhdr *)skb_mac_header(skb); |
1208 | packet_buff = skb->data; | 1216 | packet_buff = skb->data; |