From f6982511f867bdcfcf85e25d6a2c8950f880e723 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Sat, 14 Jul 2018 16:06:53 +0000 Subject: [PATCH] Fix vnic fallback PHY name matching after r334880. In some cases it seems that the PHY mode can only be identified by matching against the corresponding device node name in the FDT. r334880 broke this for the case where the node name contains a unit address. Fix the problem by allowing a match in that case. Reviewed by: andrew, sbruno Tested by: sbruno Differential Revision: https://reviews.freebsd.org/D16259 --- sys/dev/vnic/thunder_bgx_fdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/vnic/thunder_bgx_fdt.c b/sys/dev/vnic/thunder_bgx_fdt.c index 86ca4d1a4f1f..a295c18d73bd 100644 --- a/sys/dev/vnic/thunder_bgx_fdt.c +++ b/sys/dev/vnic/thunder_bgx_fdt.c @@ -193,7 +193,8 @@ bgx_fdt_phy_name_match(struct bgx *bgx, char *phy_name, ssize_t size) if (sz > size) return (FALSE); - if (strncmp(phy_name, type, sz) == 0) + if (strncmp(phy_name, type, sz - 1) == 0 && + (phy_name[sz - 1] == '\0' || phy_name[sz - 1] == '@')) return (TRUE); return (FALSE);