40GbE Intel Wired LAN Driver Updates 2021-02-10
Subsystems (3)
Tony Nguyen
maintainerThis series contains updates to i40e driver only.
Arkadiusz adds support for software controlled DCB. Upon disabling of the firmware LLDP agent, the driver configures DCB with default values (only one Traffic Class). At the same time, it allows a software based LLDP agent - userspace application i.e. lldpad) to receive DCB TLVs and set desired DCB configuration through DCB related netlink callbacks.
Aleksandr implements get and set ethtool ops for Energy Efficient Ethernet.
Przemyslaw extends support for ntuple filters allowing for Flow Director IPv6 and VLAN filters.
Kaixu Xia removes an unneeded assignment.
The following are changes since commit dc9d87581d464e7b7d38853d6904b70b6c920d99:
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 40GbE
Aleksandr Loktionov (1):
i40e: Add EEE status getting & setting implementation
Arkadiusz Kubalewski (3):
i40e: Add hardware configuration for software based DCB
i40e: Add init and default config of software based DCB
i40e: Add netlink callbacks support for software based DCB
Kaixu Xia (1):
i40e: remove the useless value assignment in i40e_clean_adminq_subtask
Przemyslaw Patynowski (2):
i40e: Add flow director support for IPv6
i40e: VLAN field for flow director
drivers/net/ethernet/intel/i40e/i40e.h | 26 +- .../net/ethernet/intel/i40e/i40e_adminq_cmd.h | 11 +- drivers/net/ethernet/intel/i40e/i40e_common.c | 65 +- drivers/net/ethernet/intel/i40e/i40e_dcb.c | 949 +++++++++++++++++- drivers/net/ethernet/intel/i40e/i40e_dcb.h | 169 +++- drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c | 752 +++++++++++++- .../net/ethernet/intel/i40e/i40e_ethtool.c | 382 ++++++- drivers/net/ethernet/intel/i40e/i40e_main.c | 601 ++++++++++- .../net/ethernet/intel/i40e/i40e_prototype.h | 9 +- .../net/ethernet/intel/i40e/i40e_register.h | 174 +++- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 534 ++++++---- drivers/net/ethernet/intel/i40e/i40e_type.h | 5 +- 12 files changed, 3378 insertions(+), 299 deletions(-)
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH 1/7 i40e: Add hardware configuration for software based DCB
From: Arkadiusz Kubalewski <[email protected]>
Add registers and definitions required for applying DCB related hardware configuration.
Add functions responsible for calculating and setting proper hardware configuration values for software based DCB functionality.
Add function responsible for invoking Admin Queue command, which results in applying new DCB configuration to the hardware.
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.
New communication channel between software and hardware is required for software driver. It must be able to calculate and configure all the registers related for DCB feature.
--- .../net/ethernet/intel/i40e/i40e_adminq_cmd.h | 11 +- drivers/net/ethernet/intel/i40e/i40e_common.c | 65 +- drivers/net/ethernet/intel/i40e/i40e_dcb.c | 949 +++++++++++++++++- drivers/net/ethernet/intel/i40e/i40e_dcb.h | 169 +++- .../net/ethernet/intel/i40e/i40e_prototype.h | 9 +- .../net/ethernet/intel/i40e/i40e_register.h | 172 +++- drivers/net/ethernet/intel/i40e/i40e_type.h | 3 +- 7 files changed, 1365 insertions(+), 13 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +10 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright(c) 2013 - 2018 Intel Corporation. */ +/* Copyright(c) 2013 - 2021 Intel Corporation. */ #ifndef _I40E_ADMINQ_CMD_H_#define _I40E_ADMINQ_CMD_H_
@@ -1080,6 +1080,7 @@ struct i40e_aqc_add_remove_control_packet_filter {#define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC 0x0001#define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_DROP 0x0002#define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TX 0x0008 +#define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_RX 0x0000__le16 seid;__le16 queue;u8 reserved[2 ];
@@ -2184,6 +2185,14 @@ I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_get_cee_dcb_cfg_resp);* Used to replace the local MIB of a given LLDP agent. e.g. DCBx */ struct i40e_aqc_lldp_set_local_mib { +#define SET_LOCAL_MIB_AC_TYPE_DCBX_SHIFT 0 +#define SET_LOCAL_MIB_AC_TYPE_DCBX_MASK (1 << \ + SET_LOCAL_MIB_AC_TYPE_DCBX_SHIFT) +#define SET_LOCAL_MIB_AC_TYPE_LOCAL_MIB 0x0 +#define SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS_SHIFT (1) +#define SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS_MASK (1 << \ + SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS_SHIFT) +#define SET_LOCAL_MIB_AC_TYPE_NON_WILLING_APPS 0x1u8 type;u8 reserved0;__le16 length;
drivers/net/ethernet/intel/i40e/i40e_common.c +64 -1
81 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_dcb.c +948 -1
959 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_dcb.h +162 -7
216 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_prototype.h +8 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright(c) 2013 - 2018 Intel Corporation. */ +/* Copyright(c) 2013 - 2021 Intel Corporation. */ #ifndef _I40E_PROTOTYPE_H_#define _I40E_PROTOTYPE_H_
@@ -200,6 +200,10 @@ i40e_status i40e_aq_get_lldp_mib(struct i40e_hw *hw, u8 bridge_type, u8 mib_type, void *buff, u16 buff_size, u16 *local_len, u16 *remote_len, struct i40e_asq_cmd_details *cmd_details); +enum i40e_status_code +i40e_aq_set_lldp_mib (struct i40e_hw *hw, +u8 mib_type,void *buff,u16 buff_size, +struct i40e_asq_cmd_details *cmd_details);i40e_status i40e_aq_cfg_lldp_mib_change_event (struct i40e_hw *hw,bool enable_update,struct i40e_asq_cmd_details *cmd_details);
@@ -289,6 +293,9 @@ i40e_aq_rem_cloud_filters_bb(struct i40e_hw *hw, u16 seid, u8 filter_count);i40e_status i40e_read_lldp_cfg (struct i40e_hw *hw,struct i40e_lldp_variables *lldp_cfg); +enum i40e_status_code +i40e_aq_suspend_port_tx (struct i40e_hw *hw,u16 seid, +struct i40e_asq_cmd_details *cmd_details);/* i40e_common */ i40e_status i40e_init_shared_code (struct i40e_hw *hw);i40e_status i40e_pf_reset (struct i40e_hw *hw);
drivers/net/ethernet/intel/i40e/i40e_register.h +171 -1
200 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_type.h +2 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright(c) 2013 - 2018 Intel Corporation. */ +/* Copyright(c) 2013 - 2021 Intel Corporation. */ #ifndef _I40E_TYPE_H_#define _I40E_TYPE_H_
@@ -517,6 +517,7 @@ struct i40e_dcbx_config {#define I40E_DCBX_MODE_CEE 0x1#define I40E_DCBX_MODE_IEEE 0x2u8 app_mode; +#define I40E_DCBX_APPS_NON_WILLING 0x1u32 numapps;u32 tlv_status;/* CEE mode TLV status */ struct i40e_dcb_ets_config etscfg;
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH 2/7 i40e: Add init and default config of software based DCB
In reply to Tony NguyenFrom: Arkadiusz Kubalewski <[email protected]>
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.
--- drivers/net/ethernet/intel/i40e/i40e.h | 15 +- .../net/ethernet/intel/i40e/i40e_ethtool.c | 20 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 520 ++++++++++++++++-- 3 files changed, 497 insertions(+), 58 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +14 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright(c) 2013 - 2018 Intel Corporation. */ +/* Copyright(c) 2013 - 2021 Intel Corporation. */ #ifndef _I40E_H_#define _I40E_H_
@@ -289,6 +289,9 @@ struct i40e_cloud_filter {u8 tunnel_type; }; +#define I40E_DCB_PRIO_TYPE_STRICT 0 +#define I40E_DCB_PRIO_TYPE_ETS 1 +#define I40E_DCB_STRICT_PRIO_CREDITS 127/* DCB per TC information data structure */ struct i40e_tc_info {u16 qoffset;/* Queue offset from base queue */
@@ -626,6 +629,8 @@ struct i40e_pf {u16 dcbx_cap;struct i40e_filter_control_settings filter_settings; +struct i40e_rx_pb_config pb_cfg;/* Current Rx packet buffer config */ +struct i40e_dcbx_config tmp_cfg;struct ptp_clock *ptp_clock;struct ptp_clock_info ptp_caps;
@@ -1122,6 +1127,12 @@ bool i40e_is_vsi_in_vlan(struct i40e_vsi *vsi);int i40e_count_filters (struct i40e_vsi *vsi);struct i40e_mac_filter *i40e_find_mac (struct i40e_vsi *vsi,const u8 *macaddr);void i40e_vlan_stripping_enable (struct i40e_vsi *vsi); +static inline bool i40e_is_sw_dcb (struct i40e_pf *pf) +{ +return !!(pf->flags &I40E_FLAG_DISABLE_FW_LLDP ); +} + +void i40e_set_lldp_forwarding (struct i40e_pf *pf,bool enable);#ifdef CONFIG_I40E_DCB void i40e_dcbnl_flush_apps(struct i40e_pf *pf, struct i40e_dcbx_config *old_cfg,
@@ -1131,6 +1142,8 @@ void i40e_dcbnl_setup(struct i40e_vsi *vsi);bool i40e_dcb_need_reconfig (struct i40e_pf *pf,struct i40e_dcbx_config *old_cfg,struct i40e_dcbx_config *new_cfg); +int i40e_hw_dcb_config (struct i40e_pf *pf,struct i40e_dcbx_config *new_cfg); +int i40e_dcb_sw_default_config (struct i40e_pf *pf);#endif /* CONFIG_I40E_DCB */ void i40e_ptp_rx_hang (struct i40e_pf *pf);void i40e_ptp_tx_hang (struct i40e_pf *pf);
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +5 -15
@@ -5033,23 +5033,13 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)if (changed_flags &I40E_FLAG_DISABLE_FW_LLDP ) {if (new_flags &I40E_FLAG_DISABLE_FW_LLDP ) { -struct i40e_dcbx_config *dcbcfg; - +#ifdef CONFIG_I40E_DCB +i40e_dcb_sw_default_config (pf); +#endif /* CONFIG_I40E_DCB */ +i40e_aq_cfg_lldp_mib_change_event (&pf->hw, false,NULL );i40e_aq_stop_lldp (&pf->hw, true, false,NULL ); -i40e_aq_set_dcb_parameters (&pf->hw, true,NULL ); -/* reset local_dcbx_config to default */ - dcbcfg = &pf->hw.local_dcbx_config; - dcbcfg->etscfg.willing =1 ; - dcbcfg->etscfg.maxtcs =0 ; - dcbcfg->etscfg.tcbwtable[0 ] =100 ; -for (i =1 ; i <I40E_MAX_TRAFFIC_CLASS ; i++) - dcbcfg->etscfg.tcbwtable[i] =0 ; -for (i =0 ; i <I40E_MAX_USER_PRIORITY ; i++) - dcbcfg->etscfg.prioritytable[i] =0 ; - dcbcfg->etscfg.tsatable[0 ] =I40E_IEEE_TSA_ETS ; - dcbcfg->pfc.willing =1 ; - dcbcfg->pfc.pfccap =I40E_MAX_TRAFFIC_CLASS ; }else { +i40e_set_lldp_forwarding (pf, false); status =i40e_aq_start_lldp (&pf->hw, false,NULL );if (status) { adq_err = pf->hw.aq.asq_last_status;
drivers/net/ethernet/intel/i40e/i40e_main.c +478 -42
722 lines not on this page · raw message
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH 3/7 i40e: Add netlink callbacks support for software based DCB
In reply to Tony NguyenFrom: Arkadiusz Kubalewski <[email protected]>
Add callbacks used by software based LLDP agent, which allows to configure DCB feature from userspace.
Update copyright dates as appropriate.
If LLDP agent is turned off in BIOS, or after setting private flag ("disable-fw-lldp on"). The driver initialized DCB functionality with default values, one traffic class with 100% bandwidth allocated.
The new netlink callbacks are required for software LLDP agent, it must be able to acquire current DCB configuration of a network port and apply DCB configuration changes, if required.
--- drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c | 752 +++++++++++++++++- 1 file changed, 745 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c +745 -7
@@ -1,10 +1,14 @@// SPDX-License-Identifier: GPL-2.0 -/* Copyright(c) 2013 - 2018 Intel Corporation. */ +/* Copyright(c) 2013 - 2021 Intel Corporation. */ #ifdef CONFIG_I40E_DCB #include "i40e.h" #include <net/dcbnl.h> +#define I40E_DCBNL_STATUS_SUCCESS 0 +#define I40E_DCBNL_STATUS_ERROR 1 +static bool i40e_dcbnl_find_app (struct i40e_dcbx_config *cfg, +struct i40e_dcb_app_priority_table *app);/** * i40e_get_pfc_delay - retrieve PFC Link Delay * @hw: pointer to hardware struct
@@ -33,14 +37,13 @@ static int i40e_dcbnl_ieee_getets(struct net_device *dev, {struct i40e_pf *pf =i40e_netdev_to_pf (dev);struct i40e_dcbx_config *dcbxcfg; -struct i40e_hw *hw = &pf->hw;if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_IEEE ))return -EINVAL ; - dcbxcfg = &hw->local_dcbx_config; + dcbxcfg = &pf->hw.local_dcbx_config; ets->willing = dcbxcfg->etscfg.willing; - ets->ets_cap = dcbxcfg->etscfg.maxtcs; + ets->ets_cap =I40E_MAX_TRAFFIC_CLASS ; ets->cbs = dcbxcfg->etscfg.cbs;memcpy (ets->tc_tx_bw, dcbxcfg->etscfg.tcbwtable,sizeof (ets->tc_tx_bw));
@@ -84,7 +87,7 @@ static int i40e_dcbnl_ieee_getpfc(struct net_device *dev, pfc->mbc = dcbxcfg->pfc.mbc;i40e_get_pfc_delay (hw, &pfc->delay); -/* Get Requests/Indicatiosn */ +/* Get Requests/Indications */ for (i =0 ; i <I40E_MAX_TRAFFIC_CLASS ; i++) { pfc->requests[i] = pf->stats.priority_xoff_tx[i]; pfc->indications[i] = pf->stats.priority_xoff_rx[i];
@@ -93,6 +96,713 @@ static int i40e_dcbnl_ieee_getpfc(struct net_device *dev,return 0 ; } +/** +* i40e_dcbnl_ieee_setets - set IEEE ETS configuration +* @netdev: the corresponding netdev +* @ets: structure to hold the ETS information +* +* Set IEEE ETS configuration +**/ +static int i40e_dcbnl_ieee_setets (struct net_device *netdev, +struct ieee_ets *ets) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); +struct i40e_dcbx_config *old_cfg; +int i, ret; + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_IEEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return -EINVAL ; + + old_cfg = &pf->hw.local_dcbx_config; +/* Copy current config into temp */ + pf->tmp_cfg = *old_cfg; + +/* Update the ETS configuration for temp */ + pf->tmp_cfg.etscfg.willing = ets->willing; + pf->tmp_cfg.etscfg.maxtcs =I40E_MAX_TRAFFIC_CLASS ; + pf->tmp_cfg.etscfg.cbs = ets->cbs; +for (i =0 ; i <I40E_MAX_TRAFFIC_CLASS ; i++) { + pf->tmp_cfg.etscfg.tcbwtable[i] = ets->tc_tx_bw[i]; + pf->tmp_cfg.etscfg.tsatable[i] = ets->tc_tsa[i]; + pf->tmp_cfg.etscfg.prioritytable[i] = ets->prio_tc[i]; + pf->tmp_cfg.etsrec.tcbwtable[i] = ets->tc_reco_bw[i]; + pf->tmp_cfg.etsrec.tsatable[i] = ets->tc_reco_tsa[i]; + pf->tmp_cfg.etsrec.prioritytable[i] = ets->reco_prio_tc[i]; + } + +/* Commit changes to HW */ + ret =i40e_hw_dcb_config (pf, &pf->tmp_cfg); +if (ret) { +dev_info (&pf->pdev->dev, +"Failed setting DCB ETS configuration err %s aq_err %s\n" , +i40e_stat_str (&pf->hw, ret), +i40e_aq_str (&pf->hw, pf->hw.aq.asq_last_status)); +return -EINVAL ; + } + +return 0 ; +} + +/** +* i40e_dcbnl_ieee_setpfc - set local IEEE PFC configuration +* @netdev: the corresponding netdev +* @pfc: structure to hold the PFC information +* +* Sets local IEEE PFC configuration +**/ +static int i40e_dcbnl_ieee_setpfc (struct net_device *netdev, +struct ieee_pfc *pfc) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); +struct i40e_dcbx_config *old_cfg; +int ret; + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_IEEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return -EINVAL ; + + old_cfg = &pf->hw.local_dcbx_config; +/* Copy current config into temp */ + pf->tmp_cfg = *old_cfg; +if (pfc->pfc_cap) + pf->tmp_cfg.pfc.pfccap = pfc->pfc_cap; +else + pf->tmp_cfg.pfc.pfccap =I40E_MAX_TRAFFIC_CLASS ; + pf->tmp_cfg.pfc.pfcenable = pfc->pfc_en; + + ret =i40e_hw_dcb_config (pf, &pf->tmp_cfg); +if (ret) { +dev_info (&pf->pdev->dev, +"Failed setting DCB PFC configuration err %s aq_err %s\n" , +i40e_stat_str (&pf->hw, ret), +i40e_aq_str (&pf->hw, pf->hw.aq.asq_last_status)); +return -EINVAL ; + } + +return 0 ; +} + +/** +* i40e_dcbnl_ieee_setapp - set local IEEE App configuration +* @netdev: the corresponding netdev +* @app: structure to hold the Application information +* +* Sets local IEEE App configuration +**/ +static int i40e_dcbnl_ieee_setapp (struct net_device *netdev, +struct dcb_app *app) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); +struct i40e_dcb_app_priority_table new_app; +struct i40e_dcbx_config *old_cfg; +int ret; + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_IEEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return -EINVAL ; + + old_cfg = &pf->hw.local_dcbx_config; +if (old_cfg->numapps ==I40E_DCBX_MAX_APPS ) +return -EINVAL ; + + ret =dcb_ieee_setapp (netdev, app); +if (ret) +return ret; + + new_app.selector = app->selector; + new_app.protocolid = app->protocol; + new_app.priority = app->priority; +/* Already internally available */ +if (i40e_dcbnl_find_app (old_cfg, &new_app)) +return 0 ; + +/* Copy current config into temp */ + pf->tmp_cfg = *old_cfg; +/* Add the app */ + pf->tmp_cfg.app[pf->tmp_cfg.numapps++] = new_app; + + ret =i40e_hw_dcb_config (pf, &pf->tmp_cfg); +if (ret) { +dev_info (&pf->pdev->dev, +"Failed setting DCB configuration err %s aq_err %s\n" , +i40e_stat_str (&pf->hw, ret), +i40e_aq_str (&pf->hw, pf->hw.aq.asq_last_status)); +return -EINVAL ; + } + +return 0 ; +} + +/** +* i40e_dcbnl_ieee_delapp - delete local IEEE App configuration +* @netdev: the corresponding netdev +* @app: structure to hold the Application information +* +* Deletes local IEEE App configuration other than the first application +* required by firmware +**/ +static int i40e_dcbnl_ieee_delapp (struct net_device *netdev, +struct dcb_app *app) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); +struct i40e_dcbx_config *old_cfg; +int i, j, ret; + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_IEEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return -EINVAL ; + + ret =dcb_ieee_delapp (netdev, app); +if (ret) +return ret; + + old_cfg = &pf->hw.local_dcbx_config; +/* Need one app for FW so keep it */ +if (old_cfg->numapps ==1 ) +return 0 ; + +/* Copy current config into temp */ + pf->tmp_cfg = *old_cfg; + +/* Find and reset the app */ +for (i =1 ; i < pf->tmp_cfg.numapps; i++) { +if (app->selector == pf->tmp_cfg.app[i].selector && + app->protocol == pf->tmp_cfg.app[i].protocolid && + app->priority == pf->tmp_cfg.app[i].priority) { +/* Reset the app data */ + pf->tmp_cfg.app[i].selector =0 ; + pf->tmp_cfg.app[i].protocolid =0 ; + pf->tmp_cfg.app[i].priority =0 ; +break ; + } + } + +/* If the specific DCB app not found */ +if (i == pf->tmp_cfg.numapps) +return -EINVAL ; + + pf->tmp_cfg.numapps--; +/* Overwrite the tmp_cfg app */ +for (j = i; j < pf->tmp_cfg.numapps; j++) + pf->tmp_cfg.app[j] = old_cfg->app[j +1 ]; + + ret =i40e_hw_dcb_config (pf, &pf->tmp_cfg); +if (ret) { +dev_info (&pf->pdev->dev, +"Failed setting DCB configuration err %s aq_err %s\n" , +i40e_stat_str (&pf->hw, ret), +i40e_aq_str (&pf->hw, pf->hw.aq.asq_last_status)); +return -EINVAL ; + } + +return 0 ; +} + +/** +* i40e_dcbnl_getstate - Get DCB enabled state +* @netdev: the corresponding netdev +* +* Get the current DCB enabled state +**/ +static u8 i40e_dcbnl_getstate (struct net_device *netdev) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +dev_dbg (&pf->pdev->dev,"DCB state=%d\n" , + !!(pf->flags &I40E_FLAG_DCB_ENABLED )); +return !!(pf->flags &I40E_FLAG_DCB_ENABLED ); +} + +/** +* i40e_dcbnl_setstate - Set DCB state +* @netdev: the corresponding netdev +* @state: enable or disable +* +* Set the DCB state +**/ +static u8 i40e_dcbnl_setstate (struct net_device *netdev,u8 state) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); +int ret =I40E_DCBNL_STATUS_SUCCESS ; + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_CEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return ret; + +dev_dbg (&pf->pdev->dev,"new state=%d current state=%d\n" , + state, (pf->flags &I40E_FLAG_DCB_ENABLED ) ?1 :0 ); +/* Nothing to do */ +if (!state == !(pf->flags &I40E_FLAG_DCB_ENABLED )) +return ret; + +if (i40e_is_sw_dcb (pf)) { +if (state) { + pf->flags |=I40E_FLAG_DCB_ENABLED ; +memcpy (&pf->hw.desired_dcbx_config, + &pf->hw.local_dcbx_config, +sizeof (struct i40e_dcbx_config )); + }else { + pf->flags &= ~I40E_FLAG_DCB_ENABLED ; + } + }else { +/* Cannot directly manipulate FW LLDP Agent */ + ret =I40E_DCBNL_STATUS_ERROR ; + } +return ret; +} + +/** +* i40e_dcbnl_set_pg_tc_cfg_tx - Set CEE PG Tx config +* @netdev: the corresponding netdev +* @tc: the corresponding traffic class +* @prio_type: the traffic priority type +* @bwg_id: the BW group id the traffic class belongs to +* @bw_pct: the BW percentage for the corresponding BWG +* @up_map: prio mapped to corresponding tc +* +* Set Tx PG settings for CEE mode +**/ +static void i40e_dcbnl_set_pg_tc_cfg_tx (struct net_device *netdev,int tc, +u8 prio_type,u8 bwg_id,u8 bw_pct, +u8 up_map) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); +int i; + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_CEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return ; + +/* LLTC not supported yet */ +if (tc >=I40E_MAX_TRAFFIC_CLASS ) +return ; + +/* prio_type, bwg_id and bw_pct per UP are not supported */ + +/* Use only up_map to map tc */ +for (i =0 ; i <I40E_MAX_TRAFFIC_CLASS ; i++) { +if (up_map &BIT (i)) + pf->tmp_cfg.etscfg.prioritytable[i] = tc; + } + pf->tmp_cfg.etscfg.tsatable[tc] =I40E_IEEE_TSA_ETS ; +dev_dbg (&pf->pdev->dev, +"Set PG config tc=%d bwg_id=%d prio_type=%d bw_pct=%d up_map=%d\n" , + tc, bwg_id, prio_type, bw_pct, up_map); +} + +/** +* i40e_dcbnl_set_pg_tc_cfg_tx - Set CEE PG Tx BW config +* @netdev: the corresponding netdev +* @pgid: the corresponding traffic class +* @bw_pct: the BW percentage for the specified traffic class +* +* Set Tx BW settings for CEE mode +**/ +static void i40e_dcbnl_set_pg_bwg_cfg_tx (struct net_device *netdev,int pgid, +u8 bw_pct) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_CEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return ; + +/* LLTC not supported yet */ +if (pgid >=I40E_MAX_TRAFFIC_CLASS ) +return ; + + pf->tmp_cfg.etscfg.tcbwtable[pgid] = bw_pct; +dev_dbg (&pf->pdev->dev,"Set PG BW config tc=%d bw_pct=%d\n" , + pgid, bw_pct); +} + +/** +* i40e_dcbnl_set_pg_tc_cfg_rx - Set CEE PG Rx config +* @netdev: the corresponding netdev +* @prio: the corresponding traffic class +* @prio_type: the traffic priority type +* @pgid: the BW group id the traffic class belongs to +* @bw_pct: the BW percentage for the corresponding BWG +* @up_map: prio mapped to corresponding tc +* +* Set Rx BW settings for CEE mode. The hardware does not support this +* so we won't allow setting of this parameter. +**/ +static void i40e_dcbnl_set_pg_tc_cfg_rx (struct net_device *netdev, +int __always_unused prio, +u8 __always_unused prio_type, +u8 __always_unused pgid, +u8 __always_unused bw_pct, +u8 __always_unused up_map) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +dev_dbg (&pf->pdev->dev,"Rx TC PG Config Not Supported.\n" ); +} + +/** +* i40e_dcbnl_set_pg_bwg_cfg_rx - Set CEE PG Rx config +* @netdev: the corresponding netdev +* @pgid: the corresponding traffic class +* @bw_pct: the BW percentage for the specified traffic class +* +* Set Rx BW settings for CEE mode. The hardware does not support this +* so we won't allow setting of this parameter. +**/ +static void i40e_dcbnl_set_pg_bwg_cfg_rx (struct net_device *netdev,int pgid, +u8 bw_pct) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +dev_dbg (&pf->pdev->dev,"Rx BWG PG Config Not Supported.\n" ); +} + +/** +* i40e_dcbnl_get_pg_tc_cfg_tx - Get CEE PG Tx config +* @netdev: the corresponding netdev +* @prio: the corresponding user priority +* @prio_type: traffic priority type +* @pgid: the BW group ID the traffic class belongs to +* @bw_pct: BW percentage for the corresponding BWG +* @up_map: prio mapped to corresponding TC +* +* Get Tx PG settings for CEE mode +**/ +static void i40e_dcbnl_get_pg_tc_cfg_tx (struct net_device *netdev,int prio, +u8 __always_unused *prio_type, +u8 *pgid, +u8 __always_unused *bw_pct, +u8 __always_unused *up_map) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_CEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return ; + +if (prio >=I40E_MAX_USER_PRIORITY ) +return ; + + *pgid = pf->hw.local_dcbx_config.etscfg.prioritytable[prio]; +dev_dbg (&pf->pdev->dev,"Get PG config prio=%d tc=%d\n" , + prio, *pgid); +} + +/** +* i40e_dcbnl_get_pg_bwg_cfg_tx - Get CEE PG BW config +* @netdev: the corresponding netdev +* @pgid: the corresponding traffic class +* @bw_pct: the BW percentage for the corresponding TC +* +* Get Tx BW settings for given TC in CEE mode +**/ +static void i40e_dcbnl_get_pg_bwg_cfg_tx (struct net_device *netdev,int pgid, +u8 *bw_pct) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_CEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return ; + +if (pgid >=I40E_MAX_TRAFFIC_CLASS ) +return ; + + *bw_pct = pf->hw.local_dcbx_config.etscfg.tcbwtable[pgid]; +dev_dbg (&pf->pdev->dev,"Get PG BW config tc=%d bw_pct=%d\n" , + pgid, *bw_pct); +} + +/** +* i40e_dcbnl_get_pg_tc_cfg_rx - Get CEE PG Rx config +* @netdev: the corresponding netdev +* @prio: the corresponding user priority +* @prio_type: the traffic priority type +* @pgid: the PG ID +* @bw_pct: the BW percentage for the corresponding BWG +* @up_map: prio mapped to corresponding TC +* +* Get Rx PG settings for CEE mode. The UP2TC map is applied in same +* manner for Tx and Rx (symmetrical) so return the TC information for +* given priority accordingly. +**/ +static void i40e_dcbnl_get_pg_tc_cfg_rx (struct net_device *netdev,int prio, +u8 *prio_type,u8 *pgid,u8 *bw_pct, +u8 *up_map) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_CEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return ; + +if (prio >=I40E_MAX_USER_PRIORITY ) +return ; + + *pgid = pf->hw.local_dcbx_config.etscfg.prioritytable[prio]; +} + +/** +* i40e_dcbnl_get_pg_bwg_cfg_rx - Get CEE PG BW Rx config +* @netdev: the corresponding netdev +* @pgid: the corresponding traffic class +* @bw_pct: the BW percentage for the corresponding TC +* +* Get Rx BW settings for given TC in CEE mode +* The adapter doesn't support Rx ETS and runs in strict priority +* mode in Rx path and hence just return 0. +**/ +static void i40e_dcbnl_get_pg_bwg_cfg_rx (struct net_device *netdev,int pgid, +u8 *bw_pct) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_CEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return ; + *bw_pct =0 ; +} + +/** +* i40e_dcbnl_set_pfc_cfg - Set CEE PFC configuration +* @netdev: the corresponding netdev +* @prio: the corresponding user priority +* @setting: the PFC setting for given priority +* +* Set the PFC enabled/disabled setting for given user priority +**/ +static void i40e_dcbnl_set_pfc_cfg (struct net_device *netdev,int prio, +u8 setting) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_CEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return ; + +if (prio >=I40E_MAX_USER_PRIORITY ) +return ; + + pf->tmp_cfg.pfc.pfccap =I40E_MAX_TRAFFIC_CLASS ; +if (setting) + pf->tmp_cfg.pfc.pfcenable |=BIT (prio); +else + pf->tmp_cfg.pfc.pfcenable &= ~BIT (prio); +dev_dbg (&pf->pdev->dev, +"Set PFC Config up=%d setting=%d pfcenable=0x%x\n" , + prio, setting, pf->tmp_cfg.pfc.pfcenable); +} + +/** +* i40e_dcbnl_get_pfc_cfg - Get CEE PFC configuration +* @netdev: the corresponding netdev +* @prio: the corresponding user priority +* @setting: the PFC setting for given priority +* +* Get the PFC enabled/disabled setting for given user priority +**/ +static void i40e_dcbnl_get_pfc_cfg (struct net_device *netdev,int prio, +u8 *setting) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_CEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return ; + +if (prio >=I40E_MAX_USER_PRIORITY ) +return ; + + *setting = (pf->hw.local_dcbx_config.pfc.pfcenable >> prio) &0x1 ; +dev_dbg (&pf->pdev->dev, +"Get PFC Config up=%d setting=%d pfcenable=0x%x\n" , + prio, *setting, pf->hw.local_dcbx_config.pfc.pfcenable); +} + +/** +* i40e_dcbnl_cee_set_all - Commit CEE DCB settings to hardware +* @netdev: the corresponding netdev +* +* Commit the current DCB configuration to hardware +**/ +static u8 i40e_dcbnl_cee_set_all (struct net_device *netdev) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); +int err; + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_CEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return I40E_DCBNL_STATUS_ERROR ; + +dev_dbg (&pf->pdev->dev,"Commit DCB Configuration to the hardware\n" ); + err =i40e_hw_dcb_config (pf, &pf->tmp_cfg); + +return err ?I40E_DCBNL_STATUS_ERROR :I40E_DCBNL_STATUS_SUCCESS ; +} + +/** +* i40e_dcbnl_get_cap - Get DCBX capabilities of adapter +* @netdev: the corresponding netdev +* @capid: the capability type +* @cap: the capability value +* +* Return the capability value for a given capability type +**/ +static u8 i40e_dcbnl_get_cap (struct net_device *netdev,int capid,u8 *cap) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +if (!(pf->flags &I40E_FLAG_DCB_CAPABLE )) +return I40E_DCBNL_STATUS_ERROR ; + +switch (capid) { +case DCB_CAP_ATTR_PG : +case DCB_CAP_ATTR_PFC : + *cap = true; +break ; +case DCB_CAP_ATTR_PG_TCS : +case DCB_CAP_ATTR_PFC_TCS : + *cap =0x80 ; +break ; +case DCB_CAP_ATTR_DCBX : + *cap = pf->dcbx_cap; +break ; +case DCB_CAP_ATTR_UP2TC : +case DCB_CAP_ATTR_GSP : +case DCB_CAP_ATTR_BCN : +default : + *cap = false; +break ; + } + +dev_dbg (&pf->pdev->dev,"Get Capability cap=%d capval=0x%x\n" , + capid, *cap); +return I40E_DCBNL_STATUS_SUCCESS ; +} + +/** +* i40e_dcbnl_getnumtcs - Get max number of traffic classes supported +* @netdev: the corresponding netdev +* @tcid: the TC id +* @num: total number of TCs supported by the device +* +* Return the total number of TCs supported by the adapter +**/ +static int i40e_dcbnl_getnumtcs (struct net_device *netdev,int tcid,u8 *num) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +if (!(pf->flags &I40E_FLAG_DCB_CAPABLE )) +return -EINVAL ; + + *num =I40E_MAX_TRAFFIC_CLASS ; +return 0 ; +} + +/** +* i40e_dcbnl_setnumtcs - Set CEE number of traffic classes +* @netdev: the corresponding netdev +* @tcid: the TC id +* @num: total number of TCs +* +* Set the total number of TCs (Unsupported) +**/ +static int i40e_dcbnl_setnumtcs (struct net_device *netdev,int tcid,u8 num) +{ +return -EINVAL ; +} + +/** +* i40e_dcbnl_getpfcstate - Get CEE PFC mode +* @netdev: the corresponding netdev +* +* Get the current PFC enabled state +**/ +static u8 i40e_dcbnl_getpfcstate (struct net_device *netdev) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +/* Return enabled if any PFC enabled UP */ +if (pf->hw.local_dcbx_config.pfc.pfcenable) +return 1 ; +else +return 0 ; +} + +/** +* i40e_dcbnl_setpfcstate - Set CEE PFC mode +* @netdev: the corresponding netdev +* @state: required state +* +* The PFC state to be set; this is enabled/disabled based on the PFC +* priority settings and not via this call for i40e driver +**/ +static void i40e_dcbnl_setpfcstate (struct net_device *netdev,u8 state) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +dev_dbg (&pf->pdev->dev,"PFC State is modified via PFC config.\n" ); +} + +/** +* i40e_dcbnl_getapp - Get CEE APP +* @netdev: the corresponding netdev +* @idtype: the App selector +* @id: the App ethtype or port number +* +* Return the CEE mode app for the given idtype and id +**/ +static int i40e_dcbnl_getapp (struct net_device *netdev,u8 idtype,u16 id) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); +struct dcb_app app = { + .selector = idtype, + .protocol = id, + }; + +if (!(pf->dcbx_cap &DCB_CAP_DCBX_VER_CEE ) || + (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED )) +return -EINVAL ; + +return dcb_getapp (netdev, &app); +} + +/** +* i40e_dcbnl_setdcbx - set required DCBx capability +* @netdev: the corresponding netdev +* @mode: new DCB mode managed or CEE+IEEE +* +* Set DCBx capability features +**/ +static u8 i40e_dcbnl_setdcbx (struct net_device *netdev,u8 mode) +{ +struct i40e_pf *pf =i40e_netdev_to_pf (netdev); + +/* Do not allow to set mode if managed by Firmware */ +if (pf->dcbx_cap &DCB_CAP_DCBX_LLD_MANAGED ) +return I40E_DCBNL_STATUS_ERROR ; + +/* No support for LLD_MANAGED modes or CEE+IEEE */ +if ((mode &DCB_CAP_DCBX_LLD_MANAGED ) || + ((mode &DCB_CAP_DCBX_VER_IEEE ) && (mode &DCB_CAP_DCBX_VER_CEE )) || + !(mode &DCB_CAP_DCBX_HOST )) +return I40E_DCBNL_STATUS_ERROR ; + +/* Already set to the given mode no change */ +if (mode == pf->dcbx_cap) +return I40E_DCBNL_STATUS_SUCCESS ; + + pf->dcbx_cap = mode; +if (mode &DCB_CAP_DCBX_VER_CEE ) + pf->hw.local_dcbx_config.dcbx_mode =I40E_DCBX_MODE_CEE ; +else + pf->hw.local_dcbx_config.dcbx_mode =I40E_DCBX_MODE_IEEE ; + +dev_dbg (&pf->pdev->dev,"mode=%d\n" , mode); +return I40E_DCBNL_STATUS_SUCCESS ; +} +/** * i40e_dcbnl_getdcbx - retrieve current DCBx capability * @dev: the corresponding netdev
@@ -132,7 +842,31 @@ static const struct dcbnl_rtnl_ops dcbnl_ops = { .ieee_getets = i40e_dcbnl_ieee_getets, .ieee_getpfc = i40e_dcbnl_ieee_getpfc, .getdcbx = i40e_dcbnl_getdcbx, - .getpermhwaddr = i40e_dcbnl_get_perm_hw_addr, + .getpermhwaddr = i40e_dcbnl_get_perm_hw_addr, + .ieee_setets = i40e_dcbnl_ieee_setets, + .ieee_setpfc = i40e_dcbnl_ieee_setpfc, + .ieee_setapp = i40e_dcbnl_ieee_setapp, + .ieee_delapp = i40e_dcbnl_ieee_delapp, + .getstate = i40e_dcbnl_getstate, + .setstate = i40e_dcbnl_setstate, + .setpgtccfgtx = i40e_dcbnl_set_pg_tc_cfg_tx, + .setpgbwgcfgtx = i40e_dcbnl_set_pg_bwg_cfg_tx, + .setpgtccfgrx = i40e_dcbnl_set_pg_tc_cfg_rx, + .setpgbwgcfgrx = i40e_dcbnl_set_pg_bwg_cfg_rx, + .getpgtccfgtx = i40e_dcbnl_get_pg_tc_cfg_tx, + .getpgbwgcfgtx = i40e_dcbnl_get_pg_bwg_cfg_tx, + .getpgtccfgrx = i40e_dcbnl_get_pg_tc_cfg_rx, + .getpgbwgcfgrx = i40e_dcbnl_get_pg_bwg_cfg_rx, + .setpfccfg = i40e_dcbnl_set_pfc_cfg, + .getpfccfg = i40e_dcbnl_get_pfc_cfg, + .setall = i40e_dcbnl_cee_set_all, + .getcap = i40e_dcbnl_get_cap, + .getnumtcs = i40e_dcbnl_getnumtcs, + .setnumtcs = i40e_dcbnl_setnumtcs, + .getpfcstate = i40e_dcbnl_getpfcstate, + .setpfcstate = i40e_dcbnl_setpfcstate, + .getapp = i40e_dcbnl_getapp, + .setdcbx = i40e_dcbnl_setdcbx, };/**
@@ -152,12 +886,16 @@ void i40e_dcbnl_set_all(struct i40e_vsi *vsi)u8 prio, tc_map;int i; +/* SW DCB taken care by DCBNL set calls */ +if (pf->dcbx_cap &DCB_CAP_DCBX_HOST ) +return ; +/* DCB not enabled */ if (!(pf->flags &I40E_FLAG_DCB_ENABLED ))return ;/* MFP mode but not an iSCSI PF so return */ -if ((pf->flags &I40E_FLAG_MFP_ENABLED ) && !(pf->hw.func_caps.iscsi)) +if ((pf->flags &I40E_FLAG_MFP_ENABLED ) && !(hw->func_caps.iscsi))return ; dcbxcfg = &hw->local_dcbx_config;
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH 4/7 i40e: Add EEE status getting & setting implementation
In reply to Tony NguyenFrom: Aleksandr Loktionov <[email protected]>
Implement Energy Efficient Ethernet (EEE) status getting & setting. The i40e_get_eee() requesting PHY EEE capabilities from firmware. The i40e_set_eee() function requests PHY EEE capabilities from firmware and sets PHY EEE advertising to full abilities or 0 depending whether EEE is to be enabled or disabled.
--- .../net/ethernet/intel/i40e/i40e_ethtool.c | 123 +++++++++++++++++- .../net/ethernet/intel/i40e/i40e_register.h | 2 + 2 files changed, 123 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +121 -2
@@ -5242,12 +5242,131 @@ static int i40e_get_module_eeprom(struct net_device *netdev,static int i40e_get_eee (struct net_device *netdev,struct ethtool_eee *edata) { -return -EOPNOTSUPP ; +struct i40e_netdev_priv *np =netdev_priv (netdev); +struct i40e_aq_get_phy_abilities_resp phy_cfg; +enum i40e_status_code status =0 ; +struct i40e_vsi *vsi = np->vsi; +struct i40e_pf *pf = vsi->back; +struct i40e_hw *hw = &pf->hw; + +/* Get initial PHY capabilities */ + status =i40e_aq_get_phy_capabilities (hw, false, true, &phy_cfg,NULL ); +if (status) +return -EAGAIN ; + +/* Check whether NIC configuration is compatible with Energy Efficient +* Ethernet (EEE) mode. +*/ +if (phy_cfg.eee_capability ==0 ) +return -EOPNOTSUPP ; + + edata->supported = SUPPORTED_Autoneg; + edata->lp_advertised = edata->supported; + +/* Get current configuration */ + status =i40e_aq_get_phy_capabilities (hw, false, false, &phy_cfg,NULL ); +if (status) +return -EAGAIN ; + + edata->advertised = phy_cfg.eee_capability ? SUPPORTED_Autoneg :0U ; + edata->eee_enabled = !!edata->advertised; + edata->tx_lpi_enabled = pf->stats.tx_lpi_status; + + edata->eee_active = pf->stats.tx_lpi_status && pf->stats.rx_lpi_status; + +return 0 ; +} + +static int i40e_is_eee_param_supported (struct net_device *netdev, +struct ethtool_eee *edata) +{ +struct i40e_netdev_priv *np =netdev_priv (netdev); +struct i40e_vsi *vsi = np->vsi; +struct i40e_pf *pf = vsi->back; +struct i40e_ethtool_not_used { +u32 value; +const char *name; + } param[] = { + {edata->advertised & ~SUPPORTED_Autoneg,"advertise" }, + {edata->tx_lpi_timer,"tx-timer" }, + {edata->tx_lpi_enabled != pf->stats.tx_lpi_status,"tx-lpi" } + }; +int i; + +for (i =0 ; i <ARRAY_SIZE (param); i++) { +if (param[i].value) { +netdev_info (netdev, +"EEE setting %s not supported\n" , + param[i].name); +return -EOPNOTSUPP ; + } + } + +return 0 ; }static int i40e_set_eee (struct net_device *netdev,struct ethtool_eee *edata) { -return -EOPNOTSUPP ; +struct i40e_netdev_priv *np =netdev_priv (netdev); +struct i40e_aq_get_phy_abilities_resp abilities; +enum i40e_status_code status =I40E_SUCCESS ; +struct i40e_aq_set_phy_config config; +struct i40e_vsi *vsi = np->vsi; +struct i40e_pf *pf = vsi->back; +struct i40e_hw *hw = &pf->hw; +__le16 eee_capability; + +/* Deny parameters we don't support */ +if (i40e_is_eee_param_supported (netdev, edata)) +return -EOPNOTSUPP ; + +/* Get initial PHY capabilities */ + status =i40e_aq_get_phy_capabilities (hw, false, true, &abilities, +NULL ); +if (status) +return -EAGAIN ; + +/* Check whether NIC configuration is compatible with Energy Efficient +* Ethernet (EEE) mode. +*/ +if (abilities.eee_capability ==0 ) +return -EOPNOTSUPP ; + +/* Cache initial EEE capability */ + eee_capability = abilities.eee_capability; + +/* Get current PHY configuration */ + status =i40e_aq_get_phy_capabilities (hw, false, false, &abilities, +NULL ); +if (status) +return -EAGAIN ; + +/* Cache current PHY configuration */ + config.phy_type = abilities.phy_type; + config.phy_type_ext = abilities.phy_type_ext; + config.link_speed = abilities.link_speed; + config.abilities = abilities.abilities | +I40E_AQ_PHY_ENABLE_ATOMIC_LINK ; + config.eeer = abilities.eeer_val; + config.low_power_ctrl = abilities.d3_lpan; + config.fec_config = abilities.fec_cfg_curr_mod_ext_info & +I40E_AQ_PHY_FEC_CONFIG_MASK ; + +/* Set desired EEE state */ +if (edata->eee_enabled) { + config.eee_capability = eee_capability; + config.eeer |=cpu_to_le32 (I40E_PRTPM_EEER_TX_LPI_EN_MASK ); + }else { + config.eee_capability =0 ; + config.eeer &=cpu_to_le32 (~I40E_PRTPM_EEER_TX_LPI_EN_MASK ); + } + +/* Apply modified PHY configuration */ + status =i40e_aq_set_phy_config (hw, &config,NULL ); +if (status) +return -EAGAIN ; + +return 0 ; }static const struct ethtool_ops i40e_ethtool_recovery_mode_ops = {
drivers/net/ethernet/intel/i40e/i40e_register.h +2 -0
@@ -544,6 +544,8 @@#define I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_MASK I40E_MASK(0x1, I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_SHIFT)#define I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_SHIFT 31#define I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_MASK I40E_MASK(0x1, I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_SHIFT) +#define I40E_PRTPM_EEER_TX_LPI_EN_SHIFT 16 +#define I40E_PRTPM_EEER_TX_LPI_EN_MASK I40E_MASK(0x1, I40E_PRTPM_EEER_TX_LPI_EN_SHIFT)#define I40E_PRTPM_RLPIC 0x001E43A0/* Reset: GLOBR */ #define I40E_PRTPM_TLPIC 0x001E43C0/* Reset: GLOBR */ #define I40E_PRTRPB_DHW (_i) (0x000AC100 + ((_i) * 32))/* _i=0...7 */ /* Reset: CORER */
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH 5/7 i40e: Add flow director support for IPv6
In reply to Tony NguyenFrom: Przemyslaw Patynowski <[email protected]>
Flow director for IPv6 is not supported.
1) Implementation of support for IPv6 flow director.
2) Added handlers for addition of TCP6, UDP6, SCTP6, IPv6.
3) Refactored legacy code to make it more generic.
4) Added packet templates for TCP6, UDP6, SCTP6, IPv6.
5) Added handling of IPv6 source and destination address for flow director.
6) Improved argument passing for source and destination portin TCP6, UDP6 and SCTP6.
7) Added handling of ethtool -n for IPv6, TCP6,UDP6, SCTP6.
8) Used correct bit flag regarding FLEXOFF field of flow director data descriptor.
Without this patch, there would be no support for flow director on IPv6,
TCP6, UDP6, SCTP6.
Tested based on x710 datasheet by using:
ethtool -N enp133s0f0 flow-type tcp4 src-port 13 dst-port 37 user-def 0x44142 action 1
ethtool -N enp133s0f0 flow-type tcp6 src-port 13 dst-port 40 user-def 0x44142 action 2
ethtool -N enp133s0f0 flow-type udp4 src-port 20 dst-port 40 user-def 0x44142 action 3
ethtool -N enp133s0f0 flow-type udp6 src-port 25 dst-port 40 user-def 0x44142 action 4
ethtool -N enp133s0f0 flow-type sctp4 src-port 55 dst-port 65 user-def 0x44142 action 5
ethtool -N enp133s0f0 flow-type sctp6 src-port 60 dst-port 40 user-def 0x44142 action 6
ethtool -N enp133s0f0 flow-type ip4 src-ip 1.1.1.1 dst-ip 1.1.1.4 user-def 0x44142 action 7
ethtool -N enp133s0f0 flow-type ip6 src-ip fe80::3efd:feff:fe6f:bbbb dst-ip fe80::3efd:feff:fe6f:aaaa user-def 0x44142 action 8 Then send traffic from client which matches the criteria provided to ethtool.
Observe that packets are redirected to user set queues with ethtool -S <interface>
--- drivers/net/ethernet/intel/i40e/i40e.h | 9 +- .../net/ethernet/intel/i40e/i40e_ethtool.c | 211 +++++++++- drivers/net/ethernet/intel/i40e/i40e_main.c | 79 +++- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 371 +++++++++++++----- 4 files changed, 551 insertions(+), 119 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +8 -1
@@ -213,10 +213,12 @@ struct i40e_fdir_filter {struct hlist_node fdir_node;/* filter ipnut set */ u8 flow_type; -u8 ip4_proto; +u8 ipl4_proto;/* TX packet view of src and dst */ __be32 dst_ip;__be32 src_ip; +__be32 dst_ip6[4 ]; +__be32 src_ip6[4 ];__be16 src_port;__be16 dst_port;__be32 sctp_v_tag;
@@ -477,6 +479,11 @@ struct i40e_pf {u16 fd_sctp4_filter_cnt;u16 fd_ip4_filter_cnt; +u16 fd_tcp6_filter_cnt; +u16 fd_udp6_filter_cnt; +u16 fd_sctp6_filter_cnt; +u16 fd_ip6_filter_cnt; +/* Flexible filter table values that need to be programmed into * hardware, which expects L3 and L4 to be programmed separately. We * need to ensure that the values are in ascended order and don't have
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +194 -17
282 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_main.c +69 -10
138 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_txrx.c +280 -91
568 lines not on this page · raw message
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH 6/7 i40e: VLAN field for flow director
In reply to Tony NguyenFrom: Przemyslaw Patynowski <[email protected]>
Allow user to specify VLAN field and add it to flow director. Show VLAN field in "ethtool -n ethx" command.
Handle VLAN type and tag field provided by ethtool command. Refactored filter addition, by replacing static arrays with runtime dummy packet creation, which allows specifying VLAN field.
Previously, VLAN field was omitted.
--- drivers/net/ethernet/intel/i40e/i40e.h | 2 + .../net/ethernet/intel/i40e/i40e_ethtool.c | 30 +- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 547 ++++++++---------- drivers/net/ethernet/intel/i40e/i40e_type.h | 2 + 4 files changed, 289 insertions(+), 292 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +2 -0
@@ -223,6 +223,8 @@ struct i40e_fdir_filter {__be16 dst_port;__be32 sctp_v_tag; +__be16 vlan_etype; +__be16 vlan_tag;/* Flexible data to match within the packet payload */ __be16 flex_word;u16 flex_offset;
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +29 -1
@@ -3318,6 +3318,14 @@ static int i40e_get_ethtool_fdir_entry(struct i40e_pf *pf,else fsp->ring_cookie = rule->q_index; +if (rule->vlan_tag) { + fsp->h_ext.vlan_etype = rule->vlan_etype; + fsp->m_ext.vlan_etype =htons (0xFFFF ); + fsp->h_ext.vlan_tci = rule->vlan_tag; + fsp->m_ext.vlan_tci =htons (0xFFFF ); + fsp->flow_type |=FLOW_EXT ; + } +if (rule->dest_vsi != pf->vsi[pf->lan_vsi]->id) {struct i40e_vsi *vsi;
@@ -4350,6 +4358,19 @@ static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,return -EOPNOTSUPP ; } +if (fsp->flow_type &FLOW_EXT ) { +/* Allow only 802.1Q and no etype defined, as +* later it's modified to 0x8100 +*/ +if (fsp->h_ext.vlan_etype !=htons (ETH_P_8021Q ) && + fsp->h_ext.vlan_etype !=0 ) +return -EOPNOTSUPP ; +if (fsp->m_ext.vlan_tci ==htons (0xFFFF )) + new_mask |=I40E_VLAN_SRC_MASK ; +else + new_mask &= ~I40E_VLAN_SRC_MASK ; + } +/* First, clear all flexible filter entries */ new_mask &= ~I40E_FLEX_INPUT_MASK ;
@@ -4529,7 +4550,9 @@ static bool i40e_match_fdir_filter(struct i40e_fdir_filter *a, a->dst_port != b->dst_port || a->src_port != b->src_port || a->flow_type != b->flow_type || - a->ipl4_proto != b->ipl4_proto) + a->ipl4_proto != b->ipl4_proto || + a->vlan_tag != b->vlan_tag || + a->vlan_etype != b->vlan_etype) return false;return true;
@@ -4688,6 +4711,11 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi, input->src_ip = fsp->h_u.tcp_ip4_spec.ip4dst; input->flow_type = fsp->flow_type & ~FLOW_EXT ; + input->vlan_etype = fsp->h_ext.vlan_etype; +if (!fsp->m_ext.vlan_etype && fsp->h_ext.vlan_tci) + input->vlan_etype =cpu_to_be16 (ETH_P_8021Q ); +if (fsp->m_ext.vlan_tci && input->vlan_etype) + input->vlan_tag = fsp->h_ext.vlan_tci; if (input->flow_type == IPV6_USER_FLOW || input->flow_type == UDP_V6_FLOW || input->flow_type == TCP_V6_FLOW ||
drivers/net/ethernet/intel/i40e/i40e_txrx.c +256 -291
675 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_type.h +2 -0
@@ -1421,6 +1421,8 @@ struct i40e_lldp_variables {#define I40E_L4_DST_MASK (0x1ULL << I40E_L4_DST_SHIFT)#define I40E_VERIFY_TAG_SHIFT 31#define I40E_VERIFY_TAG_MASK (0x3ULL << I40E_VERIFY_TAG_SHIFT) +#define I40E_VLAN_SRC_SHIFT 55 +#define I40E_VLAN_SRC_MASK (0x1ULL << I40E_VLAN_SRC_SHIFT)#define I40E_FLEX_50_SHIFT 13#define I40E_FLEX_50_MASK (0x1ULL << I40E_FLEX_50_SHIFT)
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH 7/7 i40e: remove the useless value assignment in i40e_clean_adminq_subtask
In reply to Tony NguyenFrom: Kaixu Xia <[email protected]>
The variable ret is overwritten by the following call i40e_clean_arq_element() and the assignment is useless, so remove it.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
@@ -9842,7 +9842,7 @@ static void i40e_clean_adminq_subtask(struct i40e_pf *pf)dev_dbg (&pf->pdev->dev,"ARQ: Update LLDP MIB event received\n" );#ifdef CONFIG_I40E_DCB rtnl_lock (); - ret =i40e_handle_lldp_event (pf, &event); +i40e_handle_lldp_event (pf, &event);rtnl_unlock ();#endif /* CONFIG_I40E_DCB */ break ;
Signature · 1 line
2.26.2
This series was applied to netdev/net-next.git (refs/heads/master):
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
Quoted 9 lines · On Wed, 10 Feb 2021 15:24:29 -0800 you wrote:
This series contains updates to i40e driver only.
Arkadiusz adds support for software controlled DCB. Upon disabling of the firmware LLDP agent, the driver configures DCB with default values (only one Traffic Class). At the same time, it allows a software based LLDP agent - userspace application i.e. lldpad) to receive DCB TLVs and set desired DCB configuration through DCB related netlink callbacks.
[...]
Here is the summary with links:
- [net-next,1/7] i40e: Add hardware configuration for software based DCB
https://git.kernel.org/netdev/net-next/c/90bc8e003be2 - [net-next,2/7] i40e: Add init and default config of software based DCB https://git.kernel.org/netdev/net-next/c/4b208eaa8078 - [net-next,3/7] i40e: Add netlink callbacks support for software based DCB https://git.kernel.org/netdev/net-next/c/5effa78e7c94 - [net-next,4/7] i40e: Add EEE status getting & setting implementation https://git.kernel.org/netdev/net-next/c/95f352dca19d - [net-next,5/7] i40e: Add flow director support for IPv6 https://git.kernel.org/netdev/net-next/c/efca91e89b67 - [net-next,6/7] i40e: VLAN field for flow director https://git.kernel.org/netdev/net-next/c/a9219b332f52 - [net-next,7/7] i40e: remove the useless value assignment in i40e_clean_adminq_subtask https://git.kernel.org/netdev/net-next/c/bfe2e5c44d72
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html