Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp296741imm; Tue, 15 May 2018 01:40:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpJeE+7S7cOu97IBsu1h6sPVwOHFWQw0W01MQ1MsKJlHiQ+sTUE7fkgIR8Akg4s6PQO5RpI X-Received: by 2002:a62:e408:: with SMTP id r8-v6mr14250586pfh.172.1526373644493; Tue, 15 May 2018 01:40:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526373644; cv=none; d=google.com; s=arc-20160816; b=DfIsImIqayClnqwhy+98Ps5bElejRUWiStrZVhwWNiAPD153HjcTZz0m2/sYKOjTmL jGOc3hVJjJulx8zgh5B23lYBCLKoMgDnTaF3X0hD7Hh6wbaIsYHU105k46Vmi0SM7O56 TYHXeGuzvIJua4bbe74Xlc8oBxfJIK4r5C8SXkAAdXHhCBYUHfYTLW0vj0nkLlig3mW1 6zDZlRc+ZX2HN7RUYjLp/7sBGIdjs9IzpgE81V8uZh4E+U859Cmx3JXSmKyOMQ+i3O+7 05dsTOfCAyzTqVmVYSSoBd0redpvccfczlFifD4aQOYpjMIQxAL3MeVEk3cBJImhmQG8 mYXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=/cfzcTU2FA2JZDjXXfnUdnGN8kkx1GTJ8z1quPspttg=; b=i285D/rVMomT4hd0WkQj6ie6+CwWweZSzeAZGGfIw+jmckBool8s61wssEkl9hMRDM 1C9nv+uT9bcrj58gP7xwjYwCV7lpv/Zc0JZFVf7oQCyHH7ZmKH1sgMxEe0YeZ+Pvp1SD Wp93L1fi3ZqPfODjyTHeaZX1dpWo47ZXCt2Xu7cflQ/LoVW1YTsVdymbMzwuUgs/zoN5 7WLD5Cp3AOI7RQW9MNEhebGJWxT4IFtxxRzHKoes2TIF6Dd2zWl4RXJUXJzqJwrUlbzw agplz18rXPDIeT2huqYSZZ0fIP7MwpiyUtUtnyPrbRisovZibBXCK01kQej602yRihpp 1RBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r9-v6si11585829pfg.247.2018.05.15.01.40.30; Tue, 15 May 2018 01:40:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752519AbeEOIjM (ORCPT + 99 others); Tue, 15 May 2018 04:39:12 -0400 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:49025 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752396AbeEOIjK (ORCPT ); Tue, 15 May 2018 04:39:10 -0400 X-IronPort-AV: E=Sophos;i="5.49,403,1520924400"; d="scan'208";a="14261108" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 15 May 2018 01:39:09 -0700 Received: from [10.145.6.82] (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Tue, 15 May 2018 01:39:07 -0700 Subject: Re: [RFC PATCH 5/5] net: macb: Add WOL support with ARP To: Harini Katakam CC: Nicolas Ferre , David Miller , , , , References: <1521726700-22634-1-git-send-email-harinikatakamlinux@gmail.com> <1521726700-22634-6-git-send-email-harinikatakamlinux@gmail.com> <51e1b2f3-4dd7-3513-2148-649372775130@microchip.com> From: Claudiu Beznea Message-ID: Date: Tue, 15 May 2018 11:39:04 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Harini, On 10.05.2018 13:37, Harini Katakam wrote: > Hi Claudiu, > > On Fri, May 4, 2018 at 5:47 PM, Claudiu Beznea > wrote: >> >> >> On 22.03.2018 15:51, harinikatakamlinux@gmail.com wrote: >>> From: Harini Katakam >>> >>> This patch enables ARP wake event support in GEM through the following: >>> >>> -> WOL capability can be selected based on the SoC/GEM IP version rather >>> than a devictree property alone. Hence add a new capability property and >>> set device as "wakeup capable" in probe in this case. >>> -> Wake source selection can be done via ethtool or by enabling wakeup >>> in /sys/devices/platform/..../ethx/power/ >>> This patch adds default wake source as ARP and the existing selection of >>> WOL using magic packet remains unchanged. >>> -> When GEM is the wake device with ARP as the wake event, the current >>> IP address to match is written to WOL register along with other >>> necessary confuguration required for MAC to recognize an ARP event. >>> -> While RX needs to remain enabled, there is no need to process the >>> actual wake packet - hence tie off all RX queues to avoid unnecessary >>> processing by DMA in the background. >> >> Why is this different for magic packet vs ARP packet? > > This should ideally be the same whether it is a magic packet or ARP on > the version of the IP we use (more details in my comment below). > I simply did not alter the magic packet code for now to avoid breaking > others' flow. I see your point. But in the end the code should be nice and clean. > > >>> +#define MACB_CAPS_WOL 0x00000080 >> >> I think would be better to have this as part of bp->wol and use it properly >> in suspend/resume hooks. > > I think a capability flag as part of config structure is better > because this is clearly an SoC related feature and there is no need > to have a devicetree property. Since there is no difference b/w ARP and magic packet in term of SoC, I mean, there is no special treatment b/w them, I think we should treat them both in the same way. This was my point. > > >> Wouldn't it work if you will change it in something like this: >> >> u32 wolmask, arpipmask = 0; >> >> if (bp->wol & MACB_WOL_ENABLED) { >> macb_writel(bp, IER, MACB_BIT(WOL)); >> >> if (bp->wol & MACB_WOL_HAS_ARP_PACKET) { >> /* Enable broadcast. */ >> gem_writel(bp, NCFGR, gem_readl(bp, NCFGR) & ~MACB_BIT(NBC)); >> arpipmask = cpu_to_be32p(&bp->dev->ip_ptr->ifa_list->ifa_local) & 0xFFFF; >> wolmask = arpipmask | MACB_BIT(ARP); >> } else { >> wolmask = MACB_BIT(MAG); >> } >> >> macb_writel(bp, WOL, wolmask); >> enable_irq_wake(bp->queues[0].irq); > > The above would work. But I'd still have to add the RX BD changes > and then stop the phy, disable interrupt etc., for most optimal power > down state - the idea is to keep only is essential to detect a wake event. > Also, with your approach the suspend/resume time will be longer. >> netif_device_detach(netdev); >> } >> >> I cannot find anything particular for ARP WOL events in datasheet. Also, >> I cannot find something related to DMA activity while WOL is active > > Can you please let me know which version you are referring to? > ZynqMP uses the IP version r1p06 or 07. I have user guide revision 15 . > > There is a clear set of rules for ARP wake event to be recognized. > > About the DMA activity, it is not explicitly mentioned but we have > observed that the DMA will continue to process incoming packets > and try to write them to the memory and Cadence has confirmed > the same. Later versions of the IP may have some provision to > stop DMA activity on RX channel but unfortunately in this version, > using a dummy RX buffer descriptor is the only way.> > I'm looking into your other suggestions. > Thanks, will get back to you. > > Regards, > Harini >