tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ixg(4) performances



On Tue, Aug 26, 2014 at 10:25:52AM -0400, Christos Zoulas wrote:
> I would probably extend pcictl with cfgread and cfgwrite commands.

Sure, once it works I can do that, but a first attempt just
ets EINVAL, any idea what can be wrong?

        int fd;
        struct  pciio_bdf_cfgreg pbcr;

        if ((fd = open("/dev/pci5", O_RDWR, 0)) == -1)
                err(EX_OSERR, "open /dev/pci5 failed");

        pbcr.bus = 5;
        pbcr.device = 0;
        pbcr.function = 0;
        pbcr.cfgreg.reg = 0xe6b;
        pbcr.cfgreg.val = 0x2e;

        if (ioctl(fd, PCI_IOC_BDF_CFGWRITE, &pbcr) == -1)
                err(EX_OSERR, "ioctl failed");

Inside the kernel, the only EINVAL is here:
            if (bdfr->bus > 255 || bdfr->device >= sc->sc_maxndevs ||
                    bdfr->function > 7)
                        return EINVAL;

-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index