Deleted Added
full compact
ef10_mcdi.c (292052) ef10_mcdi.c (292055)
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>
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 292052 2015-12-10 07:17:46Z arybchik $");
32__FBSDID("$FreeBSD: head/sys/dev/sfxge/common/hunt_mcdi.c 292055 2015-12-10 07:42:56Z arybchik $");
33
34#include "efsys.h"
35#include "efx.h"
36#include "efx_impl.h"
37
38
39#if EFSYS_OPT_HUNTINGTON
40

--- 353 unchanged lines hidden (view full) ---

394
395fail1:
396 EFSYS_PROBE1(fail1, efx_rc_t, rc);
397
398 return (rc);
399}
400
401 __checkReturn efx_rc_t
33
34#include "efsys.h"
35#include "efx.h"
36#include "efx_impl.h"
37
38
39#if EFSYS_OPT_HUNTINGTON
40

--- 353 unchanged lines hidden (view full) ---

394
395fail1:
396 EFSYS_PROBE1(fail1, efx_rc_t, rc);
397
398 return (rc);
399}
400
401 __checkReturn efx_rc_t
402hunt_mcdi_fw_update_supported(
402hunt_mcdi_feature_supported(
403 __in efx_nic_t *enp,
403 __in efx_nic_t *enp,
404 __in efx_mcdi_feature_id_t id,
404 __out boolean_t *supportedp)
405{
406 efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
405 __out boolean_t *supportedp)
406{
407 efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
407
408 EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON);
409
410 /*
411 * Use privilege mask state at MCDI attach.
412 * Admin privilege must be used prior to introduction of
413 * specific flag.
414 */
415 *supportedp =
416 EFX_MCDI_HAVE_PRIVILEGE(encp->enc_privilege_mask, ADMIN);
417
418 return (0);
419}
420
421 __checkReturn efx_rc_t
422hunt_mcdi_macaddr_change_supported(
423 __in efx_nic_t *enp,
424 __out boolean_t *supportedp)
425{
426 efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
427 uint32_t privilege_mask = encp->enc_privilege_mask;
408 uint32_t privilege_mask = encp->enc_privilege_mask;
409 efx_rc_t rc;
428
429 EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON);
430
431 /*
432 * Use privilege mask state at MCDI attach.
410
411 EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON);
412
413 /*
414 * Use privilege mask state at MCDI attach.
433 * Admin privilege must be used prior to introduction of
434 * mac spoofing privilege (at v4.6), which is used up to
435 * introduction of change mac spoofing privilege (at v4.7)
436 */
415 */
437 *supportedp =
438 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, CHANGE_MAC) ||
439 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, MAC_SPOOFING) ||
440 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, ADMIN);
441
416
442 return (0);
443}
417 switch (id) {
418 case EFX_MCDI_FEATURE_FW_UPDATE:
419 /*
420 * Admin privilege must be used prior to introduction of
421 * specific flag.
422 */
423 *supportedp =
424 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, ADMIN);
425 break;
426 case EFX_MCDI_FEATURE_LINK_CONTROL:
427 /*
428 * Admin privilege used prior to introduction of
429 * specific flag.
430 */
431 *supportedp =
432 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, LINK) ||
433 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, ADMIN);
434 break;
435 case EFX_MCDI_FEATURE_MACADDR_CHANGE:
436 /*
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 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, CHANGE_MAC) ||
443 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, MAC_SPOOFING) ||
444 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, ADMIN);
445 break;
446 case EFX_MCDI_FEATURE_MAC_SPOOFING:
447 /*
448 * Admin privilege must be used prior to introduction of
449 * mac spoofing privilege (at v4.6), which is used up to
450 * introduction of mac spoofing TX privilege (at v4.7)
451 */
452 *supportedp =
453 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, MAC_SPOOFING_TX) ||
454 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, MAC_SPOOFING) ||
455 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, ADMIN);
456 break;
457 default:
458 rc = ENOTSUP;
459 goto fail1;
460 break;
461 }
444
462
445 __checkReturn efx_rc_t
446hunt_mcdi_mac_spoofing_supported(
447 __in efx_nic_t *enp,
448 __out boolean_t *supportedp)
449{
450 efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
451 uint32_t privilege_mask = encp->enc_privilege_mask;
452
453 EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON);
454
455 /*
456 * Use privilege mask state at MCDI attach.
457 * Admin privilege must be used prior to introduction of
458 * mac spoofing privilege (at v4.6), which is used up to
459 * introduction of mac spoofing TX privilege (at v4.7)
460 */
461 *supportedp =
462 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, MAC_SPOOFING_TX) ||
463 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, MAC_SPOOFING) ||
464 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, ADMIN);
465
466 return (0);
463 return (0);
467}
468
464
465fail1:
466 EFSYS_PROBE1(fail1, efx_rc_t, rc);
469
467
470 __checkReturn efx_rc_t
471hunt_mcdi_link_control_supported(
472 __in efx_nic_t *enp,
473 __out boolean_t *supportedp)
474{
475 efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
476 uint32_t privilege_mask = encp->enc_privilege_mask;
477
478 EFSYS_ASSERT3U(enp->en_family, ==, EFX_FAMILY_HUNTINGTON);
479
480 /*
481 * Use privilege mask state at MCDI attach.
482 * Admin privilege used prior to introduction of
483 * specific flag.
484 */
485 *supportedp =
486 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, LINK) ||
487 EFX_MCDI_HAVE_PRIVILEGE(privilege_mask, ADMIN);
488
489 return (0);
468 return (rc);
490}
491
492#endif /* EFSYS_OPT_MCDI */
493
494#endif /* EFSYS_OPT_HUNTINGTON */
469}
470
471#endif /* EFSYS_OPT_MCDI */
472
473#endif /* EFSYS_OPT_HUNTINGTON */