From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net-next] enic: add sw timestamp support Date: Sun, 03 Dec 2017 10:16:23 -0500 (EST) Message-ID: <20171203.101623.172697821779462247.davem@davemloft.net> References: <20171201182140.4594-1-gvaradar@cisco.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, benve@cisco.com To: gvaradar@cisco.com Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:36282 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751989AbdLCPQZ (ORCPT ); Sun, 3 Dec 2017 10:16:25 -0500 In-Reply-To: <20171201182140.4594-1-gvaradar@cisco.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Govindarajulu Varadarajan Date: Fri, 1 Dec 2017 10:21:40 -0800 > Add ethtool ops to advertise sw timestamping. > Call skb_tx_timestamp() just before ringing the wq doorbell. > > Signed-off-by: Govindarajulu Varadarajan ... > diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c > index e130fb757e7b..d98676e43e03 100644 > --- a/drivers/net/ethernet/cisco/enic/enic_main.c > +++ b/drivers/net/ethernet/cisco/enic/enic_main.c > @@ -856,6 +856,7 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb, > > if (vnic_wq_desc_avail(wq) < MAX_SKB_FRAGS + ENIC_DESC_MAX_SPLITS) > netif_tx_stop_queue(txq); > + skb_tx_timestamp(skb); > if (!skb->xmit_more || netif_xmit_stopped(txq)) > vnic_wq_doorbell(wq); > Applied, but if you even make this queue processing code lockless you will have a use-after-free here as you're placing the SKB into the TX queue before accessing the 'skb' via skb_tx_timestamp() and it thus could be freed by TX completion beforehand.