/*1* Copyright (c) 2002-2007 Volkswagen Group Electronic Research2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12* 3. Neither the name of Volkswagen nor the names of its contributors13* may be used to endorse or promote products derived from this software14* without specific prior written permission.15*16* Alternatively, provided that this notice is retained in full, this17* software may be distributed under the terms of the GNU General18* Public License ("GPL") version 2, in which case the provisions of the19* GPL apply INSTEAD OF those given above.20*21* The provided data structures and external interfaces from this code22* are not restricted to be used by modules with a GPL compatible license.23*24* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS25* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT26* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR27* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT28* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,29* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT30* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,31* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY32* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT33* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE34* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH35* DAMAGE.36*37* Send feedback to <[email protected]>38*39*/4041#ifndef AF_CAN_H42#define AF_CAN_H4344#include <linux/skbuff.h>45#include <linux/netdevice.h>46#include <linux/list.h>47#include <linux/rcupdate.h>48#include <linux/can.h>4950/* af_can rx dispatcher structures */5152struct receiver {53struct hlist_node list;54struct rcu_head rcu;55canid_t can_id;56canid_t mask;57unsigned long matches;58void (*func)(struct sk_buff *, void *);59void *data;60char *ident;61};6263enum { RX_ERR, RX_ALL, RX_FIL, RX_INV, RX_EFF, RX_MAX };6465/* per device receive filters linked at dev->ml_priv */66struct dev_rcv_lists {67struct hlist_head rx[RX_MAX];68struct hlist_head rx_sff[0x800];69int remove_on_zero_entries;70int entries;71};7273/* statistic structures */7475/* can be reset e.g. by can_init_stats() */76struct s_stats {77unsigned long jiffies_init;7879unsigned long rx_frames;80unsigned long tx_frames;81unsigned long matches;8283unsigned long total_rx_rate;84unsigned long total_tx_rate;85unsigned long total_rx_match_ratio;8687unsigned long current_rx_rate;88unsigned long current_tx_rate;89unsigned long current_rx_match_ratio;9091unsigned long max_rx_rate;92unsigned long max_tx_rate;93unsigned long max_rx_match_ratio;9495unsigned long rx_frames_delta;96unsigned long tx_frames_delta;97unsigned long matches_delta;98};99100/* persistent statistics */101struct s_pstats {102unsigned long stats_reset;103unsigned long user_reset;104unsigned long rcv_entries;105unsigned long rcv_entries_max;106};107108/* function prototypes for the CAN networklayer procfs (proc.c) */109extern void can_init_proc(void);110extern void can_remove_proc(void);111extern void can_stat_update(unsigned long data);112113/* structures and variables from af_can.c needed in proc.c for reading */114extern struct timer_list can_stattimer; /* timer for statistics update */115extern struct s_stats can_stats; /* packet statistics */116extern struct s_pstats can_pstats; /* receive list statistics */117extern struct hlist_head can_rx_dev_list; /* rx dispatcher structures */118119#endif /* AF_CAN_H */120121122