diff options
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_dcb.c')
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_dcb.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_dcb.c b/drivers/net/ethernet/intel/i40e/i40e_dcb.c index 1396c70b871c..3ce43588592d 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_dcb.c +++ b/drivers/net/ethernet/intel/i40e/i40e_dcb.c | |||
@@ -640,10 +640,27 @@ out: | |||
640 | i40e_status i40e_init_dcb(struct i40e_hw *hw) | 640 | i40e_status i40e_init_dcb(struct i40e_hw *hw) |
641 | { | 641 | { |
642 | i40e_status ret = 0; | 642 | i40e_status ret = 0; |
643 | struct i40e_lldp_variables lldp_cfg; | ||
644 | u8 adminstatus = 0; | ||
643 | 645 | ||
644 | if (!hw->func_caps.dcb) | 646 | if (!hw->func_caps.dcb) |
645 | return ret; | 647 | return ret; |
646 | 648 | ||
649 | /* Read LLDP NVM area */ | ||
650 | ret = i40e_read_lldp_cfg(hw, &lldp_cfg); | ||
651 | if (ret) | ||
652 | return ret; | ||
653 | |||
654 | /* Get the LLDP AdminStatus for the current port */ | ||
655 | adminstatus = lldp_cfg.adminstatus >> (hw->port * 4); | ||
656 | adminstatus &= 0xF; | ||
657 | |||
658 | /* LLDP agent disabled */ | ||
659 | if (!adminstatus) { | ||
660 | hw->dcbx_status = I40E_DCBX_STATUS_DISABLED; | ||
661 | return ret; | ||
662 | } | ||
663 | |||
647 | /* Get DCBX status */ | 664 | /* Get DCBX status */ |
648 | ret = i40e_get_dcbx_status(hw, &hw->dcbx_status); | 665 | ret = i40e_get_dcbx_status(hw, &hw->dcbx_status); |
649 | if (ret) | 666 | if (ret) |
@@ -655,6 +672,8 @@ i40e_status i40e_init_dcb(struct i40e_hw *hw) | |||
655 | case I40E_DCBX_STATUS_IN_PROGRESS: | 672 | case I40E_DCBX_STATUS_IN_PROGRESS: |
656 | /* Get current DCBX configuration */ | 673 | /* Get current DCBX configuration */ |
657 | ret = i40e_get_dcb_config(hw); | 674 | ret = i40e_get_dcb_config(hw); |
675 | if (ret) | ||
676 | return ret; | ||
658 | break; | 677 | break; |
659 | case I40E_DCBX_STATUS_DISABLED: | 678 | case I40E_DCBX_STATUS_DISABLED: |
660 | return ret; | 679 | return ret; |
@@ -671,3 +690,33 @@ i40e_status i40e_init_dcb(struct i40e_hw *hw) | |||
671 | 690 | ||
672 | return ret; | 691 | return ret; |
673 | } | 692 | } |
693 | |||
694 | /** | ||
695 | * i40e_read_lldp_cfg - read LLDP Configuration data from NVM | ||
696 | * @hw: pointer to the HW structure | ||
697 | * @lldp_cfg: pointer to hold lldp configuration variables | ||
698 | * | ||
699 | * Reads the LLDP configuration data from NVM | ||
700 | **/ | ||
701 | i40e_status i40e_read_lldp_cfg(struct i40e_hw *hw, | ||
702 | struct i40e_lldp_variables *lldp_cfg) | ||
703 | { | ||
704 | i40e_status ret = 0; | ||
705 | u32 offset = (2 * I40E_NVM_LLDP_CFG_PTR); | ||
706 | |||
707 | if (!lldp_cfg) | ||
708 | return I40E_ERR_PARAM; | ||
709 | |||
710 | ret = i40e_acquire_nvm(hw, I40E_RESOURCE_READ); | ||
711 | if (ret) | ||
712 | goto err_lldp_cfg; | ||
713 | |||
714 | ret = i40e_aq_read_nvm(hw, I40E_SR_EMP_MODULE_PTR, offset, | ||
715 | sizeof(struct i40e_lldp_variables), | ||
716 | (u8 *)lldp_cfg, | ||
717 | true, NULL); | ||
718 | i40e_release_nvm(hw); | ||
719 | |||
720 | err_lldp_cfg: | ||
721 | return ret; | ||
722 | } | ||