aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/xt_qtaguid_internal.h
diff options
context:
space:
mode:
authorJP Abgrall <jpa@google.com>2013-01-28 16:50:44 -0800
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-09-10 18:55:53 +0100
commitc9bfa9a5655c86f9682253df3c0cc9f1a6749cc2 (patch)
treebf18dc3a204e56a671a251ff2112d57284957975 /net/netfilter/xt_qtaguid_internal.h
parentb84e10bdb0f96cc4771004c75af6fd35fcfb4b39 (diff)
downloadkernel_samsung_smdk4412-c9bfa9a5655c86f9682253df3c0cc9f1a6749cc2.zip
kernel_samsung_smdk4412-c9bfa9a5655c86f9682253df3c0cc9f1a6749cc2.tar.gz
kernel_samsung_smdk4412-c9bfa9a5655c86f9682253df3c0cc9f1a6749cc2.tar.bz2
netfilter: xt_qtaguid: extend iface stat to report protocols
In the past the iface_stat_fmt would only show global bytes/packets for the skb-based numbers. For stall detection in userspace, distinguishing tcp vs other protocols makes it easier. Now we report ifname total_skb_rx_bytes total_skb_rx_packets total_skb_tx_bytes total_skb_tx_packets {rx,tx}_{tcp,udp,ohter}_{bytes,packets} Bug: 6818637 Signed-off-by: JP Abgrall <jpa@google.com>
Diffstat (limited to 'net/netfilter/xt_qtaguid_internal.h')
-rw-r--r--net/netfilter/xt_qtaguid_internal.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/net/netfilter/xt_qtaguid_internal.h b/net/netfilter/xt_qtaguid_internal.h
index d79f838..6dc14a9 100644
--- a/net/netfilter/xt_qtaguid_internal.h
+++ b/net/netfilter/xt_qtaguid_internal.h
@@ -179,6 +179,25 @@ struct data_counters {
struct byte_packet_counters bpc[IFS_MAX_COUNTER_SETS][IFS_MAX_DIRECTIONS][IFS_MAX_PROTOS];
};
+static inline uint64_t dc_sum_bytes(struct data_counters *counters,
+ int set,
+ enum ifs_tx_rx direction)
+{
+ return counters->bpc[set][direction][IFS_TCP].bytes
+ + counters->bpc[set][direction][IFS_UDP].bytes
+ + counters->bpc[set][direction][IFS_PROTO_OTHER].bytes;
+}
+
+static inline uint64_t dc_sum_packets(struct data_counters *counters,
+ int set,
+ enum ifs_tx_rx direction)
+{
+ return counters->bpc[set][direction][IFS_TCP].packets
+ + counters->bpc[set][direction][IFS_UDP].packets
+ + counters->bpc[set][direction][IFS_PROTO_OTHER].packets;
+}
+
+
/* Generic X based nodes used as a base for rb_tree ops */
struct tag_node {
struct rb_node node;
@@ -203,7 +222,7 @@ struct iface_stat {
struct net_device *net_dev;
struct byte_packet_counters totals_via_dev[IFS_MAX_DIRECTIONS];
- struct byte_packet_counters totals_via_skb[IFS_MAX_DIRECTIONS];
+ struct data_counters totals_via_skb;
/*
* We keep the last_known, because some devices reset their counters
* just before NETDEV_UP, while some will reset just before