From owner-p4-projects@FreeBSD.ORG Sun Mar 2 23:16:24 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 07FFB1065674; Sun, 2 Mar 2008 23:16:24 +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 BA3EF1065672 for ; Sun, 2 Mar 2008 23:16:23 +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 93CF18FC1A for ; Sun, 2 Mar 2008 23:16:23 +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 m22NGNBO046588 for ; Sun, 2 Mar 2008 23:16:23 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m22NGNU7046586 for perforce@freebsd.org; Sun, 2 Mar 2008 23:16:23 GMT (envelope-from kmacy@freebsd.org) Date: Sun, 2 Mar 2008 23:16:23 GMT Message-Id: <200803022316.m22NGNU7046586@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 136700 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: Sun, 02 Mar 2008 23:16:24 -0000 http://perforce.freebsd.org/chv.cgi?CH=136700 Change 136700 by kmacy@kmacy:entropy:iwarp on 2008/03/02 23:16:07 Fix missed initialization dependencies Affected files ... .. //depot/projects/iwarp/sys/dev/cxgb/cxgb_main.c#22 edit .. //depot/projects/iwarp/sys/dev/cxgb/cxgb_offload.c#22 edit .. //depot/projects/iwarp/sys/dev/cxgb/ulp/tom/cxgb_tom.c#12 edit Differences ... ==== //depot/projects/iwarp/sys/dev/cxgb/cxgb_main.c#22 (text+ko) ==== @@ -724,9 +724,11 @@ printf("cxgb_free: DEVMAP_BIT not set\n"); } else printf("not offloading set\n"); - +#ifdef notyet + /* XXX need to handle unload in TOM */ if (sc->flags & CXGB_OFLD_INIT) cxgb_offload_deactivate(sc); +#endif free(sc->filters, M_DEVBUF); t3_sge_free(sc); @@ -1722,9 +1724,6 @@ t3_tp_set_offload_mode(adapter, 1); tdev->lldev = pi->ifp; - err = cxgb_offload_activate(adapter); - if (err) - goto out; init_port_mtus(adapter); t3_load_mtus(adapter, adapter->params.mtus, adapter->params.a_wnd, @@ -1736,7 +1735,6 @@ /* Call back all registered clients */ cxgb_add_clients(tdev); -out: /* restore them in case the offload module has changed them */ if (err) { t3_tp_set_offload_mode(adapter, 0); ==== //depot/projects/iwarp/sys/dev/cxgb/cxgb_offload.c#22 (text+ko) ==== @@ -194,7 +194,24 @@ mtx_unlock(&cxgb_db_lock); } +/** + * cxgb_ofld_recv - process n received offload packets + * @dev: the offload device + * @m: an array of offload packets + * @n: the number of offload packets + * + * Process an array of ingress offload packets. Each packet is forwarded + * to any active network taps and then passed to the offload device's receive + * method. We optimize passing packets to the receive method by passing + * it the whole array at once except when there are active taps. + */ +int +cxgb_ofld_recv(struct t3cdev *dev, struct mbuf **m, int n) +{ + return dev->recv(dev, m, n); +} + /* * Dummy handler for Rx offload packets in case we get an offload packet before * proper processing is setup. This complains and drops the packet as it isn't @@ -396,6 +413,7 @@ cxgb_set_dummy_ops(tdev); tdev->type = adap2type(adapter); + tdev->adapter = adapter; register_tdev(tdev); } ==== //depot/projects/iwarp/sys/dev/cxgb/ulp/tom/cxgb_tom.c#12 (text+ko) ==== @@ -109,6 +109,7 @@ static int t3_toe_attach(struct toedev *dev, const struct offload_id *entry); static void cxgb_register_listeners(void); +static void t3c_tom_add(struct t3cdev *cdev); /* * Handlers for each CPL opcode @@ -133,6 +134,7 @@ struct cxgb_client t3c_tom_client = { .name = "tom_cxgb3", + .add = t3c_tom_add, .remove = NULL, .handlers = tom_cpl_handlers, .redirect = NULL @@ -342,7 +344,6 @@ t = malloc(sizeof(*t), M_CXGB, M_WAITOK|M_ZERO); if (!t) return (ENOMEM); - dev->adapter = adapter; err = (EOPNOTSUPP); @@ -434,37 +435,6 @@ return r; } -/** - * cxgb_ofld_recv - process n received offload packets - * @dev: the offload device - * @m: an array of offload packets - * @n: the number of offload packets - * - * Process an array of ingress offload packets. Each packet is forwarded - * to any active network taps and then passed to the offload device's receive - * method. We optimize passing packets to the receive method by passing - * it the whole array at once except when there are active taps. - */ -int -cxgb_ofld_recv(struct t3cdev *dev, struct mbuf **m, int n) -{ - -#if defined(CONFIG_CHELSIO_T3) - if (likely(!netdev_nit)) - return dev->recv(dev, skb, n); - - for ( ; n; n--, skb++) { - skb[0]->dev = dev->lldev; - dev_queue_xmit_nit(skb[0], dev->lldev); - skb[0]->dev = NULL; - dev->recv(dev, skb, 1); - } - return 0; -#else - return dev->recv(dev, m, n); -#endif -} - static struct ifnet * get_iff_from_mac(adapter_t *adapter, const uint8_t *mac, unsigned int vlan) { @@ -750,6 +720,9 @@ if (t == NULL) return; + cdev->send = t3_offload_tx; + cdev->ctl = cxgb_offload_ctl; + if (cdev->ctl(cdev, GET_WR_LEN, &wr_len) < 0) goto out_free_tom; @@ -768,9 +741,6 @@ tdev = &t->tdev; tdev->tod_ttid = cdev2type(cdev); tdev->tod_lldev = cdev->lldev; - - cdev->send = t3_offload_tx; - cdev->ctl = cxgb_offload_ctl; if (register_toedev(tdev, "toe%d")) { printf("unable to register offload device"); @@ -792,8 +762,9 @@ t3cdev_add(t); /* Activate TCP offload device */ + cxgb_offload_activate(TOM_DATA(tdev)->cdev->adapter); + activate_offload(tdev); - cxgb_offload_activate(TOM_DATA(tdev)->cdev->adapter); cxgb_register_listeners(); return; @@ -1474,9 +1445,6 @@ cxgb_toe_listen_stop, NULL, EVENTHANDLER_PRI_ANY); TAILQ_INIT(&cxgb_list); - /* Register to offloading devices */ - t3c_tom_client.add = t3c_tom_add; - cxgb_register_client(&t3c_tom_client); t3_register_cpl_handler(CPL_PASS_OPEN_RPL, do_stid_rpl); @@ -1502,6 +1470,9 @@ t3_register_cpl_handler(CPL_GET_TCB_RPL, do_hwtid_rpl); t3_register_cpl_handler(CPL_SET_TCB_RPL, do_hwtid_rpl); + /* Register to offloading devices */ + cxgb_register_client(&t3c_tom_client); + return (0); }