diff options
Diffstat (limited to 'include/linux/hdlc.h')
| -rw-r--r-- | include/linux/hdlc.h | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h index db390c511ada..6115545a5b9c 100644 --- a/include/linux/hdlc.h +++ b/include/linux/hdlc.h | |||
| @@ -26,13 +26,6 @@ | |||
| 26 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
| 27 | #include <linux/hdlc/ioctl.h> | 27 | #include <linux/hdlc/ioctl.h> |
| 28 | 28 | ||
| 29 | |||
| 30 | /* Used by all network devices here, pointed to by netdev_priv(dev) */ | ||
| 31 | struct hdlc_device_desc { | ||
| 32 | int (*netif_rx)(struct sk_buff *skb); | ||
| 33 | struct net_device_stats stats; | ||
| 34 | }; | ||
| 35 | |||
| 36 | /* This structure is a private property of HDLC protocols. | 29 | /* This structure is a private property of HDLC protocols. |
| 37 | Hardware drivers have no interest here */ | 30 | Hardware drivers have no interest here */ |
| 38 | 31 | ||
| @@ -44,12 +37,15 @@ struct hdlc_proto { | |||
| 44 | void (*detach)(struct net_device *dev); | 37 | void (*detach)(struct net_device *dev); |
| 45 | int (*ioctl)(struct net_device *dev, struct ifreq *ifr); | 38 | int (*ioctl)(struct net_device *dev, struct ifreq *ifr); |
| 46 | __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev); | 39 | __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev); |
| 40 | int (*netif_rx)(struct sk_buff *skb); | ||
| 47 | struct module *module; | 41 | struct module *module; |
| 48 | struct hdlc_proto *next; /* next protocol in the list */ | 42 | struct hdlc_proto *next; /* next protocol in the list */ |
| 49 | }; | 43 | }; |
| 50 | 44 | ||
| 51 | 45 | ||
| 46 | /* Pointed to by dev->priv */ | ||
| 52 | typedef struct hdlc_device { | 47 | typedef struct hdlc_device { |
| 48 | struct net_device_stats stats; | ||
| 53 | /* used by HDLC layer to take control over HDLC device from hw driver*/ | 49 | /* used by HDLC layer to take control over HDLC device from hw driver*/ |
| 54 | int (*attach)(struct net_device *dev, | 50 | int (*attach)(struct net_device *dev, |
| 55 | unsigned short encoding, unsigned short parity); | 51 | unsigned short encoding, unsigned short parity); |
| @@ -83,18 +79,11 @@ void unregister_hdlc_protocol(struct hdlc_proto *proto); | |||
| 83 | 79 | ||
| 84 | struct net_device *alloc_hdlcdev(void *priv); | 80 | struct net_device *alloc_hdlcdev(void *priv); |
| 85 | 81 | ||
| 86 | 82 | static inline struct hdlc_device* dev_to_hdlc(struct net_device *dev) | |
| 87 | static __inline__ struct hdlc_device_desc* dev_to_desc(struct net_device *dev) | ||
| 88 | { | ||
| 89 | return netdev_priv(dev); | ||
| 90 | } | ||
| 91 | |||
| 92 | static __inline__ hdlc_device* dev_to_hdlc(struct net_device *dev) | ||
| 93 | { | 83 | { |
| 94 | return netdev_priv(dev) + sizeof(struct hdlc_device_desc); | 84 | return dev->priv; |
| 95 | } | 85 | } |
| 96 | 86 | ||
| 97 | |||
| 98 | static __inline__ void debug_frame(const struct sk_buff *skb) | 87 | static __inline__ void debug_frame(const struct sk_buff *skb) |
| 99 | { | 88 | { |
| 100 | int i; | 89 | int i; |
| @@ -116,13 +105,13 @@ int hdlc_open(struct net_device *dev); | |||
| 116 | void hdlc_close(struct net_device *dev); | 105 | void hdlc_close(struct net_device *dev); |
| 117 | 106 | ||
| 118 | int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, | 107 | int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, |
| 119 | int (*rx)(struct sk_buff *skb), size_t size); | 108 | size_t size); |
| 120 | /* May be used by hardware driver to gain control over HDLC device */ | 109 | /* May be used by hardware driver to gain control over HDLC device */ |
| 121 | void detach_hdlc_protocol(struct net_device *dev); | 110 | void detach_hdlc_protocol(struct net_device *dev); |
| 122 | 111 | ||
| 123 | static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev) | 112 | static __inline__ struct net_device_stats *hdlc_stats(struct net_device *dev) |
| 124 | { | 113 | { |
| 125 | return &dev_to_desc(dev)->stats; | 114 | return &dev_to_hdlc(dev)->stats; |
| 126 | } | 115 | } |
| 127 | 116 | ||
| 128 | 117 | ||
