aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_dcb_lib.c')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_dcb_lib.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
new file mode 100644
index 000000000000..8ce358fbe9fb
--- /dev/null
+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
@@ -0,0 +1,42 @@
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright (c) 2019, Intel Corporation. */
3
4#include "ice_dcb_lib.h"
5
6/**
7 * ice_init_pf_dcb - initialize DCB for a PF
8 * @pf: pf to initiialize DCB for
9 */
10int ice_init_pf_dcb(struct ice_pf *pf)
11{
12 struct device *dev = &pf->pdev->dev;
13 struct ice_port_info *port_info;
14 struct ice_hw *hw = &pf->hw;
15
16 port_info = hw->port_info;
17
18 /* check if device is DCB capable */
19 if (!hw->func_caps.common_cap.dcb) {
20 dev_dbg(dev, "DCB not supported\n");
21 return -EOPNOTSUPP;
22 }
23
24 /* Best effort to put DCBx and LLDP into a good state */
25 port_info->dcbx_status = ice_get_dcbx_status(hw);
26 if (port_info->dcbx_status != ICE_DCBX_STATUS_DONE &&
27 port_info->dcbx_status != ICE_DCBX_STATUS_IN_PROGRESS) {
28 bool dcbx_status;
29
30 /* Attempt to start LLDP engine. Ignore errors
31 * as this will error if it is already started
32 */
33 ice_aq_start_lldp(hw, NULL);
34
35 /* Attempt to start DCBX. Ignore errors as this
36 * will error if it is already started
37 */
38 ice_aq_start_stop_dcbx(hw, true, &dcbx_status, NULL);
39 }
40
41 return 0;
42}