svn commit: r344933 - in stable: 11/sys/dev/cxgbe 12/sys/dev/cxgbe

John Baldwin jhb at FreeBSD.org
Fri Mar 8 19:20:47 UTC 2019


Author: jhb
Date: Fri Mar  8 19:20:46 2019
New Revision: 344933
URL: https://svnweb.freebsd.org/changeset/base/344933

Log:
  MFC 344671: Don't assume all children of a nexus are ports.
  
  Specifically, ccr(4) devices are also children of cxgbe nexus devices.
  Rather than making assumptions about the child device's softc, walk
  the list of ports from the nexus' softc to determine if a child is a
  port in t4_child_location_str().  This fixes a panic when detaching a
  ccr device.

Modified:
  stable/11/sys/dev/cxgbe/t4_main.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/dev/cxgbe/t4_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/dev/cxgbe/t4_main.c
==============================================================================
--- stable/11/sys/dev/cxgbe/t4_main.c	Fri Mar  8 19:07:41 2019	(r344932)
+++ stable/11/sys/dev/cxgbe/t4_main.c	Fri Mar  8 19:20:46 2019	(r344933)
@@ -1338,10 +1338,19 @@ done:
 static int
 t4_child_location_str(device_t bus, device_t dev, char *buf, size_t buflen)
 {
+	struct adapter *sc;
 	struct port_info *pi;
+	int i;
 
-	pi = device_get_softc(dev);
-	snprintf(buf, buflen, "port=%d", pi->port_id);
+	sc = device_get_softc(bus);
+	buf[0] = '\0';
+	for_each_port(sc, i) {
+		pi = sc->port[i];
+		if (pi != NULL && pi->dev == dev) {
+			snprintf(buf, buflen, "port=%d", pi->port_id);
+			break;
+		}
+	}
 	return (0);
 }
 


More information about the svn-src-all mailing list