[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20181022.195552.1906806895915259090.davem@davemloft.net>
Date: Mon, 22 Oct 2018 19:55:52 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: chunkeey@...il.com
Cc: netdev@...r.kernel.org, f.fainelli@...il.com
Subject: Re: [PATCH v2 2/4] net: emac: implement TCP segmentation offload
(TSO)
From: Christian Lamparter <chunkeey@...il.com>
Date: Mon, 22 Oct 2018 13:04:12 +0200
> @@ -1452,8 +1509,49 @@ static inline u16 emac_tx_vlan(struct emac_instance *dev, struct sk_buff *skb)
> return 0;
> }
>
> +static netdev_tx_t
> +emac_start_xmit_sg(struct sk_buff *skb, struct net_device *ndev);
> +
> +static netdev_tx_t
> +emac_sw_tso(struct sk_buff *skb, struct net_device *ndev)
> +{
> + struct emac_instance *dev = netdev_priv(ndev);
> + struct sk_buff *segs, *curr;
> + unsigned int i, frag_slots;
> +
> + /* make sure to not overflow the tx ring */
> + frag_slots = dev->tx_cnt;
> + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
> + struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
> +
> + frag_slots += mal_tx_chunks(skb_frag_size(frag));
> +
> + if (frag_slots >= NUM_TX_BUFF)
> + return NETDEV_TX_BUSY;
> + };
> +
> + segs = skb_gso_segment(skb, ndev->features &
> + ~(NETIF_F_TSO | NETIF_F_TSO6));
This NETDEV_TX_BUSY isn't going to work.
Your TX queue is awake. So there won't be any guaranteed event to "wake up"
the queue and try sending this SKB again.
Please take a look at how the tg3.c driver handles this situation. You have
to first stop the queue, do you overflow test, and then you can return
NETDEV_TX_BUSY if necessary.
Powered by blists - more mailing lists