[ofa-general] Problem with ipath_dma.c and dma-mapping.h

Harold/Carlyn Iuzzolino iuzzolin at nmia.com
Thu Jul 24 22:39:32 PDT 2008


Dear Openfabrics,  general at lists.openfabrics.org

I am trying to compile OFED-1.4-20080724-0600.tgz, the latest-and-greatest
version as of today July 24.

Fedora Core release 6 (Zod)
Kernel 2.6.18-1.2798.fc6xen on an x86_64

[root at elrond ~]# uname -a
Linux elrond 2.6.18-1.2798.fc6xen #1 SMP Mon Oct 16 14:59:01 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux

It is a Single core 64 bit 2.4 GHz machine


I run the install.pl script with no changes and made these choices
OFED Distribution Software Installation Menu
   2) Install OFED Software
OFED Distribution Software Installation Menu
   3) All packages (all of Basic, HPC)
Please choose an implementation of MVAPICH2:
   1) OFA (IB and iWARP)
Enable ROMIO support [Y/n]: y
Enable shared library support [Y/n]: y
Enable Checkpoint-Restart support [y/N]: n


I have run into the following error:


/var/tmp/OFED_topdir/BUILD/ofa_kernel-1.4/drivers/infiniband/hw/ipath/ipath_dma.c:58: error: implicit declaration of function 'valid_dma_direction'

The code it is complaining about is
ipath_dma.c:    BUG_ON(!valid_dma_direction(direction));  

This subroutine valid_dma_direction is USED 6 times in one file ipath_dma.c
but isn't DEFINED anywhere.

If I cd up 3 levels and search recursively for valid_dma_direction,
I find valid_dma_direction in 24 files, all dma-mapping.h for different
versions of the kernel_addons backports.

dma-mapping.h has this kind of code:
#ifndef __x86_64__ 

/* x86_64 was the only architecture that had valid_dma_direction
 * before 2.6.18 */

static inline int valid_dma_direction(int dma_direction)
{
        return ((dma_direction == DMA_BIDIRECTIONAL) ||
                (dma_direction == DMA_TO_DEVICE) ||
                (dma_direction == DMA_FROM_DEVICE));
}
#endif


I added the line
#include <linux/dma-mapping.h> 
to the file ipath_dma.c 
(/var/tmp/OFED_topdir/BUILD/ofa_kernel-1.4/drivers/infiniband/hw/ipath/ipath_dma.c)

That didn't work. The reason is that since this is a 64 bit machine, the
definition: static inline int valid_dma_direction(int dma_direction)
isn't included because of the #ifndef __x86_64__ statement.

So I went into the dma-mapping.h file and put
#undef __x86_64__
before the ifndef __x86_64__ so that the definition of valid_dma_direction(int dma_direction) is included.


SUCCESS, sort of. That subroutine DID compile. BUT a file later on didn't
compile.

BUT I shouldn't have to do fixes like that. And the question is, if
this is a 64 bit machine, and the dma-mapping.h defines valid_dma_direction
ONLY IF you are NOT compiling for a 64 bit machine, then the Openfabrics
files: ipath_dma.c and/or dma-mapping.h have some kind of mistake.

Has anybody else run into this problem? Do you know what the correct code
is? Can you get Openfabrics to incorporate the fix into their code?

Carlyn Iuzzolino





More information about the general mailing list