Skip to content

Commit 4b208ea

Browse files
kubalewskianguy11
authored andcommitted
i40e: Add init and default config of software based DCB
Add extra handling on changing the "disable-fw-lldp" private flag to properly initialize software based DCB feature. Add default configuration of DCB functionality when Firmware LLDP agent is turned off, in case of driver probe and device reset on reconfiguration. Update copyright dates as appropriate. Software based DCB is a brand-new feature in i40e driver. Before, DCB was implemented by Firmware LLDP agent only. The agent was responsible for handling incoming DCB-related LLDP frames and applying received DCB configuration to hardware. Default configuration and new initialization flow for software based DCB is required. If LLDP agent is turned off in BIOS, or after setting private flag ("disable-fw-lldp on"). The driver initializes DCB functionality with default values, one traffic class with 100% bandwidth allocated. Signed-off-by: Aleksandr Loktionov <[email protected]> Signed-off-by: Arkadiusz Kubalewski <[email protected]> Tested-by: Tony Brelinski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 90bc8e0 commit 4b208ea

File tree

3 files changed

+497
-58
lines changed

3 files changed

+497
-58
lines changed

drivers/net/ethernet/intel/i40e/i40e.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
2-
/* Copyright(c) 2013 - 2018 Intel Corporation. */
2+
/* Copyright(c) 2013 - 2021 Intel Corporation. */
33

44
#ifndef _I40E_H_
55
#define _I40E_H_
@@ -289,6 +289,9 @@ struct i40e_cloud_filter {
289289
u8 tunnel_type;
290290
};
291291

292+
#define I40E_DCB_PRIO_TYPE_STRICT 0
293+
#define I40E_DCB_PRIO_TYPE_ETS 1
294+
#define I40E_DCB_STRICT_PRIO_CREDITS 127
292295
/* DCB per TC information data structure */
293296
struct i40e_tc_info {
294297
u16 qoffset; /* Queue offset from base queue */
@@ -626,6 +629,8 @@ struct i40e_pf {
626629
u16 dcbx_cap;
627630

628631
struct i40e_filter_control_settings filter_settings;
632+
struct i40e_rx_pb_config pb_cfg; /* Current Rx packet buffer config */
633+
struct i40e_dcbx_config tmp_cfg;
629634

630635
struct ptp_clock *ptp_clock;
631636
struct ptp_clock_info ptp_caps;
@@ -1122,6 +1127,12 @@ bool i40e_is_vsi_in_vlan(struct i40e_vsi *vsi);
11221127
int i40e_count_filters(struct i40e_vsi *vsi);
11231128
struct i40e_mac_filter *i40e_find_mac(struct i40e_vsi *vsi, const u8 *macaddr);
11241129
void i40e_vlan_stripping_enable(struct i40e_vsi *vsi);
1130+
static inline bool i40e_is_sw_dcb(struct i40e_pf *pf)
1131+
{
1132+
return !!(pf->flags & I40E_FLAG_DISABLE_FW_LLDP);
1133+
}
1134+
1135+
void i40e_set_lldp_forwarding(struct i40e_pf *pf, bool enable);
11251136
#ifdef CONFIG_I40E_DCB
11261137
void i40e_dcbnl_flush_apps(struct i40e_pf *pf,
11271138
struct i40e_dcbx_config *old_cfg,
@@ -1131,6 +1142,8 @@ void i40e_dcbnl_setup(struct i40e_vsi *vsi);
11311142
bool i40e_dcb_need_reconfig(struct i40e_pf *pf,
11321143
struct i40e_dcbx_config *old_cfg,
11331144
struct i40e_dcbx_config *new_cfg);
1145+
int i40e_hw_dcb_config(struct i40e_pf *pf, struct i40e_dcbx_config *new_cfg);
1146+
int i40e_dcb_sw_default_config(struct i40e_pf *pf);
11341147
#endif /* CONFIG_I40E_DCB */
11351148
void i40e_ptp_rx_hang(struct i40e_pf *pf);
11361149
void i40e_ptp_tx_hang(struct i40e_pf *pf);

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5033,23 +5033,13 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
50335033

50345034
if (changed_flags & I40E_FLAG_DISABLE_FW_LLDP) {
50355035
if (new_flags & I40E_FLAG_DISABLE_FW_LLDP) {
5036-
struct i40e_dcbx_config *dcbcfg;
5037-
5036+
#ifdef CONFIG_I40E_DCB
5037+
i40e_dcb_sw_default_config(pf);
5038+
#endif /* CONFIG_I40E_DCB */
5039+
i40e_aq_cfg_lldp_mib_change_event(&pf->hw, false, NULL);
50385040
i40e_aq_stop_lldp(&pf->hw, true, false, NULL);
5039-
i40e_aq_set_dcb_parameters(&pf->hw, true, NULL);
5040-
/* reset local_dcbx_config to default */
5041-
dcbcfg = &pf->hw.local_dcbx_config;
5042-
dcbcfg->etscfg.willing = 1;
5043-
dcbcfg->etscfg.maxtcs = 0;
5044-
dcbcfg->etscfg.tcbwtable[0] = 100;
5045-
for (i = 1; i < I40E_MAX_TRAFFIC_CLASS; i++)
5046-
dcbcfg->etscfg.tcbwtable[i] = 0;
5047-
for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
5048-
dcbcfg->etscfg.prioritytable[i] = 0;
5049-
dcbcfg->etscfg.tsatable[0] = I40E_IEEE_TSA_ETS;
5050-
dcbcfg->pfc.willing = 1;
5051-
dcbcfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS;
50525041
} else {
5042+
i40e_set_lldp_forwarding(pf, false);
50535043
status = i40e_aq_start_lldp(&pf->hw, false, NULL);
50545044
if (status) {
50555045
adq_err = pf->hw.aq.asq_last_status;

0 commit comments

Comments
 (0)