Skip to contentSkip to conversation

No need to inc/dec packet_socks_nr if PACKET_REFCNT_DEBUG is not set

PATCH In review Denis V. Lunev 2 participants 2 messages Nov 8, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 No need to inc/dec packet_socks_nr if PACKET_REFCNT_DEBUG is not set

No need to inc/dec packet_socks_nr if PACKET_REFCNT_DEBUG is not set.

net/packet/af_packet.c renamed from net/packet/af_packet.c.packetrefcnt +5 -1
@@ -135,7 +135,9 @@ dev->hard_header == NULL (ll header is a
    packet classifier depends on it.
  */
 
+#ifdef PACKET_REFCNT_DEBUG
 static atomic_t packet_socks_nr;
+#endif
 
 
 /* Private packet socket structures. */
@@ -232,8 +234,8 @@ static void packet_sock_destruct(struct 
 		return;
 	}
 
-	atomic_dec(&packet_socks_nr);
 #ifdef PACKET_REFCNT_DEBUG
+	atomic_dec(&packet_socks_nr);
 	printk(KERN_DEBUG "PACKET socket %p is free, %d are alive\n", sk, atomic_read(&packet_socks_nr));
 #endif
 }
@@ -1005,7 +1007,9 @@ static int packet_create(struct net *net
 	po->num = proto;
 
 	sk->sk_destruct = packet_sock_destruct;
+#ifdef PACKET_REFCNT_DEBUG
 	atomic_inc(&packet_socks_nr);
+#endif
 
 	/*
 	 *	Attach a protocol block
#1 lore raw

pls disregard this, Pavel have sent one similar already

Quoted 41 lines · Denis V. Lunev

No need to inc/dec packet_socks_nr if PACKET_REFCNT_DEBUG is not set.

net/packet/af_packet.c renamed from net/packet/af_packet.c.packetrefcnt +5 -2
@@ -135,7 +135,9 @@ dev->hard_header == NULL (ll header is a
    packet classifier depends on it.
  */
 
+#ifdef PACKET_REFCNT_DEBUG
 static atomic_t packet_socks_nr;
+#endif
 
 
 /* Private packet socket structures. */
@@ -232,8 +234,8 @@ static void packet_sock_destruct(struct 
 		return;
 	}
 
-	atomic_dec(&packet_socks_nr);
 #ifdef PACKET_REFCNT_DEBUG
+	atomic_dec(&packet_socks_nr);
 	printk(KERN_DEBUG "PACKET socket %p is free, %d are alive\n", sk, atomic_read(&packet_socks_nr));
 #endif
 }
@@ -1005,7 +1007,9 @@ static int packet_create(struct net *net
 	po->num = proto;
 
 	sk->sk_destruct = packet_sock_destruct;
+#ifdef PACKET_REFCNT_DEBUG
 	atomic_inc(&packet_socks_nr);
+#endif
 
 	/*
 	 *	Attach a protocol block
-

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html