From patchwork Wed Dec 10 03:51:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ding Tianhong X-Patchwork-Id: 5466691 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9E5489F1D4 for ; Wed, 10 Dec 2014 03:56:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B31C02011D for ; Wed, 10 Dec 2014 03:56:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1FB920108 for ; Wed, 10 Dec 2014 03:56:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XyYKu-0002UW-0q; Wed, 10 Dec 2014 03:53:12 +0000 Received: from szxga01-in.huawei.com ([119.145.14.64]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XyYKo-0002O6-3G for linux-arm-kernel@lists.infradead.org; Wed, 10 Dec 2014 03:53:08 +0000 Received: from 172.24.2.119 (EHLO szxeml457-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CFW06166; Wed, 10 Dec 2014 11:52:05 +0800 (CST) Received: from [127.0.0.1] (10.177.22.246) by szxeml457-hub.china.huawei.com (10.82.67.200) with Microsoft SMTP Server id 14.3.158.1; Wed, 10 Dec 2014 11:51:53 +0800 Message-ID: <5487C357.9030507@huawei.com> Date: Wed, 10 Dec 2014 11:51:51 +0800 From: Ding Tianhong User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Arnd Bergmann , Alexander Graf Subject: Re: [PATCH v8 3/3] net: hisilicon: new hip04 ethernet driver References: <1397869980-21187-1-git-send-email-zhangfei.gao@linaro.org> <5483C977.2060308@huawei.com> <54842298.2010007@suse.de> <2619239.NTtdNaZCJM@wuerfel> In-Reply-To: <2619239.NTtdNaZCJM@wuerfel> X-Originating-IP: [10.177.22.246] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141209_195307_653420_3AFD8D4B X-CRM114-Status: GOOD ( 23.37 ) X-Spam-Score: -0.7 (/) Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, f.fainelli@gmail.com, linux@arm.linux.org.uk, eric.dumazet@gmail.com, sergei.shtylyov@cogentembedded.com, netdev@vger.kernel.org, xuwei5@hisilicon.com, David.Laight@aculab.com, Zhangfei Gao , davem@davemloft.net, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 2014/12/8 4:09, Arnd Bergmann wrote: > On Sunday 07 December 2014 10:49:12 Alexander Graf wrote: >> On 07.12.14 04:28, Ding Tianhong wrote: >>> On 2014/12/7 8:42, Alexander Graf wrote: >>>> On 19.04.14 03:13, Zhangfei Gao wrote: >>>>> Support Hisilicon hip04 ethernet driver, including 100M / 1000M controller. >>>>> The controller has no tx done interrupt, reclaim xmitted buffer in the poll. >>>>> >>>>> Signed-off-by: Zhangfei Gao >>>> >>>> Is this driver still supposed to go upstream? I presume this was the >>>> last submission and it's been quite some time ago >>>> >>> >>> yes, it is really a long time, but The hip04 did not support tx irq, >>> we couldn't get any better idea to fix this defect, do you have any suggestion? >> >> Well, if hardware doesn't have a TX irq I don't see there's anything we >> can do to fix that ;). > > I don't know if it's related to the ethernet on hip01, but I would assume > it is, and that platform is currently being submitted for inclusion, so > I'd definitely hope to see this driver get merged too eventually. > > IIRC, the last revision of the patch set had basically fixed the problem, > except for a race that would still allow the napi poll function to exit > with poll_complete() but a full queue of TX descriptors and no fallback > to clean them up. There was also still an open question about whether or > not the driver should use skb_orphan, but I may be misremembering that part. > Hi Arnd: what about use a state machine to check the tx queue and free the skb, just like: what do you think of this solution? Regards Ding >> Dave, what's your take here? Should we keep a driver from going upstream >> just because the hardware is partly broken? I'd really prefer to have an >> upstream driver on that SoC rather than some random (eventually even >> more broken) downstream code. > > We can certainly have a slow driver for this hardware, and I'd much > prefer slow over broken. I'd guess that some of the performance impact > of the missing interrupts can now be offset with the xmit_more logic. > > Arnd > -- > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > > . > diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c index 8593658..71faca8 100644 --- a/drivers/net/ethernet/hisilicon/hip04_eth.c +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c @@ -396,9 +396,25 @@ static int hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) stats->tx_packets++; priv->tx_count++; + + queue_delayed_work(priv->wq, &priv->tx_queue, delay); + return NETDEV_TX_OK; } +static void hip04_tx_queue_monitor(struct work_struct *work) +{ + struct hip04_priv *priv = container_of(work, struct hip04_priv, + queue_work.work); + struct net_device *dev = priv->ndev; + hip04_tx_reclain(ndev, false); + + if (TX_QUEUE_IS_EMPRY(ndev)) + return; + + queue_delayed_work(priv->wq, &priv->tx_queue, delay); +} + static int hip04_rx_poll(struct napi_struct *napi, int budget) { struct hip04_priv *priv = container_of(napi, struct hip04_priv, napi); @@ -736,6 +752,8 @@ static int hip04_mac_probe(struct platform_device *pdev) goto alloc_fail; } + INIT_DELAYED_WORK(&priv->tx_queue, hip04_tx_queue_monitor); + return 0;