[LEDE-DEV] [PATCH] ag71xx: Add some unlikely calls + rearange some stuff in hard_start_xmit.

John Crispin john at phrozen.org
Tue Feb 13 22:52:47 PST 2018



On 13/02/18 23:53, Rosen Penev wrote:
> Based on Qualcomm driver. Improves iperf3 throughput by ~20mbps on transmit on Archer C7v4.

this is missing the description of what the patch does.

     John
>
> Signed-off-by: Rosen Penev <rosenp at gmail.com>
> ---
>   .../drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c      | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
> index 95682b7641..d32f220178 100644
> --- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
> +++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
> @@ -797,11 +797,14 @@ static netdev_tx_t ag71xx_hard_start_xmit(struct sk_buff *skb,
>   	if (ag71xx_has_ar8216(ag))
>   		ag71xx_add_ar8216_header(ag, skb);
>   
> -	if (skb->len <= 4) {
> +	dma_cache_sync (NULL, skb->data, skb->len, DMA_TO_DEVICE);
> +
> +	if (unlikely(skb->len <= 4)) {
>   		DBG("%s: packet len is too small\n", ag->dev->name);
>   		goto err_drop;
>   	}
>   
> +	netdev_sent_queue(dev, skb->len);
>   	dma_addr = dma_map_single(&dev->dev, skb->data, skb->len,
>   				  DMA_TO_DEVICE);
>   
> @@ -817,27 +820,24 @@ static netdev_tx_t ag71xx_hard_start_xmit(struct sk_buff *skb,
>   	ring->buf[i].len = skb->len;
>   	ring->buf[i].skb = skb;
>   
> -	netdev_sent_queue(dev, skb->len);
> -
>   	skb_tx_timestamp(skb);
>   
>   	desc->ctrl &= ~DESC_EMPTY;
>   	ring->curr += n;
>   
> -	/* flush descriptor */
> -	wmb();
> -
>   	ring_min = 2;
>   	if (ring->desc_split)
>   	    ring_min *= AG71XX_TX_RING_DS_PER_PKT;
>   
> -	if (ring->curr - ring->dirty >= ring_size - ring_min) {
> +	if (unlikely(ring->curr - ring->dirty >= ring_size - ring_min)) {
>   		DBG("%s: tx queue full\n", dev->name);
>   		netif_stop_queue(dev);
>   	}
>   
>   	DBG("%s: packet injected into TX queue\n", ag->dev->name);
>   
> +	/* flush descriptor */
> +	wmb();
>   	/* enable TX engine */
>   	ag71xx_wr(ag, AG71XX_REG_TX_CTRL, TX_CTRL_TXE);
>   




More information about the Lede-dev mailing list