On Aug 26, 2:42pm, m...@netbsd.org (Emmanuel Dreyfus) wrote: -- Subject: 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; I think in the example that was 0xe6. I think the .b means byte access (I am guessing). I think that we are only doing word accesses, thus we probably need to read, mask modify write the byte. I have not verified any of that, these are guesses... Look at the pcictl source code. | | 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 | m...@netbsd.org -- End of excerpt from Emmanuel Dreyfus