From de93ca218074741c8718a6c40c3af866cd77a049 Mon Sep 17 00:00:00 2001 From: Harout Hedeshian Date: Tue, 26 Aug 2014 14:32:51 -0600 Subject: net: rmnet_data: Add counters for downlink checksum offload return codes Added counter array to /sys/module/rmnet_data/parameters/checksum_dl_stats for non-realtime analysis of checksum offload. Change-Id: I749c09147325fd0f871c34ff17e2546b68898faa Signed-off-by: Harout Hedeshian --- net/rmnet_data/rmnet_data_handlers.c | 1 + net/rmnet_data/rmnet_data_stats.c | 25 ++++++++++++++++++++++--- net/rmnet_data/rmnet_data_stats.h | 1 + 3 files changed, 24 insertions(+), 3 deletions(-) (limited to 'net/rmnet_data') diff --git a/net/rmnet_data/rmnet_data_handlers.c b/net/rmnet_data/rmnet_data_handlers.c index b6806370bdd0..ed25dc508ba4 100644 --- a/net/rmnet_data/rmnet_data_handlers.c +++ b/net/rmnet_data/rmnet_data_handlers.c @@ -285,6 +285,7 @@ static rx_handler_result_t _rmnet_map_ingress_handler(struct sk_buff *skb, if (config->ingress_data_format & RMNET_INGRESS_FORMAT_MAP_CKSUMV3) { ckresult = rmnet_map_checksum_downlink_packet(skb); trace_rmnet_map_checksum_downlink_packet(skb, ckresult); + rmnet_stats_dl_checksum(ckresult); if (likely(ckresult == RMNET_MAP_CHECKSUM_OK)) skb->ip_summed |= CHECKSUM_UNNECESSARY; else if (ckresult != RMNET_MAP_CHECKSUM_ERR_UNKNOWN_IP_VERSION diff --git a/net/rmnet_data/rmnet_data_stats.c b/net/rmnet_data/rmnet_data_stats.c index 7643cb6aea0e..caf936f3ebfa 100644 --- a/net/rmnet_data/rmnet_data_stats.c +++ b/net/rmnet_data/rmnet_data_stats.c @@ -20,8 +20,11 @@ #include #include #include +#include #include "rmnet_data_private.h" #include "rmnet_data_stats.h" +#include "rmnet_data_config.h" +#include "rmnet_map.h" enum rmnet_deagg_e { RMNET_STATS_AGG_BUFF, @@ -37,17 +40,22 @@ MODULE_PARM_DESC(skb_free, "SKBs dropped or freed"); static DEFINE_SPINLOCK(rmnet_queue_xmit_lock); unsigned long int queue_xmit[RMNET_STATS_QUEUE_XMIT_MAX*2]; module_param_array(queue_xmit, ulong, 0, S_IRUGO); -MODULE_PARM_DESC(queue_xmit, "SKBs queued"); +MODULE_PARM_DESC(queue_xmit, "SKBs queued for transmit"); static DEFINE_SPINLOCK(rmnet_deagg_count); unsigned long int deagg_count[RMNET_STATS_AGG_MAX]; module_param_array(deagg_count, ulong, 0, S_IRUGO); -MODULE_PARM_DESC(deagg_count, "SKBs queued"); +MODULE_PARM_DESC(deagg_count, "SKBs De-aggregated"); static DEFINE_SPINLOCK(rmnet_agg_count); unsigned long int agg_count[RMNET_STATS_AGG_MAX]; module_param_array(agg_count, ulong, 0, S_IRUGO); -MODULE_PARM_DESC(agg_count, "SKBs queued"); +MODULE_PARM_DESC(agg_count, "SKBs Aggregated"); + +static DEFINE_SPINLOCK(rmnet_checksum_dl_stats); +unsigned long int checksum_dl_stats[RMNET_MAP_CHECKSUM_ENUM_LENGTH]; +module_param_array(checksum_dl_stats, ulong, 0, S_IRUGO); +MODULE_PARM_DESC(checksum_dl_stats, "Downlink Checksum Statistics"); void rmnet_kfree_skb(struct sk_buff *skb, unsigned int reason) { @@ -98,3 +106,14 @@ void rmnet_stats_deagg_pkts(int aggcount) spin_unlock_irqrestore(&rmnet_deagg_count, flags); } +void rmnet_stats_dl_checksum(unsigned int rc) +{ + unsigned long flags; + + if (rc >= RMNET_MAP_CHECKSUM_ENUM_LENGTH) + rc = RMNET_MAP_CHECKSUM_ERR_UNKOWN; + + spin_lock_irqsave(&rmnet_checksum_dl_stats, flags); + checksum_dl_stats[rc]++; + spin_unlock_irqrestore(&rmnet_checksum_dl_stats, flags); +} diff --git a/net/rmnet_data/rmnet_data_stats.h b/net/rmnet_data/rmnet_data_stats.h index a37887c24739..b25c45edcdca 100644 --- a/net/rmnet_data/rmnet_data_stats.h +++ b/net/rmnet_data/rmnet_data_stats.h @@ -55,4 +55,5 @@ void rmnet_kfree_skb(struct sk_buff *skb, unsigned int reason); void rmnet_stats_queue_xmit(int rc, unsigned int reason); void rmnet_stats_deagg_pkts(int aggcount); void rmnet_stats_agg_pkts(int aggcount); +void rmnet_stats_dl_checksum(unsigned int rc); #endif /* _RMNET_DATA_STATS_H_ */ -- cgit v1.2.3