u16 slid = in_wc ? in_wc->slid : IB_LID_PERMISSIVE; 
u16 slid = in_wc ? in_wc->slid : be16_to_cpu(IB_LID_PERMISSIVE); 
int mthca_process_mad(struct ib_device *ibdev,		      int mad_flags,		      u8 port_num,		      struct ib_wc *in_wc,		      struct ib_grh *in_grh,		      struct ib_mad *in_mad,		      struct ib_mad *out_mad){	int err;	u8 status;	u16 slid = in_wc ? in_wc->slid : IB_LID_PERMISSIVE;	/* Forward locally generated traps to the SM */	if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP &&	    slid == 0) {		forward_trap(to_mdev(ibdev), port_num, in_mad);		return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED;	}	/*	 * Only handle SM gets, sets and trap represses for SM class	 *	 * Only handle PMA and Mellanox vendor-specific class gets and	 * sets for other classes.	 */	if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_LID_ROUTED ||	    in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) {		if (in_mad->mad_hdr.method   != IB_MGMT_METHOD_GET &&		    in_mad->mad_hdr.method   != IB_MGMT_METHOD_SET &&		    in_mad->mad_hdr.method   != IB_MGMT_METHOD_TRAP_REPRESS)			return IB_MAD_RESULT_SUCCESS;		/*		 * Don't process SMInfo queries or vendor-specific		 * MADs -- the SMA can't handle them.		 */		if (in_mad->mad_hdr.attr_id == IB_SMP_ATTR_SM_INFO ||		    ((in_mad->mad_hdr.attr_id & IB_SMP_ATTR_VENDOR_MASK) ==		     IB_SMP_ATTR_VENDOR_MASK))			return IB_MAD_RESULT_SUCCESS;	} else if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT ||		   in_mad->mad_hdr.mgmt_class == MTHCA_VENDOR_CLASS1     ||		   in_mad->mad_hdr.mgmt_class == MTHCA_VENDOR_CLASS2) {		if (in_mad->mad_hdr.method  != IB_MGMT_METHOD_GET &&		    in_mad->mad_hdr.method  != IB_MGMT_METHOD_SET)			return IB_MAD_RESULT_SUCCESS;	} else		return IB_MAD_RESULT_SUCCESS;	err = mthca_MAD_IFC(to_mdev(ibdev),			    mad_flags & IB_MAD_IGNORE_MKEY,			    mad_flags & IB_MAD_IGNORE_BKEY,			    port_num, in_wc, in_grh, in_mad, out_mad,			    &status);	if (err) {		mthca_err(to_mdev(ibdev), "MAD_IFC failed\n");		return IB_MAD_RESULT_FAILURE;	}	if (status == MTHCA_CMD_STAT_BAD_PKT)		return IB_MAD_RESULT_SUCCESS;	if (status) {		mthca_err(to_mdev(ibdev), "MAD_IFC returned status %02x\n",			  status);		return IB_MAD_RESULT_FAILURE;	}	if (!out_mad->mad_hdr.status)		smp_snoop(ibdev, port_num, in_mad);	/* set return bit in status of directed route responses */	if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)		out_mad->mad_hdr.status |= cpu_to_be16(1 << 15);	if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP_REPRESS)		/* no response for trap repress */		return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED;	return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/97f52eb438be7caebe026421545619d8a0c1398a/mthca_mad.c/buggy/drivers/infiniband/hw/mthca/mthca_mad.c