patch-1.3.77 linux/net/ipv4/ip_fragment.c
Next file: linux/net/ipv4/proc.c
Previous file: linux/net/ipv4/af_inet.c
Back to the patch index
Back to the overall index
- Lines: 71
- Date:
Wed Mar 20 15:14:14 1996
- Orig file:
v1.3.76/linux/net/ipv4/ip_fragment.c
- Orig date:
Wed Nov 8 07:11:45 1995
diff -u --recursive --new-file v1.3.76/linux/net/ipv4/ip_fragment.c linux/net/ipv4/ip_fragment.c
@@ -45,7 +45,7 @@
static struct ipq *ipqueue = NULL; /* IP fragment queue */
-unsigned long ip_frag_mem = 0; /* Memory used for fragments */
+atomic_t ip_frag_mem = 0; /* Memory used for fragments */
/*
* Memory Tracking Functions
@@ -53,34 +53,22 @@
extern __inline__ void frag_kfree_skb(struct sk_buff *skb, int type)
{
- unsigned long flags;
- save_flags(flags);
- cli();
- ip_frag_mem-=skb->truesize;
- restore_flags(flags);
+ atomic_sub(skb->truesize, &ip_frag_mem);
kfree_skb(skb,type);
}
extern __inline__ void frag_kfree_s(void *ptr, int len)
{
- unsigned long flags;
- save_flags(flags);
- cli();
- ip_frag_mem-=len;
- restore_flags(flags);
+ atomic_sub(len, &ip_frag_mem);
kfree_s(ptr,len);
}
extern __inline__ void *frag_kmalloc(int size, int pri)
{
- unsigned long flags;
void *vp=kmalloc(size,pri);
if(!vp)
return NULL;
- save_flags(flags);
- cli();
- ip_frag_mem+=size;
- restore_flags(flags);
+ atomic_add(size, &ip_frag_mem);
return vp;
}
@@ -623,7 +611,6 @@
struct sk_buff *skb2;
int left, mtu, hlen, len;
int offset;
- unsigned long flags;
/*
* Point into the IP datagram header.
@@ -730,14 +717,11 @@
* it might possess
*/
- save_flags(flags);
if (sk)
{
- cli();
- sk->wmem_alloc += skb2->truesize;
+ atomic_add(skb2->truesize, &sk->wmem_alloc);
skb2->sk=sk;
}
- restore_flags(flags);
skb2->raddr = skb->raddr; /* For rebuild_header - must be here */
/*
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this