From owner-svn-src-stable-10@freebsd.org Thu Jan 14 15:28:48 2016 Return-Path: Delivered-To: svn-src-stable-10@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 BC632A8224B; Thu, 14 Jan 2016 15:28:48 +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 8F57C1791; Thu, 14 Jan 2016 15:28:48 +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 u0EFSlNJ043418; Thu, 14 Jan 2016 15:28:47 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0EFSl3x043413; Thu, 14 Jan 2016 15:28:47 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201601141528.u0EFSl3x043413@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 14 Jan 2016 15:28:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r293964 - stable/10/sys/dev/sfxge/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jan 2016 15:28:48 -0000 Author: arybchik Date: Thu Jan 14 15:28:46 2016 New Revision: 293964 URL: https://svnweb.freebsd.org/changeset/base/293964 Log: MFC r292008 sfxge: use MAC spoofing TX and MAC change privileges Update of common code to provide a query on the MAC_SPOOFING_TX and CHANGE_MAC privileges instead of the deprecated MAC_SPOOFING privilege. Submitted by: Richard Houldsworth Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/common/efx_impl.h stable/10/sys/dev/sfxge/common/efx_mcdi.c stable/10/sys/dev/sfxge/common/efx_mcdi.h stable/10/sys/dev/sfxge/common/hunt_impl.h stable/10/sys/dev/sfxge/common/hunt_mcdi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- stable/10/sys/dev/sfxge/common/efx_impl.h Thu Jan 14 15:27:49 2016 (r293963) +++ stable/10/sys/dev/sfxge/common/efx_impl.h Thu Jan 14 15:28:46 2016 (r293964) @@ -463,6 +463,7 @@ typedef struct efx_mcdi_ops_s { efx_rc_t (*emco_fw_update_supported)(efx_nic_t *, boolean_t *); efx_rc_t (*emco_macaddr_change_supported)(efx_nic_t *, boolean_t *); efx_rc_t (*emco_link_control_supported)(efx_nic_t *, boolean_t *); + efx_rc_t (*emco_mac_spoofing_supported)(efx_nic_t *, boolean_t *); void (*emco_read_response)(efx_nic_t *, void *, size_t, size_t); } efx_mcdi_ops_t; Modified: stable/10/sys/dev/sfxge/common/efx_mcdi.c ============================================================================== --- stable/10/sys/dev/sfxge/common/efx_mcdi.c Thu Jan 14 15:27:49 2016 (r293963) +++ stable/10/sys/dev/sfxge/common/efx_mcdi.c Thu Jan 14 15:28:46 2016 (r293964) @@ -55,6 +55,7 @@ static efx_mcdi_ops_t __efx_mcdi_siena_o /* emco_macaddr_change_supported */ siena_mcdi_link_control_supported, /* emco_link_control_supported */ + NULL, /* emco_mac_spoofing_supported */ siena_mcdi_read_response, /* emco_read_response */ }; @@ -74,6 +75,8 @@ static efx_mcdi_ops_t __efx_mcdi_hunt_op /* emco_macaddr_change_supported */ hunt_mcdi_link_control_supported, /* emco_link_control_supported */ + hunt_mcdi_mac_spoofing_supported, + /* emco_mac_spoofing_supported */ hunt_mcdi_read_response, /* emco_read_response */ }; @@ -1389,6 +1392,31 @@ fail1: return (rc); } + __checkReturn efx_rc_t +efx_mcdi_mac_spoofing_supported( + __in efx_nic_t *enp, + __out boolean_t *supportedp) +{ + efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop; + efx_rc_t rc; + + if (emcop != NULL && emcop->emco_mac_spoofing_supported != NULL) { + if ((rc = emcop->emco_mac_spoofing_supported(enp, supportedp)) + != 0) + goto fail1; + } else { + /* Earlier devices always supported MAC spoofing */ + *supportedp = B_TRUE; + } + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + #if EFSYS_OPT_BIST #if EFSYS_OPT_HUNTINGTON Modified: stable/10/sys/dev/sfxge/common/efx_mcdi.h ============================================================================== --- stable/10/sys/dev/sfxge/common/efx_mcdi.h Thu Jan 14 15:27:49 2016 (r293963) +++ stable/10/sys/dev/sfxge/common/efx_mcdi.h Thu Jan 14 15:28:46 2016 (r293964) @@ -181,6 +181,12 @@ efx_mcdi_link_control_supported( __in efx_nic_t *enp, __out boolean_t *supportedp); +extern __checkReturn efx_rc_t +efx_mcdi_mac_spoofing_supported( + __in efx_nic_t *enp, + __out boolean_t *supportedp); + + #if EFSYS_OPT_BIST #if EFSYS_OPT_HUNTINGTON extern __checkReturn efx_rc_t Modified: stable/10/sys/dev/sfxge/common/hunt_impl.h ============================================================================== --- stable/10/sys/dev/sfxge/common/hunt_impl.h Thu Jan 14 15:27:49 2016 (r293963) +++ stable/10/sys/dev/sfxge/common/hunt_impl.h Thu Jan 14 15:28:46 2016 (r293964) @@ -298,6 +298,12 @@ hunt_mcdi_link_control_supported( __in efx_nic_t *enp, __out boolean_t *supportedp); +extern __checkReturn efx_rc_t +hunt_mcdi_mac_spoofing_supported( + __in efx_nic_t *enp, + __out boolean_t *supportedp); + + #endif /* EFSYS_OPT_MCDI */ /* NVRAM */ Modified: stable/10/sys/dev/sfxge/common/hunt_mcdi.c ============================================================================== --- stable/10/sys/dev/sfxge/common/hunt_mcdi.c Thu Jan 14 15:27:49 2016 (r293963) +++ stable/10/sys/dev/sfxge/common/hunt_mcdi.c Thu Jan 14 15:28:46 2016 (r293964) @@ -435,9 +435,12 @@ hunt_mcdi_macaddr_change_supported( /* * Use privilege mask state at MCDI attach. * Admin privilege must be used prior to introduction of - * specific flag (at v4.6). + * mac spoofing privilege (at v4.6), which is used up to + * introduction of change mac spoofing privilege (at v4.7) */ *supportedp = + ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_CHANGE_MAC) == + MC_CMD_PRIVILEGE_MASK_IN_GRP_CHANGE_MAC) || ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING) == MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING) || ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN) == @@ -447,6 +450,34 @@ hunt_mcdi_macaddr_change_supported( } __checkReturn efx_rc_t +hunt_mcdi_mac_spoofing_supported( + __in efx_nic_t *enp, + __out boolean_t *supportedp) +{ + efx_nic_cfg_t *encp = &(enp->en_nic_cfg); + uint32_t privilege_mask = encp->enc_privilege_mask; + + EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON); + + /* + * Use privilege mask state at MCDI attach. + * Admin privilege must be used prior to introduction of + * mac spoofing privilege (at v4.6), which is used up to + * introduction of mac spoofing TX privilege (at v4.7) + */ + *supportedp = + ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING_TX) == + MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING_TX) || + ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING) == + MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING) || + ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN) == + MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN); + + return (0); +} + + + __checkReturn efx_rc_t hunt_mcdi_link_control_supported( __in efx_nic_t *enp, __out boolean_t *supportedp)