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

Ralph Campbell ralph.campbell at qlogic.com
Mon Jul 28 16:53:54 PDT 2008


After looking at this somewhat, I don't see what the bug is.
The various OFED-1.4 files in:
kernel_addons/backport/*/include/linux/dma-mapping.h
either have or don't have #ifndef __x86_64__
depending on whether valid_dma_direction() is defined in
include/asm-x86_64/dma-mapping.h or not.
For the kernel-devel-2.6.18-1.2798.fc6.x86_64.rpm,
include/asm-x86_64/dma-mapping.h does define valid_dma_direction()
and OFED-1.4
kernel_addons/backport/backport/2.6.18_FC6/include/linux/dma-mapping.h
does correctly ifndef __x86_64__ valid_dma_direction().

I don't have an FC6 system handy so I can't reproduce this.

Are you sure that you aren't installing on a patched kernel?
You can check by looking at:
cd /lib/modules/`uname -r`/build/include
grep valid_dma_direction asm-x86_64/dma-mapping.h linux/dma-mapping.h

On Thu, 2008-07-24 at 23:39 -0600, Harold/Carlyn Iuzzolino wrote:
> 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
> 
> 
> _______________________________________________
> general mailing list
> general at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
> 
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general




More information about the general mailing list