~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/hdlc.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/hdlc.h (Version linux-6.12-rc7) and /include/linux/hdlc.h (Version linux-5.0.21)


  1 /* SPDX-License-Identifier: GPL-2.0-only */    << 
  2 /*                                                  1 /*
  3  * Generic HDLC support routines for Linux          2  * Generic HDLC support routines for Linux
  4  *                                                  3  *
  5  * Copyright (C) 1999-2005 Krzysztof Halasa <k      4  * Copyright (C) 1999-2005 Krzysztof Halasa <khc@pm.waw.pl>
                                                   >>   5  *
                                                   >>   6  * This program is free software; you can redistribute it and/or modify it
                                                   >>   7  * under the terms of version 2 of the GNU General Public License
                                                   >>   8  * as published by the Free Software Foundation.
  6  */                                                 9  */
  7 #ifndef __HDLC_H                                   10 #ifndef __HDLC_H
  8 #define __HDLC_H                                   11 #define __HDLC_H
  9                                                    12 
 10                                                    13 
 11 #include <linux/skbuff.h>                          14 #include <linux/skbuff.h>
 12 #include <linux/netdevice.h>                       15 #include <linux/netdevice.h>
 13 #include <linux/hdlc/ioctl.h>                      16 #include <linux/hdlc/ioctl.h>
 14 #include <uapi/linux/hdlc.h>                       17 #include <uapi/linux/hdlc.h>
 15                                                    18 
 16 /* This structure is a private property of HDL     19 /* This structure is a private property of HDLC protocols.
 17    Hardware drivers have no interest here */       20    Hardware drivers have no interest here */
 18                                                    21 
 19 struct hdlc_proto {                                22 struct hdlc_proto {
 20         int (*open)(struct net_device *dev);       23         int (*open)(struct net_device *dev);
 21         void (*close)(struct net_device *dev);     24         void (*close)(struct net_device *dev);
 22         void (*start)(struct net_device *dev);     25         void (*start)(struct net_device *dev); /* if open & DCD */
 23         void (*stop)(struct net_device *dev);      26         void (*stop)(struct net_device *dev); /* if open & !DCD */
 24         void (*detach)(struct net_device *dev)     27         void (*detach)(struct net_device *dev);
 25         int (*ioctl)(struct net_device *dev, s !!  28         int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
 26         __be16 (*type_trans)(struct sk_buff *s     29         __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev);
 27         int (*netif_rx)(struct sk_buff *skb);      30         int (*netif_rx)(struct sk_buff *skb);
 28         netdev_tx_t (*xmit)(struct sk_buff *sk     31         netdev_tx_t (*xmit)(struct sk_buff *skb, struct net_device *dev);
 29         struct module *module;                     32         struct module *module;
 30         struct hdlc_proto *next; /* next proto     33         struct hdlc_proto *next; /* next protocol in the list */
 31 };                                                 34 };
 32                                                    35 
 33                                                    36 
 34 /* Pointed to by netdev_priv(dev) */               37 /* Pointed to by netdev_priv(dev) */
 35 typedef struct hdlc_device {                       38 typedef struct hdlc_device {
 36         /* used by HDLC layer to take control      39         /* used by HDLC layer to take control over HDLC device from hw driver*/
 37         int (*attach)(struct net_device *dev,      40         int (*attach)(struct net_device *dev,
 38                       unsigned short encoding,     41                       unsigned short encoding, unsigned short parity);
 39                                                    42 
 40         /* hardware driver must handle this in     43         /* hardware driver must handle this instead of dev->hard_start_xmit */
 41         netdev_tx_t (*xmit)(struct sk_buff *sk     44         netdev_tx_t (*xmit)(struct sk_buff *skb, struct net_device *dev);
 42                                                    45 
 43         /* Things below are for HDLC layer int     46         /* Things below are for HDLC layer internal use only */
 44         const struct hdlc_proto *proto;            47         const struct hdlc_proto *proto;
 45         int carrier;                               48         int carrier;
 46         int open;                                  49         int open;
 47         spinlock_t state_lock;                     50         spinlock_t state_lock;
 48         void *state;                               51         void *state;
 49         void *priv;                                52         void *priv;
 50 } hdlc_device;                                     53 } hdlc_device;
 51                                                    54 
 52                                                    55 
 53                                                    56 
 54 /* Exported from hdlc module */                    57 /* Exported from hdlc module */
 55                                                    58 
 56 /* Called by hardware driver when a user reque     59 /* Called by hardware driver when a user requests HDLC service */
 57 int hdlc_ioctl(struct net_device *dev, struct  !!  60 int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
 58                                                    61 
 59 /* Must be used by hardware driver on module s     62 /* Must be used by hardware driver on module startup/exit */
 60 #define register_hdlc_device(dev)       regist     63 #define register_hdlc_device(dev)       register_netdev(dev)
 61 void unregister_hdlc_device(struct net_device      64 void unregister_hdlc_device(struct net_device *dev);
 62                                                    65 
 63                                                    66 
 64 void register_hdlc_protocol(struct hdlc_proto      67 void register_hdlc_protocol(struct hdlc_proto *proto);
 65 void unregister_hdlc_protocol(struct hdlc_prot     68 void unregister_hdlc_protocol(struct hdlc_proto *proto);
 66                                                    69 
 67 struct net_device *alloc_hdlcdev(void *priv);      70 struct net_device *alloc_hdlcdev(void *priv);
 68                                                    71 
 69 static inline struct hdlc_device* dev_to_hdlc(     72 static inline struct hdlc_device* dev_to_hdlc(struct net_device *dev)
 70 {                                                  73 {
 71         return netdev_priv(dev);                   74         return netdev_priv(dev);
 72 }                                                  75 }
 73                                                    76 
 74 static __inline__ void debug_frame(const struc     77 static __inline__ void debug_frame(const struct sk_buff *skb)
 75 {                                                  78 {
 76         int i;                                     79         int i;
 77                                                    80 
 78         for (i=0; i < skb->len; i++) {             81         for (i=0; i < skb->len; i++) {
 79                 if (i == 100) {                    82                 if (i == 100) {
 80                         printk("...\n");           83                         printk("...\n");
 81                         return;                    84                         return;
 82                 }                                  85                 }
 83                 printk(" %02X", skb->data[i]);     86                 printk(" %02X", skb->data[i]);
 84         }                                          87         }
 85         printk("\n");                              88         printk("\n");
 86 }                                                  89 }
 87                                                    90 
 88                                                    91 
 89 /* Must be called by hardware driver when HDLC     92 /* Must be called by hardware driver when HDLC device is being opened */
 90 int hdlc_open(struct net_device *dev);             93 int hdlc_open(struct net_device *dev);
 91 /* Must be called by hardware driver when HDLC     94 /* Must be called by hardware driver when HDLC device is being closed */
 92 void hdlc_close(struct net_device *dev);           95 void hdlc_close(struct net_device *dev);
 93 /* Must be pointed to by hw driver's dev->netd     96 /* Must be pointed to by hw driver's dev->netdev_ops->ndo_start_xmit */
 94 netdev_tx_t hdlc_start_xmit(struct sk_buff *sk     97 netdev_tx_t hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev);
 95                                                    98 
 96 int attach_hdlc_protocol(struct net_device *de     99 int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
 97                          size_t size);            100                          size_t size);
 98 /* May be used by hardware driver to gain cont    101 /* May be used by hardware driver to gain control over HDLC device */
 99 int detach_hdlc_protocol(struct net_device *de    102 int detach_hdlc_protocol(struct net_device *dev);
100                                                   103 
101 static __inline__ __be16 hdlc_type_trans(struc    104 static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
102                                          struc    105                                          struct net_device *dev)
103 {                                                 106 {
104         hdlc_device *hdlc = dev_to_hdlc(dev);     107         hdlc_device *hdlc = dev_to_hdlc(dev);
105                                                   108 
106         skb->dev = dev;                           109         skb->dev = dev;
107         skb_reset_mac_header(skb);                110         skb_reset_mac_header(skb);
108                                                   111 
109         if (hdlc->proto->type_trans)              112         if (hdlc->proto->type_trans)
110                 return hdlc->proto->type_trans    113                 return hdlc->proto->type_trans(skb, dev);
111         else                                      114         else
112                 return htons(ETH_P_HDLC);         115                 return htons(ETH_P_HDLC);
113 }                                                 116 }
114                                                   117 
115 #endif /* __HDLC_H */                             118 #endif /* __HDLC_H */
116                                                   119 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php