From: Kan Liang <kan.li...@intel.com>

Handle ndo_get_per_queue_tx_usecs and ndo_set_per_queue_tx_usecs
options for i40e driver specifically.

Signed-off-by: Kan Liang <kan.li...@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 39 +++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c 
b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 4b7d874..d4310ae 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -8673,6 +8673,43 @@ static int i40e_ndo_bridge_getlink(struct sk_buff *skb, 
u32 pid, u32 seq,
                                       nlflags, 0, 0, filter_mask, NULL);
 }
 
+/**
+ * i40e_ndo_get_per_queue_tx_usecs - Get per queue coalesce parameter tx_usecs
+ * @dev: the netdev being configured
+ * @index: queue index
+ *
+ * Return tx_usecs for specific channel
+ **/
+u32 i40e_ndo_get_per_queue_tx_usecs(struct net_device *dev, int index)
+{
+       struct i40e_netdev_priv *np = netdev_priv(dev);
+       struct i40e_vsi *vsi = np->vsi;
+       struct i40e_pf *pf = vsi->back;
+       struct i40e_hw *hw = &pf->hw;
+       u32 val;
+
+       val = rd32(hw, I40E_PFINT_ITRN(1, index));
+
+       return (val * 2);
+}
+
+/**
+ * i40e_ndo_set_per_queue_tx_usecs - Set per queue coalesce parameter tx_usecs
+ * @dev: the netdev being configured
+ * @index: queue index
+ * @val: tx_usecs value
+ **/
+void i40e_ndo_set_per_queue_tx_usecs(struct net_device *dev, int index, u32 
val)
+{
+       struct i40e_netdev_priv *np = netdev_priv(dev);
+       struct i40e_vsi *vsi = np->vsi;
+       struct i40e_pf *pf = vsi->back;
+       struct i40e_hw *hw = &pf->hw;
+
+       wr32(hw, I40E_PFINT_ITRN(1, index), val / 2);
+       i40e_flush(hw);
+}
+
 #define I40E_MAX_TUNNEL_HDR_LEN 80
 /**
  * i40e_features_check - Validate encapsulated packet conforms to limits
@@ -8729,6 +8766,8 @@ static const struct net_device_ops i40e_netdev_ops = {
        .ndo_features_check     = i40e_features_check,
        .ndo_bridge_getlink     = i40e_ndo_bridge_getlink,
        .ndo_bridge_setlink     = i40e_ndo_bridge_setlink,
+       .ndo_get_per_queue_tx_usecs     = i40e_ndo_get_per_queue_tx_usecs,
+       .ndo_set_per_queue_tx_usecs     = i40e_ndo_set_per_queue_tx_usecs,
 };
 
 /**
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to