Re: Intel 10Gb card (82598AF) on 6.9 release

2021-07-17 Thread Adam Stouffer
Jonathan, just wanted to report the patch worked. The card is up and
running. Many thanks.



Re: Intel 10Gb card (82598AF) on 6.9 release

2021-07-17 Thread Adam Stouffer
On Fri, Jul 16, 2021 at 6:47 PM Jonathan Matthew  wrote:
>
>
> I think the problem here is that we don't check if msi is enabled
> before deciding we can use msix.  Can you try this diff out?
> I wrote this after seeing a similar report somewhere, but I can't find
> it now.
>
> Index: pci.c
> ===
> RCS file: /cvs/src/sys/dev/pci/pci.c,v
> retrieving revision 1.119
> diff -u -p -r1.119 pci.c
> --- pci.c   8 Sep 2020 20:13:52 -   1.119
> +++ pci.c   22 Jun 2021 02:55:50 -
> @@ -410,16 +410,48 @@ pcisubmatch(struct device *parent, void
>  }
>
>  int
> +pci_device_msi_enabled(pci_chipset_tag_t pc, pcitag_t tag)
> +{
> +   int off;
> +   pcireg_t cap;
> +   uint64_t addr;
> +
> +   if (pci_get_ht_capability(pc, tag, PCI_HT_CAP_MSI, , )) {
> +   /*
> +* XXX Should we enable MSI mapping ourselves on
> +* systems that have it disabled?
> +*/
> +   if (cap & PCI_HT_MSI_ENABLED) {
> +   if ((cap & PCI_HT_MSI_FIXED) == 0) {
> +   addr = pci_conf_read(pc, tag,
> +   off + PCI_HT_MSI_ADDR);
> +   addr |= (uint64_t)pci_conf_read(pc, tag,
> +   off + PCI_HT_MSI_ADDR_HI32) << 32;
> +   } else
> +   addr = PCI_HT_MSI_FIXED_ADDR;
> +
> +   /*
> +* XXX This will fail to enable MSI on systems
> +* that don't use the canonical address.
> +*/
> +   if (addr == PCI_HT_MSI_FIXED_ADDR)
> +   return (1);
> +   }
> +   }
> +
> +   return (0);
> +}
> +
> +int
>  pci_probe_device(struct pci_softc *sc, pcitag_t tag,
>  int (*match)(struct pci_attach_args *), struct pci_attach_args *pap)
>  {
> pci_chipset_tag_t pc = sc->sc_pc;
> struct pci_attach_args pa;
> struct pci_dev *pd;
> -   pcireg_t id, class, intr, bhlcr, cap;
> +   pcireg_t id, class, intr, bhlcr;
> int pin, bus, device, function;
> -   int off, ret = 0;
> -   uint64_t addr;
> +   int ret = 0;
>
> pci_decompose_tag(pc, tag, , , );
>
> @@ -486,28 +518,8 @@ pci_probe_device(struct pci_softc *sc, p
> }
> pa.pa_intrline = PCI_INTERRUPT_LINE(intr);
>
> -   if (pci_get_ht_capability(pc, tag, PCI_HT_CAP_MSI, , )) {
> -   /*
> -* XXX Should we enable MSI mapping ourselves on
> -* systems that have it disabled?
> -*/
> -   if (cap & PCI_HT_MSI_ENABLED) {
> -   if ((cap & PCI_HT_MSI_FIXED) == 0) {
> -   addr = pci_conf_read(pc, tag,
> -   off + PCI_HT_MSI_ADDR);
> -   addr |= (uint64_t)pci_conf_read(pc, tag,
> -   off + PCI_HT_MSI_ADDR_HI32) << 32;
> -   } else
> -   addr = PCI_HT_MSI_FIXED_ADDR;
> -
> -   /*
> -* XXX This will fail to enable MSI on systems
> -* that don't use the canonical address.
> -*/
> -   if (addr == PCI_HT_MSI_FIXED_ADDR)
> -   pa.pa_flags |= PCI_FLAGS_MSI_ENABLED;
> -   }
> -   }
> +   if (pci_device_msi_enabled(pc, tag))
> +   pa.pa_flags |= PCI_FLAGS_MSI_ENABLED;
>
> /*
>  * Give the MD code a chance to alter pci_attach_args and/or
> @@ -1697,6 +1709,9 @@ int
>  pci_intr_msix_count(pci_chipset_tag_t pc, pcitag_t tag)
>  {
> pcireg_t reg;
> +
> +   if (pci_device_msi_enabled(pc, tag) == 0)
> +   return (0);
>
> if (pci_get_capability(pc, tag, PCI_CAP_MSIX, NULL, ) == 0)
> return (0);

Jonathan, thanks for the quick reply. I've never applied a patch
before but don't mind giving it a shot if you'll bear with me. This
patch would be for the -current tree, correct? So the process would be
to get the -current source, apply the patch, then follow the steps to
compile a new kernel?



Intel 10Gb card (82598AF) on 6.9 release

2021-07-16 Thread Adam Stouffer
I'm having difficulty getting an Intel 10Gb ethernet card recognized
on 6.9. The card is recognized by the ix driver but this error shows
up in dmesg:

ix0 at pci1 dev 0 function 0 "Intel 82598AF" rev
0x01ixgbe_allocate_msix: pci_intr_map_msix vec 0 failed

The rest of dmesg:

OpenBSD 6.9 (GENERIC.MP) #3: Mon Jun  7 08:21:26 MDT 2021

r...@syspatch-69-amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 6341455872 (6047MB)
avail mem = 6133891072 (5849MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.5 @ 0xea0c0 (74 entries)
bios0: vendor Hewlett-Packard version "786F1 v01.35" date 10/23/2015
bios0: Hewlett-Packard HP Compaq dc7800 Small Form Factor
acpi0 at bios0: ACPI 1.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP APIC ASF! MCFG TCPA SLIC HPET DMAR
acpi0: wakeup devices PCI0(S4) COM1(S4) PEG1(S4) PEG2(S4) IGBE(S4)
PCX1(S4) PCX2(S4) PCX5(S4) PCX6(S4) HUB_(S4) USB1(S3) USB2(S3)
USB3(S3) USB4(S3) USB5(S3) USB6(S3) [...]
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz, 2992.96 MHz, 06-17-06
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,NXE,LONG,LAHF,PERF,SENSOR,MELTDOWN
cpu0: 6MB 64b/line 16-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 332MHz
cpu0: mwait min=64, max=64, C-substates=0.2.2.2.2, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz, 2992.51 MHz, 06-17-06
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,NXE,LONG,LAHF,PERF,SENSOR,MELTDOWN
cpu1: 6MB 64b/line 16-way L2 cache
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins, remapped
acpimcfg0 at acpi0
acpimcfg0: addr 0xf400, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (PEG1)
acpiprt2 at acpi0: bus -1 (PEG2)
acpiprt3 at acpi0: bus 32 (PCX1)
acpiprt4 at acpi0: bus 48 (PCX2)
acpiprt5 at acpi0: bus -1 (PCX5)
acpiprt6 at acpi0: bus -1 (PCX6)
acpiprt7 at acpi0: bus 7 (HUB_)
acpipci0 at acpi0 PCI0: 0x 0x0011 0x0001
acpicmos0 at acpi0
"PNP0003" at acpi0 not configured
tpm0 at acpi0 TPM_ addr 0x4e/0x2, device 0x rev 0xff
acpibtn0 at acpi0: PBTN
"PNP0C14" at acpi0 not configured
acpicpu0 at acpi0: !C2(750@40 io@0xf814), C1(1000@20 halt), PSS
acpicpu1 at acpi0: !C2(750@40 io@0xf814), C1(1000@20 halt), PSS
cpu0: Enhanced SpeedStep 2992 MHz: speeds: 3000, 1998 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 82Q35 Host" rev 0x02
ppb0 at pci0 dev 1 function 0 "Intel 82Q35 PCIE" rev 0x02: apic 1 int 16
pci1 at ppb0 bus 1
em0 at pci1 dev 0 function 0 "Intel 82571EB" rev 0x06: apic 1 int 16,
address 00:14:5e:76:e2:48
inteldrm0 at pci0 dev 2 function 0 "Intel 82Q35 Video" rev 0x02
drm0 at inteldrm0
intagp0 at inteldrm0
agp0 at intagp0: aperture at 0xe000, size 0x1000
inteldrm0: apic 1 int 16, G33, gen 3
"Intel 82Q35 HECI" rev 0x02 at pci0 dev 3 function 0 not configured
pciide0 at pci0 dev 3 function 2 "Intel 82Q35 PT IDER" rev 0x02: DMA
(unsupported), channel 0 wired to native-PCI, channel 1 wired to
native-PCI
pciide0: using apic 1 int 18 for native-PCI interrupt
pciide0: channel 0 ignored (not responding; disabled or no drives?)
pciide0: channel 1 ignored (not responding; disabled or no drives?)
puc0 at pci0 dev 3 function 3 "Intel 82Q35 KT" rev 0x02: ports: 16 com
com4 at puc0 port 0 apic 1 int 17: ns16550a, 16 byte fifo
com4: probed fifo depth: 0 bytes
em2 at pci0 dev 25 function 0 "Intel ICH9 IGP AMT" rev 0x02: apic 1
int 19, address 00:1f:29:d3:dc:76
uhci0 at pci0 dev 26 function 0 "Intel 82801I USB" rev 0x02: apic 1 int 20
uhci1 at pci0 dev 26 function 1 "Intel 82801I USB" rev 0x02: apic 1 int 21
uhci2 at pci0 dev 26 function 2 "Intel 82801I USB" rev 0x02: apic 1 int 22
ehci0 at pci0 dev 26 function 7 "Intel 82801I USB" rev 0x02: apic 1 int 22
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 configuration 1 interface 0 "Intel EHCI root hub" rev
2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 "Intel 82801I HD Audio" rev 0x02:
apic 1 int 21
azalia0: codecs: Analog Devices AD1884
audio0 at azalia0
ppb1 at pci0 dev 28 function 0 "Intel 82801I PCIE" rev 0x02
pci2 at ppb1 bus 32
ppb2 at pci0 dev 28 function 1 "Intel 82801I PCIE" rev 0x02: apic 1 int 21
pci3 at ppb2 bus 48
uhci3 at pci0 dev 29 function 0 "Intel 82801I USB" rev 0x02: apic 1 int 20
uhci4 at pci0 dev 29 function 1 "Intel 82801I USB" rev 0x02: apic 1 int 21
ehci1 at pci0 dev 29