android_kernel_cmhtcleo/include/linux/iface_stat.h
tytung 330c350fdb net: New iface_stat module to monitor persistent network stats.
Adding a new module that tracks the number of bytes/packets transfered by a network interface, even after the interface has been removed.
This is relevant to track the total data usage in mobile devices whose interfaces are added and removed quite frequently (WiFi, Bluetooth, 3G,..).

Monitoring is done only for devices that are configured with a valid IP address (check to exclude virtual/loopback/tunnel interfaces).

Change-Id: I8ac642af1990433ebd0784e8dbd72bf0714b5bf6
Signed-off-by: Ashish Sharma <ashishsharma@google.com>

Included a little modification for the out-of-date HD2 .32 kernel.
2011-11-15 23:00:32 +08:00

51 lines
1.3 KiB
C

/* include/linux/iface_stat.h
*
* Copyright (C) 2011 Google, Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __IFACE_STAT_H
#define __IFACE_STAT_H
/*
* Contains definitions for persistent data usage tracking per
* network interface.
*/
#ifdef CONFIG_IFACE_STAT
/*
* Create a new entry for tracking the specified interface.
* Do nothing if the entry already exists.
* Called when an interface is configured with a valid IP address.
*/
void create_iface_stat(const struct in_device *in_dev);
/*
* Update stats for the specified interface.
* Do nothing if the entry does not exist (when a device was never
* configured with an IP address). Called when an device is being
* unregistered.
*/
void iface_stat_update(struct net_device *dev);
#else
static inline void create_iface_stat(in_dev)
{ }
static inline void iface_stat_update(dev)
{ }
#endif
#endif /* __IFACE_STAT_H */