PERFORCE change 118397 for review

Kip Macy kmacy at FreeBSD.org
Thu Apr 19 07:23:56 UTC 2007


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

Change 118397 by kmacy at kmacy_vt-x:opentoe_init on 2007/04/19 07:22:58

	remove last vestiges of t3cdev
	enable offload support at attach time

Affected files ...

.. //depot/projects/opentoe/sys/dev/cxgb/cxgb_adapter.h#8 edit
.. //depot/projects/opentoe/sys/dev/cxgb/cxgb_l2t.c#2 edit
.. //depot/projects/opentoe/sys/dev/cxgb/cxgb_main.c#5 edit
.. //depot/projects/opentoe/sys/dev/cxgb/cxgb_offload.c#5 edit
.. //depot/projects/opentoe/sys/dev/cxgb/cxgb_offload.h#5 edit
.. //depot/projects/opentoe/sys/dev/cxgb/cxgb_osdep.h#6 edit
.. //depot/projects/opentoe/sys/dev/cxgb/cxgb_sge.c#6 edit

Differences ...

==== //depot/projects/opentoe/sys/dev/cxgb/cxgb_adapter.h#8 (text+ko) ====

@@ -128,14 +128,6 @@
 	struct sge_lro_session s[MAX_LRO_PER_QSET];
 };
 
-/* has its own header on linux XXX
- * but I don't even know what it is :-/
- */
-
-struct t3cdev {
-	int foo; /* XXX fill in */
-};
-
 #define RX_BUNDLE_SIZE 8
 
 struct rsp_desc;
@@ -298,6 +290,7 @@
 	struct toedev           tdev;
 	char                    fw_version[64];
 	uint32_t                open_device_map;
+	uint32_t                registered_device_map;
 	struct mtx              lock;
 };
 

==== //depot/projects/opentoe/sys/dev/cxgb/cxgb_l2t.c#2 (text+ko) ====

@@ -1,42 +1,9 @@
-/*
- * Copyright (c) 2006 Chelsio, Inc. All rights reserved.
- * Copyright (c) 2006 Open Grid Computing, Inc. All rights reserved.
- *
- * This software is available to you under a choice of one of two
- * licenses.  You may choose to be licensed under the terms of the GNU
- * General Public License (GPL) Version 2, available from the file
- * COPYING in the main directory of this source tree, or the
- * OpenIB.org BSD license below:
- *
- *     Redistribution and use in source and binary forms, with or
- *     without modification, are permitted provided that the following
- *     conditions are met:
- *
- *      - Redistributions of source code must retain the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer.
- *
- *      - Redistributions in binary form must reproduce the above
- *        copyright notice, this list of conditions and the following
- *        disclaimer in the documentation and/or other materials
- *        provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include <linux/if.h>
 #include <linux/if_vlan.h>
 #include <linux/jhash.h>
 #include <net/neighbour.h>
-#include "t3cdev.h"
 #include "cxgb3_defs.h"
 #include "l2t.h"
 #include "t3_cpl.h"
@@ -83,7 +50,7 @@
  * supplied skb is used for the CPL_L2T_WRITE_REQ.  Must be called with the
  * entry locked.
  */
-static int setup_l2e_send_pending(struct t3cdev *dev, struct sk_buff *skb,
+static int setup_l2e_send_pending(struct toedev *dev, struct sk_buff *skb,
 				  struct l2t_entry *e)
 {
 	struct cpl_l2t_write_req *req;
@@ -130,7 +97,7 @@
 	e->arpq_tail = skb;
 }
 
-int t3_l2t_send_slow(struct t3cdev *dev, struct sk_buff *skb,
+int t3_l2t_send_slow(struct toedev *dev, struct sk_buff *skb,
 		     struct l2t_entry *e)
 {
 again:
@@ -178,7 +145,7 @@
 }
 EXPORT_SYMBOL(t3_l2t_send_slow);
 
-void t3_l2t_send_event(struct t3cdev *dev, struct l2t_entry *e)
+void t3_l2t_send_event(struct toedev *dev, struct l2t_entry *e)
 {
 again:
 	switch (e->state) {
@@ -299,7 +266,7 @@
 	spin_unlock(&e->lock);
 }
 
-struct l2t_entry *t3_l2t_get(struct t3cdev *dev, struct neighbour *neigh,
+struct l2t_entry *t3_l2t_get(struct toedev *dev, struct neighbour *neigh,
 			     unsigned int smt_idx)
 {
 	struct l2t_entry *e;
@@ -350,7 +317,7 @@
  * XXX: maybe we should abandon the latter behavior and just require a failure
  * handler.
  */
-static void handle_failed_resolution(struct t3cdev *dev, struct sk_buff *arpq)
+static void handle_failed_resolution(struct toedev *dev, struct sk_buff *arpq)
 {
 	while (arpq) {
 		struct sk_buff *skb = arpq;
@@ -369,7 +336,7 @@
  * Called when the host's ARP layer makes a change to some entry that is
  * loaded into the HW L2 table.
  */
-void t3_l2t_update(struct t3cdev *dev, struct neighbour *neigh)
+void t3_l2t_update(struct toedev *dev, struct neighbour *neigh)
 {
 	struct l2t_entry *e;
 	struct sk_buff *arpq = NULL;
@@ -415,7 +382,7 @@
 /*
  * Called from a kprobe, interrupts are off.
  */
-void t3_l2t_update(struct t3cdev *dev, struct neighbour *neigh)
+void t3_l2t_update(struct toedev *dev, struct neighbour *neigh)
 {
 	struct l2t_entry *e;
 	struct l2t_data *d = L2DATA(dev);
@@ -444,7 +411,7 @@
 	struct sk_buff *arpq = NULL;
 	struct l2t_entry *e = (struct l2t_entry *)data;
 	struct neighbour *neigh = e->neigh;
-	struct t3cdev *dev = e->tdev;
+	struct toedev *dev = e->tdev;
 
 	barrier();
 	if (!atomic_read(&e->refcnt))

==== //depot/projects/opentoe/sys/dev/cxgb/cxgb_main.c#5 (text+ko) ====

@@ -79,6 +79,7 @@
 #include <dev/cxgb/cxgb_osdep.h>
 #include <dev/cxgb/common/cxgb_common.h>
 #include <dev/cxgb/cxgb_ioctl.h>
+#include <dev/cxgb/cxgb_offload.h>
 #include <dev/cxgb/common/cxgb_regs.h>
 #include <dev/cxgb/common/cxgb_t3_cpl.h>
 #include <dev/cxgb/common/cxgb_firmware_exports.h>
@@ -504,6 +505,11 @@
 	if (error)
 		goto out;
 	
+	if (is_offload(sc)) {
+		setbit(&sc->registered_device_map, OFFLOAD_DEVMAP_BIT);
+		cxgb_adapter_ofld(sc);
+        }
+	
 	snprintf(&sc->fw_version[0], sizeof(sc->fw_version), "%d.%d", G_FW_VERSION_MAJOR(vers),
 	    G_FW_VERSION_MINOR(vers));
 

==== //depot/projects/opentoe/sys/dev/cxgb/cxgb_offload.c#5 (text+ko) ====

@@ -204,10 +204,10 @@
 	return 0;
 }
 
-static struct net_device *
+static struct ifnet *
 get_iff_from_mac(adapter_t *adapter, const uint8_t *mac, unsigned int vlan)
 {
-#ifdef notyet
+#ifdef notyet	
 	int i;
 
 	for_each_port(adapter, i) {
@@ -215,8 +215,8 @@
 		const struct port_info *p = &adapter->port[i];
 		struct ifnet *ifnet = p->ifp;
 
-		if (!memcmp(port->hw_addr, mac, ETH_ALEN)) {
-			if (vlan && vlan != VLAN_VID_MASK) {
+		if (!memcmp(p->hw_addr, mac, ETHER_ADDR_LEN)) {
+			if (vlan && vlan != EVL_VLID_MASK) {
 				grp = p->vlan_grp;
 				dev = grp ? grp->vlan_devices[vlan] : NULL;
 			} else
@@ -225,7 +225,7 @@
 			return dev;
 		}
 	}
-#endif		
+#endif	
 	return NULL;
 }
 
@@ -1444,7 +1444,7 @@
 	mtx_unlock(&cxgb_db_lock);	
 }
 
-void __devinit
+void
 cxgb_adapter_ofld(struct adapter *adapter)
 {
 	struct toedev *tdev = &adapter->tdev;

==== //depot/projects/opentoe/sys/dev/cxgb/cxgb_offload.h#5 (text+ko) ====

@@ -256,8 +256,8 @@
 void cxgb_redirect(struct dst_entry *old, struct dst_entry *new);
 #endif
 int process_rx(struct toedev *dev, struct mbuf **m, int n);
-int attach_t3cdev(struct toedev *dev);
-void detach_t3cdev(struct toedev *dev);
+int attach_toedev(struct toedev *dev);
+void detach_toedev(struct toedev *dev);
 
 
 #endif

==== //depot/projects/opentoe/sys/dev/cxgb/cxgb_osdep.h#6 (text+ko) ====

@@ -138,6 +138,9 @@
 #define t3_os_sleep(x) DELAY((x) * 1000)
 
 #define max_t(type, a, b) (type)max((a), (b))
+#define net_device ifnet
+
+
 
 /* Standard PHY definitions */
 #define BMCR_LOOPBACK		BMCR_LOOP

==== //depot/projects/opentoe/sys/dev/cxgb/cxgb_sge.c#6 (text+ko) ====

@@ -1690,13 +1690,13 @@
 #define NOMEM_INTR_DELAY 2500
 
 static __inline void
-deliver_partial_bundle(struct t3cdev *tdev, struct sge_rspq *q)
+deliver_partial_bundle(struct toedev *tdev, struct sge_rspq *q)
 {
 	;
 }
 
 static __inline void
-rx_offload(struct t3cdev *tdev, struct sge_rspq *rq,
+rx_offload(struct toedev *tdev, struct sge_rspq *rq,
     struct mbuf *m)
 {
 #ifdef notyet


More information about the p4-projects mailing list