Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7e1962f authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net: stmmac: Support eth type based TX intr moderation"

parents b968b182 1c3233ed
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1717,6 +1717,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
	plat_dat->bsp_priv = ethqos;
	plat_dat->fix_mac_speed = ethqos_fix_mac_speed;
	plat_dat->tx_select_queue = dwmac_qcom_select_queue;
	plat_dat->get_plat_tx_coal_frames =  dwmac_qcom_get_plat_tx_coal_frames;
	plat_dat->has_gmac4 = 1;
	plat_dat->pmt = 1;
	plat_dat->tso_en = of_property_read_bool(np, "snps,tso");
+1 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ struct stmmac_priv {
	u32 tx_count_frames;
	u32 tx_coal_frames;
	u32 tx_coal_timer;
	bool tx_coal_timer_disable;

	int tx_coalesce;
	int hwts_tx_en;
+54 −21
Original line number Diff line number Diff line
@@ -2015,7 +2015,9 @@ if (priv->dev->stats.tx_packets == 1)
	}
	tx_q->dirty_tx = entry;

	netdev_tx_completed_queue(netdev_get_tx_queue(priv->dev, queue),
	if (!priv->tx_coal_timer_disable)
		netdev_tx_completed_queue(
			netdev_get_tx_queue(priv->dev, queue),
			pkts_compl, bytes_compl);

	if (unlikely(netif_tx_queue_stopped(netdev_get_tx_queue(priv->dev,
@@ -2752,6 +2754,7 @@ static int stmmac_open(struct net_device *dev)
		goto init_error;
	}

	if (!priv->tx_coal_timer_disable)
		stmmac_init_tx_coalesce(priv);

	if (dev->phydev)
@@ -2806,7 +2809,7 @@ static int stmmac_open(struct net_device *dev)
irq_error:
	if (dev->phydev)
		phy_stop(dev->phydev);

	if (!priv->tx_coal_timer_disable)
		del_timer_sync(&priv->txtimer);
	stmmac_hw_teardown(dev);
init_error:
@@ -2841,6 +2844,7 @@ static int stmmac_release(struct net_device *dev)

	stmmac_disable_all_queues(priv);

	if (!priv->tx_coal_timer_disable)
		del_timer_sync(&priv->txtimer);

	/* Free the IRQ lines */
@@ -3052,14 +3056,22 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)

	/* Manage tx mitigation */
	priv->tx_count_frames += nfrags + 1;

	if (likely(priv->tx_coal_timer_disable)) {
		priv->tx_count_frames = 0;
		priv->hw->desc->set_tx_ic(desc);
		priv->xstats.tx_set_ic_bit++;
	} else {
		if (likely(priv->tx_coal_frames > priv->tx_count_frames)) {
		mod_timer(&priv->txtimer,
			mod_timer(
				&priv->txtimer,
				STMMAC_COAL_TIMER(priv->tx_coal_timer));
		} else {
			priv->tx_count_frames = 0;
			priv->hw->desc->set_tx_ic(desc);
			priv->xstats.tx_set_ic_bit++;
		}
	}

	skb_tx_timestamp(skb);

@@ -3106,6 +3118,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
		print_pkt(skb->data, skb_headlen(skb));
	}

	if (!priv->tx_coal_timer_disable)
		netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len);

	tx_q->tx_tail_addr = tx_q->dma_tx_phy + (tx_q->cur_tx * sizeof(*desc));
@@ -3141,7 +3154,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
	struct dma_desc *desc, *first;
	struct stmmac_tx_queue *tx_q;
	unsigned int enh_desc;
	unsigned int des;
	unsigned int des, int_mod;

	tx_q = &priv->tx_queue[queue];

@@ -3283,14 +3296,27 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
	 * This approach takes care about the fragments: desc is the first
	 * element in case of no SG.
	 */
	if (likely(priv->tx_coal_timer_disable)) {
		if (priv->plat->get_plat_tx_coal_frames) {
			int_mod = priv->plat->get_plat_tx_coal_frames(skb);

			if (!(tx_q->cur_tx % int_mod)) {
				priv->tx_count_frames = 0;
				priv->hw->desc->set_tx_ic(desc);
				priv->xstats.tx_set_ic_bit++;
			}
		}
	} else {
		if (likely(priv->tx_coal_frames > priv->tx_count_frames)) {
		mod_timer(&priv->txtimer,
			mod_timer(
				&priv->txtimer,
				STMMAC_COAL_TIMER(priv->tx_coal_timer));
		} else {
			priv->tx_count_frames = 0;
			priv->hw->desc->set_tx_ic(desc);
			priv->xstats.tx_set_ic_bit++;
		}
	}

	if (!priv->hwts_tx_en)
		skb_tx_timestamp(skb);
@@ -3335,8 +3361,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
		dma_wmb();
	}

	if (!priv->tx_coal_timer_disable)
		netdev_tx_sent_queue(netdev_get_tx_queue(dev, queue), skb->len);

	if (priv->synopsys_id < DWMAC_CORE_4_00)
		priv->hw->dma->enable_dma_transmission(priv->ioaddr);
	else {
@@ -4481,6 +4507,10 @@ int stmmac_dvr_probe(struct device *device,
		goto error_netdev_register;
	}

	/* Disable tx_coal_timer if plat provides callback */
	priv->tx_coal_timer_disable =
		plat_dat->get_plat_tx_coal_frames ? true : false;

#ifdef CONFIG_DEBUG_FS
	ret = stmmac_init_fs(ndev);
	if (ret < 0)
@@ -4670,7 +4700,10 @@ int stmmac_resume(struct device *dev)
	stmmac_clear_descriptors(priv);

	stmmac_hw_setup(ndev, false);

	if (!priv->tx_coal_timer_disable)
		stmmac_init_tx_coalesce(priv);

	stmmac_set_rx_mode(ndev);

	stmmac_enable_all_queues(priv);