Received: by 10.192.165.148 with SMTP id m20csp967335imm; Thu, 10 May 2018 03:38:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpB1OhXmobNO92bhAehehuh14AM1Z88itt8KnaH9LtmDJ4Xi9oAiYNfsnYw05PNqFQtQA9k X-Received: by 2002:a17:902:b585:: with SMTP id a5-v6mr874361pls.53.1525948707667; Thu, 10 May 2018 03:38:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525948707; cv=none; d=google.com; s=arc-20160816; b=ErcH+SQTIz/BgZ2VR8VGXt42BiIaRN+YHoo0DiR91bMTOm+MBuO4uyNSz1rrB+G8Qt TKdLON4tPK5juVNHYyy/nTJoH2W7h0R5OVuMg+bAWTd/7VMlDAlxdTZOlM3KN08AJrv+ ChmjEmcsJo6J6z7wBVd7SKqAum0SPIogs+T0XruZPmgAp1lGG56OkzmD1OipqHjHxVS6 bfmeQHJFLm/J8/kdXGgppnPEBRDtn1K+++HgNuInC4CSQ4CHSj9KhD5hu5GJpAHNzv/t GvyCwB08TVDeRjKjyN8quiWX9810Ma7peKpwZQ51P75AKz0i+VotdKImpuimu7y/0ib+ qr2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=l9zXHG+qUZ5So/F+YNkMdkxONMT5QiPT66IUdT7SegY=; b=eMkC80Zz6WRKThXb/XYMB0gSYG4E0+yxwWWYXMkpdc4f0FoCVb48zrdhUxXGl623ps 6P16Wghl4+au4mGwfcftdHwBTP02mwqwqpRksw3M1cy4g0AOt42KV9sPnH5QFEoCAV1I 6fQQ+PARK/Y37XCXVWa8MyHh6glrcuVywCcOR89J4VeHPtUX/HFqL2io7duKPvau3nml uOfDyJTuNJkJfey0Hed7D+wWKrNKAJ6zSZeEBIgk0Dik5oEgyk5CEKFAIdC/r7W8OyRg XCZyYFQ/oyiBCPMkxQ6QPaALWjItfui2sGuWwsF7t9V2SQxGrRhNYaHOCqt9WeoBtIzX MnLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jYeScg/o; 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 a24-v6si427533pgw.101.2018.05.10.03.38.13; Thu, 10 May 2018 03:38:27 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jYeScg/o; 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 S1756940AbeEJKh4 (ORCPT + 99 others); Thu, 10 May 2018 06:37:56 -0400 Received: from mail-qk0-f176.google.com ([209.85.220.176]:33132 "EHLO mail-qk0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756820AbeEJKhn (ORCPT ); Thu, 10 May 2018 06:37:43 -0400 Received: by mail-qk0-f176.google.com with SMTP id c11-v6so1150210qkm.0; Thu, 10 May 2018 03:37:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=l9zXHG+qUZ5So/F+YNkMdkxONMT5QiPT66IUdT7SegY=; b=jYeScg/oc7pXdcrt4Qqv4W/b2svzEsLeuxJezTfXjV0ptQG0C4FOcYQo3grH+nV43m zI8ApLCU/bQcXhYiUAATEREmIrfWnsEYpnIinKRS46zxiCeNMx4m0rDM8TgafzhJme9m /72tjFdKVVZz7wBBvyHCZtMK7zAGWOp4sow1hCDgTjuRmPb+vBQfleED1SOYOlQHXgi8 pXmmQc3tqb3DmP9wvF1501mwaktKj0Qlc9Ok/6DCUQBarRqUfUpuNf1DsXAurcAguWN2 fjgkktTxV3SrtLIkd0eJagsGM0/oDlK3bugni4g5j+XWfQ4ZFlxTh6EPk+VnXPE0yBrd tnmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=l9zXHG+qUZ5So/F+YNkMdkxONMT5QiPT66IUdT7SegY=; b=BByn1NilfScyR9MXHyXA6THK8QjTAvjM0gjP1qTA4errlTDpMbpZTUubLQGMJo1Rev Zd1y4BLPoqALSRGnUYxHSgdRTsRENLFQD3LLJPN1IEU5E7gPIZe6S6CPUNhAv1+EsiAJ p2/ksdRuqb59xhrh/z3AVpkPvVxFuuqKbsrBKohUQatnhUyzIXnnJc6aQZsphEkdejOp b5/jWCbaDvfIQRcC7ZYxl3m9tpo2oINROvAgbOWj+1hI0pGXAqpM0fC3z6He/y9XBxAN /yzpt3blB25+r3hI/9cz53P/gP4XTuitAwtE00lvNHQ2EZMOnJvCth/Te0glubGu3XNL SAbQ== X-Gm-Message-State: ALKqPwfDaEBBBJuMAymnGBI3gE4PwWGxQgrCK1anbeo4ThAmlOqp31X6 TRsmDl10DqYzfey5g55yHmoQDEJQzyQbExIC9Zg= X-Received: by 2002:a37:320b:: with SMTP id y11-v6mr672882qky.254.1525948662424; Thu, 10 May 2018 03:37:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.46.37 with HTTP; Thu, 10 May 2018 03:37:41 -0700 (PDT) In-Reply-To: <51e1b2f3-4dd7-3513-2148-649372775130@microchip.com> 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: Harini Katakam Date: Thu, 10 May 2018 16:07:41 +0530 X-Google-Sender-Auth: zcnEROJVfKXlvRdlA8rYz8Lonnc Message-ID: Subject: Re: [RFC PATCH 5/5] net: macb: Add WOL support with ARP To: Claudiu Beznea Cc: Nicolas Ferre , David Miller , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, michals@xilinx.com, appanad@xilinx.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. >> +#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. > 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. > 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. 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