aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
authorMartin Hundebøll <martin@hundeboll.net>2012-04-20 11:02:45 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-18 12:00:58 -0400
commitf8214865a55f805e65c33350bc0f1eb46dd8433d (patch)
tree0fb4582b2ec3b045a094acd6063f5559e6d4dcb5 /net/batman-adv/routing.c
parent66a1b2bcb34b0c74a3422968b15a7ea853ea5a2d (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/routing.c')
-rw-r--r--net/batman-adv/routing.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 015471d801b4..369604c99a46 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -600,6 +600,8 @@ int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
600 600
601 switch (tt_query->flags & TT_QUERY_TYPE_MASK) { 601 switch (tt_query->flags & TT_QUERY_TYPE_MASK) {
602 case TT_REQUEST: 602 case TT_REQUEST:
603 batadv_inc_counter(bat_priv, BAT_CNT_TT_REQUEST_RX);
604
603 /* If we cannot provide an answer the tt_request is 605 /* If we cannot provide an answer the tt_request is
604 * forwarded */ 606 * forwarded */
605 if (!send_tt_response(bat_priv, tt_query)) { 607 if (!send_tt_response(bat_priv, tt_query)) {
@@ -612,6 +614,8 @@ int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
612 } 614 }
613 break; 615 break;
614 case TT_RESPONSE: 616 case TT_RESPONSE:
617 batadv_inc_counter(bat_priv, BAT_CNT_TT_RESPONSE_RX);
618
615 if (is_my_mac(tt_query->dst)) { 619 if (is_my_mac(tt_query->dst)) {
616 /* packet needs to be linearized to access the TT 620 /* packet needs to be linearized to access the TT
617 * changes */ 621 * changes */
@@ -665,6 +669,8 @@ int recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if)
665 if (is_broadcast_ether_addr(ethhdr->h_source)) 669 if (is_broadcast_ether_addr(ethhdr->h_source))
666 goto out; 670 goto out;
667 671
672 batadv_inc_counter(bat_priv, BAT_CNT_TT_ROAM_ADV_RX);
673
668 roam_adv_packet = (struct roam_adv_packet *)skb->data; 674 roam_adv_packet = (struct roam_adv_packet *)skb->data;
669 675
670 if (!is_my_mac(roam_adv_packet->dst)) 676 if (!is_my_mac(roam_adv_packet->dst))
@@ -872,6 +878,11 @@ static int route_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
872 /* decrement ttl */ 878 /* decrement ttl */
873 unicast_packet->header.ttl--; 879 unicast_packet->header.ttl--;
874 880
881 /* Update stats counter */
882 batadv_inc_counter(bat_priv, BAT_CNT_FORWARD);
883 batadv_add_counter(bat_priv, BAT_CNT_FORWARD_BYTES,
884 skb->len + ETH_HLEN);
885
875 /* route it */ 886 /* route it */
876 send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr); 887 send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr);
877 ret = NET_RX_SUCCESS; 888 ret = NET_RX_SUCCESS;