Configure DMA atributes?

Peter Senna Tschudin peter.senna at
Mon Aug 12 13:55:35 EDT 2013

There are some PCI Ethernet drivers with code similar to:

From: drivers/net/ethernet/realtek/8139cp.c

        /* Configure DMA attributes. */
        if ((sizeof(dma_addr_t) > 4) &&
            !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)) &&
            !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
                pci_using_dac = 1;
        } else {
                pci_using_dac = 0;

                rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
                if (rc) {
                                "No usable DMA configuration, aborting\n");
                        goto err_out_res;
                rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
                if (rc) {
                                "No usable consistent DMA
configuration, aborting\n");
                        goto err_out_res;

What is this code supposed to do?

I did tests inside two KVM virtual machines using rtl8139 virtual
network interface. One VM configured for x86_64 and the other
configured for i686. On both VMs this code makes no visible difference
at all. I can remove the code completely, or leave only parts of it,
the result is always the same. The 8139cp module is loaded
successfully and the network works after loading the module. Nothing
is shown on dmesg.

If I comment the assignment to pci_using_dac, the compiler issues
warnings, but it makes no visible difference to assign 1 or 0.

If I had real hardware what could I brake by playing with this code?



More information about the Kernelnewbies mailing list