From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752691AbcG2J1u (ORCPT ); Fri, 29 Jul 2016 05:27:50 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:61600 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750806AbcG2J1p (ORCPT ); Fri, 29 Jul 2016 05:27:45 -0400 From: Arnd Bergmann To: LABBE Corentin Cc: linux-arm-kernel@lists.infradead.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@free-electrons.com, wens@csie.org, linux@armlinux.org.uk, davem@davemloft.net, devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: Re: [PATCH v2 1/5] ethernet: add sun8i-emac driver Date: Fri, 29 Jul 2016 11:26:57 +0200 Message-ID: <4552489.XcKoxjnXeP@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-28-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <20160728131826.GA7582@Red> References: <1469001800-11615-1-git-send-email-clabbe.montjoie@gmail.com> <4697175.RMdFEWr9V5@wuerfel> <20160728131826.GA7582@Red> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:xXTLXayZXIusG21he7UN5k6vePFii3/Lf4VxPs9TtbSLcVM0aJQ 1IwjtjtG+qnTnKYz96cZ+VjT1gX4mvzzWXaTudTgd75+9fkQFY+C/4Ob2XHCbSZO9dyzNJI rM8m69AFSpYuhdd12gQ4qOAA6M6truMPctDTi51uS+NeRU0HWwL695CKyF5RwIxIETQ1dXg LsU/vLD7Z8JwEgv24c0Jw== X-UI-Out-Filterresults: notjunk:1;V01:K0:1+Y/f7xYocE=:SlK0PA5ZO1Q5pRLtRoY4is vZwXXAweBMbDwKnS2z04EHw4HrtuEqdkm/T5qHCFICn7liA4/DnpTDGT0h1sonKEvturMqv10 lLMePSubOa3YneDqGUI1+QgZTnbYH/3/u0GdGcWTcvYMefc3llbLPcAnMlKHN+UqNquc7/bYy 77DGwjFwFEfiFdmzvOp4/rSUraoOiM1zoCeMv6DMuLTkpuh3vSeIxn0f4QEJQrG+zbETxk+hN Xgu1QlfhYnUthIo1ZsFYEml6/LfC7mEkt9VTFaMN53D2gTcCSErO22E+A6TQXMSUaDMiHy+rL 79fKINPi7DbIPkXm5ul08PqxVe8HOxK3sJ23iWWo7Wu9+HGsM/avn4MCt6aKhe/9J2FJEFMEt Cj85krAxmx/l7FgzZk9AADIT1JtIOCCYbZIrX9X+iHm4Tc7Nowbq0bGxUSMg24PEQSsZT/7uC 2f03Id9HuHfIoMKjbBOg3TeN3kbHYC8FYsHwofZl/vsIeonHMMbI5J/0r71s98AxDlyJoYs4W 7YeezK1Im4uVrzuWIDYqRjeWZA4/4VtlH4By7s07VHXM05dsWSQH1nzY6N1SDhPWxVog1BHxL CXCBvErSyzwvWJV6zeEZwaoj3AQ9u9yHMgIbW/aWeMUA0QdRHKjJamg7aTmacY6kxDtKJocu2 bcFxRma067W1P7PmyaMheiXQvn8Q1U+U4chzIFuE8hBc/pzq4FT829YNUnIZU6QxL3SUXNOUx 4pVqwNMyLKZZWeKS Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, July 28, 2016 3:18:26 PM CEST LABBE Corentin wrote: > > I will reworked locking and it seems that no locking is necessary. > I have added the following comment about the locking strategy: > > /* Locking strategy: > * RX queue does not need any lock since only sun8i_emac_poll() access it. > * (All other RX modifiers (ringparam/ndo_stop) disable NAPI and so sun8i_emac_poll()) > * TX queue is handled by sun8i_emac_xmit(), sun8i_emac_complete_xmit() and sun8i_emac_tx_timeout() > * (All other RX modifiers (ringparam/ndo_stop) disable NAPI and stop queue) > * > * sun8i_emac_xmit() could fire only once (netif_tx_lock) > * sun8i_emac_complete_xmit() could fire only once (called from NAPI) > * sun8i_emac_tx_timeout() could fire only once (netif_tx_lock) and couldnt > * race with sun8i_emac_xmit (due to netif_tx_lock) and with sun8i_emac_complete_xmit which disable NAPI. > * > * So only sun8i_emac_xmit and sun8i_emac_complete_xmit could fire at the same time. > * But they never could modify the same descriptors: > * - sun8i_emac_complete_xmit() will modify only descriptors with empty status > * - sun8i_emac_xmit() will modify only descriptors set to DCLEAN > * Proper memory barriers ensure that descriptor set to DCLEAN could not be > * modified latter by sun8i_emac_complete_xmit(). > * */ Sounds good, the comment is certainly very helpful here. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH v2 1/5] ethernet: add sun8i-emac driver Date: Fri, 29 Jul 2016 11:26:57 +0200 Message-ID: <4552489.XcKoxjnXeP@wuerfel> References: <1469001800-11615-1-git-send-email-clabbe.montjoie@gmail.com> <4697175.RMdFEWr9V5@wuerfel> <20160728131826.GA7582@Red> Reply-To: arnd-r2nGTMty4D4@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, mark.rutland-5wv7dgnIgG8@public.gmane.org, maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org, wens-jdAy2FN1RRM@public.gmane.org, linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org, davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To: LABBE Corentin Return-path: Sender: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org In-Reply-To: <20160728131826.GA7582@Red> List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , List-Id: netdev.vger.kernel.org On Thursday, July 28, 2016 3:18:26 PM CEST LABBE Corentin wrote: > > I will reworked locking and it seems that no locking is necessary. > I have added the following comment about the locking strategy: > > /* Locking strategy: > * RX queue does not need any lock since only sun8i_emac_poll() access it. > * (All other RX modifiers (ringparam/ndo_stop) disable NAPI and so sun8i_emac_poll()) > * TX queue is handled by sun8i_emac_xmit(), sun8i_emac_complete_xmit() and sun8i_emac_tx_timeout() > * (All other RX modifiers (ringparam/ndo_stop) disable NAPI and stop queue) > * > * sun8i_emac_xmit() could fire only once (netif_tx_lock) > * sun8i_emac_complete_xmit() could fire only once (called from NAPI) > * sun8i_emac_tx_timeout() could fire only once (netif_tx_lock) and couldnt > * race with sun8i_emac_xmit (due to netif_tx_lock) and with sun8i_emac_complete_xmit which disable NAPI. > * > * So only sun8i_emac_xmit and sun8i_emac_complete_xmit could fire at the same time. > * But they never could modify the same descriptors: > * - sun8i_emac_complete_xmit() will modify only descriptors with empty status > * - sun8i_emac_xmit() will modify only descriptors set to DCLEAN > * Proper memory barriers ensure that descriptor set to DCLEAN could not be > * modified latter by sun8i_emac_complete_xmit(). > * */ Sounds good, the comment is certainly very helpful here. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Fri, 29 Jul 2016 11:26:57 +0200 Subject: [PATCH v2 1/5] ethernet: add sun8i-emac driver In-Reply-To: <20160728131826.GA7582@Red> References: <1469001800-11615-1-git-send-email-clabbe.montjoie@gmail.com> <4697175.RMdFEWr9V5@wuerfel> <20160728131826.GA7582@Red> Message-ID: <4552489.XcKoxjnXeP@wuerfel> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thursday, July 28, 2016 3:18:26 PM CEST LABBE Corentin wrote: > > I will reworked locking and it seems that no locking is necessary. > I have added the following comment about the locking strategy: > > /* Locking strategy: > * RX queue does not need any lock since only sun8i_emac_poll() access it. > * (All other RX modifiers (ringparam/ndo_stop) disable NAPI and so sun8i_emac_poll()) > * TX queue is handled by sun8i_emac_xmit(), sun8i_emac_complete_xmit() and sun8i_emac_tx_timeout() > * (All other RX modifiers (ringparam/ndo_stop) disable NAPI and stop queue) > * > * sun8i_emac_xmit() could fire only once (netif_tx_lock) > * sun8i_emac_complete_xmit() could fire only once (called from NAPI) > * sun8i_emac_tx_timeout() could fire only once (netif_tx_lock) and couldnt > * race with sun8i_emac_xmit (due to netif_tx_lock) and with sun8i_emac_complete_xmit which disable NAPI. > * > * So only sun8i_emac_xmit and sun8i_emac_complete_xmit could fire at the same time. > * But they never could modify the same descriptors: > * - sun8i_emac_complete_xmit() will modify only descriptors with empty status > * - sun8i_emac_xmit() will modify only descriptors set to DCLEAN > * Proper memory barriers ensure that descriptor set to DCLEAN could not be > * modified latter by sun8i_emac_complete_xmit(). > * */ Sounds good, the comment is certainly very helpful here. Arnd