Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Dec 2019 21:41:53 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r355887 - head/sys/dev/vnic
Message-ID:  <201912182141.xBILfr8u003898@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Wed Dec 18 21:41:53 2019
New Revision: 355887
URL: https://svnweb.freebsd.org/changeset/base/355887

Log:
  vnic: Relax PHY node matching after r336281.
  
  The phy name may apparently be followed by a number in some systems.
  Allow that.
  
  PR:		242654
  Reported and tested by:	Marcel <marcel@brickporch.com>
  MFC after:	3 days
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/dev/vnic/thunder_bgx_fdt.c

Modified: head/sys/dev/vnic/thunder_bgx_fdt.c
==============================================================================
--- head/sys/dev/vnic/thunder_bgx_fdt.c	Wed Dec 18 19:10:30 2019	(r355886)
+++ head/sys/dev/vnic/thunder_bgx_fdt.c	Wed Dec 18 21:41:53 2019	(r355887)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/bitset.h>
 #include <sys/bitstring.h>
 #include <sys/bus.h>
+#include <sys/ctype.h>
 #include <sys/endian.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
@@ -151,6 +152,7 @@ bgx_fdt_phy_name_match(struct bgx *bgx, char *phy_name
 {
 	const char *type;
 	ssize_t sz;
+	char last;
 
 	switch (bgx->qlm_mode) {
 	case QLM_MODE_SGMII:
@@ -193,10 +195,11 @@ bgx_fdt_phy_name_match(struct bgx *bgx, char *phy_name
 
 	if (sz > size)
 		return (FALSE);
-	if (strncmp(phy_name, type, sz - 1) == 0 &&
-	    (phy_name[sz - 1] == '\0' || phy_name[sz - 1] == '@'))
-		return (TRUE);
-
+	if (strncmp(phy_name, type, sz - 1) == 0) {
+		last = phy_name[sz - 1];
+		if (last == '\0' || last == '@' || isdigit(last))
+			return (TRUE);
+	}
 	return (FALSE);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912182141.xBILfr8u003898>