Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: chunkeey@gmail.com
Cc: netdev@vger.kernel.org, f.fainelli@gmail.com
Subject: Re: [PATCH v2 2/4] net: emac: implement TCP segmentation offload (TSO)
Date: Mon, 22 Oct 2018 19:55:52 -0700 (PDT)	[thread overview]
Message-ID: <20181022.195552.1906806895915259090.davem@davemloft.net> (raw)
In-Reply-To: <617f509eed6c844ffd2442b2c4b46b3fe6bc580a.1540206214.git.chunkeey@gmail.com>

From: Christian Lamparter <chunkeey@gmail.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.

      parent reply	other threads:[~2018-10-23 11:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-22 11:04 [PATCH v2 1/4] net: emac: implement 802.1Q VLAN TX tagging support Christian Lamparter
2018-10-22 11:04 ` [PATCH v2 2/4] net: emac: implement TCP segmentation offload (TSO) Christian Lamparter
2018-10-22 11:04   ` [PATCH v2 3/4] net: emac: remove IBM_EMAC_RX_SKB_HEADROOM Christian Lamparter
2018-10-22 11:04     ` [PATCH v2 4/4] net: emac: add deprecation notice to emac custom phy users Christian Lamparter
2018-10-23  2:55   ` David Miller [this message]

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=20181022.195552.1906806895915259090.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=chunkeey@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox