Commit 4d9b6043 authored by Neerav Parikh's avatar Neerav Parikh Committed by Jeff Kirsher

i40e: Separate out DCB capability and enabled flags

Currently if the firmware reports DCB capability the driver enables
I40E_FLAG_DCB_ENABLED flag. When this flag is enabled the driver
inserts a tag when transmitting a packet from the port even if there
are no DCB traffic classes configured at the port.

This patch adds a new flag I40E_FLAG_DCB_CAPABLE that will be set
when the DCB capability is present and the existing flag
I40E_FLAG_DCB_ENABLED will be set only if there are more than one
traffic classes configured at the port.

Change-ID: I24ccbf53ef293db2eba80c8a9772acf729795bd5
Signed-off-by: default avatarNeerav Parikh <neerav.parikh@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent ddf0b3a6
...@@ -264,6 +264,7 @@ struct i40e_pf { ...@@ -264,6 +264,7 @@ struct i40e_pf {
#ifdef CONFIG_I40E_VXLAN #ifdef CONFIG_I40E_VXLAN
#define I40E_FLAG_VXLAN_FILTER_SYNC (u64)(1 << 27) #define I40E_FLAG_VXLAN_FILTER_SYNC (u64)(1 << 27)
#endif #endif
#define I40E_FLAG_DCB_CAPABLE (u64)(1 << 29)
/* tracks features that get auto disabled by errors */ /* tracks features that get auto disabled by errors */
u64 auto_disable_flags; u64 auto_disable_flags;
......
...@@ -302,8 +302,8 @@ void i40e_dcbnl_setup(struct i40e_vsi *vsi) ...@@ -302,8 +302,8 @@ void i40e_dcbnl_setup(struct i40e_vsi *vsi)
struct net_device *dev = vsi->netdev; struct net_device *dev = vsi->netdev;
struct i40e_pf *pf = i40e_netdev_to_pf(dev); struct i40e_pf *pf = i40e_netdev_to_pf(dev);
/* DCB not enabled */ /* Not DCB capable */
if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) if (!(pf->flags & I40E_FLAG_DCB_CAPABLE))
return; return;
/* Do not setup DCB NL ops for MFP mode */ /* Do not setup DCB NL ops for MFP mode */
......
...@@ -4130,7 +4130,11 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf) ...@@ -4130,7 +4130,11 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf)
/* When status is not DISABLED then DCBX in FW */ /* When status is not DISABLED then DCBX in FW */
pf->dcbx_cap = DCB_CAP_DCBX_LLD_MANAGED | pf->dcbx_cap = DCB_CAP_DCBX_LLD_MANAGED |
DCB_CAP_DCBX_VER_IEEE; DCB_CAP_DCBX_VER_IEEE;
pf->flags |= I40E_FLAG_DCB_ENABLED;
pf->flags |= I40E_FLAG_DCB_CAPABLE;
/* Enable DCB tagging only when more than one TC */
if (i40e_dcb_get_num_tc(&hw->local_dcbx_config) > 1)
pf->flags |= I40E_FLAG_DCB_ENABLED;
} }
} else { } else {
dev_info(&pf->pdev->dev, "AQ Querying DCB configuration failed: %d\n", dev_info(&pf->pdev->dev, "AQ Querying DCB configuration failed: %d\n",
...@@ -4685,6 +4689,10 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf, ...@@ -4685,6 +4689,10 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf,
int ret = 0; int ret = 0;
u8 type; u8 type;
/* Not DCB capable or capability disabled */
if (!(pf->flags & I40E_FLAG_DCB_CAPABLE))
return ret;
/* Ignore if event is not for Nearest Bridge */ /* Ignore if event is not for Nearest Bridge */
type = ((mib->type >> I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT) type = ((mib->type >> I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT)
& I40E_AQ_LLDP_BRIDGE_TYPE_MASK); & I40E_AQ_LLDP_BRIDGE_TYPE_MASK);
...@@ -4726,6 +4734,12 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf, ...@@ -4726,6 +4734,12 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf,
if (!need_reconfig) if (!need_reconfig)
goto exit; goto exit;
/* Enable DCB tagging only when more than one TC */
if (i40e_dcb_get_num_tc(dcbx_cfg) > 1)
pf->flags |= I40E_FLAG_DCB_ENABLED;
else
pf->flags &= ~I40E_FLAG_DCB_ENABLED;
/* Reconfiguration needed quiesce all VSIs */ /* Reconfiguration needed quiesce all VSIs */
i40e_pf_quiesce_all_vsi(pf); i40e_pf_quiesce_all_vsi(pf);
...@@ -6365,7 +6379,7 @@ static void i40e_init_interrupt_scheme(struct i40e_pf *pf) ...@@ -6365,7 +6379,7 @@ static void i40e_init_interrupt_scheme(struct i40e_pf *pf)
if (err) { if (err) {
pf->flags &= ~(I40E_FLAG_MSIX_ENABLED | pf->flags &= ~(I40E_FLAG_MSIX_ENABLED |
I40E_FLAG_RSS_ENABLED | I40E_FLAG_RSS_ENABLED |
I40E_FLAG_DCB_ENABLED | I40E_FLAG_DCB_CAPABLE |
I40E_FLAG_SRIOV_ENABLED | I40E_FLAG_SRIOV_ENABLED |
I40E_FLAG_FD_SB_ENABLED | I40E_FLAG_FD_SB_ENABLED |
I40E_FLAG_FD_ATR_ENABLED | I40E_FLAG_FD_ATR_ENABLED |
...@@ -8187,13 +8201,13 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf) ...@@ -8187,13 +8201,13 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf)
pf->flags &= ~(I40E_FLAG_RSS_ENABLED | pf->flags &= ~(I40E_FLAG_RSS_ENABLED |
I40E_FLAG_FD_SB_ENABLED | I40E_FLAG_FD_SB_ENABLED |
I40E_FLAG_FD_ATR_ENABLED | I40E_FLAG_FD_ATR_ENABLED |
I40E_FLAG_DCB_ENABLED | I40E_FLAG_DCB_CAPABLE |
I40E_FLAG_SRIOV_ENABLED | I40E_FLAG_SRIOV_ENABLED |
I40E_FLAG_VMDQ_ENABLED); I40E_FLAG_VMDQ_ENABLED);
} else if (!(pf->flags & (I40E_FLAG_RSS_ENABLED | } else if (!(pf->flags & (I40E_FLAG_RSS_ENABLED |
I40E_FLAG_FD_SB_ENABLED | I40E_FLAG_FD_SB_ENABLED |
I40E_FLAG_FD_ATR_ENABLED | I40E_FLAG_FD_ATR_ENABLED |
I40E_FLAG_DCB_ENABLED))) { I40E_FLAG_DCB_CAPABLE))) {
/* one qp for PF */ /* one qp for PF */
pf->rss_size = pf->num_lan_qps = 1; pf->rss_size = pf->num_lan_qps = 1;
queues_left -= pf->num_lan_qps; queues_left -= pf->num_lan_qps;
...@@ -8205,9 +8219,9 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf) ...@@ -8205,9 +8219,9 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf)
I40E_FLAG_VMDQ_ENABLED); I40E_FLAG_VMDQ_ENABLED);
} else { } else {
/* Not enough queues for all TCs */ /* Not enough queues for all TCs */
if ((pf->flags & I40E_FLAG_DCB_ENABLED) && if ((pf->flags & I40E_FLAG_DCB_CAPABLE) &&
(queues_left < I40E_MAX_TRAFFIC_CLASS)) { (queues_left < I40E_MAX_TRAFFIC_CLASS)) {
pf->flags &= ~I40E_FLAG_DCB_ENABLED; pf->flags &= ~I40E_FLAG_DCB_CAPABLE;
dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n"); dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n");
} }
pf->num_lan_qps = pf->rss_size_max; pf->num_lan_qps = pf->rss_size_max;
...@@ -8300,7 +8314,7 @@ static void i40e_print_features(struct i40e_pf *pf) ...@@ -8300,7 +8314,7 @@ static void i40e_print_features(struct i40e_pf *pf)
buf += sprintf(buf, "FD_SB "); buf += sprintf(buf, "FD_SB ");
buf += sprintf(buf, "NTUPLE "); buf += sprintf(buf, "NTUPLE ");
} }
if (pf->flags & I40E_FLAG_DCB_ENABLED) if (pf->flags & I40E_FLAG_DCB_CAPABLE)
buf += sprintf(buf, "DCB "); buf += sprintf(buf, "DCB ");
if (pf->flags & I40E_FLAG_PTP) if (pf->flags & I40E_FLAG_PTP)
buf += sprintf(buf, "PTP "); buf += sprintf(buf, "PTP ");
...@@ -8486,7 +8500,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -8486,7 +8500,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
err = i40e_init_pf_dcb(pf); err = i40e_init_pf_dcb(pf);
if (err) { if (err) {
dev_info(&pdev->dev, "init_pf_dcb failed: %d\n", err); dev_info(&pdev->dev, "init_pf_dcb failed: %d\n", err);
pf->flags &= ~I40E_FLAG_DCB_ENABLED; pf->flags &= ~I40E_FLAG_DCB_CAPABLE;
/* Continue without DCB enabled */ /* Continue without DCB enabled */
} }
#endif /* CONFIG_I40E_DCB */ #endif /* CONFIG_I40E_DCB */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment