Xenomai  3.0.5
rtmac_disc.h
1 /***
2  *
3  * include/rtmac/rtmac_disc.h
4  *
5  * rtmac - real-time networking media access control subsystem
6  * Copyright (C) 2002 Marc Kleine-Budde <kleine-budde@gmx.de>,
7  * 2003, 2004 Jan Kiszka <Jan.Kiszka@web.de>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  */
24 
25 #ifndef __RTMAC_DISC_H_
26 #define __RTMAC_DISC_H_
27 
28 #include <linux/list.h>
29 #include <linux/netdevice.h>
30 
31 #include <rtdev.h>
32 #include <rtnet_chrdev.h>
33 
34 
35 #define RTMAC_NO_VNIC NULL
36 #define RTMAC_DEFAULT_VNIC rtmac_vnic_xmit
37 
38 typedef int (*vnic_xmit_handler)(struct sk_buff *skb, struct net_device *dev);
39 
40 struct rtmac_priv {
41  int (*orig_start_xmit)(struct rtskb *skb, struct rtnet_device *dev);
42  struct net_device *vnic;
43  struct net_device_stats vnic_stats;
44  struct rtskb_pool vnic_skb_pool;
45  unsigned int vnic_max_mtu;
46 
47  u8 disc_priv[0] __attribute__ ((aligned(16)));
48 };
49 
50 struct rtmac_proc_entry {
51  const char *name;
52  int (*handler)(struct xnvfile_regular_iterator *it, void *data);
53  struct xnvfile_regular vfile;
54 };
55 
56 struct rtmac_disc {
57  struct list_head list;
58 
59  const char *name;
60  unsigned int priv_size; /* size of rtmac_priv.disc_priv */
61  u16 disc_type;
62 
63  int (*packet_rx)(struct rtskb *skb);
64  /* rt_packet_tx prototype must be compatible with hard_start_xmit */
65  int (*rt_packet_tx)(struct rtskb *skb,
66  struct rtnet_device *dev);
67  int (*nrt_packet_tx)(struct rtskb *skb);
68 
69  unsigned int (*get_mtu)(struct rtnet_device *rtdev,
70  unsigned int priority);
71 
72  vnic_xmit_handler vnic_xmit;
73 
74  int (*attach)(struct rtnet_device *rtdev, void *disc_priv);
75  int (*detach)(struct rtnet_device *rtdev, void *disc_priv);
76 
77  struct rtnet_ioctls ioctls;
78 
79  struct rtmac_proc_entry *proc_entries;
80  unsigned nr_proc_entries;
81 
82  struct module *owner;
83 };
84 
85 
86 int rtmac_disc_attach(struct rtnet_device *rtdev, struct rtmac_disc *disc);
87 int rtmac_disc_detach(struct rtnet_device *rtdev);
88 
89 int __rtmac_disc_register(struct rtmac_disc *disc, struct module *module);
90 #define rtmac_disc_register(disc) __rtmac_disc_register(disc, THIS_MODULE)
91 
92 void rtmac_disc_deregister(struct rtmac_disc *disc);
93 
94 #ifdef CONFIG_XENO_OPT_VFILE
95 int rtnet_rtmac_disciplines_show(struct xnvfile_regular_iterator *it, void *d);
96 #endif /* CONFIG_XENO_OPT_VFILE */
97 
98 
99 #endif /* __RTMAC_DISC_H_ */
Regular vfile iterator.
Definition: vfile.h:269