patch-2.2.11 linux/include/net/sock.h

Next file: linux/include/net/tcp.h
Previous file: linux/include/net/pkt_cls.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.10/linux/include/net/sock.h linux/include/net/sock.h
@@ -300,6 +300,7 @@
 
 	__u32	last_seg_size;	/* Size of last incoming segment */
 	__u32	rcv_mss;	/* MSS used for delayed ACK decisions */ 
+	__u32 	partial_writers; /* # of clients wanting at the head packet */
 
 	struct open_request	*syn_wait_queue;
 	struct open_request	**syn_wait_last;
@@ -584,9 +585,7 @@
 	/* Keeping track of sk's, looking them up, and port selection methods. */
 	void			(*hash)(struct sock *sk);
 	void			(*unhash)(struct sock *sk);
-	void			(*rehash)(struct sock *sk);
-	unsigned short		(*good_socknum)(void);
-	int			(*verify_bind)(struct sock *sk, unsigned short snum);
+	int			(*get_port)(struct sock *sk, unsigned short snum);
 
 	unsigned short		max_header;
 	unsigned long		retransmits;
@@ -622,22 +621,26 @@
 /* Some things in the kernel just want to get at a protocols
  * entire socket list commensurate, thus...
  */
+static __inline__ void __add_to_prot_sklist(struct sock *sk)
+{
+	struct proto *p = sk->prot;
+
+	sk->sklist_prev = (struct sock *) p;
+	sk->sklist_next = p->sklist_next;
+	p->sklist_next->sklist_prev = sk;
+	p->sklist_next = sk;
+
+	/* Charge the protocol. */
+	sk->prot->inuse += 1;
+	if(sk->prot->highestinuse < sk->prot->inuse)
+		sk->prot->highestinuse = sk->prot->inuse;
+}
+
 static __inline__ void add_to_prot_sklist(struct sock *sk)
 {
 	SOCKHASH_LOCK();
-	if(!sk->sklist_next) {
-		struct proto *p = sk->prot;
-
-		sk->sklist_prev = (struct sock *) p;
-		sk->sklist_next = p->sklist_next;
-		p->sklist_next->sklist_prev = sk;
-		p->sklist_next = sk;
-
-		/* Charge the protocol. */
-		sk->prot->inuse += 1;
-		if(sk->prot->highestinuse < sk->prot->inuse)
-			sk->prot->highestinuse = sk->prot->inuse;
-	}
+	if(!sk->sklist_next)
+		__add_to_prot_sklist(sk);
 	SOCKHASH_UNLOCK();
 }
 
@@ -670,9 +673,9 @@
 #if 0
 /* debugging code: the test isn't even 100% correct, but it can catch bugs */
 /* Note that a double lock is ok in theory - it's just _usually_ a bug */
+/* Actually it can easily happen with multiple writers */ 
 	if (atomic_read(&sk->sock_readers)) {
-		__label__ here;
-		printk("double lock on socket at %p\n", &&here);
+		printk("double lock on socket at %p\n", gethere());
 here:
 	}
 #endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)