All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH S17 09/17] ice: Add ability to update rx-usecs-high
Date: Thu, 28 Feb 2019 15:25:55 -0800	[thread overview]
Message-ID: <20190228232603.32156-10-anirudh.venkataramanan@intel.com> (raw)
In-Reply-To: <20190228232603.32156-1-anirudh.venkataramanan@intel.com>

From: Brett Creeley <brett.creeley@intel.com>

Currently the driver allows rx-usecs-high values to be set,
but when querying the device for rx-usecs-high the value
does not stick. This is because it was not yet implemented.
Add code to allow the user to change rx-usecs-high and
use this to set the q_vector's intrl value.

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_ethtool.c | 31 +++++++++++++++++++++++++++-
 drivers/net/ethernet/intel/ice/ice_lib.c     |  2 +-
 drivers/net/ethernet/intel/ice/ice_lib.h     |  1 +
 drivers/net/ethernet/intel/ice/ice_txrx.h    |  1 +
 4 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 64a4c4456ba0..f995ed599cd9 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -2228,12 +2228,18 @@ static int
 ice_get_rc_coalesce(struct ethtool_coalesce *ec, enum ice_container_type c_type,
 		    struct ice_ring_container *rc)
 {
-	struct ice_pf *pf = rc->ring->vsi->back;
+	struct ice_pf *pf;
+
+	if (!rc->ring)
+		return -EINVAL;
+
+	pf = rc->ring->vsi->back;
 
 	switch (c_type) {
 	case ICE_RX_CONTAINER:
 		ec->use_adaptive_rx_coalesce = ITR_IS_DYNAMIC(rc->itr_setting);
 		ec->rx_coalesce_usecs = rc->itr_setting & ~ICE_ITR_DYNAMIC;
+		ec->rx_coalesce_usecs_high = rc->ring->q_vector->intrl;
 		break;
 	case ICE_TX_CONTAINER:
 		ec->use_adaptive_tx_coalesce = ITR_IS_DYNAMIC(rc->itr_setting);
@@ -2342,6 +2348,23 @@ ice_set_rc_coalesce(enum ice_container_type c_type, struct ethtool_coalesce *ec,
 
 	switch (c_type) {
 	case ICE_RX_CONTAINER:
+		if (ec->rx_coalesce_usecs_high > ICE_MAX_INTRL ||
+		    (ec->rx_coalesce_usecs_high &&
+		     ec->rx_coalesce_usecs_high < pf->hw.intrl_gran)) {
+			netdev_info(vsi->netdev,
+				    "Invalid value, rx-usecs-high valid values are 0 (disabled), %d-%d\n",
+				    pf->hw.intrl_gran, ICE_MAX_INTRL);
+			return -EINVAL;
+		}
+
+		if (ec->rx_coalesce_usecs_high != rc->ring->q_vector->intrl) {
+			rc->ring->q_vector->intrl = ec->rx_coalesce_usecs_high;
+			wr32(&pf->hw, GLINT_RATE(vsi->hw_base_vector +
+						 rc->ring->q_vector->v_idx),
+			     ice_intrl_usec_to_reg(ec->rx_coalesce_usecs_high,
+						   pf->hw.intrl_gran));
+		}
+
 		if (ec->rx_coalesce_usecs != itr_setting &&
 		    ec->use_adaptive_rx_coalesce) {
 			netdev_info(vsi->netdev,
@@ -2364,6 +2387,12 @@ ice_set_rc_coalesce(enum ice_container_type c_type, struct ethtool_coalesce *ec,
 		}
 		break;
 	case ICE_TX_CONTAINER:
+		if (ec->tx_coalesce_usecs_high) {
+			netdev_info(vsi->netdev,
+				    "setting tx-usecs-high is not supported\n");
+			return -EINVAL;
+		}
+
 		if (ec->tx_coalesce_usecs != itr_setting &&
 		    ec->use_adaptive_tx_coalesce) {
 			netdev_info(vsi->netdev,
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 982a3a9e9b8d..4c6ecc25aaa0 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -1764,7 +1764,7 @@ int ice_vsi_cfg_lan_txqs(struct ice_vsi *vsi)
  * This function converts a decimal interrupt rate limit in usecs to the format
  * expected by firmware.
  */
-static u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran)
+u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran)
 {
 	u32 val = intrl / gran;
 
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h
index 714ace077796..a91d3553cc89 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.h
+++ b/drivers/net/ethernet/intel/ice/ice_lib.h
@@ -80,4 +80,5 @@ void ice_vsi_free_tx_rings(struct ice_vsi *vsi);
 
 int ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena);
 
+u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran);
 #endif /* !_ICE_LIB_H_ */
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.h b/drivers/net/ethernet/intel/ice/ice_txrx.h
index c75d9fd12a68..66e05032ee56 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx.h
+++ b/drivers/net/ethernet/intel/ice/ice_txrx.h
@@ -142,6 +142,7 @@ enum ice_rx_dtype {
 #define ICE_ITR_ADAPTIVE_BULK		0x0000
 
 #define ICE_DFLT_INTRL	0
+#define ICE_MAX_INTRL	236
 
 /* Legacy or Advanced Mode Queue */
 #define ICE_TX_ADVANCED	0
-- 
2.14.5


  parent reply	other threads:[~2019-02-28 23:25 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-28 23:25 [Intel-wired-lan] [PATCH S17 00/17] Implementation updates for ice Anirudh Venkataramanan
2019-02-28 23:25 ` [Intel-wired-lan] [PATCH S17 01/17] ice: Calculate ITR increment based on direct calculation Anirudh Venkataramanan
2019-03-08  0:26   ` Bowers, AndrewX
2019-02-28 23:25 ` [Intel-wired-lan] [PATCH S17 02/17] ice: Create framework for VSI queue context Anirudh Venkataramanan
2019-03-08  0:26   ` Bowers, AndrewX
2019-02-28 23:25 ` [Intel-wired-lan] [PATCH S17 03/17] ice: Return configuration error without queue to disable Anirudh Venkataramanan
2019-03-08  0:27   ` Bowers, AndrewX
2019-02-28 23:25 ` [Intel-wired-lan] [PATCH S17 04/17] ice: Resolve static analysis reported issue Anirudh Venkataramanan
2019-03-08  0:27   ` Bowers, AndrewX
2019-02-28 23:25 ` [Intel-wired-lan] [PATCH S17 05/17] ice: Reduce scope of variable in ice_vsi_cfg_rxqs Anirudh Venkataramanan
2019-03-08  0:28   ` Bowers, AndrewX
2019-02-28 23:25 ` [Intel-wired-lan] [PATCH S17 06/17] ice: Validate ring existence and its q_vector per VSI Anirudh Venkataramanan
2019-03-08  0:28   ` Bowers, AndrewX
2019-02-28 23:25 ` [Intel-wired-lan] [PATCH S17 07/17] ice: Use ice_for_each_q_vector macro where possible Anirudh Venkataramanan
2019-03-08  0:29   ` Bowers, AndrewX
2019-02-28 23:25 ` [Intel-wired-lan] [PATCH S17 08/17] ice: Add 52 byte RSS hash key support Anirudh Venkataramanan
2019-03-08  0:29   ` Bowers, AndrewX
2019-02-28 23:25 ` Anirudh Venkataramanan [this message]
2019-03-08  0:33   ` [Intel-wired-lan] [PATCH S17 09/17] ice: Add ability to update rx-usecs-high Bowers, AndrewX
2019-02-28 23:25 ` [Intel-wired-lan] [PATCH S17 10/17] ice: Remove unnecessary wait when disabling/enabling Rx queues Anirudh Venkataramanan
2019-03-08  0:34   ` Bowers, AndrewX
2019-02-28 23:25 ` [Intel-wired-lan] [PATCH S17 11/17] ice: Fix issue when adding more than allowed VLANs Anirudh Venkataramanan
2019-03-08  0:34   ` Bowers, AndrewX
2019-02-28 23:25 ` [Intel-wired-lan] [PATCH S17 12/17] ice: Remove runtime change of PFINT_OICR_ENA register Anirudh Venkataramanan
2019-03-08  0:35   ` Bowers, AndrewX
2019-02-28 23:25 ` [Intel-wired-lan] [PATCH S17 13/17] ice: Add reg_idx variable in ice_q_vector structure Anirudh Venkataramanan
2019-03-08  0:35   ` Bowers, AndrewX
2019-02-28 23:26 ` [Intel-wired-lan] [PATCH S17 14/17] ice: Add missing PHY type to link settings Anirudh Venkataramanan
2019-03-08  0:36   ` Bowers, AndrewX
2019-02-28 23:26 ` [Intel-wired-lan] [PATCH S17 15/17] ice: Refactor link event flow Anirudh Venkataramanan
2019-03-08  0:36   ` Bowers, AndrewX
2019-02-28 23:26 ` [Intel-wired-lan] [PATCH S17 16/17] ice: Use dev_err when ice_cfg_vsi_lan fails Anirudh Venkataramanan
2019-03-08  0:36   ` Bowers, AndrewX
2019-02-28 23:26 ` [Intel-wired-lan] [PATCH S17 17/17] ice: Use pf instead of vsi-back Anirudh Venkataramanan
2019-03-08  0:37   ` Bowers, AndrewX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190228232603.32156-10-anirudh.venkataramanan@intel.com \
    --to=anirudh.venkataramanan@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.