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 <mar...@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);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to