Linux Audio

Check our new training course

Loading...
v3.5.6
  1/*
  2 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
  3 * All rights reserved.
  4 *
  5 * Redistribution and use in source and binary forms, with or without
  6 * modification, are permitted provided that the following conditions
  7 * are met:
  8 * 1. Redistributions of source code must retain the above copyright
  9 *    notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 *    notice, this list of conditions and the following disclaimer in the
 12 *    documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Volkswagen nor the names of its contributors
 14 *    may be used to endorse or promote products derived from this software
 15 *    without specific prior written permission.
 16 *
 17 * Alternatively, provided that this notice is retained in full, this
 18 * software may be distributed under the terms of the GNU General
 19 * Public License ("GPL") version 2, in which case the provisions of the
 20 * GPL apply INSTEAD OF those given above.
 21 *
 22 * The provided data structures and external interfaces from this code
 23 * are not restricted to be used by modules with a GPL compatible license.
 24 *
 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 36 * DAMAGE.
 37 *
 
 
 38 */
 39
 40#ifndef AF_CAN_H
 41#define AF_CAN_H
 42
 43#include <linux/skbuff.h>
 44#include <linux/netdevice.h>
 45#include <linux/list.h>
 46#include <linux/rcupdate.h>
 47#include <linux/can.h>
 48
 49/* af_can rx dispatcher structures */
 50
 51struct receiver {
 52	struct hlist_node list;
 53	struct rcu_head rcu;
 54	canid_t can_id;
 55	canid_t mask;
 56	unsigned long matches;
 57	void (*func)(struct sk_buff *, void *);
 58	void *data;
 59	char *ident;
 60};
 61
 62enum { RX_ERR, RX_ALL, RX_FIL, RX_INV, RX_EFF, RX_MAX };
 63
 64/* per device receive filters linked at dev->ml_priv */
 65struct dev_rcv_lists {
 66	struct hlist_head rx[RX_MAX];
 67	struct hlist_head rx_sff[0x800];
 68	int remove_on_zero_entries;
 69	int entries;
 70};
 71
 72/* statistic structures */
 73
 74/* can be reset e.g. by can_init_stats() */
 75struct s_stats {
 76	unsigned long jiffies_init;
 77
 78	unsigned long rx_frames;
 79	unsigned long tx_frames;
 80	unsigned long matches;
 81
 82	unsigned long total_rx_rate;
 83	unsigned long total_tx_rate;
 84	unsigned long total_rx_match_ratio;
 85
 86	unsigned long current_rx_rate;
 87	unsigned long current_tx_rate;
 88	unsigned long current_rx_match_ratio;
 89
 90	unsigned long max_rx_rate;
 91	unsigned long max_tx_rate;
 92	unsigned long max_rx_match_ratio;
 93
 94	unsigned long rx_frames_delta;
 95	unsigned long tx_frames_delta;
 96	unsigned long matches_delta;
 97};
 98
 99/* persistent statistics */
100struct s_pstats {
101	unsigned long stats_reset;
102	unsigned long user_reset;
103	unsigned long rcv_entries;
104	unsigned long rcv_entries_max;
105};
106
107/* function prototypes for the CAN networklayer procfs (proc.c) */
108extern void can_init_proc(void);
109extern void can_remove_proc(void);
110extern void can_stat_update(unsigned long data);
111
112/* structures and variables from af_can.c needed in proc.c for reading */
113extern struct timer_list can_stattimer;    /* timer for statistics update */
114extern struct s_stats    can_stats;        /* packet statistics */
115extern struct s_pstats   can_pstats;       /* receive list statistics */
116extern struct hlist_head can_rx_dev_list;  /* rx dispatcher structures */
117
118#endif /* AF_CAN_H */
v3.1
  1/*
  2 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
  3 * All rights reserved.
  4 *
  5 * Redistribution and use in source and binary forms, with or without
  6 * modification, are permitted provided that the following conditions
  7 * are met:
  8 * 1. Redistributions of source code must retain the above copyright
  9 *    notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 *    notice, this list of conditions and the following disclaimer in the
 12 *    documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Volkswagen nor the names of its contributors
 14 *    may be used to endorse or promote products derived from this software
 15 *    without specific prior written permission.
 16 *
 17 * Alternatively, provided that this notice is retained in full, this
 18 * software may be distributed under the terms of the GNU General
 19 * Public License ("GPL") version 2, in which case the provisions of the
 20 * GPL apply INSTEAD OF those given above.
 21 *
 22 * The provided data structures and external interfaces from this code
 23 * are not restricted to be used by modules with a GPL compatible license.
 24 *
 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 36 * DAMAGE.
 37 *
 38 * Send feedback to <socketcan-users@lists.berlios.de>
 39 *
 40 */
 41
 42#ifndef AF_CAN_H
 43#define AF_CAN_H
 44
 45#include <linux/skbuff.h>
 46#include <linux/netdevice.h>
 47#include <linux/list.h>
 48#include <linux/rcupdate.h>
 49#include <linux/can.h>
 50
 51/* af_can rx dispatcher structures */
 52
 53struct receiver {
 54	struct hlist_node list;
 55	struct rcu_head rcu;
 56	canid_t can_id;
 57	canid_t mask;
 58	unsigned long matches;
 59	void (*func)(struct sk_buff *, void *);
 60	void *data;
 61	char *ident;
 62};
 63
 64enum { RX_ERR, RX_ALL, RX_FIL, RX_INV, RX_EFF, RX_MAX };
 65
 66/* per device receive filters linked at dev->ml_priv */
 67struct dev_rcv_lists {
 68	struct hlist_head rx[RX_MAX];
 69	struct hlist_head rx_sff[0x800];
 70	int remove_on_zero_entries;
 71	int entries;
 72};
 73
 74/* statistic structures */
 75
 76/* can be reset e.g. by can_init_stats() */
 77struct s_stats {
 78	unsigned long jiffies_init;
 79
 80	unsigned long rx_frames;
 81	unsigned long tx_frames;
 82	unsigned long matches;
 83
 84	unsigned long total_rx_rate;
 85	unsigned long total_tx_rate;
 86	unsigned long total_rx_match_ratio;
 87
 88	unsigned long current_rx_rate;
 89	unsigned long current_tx_rate;
 90	unsigned long current_rx_match_ratio;
 91
 92	unsigned long max_rx_rate;
 93	unsigned long max_tx_rate;
 94	unsigned long max_rx_match_ratio;
 95
 96	unsigned long rx_frames_delta;
 97	unsigned long tx_frames_delta;
 98	unsigned long matches_delta;
 99};
100
101/* persistent statistics */
102struct s_pstats {
103	unsigned long stats_reset;
104	unsigned long user_reset;
105	unsigned long rcv_entries;
106	unsigned long rcv_entries_max;
107};
108
109/* function prototypes for the CAN networklayer procfs (proc.c) */
110extern void can_init_proc(void);
111extern void can_remove_proc(void);
112extern void can_stat_update(unsigned long data);
113
114/* structures and variables from af_can.c needed in proc.c for reading */
115extern struct timer_list can_stattimer;    /* timer for statistics update */
116extern struct s_stats    can_stats;        /* packet statistics */
117extern struct s_pstats   can_pstats;       /* receive list statistics */
118extern struct hlist_head can_rx_dev_list;  /* rx dispatcher structures */
119
120#endif /* AF_CAN_H */