From owner-p4-projects@FreeBSD.ORG Fri Feb 22 22:31:07 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7D35516A408; Fri, 22 Feb 2008 22:31:07 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2060C16A405 for ; Fri, 22 Feb 2008 22:31:07 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 134F913C478 for ; Fri, 22 Feb 2008 22:31:07 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m1MMV6jY069330 for ; Fri, 22 Feb 2008 22:31:06 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1MMV600069327 for perforce@freebsd.org; Fri, 22 Feb 2008 22:31:06 GMT (envelope-from kmacy@freebsd.org) Date: Fri, 22 Feb 2008 22:31:06 GMT Message-Id: <200802222231.m1MMV600069327@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 135995 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2008 22:31:08 -0000 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); }