Blame SOURCES/0007-Revert-netdrv-ice-let-core-reject-the-unsupported-co.patch

2eb987
From 69853c6ef201328562772b4f6adbed11c0cf2168 Mon Sep 17 00:00:00 2001
2eb987
From: Eugene Syromiatnikov <esyr@redhat.com>
2eb987
Date: Thu, 27 Aug 2020 19:20:02 +0200
2eb987
Subject: [PATCH 7/7] Revert "[netdrv] ice: let core reject the unsupported
2eb987
 coalescing parameters"
2eb987
2eb987
This reverts commit 090b055534b6b2c2a480d8dca667bbd1de6481e9.
2eb987
---
2eb987
 drivers/net/ethernet/intel/ice/ice_ethtool.c | 59 ++++++++++++++++++++++++++--
2eb987
 1 file changed, 56 insertions(+), 3 deletions(-)
2eb987
2eb987
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
2eb987
index 2b0aa0afcd1e..0b2ceaf1a53c 100644
2eb987
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
2eb987
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
2eb987
@@ -3493,6 +3493,12 @@ ice_set_rc_coalesce(enum ice_container_type c_type, struct ethtool_coalesce *ec,
2eb987
 
2eb987
 		break;
2eb987
 	case ICE_TX_CONTAINER:
2eb987
+		if (ec->tx_coalesce_usecs_high) {
2eb987
+			netdev_info(vsi->netdev, "setting %s-usecs-high is not supported\n",
2eb987
+				    c_type_str);
2eb987
+			return -EINVAL;
2eb987
+		}
2eb987
+
2eb987
 		use_adaptive_coalesce = ec->use_adaptive_tx_coalesce;
2eb987
 		coalesce_usecs = ec->tx_coalesce_usecs;
2eb987
 
2eb987
@@ -3569,6 +3575,53 @@ ice_set_q_coalesce(struct ice_vsi *vsi, struct ethtool_coalesce *ec, int q_num)
2eb987
 }
2eb987
 
2eb987
 /**
2eb987
+ * ice_is_coalesce_param_invalid - check for unsupported coalesce parameters
2eb987
+ * @netdev: pointer to the netdev associated with this query
2eb987
+ * @ec: ethtool structure to fill with driver's coalesce settings
2eb987
+ *
2eb987
+ * Print netdev info if driver doesn't support one of the parameters
2eb987
+ * and return error. When any parameters will be implemented, remove only
2eb987
+ * this parameter from param array.
2eb987
+ */
2eb987
+static int
2eb987
+ice_is_coalesce_param_invalid(struct net_device *netdev,
2eb987
+			      struct ethtool_coalesce *ec)
2eb987
+{
2eb987
+	struct ice_ethtool_not_used {
2eb987
+		u32 value;
2eb987
+		const char *name;
2eb987
+	} param[] = {
2eb987
+		{ec->stats_block_coalesce_usecs, "stats-block-usecs"},
2eb987
+		{ec->rate_sample_interval, "sample-interval"},
2eb987
+		{ec->pkt_rate_low, "pkt-rate-low"},
2eb987
+		{ec->pkt_rate_high, "pkt-rate-high"},
2eb987
+		{ec->rx_max_coalesced_frames, "rx-frames"},
2eb987
+		{ec->rx_coalesce_usecs_irq, "rx-usecs-irq"},
2eb987
+		{ec->rx_max_coalesced_frames_irq, "rx-frames-irq"},
2eb987
+		{ec->tx_max_coalesced_frames, "tx-frames"},
2eb987
+		{ec->tx_coalesce_usecs_irq, "tx-usecs-irq"},
2eb987
+		{ec->tx_max_coalesced_frames_irq, "tx-frames-irq"},
2eb987
+		{ec->rx_coalesce_usecs_low, "rx-usecs-low"},
2eb987
+		{ec->rx_max_coalesced_frames_low, "rx-frames-low"},
2eb987
+		{ec->tx_coalesce_usecs_low, "tx-usecs-low"},
2eb987
+		{ec->tx_max_coalesced_frames_low, "tx-frames-low"},
2eb987
+		{ec->rx_max_coalesced_frames_high, "rx-frames-high"},
2eb987
+		{ec->tx_max_coalesced_frames_high, "tx-frames-high"}
2eb987
+	};
2eb987
+	int i;
2eb987
+
2eb987
+	for (i = 0; i < ARRAY_SIZE(param); i++) {
2eb987
+		if (param[i].value) {
2eb987
+			netdev_info(netdev, "Setting %s not supported\n",
2eb987
+				    param[i].name);
2eb987
+			return -EINVAL;
2eb987
+		}
2eb987
+	}
2eb987
+
2eb987
+	return 0;
2eb987
+}
2eb987
+
2eb987
+/**
2eb987
  * ice_print_if_odd_usecs - print message if user tries to set odd [tx|rx]-usecs
2eb987
  * @netdev: netdev used for print
2eb987
  * @itr_setting: previous user setting
2eb987
@@ -3608,6 +3661,9 @@ __ice_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec,
2eb987
 	struct ice_netdev_priv *np = netdev_priv(netdev);
2eb987
 	struct ice_vsi *vsi = np->vsi;
2eb987
 
2eb987
+	if (ice_is_coalesce_param_invalid(netdev, ec))
2eb987
+		return -EINVAL;
2eb987
+
2eb987
 	if (q_num < 0) {
2eb987
 		struct ice_q_vector *q_vector = vsi->q_vectors[0];
2eb987
 		int v_idx;
2eb987
@@ -3802,9 +3858,6 @@ ice_get_module_eeprom(struct net_device *netdev,
2eb987
 }
2eb987
 
2eb987
 static const struct ethtool_ops ice_ethtool_ops = {
2eb987
-	.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
2eb987
-				     ETHTOOL_COALESCE_USE_ADAPTIVE |
2eb987
-				     ETHTOOL_COALESCE_RX_USECS_HIGH,
2eb987
 	.get_link_ksettings	= ice_get_link_ksettings,
2eb987
 	.set_link_ksettings	= ice_set_link_ksettings,
2eb987
 	.get_drvinfo		= ice_get_drvinfo,
2eb987
-- 
2eb987
2.13.6
2eb987