NetBSD Problem Report #47750

From www@NetBSD.org  Sat Apr 20 03:34:33 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 9769363E5A8
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 20 Apr 2013 03:34:33 +0000 (UTC)
Message-Id: <20130420033431.811A563E5A8@www.NetBSD.org>
Date: Sat, 20 Apr 2013 03:34:31 +0000 (UTC)
From: h-masuda@ootani.nagata.kobe.jp
Reply-To: h-masuda@ootani.nagata.kobe.jp
To: gnats-bugs@NetBSD.org
Subject: if_dge does not recognize Intel PRO/10GbE SR adapter
X-Send-Pr-Version: www-1.0

>Number:         47750
>Category:       kern
>Synopsis:       if_dge does not recognize Intel PRO/10GbE SR adapter
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pgoyette
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 20 03:35:01 +0000 2013
>Closed-Date:    Wed Jun 01 11:30:39 +0000 2016
>Last-Modified:  Thu Dec 08 08:00:03 +0000 2016
>Originator:     MASUDA Hideo
>Release:        NetBSD/i386 6.0
>Organization:
>Environment:
NetBSD pe2600-1.dsm.cis.kit.ac.jp 6.0 NetBSD 6.0 (GENERIC) i386

>Description:
if_dge does not recognize Intel PRO/10GbE SR adapter.

% pcictl /dev/pci0 list
005:05:0: Intel product 0x1a48 (ethernet network, revision 0x02)

% dmesg
vendor 0x8086 product 0x1a48 (ethernet network, revision 0x02) at pci5 dev 5 function 0 not configured


>How-To-Repeat:
Install Intel PRO/10GbE SR adapter and boot NetBSD.

>Fix:
The following patch works well on my machine.

% dmesg | grep dge0
dge0 at pci5 dev 5 function 0: Intel i82597EX 10GbE-SR Ethernet (rev. 0x02)
dge0: interrupting at ioapic2 pin 4
dge0: 64-bit 100MHz PCIX bus
dge0: Ethernet address 00:0e:0c:5a:94:22

Index: if_dge.c
===================================================================
RCS file: /cvs/cvsroot/src/sys/dev/pci/if_dge.c,v
retrieving revision 1.34
diff -u -r1.34 if_dge.c
--- if_dge.c   2 Feb 2012 19:43:05 -0000  1.34
+++ if_dge.c   20 Apr 2013 02:58:19 -0000
@@ -256,6 +256,7 @@
   int sc_bus_speed;    /* PCI/PCIX bus speed */
   int sc_pcix_offset;     /* PCIX capability register offset */

+  const struct dge_product *sc_dgep; /* Pointer to the dge_product entry */
   pci_chipset_tag_t sc_pc;
   pcitag_t sc_pt;
   int sc_mmrbc;        /* Max PCIX memory read byte count */
@@ -455,6 +456,30 @@
 } while (/*CONSTCOND*/0)
 #endif

+/*
+ * Devices supported by this driver.
+ */
+static const struct dge_product {
+  pci_vendor_id_t      dgep_vendor;
+  pci_product_id_t  dgep_product;
+  const char     *dgep_name;
+  int         dgep_flags;
+#define DGEP_F_10G_LR     0x01
+#define DGEP_F_10G_SR     0x02
+} dge_products[] = {
+  { PCI_VENDOR_INTEL,  PCI_PRODUCT_INTEL_82597EX,
+    "Intel i82597EX 10GbE-LR Ethernet",
+    DGEP_F_10G_LR },
+
+  { PCI_VENDOR_INTEL,  PCI_PRODUCT_INTEL_82597EX_SR,
+    "Intel i82597EX 10GbE-SR Ethernet",
+    DGEP_F_10G_SR },
+
+  { 0,        0,
+    NULL,
+    0 },
+};
+
 #ifdef DGE_OFFBYONE_RXBUG
 /*
  * Allocation constants.  Much memory may be used for this.
@@ -644,14 +669,26 @@
 static char (*dge_txseg_evcnt_names)[DGE_NTXSEGS][8 /* "txseg00" + \0 */];
 #endif /* DGE_EVENT_COUNTERS */

+static const struct dge_product *
+dge_lookup(const struct pci_attach_args *pa)
+{
+  const struct dge_product *dgep;
+
+  for (dgep = dge_products; dgep->dgep_name != NULL; dgep++) {
+     if (PCI_VENDOR(pa->pa_id) == dgep->dgep_vendor &&
+         PCI_PRODUCT(pa->pa_id) == dgep->dgep_product)
+        return dgep;
+  }
+  return NULL;
+}
+
 static int
 dge_match(device_t parent, cfdata_t cf, void *aux)
 {
   struct pci_attach_args *pa = aux;

-  if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_INTEL &&
-      PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INTEL_82597EX)
-     return (1);
+  if (dge_lookup(pa) != NULL)
+     return 1;

   return (0);
 }
@@ -670,13 +707,20 @@
   uint8_t enaddr[ETHER_ADDR_LEN];
   pcireg_t preg, memtype;
   uint32_t reg;
+  const struct dge_product *dgep;
+
+  sc->sc_dgep = dgep = dge_lookup(pa);
+  if (dgep == NULL) {
+     printf("\n");
+     panic("dge_attach: impossible");
+  }

   sc->sc_dmat = pa->pa_dmat;
   sc->sc_pc = pa->pa_pc;
   sc->sc_pt = pa->pa_tag;

   pci_aprint_devinfo_fancy(pa, "Ethernet controller",
-     "Intel i82597EX 10GbE-LR Ethernet", 1);
+     dgep->dgep_name, 1);

   memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, DGE_PCI_BAR);
         if (pci_mapreg_map(pa, DGE_PCI_BAR, memtype, 0,
@@ -862,8 +906,13 @@
    */
         ifmedia_init(&sc->sc_media, IFM_IMASK, dge_xgmii_mediachange,
             dge_xgmii_mediastatus);
-        ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_10G_LR, 0, NULL);
-        ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_10G_LR);
+  if (dgep->dgep_flags & DGEP_F_10G_SR) {
+          ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_10G_SR, 0, NULL);
+          ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_10G_SR);
+  } else { /* XXX default is LR */
+          ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_10G_LR, 0, NULL);
+          ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_10G_LR);
+  }

   ifp = &sc->sc_ethercom.ec_if;
   strlcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ);
@@ -2357,7 +2406,11 @@
   struct dge_softc *sc = ifp->if_softc;

   ifmr->ifm_status = IFM_AVALID;
-  ifmr->ifm_active = IFM_ETHER|IFM_10G_LR;
+  if (sc->sc_dgep->dgep_flags & DGEP_F_10G_SR ) {
+     ifmr->ifm_active = IFM_ETHER|IFM_10G_SR;
+  } else {
+     ifmr->ifm_active = IFM_ETHER|IFM_10G_LR;
+  }

   if (CSR_READ(sc, DGE_STATUS) & STATUS_LINKUP)
      ifmr->ifm_status |= IFM_ACTIVE;

Index: pcidevs
===================================================================
RCS file: /cvs/cvsroot/src/sys/dev/pci/pcidevs,v
retrieving revision 1.1102.2.11
diff -u -r1.1102.2.11 pcidevs
--- pcidevs 22 Nov 2012 17:46:09 -0000 1.1102.2.11
+++ pcidevs 20 Apr 2013 02:58:27 -0000
@@ -2501,6 +2501,7 @@
 product INTEL PRO_100_VE_4   0x103d   PRO/100 VE (MOB) Network Controller
 product INTEL PRO_100_VM_5   0x103e   PRO/100 VM (MOB) Network Controller
 product INTEL PRO_WL_2100 0x1043   PRO/Wireless LAN 2100 3B Mini-PCI Adapter
+product INTEL 82597EX_SR  0x1a48   PRO/10GbE SR Server Adapter
 product INTEL 82597EX     0x1048   PRO/10GbE LR Server Adapter
 product INTEL 82801H_M_AMT   0x1049   i82801H (M_AMT) LAN Controller
 product INTEL 82801H_AMT  0x104a   i82801H (AMT) LAN Controller

>Release-Note:

>Audit-Trail:
From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47750 CVS commit: src/sys/dev/pci
Date: Wed, 1 Jun 2016 11:00:15 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Wed Jun  1 11:00:15 UTC 2016

 Modified Files:
 	src/sys/dev/pci: pcidevs

 Log Message:
 Add Intel 82597EX_SR, from PR kern/47750


 To generate a diff of this commit:
 cvs rdiff -u -r1.1250 -r1.1251 src/sys/dev/pci/pcidevs

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: kern-bug-people->pgoyette
Responsible-Changed-By: pgoyette@NetBSD.org
Responsible-Changed-When: Wed, 01 Jun 2016 11:22:31 +0000
Responsible-Changed-Why:
I'll handle this one.


From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47750 CVS commit: src/sys/dev/pci
Date: Wed, 1 Jun 2016 11:28:45 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Wed Jun  1 11:28:45 UTC 2016

 Modified Files:
 	src/sys/dev/pci: if_dge.c

 Log Message:
 Add support for Intel 82597EX_SR - from PR kern/47750


 To generate a diff of this commit:
 cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/if_dge.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Wed, 01 Jun 2016 11:30:39 +0000
State-Changed-Why:
Patch committed.


From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47750 CVS commit: [netbsd-7] src/sys/dev/pci
Date: Thu, 8 Dec 2016 07:56:46 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Thu Dec  8 07:56:45 UTC 2016

 Modified Files:
 	src/sys/dev/pci [netbsd-7]: pcidevs

 Log Message:
 Pull up following revision(s) (requested by msaitoh in ticket #1291):
 	sys/dev/pci/pcidevs: revisions 1.1221-1.1245, 1.1247-1.1262, 1.1264-1.1269, 1.1271-1.1273
 - Add SystemBase SB16C1050 UARTs.
 - Add D-Link DFE520TX (part of PR#49889 reported by Maxim Tsyplakov).
 - Add Realtek RTL8188EE and RTL8192CE
 - Add PLX Technology PEX 8111.
 - Add some Red Hat devices.
 - Add Samsung SM951.
 - Add several NVIDIA geforce and NVS cards.
 - Add some ATI/AMD devices.
 - Add Radeon HD 2400 and TSB82AA2 IEEE 1394 Host Controller.
   Reported by T. M. Pederson (PR#40987).
 - Add some Edimax, AWT, Fusion-io and Ralink devices of ral(4).
 - Add MSI RT3090, Edimax RT3591, Ralink RT 536[02] and RT5390 of
   ral(4).
 - Add vendor ID of Super Micro.
 - Add MegaRAID SAS3008.
 - Fix entries. The following problems were found while sorting entries:
   - Remove the following entries because the value is duplicated:
     CMDTECH_240		(CMDTECH_AAR_1210SA has the same value)
     INTEL_C610_SATA_RAID (INTEL_82801H_SATA_RAID has the same vaule)
     INTEL_C610_PCIE_1_3	(82801BA_HPB has the same value)
     GEFORCE_610M3	(GEFORCE_610M2 has the same value)
   - RADEON_RV350_NQ is not 0x4e41 but 0x4e51
   - 82801JD_SATA_RAID is not 0x3a02 but 0x3a05.
   - The following two entries have the same number. Fix one of them:
     DH89XXCL_USB_2 to 0x23b5	(was 0x23b4 (== DH89XXCL_USB_1))
     5500_HB to 0x3404 and change the desc (was 0x3403 (== 3400_HB))
     82X58_PCIE_0_1 to 0x3421	(was 0x3420 (== 82X58_PCIE_0_0))
     82801JI_THERMAL to 0x3a32	(was 0x3a30 (== 82801JI_SMB))
 - Add the following Intel entries:
   - PCIe NVMe SSD.
   - Dual Band Wireless AC 3165.
   - I219 family Ethernet devices.
   - Dual Band Wireless AC 3165, 4165 and 8260 devices.
   - 82597EX_SR (part of PR#47750).
   - Braswell devices.
   - Core 6G devices.
   - 100 series chipset devices.
   - Xeon D devices.
   - Xeon 5[56]00 devices.
   - Xeon E7 v4 devices.
 - Add "Core i7-6xxxK" to some Intel devices' description.
 - Fix Intel XE5_V3_IMC1_DDRIO_[34]'s values.
 - Add another ID for Intel 82Q45 KT.
 - Add some entries of Intel 965 Express Chipset.
 - Add some Intel Xeon E5 v3 devices.
 - Add some Intel 1st gen Core PCI devices.
 - Add some Intel Core 5G devices.
 - Add some Intel Core i7-6xxxK devices.
 - Add some Intel Core i7-800 and i5-700 devices.
 - Add some Intel 10G devices.
 - Add ASMedia ASM1042A USB 3.0 Host Controller.
 - Add ASMEDIA ASM1083/1085/1142.
 - Add Marvell Armada38x and 88AP510.
 - Add Qualcomm Atheros QCA986x/988x.
 - Add Atheros AR9565 Wireless LAN.
 - Sort entries in device ID's order.
 - Fix typo.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1199.2.6 -r1.1199.2.7 src/sys/dev/pci/pcidevs

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.