get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 678516,
    "url": "http://patchwork.ozlabs.org/api/patches/678516/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1475685046-16900-12-git-send-email-bimmy.pujari@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": "<1475685046-16900-12-git-send-email-bimmy.pujari@intel.com>",
    "list_archive_url": null,
    "date": "2016-10-05T16:30:41",
    "name": "[next,S49-V2,11/15] i40e: remove duplicate add/delete adminq command code for filters",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "480bfdeeb59bda5584456a92239095b34b6bf23b",
    "submitter": {
        "id": 68919,
        "url": "http://patchwork.ozlabs.org/api/people/68919/?format=api",
        "name": "Pujari, Bimmy",
        "email": "bimmy.pujari@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/1475685046-16900-12-git-send-email-bimmy.pujari@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/678516/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/678516/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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\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 3sq1XM4l7gz9sBR\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  6 Oct 2016 03:32:19 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 33D89C2382;\n\tWed,  5 Oct 2016 16:32:18 +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 xpAURgitew9Z; Wed,  5 Oct 2016 16:32:16 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 41AD9C238C;\n\tWed,  5 Oct 2016 16:32:15 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id E3FB61CE82D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  5 Oct 2016 16:32:11 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id E1A75925CC\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  5 Oct 2016 16:32:11 +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 GcX3mYNSiJxI for <intel-wired-lan@lists.osuosl.org>;\n\tWed,  5 Oct 2016 16:32:10 +0000 (UTC)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id DB6C3925C0\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed,  5 Oct 2016 16:32:10 +0000 (UTC)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga105.fm.intel.com with ESMTP; 05 Oct 2016 09:32:10 -0700",
            "from bimmy.jf.intel.com (HELO bimmy.linux1.jf.intel.com)\n\t([134.134.2.167])\n\tby fmsmga005.fm.intel.com with ESMTP; 05 Oct 2016 09:32:10 -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.31,449,1473145200\"; d=\"scan'208\";a=\"16526392\"",
        "From": "Bimmy Pujari <bimmy.pujari@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Wed,  5 Oct 2016 09:30:41 -0700",
        "Message-Id": "<1475685046-16900-12-git-send-email-bimmy.pujari@intel.com>",
        "X-Mailer": "git-send-email 2.4.11",
        "In-Reply-To": "<1475685046-16900-1-git-send-email-bimmy.pujari@intel.com>",
        "References": "<1475685046-16900-1-git-send-email-bimmy.pujari@intel.com>",
        "Subject": "[Intel-wired-lan] [next PATCH S49-V2 11/15] i40e: remove duplicate\n\tadd/delete adminq command code for filters",
        "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": "From: Jacob Keller <jacob.e.keller@intel.com>\n\nWe duplicate some code around adding and deleting filters using the\nadminq interface. This is prone to errors in case there are bugs. Use\nfunctions which extract the logic to their own portion so that we don't\nduplicate it twice in code.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\nChange-ID: I60d68aeb887976787dec00b23ab386a106e61465\n---\n drivers/net/ethernet/intel/i40e/i40e_main.c | 156 +++++++++++++++-------------\n 1 file changed, 84 insertions(+), 72 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 327ffbf..4f14b55 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -1783,6 +1783,80 @@ i40e_update_filter_state(int count,\n }\n \n /**\n+ * i40e_aqc_del_filters - Request firmware to delete a set of filters\n+ * @vsi: ptr to the VSI\n+ * @vsi_name: name to display in messages\n+ * @list: the list of filters to send to firmware\n+ * @num_del: the number of filters to delete\n+ * @retval: Set to -EIO on failure to delete\n+ *\n+ * Send a request to firmware via AdminQ to delete a set of filters. Uses\n+ * *retval instead of a return value so that success does not force ret_val to\n+ * be set to 0. This ensures that a sequence of calls to this function\n+ * preserve the previous value of *retval on successful delete.\n+ */\n+static\n+void i40e_aqc_del_filters(struct i40e_vsi *vsi, const char *vsi_name,\n+\t\t\t  struct i40e_aqc_remove_macvlan_element_data *list,\n+\t\t\t  int num_del, int *retval)\n+{\n+\tstruct i40e_hw *hw = &vsi->back->hw;\n+\ti40e_status aq_ret;\n+\tint aq_err;\n+\n+\taq_ret = i40e_aq_remove_macvlan(hw, vsi->seid, list, num_del, NULL);\n+\taq_err = hw->aq.asq_last_status;\n+\n+\t/* Explicitly ignore and do not report when firmware returns ENOENT */\n+\tif (aq_ret && !(aq_err == I40E_AQ_RC_ENOENT)) {\n+\t\t*retval = -EIO;\n+\t\tdev_info(&vsi->back->pdev->dev,\n+\t\t\t \"ignoring delete macvlan error on %s, err %s, aq_err %s\\n\",\n+\t\t\t vsi_name, i40e_stat_str(hw, aq_ret),\n+\t\t\t i40e_aq_str(hw, aq_err));\n+\t}\n+}\n+\n+/**\n+ * i40e_aqc_add_filters - Request firmware to add a set of filters\n+ * @vsi: ptr to the VSI\n+ * @vsi_name: name to display in messages\n+ * @list: the list of filters to send to firmware\n+ * @add_head: Position in the add hlist\n+ * @num_add: the number of filters to add\n+ * @promisc_change: set to true on exit if promiscuous mode was forced on\n+ *\n+ * Send a request to firmware via AdminQ to add a chunk of filters. Will set\n+ * promisc_changed to true if the firmware has run out of space for more\n+ * filters.\n+ */\n+static\n+void i40e_aqc_add_filters(struct i40e_vsi *vsi, const char *vsi_name,\n+\t\t\t  struct i40e_aqc_add_macvlan_element_data *list,\n+\t\t\t  struct i40e_mac_filter *add_head,\n+\t\t\t  int num_add, bool *promisc_changed)\n+{\n+\tstruct i40e_hw *hw = &vsi->back->hw;\n+\ti40e_status aq_ret;\n+\tint aq_err, fcnt;\n+\n+\taq_ret = i40e_aq_add_macvlan(hw, vsi->seid, list, num_add, NULL);\n+\taq_err = hw->aq.asq_last_status;\n+\tfcnt = i40e_update_filter_state(num_add, list, add_head, aq_ret);\n+\tvsi->active_filters += fcnt;\n+\n+\tif (fcnt != num_add) {\n+\t\t*promisc_changed = true;\n+\t\tset_bit(__I40E_FILTER_OVERFLOW_PROMISC, &vsi->state);\n+\t\tvsi->promisc_threshold = (vsi->active_filters * 3) / 4;\n+\t\tdev_warn(&vsi->back->pdev->dev,\n+\t\t\t \"Error %s adding RX filters on %s, promiscuous mode forced on\\n\",\n+\t\t\t i40e_aq_str(hw, aq_err),\n+\t\t\t vsi_name);\n+\t}\n+}\n+\n+/**\n  * i40e_sync_vsi_filters - Update the VSI filter list to the HW\n  * @vsi: ptr to the VSI\n  *\n@@ -1808,10 +1882,8 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \tint num_add = 0;\n \tint num_del = 0;\n \tint retval = 0;\n-\tint aq_err = 0;\n \tu16 cmd_flags;\n \tint list_size;\n-\tint fcnt;\n \tint bkt;\n \n \t/* empty array typed pointers, kcalloc later */\n@@ -1948,24 +2020,10 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \n \t\t\t/* flush a full buffer */\n \t\t\tif (num_del == filter_list_len) {\n-\t\t\t\taq_ret = i40e_aq_remove_macvlan(hw, vsi->seid,\n-\t\t\t\t\t\t\t\tdel_list,\n-\t\t\t\t\t\t\t\tnum_del, NULL);\n-\t\t\t\taq_err = hw->aq.asq_last_status;\n-\t\t\t\tnum_del = 0;\n+\t\t\t\ti40e_aqc_del_filters(vsi, vsi_name, del_list,\n+\t\t\t\t\t\t     num_del, &retval);\n \t\t\t\tmemset(del_list, 0, list_size);\n-\n-\t\t\t\t/* Explicitly ignore and do not report when\n-\t\t\t\t * firmware returns ENOENT.\n-\t\t\t\t */\n-\t\t\t\tif (aq_ret && !(aq_err == I40E_AQ_RC_ENOENT)) {\n-\t\t\t\t\tretval = -EIO;\n-\t\t\t\t\tdev_info(&pf->pdev->dev,\n-\t\t\t\t\t\t \"ignoring delete macvlan error on %s, err %s, aq_err %s\\n\",\n-\t\t\t\t\t\t vsi_name,\n-\t\t\t\t\t\t i40e_stat_str(hw, aq_ret),\n-\t\t\t\t\t\t i40e_aq_str(hw, aq_err));\n-\t\t\t\t}\n+\t\t\t\tnum_del = 0;\n \t\t\t}\n \t\t\t/* Release memory for MAC filter entries which were\n \t\t\t * synced up with HW.\n@@ -1975,22 +2033,8 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \t\t}\n \n \t\tif (num_del) {\n-\t\t\taq_ret = i40e_aq_remove_macvlan(hw, vsi->seid, del_list,\n-\t\t\t\t\t\t\tnum_del, NULL);\n-\t\t\taq_err = hw->aq.asq_last_status;\n-\t\t\tnum_del = 0;\n-\n-\t\t\t/* Explicitly ignore and do not report when firmware\n-\t\t\t * returns ENOENT.\n-\t\t\t */\n-\t\t\tif (aq_ret && !(aq_err == I40E_AQ_RC_ENOENT)) {\n-\t\t\t\tretval = -EIO;\n-\t\t\t\tdev_info(&pf->pdev->dev,\n-\t\t\t\t\t \"ignoring delete macvlan error on %s, err %s aq_err %s\\n\",\n-\t\t\t\t\t vsi_name,\n-\t\t\t\t\t i40e_stat_str(hw, aq_ret),\n-\t\t\t\t\t i40e_aq_str(hw, aq_err));\n-\t\t\t}\n+\t\t\ti40e_aqc_del_filters(vsi, vsi_name, del_list,\n+\t\t\t\t\t     num_del, &retval);\n \t\t}\n \n \t\tkfree(del_list);\n@@ -2041,48 +2085,16 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)\n \n \t\t\t/* flush a full buffer */\n \t\t\tif (num_add == filter_list_len) {\n-\t\t\t\taq_ret = i40e_aq_add_macvlan(hw, vsi->seid,\n-\t\t\t\t\t\t\t     add_list, num_add,\n-\t\t\t\t\t\t\t     NULL);\n-\t\t\t\taq_err = hw->aq.asq_last_status;\n-\t\t\t\tfcnt = i40e_update_filter_state(num_add,\n-\t\t\t\t\t\t\t\tadd_list,\n-\t\t\t\t\t\t\t\tadd_head,\n-\t\t\t\t\t\t\t\taq_ret);\n-\t\t\t\tvsi->active_filters += fcnt;\n-\n-\t\t\t\tif (fcnt != num_add) {\n-\t\t\t\t\tpromisc_changed = true;\n-\t\t\t\t\tset_bit(__I40E_FILTER_OVERFLOW_PROMISC,\n-\t\t\t\t\t\t&vsi->state);\n-\t\t\t\t\tvsi->promisc_threshold =\n-\t\t\t\t\t\t(vsi->active_filters * 3) / 4;\n-\t\t\t\t\tdev_warn(&pf->pdev->dev,\n-\t\t\t\t\t\t \"Error %s adding RX filters on %s, promiscuous mode forced on\\n\",\n-\t\t\t\t\t\t i40e_aq_str(hw, aq_err),\n-\t\t\t\t\t\t vsi_name);\n-\t\t\t\t}\n+\t\t\t\ti40e_aqc_add_filters(vsi, vsi_name, add_list,\n+\t\t\t\t\t\t     add_head, num_add,\n+\t\t\t\t\t\t     &promisc_changed);\n \t\t\t\tmemset(add_list, 0, list_size);\n \t\t\t\tnum_add = 0;\n \t\t\t}\n \t\t}\n \t\tif (num_add) {\n-\t\t\taq_ret = i40e_aq_add_macvlan(hw, vsi->seid,\n-\t\t\t\t\t\t     add_list, num_add, NULL);\n-\t\t\taq_err = hw->aq.asq_last_status;\n-\t\t\tfcnt = i40e_update_filter_state(num_add, add_list,\n-\t\t\t\t\t\t\tadd_head, aq_ret);\n-\t\t\tvsi->active_filters += fcnt;\n-\t\t\tif (fcnt != num_add) {\n-\t\t\t\tpromisc_changed = true;\n-\t\t\t\tset_bit(__I40E_FILTER_OVERFLOW_PROMISC,\n-\t\t\t\t\t&vsi->state);\n-\t\t\t\tvsi->promisc_threshold =\n-\t\t\t\t\t\t(vsi->active_filters * 3) / 4;\n-\t\t\t\tdev_warn(&pf->pdev->dev,\n-\t\t\t\t\t \"Error %s adding RX filters on %s, promiscuous mode forced on\\n\",\n-\t\t\t\t\t i40e_aq_str(hw, aq_err), vsi_name);\n-\t\t\t}\n+\t\t\ti40e_aqc_add_filters(vsi, vsi_name, add_list, add_head,\n+\t\t\t\t\t     num_add, &promisc_changed);\n \t\t}\n \t\t/* Now move all of the filters from the temp add list back to\n \t\t * the VSI's list.\n",
    "prefixes": [
        "next",
        "S49-V2",
        "11/15"
    ]
}