Skip to content

Commit

Permalink
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/tnguy/next-queue

Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2022-08-18 (ice)

This series contains updates to ice driver only.

Jesse and Anatolii add support for controlling FCS/CRC stripping via
ethtool.

Anirudh allows for 100M speeds on devices which support it.

Sylwester removes ucast_shared field and the associated dead code related
to it.

Mikael removes non-inclusive language from the driver.

* '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
  ice: remove non-inclusive language
  ice: Remove ucast_shared
  ice: Allow 100M speeds for some devices
  ice: Implement FCS/CRC and VLAN stripping co-existence policy
  ice: Implement control of FCS/CRC stripping
====================

Link: https://lore.kernel.org/r/20220818155207.996297-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Aug 23, 2022
2 parents b18e04e + 5c60300 commit 0134fe8
Show file tree
Hide file tree
Showing 13 changed files with 136 additions and 184 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/intel/ice/ice.h
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ ice_fetch_u64_stats_per_ring(struct u64_stats_sync *syncp,
struct ice_q_stats stats, u64 *pkts, u64 *bytes);
int ice_up(struct ice_vsi *vsi);
int ice_down(struct ice_vsi *vsi);
int ice_down_up(struct ice_vsi *vsi);
int ice_vsi_cfg(struct ice_vsi *vsi);
struct ice_vsi *ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi);
int ice_vsi_determine_xdp_res(struct ice_vsi *vsi);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/intel/ice/ice_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ static int ice_setup_rx_ctx(struct ice_rx_ring *ring)
/* Strip the Ethernet CRC bytes before the packet is posted to host
* memory.
*/
rlan_ctx.crcstrip = 1;
rlan_ctx.crcstrip = !(ring->flags & ICE_RX_FLAGS_CRC_STRIP_DIS);

/* L2TSEL flag defines the reported L2 Tags in the receive descriptor
* and it needs to remain 1 for non-DVM capable configurations to not
Expand Down
20 changes: 20 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2775,6 +2775,26 @@ ice_aq_set_port_params(struct ice_port_info *pi, bool double_vlan,
return ice_aq_send_cmd(hw, &desc, NULL, 0, cd);
}

/**
* ice_is_100m_speed_supported
* @hw: pointer to the HW struct
*
* returns true if 100M speeds are supported by the device,
* false otherwise.
*/
bool ice_is_100m_speed_supported(struct ice_hw *hw)
{
switch (hw->device_id) {
case ICE_DEV_ID_E822C_SGMII:
case ICE_DEV_ID_E822L_SGMII:
case ICE_DEV_ID_E823L_1GBE:
case ICE_DEV_ID_E823C_SGMII:
return true;
default:
return false;
}
}

/**
* ice_get_link_speed_based_on_phy_type - returns link speed
* @phy_type_low: lower part of phy_type
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/intel/ice/ice_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ ice_aq_set_gpio(struct ice_hw *hw, u16 gpio_ctrl_handle, u8 pin_idx, bool value,
int
ice_aq_get_gpio(struct ice_hw *hw, u16 gpio_ctrl_handle, u8 pin_idx,
bool *value, struct ice_sq_cd *cd);
bool ice_is_100m_speed_supported(struct ice_hw *hw);
int
ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size,
struct ice_sq_cd *cd);
Expand Down
16 changes: 8 additions & 8 deletions drivers/net/ethernet/intel/ice/ice_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1289,10 +1289,7 @@ static int ice_set_priv_flags(struct net_device *netdev, u32 flags)
}
if (test_bit(ICE_FLAG_LEGACY_RX, change_flags)) {
/* down and up VSI so that changes of Rx cfg are reflected. */
if (!test_and_set_bit(ICE_VSI_DOWN, vsi->state)) {
ice_down(vsi);
ice_up(vsi);
}
ice_down_up(vsi);
}
/* don't allow modification of this flag when a single VF is in
* promiscuous mode because it's not supported
Expand Down Expand Up @@ -1473,20 +1470,22 @@ ice_get_ethtool_stats(struct net_device *netdev,

/**
* ice_mask_min_supported_speeds
* @hw: pointer to the HW structure
* @phy_types_high: PHY type high
* @phy_types_low: PHY type low to apply minimum supported speeds mask
*
* Apply minimum supported speeds mask to PHY type low. These are the speeds
* for ethtool supported link mode.
*/
static
void ice_mask_min_supported_speeds(u64 phy_types_high, u64 *phy_types_low)
static void
ice_mask_min_supported_speeds(struct ice_hw *hw,
u64 phy_types_high, u64 *phy_types_low)
{
/* if QSFP connection with 100G speed, minimum supported speed is 25G */
if (*phy_types_low & ICE_PHY_TYPE_LOW_MASK_100G ||
phy_types_high & ICE_PHY_TYPE_HIGH_MASK_100G)
*phy_types_low &= ~ICE_PHY_TYPE_LOW_MASK_MIN_25G;
else
else if (!ice_is_100m_speed_supported(hw))
*phy_types_low &= ~ICE_PHY_TYPE_LOW_MASK_MIN_1G;
}

Expand Down Expand Up @@ -1536,7 +1535,8 @@ ice_phy_type_to_ethtool(struct net_device *netdev,
phy_types_low = le64_to_cpu(pf->nvm_phy_type_lo);
phy_types_high = le64_to_cpu(pf->nvm_phy_type_hi);

ice_mask_min_supported_speeds(phy_types_high, &phy_types_low);
ice_mask_min_supported_speeds(&pf->hw, phy_types_high,
&phy_types_low);
/* determine advertised modes based on link override only
* if it's supported and if the FW doesn't abstract the
* driver from having to account for link overrides
Expand Down
16 changes: 8 additions & 8 deletions drivers/net/ethernet/intel/ice/ice_lag.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ static void ice_lag_set_backup(struct ice_lag *lag)
*/
static void ice_display_lag_info(struct ice_lag *lag)
{
const char *name, *peer, *upper, *role, *bonded, *master;
const char *name, *peer, *upper, *role, *bonded, *primary;
struct device *dev = &lag->pf->pdev->dev;

name = lag->netdev ? netdev_name(lag->netdev) : "unset";
peer = lag->peer_netdev ? netdev_name(lag->peer_netdev) : "unset";
upper = lag->upper_netdev ? netdev_name(lag->upper_netdev) : "unset";
master = lag->master ? "TRUE" : "FALSE";
primary = lag->primary ? "TRUE" : "FALSE";
bonded = lag->bonded ? "BONDED" : "UNBONDED";

switch (lag->role) {
Expand All @@ -87,8 +87,8 @@ static void ice_display_lag_info(struct ice_lag *lag)
role = "ERROR";
}

dev_dbg(dev, "%s %s, peer:%s, upper:%s, role:%s, master:%s\n", name,
bonded, peer, upper, role, master);
dev_dbg(dev, "%s %s, peer:%s, upper:%s, role:%s, primary:%s\n", name,
bonded, peer, upper, role, primary);
}

/**
Expand Down Expand Up @@ -119,7 +119,7 @@ static void ice_lag_info_event(struct ice_lag *lag, void *ptr)
}

if (strcmp(bonding_info->slave.slave_name, lag_netdev_name)) {
netdev_dbg(lag->netdev, "Bonding event recv, but slave info not for us\n");
netdev_dbg(lag->netdev, "Bonding event recv, but secondary info not for us\n");
goto lag_out;
}

Expand Down Expand Up @@ -164,8 +164,8 @@ ice_lag_link(struct ice_lag *lag, struct netdev_notifier_changeupper_info *info)
lag->bonded = true;
lag->role = ICE_LAG_UNSET;

/* if this is the first element in an LAG mark as master */
lag->master = !!(peers == 1);
/* if this is the first element in an LAG mark as primary */
lag->primary = !!(peers == 1);
}

/**
Expand Down Expand Up @@ -264,7 +264,7 @@ static void ice_lag_changeupper_event(struct ice_lag *lag, void *ptr)
netdev_dbg(netdev, "bonding %s\n", info->linking ? "LINK" : "UNLINK");

if (!netif_is_lag_master(info->upper_dev)) {
netdev_dbg(netdev, "changeupper rcvd, but not master. bail\n");
netdev_dbg(netdev, "changeupper rcvd, but not primary. bail\n");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/intel/ice/ice_lag.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct ice_lag {
struct net_device *upper_netdev; /* upper bonding netdev */
struct notifier_block notif_block;
u8 bonded:1; /* currently bonded */
u8 master:1; /* this is a master */
u8 primary:1; /* this is primary */
u8 handler:1; /* did we register a rx_netdev_handler */
/* each thing blocking bonding will increment this value by one.
* If this value is zero, then bonding is allowed.
Expand Down
22 changes: 22 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,22 @@ void ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena)
kfree(lut);
}

/**
* ice_vsi_cfg_crc_strip - Configure CRC stripping for a VSI
* @vsi: VSI to be configured
* @disable: set to true to have FCS / CRC in the frame data
*/
void ice_vsi_cfg_crc_strip(struct ice_vsi *vsi, bool disable)
{
int i;

ice_for_each_rxq(vsi, i)
if (disable)
vsi->rx_rings[i]->flags |= ICE_RX_FLAGS_CRC_STRIP_DIS;
else
vsi->rx_rings[i]->flags &= ~ICE_RX_FLAGS_CRC_STRIP_DIS;
}

/**
* ice_vsi_cfg_rss_lut_key - Configure RSS params for a VSI
* @vsi: VSI to be configured
Expand Down Expand Up @@ -3277,6 +3293,12 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)
*/
if (test_bit(ICE_FLAG_RSS_ENA, pf->flags))
ice_vsi_cfg_rss_lut_key(vsi);

/* disable or enable CRC stripping */
if (vsi->netdev)
ice_vsi_cfg_crc_strip(vsi, !!(vsi->netdev->features &
NETIF_F_RXFCS));

break;
case ICE_VSI_VF:
ret = ice_vsi_alloc_q_vectors(vsi);
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ void ice_vsi_free_tx_rings(struct ice_vsi *vsi);

void ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena);

void ice_vsi_cfg_crc_strip(struct ice_vsi *vsi, bool disable);

void ice_update_tx_ring_stats(struct ice_tx_ring *ring, u64 pkts, u64 bytes);

void ice_update_rx_ring_stats(struct ice_rx_ring *ring, u64 pkts, u64 bytes);
Expand Down
67 changes: 65 additions & 2 deletions drivers/net/ethernet/intel/ice/ice_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3376,6 +3376,11 @@ static void ice_set_netdev_features(struct net_device *netdev)
if (is_dvm_ena)
netdev->hw_features |= NETIF_F_HW_VLAN_STAG_RX |
NETIF_F_HW_VLAN_STAG_TX;

/* Leave CRC / FCS stripping enabled by default, but allow the value to
* be changed at runtime
*/
netdev->hw_features |= NETIF_F_RXFCS;
}

/**
Expand Down Expand Up @@ -4667,8 +4672,6 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
ice_set_safe_mode_caps(hw);
}

hw->ucast_shared = true;

err = ice_init_pf(pf);
if (err) {
dev_err(dev, "ice_init_pf failed: %d\n", err);
Expand Down Expand Up @@ -5727,6 +5730,9 @@ ice_fdb_del(struct ndmsg *ndm, __always_unused struct nlattr *tb[],
NETIF_F_HW_VLAN_STAG_RX | \
NETIF_F_HW_VLAN_STAG_TX)

#define NETIF_VLAN_STRIPPING_FEATURES (NETIF_F_HW_VLAN_CTAG_RX | \
NETIF_F_HW_VLAN_STAG_RX)

#define NETIF_VLAN_FILTERING_FEATURES (NETIF_F_HW_VLAN_CTAG_FILTER | \
NETIF_F_HW_VLAN_STAG_FILTER)

Expand Down Expand Up @@ -5813,6 +5819,14 @@ ice_fix_features(struct net_device *netdev, netdev_features_t features)
NETIF_F_HW_VLAN_STAG_TX);
}

if (!(netdev->features & NETIF_F_RXFCS) &&
(features & NETIF_F_RXFCS) &&
(features & NETIF_VLAN_STRIPPING_FEATURES) &&
!ice_vsi_has_non_zero_vlans(np->vsi)) {
netdev_warn(netdev, "Disabling VLAN stripping as FCS/CRC stripping is also disabled and there is no VLAN configured\n");
features &= ~NETIF_VLAN_STRIPPING_FEATURES;
}

return features;
}

Expand Down Expand Up @@ -5906,6 +5920,13 @@ ice_set_vlan_features(struct net_device *netdev, netdev_features_t features)
current_vlan_features = netdev->features & NETIF_VLAN_OFFLOAD_FEATURES;
requested_vlan_features = features & NETIF_VLAN_OFFLOAD_FEATURES;
if (current_vlan_features ^ requested_vlan_features) {
if ((features & NETIF_F_RXFCS) &&
(features & NETIF_VLAN_STRIPPING_FEATURES)) {
dev_err(ice_pf_to_dev(vsi->back),
"To enable VLAN stripping, you must first enable FCS/CRC stripping\n");
return -EIO;
}

err = ice_set_vlan_offload_features(vsi, features);
if (err)
return err;
Expand Down Expand Up @@ -5987,6 +6008,23 @@ ice_set_features(struct net_device *netdev, netdev_features_t features)
if (ret)
return ret;

/* Turn on receive of FCS aka CRC, and after setting this
* flag the packet data will have the 4 byte CRC appended
*/
if (changed & NETIF_F_RXFCS) {
if ((features & NETIF_F_RXFCS) &&
(features & NETIF_VLAN_STRIPPING_FEATURES)) {
dev_err(ice_pf_to_dev(vsi->back),
"To disable FCS/CRC stripping, you must first disable VLAN stripping\n");
return -EIO;
}

ice_vsi_cfg_crc_strip(vsi, !!(features & NETIF_F_RXFCS));
ret = ice_down_up(vsi);
if (ret)
return ret;
}

if (changed & NETIF_F_NTUPLE) {
bool ena = !!(features & NETIF_F_NTUPLE);

Expand Down Expand Up @@ -6690,6 +6728,31 @@ int ice_down(struct ice_vsi *vsi)
return 0;
}

/**
* ice_down_up - shutdown the VSI connection and bring it up
* @vsi: the VSI to be reconnected
*/
int ice_down_up(struct ice_vsi *vsi)
{
int ret;

/* if DOWN already set, nothing to do */
if (test_and_set_bit(ICE_VSI_DOWN, vsi->state))
return 0;

ret = ice_down(vsi);
if (ret)
return ret;

ret = ice_up(vsi);
if (ret) {
netdev_err(vsi->netdev, "reallocating resources failed during netdev features change, may need to reload driver\n");
return ret;
}

return 0;
}

/**
* ice_vsi_setup_tx_rings - Allocate VSI Tx queue resources
* @vsi: VSI having resources allocated
Expand Down
Loading

0 comments on commit 0134fe8

Please sign in to comment.