svn commit: r216913 - in projects/ofed/head/sys/ofed: drivers/infiniband/core drivers/infiniband/debug drivers/infiniband/hw/cxgb3 drivers/infiniband/hw/ehca drivers/infiniband/hw/mlx4 drivers/infi...

Jeff Roberson jeff at FreeBSD.org
Mon Jan 3 06:31:52 UTC 2011


Author: jeff
Date: Mon Jan  3 06:31:51 2011
New Revision: 216913
URL: http://svn.freebsd.org/changeset/base/216913

Log:
   - Merge in ofed 1.5.3-rc1 changes from base.
   - Implement minor linux features required to build the merge.
  
  Sponsored by:	Isilon Systems, iX Systems, and Panasas.

Added:
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/genalloc.c
     - copied unchanged from r216911, projects/ofed/base/sys/ofed/drivers/infiniband/hw/cxgb3/genalloc.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/nes/nes_ud.c
     - copied unchanged from r216911, projects/ofed/base/sys/ofed/drivers/infiniband/hw/nes/nes_ud.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/nes/nes_ud.h
     - copied unchanged from r216911, projects/ofed/base/sys/ofed/drivers/infiniband/hw/nes/nes_ud.h
  projects/ofed/head/sys/ofed/include/linux/io-mapping.h
Modified:
  projects/ofed/head/sys/ofed/drivers/infiniband/core/agent.c
  projects/ofed/head/sys/ofed/drivers/infiniband/core/cache.c
  projects/ofed/head/sys/ofed/drivers/infiniband/core/cm.c
  projects/ofed/head/sys/ofed/drivers/infiniband/core/cma.c
  projects/ofed/head/sys/ofed/drivers/infiniband/core/mad.c
  projects/ofed/head/sys/ofed/drivers/infiniband/core/multicast.c
  projects/ofed/head/sys/ofed/drivers/infiniband/core/sa_query.c
  projects/ofed/head/sys/ofed/drivers/infiniband/core/sysfs.c
  projects/ofed/head/sys/ofed/drivers/infiniband/core/ucma.c
  projects/ofed/head/sys/ofed/drivers/infiniband/core/ud_header.c
  projects/ofed/head/sys/ofed/drivers/infiniband/core/user_mad.c
  projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs.h
  projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c
  projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_main.c
  projects/ofed/head/sys/ofed/drivers/infiniband/core/verbs.c
  projects/ofed/head/sys/ofed/drivers/infiniband/debug/memtrack.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_hal.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_hal.h
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_resource.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_resource.h
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/iwch_cm.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/ehca/ehca_main.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/ah.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/cq.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/mad.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/main.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_ib.h
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/mr.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/qp.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/mthca/mthca_dev.h
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/nes/Makefile
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/nes/nes.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/nes/nes.h
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/nes/nes_cm.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/nes/nes_hw.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/nes/nes_hw.h
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/nes/nes_nic.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/nes/nes_utils.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/nes/nes_verbs.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/nes/nes_verbs.h
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib.h
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_7322_regs.h
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_common.h
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_cq.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_diag.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_driver.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_file_ops.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_iba6120.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_iba7220.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_iba7322.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_init.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_intr.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_keys.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_mad.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_mr.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_pcie.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_qp.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_rc.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_sdma.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_trace.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_tx.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_uc.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_ud.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_user_sdma.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_verbs.c
  projects/ofed/head/sys/ofed/drivers/infiniband/hw/qib/qib_verbs.h
  projects/ofed/head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ethtool.c
  projects/ofed/head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
  projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_cma.c
  projects/ofed/head/sys/ofed/drivers/infiniband/ulp/srpt/scst_debug.h
  projects/ofed/head/sys/ofed/drivers/infiniband/util/madeye.c
  projects/ofed/head/sys/ofed/drivers/net/mlx4/alloc.c
  projects/ofed/head/sys/ofed/drivers/net/mlx4/cmd.c
  projects/ofed/head/sys/ofed/drivers/net/mlx4/en_ethtool.c
  projects/ofed/head/sys/ofed/drivers/net/mlx4/en_netdev.c
  projects/ofed/head/sys/ofed/drivers/net/mlx4/en_port.c
  projects/ofed/head/sys/ofed/drivers/net/mlx4/en_port.h
  projects/ofed/head/sys/ofed/drivers/net/mlx4/en_rx.c
  projects/ofed/head/sys/ofed/drivers/net/mlx4/en_tx.c
  projects/ofed/head/sys/ofed/drivers/net/mlx4/fw.c
  projects/ofed/head/sys/ofed/drivers/net/mlx4/main.c
  projects/ofed/head/sys/ofed/drivers/net/mlx4/mcg.c
  projects/ofed/head/sys/ofed/drivers/net/mlx4/mlx4.h
  projects/ofed/head/sys/ofed/drivers/net/mlx4/mlx4_en.h
  projects/ofed/head/sys/ofed/drivers/net/mlx4/pd.c
  projects/ofed/head/sys/ofed/drivers/net/mlx4/port.c
  projects/ofed/head/sys/ofed/drivers/net/mlx4/qp.c
  projects/ofed/head/sys/ofed/include/linux/bitops.h
  projects/ofed/head/sys/ofed/include/linux/io.h
  projects/ofed/head/sys/ofed/include/linux/mlx4/cmd.h
  projects/ofed/head/sys/ofed/include/linux/mlx4/device.h
  projects/ofed/head/sys/ofed/include/linux/mlx4/driver.h
  projects/ofed/head/sys/ofed/include/linux/mlx4/qp.h
  projects/ofed/head/sys/ofed/include/linux/netdevice.h
  projects/ofed/head/sys/ofed/include/linux/types.h
  projects/ofed/head/sys/ofed/include/rdma/ib_addr.h
  projects/ofed/head/sys/ofed/include/rdma/ib_sa.h
  projects/ofed/head/sys/ofed/include/rdma/ib_user_verbs.h
  projects/ofed/head/sys/ofed/include/rdma/ib_verbs.h
Directory Properties:
  projects/ofed/head/sys/ofed/   (props changed)
  projects/ofed/head/sys/ofed/include/linux/   (props changed)

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/agent.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/agent.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/agent.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -48,8 +48,6 @@
 struct ib_agent_port_private {
 	struct list_head port_list;
 	struct ib_mad_agent *agent[2];
-	struct ib_device    *device;
-	u8		     port_num;
 };
 
 static DEFINE_SPINLOCK(ib_agent_port_list_lock);
@@ -60,10 +58,11 @@ __ib_get_agent_port(struct ib_device *de
 {
 	struct ib_agent_port_private *entry;
 
-	list_for_each_entry(entry, &ib_agent_port_list, port_list)
-		if (entry->device == device && entry->port_num == port_num)
+	list_for_each_entry(entry, &ib_agent_port_list, port_list) {
+		if (entry->agent[1]->device == device &&
+		    entry->agent[1]->port_num == port_num)
 			return entry;
-
+	}
 	return NULL;
 }
 
@@ -156,7 +155,7 @@ int ib_agent_port_open(struct ib_device 
 		goto error1;
 	}
 
-	if (rdma_port_link_layer(device, port_num) == IB_LINK_LAYER_INFINIBAND) {
+	if (rdma_port_get_link_layer(device, port_num) == IB_LINK_LAYER_INFINIBAND) {
 		/* Obtain send only MAD agent for SMI QP */
 		port_priv->agent[0] = ib_register_mad_agent(device, port_num,
 							    IB_QPT_SMI, NULL, 0,
@@ -178,9 +177,6 @@ int ib_agent_port_open(struct ib_device 
 		goto error3;
 	}
 
-	port_priv->device = device;
-	port_priv->port_num = port_num;
-
 	spin_lock_irqsave(&ib_agent_port_list_lock, flags);
 	list_add_tail(&port_priv->port_list, &ib_agent_port_list);
 	spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
@@ -188,7 +184,7 @@ int ib_agent_port_open(struct ib_device 
 	return 0;
 
 error3:
-	if (rdma_port_link_layer(device, port_num) == IB_LINK_LAYER_INFINIBAND)
+	if (port_priv->agent[0])
 		ib_unregister_mad_agent(port_priv->agent[0]);
 error2:
 	kfree(port_priv);
@@ -212,7 +208,7 @@ int ib_agent_port_close(struct ib_device
 	spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
 
 	ib_unregister_mad_agent(port_priv->agent[1]);
-	if (rdma_port_link_layer(device, port_num) == IB_LINK_LAYER_INFINIBAND)
+	if (port_priv->agent[0])
 		ib_unregister_mad_agent(port_priv->agent[0]);
 
 	kfree(port_priv);

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/cache.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/cache.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/cache.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -302,7 +302,8 @@ static void ib_cache_event(struct ib_eve
 	    event->event == IB_EVENT_LID_CHANGE  ||
 	    event->event == IB_EVENT_PKEY_CHANGE ||
 	    event->event == IB_EVENT_SM_CHANGE   ||
-	    event->event == IB_EVENT_CLIENT_REREGISTER) {
+	    event->event == IB_EVENT_CLIENT_REREGISTER ||
+	    event->event == IB_EVENT_GID_CHANGE) {
 		work = kmalloc(sizeof *work, GFP_ATOMIC);
 		if (work) {
 			INIT_WORK(&work->work, ib_cache_task);

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/cm.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/cm.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/cm.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -362,7 +362,6 @@ static int cm_init_av_by_path(struct ib_
 	unsigned long flags;
 	int ret;
 	u8 p;
-	int force_grh;
 
 	read_lock_irqsave(&cm.device_lock, flags);
 	list_for_each_entry(cm_dev, &cm.device_list, list) {
@@ -383,10 +382,8 @@ static int cm_init_av_by_path(struct ib_
 		return ret;
 
 	av->port = port;
-	force_grh = rdma_port_link_layer(cm_dev->ib_device, port->port_num) ==
-		IB_LINK_LAYER_ETHERNET ? 1 : 0;
 	ib_init_ah_from_path(cm_dev->ib_device, port->port_num, path,
-			     &av->ah_attr, force_grh);
+			     &av->ah_attr);
 	av->timeout = path->packet_life_time + 1;
 	return 0;
 }
@@ -2446,10 +2443,12 @@ int ib_send_cm_mra(struct ib_cm_id *cm_i
 		msg_response = CM_MSG_RESPONSE_REP;
 		break;
 	case IB_CM_ESTABLISHED:
-		cm_state = cm_id->state;
-		lap_state = IB_CM_MRA_LAP_SENT;
-		msg_response = CM_MSG_RESPONSE_OTHER;
-		break;
+		if (cm_id->lap_state == IB_CM_LAP_RCVD) {
+			cm_state = cm_id->state;
+			lap_state = IB_CM_MRA_LAP_SENT;
+			msg_response = CM_MSG_RESPONSE_OTHER;
+			break;
+		}
 	default:
 		ret = -EINVAL;
 		goto error1;

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/cma.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/cma.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/cma.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -608,7 +608,7 @@ static int cma_ib_init_qp_attr(struct rd
 	int ret;
 	u16 pkey;
 
-	if (rdma_port_link_layer(id_priv->id.device, id_priv->id.port_num) ==
+	if (rdma_port_get_link_layer(id_priv->id.device, id_priv->id.port_num) ==
 	    IB_LINK_LAYER_INFINIBAND)
 		pkey = ib_addr_get_pkey(dev_addr);
 	else
@@ -793,7 +793,7 @@ static inline int cma_user_data_offset(e
 
 static void cma_cancel_route(struct rdma_id_private *id_priv)
 {
-	switch (rdma_port_link_layer(id_priv->id.device, id_priv->id.port_num)) {
+	switch (rdma_port_get_link_layer(id_priv->id.device, id_priv->id.port_num)) {
 	case IB_LINK_LAYER_INFINIBAND:
 		if (id_priv->query)
 			ib_sa_cancel_query(id_priv->query_id, id_priv->query);
@@ -874,7 +874,7 @@ static void cma_leave_mc_groups(struct r
 		mc = container_of(id_priv->mc_list.next,
 				  struct cma_multicast, list);
 		list_del(&mc->list);
-		switch (rdma_port_link_layer(id_priv->cma_dev->device, id_priv->id.port_num)) {
+		switch (rdma_port_get_link_layer(id_priv->cma_dev->device, id_priv->id.port_num)) {
 		case IB_LINK_LAYER_INFINIBAND:
 			ib_sa_free_multicast(mc->multicast.ib);
 			kfree(mc);
@@ -1795,7 +1795,7 @@ static int cma_resolve_iboe_route(struct
 	struct sockaddr_in *src_addr = (struct sockaddr_in *)&route->addr.src_addr;
 	struct sockaddr_in *dst_addr = (struct sockaddr_in *)&route->addr.dst_addr;
 	struct net_device *ndev = NULL;
-	u16 vid = 0;
+	u16 vid;
 
 	if (src_addr->sin_family != dst_addr->sin_family)
 		return -EINVAL;
@@ -1822,9 +1822,7 @@ static int cma_resolve_iboe_route(struct
 		goto err2;
 	}
 
-#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
-	vid = vlan_dev_vlan_id(ndev);
-#endif
+	vid = rdma_vlan_dev_vlan_id(ndev);
 
 	iboe_mac_vlan_to_ll(&route->path_rec->sgid, addr->dev_addr.src_dev_addr, vid);
 	iboe_mac_vlan_to_ll(&route->path_rec->dgid, addr->dev_addr.dst_dev_addr, vid);
@@ -1879,7 +1877,7 @@ int rdma_resolve_route(struct rdma_cm_id
 	atomic_inc(&id_priv->refcount);
 	switch (rdma_node_get_transport(id->device->node_type)) {
 	case RDMA_TRANSPORT_IB:
-		switch (rdma_port_link_layer(id->device, id->port_num)) {
+		switch (rdma_port_get_link_layer(id->device, id->port_num)) {
 		case IB_LINK_LAYER_INFINIBAND:
 			ret = cma_resolve_ib_route(id_priv, timeout_ms);
 			break;
@@ -1941,7 +1939,7 @@ port_found:
 		goto out;
 
 	id_priv->id.route.addr.dev_addr.dev_type =
-		(rdma_port_link_layer(cma_dev->device, p) == IB_LINK_LAYER_INFINIBAND) ?
+		(rdma_port_get_link_layer(cma_dev->device, p) == IB_LINK_LAYER_INFINIBAND) ?
 		ARPHRD_INFINIBAND : ARPHRD_ETHER;
 
 	rdma_addr_set_sgid(&id_priv->id.route.addr.dev_addr, &gid);
@@ -2426,7 +2424,6 @@ static int cma_sidr_rep_handler(struct i
 	struct rdma_cm_event event;
 	struct ib_cm_sidr_rep_event_param *rep = &ib_event->param.sidr_rep_rcvd;
 	int ret = 0;
-	int force_grh;
 
 	if (cma_disable_callback(id_priv, CMA_CONNECT))
 		return 0;
@@ -2456,11 +2453,9 @@ static int cma_sidr_rep_handler(struct i
 			event.status = -EINVAL;
 			break;
 		}
-		force_grh = rdma_port_link_layer(cm_id->device, id_priv->id.port_num) ==
-			IB_LINK_LAYER_ETHERNET ? 1 : 0;
 		ib_init_ah_from_path(id_priv->id.device, id_priv->id.port_num,
 				     id_priv->id.route.path_rec,
-				     &event.param.ud.ah_attr, force_grh);
+				     &event.param.ud.ah_attr);
 		event.param.ud.qp_num = rep->qpn;
 		event.param.ud.qkey = rep->qkey;
 		event.event = RDMA_CM_EVENT_ESTABLISHED;
@@ -3028,7 +3023,7 @@ static void cma_iboe_set_mgid(struct soc
 }
 
 static int cma_iboe_join_multicast(struct rdma_id_private *id_priv,
-				     struct cma_multicast *mc)
+				   struct cma_multicast *mc)
 {
 	struct iboe_mcast_work *work;
 	struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr;
@@ -3116,7 +3111,7 @@ int rdma_join_multicast(struct rdma_cm_i
 
 	switch (rdma_node_get_transport(id->device->node_type)) {
 	case RDMA_TRANSPORT_IB:
-		switch (rdma_port_link_layer(id->device, id->port_num)) {
+		switch (rdma_port_get_link_layer(id->device, id->port_num)) {
 		case IB_LINK_LAYER_INFINIBAND:
 			ret = cma_join_ib_multicast(id_priv, mc);
 			break;
@@ -3161,7 +3156,7 @@ void rdma_leave_multicast(struct rdma_cm
 						&mc->multicast.ib->rec.mgid,
 						mc->multicast.ib->rec.mlid);
 			if (rdma_node_get_transport(id_priv->cma_dev->device->node_type) == RDMA_TRANSPORT_IB) {
-				switch (rdma_port_link_layer(id->device, id->port_num)) {
+				switch (rdma_port_get_link_layer(id->device, id->port_num)) {
 				case IB_LINK_LAYER_INFINIBAND:
 					ib_sa_free_multicast(mc->multicast.ib);
 					kfree(mc);

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/mad.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/mad.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/mad.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -2814,7 +2814,7 @@ static int ib_mad_port_open(struct ib_de
 	init_mad_qp(port_priv, &port_priv->qp_info[1]);
 
 	cq_size = mad_sendq_size + mad_recvq_size;
-	has_smi = rdma_port_link_layer(device, port_num) == IB_LINK_LAYER_INFINIBAND;
+	has_smi = rdma_port_get_link_layer(device, port_num) == IB_LINK_LAYER_INFINIBAND;
 	if (has_smi)
 		cq_size *= 2;
 

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/multicast.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/multicast.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/multicast.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -745,7 +745,7 @@ static void mcast_event_handler(struct i
 	int index;
 
 	dev = container_of(handler, struct mcast_device, event_handler);
-	if (rdma_port_link_layer(dev->device, event->element.port_num) !=
+	if (rdma_port_get_link_layer(dev->device, event->element.port_num) !=
 	    IB_LINK_LAYER_INFINIBAND)
 		return;
 
@@ -776,7 +776,7 @@ static void mcast_add_one(struct ib_devi
 	if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
 		return;
 
-	dev = kzalloc(sizeof *dev + device->phys_port_cnt * sizeof *port,
+	dev = kmalloc(sizeof *dev + device->phys_port_cnt * sizeof *port,
 		      GFP_KERNEL);
 	if (!dev)
 		return;
@@ -789,7 +789,7 @@ static void mcast_add_one(struct ib_devi
 	}
 
 	for (i = 0; i <= dev->end_port - dev->start_port; i++) {
-		if (rdma_port_link_layer(device, dev->start_port + i) !=
+		if (rdma_port_get_link_layer(device, dev->start_port + i) !=
 		    IB_LINK_LAYER_INFINIBAND)
 			continue;
 		port = &dev->port[i];
@@ -828,7 +828,7 @@ static void mcast_remove_one(struct ib_d
 	flush_workqueue(mcast_wq);
 
 	for (i = 0; i <= dev->end_port - dev->start_port; i++) {
-		if (rdma_port_link_layer(device, dev->start_port + i) ==
+		if (rdma_port_get_link_layer(device, dev->start_port + i) ==
 		    IB_LINK_LAYER_INFINIBAND) {
 			port = &dev->port[i];
 			deref_port(port);

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/sa_query.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/sa_query.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/sa_query.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -580,17 +580,17 @@ static void ib_sa_event(struct ib_event_
 		struct ib_sa_port *port =
 			&sa_dev->port[event->element.port_num - sa_dev->start_port];
 
-		if (rdma_port_link_layer(handler->device, port->port_num) == IB_LINK_LAYER_INFINIBAND) {
-			spin_lock_irqsave(&port->ah_lock, flags);
-			if (port->sm_ah)
-				kref_put(&port->sm_ah->ref, free_sm_ah);
-			port->sm_ah = NULL;
-			spin_unlock_irqrestore(&port->ah_lock, flags);
+		if (rdma_port_get_link_layer(handler->device, port->port_num) != IB_LINK_LAYER_INFINIBAND)
+			return;
 
-			schedule_work(&sa_dev->port[event->element.port_num -
-				      sa_dev->start_port].update_task);
-		}
+		spin_lock_irqsave(&port->ah_lock, flags);
+		if (port->sm_ah)
+			kref_put(&port->sm_ah->ref, free_sm_ah);
+		port->sm_ah = NULL;
+		spin_unlock_irqrestore(&port->ah_lock, flags);
 
+		schedule_work(&sa_dev->port[event->element.port_num -
+					    sa_dev->start_port].update_task);
 	}
 }
 
@@ -656,11 +656,11 @@ static u8 get_src_path_mask(struct ib_de
 }
 
 int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
-			 struct ib_sa_path_rec *rec, struct ib_ah_attr *ah_attr,
-			 int force_grh)
+			 struct ib_sa_path_rec *rec, struct ib_ah_attr *ah_attr)
 {
 	int ret;
 	u16 gid_index;
+	int force_grh;
 
 	memset(ah_attr, 0, sizeof *ah_attr);
 	ah_attr->dlid = be16_to_cpu(rec->dlid);
@@ -670,6 +670,8 @@ int ib_init_ah_from_path(struct ib_devic
 	ah_attr->port_num = port_num;
 	ah_attr->static_rate = rec->rate;
 
+	force_grh = rdma_port_get_link_layer(device, port_num) == IB_LINK_LAYER_ETHERNET;
+
 	if (rec->hop_limit > 1 || force_grh) {
 		ah_attr->ah_flags = IB_AH_GRH;
 		ah_attr->grh.dgid = rec->dgid;
@@ -1337,7 +1339,7 @@ static void ib_sa_add_one(struct ib_devi
 
 	for (i = 0; i <= e - s; ++i) {
 		spin_lock_init(&sa_dev->port[i].ah_lock);
-		if (rdma_port_link_layer(device, i + 1) != IB_LINK_LAYER_INFINIBAND)
+		if (rdma_port_get_link_layer(device, i + 1) != IB_LINK_LAYER_INFINIBAND)
 			continue;
 
 		sa_dev->port[i].sm_ah    = NULL;
@@ -1377,14 +1379,14 @@ static void ib_sa_add_one(struct ib_devi
 		goto err;
 
 	for (i = 0; i <= e - s; ++i)
-		if (rdma_port_link_layer(device, i + 1) == IB_LINK_LAYER_INFINIBAND)
+		if (rdma_port_get_link_layer(device, i + 1) == IB_LINK_LAYER_INFINIBAND)
 			update_sm_ah(&sa_dev->port[i].update_task);
 
 	return;
 
 err:
 	while (--i >= 0)
-		if (rdma_port_link_layer(device, i + 1) == IB_LINK_LAYER_INFINIBAND) {
+		if (rdma_port_get_link_layer(device, i + 1) == IB_LINK_LAYER_INFINIBAND) {
 			if (!IS_ERR(sa_dev->port[i].notice_agent))
 				ib_unregister_mad_agent(sa_dev->port[i].notice_agent);
 			if (!IS_ERR(sa_dev->port[i].agent))
@@ -1409,7 +1411,7 @@ static void ib_sa_remove_one(struct ib_d
 	flush_scheduled_work();
 
 	for (i = 0; i <= sa_dev->end_port - sa_dev->start_port; ++i) {
-		if (rdma_port_link_layer(device, i + 1) == IB_LINK_LAYER_INFINIBAND) {
+		if (rdma_port_get_link_layer(device, i + 1) == IB_LINK_LAYER_INFINIBAND) {
 			ib_unregister_mad_agent(sa_dev->port[i].notice_agent);
 			ib_unregister_mad_agent(sa_dev->port[i].agent);
 			if (sa_dev->port[i].sm_ah)

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/sysfs.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/sysfs.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/sysfs.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -79,7 +79,7 @@ static ssize_t port_attr_show(struct kob
 	return port_attr->show(p, port_attr, buf);
 }
 
-static struct sysfs_ops port_sysfs_ops = {
+static const struct sysfs_ops port_sysfs_ops = {
 	.show = port_attr_show
 };
 
@@ -225,7 +225,7 @@ static ssize_t phys_state_show(struct ib
 static ssize_t link_layer_show(struct ib_port *p, struct port_attribute *unused,
 			       char *buf)
 {
-	switch (rdma_port_link_layer(p->ibdev, p->port_num)) {
+	switch (rdma_port_get_link_layer(p->ibdev, p->port_num)) {
 	case IB_LINK_LAYER_INFINIBAND:
 		return sprintf(buf, "%s\n", "IB");
 	case IB_LINK_LAYER_ETHERNET:

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/ucma.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/ucma.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/ucma.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -49,7 +49,7 @@ MODULE_DESCRIPTION("RDMA Userspace Conne
 MODULE_LICENSE("Dual BSD/GPL");
 
 enum {
-	UCMA_MAX_BACKLOG	= 128
+	UCMA_MAX_BACKLOG	= 1024
 };
 
 struct ucma_file {
@@ -584,31 +584,26 @@ static void ucma_copy_ib_route(struct rd
 }
 
 static void ucma_copy_iboe_route(struct rdma_ucm_query_route_resp *resp,
-				   struct rdma_route *route)
+				 struct rdma_route *route)
 {
 	struct rdma_dev_addr *dev_addr;
-#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	struct net_device *dev;
-#endif
 	u16 vid = 0;
 
 	resp->num_paths = route->num_paths;
 	switch (route->num_paths) {
 	case 0:
 		dev_addr = &route->addr.dev_addr;
-		/* XXX Vlan missing. */
-#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if);
-		if (dev) {
-			vid = vlan_dev_vlan_id(dev);
-			dev_put(dev);
-		}
-#endif
+			if (dev) {
+				vid = rdma_vlan_dev_vlan_id(dev);
+				dev_put(dev);
+			}
 
 		iboe_mac_vlan_to_ll((union ib_gid *) &resp->ib_route[0].dgid,
 				    dev_addr->dst_dev_addr, vid);
 		iboe_addr_get_sgid(dev_addr,
-				 (union ib_gid *) &resp->ib_route[0].sgid);
+				   (union ib_gid *) &resp->ib_route[0].sgid);
 		resp->ib_route[0].pkey = cpu_to_be16(0xffff);
 		break;
 	case 2:
@@ -659,7 +654,7 @@ static ssize_t ucma_query_route(struct u
 	resp.node_guid = (__force __u64) ctx->cm_id->device->node_guid;
 	resp.port_num = ctx->cm_id->port_num;
 	if (rdma_node_get_transport(ctx->cm_id->device->node_type) == RDMA_TRANSPORT_IB) {
-		switch (rdma_port_link_layer(ctx->cm_id->device, ctx->cm_id->port_num)) {
+		switch (rdma_port_get_link_layer(ctx->cm_id->device, ctx->cm_id->port_num)) {
 		case IB_LINK_LAYER_INFINIBAND:
 			ucma_copy_ib_route(&resp, &ctx->cm_id->route);
 			break;

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/ud_header.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/ud_header.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/ud_header.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -269,7 +269,7 @@ void ib_ud_header_init(int     		    pay
 	if (lrh_present)
 		header->lrh.packet_length = cpu_to_be16(packet_length);
 
-	if (header->immediate_present)
+	if (immediate_present)
 		header->bth.opcode           = IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE;
 	else
 		header->bth.opcode           = IB_OPCODE_UD_SEND_ONLY;

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/user_mad.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/user_mad.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/user_mad.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -1140,7 +1140,7 @@ static void ib_umad_add_one(struct ib_de
 	for (i = s; i <= e; ++i) {
 		umad_dev->port[i - s].umad_dev = umad_dev;
 
-		if (rdma_port_link_layer(device, i) == IB_LINK_LAYER_INFINIBAND)
+		if (rdma_port_get_link_layer(device, i) == IB_LINK_LAYER_INFINIBAND)
 			if (ib_umad_init_port(device, i, &umad_dev->port[i - s]))
 				goto err;
 	}
@@ -1151,7 +1151,7 @@ static void ib_umad_add_one(struct ib_de
 
 err:
 	while (--i >= s)
-		if (rdma_port_link_layer(device, i) == IB_LINK_LAYER_INFINIBAND)
+		if (rdma_port_get_link_layer(device, i) == IB_LINK_LAYER_INFINIBAND)
 			ib_umad_kill_port(&umad_dev->port[i - s]);
 
 	kref_put(&umad_dev->ref, ib_umad_release_dev);
@@ -1166,7 +1166,7 @@ static void ib_umad_remove_one(struct ib
 		return;
 
 	for (i = 0; i <= umad_dev->end_port - umad_dev->start_port; ++i)
-		if (rdma_port_link_layer(device, i + 1) == IB_LINK_LAYER_INFINIBAND)
+		if (rdma_port_get_link_layer(device, i + 1) == IB_LINK_LAYER_INFINIBAND)
 			ib_umad_kill_port(&umad_dev->port[i]);
 
 	kref_put(&umad_dev->ref, ib_umad_release_dev);

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs.h
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs.h	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs.h	Mon Jan  3 06:31:51 2011	(r216913)
@@ -215,7 +215,6 @@ IB_UVERBS_DECLARE_CMD(modify_xrc_rcv_qp)
 IB_UVERBS_DECLARE_CMD(query_xrc_rcv_qp);
 IB_UVERBS_DECLARE_CMD(reg_xrc_rcv_qp);
 IB_UVERBS_DECLARE_CMD(unreg_xrc_rcv_qp);
-IB_UVERBS_DECLARE_CMD(get_eth_l2_addr);
 
 
 #endif /* UVERBS_H */

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -1856,38 +1856,6 @@ err:
 	return ret;
 }
 
-ssize_t ib_uverbs_get_eth_l2_addr(struct ib_uverbs_file *file, const char __user *buf,
-				  int in_len, int out_len)
-{
-	struct ib_uverbs_get_eth_l2_addr       cmd;
-	struct ib_uverbs_get_eth_l2_addr_resp  resp;
-	int              ret;
-	struct ib_pd    *pd;
-
-	if (out_len < sizeof resp)
-		return -ENOSPC;
-
-	if (copy_from_user(&cmd, buf, sizeof cmd))
-		return -EFAULT;
-
-	pd = idr_read_pd(cmd.pd_handle, file->ucontext);
-	if (!pd)
-		return -EINVAL;
-
-	ret = ib_get_eth_l2_addr(pd->device, cmd.port, (union ib_gid *)cmd.gid,
-				 cmd.sgid_idx, resp.mac, &resp.vlan_id);
-	put_pd_read(pd);
-	if (!ret) {
-		if (copy_to_user((void __user *) (unsigned long) cmd.response,
-				 &resp, sizeof resp))
-			return -EFAULT;
-
-		return in_len;
-	}
-
-	return ret;
-}
-
 ssize_t ib_uverbs_destroy_ah(struct ib_uverbs_file *file,
 			     const char __user *buf, int in_len, int out_len)
 {

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_main.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_main.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_main.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -117,7 +117,6 @@ static ssize_t (*uverbs_cmd_table[])(str
 	[IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP]	= ib_uverbs_query_xrc_rcv_qp,
 	[IB_USER_VERBS_CMD_REG_XRC_RCV_QP]	= ib_uverbs_reg_xrc_rcv_qp,
 	[IB_USER_VERBS_CMD_UNREG_XRC_RCV_QP]	= ib_uverbs_unreg_xrc_rcv_qp,
-	[IB_USER_VERBS_CMD_GET_ETH_L2_ADDR]	= ib_uverbs_get_eth_l2_addr,
 };
 
 #ifdef __linux__

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/verbs.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/core/verbs.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/core/verbs.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -94,7 +94,7 @@ rdma_node_get_transport(enum rdma_node_t
 }
 EXPORT_SYMBOL(rdma_node_get_transport);
 
-enum rdma_link_layer rdma_port_link_layer(struct ib_device *device, u8 port_num)
+enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_num)
 {
 	if (device->get_link_layer)
 		return device->get_link_layer(device, port_num);
@@ -108,7 +108,7 @@ enum rdma_link_layer rdma_port_link_laye
 		return IB_LINK_LAYER_UNSPECIFIED;
 	}
 }
-EXPORT_SYMBOL(rdma_port_link_layer);
+EXPORT_SYMBOL(rdma_port_get_link_layer);
 
 /* Protection domains */
 
@@ -371,8 +371,8 @@ EXPORT_SYMBOL(ib_create_qp);
 
 static const struct {
 	int			valid;
-	enum ib_qp_attr_mask	req_param[IB_QPT_RAW_ETY + 1];
-	enum ib_qp_attr_mask	opt_param[IB_QPT_RAW_ETY + 1];
+	enum ib_qp_attr_mask	req_param[IB_QPT_RAW_ETH + 1];
+	enum ib_qp_attr_mask	opt_param[IB_QPT_RAW_ETH + 1];
 } qp_state_table[IB_QPS_ERR + 1][IB_QPS_ERR + 1] = {
 	[IB_QPS_RESET] = {
 		[IB_QPS_RESET] = { .valid = 1 },
@@ -382,6 +382,7 @@ static const struct {
 				[IB_QPT_UD]  = (IB_QP_PKEY_INDEX		|
 						IB_QP_PORT			|
 						IB_QP_QKEY),
+				[IB_QPT_RAW_ETH] = IB_QP_PORT,
 				[IB_QPT_UC]  = (IB_QP_PKEY_INDEX		|
 						IB_QP_PORT			|
 						IB_QP_ACCESS_FLAGS),
@@ -1001,9 +1002,21 @@ int ib_attach_mcast(struct ib_qp *qp, un
 {
 	if (!qp->device->attach_mcast)
 		return -ENOSYS;
-	if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD)
-		return -EINVAL;
 
+	switch (rdma_node_get_transport(qp->device->node_type)) {
+	case RDMA_TRANSPORT_IB:
+		if (qp->qp_type == IB_QPT_RAW_ETH) {
+			/* In raw Etherent mgids the 63 msb's should be 0 */
+			if (gid->global.subnet_prefix & cpu_to_be64(~1ULL))
+				return -EINVAL;
+		} else if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD)
+			return -EINVAL;
+		break;
+	case RDMA_TRANSPORT_IWARP:
+		if (qp->qp_type != IB_QPT_RAW_ETH)
+			return -EINVAL;
+		break;
+	}
 	return qp->device->attach_mcast(qp, gid, lid);
 }
 EXPORT_SYMBOL(ib_attach_mcast);
@@ -1012,9 +1025,21 @@ int ib_detach_mcast(struct ib_qp *qp, un
 {
 	if (!qp->device->detach_mcast)
 		return -ENOSYS;
-	if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD)
-		return -EINVAL;
 
+	switch (rdma_node_get_transport(qp->device->node_type)) {
+	case RDMA_TRANSPORT_IB:
+		if (qp->qp_type == IB_QPT_RAW_ETH) {
+			/* In raw Etherent mgids the 63 msb's should be 0 */
+			if (gid->global.subnet_prefix & cpu_to_be64(~1ULL))
+				return -EINVAL;
+		} else if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD)
+			return -EINVAL;
+		break;
+	case RDMA_TRANSPORT_IWARP:
+		if (qp->qp_type != IB_QPT_RAW_ETH)
+			return -EINVAL;
+		break;
+	}
 	return qp->device->detach_mcast(qp, gid, lid);
 }
 EXPORT_SYMBOL(ib_detach_mcast);
@@ -1046,12 +1071,3 @@ struct ib_xrcd *ib_alloc_xrcd(struct ib_
 }
 EXPORT_SYMBOL(ib_alloc_xrcd);
 
-int ib_get_eth_l2_addr(struct ib_device *device, u8 port, union ib_gid *gid,
-		       int sgid_idx, u8 *mac, __u16 *vlan_id)
-{
-	if (!device->get_eth_l2_addr)
-		return -ENOSYS;
-
-	return device->get_eth_l2_addr(device, port, gid, sgid_idx, mac, vlan_id);
-}
-EXPORT_SYMBOL(ib_get_eth_l2_addr);

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/debug/memtrack.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/debug/memtrack.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/debug/memtrack.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -435,13 +435,10 @@ static int create_procfs_tree(void)
         for (i=0, bit_mask=1; i<MEMTRACK_NUM_OF_MEMTYPES; ++i, bit_mask<<=1) {
                 if (bit_mask & track_mask) {
                         proc_ent = create_proc_entry(rsc_names[i], S_IRUGO, memtrack_tree);
-                        if ( !proc_ent ) {
+                        if ( !proc_ent )
                                 goto undo_create_root;
-                        }
-                        else {
-                                proc_ent->proc_fops = &memtrack_proc_fops;
-                                proc_ent->owner = THIS_MODULE;
-                        }
+
+			proc_ent->proc_fops = &memtrack_proc_fops;
                 }
         }
 

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_hal.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_hal.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_hal.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -109,7 +109,6 @@ int cxio_hal_cq_op(struct cxio_rdev *rde
 		while (!CQ_VLD_ENTRY(rptr, cq->size_log2, cqe)) {
 			udelay(1);
 			if (i++ > 1000000) {
-				BUG_ON(1);
 				printk(KERN_ERR "%s: stalled rnic\n",
 				       rdev_p->dev_name);
 				return -EIO;

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_hal.h
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_hal.h	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_hal.h	Mon Jan  3 06:31:51 2011	(r216913)
@@ -52,7 +52,7 @@
 #define T3_MAX_PBL_SIZE 256
 #define T3_MAX_RQ_SIZE 1024
 #define T3_MAX_QP_DEPTH (T3_MAX_RQ_SIZE-1)
-#define T3_MAX_CQ_DEPTH 262144
+#define T3_MAX_CQ_DEPTH 65536
 #define T3_MAX_NUM_STAG (1<<15)
 #define T3_MAX_MR_SIZE 0x100000000ULL
 #define T3_PAGESIZE_MASK 0xffff000  /* 4KB-128MB */

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_resource.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_resource.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_resource.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -39,6 +39,8 @@
 #include "cxio_resource.h"
 #include "cxio_hal.h"
 
+#include "genalloc.c"
+
 static struct kfifo *rhdl_fifo;
 static spinlock_t rhdl_fifo_lock;
 

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_resource.h
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_resource.h	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/cxio_resource.h	Mon Jan  3 06:31:51 2011	(r216913)
@@ -38,7 +38,6 @@
 #include <linux/kfifo.h>
 #include <linux/spinlock.h>
 #include <linux/errno.h>
-#include <linux/genalloc.h>
 #include "cxio_hal.h"
 
 extern int cxio_hal_init_rhdl_resource(u32 nr_rhdl);

Copied: projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/genalloc.c (from r216911, projects/ofed/base/sys/ofed/drivers/infiniband/hw/cxgb3/genalloc.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/genalloc.c	Mon Jan  3 06:31:51 2011	(r216913, copy of r216911, projects/ofed/base/sys/ofed/drivers/infiniband/hw/cxgb3/genalloc.c)
@@ -0,0 +1,209 @@
+/*
+ * Basic general purpose allocator for managing special purpose memory
+ * not managed by the regular kmalloc/kfree interface.
+ * Uses for this includes on-device special memory, uncached memory
+ * etc.
+ *
+ * Copyright 2005 (C) Jes Sorensen <jes at trained-monkey.org>
+ *
+ * This source code is licensed under the GNU General Public License,
+ * Version 2.  See the file COPYING for more details.
+ */
+
+/*
+ *  General purpose special memory pool descriptor.
+ */
+struct gen_pool {
+	rwlock_t lock;
+	struct list_head chunks;	/* list of chunks in this pool */
+	int min_alloc_order;		/* minimum allocation order */
+};
+
+/*
+ *  General purpose special memory pool chunk descriptor.
+ */
+struct gen_pool_chunk {
+	spinlock_t lock;
+	struct list_head next_chunk;	/* next chunk in pool */
+	unsigned long start_addr;	/* starting address of memory chunk */
+	unsigned long end_addr;		/* ending address of memory chunk */
+	unsigned long bits[0];		/* bitmap for allocating memory chunk */
+};
+
+/**
+ * gen_pool_create - create a new special memory pool
+ * @min_alloc_order: log base 2 of number of bytes each bitmap bit represents
+ * @nid: node id of the node the pool structure should be allocated on, or -1
+ *
+ * Create a new special memory pool that can be used to manage special purpose
+ * memory not managed by the regular kmalloc/kfree interface.
+ */
+static struct gen_pool *gen_pool_create(int min_alloc_order, int nid)
+{
+	struct gen_pool *pool;
+
+	pool = kmalloc_node(sizeof(struct gen_pool), GFP_KERNEL, nid);
+	if (pool != NULL) {
+		rwlock_init(&pool->lock);
+		INIT_LIST_HEAD(&pool->chunks);
+		pool->min_alloc_order = min_alloc_order;
+	}
+	return pool;
+}
+
+/**
+ * gen_pool_add - add a new chunk of special memory to the pool
+ * @pool: pool to add new memory chunk to
+ * @addr: starting address of memory chunk to add to pool
+ * @size: size in bytes of the memory chunk to add to pool
+ * @nid: node id of the node the chunk structure and bitmap should be
+ *       allocated on, or -1
+ *
+ * Add a new chunk of special memory to the specified pool.
+ */
+static int gen_pool_add(struct gen_pool *pool, unsigned long addr, size_t size,
+		 int nid)
+{
+	struct gen_pool_chunk *chunk;
+	int nbits = size >> pool->min_alloc_order;
+	int nbytes = sizeof(struct gen_pool_chunk) +
+				(nbits + BITS_PER_BYTE - 1) / BITS_PER_BYTE;
+
+	chunk = kmalloc_node(nbytes, GFP_KERNEL, nid);
+	if (unlikely(chunk == NULL))
+		return -1;
+
+	memset(chunk, 0, nbytes);
+	spin_lock_init(&chunk->lock);
+	chunk->start_addr = addr;
+	chunk->end_addr = addr + size;
+
+	write_lock(&pool->lock);
+	list_add(&chunk->next_chunk, &pool->chunks);
+	write_unlock(&pool->lock);
+
+	return 0;
+}
+
+/**
+ * gen_pool_destroy - destroy a special memory pool
+ * @pool: pool to destroy
+ *
+ * Destroy the specified special memory pool. Verifies that there are no
+ * outstanding allocations.
+ */
+static void gen_pool_destroy(struct gen_pool *pool)
+{
+	struct list_head *_chunk, *_next_chunk;
+	struct gen_pool_chunk *chunk;
+	int order = pool->min_alloc_order;
+	int bit, end_bit;
+
+
+	write_lock(&pool->lock);
+	list_for_each_safe(_chunk, _next_chunk, &pool->chunks) {
+		chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk);
+		list_del(&chunk->next_chunk);
+
+		end_bit = (chunk->end_addr - chunk->start_addr) >> order;
+		bit = find_next_bit(chunk->bits, end_bit, 0);
+		BUG_ON(bit < end_bit);
+
+		kfree(chunk);
+	}
+	kfree(pool);
+	return;
+}
+
+/**
+ * gen_pool_alloc - allocate special memory from the pool
+ * @pool: pool to allocate from
+ * @size: number of bytes to allocate from the pool
+ *
+ * Allocate the requested number of bytes from the specified pool.
+ * Uses a first-fit algorithm.
+ */
+static unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
+{
+	struct list_head *_chunk;
+	struct gen_pool_chunk *chunk;
+	unsigned long addr, flags;
+	int order = pool->min_alloc_order;
+	int nbits, bit, start_bit, end_bit;
+
+	if (size == 0)
+		return 0;
+
+	nbits = (size + (1UL << order) - 1) >> order;
+
+	read_lock(&pool->lock);
+	list_for_each(_chunk, &pool->chunks) {
+		chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk);
+
+		end_bit = (chunk->end_addr - chunk->start_addr) >> order;
+		end_bit -= nbits + 1;
+
+		spin_lock_irqsave(&chunk->lock, flags);
+		bit = -1;
+		while (bit + 1 < end_bit) {
+			bit = find_next_zero_bit(chunk->bits, end_bit, bit + 1);
+			if (bit >= end_bit)
+				break;
+
+			start_bit = bit;
+			if (nbits > 1) {
+				bit = find_next_bit(chunk->bits, bit + nbits,
+							bit + 1);
+				if (bit - start_bit < nbits)
+					continue;
+			}
+
+			addr = chunk->start_addr +
+					    ((unsigned long)start_bit << order);
+			while (nbits--)
+				__set_bit(start_bit++, chunk->bits);
+			spin_unlock_irqrestore(&chunk->lock, flags);
+			read_unlock(&pool->lock);
+			return addr;
+		}
+		spin_unlock_irqrestore(&chunk->lock, flags);
+	}
+	read_unlock(&pool->lock);
+	return 0;
+}
+
+/**
+ * gen_pool_free - free allocated special memory back to the pool
+ * @pool: pool to free to
+ * @addr: starting address of memory to free back to pool
+ * @size: size in bytes of memory to free
+ *
+ * Free previously allocated special memory back to the specified pool.
+ */
+static void gen_pool_free(struct gen_pool *pool, unsigned long addr, size_t size)
+{
+	struct list_head *_chunk;
+	struct gen_pool_chunk *chunk;
+	unsigned long flags;
+	int order = pool->min_alloc_order;
+	int bit, nbits;
+
+	nbits = (size + (1UL << order) - 1) >> order;
+
+	read_lock(&pool->lock);
+	list_for_each(_chunk, &pool->chunks) {
+		chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk);
+
+		if (addr >= chunk->start_addr && addr < chunk->end_addr) {
+			BUG_ON(addr + size > chunk->end_addr);
+			spin_lock_irqsave(&chunk->lock, flags);
+			bit = (addr - chunk->start_addr) >> order;
+			while (nbits--)
+				__clear_bit(bit++, chunk->bits);
+			spin_unlock_irqrestore(&chunk->lock, flags);
+			break;
+		}
+	}
+	BUG_ON(nbits > 0);
+	read_unlock(&pool->lock);
+}

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/iwch_cm.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/iwch_cm.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/hw/cxgb3/iwch_cm.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -486,7 +486,8 @@ static int send_connect(struct iwch_ep *
 	    V_MSS_IDX(mtu_idx) |
 	    V_L2T_IDX(ep->l2t->idx) | V_TX_CHANNEL(ep->l2t->smt_idx);
 	opt0l = V_TOS((ep->tos >> 2) & M_TOS) | V_RCV_BUFSIZ(rcv_win>>10);
-	opt2 = V_FLAVORS_VALID(1) | V_CONG_CONTROL_FLAVOR(cong_flavor);
+	opt2 = F_RX_COALESCE_VALID | V_RX_COALESCE(0) | V_FLAVORS_VALID(1) |
+	       V_CONG_CONTROL_FLAVOR(cong_flavor);
 	skb->priority = CPL_PRIORITY_SETUP;
 	set_arp_failure_handler(skb, act_open_req_arp_failure);
 
@@ -1303,7 +1304,8 @@ static void accept_cr(struct iwch_ep *ep
 	    V_MSS_IDX(mtu_idx) |
 	    V_L2T_IDX(ep->l2t->idx) | V_TX_CHANNEL(ep->l2t->smt_idx);
 	opt0l = V_TOS((ep->tos >> 2) & M_TOS) | V_RCV_BUFSIZ(rcv_win>>10);
-	opt2 = V_FLAVORS_VALID(1) | V_CONG_CONTROL_FLAVOR(cong_flavor);
+	opt2 = F_RX_COALESCE_VALID | V_RX_COALESCE(0) | V_FLAVORS_VALID(1) |
+	       V_CONG_CONTROL_FLAVOR(cong_flavor);
 
 	rpl = cplhdr(skb);
 	rpl->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/hw/ehca/ehca_main.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/hw/ehca/ehca_main.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/hw/ehca/ehca_main.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -359,7 +359,8 @@ static int ehca_sense_attributes(struct 
 	 * a firmware property, so it's valid across all adapters
 	 */
 	if (ehca_lock_hcalls == -1)
-		ehca_lock_hcalls = !(shca->hca_cap & HCA_CAP_H_ALLOC_RES_SYNC);
+		ehca_lock_hcalls = !EHCA_BMASK_GET(HCA_CAP_H_ALLOC_RES_SYNC,
+					shca->hca_cap);
 
 	/* translate supported MR page sizes; always support 4K */
 	shca->hca_cap_mr_pgsize = EHCA_PAGESIZE;

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/ah.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/ah.c	Mon Jan  3 05:54:49 2011	(r216912)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/ah.c	Mon Jan  3 06:31:51 2011	(r216913)
@@ -100,15 +100,19 @@ static struct ib_ah *create_iboe_ah(stru
 	int err;
 	int is_mcast;
 	u16 vlan_tag;
+	union ib_gid sgid;
 
 	err = mlx4_ib_resolve_grh(ibdev, ah_attr, mac, &is_mcast, ah_attr->port_num);
 	if (err)
 		return ERR_PTR(err);
 
-	memcpy(ah->av.eth.mac_0_1, mac, 2);
-	memcpy(ah->av.eth.mac_2_5, mac + 2, 4);
-	vlan_tag = rdma_get_vlan_id(&ah_attr->grh.dgid);
-	vlan_tag |= (ah_attr->sl & 7) << 13;
+	memcpy(ah->av.eth.mac, mac, 6);
+	err = ib_get_cached_gid(pd->device, ah_attr->port_num, ah_attr->grh.sgid_index, &sgid);
+	if (err)
+		return ERR_PTR(err);
+	vlan_tag = rdma_get_vlan_id(&sgid);
+	if (vlan_tag < 0x1000)
+		vlan_tag |= (ah_attr->sl & 7) << 13;
 	ah->av.eth.port_pd = cpu_to_be32(to_mpd(pd)->pdn | (ah_attr->port_num << 24));
 	ah->av.eth.gid_index = ah_attr->grh.sgid_index;
 	ah->av.eth.vlan = cpu_to_be16(vlan_tag);
@@ -140,7 +144,7 @@ struct ib_ah *mlx4_ib_create_ah(struct i
 	if (!ah)
 		return ERR_PTR(-ENOMEM);
 
-	if (rdma_port_link_layer(pd->device, ah_attr->port_num) == IB_LINK_LAYER_ETHERNET) {
+	if (rdma_port_get_link_layer(pd->device, ah_attr->port_num) == IB_LINK_LAYER_ETHERNET) {
 		if (!(ah_attr->ah_flags & IB_AH_GRH)) {
 			ret = ERR_PTR(-EINVAL);
 			goto out;
@@ -172,7 +176,7 @@ int mlx4_ib_query_ah(struct ib_ah *ibah,
 	memset(ah_attr, 0, sizeof *ah_attr);
 	ah_attr->sl = be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 28;
 	ah_attr->port_num = be32_to_cpu(ah->av.ib.port_pd) >> 24;
-	ll = rdma_port_link_layer(ibah->device, ah_attr->port_num);
+	ll = rdma_port_get_link_layer(ibah->device, ah_attr->port_num);
 	ah_attr->dlid = ll == IB_LINK_LAYER_INFINIBAND ? be16_to_cpu(ah->av.ib.dlid) : 0;
 	if (ah->av.ib.stat_rate)
 		ah_attr->static_rate = ah->av.ib.stat_rate - MLX4_STAT_RATE_OFFSET;
@@ -199,26 +203,3 @@ int mlx4_ib_destroy_ah(struct ib_ah *ah)
 	return 0;
 }
 
-int mlx4_ib_get_eth_l2_addr(struct ib_device *device, u8 port, union ib_gid *dgid,

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list