Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
0002 /* Copyright (c) 2002-2007 Volkswagen Group Electronic Research
0003  * All rights reserved.
0004  *
0005  * Redistribution and use in source and binary forms, with or without
0006  * modification, are permitted provided that the following conditions
0007  * are met:
0008  * 1. Redistributions of source code must retain the above copyright
0009  *    notice, this list of conditions and the following disclaimer.
0010  * 2. Redistributions in binary form must reproduce the above copyright
0011  *    notice, this list of conditions and the following disclaimer in the
0012  *    documentation and/or other materials provided with the distribution.
0013  * 3. Neither the name of Volkswagen nor the names of its contributors
0014  *    may be used to endorse or promote products derived from this software
0015  *    without specific prior written permission.
0016  *
0017  * Alternatively, provided that this notice is retained in full, this
0018  * software may be distributed under the terms of the GNU General
0019  * Public License ("GPL") version 2, in which case the provisions of the
0020  * GPL apply INSTEAD OF those given above.
0021  *
0022  * The provided data structures and external interfaces from this code
0023  * are not restricted to be used by modules with a GPL compatible license.
0024  *
0025  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0026  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0027  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0028  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0029  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0030  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0031  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0032  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0033  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0034  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0035  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
0036  * DAMAGE.
0037  *
0038  */
0039 
0040 #ifndef AF_CAN_H
0041 #define AF_CAN_H
0042 
0043 #include <linux/skbuff.h>
0044 #include <linux/netdevice.h>
0045 #include <linux/list.h>
0046 #include <linux/rcupdate.h>
0047 #include <linux/can.h>
0048 
0049 /* af_can rx dispatcher structures */
0050 
0051 struct receiver {
0052     struct hlist_node list;
0053     canid_t can_id;
0054     canid_t mask;
0055     unsigned long matches;
0056     void (*func)(struct sk_buff *skb, void *data);
0057     void *data;
0058     char *ident;
0059     struct sock *sk;
0060     struct rcu_head rcu;
0061 };
0062 
0063 /* statistic structures */
0064 
0065 /* can be reset e.g. by can_init_stats() */
0066 struct can_pkg_stats {
0067     unsigned long jiffies_init;
0068 
0069     unsigned long rx_frames;
0070     unsigned long tx_frames;
0071     unsigned long matches;
0072 
0073     unsigned long total_rx_rate;
0074     unsigned long total_tx_rate;
0075     unsigned long total_rx_match_ratio;
0076 
0077     unsigned long current_rx_rate;
0078     unsigned long current_tx_rate;
0079     unsigned long current_rx_match_ratio;
0080 
0081     unsigned long max_rx_rate;
0082     unsigned long max_tx_rate;
0083     unsigned long max_rx_match_ratio;
0084 
0085     unsigned long rx_frames_delta;
0086     unsigned long tx_frames_delta;
0087     unsigned long matches_delta;
0088 };
0089 
0090 /* persistent statistics */
0091 struct can_rcv_lists_stats {
0092     unsigned long stats_reset;
0093     unsigned long user_reset;
0094     unsigned long rcv_entries;
0095     unsigned long rcv_entries_max;
0096 };
0097 
0098 /* function prototypes for the CAN networklayer procfs (proc.c) */
0099 void can_init_proc(struct net *net);
0100 void can_remove_proc(struct net *net);
0101 void can_stat_update(struct timer_list *t);
0102 
0103 #endif /* AF_CAN_H */