PERFORCE change 136700 for review

Kip Macy kmacy at FreeBSD.org
Sun Mar 2 23:16:24 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=136700

Change 136700 by kmacy at 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);
 }
 


More information about the p4-projects mailing list