patch-2.1.15 linux/include/linux/skbuff.h
Next file: linux/include/linux/socket.h
Previous file: linux/include/linux/serial.h
Back to the patch index
Back to the overall index
- Lines: 211
- Date:
Thu Dec 12 17:33:16 1996
- Orig file:
v2.1.14/linux/include/linux/skbuff.h
- Orig date:
Thu Dec 12 17:02:46 1996
diff -u --recursive --new-file v2.1.14/linux/include/linux/skbuff.h linux/include/linux/skbuff.h
@@ -44,7 +44,6 @@
#endif
};
-
struct sk_buff
{
struct sk_buff * next; /* Next buffer in list */
@@ -53,57 +52,61 @@
#if CONFIG_SKB_CHECK
int magic_debug_cookie;
#endif
- struct sk_buff *link3; /* Link for IP protocol level buffer chains */
struct sock *sk; /* Socket we are owned by */
unsigned long when; /* used to compute rtt's */
struct timeval stamp; /* Time we arrived */
struct device *dev; /* Device we arrived on/are leaving by */
- union
+
+ /* Transport layer header */
+ union
{
struct tcphdr *th;
- struct ethhdr *eth;
- struct iphdr *iph;
struct udphdr *uh;
+ struct icmphdr *icmph;
+ struct igmphdr *igmph;
+ struct iphdr *ipiph;
+ struct spxhdr *spxh;
unsigned char *raw;
- /* for passing file handles in a unix domain socket */
- void *filp;
} h;
+
+ /* Network layer header */
+ union
+ {
+ struct iphdr *iph;
+ struct ipv6hdr *ipv6h;
+ struct arphdr *arph;
+ struct ipxhdr *ipxh;
+ unsigned char *raw;
+ } nh;
+ /* Link layer header */
union
{
- /* As yet incomplete physical layer views */
- unsigned char *raw;
struct ethhdr *ethernet;
+ unsigned char *raw;
} mac;
-
- struct iphdr *ip_hdr; /* For IPPROTO_RAW */
+
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
- struct ipv6hdr *ipv6_hdr;
-
- /*
- * It would be inefficient to store the nexthop address in every
- * skb. Instead we store a pointer to the respective neighbour
- * cache entry. This might make ndisc cache management harder.
+ /*
+ * Generic "neighbour" information
*/
-
struct neighbour *nexthop;
#endif
- unsigned int len; /* Length of actual data */
- unsigned int csum; /* Checksum */
- __u32 saddr; /* IP source address */
- __u32 daddr; /* IP target address */
- __u32 raddr; /* IP next hop address */
+ struct dst_entry *dst;
+
__u32 seq; /* TCP sequence number */
__u32 end_seq; /* seq [+ fin] [+ syn] + datalen */
__u32 ack_seq; /* TCP ack sequence number */
- unsigned char proto_priv[16]; /* Protocol private data */
+ char cb[32];
+
+ unsigned int len; /* Length of actual data */
+ unsigned int csum; /* Checksum */
volatile char acked, /* Are we acked ? */
used, /* Are we in use ? */
- free, /* How to free this buffer */
arp; /* Has IP/ARP resolution finished */
unsigned char tries, /* Times tried */
- lock, /* Are we locked ? */
- localroute, /* Local routing asserted for this frame */
+ inclone, /* Inline clone */
+ priority,
pkt_type, /* Packet class */
pkt_bridged, /* Tracker for bridging */
ip_summed; /* Driver fed us an IP checksum */
@@ -112,9 +115,9 @@
#define PACKET_MULTICAST 2 /* To group */
#define PACKET_OTHERHOST 3 /* To someone else */
#define PACKET_NDISC 17 /* Outgoing NDISC packet */
- unsigned short users; /* User count - see datagram.c,tcp.c */
+ atomic_t users; /* User count - see datagram.c,tcp.c */
unsigned short protocol; /* Packet protocol from driver. */
- unsigned short truesize; /* Buffer size */
+ unsigned int truesize; /* Buffer size */
atomic_t count; /* reference count */
struct sk_buff *data_skb; /* Link to the actual data skb */
@@ -123,10 +126,16 @@
unsigned char *tail; /* Tail pointer */
unsigned char *end; /* End pointer */
void (*destructor)(struct sk_buff *); /* Destruct function */
- __u16 redirport; /* Redirect port */
- __u16 inclone; /* Inline clone */
#define SKB_CLONE_ORIG 1
#define SKB_CLONE_INLINE 2
+
+#if defined(CONFIG_SHAPER) || defined(CONFIG_SHAPER_MODULE)
+ __u32 shapelatency; /* Latency on frame */
+ __u32 shapeclock; /* Time it should go out */
+ __u32 shapelen; /* Frame length in clocks */
+ __u32 shapestamp; /* Stamp for shaper */
+ __u16 shapepend; /* Pending */
+#endif
};
#ifdef CONFIG_SKB_LARGE
@@ -154,7 +163,7 @@
#if 0
extern void print_skb(struct sk_buff *);
#endif
-extern void kfree_skb(struct sk_buff *skb, int rw);
+extern void __kfree_skb(struct sk_buff *skb);
extern void skb_queue_head_init(struct sk_buff_head *list);
extern void skb_queue_head(struct sk_buff_head *list,struct sk_buff *buf);
extern void skb_queue_tail(struct sk_buff_head *list,struct sk_buff *buf);
@@ -169,10 +178,8 @@
extern void kfree_skbmem(struct sk_buff *skb);
extern struct sk_buff * skb_clone(struct sk_buff *skb, int priority);
extern struct sk_buff * skb_copy(struct sk_buff *skb, int priority);
-extern void skb_device_lock(struct sk_buff *skb);
-extern void skb_device_unlock(struct sk_buff *skb);
-extern void dev_kfree_skb(struct sk_buff *skb, int mode);
-extern int skb_device_locked(struct sk_buff *skb);
+extern struct sk_buff * skb_realloc_headroom(struct sk_buff *skb, int newheadroom);
+#define dev_kfree_skb(a, b) kfree_skb((a), (b))
extern unsigned char * skb_put(struct sk_buff *skb, unsigned int len);
extern unsigned char * skb_push(struct sk_buff *skb, unsigned int len);
extern unsigned char * skb_pull(struct sk_buff *skb, unsigned int len);
@@ -186,6 +193,12 @@
return (list->next == (struct sk_buff *) list);
}
+extern __inline__ void kfree_skb(struct sk_buff *skb, int rw)
+{
+ if (atomic_dec_and_test(&skb->users))
+ __kfree_skb(skb);
+}
+
extern __inline__ struct sk_buff *skb_unshare(struct sk_buff *skb, int pri, int dir)
{
struct sk_buff *nskb;
@@ -474,10 +487,47 @@
}
}
+/* dev_tint can lock buffer at any moment,
+ * so that cli(), unlink it and sti(),
+ * now it is safe.
+ */
+
+extern __inline__ int skb_steal(struct sk_buff *skb)
+{
+ unsigned long flags;
+
+ save_flags(flags);
+ cli();
+ if (skb->next) {
+ skb_unlink(skb);
+ atomic_dec(&skb->users);
+ }
+ restore_flags(flags);
+ return 1;
+}
+
+extern __inline__ void __skb_steal(struct sk_buff *skb)
+{
+ if (skb->next) {
+ skb_unlink(skb);
+ atomic_dec(&skb->users);
+ }
+}
+
+extern __inline__ void skb_orphan(struct sk_buff *skb)
+{
+ if (skb->destructor)
+ skb->destructor(skb);
+ skb->destructor = NULL;
+ skb->sk = NULL;
+}
+
+
#endif
+extern struct sk_buff * skb_realloc_headroom(struct sk_buff *skb, int newheadroom);
extern struct sk_buff * skb_recv_datagram(struct sock *sk,unsigned flags,int noblock, int *err);
-extern int datagram_select(struct sock *sk, int sel_type, select_table *wait);
+extern int datagram_select(struct socket *sock, int sel_type, select_table *wait);
extern int skb_copy_datagram(struct sk_buff *from, int offset, char *to,int size);
extern int skb_copy_datagram_iovec(struct sk_buff *from, int offset, struct iovec *to,int size);
extern void skb_free_datagram(struct sock * sk, struct sk_buff *skb);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov