From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: Re: [PATCH net 1/1] driver: veth: Return the actual value instead return NETDEV_TX_OK always Date: Wed, 2 Nov 2016 17:58:39 -0700 Message-ID: <704bff33-d376-1825-07d1-b2e11775e9d4@gmail.com> References: <1478080756-16789-1-git-send-email-fgao@ikuai8.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: David Miller , Cong Wang , Vijay Pandurangan , Evan Jones , pabeni@redhat.com, Linux Kernel Network Developers To: Gao Feng , Cong Wang Return-path: Received: from mail-pf0-f194.google.com ([209.85.192.194]:34856 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751592AbcKCA6m (ORCPT ); Wed, 2 Nov 2016 20:58:42 -0400 Received: by mail-pf0-f194.google.com with SMTP id i88so3107959pfk.2 for ; Wed, 02 Nov 2016 17:58:42 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On 11/02/2016 05:52 PM, Gao Feng wrote: > Hi Cong, > > On Thu, Nov 3, 2016 at 4:22 AM, Cong Wang wrote: >> On Wed, Nov 2, 2016 at 2:59 AM, wrote: >>> From: Gao Feng >>> >>> Current veth_xmit always returns NETDEV_TX_OK whatever if it is really >>> sent successfully. Now return the actual value instead of NETDEV_TX_OK >>> always. >>> >>> Signed-off-by: Gao Feng >>> --- >>> drivers/net/veth.c | 7 +++++-- >>> 1 file changed, 5 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/net/veth.c b/drivers/net/veth.c >>> index fbc853e..769a3bd 100644 >>> --- a/drivers/net/veth.c >>> +++ b/drivers/net/veth.c >>> @@ -111,15 +111,18 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) >>> struct veth_priv *priv = netdev_priv(dev); >>> struct net_device *rcv; >>> int length = skb->len; >>> + int ret = NETDEV_TX_OK; >>> >>> rcu_read_lock(); >>> rcv = rcu_dereference(priv->peer); >>> if (unlikely(!rcv)) { >>> kfree_skb(skb); >>> + ret = NET_RX_DROP; >> >> >> Returning NET_RX_DROP doesn't look correct in a xmit function. > > Yes. But I don't find good macro. > NETDEV_TX_BUSY or NET_RX_DROP, which is better ? There is no much choice you need to return a correct value from the netdev_tx_t enum, which NET_RX_DROP is not part of, so that probably means using NETDEV_TX_OK here, the packet has been freed, and there is no flow control problem mandating the return of NETDEV_TX_BUSY it seems... -- Florian