Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2015 08:57:48 +0000 (UTC)
From:      Andrew Rybchenko <arybchik@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r283599 - head/sys/dev/sfxge
Message-ID:  <201505270857.t4R8vmRa050865@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arybchik
Date: Wed May 27 08:57:48 2015
New Revision: 283599
URL: https://svnweb.freebsd.org/changeset/base/283599

Log:
  sfxge: mask ifmedia options (pauses) when looking for matching mode
  
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:      2 days
  Differential Revision: https://reviews.freebsd.org/D2656

Modified:
  head/sys/dev/sfxge/sfxge_port.c

Modified: head/sys/dev/sfxge/sfxge_port.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_port.c	Wed May 27 08:30:16 2015	(r283598)
+++ head/sys/dev/sfxge/sfxge_port.c	Wed May 27 08:57:48 2015	(r283599)
@@ -822,6 +822,8 @@ sfxge_link_mode_to_phy_cap(efx_link_mode
 static int
 sfxge_phy_cap_mask(struct sfxge_softc *sc, int ifmedia, uint32_t *phy_cap_mask)
 {
+	/* Get global options (duplex), type and subtype bits */
+	int ifmedia_masked = ifmedia & (IFM_GMASK | IFM_NMASK | IFM_TMASK);
 	efx_phy_media_type_t medium_type;
 	boolean_t mode_found = B_FALSE;
 	uint32_t cap_mask, mode_cap_mask;
@@ -837,7 +839,7 @@ sfxge_phy_cap_mask(struct sfxge_softc *s
 	efx_phy_adv_cap_get(sc->enp, EFX_PHY_CAP_PERM, &cap_mask);
 
 	for (mode = EFX_LINK_10HDX; mode < EFX_LINK_NMODES; mode++) {
-		if (ifmedia == sfxge_link_mode[medium_type][mode]) {
+		if (ifmedia_masked == sfxge_link_mode[medium_type][mode]) {
 			mode_found = B_TRUE;
 			break;
 		}
@@ -848,8 +850,8 @@ sfxge_phy_cap_mask(struct sfxge_softc *s
 		 * If media is not in the table, it must be IFM_AUTO.
 		 */
 		KASSERT((cap_mask & (1 << EFX_PHY_CAP_AN)) &&
-		    ifmedia == (IFM_ETHER | IFM_AUTO),
-		    ("%s: no mode for media %d", __func__, ifmedia));
+		    ifmedia_masked == (IFM_ETHER | IFM_AUTO),
+		    ("%s: no mode for media %#x", __func__, ifmedia));
 		*phy_cap_mask = (cap_mask & ~(1 << EFX_PHY_CAP_ASYM));
 		return (0);
 	}



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