ah_attr.grh.flow_label = be32_to_cpup( &grh->version_tclass_flow)  & 0xfffff; ah_attr.grh.traffic_class = (be32_to_cpup( &grh->version_tclass_flow) >> 20) & 0xff; 
ah_attr.grh.flow_label = be32_to_cpu( grh->version_tclass_flow)  & 0xfffff; ah_attr.grh.traffic_class = (be32_to_cpu( grh->version_tclass_flow) >> 20) & 0xff; 
static int agent_mad_send(struct ib_mad_agent *mad_agent,			  struct ib_agent_port_private *port_priv,			  struct ib_mad_private *mad_priv,			  struct ib_grh *grh,			  struct ib_wc *wc){	struct ib_agent_send_wr *agent_send_wr;	struct ib_sge gather_list;	struct ib_send_wr send_wr;	struct ib_send_wr *bad_send_wr;	struct ib_ah_attr ah_attr;	unsigned long flags;	int ret = 1;	agent_send_wr = kmalloc(sizeof(*agent_send_wr), GFP_KERNEL);	if (!agent_send_wr)		goto out;	agent_send_wr->mad = mad_priv;	gather_list.addr = dma_map_single(mad_agent->device->dma_device,					  &mad_priv->mad,					  sizeof(mad_priv->mad),					  DMA_TO_DEVICE);	gather_list.length = sizeof(mad_priv->mad);	gather_list.lkey = mad_agent->mr->lkey;	send_wr.next = NULL;	send_wr.opcode = IB_WR_SEND;	send_wr.sg_list = &gather_list;	send_wr.num_sge = 1;	send_wr.wr.ud.remote_qpn = wc->src_qp; /* DQPN */	send_wr.wr.ud.timeout_ms = 0;	send_wr.send_flags = IB_SEND_SIGNALED | IB_SEND_SOLICITED;	ah_attr.dlid = wc->slid;	ah_attr.port_num = mad_agent->port_num;	ah_attr.src_path_bits = wc->dlid_path_bits;	ah_attr.sl = wc->sl;	ah_attr.static_rate = 0;	ah_attr.ah_flags = 0; /* No GRH */	if (mad_priv->mad.mad.mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT) {		if (wc->wc_flags & IB_WC_GRH) {			ah_attr.ah_flags = IB_AH_GRH;			/* Should sgid be looked up ? */			ah_attr.grh.sgid_index = 0;			ah_attr.grh.hop_limit = grh->hop_limit;			ah_attr.grh.flow_label = be32_to_cpup(				&grh->version_tclass_flow)  & 0xfffff;			ah_attr.grh.traffic_class = (be32_to_cpup(				&grh->version_tclass_flow) >> 20) & 0xff;			memcpy(ah_attr.grh.dgid.raw,			       grh->sgid.raw,			       sizeof(ah_attr.grh.dgid));		}	}	agent_send_wr->ah = ib_create_ah(mad_agent->qp->pd, &ah_attr);	if (IS_ERR(agent_send_wr->ah)) {		printk(KERN_ERR SPFX "No memory for address handle\n");		kfree(agent_send_wr);		goto out;	}	send_wr.wr.ud.ah = agent_send_wr->ah;	if (mad_priv->mad.mad.mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT) {		send_wr.wr.ud.pkey_index = wc->pkey_index;		send_wr.wr.ud.remote_qkey = IB_QP1_QKEY;	} else { 	/* for SMPs */		send_wr.wr.ud.pkey_index = 0;		send_wr.wr.ud.remote_qkey = 0;	}	send_wr.wr.ud.mad_hdr = &mad_priv->mad.mad.mad_hdr;	send_wr.wr_id = (unsigned long)agent_send_wr;	pci_unmap_addr_set(agent_send_wr, mapping, gather_list.addr);	/* Send */	spin_lock_irqsave(&port_priv->send_list_lock, flags);	if (ib_post_send_mad(mad_agent, &send_wr, &bad_send_wr)) {		spin_unlock_irqrestore(&port_priv->send_list_lock, flags);		dma_unmap_single(mad_agent->device->dma_device,				 pci_unmap_addr(agent_send_wr, mapping),				 sizeof(mad_priv->mad),				 DMA_TO_DEVICE);		ib_destroy_ah(agent_send_wr->ah);		kfree(agent_send_wr);	} else {		list_add_tail(&agent_send_wr->send_list,			      &port_priv->send_posted_list);		spin_unlock_irqrestore(&port_priv->send_list_lock, flags);		ret = 0;	}out:	return ret;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/497677ab940e637a41351dca6610bc4320abc8f1/agent.c/clean/drivers/infiniband/core/agent.c