Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Shahed Shaikh <shahed.shaikh@qlogic.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	Dept_NX_Linux_NIC_Driver@qlogic.com,
	Sritej Velaga <sritej.velaga@qlogic.com>
Subject: Re: [PATCH net-next 7/9] qlcnic: fix TSO race condition
Date: Sat, 13 Apr 2013 11:35:16 -0700	[thread overview]
Message-ID: <1365878116.4459.105.camel@edumazet-glaptop> (raw)
In-Reply-To: <1365874114-6759-8-git-send-email-shahed.shaikh@qlogic.com>

On Sat, 2013-04-13 at 13:28 -0400, Shahed Shaikh wrote:
> From: Sritej Velaga <sritej.velaga@qlogic.com>
> 
> When driver receives a packet with gso size > 0 and when TSO is disabled,
> it should be transmitted as a TSO packet to prevent Tx timeout and subsequent
> firmware reset.
> 
> Signed-off-by: Sritej Velaga <sritej.velaga@qlogic.com>
> Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
> ---
>  drivers/net/ethernet/qlogic/qlcnic/qlcnic.h        |    1 +
>  .../net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c    |    2 ++
>  drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c     |    8 ++++++--
>  3 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
> index 7551b18..53c414f 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
> @@ -485,6 +485,7 @@ struct qlcnic_adapter_stats {
>  	u64  tx_dma_map_error;
>  	u64  spurious_intr;
>  	u64  mac_filter_limit_overrun;
> +	u64  invalid_tso_pkt;
>  };
>  
>  /*
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
> index 7b56a50..48434ee 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
> @@ -53,6 +53,8 @@ static const struct qlcnic_stats qlcnic_gstrings_stats[] = {
>  				QLC_OFF(stats.mac_filter_limit_overrun)},
>  	{"spurious intr", QLC_SIZEOF(stats.spurious_intr),
>  	 QLC_OFF(stats.spurious_intr)},
> +	{"invalid_tso_pkt", QLC_SIZEOF(stats.invalid_tso_pkt),
> +			QLC_OFF(stats.invalid_tso_pkt)},
>  
>  };
>  
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> index a85ca63..cb19e30 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> @@ -362,8 +362,12 @@ set_flags:
>  		memcpy(&first_desc->eth_addr, skb->data, ETH_ALEN);
>  	}
>  	opcode = TX_ETHER_PKT;
> -	if ((adapter->netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) &&
> -	    skb_shinfo(skb)->gso_size > 0) {
> +
> +	if (skb_shinfo(skb)->gso_size > 0) {
> +		if (!(adapter->netdev->features &
> +		      (NETIF_F_TSO | NETIF_F_TSO6))) {
> +			adapter->stats.invalid_tso_pkt++;
> +		}
>  		hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
>  		first_desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
>  		first_desc->total_hdr_length = hdr_len;

This looks like not needed at all.

Take a look at all other network drivers.

Not a single one does the (netdev->features & (NETIF_F_TSO |
NETIF_F_TSO6)) check in their tx fast path.

This is done by the core networking stacks.

Just remove the check, and do not add an "invalid_tso_pkt", as there is
nothing invalid here.

If a driver advertised NETIF_F_TSO in its hw_features, then it _must_ be
prepared to send TSO packets, even if the admin plays with "ethtool -k
tso off".

RTNL is not taken in TX path, so there is always the possibility a
driver has to transmit a TSO packet right after the change.

  reply	other threads:[~2013-04-13 18:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-13 17:28 [PATCH net-next 0/9] qlcnic: Bug fixes and enhancements Shahed Shaikh
2013-04-13 17:28 ` [PATCH net-next 1/9] qlcnic: Implement GET_LED_STATUS command for 82xx adapter Shahed Shaikh
2013-04-14 10:55   ` Francois Romieu
2013-04-13 17:28 ` [PATCH net-next 2/9] qlcnic: Fix typo in logs Shahed Shaikh
2013-04-13 17:28 ` [PATCH net-next 3/9] qlcnic: Add identifying string for 83xx adapter Shahed Shaikh
2013-04-14 10:55   ` Francois Romieu
2013-04-13 17:28 ` [PATCH net-next 4/9] qlcnic: fix beaconing test for 82xx adapter Shahed Shaikh
2013-04-14 10:55   ` Francois Romieu
2013-04-13 17:28 ` [PATCH net-next 5/9] qlcnic: Enable Interrupt Coalescing for 83xx adapter Shahed Shaikh
2013-04-14 10:55   ` Francois Romieu
2013-04-13 17:28 ` [PATCH net-next 6/9] qlcnic: Fix recurring firmware dump collection Shahed Shaikh
2013-04-14 10:55   ` Francois Romieu
2013-04-13 17:28 ` [PATCH net-next 7/9] qlcnic: fix TSO race condition Shahed Shaikh
2013-04-13 18:35   ` Eric Dumazet [this message]
2013-04-14 17:55     ` Shahed Shaikh
2013-04-13 17:28 ` [PATCH net-next 8/9] qlcnic: Enhanced channel configuration logs Shahed Shaikh
2013-04-14 10:55   ` Francois Romieu
2013-04-13 17:28 ` [PATCH net-next 9/9] qlcnic: Bump up the version to 5.2.41 Shahed Shaikh

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=1365878116.4459.105.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=Dept_NX_Linux_NIC_Driver@qlogic.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=shahed.shaikh@qlogic.com \
    --cc=sritej.velaga@qlogic.com \
    /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