From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [patch net-next 4/4] mlxsw: Introduce Mellanox SwitchX-2 ASIC support Date: Sun, 26 Jul 2015 19:14:11 +0200 Message-ID: <20150726171410.GB2207@nanopsycho.fritz.box> References: <1437666216-3149-1-git-send-email-jiri@resnulli.us> <1437666216-3149-5-git-send-email-jiri@resnulli.us> <20150726071010.GA2150@nanopsycho.fritz.box> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Netdev , "David S. Miller" , idosch@mellanox.com, eladr@mellanox.com, "ogerlitz@mellanox.com" , Roopa Prabhu , Florian Fainelli , Thomas Graf , Alexei Starovoitov , Jamal Hadi Salim , Daniel Borkmann , john fastabend , "simon.horman@netronome.com" , John Linville , Andy Gospodarek , Shrijeet Mukherjee , "nhorman@tuxdriver.com" , Jiri Pirko To: Scott Feldman Return-path: Received: from mail-wi0-f173.google.com ([209.85.212.173]:34373 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755181AbbGZROP (ORCPT ); Sun, 26 Jul 2015 13:14:15 -0400 Received: by wibud3 with SMTP id ud3so113842391wib.1 for ; Sun, 26 Jul 2015 10:14:13 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20150726071010.GA2150@nanopsycho.fritz.box> Sender: netdev-owner@vger.kernel.org List-ID: > > >> >>> + struct sk_buff *skb_new; >>> + >>> + skb_new = skb_realloc_headroom(skb, MLXSW_TXHDR_LEN); >>> + dev_kfree_skb_any(skb); >>> + if (!skb_new) { >>> + this_cpu_inc(mlxsw_sx_port->pcpu_stats->tx_dropped); >>> + return NETDEV_TX_OK; >>> + } >>> + skb = skb_new; >>> + } >>> + mlxsw_sx_txhdr_construct(skb, &tx_info); >>> + err = mlxsw_core_skb_transmit(mlxsw_sx, skb, &tx_info); >>> + if (err == -EAGAIN) >>> + return NETDEV_TX_BUSY; >> >>I think there is a problem here when returning NETDEV_TX_BUSY when >>original skb might have been freed above in the headroom check. (ref >>Documentation/networking/driver.txt). > >I have to check this out a bit more. Thanks for pointing that out. You are right. In case queue is busy we obviously cannot free the original skb. Will fix that in V2. Thanks!