From owner-svn-src-all@freebsd.org Wed May 11 06:19:07 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BEA7B36ED5; Wed, 11 May 2016 06:19:07 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E68E1A77; Wed, 11 May 2016 06:19:06 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4B6J6GE038643; Wed, 11 May 2016 06:19:06 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4B6J6t7038641; Wed, 11 May 2016 06:19:06 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201605110619.u4B6J6t7038641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 11 May 2016 06:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299405 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2016 06:19:07 -0000 Author: arybchik Date: Wed May 11 06:19:05 2016 New Revision: 299405 URL: https://svnweb.freebsd.org/changeset/base/299405 Log: sfxge(4): simplify efx_mac_select Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6291 Modified: head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/common/efx_mac.c Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Wed May 11 06:18:15 2016 (r299404) +++ head/sys/dev/sfxge/common/efx_impl.h Wed May 11 06:19:05 2016 (r299405) @@ -85,8 +85,6 @@ extern "C" { typedef enum efx_mac_type_e { EFX_MAC_INVALID = 0, - EFX_MAC_FALCON_GMAC, - EFX_MAC_FALCON_XMAC, EFX_MAC_SIENA, EFX_MAC_HUNTINGTON, EFX_MAC_MEDFORD, Modified: head/sys/dev/sfxge/common/efx_mac.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mac.c Wed May 11 06:18:15 2016 (r299404) +++ head/sys/dev/sfxge/common/efx_mac.c Wed May 11 06:19:05 2016 (r299405) @@ -87,32 +87,6 @@ static efx_mac_ops_t __efx_ef10_mac_ops }; #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ -static efx_mac_ops_t *__efx_mac_ops[] = { - /* [EFX_MAC_INVALID] */ - NULL, - /* [EFX_MAC_FALCON_GMAC] */ - NULL, - /* [EFX_MAC_FALCON_XMAC] */ - NULL, - /* [EFX_MAC_SIENA] */ -#if EFSYS_OPT_SIENA - &__efx_siena_mac_ops, -#else - NULL, -#endif - /* [EFX_MAC_HUNTINGTON] */ -#if EFSYS_OPT_HUNTINGTON - &__efx_ef10_mac_ops, -#else - NULL, -#endif - /* [EFX_MAC_MEDFORD] */ -#if EFSYS_OPT_MEDFORD - &__efx_ef10_mac_ops, -#else - NULL, -#endif -}; __checkReturn efx_rc_t efx_mac_pdu_set( @@ -731,38 +705,43 @@ efx_mac_select( efx_mac_ops_t *emop; int rc = EINVAL; + switch (enp->en_family) { #if EFSYS_OPT_SIENA - if (enp->en_family == EFX_FAMILY_SIENA) { + case EFX_FAMILY_SIENA: + emop = &__efx_siena_mac_ops; type = EFX_MAC_SIENA; - goto chosen; - } -#endif + break; +#endif /* EFSYS_OPT_SIENA */ #if EFSYS_OPT_HUNTINGTON - if (enp->en_family == EFX_FAMILY_HUNTINGTON) { + case EFX_FAMILY_HUNTINGTON: + emop = &__efx_ef10_mac_ops; type = EFX_MAC_HUNTINGTON; - goto chosen; - } -#endif + break; +#endif /* EFSYS_OPT_HUNTINGTON */ #if EFSYS_OPT_MEDFORD - if (enp->en_family == EFX_FAMILY_MEDFORD) { + case EFX_FAMILY_MEDFORD: + emop = &__efx_ef10_mac_ops; type = EFX_MAC_MEDFORD; - goto chosen; + break; +#endif /* EFSYS_OPT_MEDFORD */ + + default: + rc = EINVAL; + goto fail1; } -#endif -chosen: EFSYS_ASSERT(type != EFX_MAC_INVALID); EFSYS_ASSERT3U(type, <, EFX_MAC_NTYPES); - emop = epp->ep_emop = (efx_mac_ops_t *)__efx_mac_ops[type]; EFSYS_ASSERT(emop != NULL); + epp->ep_emop = emop; epp->ep_mac_type = type; if (emop->emo_reset != NULL) { if ((rc = emop->emo_reset(enp)) != 0) - goto fail1; + goto fail2; EFSYS_ASSERT(enp->en_reset_flags & EFX_RESET_MAC); enp->en_reset_flags &= ~EFX_RESET_MAC; @@ -770,6 +749,8 @@ chosen: return (0); +fail2: + EFSYS_PROBE(fail2); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc);