Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Feb 2008 22:31:06 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 135995 for review
Message-ID:  <200802222231.m1MMV600069327@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=135995

Change 135995 by kmacy@kmacy:entropy:iwarp on 2008/02/22 22:31:04

	register listeners in the case where device is configured after the tom is loaded

Affected files ...

.. //depot/projects/iwarp/sys/dev/cxgb/ulp/tom/cxgb_listen.c#5 edit
.. //depot/projects/iwarp/sys/dev/cxgb/ulp/tom/cxgb_tom.c#9 edit

Differences ...

==== //depot/projects/iwarp/sys/dev/cxgb/ulp/tom/cxgb_listen.c#5 (text+ko) ====

@@ -180,7 +180,6 @@
 	return p;
 }
 
-#if 0
 /*
  * Given a pointer to a listening socket return its server TID by consulting
  * the socket->stid map.  Returns -1 if the socket is not in the map.
@@ -191,16 +190,15 @@
 	int stid = -1, bucket = listen_hashfn(so);
 	struct listen_info *p;
 
-	spin_lock(&d->listen_lock);
+	mtx_lock(&d->listen_lock);
 	for (p = d->listen_hash_tab[bucket]; p; p = p->next)
-		if (p->sk == sk) {
+		if (p->so == so) {
 			stid = p->stid;
 			break;
 		}
-	spin_unlock(&d->listen_lock);
+	mtx_unlock(&d->listen_lock);
 	return stid;
 }
-#endif
 
 /*
  * Delete the listen_info structure for a listening socket.  Returns the server
@@ -244,6 +242,9 @@
 	if (!TOM_TUNABLE(dev, activated))
 		return;
 
+	if (listen_hash_find(d, so) != -1)
+		return;
+	
 	CTR1(KTR_TOM, "start listen on port %u", ntohs(inp->inp_lport));
 	ctx = malloc(sizeof(*ctx), M_CXGB, M_NOWAIT|M_ZERO);
 

==== //depot/projects/iwarp/sys/dev/cxgb/ulp/tom/cxgb_tom.c#9 (text+ko) ====

@@ -92,6 +92,8 @@
 static struct mtx cxgb_list_lock;
 
 static int t3_toe_attach(struct toedev *dev, const struct offload_id *entry);
+static void cxgb_register_listeners(void);
+
 /*
  * Handlers for each CPL opcode
  */
@@ -262,6 +264,7 @@
 
 	/* Activate TCP offload device */
 	activate_offload(tdev);
+	cxgb_register_listeners();
 	return;
 
 out_free_all:
@@ -443,8 +446,11 @@
 t3_tom_init(void)
 {
 	init_cpl_handlers();
-	if (t3_init_cpl_io() < 0)
+	if (t3_init_cpl_io() < 0) {
+		log(LOG_ERR,
+		    "Unable to initialize cpl io ops\n");
 		return -1;
+	}
 	t3_init_socket_ops();
 
 	 /* Register with the TOE device layer. */
@@ -467,7 +473,6 @@
 	/* Register to offloading devices */
 	t3c_tom_client.add = t3c_tom_add;
 	cxgb_register_client(&t3c_tom_client);
-	cxgb_register_listeners();
 	return (0);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802222231.m1MMV600069327>