Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/743622/?format=api
{ "id": 743622, "url": "http://patchwork.ozlabs.org/api/patches/743622/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1490575475-8215-2-git-send-email-kim.tatt.chuah@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1490575475-8215-2-git-send-email-kim.tatt.chuah@intel.com>", "list_archive_url": null, "date": "2017-03-27T00:44:35", "name": "igb: Enable reading of wake up packet", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "2c6439b9bf7a70558871095fcdb1e82bdfdb4c5c", "submitter": { "id": 71272, "url": "http://patchwork.ozlabs.org/api/people/71272/?format=api", "name": "Chuah, Kim Tatt", "email": "kim.tatt.chuah@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1490575475-8215-2-git-send-email-kim.tatt.chuah@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/743622/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/743622/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Received": [ "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3vs4Wg41g1z9ryj\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 27 Mar 2017 17:54:22 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id E192B84D83;\n\tMon, 27 Mar 2017 06:54:20 +0000 (UTC)", "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id PWT5dwNItZXf; Mon, 27 Mar 2017 06:54:20 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 9E0AC84CE3;\n\tMon, 27 Mar 2017 06:54:19 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 1C2DA1C2D49\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Mar 2017 00:45:41 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 18C1E83547\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Mar 2017 00:45:41 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id ILHQvdtDBtuQ for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Mar 2017 00:45:40 +0000 (UTC)", "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 472CE834CC\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Mar 2017 00:45:40 +0000 (UTC)", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga105.fm.intel.com with ESMTP; 26 Mar 2017 17:45:40 -0700", "from kchuah4-ilbpg1.png.intel.com ([10.88.227.53])\n\tby orsmga003.jf.intel.com with ESMTP; 26 Mar 2017 17:45:39 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.36,229,1486454400\"; d=\"scan'208\";a=\"948423306\"", "From": "\"Chuah, Kim Tatt\" <kim.tatt.chuah@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Mon, 27 Mar 2017 08:44:35 +0800", "Message-Id": "<1490575475-8215-2-git-send-email-kim.tatt.chuah@intel.com>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1490575475-8215-1-git-send-email-kim.tatt.chuah@intel.com>", "References": "<1490575475-8215-1-git-send-email-kim.tatt.chuah@intel.com>", "X-Mailman-Approved-At": "Mon, 27 Mar 2017 06:54:18 +0000", "Cc": "kim.tatt.chuah@intel.com", "Subject": "[Intel-wired-lan] [PATCH] igb: Enable reading of wake up packet", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "Currently, in igb_resume(), igb driver ignores the Wake Up Status (WUS)\nand Wake Up Packet Memory (WUPM) registers. This patch enables the igb\ndriver to read the WUPM if the controller was woken by a wake up packet\nthat is not more than 128 bytes long (maximum WUPM size), then pass it\nup the kernel network stack.\n\nSigned-off-by: Chuah, Kim Tatt <kim.tatt.chuah@intel.com>\n---\n drivers/net/ethernet/intel/igb/e1000_defines.h | 21 +++++++++++++++\n drivers/net/ethernet/intel/igb/igb_main.c | 36 +++++++++++++++++++++++++-\n 2 files changed, 56 insertions(+), 1 deletion(-)", "diff": "diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h\nindex 8aee314..532bc7b 100644\n--- a/drivers/net/ethernet/intel/igb/e1000_defines.h\n+++ b/drivers/net/ethernet/intel/igb/e1000_defines.h\n@@ -39,6 +39,27 @@\n #define E1000_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */\n #define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */\n \n+/* Wake Up Status */\n+#define E1000_WUS_EX 0x00000004 /* Directed Exact */\n+#define E1000_WUS_ARPD 0x00000020 /* Directed ARP Request */\n+#define E1000_WUS_IPV4 0x00000040 /* Directed IPv4 */\n+#define E1000_WUS_IPV6 0x00000080 /* Directed IPv6 */\n+#define E1000_WUS_NSD 0x00000400 /* Directed IPv6 Neighbor Solicitation */\n+\n+/* Packet types that are enabled for wake packet delivery */\n+#define WAKE_PKT_WUS ( \\\n+\tE1000_WUS_EX | \\\n+\tE1000_WUS_ARPD | \\\n+\tE1000_WUS_IPV4 | \\\n+\tE1000_WUS_IPV6 | \\\n+\tE1000_WUS_NSD)\n+\n+/* Wake Up Packet Length */\n+#define E1000_WUPL_MASK 0x00000FFF\n+\n+/* Wake Up Packet Memory stores the first 128 bytes of the wake up packet */\n+#define E1000_WUPM_BYTES 128\n+\n /* Extended Device Control */\n #define E1000_CTRL_EXT_SDP2_DATA 0x00000040 /* Value of SW Defineable Pin 2 */\n #define E1000_CTRL_EXT_SDP3_DATA 0x00000080 /* Value of SW Defineable Pin 3 */\ndiff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c\nindex be456ba..81e0982 100644\n--- a/drivers/net/ethernet/intel/igb/igb_main.c\n+++ b/drivers/net/ethernet/intel/igb/igb_main.c\n@@ -7630,6 +7630,36 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake,\n \treturn 0;\n }\n \n+static void igb_deliver_wake_packet(struct net_device *netdev)\n+{\n+\tstruct igb_adapter *adapter = netdev_priv(netdev);\n+\tstruct e1000_hw *hw = &adapter->hw;\n+\tstruct sk_buff *skb;\n+\tu32 wupl;\n+\n+\twupl = rd32(E1000_WUPL) & E1000_WUPL_MASK;\n+\n+\t/* WUPM stores only the first 128 bytes of the wake packet.\n+\t * Read the packet only if we have the whole thing.\n+\t */\n+\tif ((wupl == 0) || (wupl > E1000_WUPM_BYTES))\n+\t\treturn;\n+\n+\tskb = netdev_alloc_skb_ip_align(netdev, E1000_WUPM_BYTES);\n+\tif (!skb)\n+\t\treturn;\n+\n+\tskb_put(skb, wupl);\n+\n+\t/* Ensure reads are 32-bit aligned */\n+\twupl = roundup(wupl, 4);\n+\n+\tmemcpy_fromio(skb->data, hw->hw_addr + E1000_WUPM_REG(0), wupl);\n+\n+\tskb->protocol = eth_type_trans(skb, netdev);\n+\tnetif_rx(skb);\n+}\n+\n #ifdef CONFIG_PM\n #ifdef CONFIG_PM_SLEEP\n static int igb_suspend(struct device *dev)\n@@ -7659,7 +7689,7 @@ static int igb_resume(struct device *dev)\n \tstruct net_device *netdev = pci_get_drvdata(pdev);\n \tstruct igb_adapter *adapter = netdev_priv(netdev);\n \tstruct e1000_hw *hw = &adapter->hw;\n-\tu32 err;\n+\tu32 err, val;\n \n \tpci_set_power_state(pdev, PCI_D0);\n \tpci_restore_state(pdev);\n@@ -7690,6 +7720,10 @@ static int igb_resume(struct device *dev)\n \t */\n \tigb_get_hw_control(adapter);\n \n+\tval = rd32(E1000_WUS);\n+\tif (val & WAKE_PKT_WUS)\n+\t\tigb_deliver_wake_packet(netdev);\n+\n \twr32(E1000_WUS, ~0);\n \n \trtnl_lock();\n", "prefixes": [] }