aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/i40e/i40e_dcb.c
diff options
context:
space:
mode:
authorNeerav Parikh <neerav.parikh@intel.com>2014-11-11 19:18:30 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-11-18 04:09:06 -0500
commite1c4751ee22f5d5f6f6cfcb70614e18e4218892e (patch)
tree9d6d032ef4ea84dd1851de599e59b8fed8932137 /drivers/net/ethernet/intel/i40e/i40e_dcb.c
parent9fa61dd2153a4ff3a57891d4866a2595eb9ac81a (diff)
i40e: Check for LLDP AdminStatus before querying DCBX
This patch adds a check whether LLDP Agent's default AdminStatus is enabled or disabled on a given port. If it is disabled then it sets the DCBX status to disabled as well; and would not query firmware for any DCBX configuration data. Change-ID: I73c0b9f0adbf4cae177d14914b20a48c9a8f50fd Signed-off-by: Neerav Parikh <neerav.parikh@intel.com> Tested-By: Jack Morgan <jack.morgan@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_dcb.c')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_dcb.c49
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:
640i40e_status i40e_init_dcb(struct i40e_hw *hw) 640i40e_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 **/
701i40e_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
720err_lldp_cfg:
721 return ret;
722}