1/*-
2 * Copyright (c) 2012-2015 Solarflare Communications Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
--- 15 unchanged lines hidden (view full) ---
24 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * The views and conclusions contained in the software and documentation are
27 * those of the authors and should not be interpreted as representing official
28 * policies, either expressed or implied, of the FreeBSD Project.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/sfxge/common/hunt_mcdi.c 292008 2015-12-09 06:24:22Z arybchik $");
33
34#include "efsys.h"
35#include "efx.h"
36#include "efx_impl.h"
37
38
39#if EFSYS_OPT_HUNTINGTON
40
--- 389 unchanged lines hidden (view full) ---
430 efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
431 uint32_t privilege_mask = encp->enc_privilege_mask;
432
433 EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON);
434
435 /*
436 * Use privilege mask state at MCDI attach.
437 * Admin privilege must be used prior to introduction of
438 * mac spoofing privilege (at v4.6), which is used up to
439 * introduction of change mac spoofing privilege (at v4.7)
440 */
441 *supportedp =
442 ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_CHANGE_MAC) ==
443 MC_CMD_PRIVILEGE_MASK_IN_GRP_CHANGE_MAC) ||
444 ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING) ==
445 MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING) ||
446 ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN) ==
447 MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN);
448
449 return (0);
450}
451
452 __checkReturn efx_rc_t
453hunt_mcdi_mac_spoofing_supported(
454 __in efx_nic_t *enp,
455 __out boolean_t *supportedp)
456{
457 efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
458 uint32_t privilege_mask = encp->enc_privilege_mask;
459
460 EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON);
461
462 /*
463 * Use privilege mask state at MCDI attach.
464 * Admin privilege must be used prior to introduction of
465 * mac spoofing privilege (at v4.6), which is used up to
466 * introduction of mac spoofing TX privilege (at v4.7)
467 */
468 *supportedp =
469 ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING_TX) ==
470 MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING_TX) ||
471 ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING) ==
472 MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING) ||
473 ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN) ==
474 MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN);
475
476 return (0);
477}
478
479
480 __checkReturn efx_rc_t
481hunt_mcdi_link_control_supported(
482 __in efx_nic_t *enp,
483 __out boolean_t *supportedp)
484{
485 efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
486 uint32_t privilege_mask = encp->enc_privilege_mask;
487
488 EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON);
--- 18 unchanged lines hidden ---
2 * Copyright (c) 2012-2015 Solarflare Communications Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
--- 15 unchanged lines hidden (view full) ---
24 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * The views and conclusions contained in the software and documentation are
27 * those of the authors and should not be interpreted as representing official
28 * policies, either expressed or implied, of the FreeBSD Project.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/sfxge/common/hunt_mcdi.c 292008 2015-12-09 06:24:22Z arybchik $");
33
34#include "efsys.h"
35#include "efx.h"
36#include "efx_impl.h"
37
38
39#if EFSYS_OPT_HUNTINGTON
40
--- 389 unchanged lines hidden (view full) ---
430 efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
431 uint32_t privilege_mask = encp->enc_privilege_mask;
432
433 EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON);
434
435 /*
436 * Use privilege mask state at MCDI attach.
437 * Admin privilege must be used prior to introduction of
438 * mac spoofing privilege (at v4.6), which is used up to
439 * introduction of change mac spoofing privilege (at v4.7)
440 */
441 *supportedp =
442 ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_CHANGE_MAC) ==
443 MC_CMD_PRIVILEGE_MASK_IN_GRP_CHANGE_MAC) ||
444 ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING) ==
445 MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING) ||
446 ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN) ==
447 MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN);
448
449 return (0);
450}
451
452 __checkReturn efx_rc_t
453hunt_mcdi_mac_spoofing_supported(
454 __in efx_nic_t *enp,
455 __out boolean_t *supportedp)
456{
457 efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
458 uint32_t privilege_mask = encp->enc_privilege_mask;
459
460 EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON);
461
462 /*
463 * Use privilege mask state at MCDI attach.
464 * Admin privilege must be used prior to introduction of
465 * mac spoofing privilege (at v4.6), which is used up to
466 * introduction of mac spoofing TX privilege (at v4.7)
467 */
468 *supportedp =
469 ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING_TX) ==
470 MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING_TX) ||
471 ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING) ==
472 MC_CMD_PRIVILEGE_MASK_IN_GRP_MAC_SPOOFING) ||
473 ((privilege_mask & MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN) ==
474 MC_CMD_PRIVILEGE_MASK_IN_GRP_ADMIN);
475
476 return (0);
477}
478
479
480 __checkReturn efx_rc_t
481hunt_mcdi_link_control_supported(
482 __in efx_nic_t *enp,
483 __out boolean_t *supportedp)
484{
485 efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
486 uint32_t privilege_mask = encp->enc_privilege_mask;
487
488 EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON);
--- 18 unchanged lines hidden ---