get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1154961/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1154961,
    "url": "http://patchwork.ozlabs.org/api/patches/1154961/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190828173912.29293-1-bob.beckett@collabora.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": "<20190828173912.29293-1-bob.beckett@collabora.com>",
    "list_archive_url": null,
    "date": "2019-08-28T17:38:54",
    "name": "igb: add rx drop enable attribute",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "87b5a532109a91ff1ccac5bfa16faaf0467c736d",
    "submitter": {
        "id": 76934,
        "url": "http://patchwork.ozlabs.org/api/people/76934/?format=api",
        "name": "Robert Beckett",
        "email": "bob.beckett@collabora.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/20190828173912.29293-1-bob.beckett@collabora.com/mbox/",
    "series": [
        {
            "id": 127938,
            "url": "http://patchwork.ozlabs.org/api/series/127938/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=127938",
            "date": "2019-08-28T17:38:54",
            "name": "igb: add rx drop enable attribute",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/127938/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1154961/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1154961/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@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"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.138; helo=whitealder.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dmarc=fail (p=none dis=none)\n\theader.from=collabora.com"
        ],
        "Received": [
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 46JlhV2FHVz9sDQ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 29 Aug 2019 11:41:43 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 5789288585;\n\tThu, 29 Aug 2019 01:41:40 +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 c6tEARwIm0Pe; Thu, 29 Aug 2019 01:41:38 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 47547884CA;\n\tThu, 29 Aug 2019 01:41:38 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 129CB1BF300\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 28 Aug 2019 17:39:48 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 0EFD186AFB\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 28 Aug 2019 17:39:48 +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 GlpZgZSb4gS7 for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 28 Aug 2019 17:39:47 +0000 (UTC)",
            "from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id CEEC686AE4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 28 Aug 2019 17:39:46 +0000 (UTC)",
            "from [127.0.0.1] (localhost [127.0.0.1])\n\t(Authenticated sender: bbeckett) with ESMTPSA id C60CE263947"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "From": "Robert Beckett <bob.beckett@collabora.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Wed, 28 Aug 2019 18:38:54 +0100",
        "Message-Id": "<20190828173912.29293-1-bob.beckett@collabora.com>",
        "X-Mailer": "git-send-email 2.18.0",
        "X-Mailman-Approved-At": "Thu, 29 Aug 2019 01:41:36 +0000",
        "Subject": "[Intel-wired-lan] [PATCH] igb: add rx drop enable attribute",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Cc": "Robert Beckett <bob.beckett@collabora.com>, netdev@vger.kernel.org,\n\t\"David S. Miller\" <davem@davemloft.net>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "To allow userland to enable or disable dropping packets when descriptor\nring is exhausted, add an adapter rx_drop_en attribute.\n\nThis can be used in conjunction with flow control to mitigate packet storms\n(e.g. due to network loop or DoS) by forcing the network adapter to send\npause frames whenever the ring is close to exhaustion.\n\nBy default this will maintain previous behaviour of enabling dropping of\npackets during ring buffer exhaustion.\nSome use cases prefer to not drop packets upon exhaustion, but instead\nuse flow control to limit ingress rates and ensure no dropped packets.\nThis is useful when the host CPU cannot keep up with packet delivery,\nbut data delivery is more important than throughput via multiple queues.\n\nUserland can write 0 to rx_drop_en to disable packet dropping via udev.\n\nSigned-off-by: Robert Beckett <bob.beckett@collabora.com>\n---\n drivers/net/ethernet/intel/igb/igb.h      |  1 +\n drivers/net/ethernet/intel/igb/igb_main.c | 60 ++++++++++++++++++++++-\n 2 files changed, 60 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h\nindex ca54e268d157..efada57a05e1 100644\n--- a/drivers/net/ethernet/intel/igb/igb.h\n+++ b/drivers/net/ethernet/intel/igb/igb.h\n@@ -594,6 +594,7 @@ struct igb_adapter {\n \tstruct igb_mac_addr *mac_table;\n \tstruct vf_mac_filter vf_macs;\n \tstruct vf_mac_filter *vf_mac_list;\n+\tbool rx_drop_enable; /* drop packets when descriptor ring exhausted */\n };\n \n /* flags controlling PTP/1588 function */\ndiff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c\nindex 105b0624081a..5b499130c3f5 100644\n--- a/drivers/net/ethernet/intel/igb/igb_main.c\n+++ b/drivers/net/ethernet/intel/igb/igb_main.c\n@@ -2982,6 +2982,54 @@ static s32 igb_init_i2c(struct igb_adapter *adapter)\n \treturn status;\n }\n \n+static ssize_t rx_drop_en_show(struct device *dev,\n+\t\t\t       struct device_attribute *attr,\n+\t\t\t       char *buf)\n+\n+{\n+\tstruct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));\n+\tstruct igb_adapter *adapter = netdev_priv(netdev);\n+\n+\tif (adapter->rx_drop_enable)\n+\t\treturn sprintf(buf, \"1\\n\");\n+\telse\n+\t\treturn sprintf(buf, \"0\\n\");\n+}\n+\n+static ssize_t rx_drop_en_store(struct device *dev,\n+\t\t\t\tstruct device_attribute *attr,\n+\t\t\t\tconst char *buf, size_t count)\n+{\n+\tstruct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));\n+\tstruct igb_adapter *adapter = netdev_priv(netdev);\n+\tstruct e1000_hw *hw = &adapter->hw;\n+\tint queue_idx, reg_idx;\n+\tbool val;\n+\tu32 srrctl;\n+\tint ret;\n+\n+\tret = kstrtobool(buf, &val);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tadapter->rx_drop_enable = val;\n+\n+\t/* set for each currently active ring */\n+\tfor (queue_idx = 0; queue_idx < adapter->num_rx_queues; queue_idx++) {\n+\t\treg_idx = adapter->rx_ring[queue_idx]->reg_idx;\n+\t\tsrrctl = rd32(E1000_SRRCTL(reg_idx));\n+\t\tif (val == 0)\n+\t\t\tsrrctl &= ~E1000_SRRCTL_DROP_EN;\n+\t\telse\n+\t\t\tsrrctl |= E1000_SRRCTL_DROP_EN;\n+\t\twr32(E1000_SRRCTL(reg_idx), srrctl);\n+\t}\n+\n+\treturn count;\n+}\n+\n+static DEVICE_ATTR_RW(rx_drop_en);\n+\n /**\n  *  igb_probe - Device Initialization Routine\n  *  @pdev: PCI device information struct\n@@ -3329,6 +3377,9 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)\n \t\tgoto err_eeprom;\n \t}\n \n+\t/* Add adapter attributes */\n+\tdevice_create_file(&pdev->dev, &dev_attr_rx_drop_en);\n+\n \t/* let the f/w know that the h/w is now under the control of the\n \t * driver.\n \t */\n@@ -3655,6 +3706,9 @@ static void igb_remove(struct pci_dev *pdev)\n \t */\n \tigb_release_hw_control(adapter);\n \n+\t/* Remove addapter attributes */\n+\tdevice_remove_file(&pdev->dev, &dev_attr_rx_drop_en);\n+\n #ifdef CONFIG_PCI_IOV\n \tigb_disable_sriov(pdev);\n #endif\n@@ -3753,6 +3807,9 @@ static void igb_init_queue_configuration(struct igb_adapter *adapter)\n \tmax_rss_queues = igb_get_max_rss_queues(adapter);\n \tadapter->rss_queues = min_t(u32, max_rss_queues, num_online_cpus());\n \n+\tif (adapter->vfs_allocated_count || adapter->rss_queues > 1)\n+\t\tadapter->rx_drop_enable = true;\n+\n \tigb_set_flag_queue_pairs(adapter, max_rss_queues);\n }\n \n@@ -4504,7 +4561,8 @@ void igb_configure_rx_ring(struct igb_adapter *adapter,\n \tif (hw->mac.type >= e1000_82580)\n \t\tsrrctl |= E1000_SRRCTL_TIMESTAMP;\n \t/* Only set Drop Enable if we are supporting multiple queues */\n-\tif (adapter->vfs_allocated_count || adapter->num_rx_queues > 1)\n+\tif (adapter->rx_drop_enable &&\n+\t\t(adapter->vfs_allocated_count || adapter->num_rx_queues > 1))\n \t\tsrrctl |= E1000_SRRCTL_DROP_EN;\n \n \twr32(E1000_SRRCTL(reg_idx), srrctl);\n",
    "prefixes": []
}