get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 955612,
    "url": "http://patchwork.ozlabs.org/api/patches/955612/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180809132958.23036-14-anirudh.venkataramanan@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": "<20180809132958.23036-14-anirudh.venkataramanan@intel.com>",
    "list_archive_url": null,
    "date": "2018-08-09T13:29:56",
    "name": "[v3,13/15] ice: Enable VSI Rx/Tx pruning only when VLAN 0 is active",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "6048620f3a3cb255377102b3018db0cc73bb6af7",
    "submitter": {
        "id": 73601,
        "url": "http://patchwork.ozlabs.org/api/people/73601/?format=api",
        "name": "Anirudh Venkataramanan",
        "email": "anirudh.venkataramanan@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/20180809132958.23036-14-anirudh.venkataramanan@intel.com/mbox/",
    "series": [
        {
            "id": 60078,
            "url": "http://patchwork.ozlabs.org/api/series/60078/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=60078",
            "date": "2018-08-09T13:29:43",
            "name": "Feature updates for ice",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/60078/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/955612/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/955612/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.133; helo=hemlock.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\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 41mTf955mLz9s0n\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  9 Aug 2018 23:30:41 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 19419883DD;\n\tThu,  9 Aug 2018 13:30:40 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id rHxsRjmNbiE4; Thu,  9 Aug 2018 13:30:38 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id B6D5488351;\n\tThu,  9 Aug 2018 13:30:38 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 8E2001C3F93\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu,  9 Aug 2018 13:30:35 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 8C03C8707B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu,  9 Aug 2018 13:30:35 +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 KZzm8NRocB9s for <intel-wired-lan@lists.osuosl.org>;\n\tThu,  9 Aug 2018 13:30:34 +0000 (UTC)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 45F3F870A3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu,  9 Aug 2018 13:30:34 +0000 (UTC)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t09 Aug 2018 06:30:30 -0700",
            "from kyungmin-mobl.amr.corp.intel.com (HELO\n\tavenkata-mobl4.localdomain) ([10.254.101.153])\n\tby fmsmga006.fm.intel.com with ESMTP; 09 Aug 2018 06:30:29 -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-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.53,215,1531810800\"; d=\"scan'208\";a=\"253368235\"",
        "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Thu,  9 Aug 2018 06:29:56 -0700",
        "Message-Id": "<20180809132958.23036-14-anirudh.venkataramanan@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20180809132958.23036-1-anirudh.venkataramanan@intel.com>",
        "References": "<20180809132958.23036-1-anirudh.venkataramanan@intel.com>",
        "Subject": "[Intel-wired-lan] [PATCH v3 13/15] ice: Enable VSI Rx/Tx pruning\n\tonly when VLAN 0 is active",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.24",
        "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>",
        "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": "From: Brett Creeley <brett.creeley@intel.com>\n\nVLAN pruning is not valid when VLAN 0 is not active. If VLAN\npruning is enabled and VLAN 0 is not active (8021q driver not loaded)\nthen normal, non-VLAN, traffic will not pass.\n\nTX/RX VLAN pruning is enabled when the VLAN 0 is added to the\nactive_vlan bitmap and it is disabled when VLAN 0 is removed from the\nactive_vlan bitmap.\n\nSo, only enable VLAN pruning when VLAN 0 is active. Setting RX VLAN\npruning causes the switch to drop received VLAN packets when there\nare no matching VLAN ids in the associated VSI's switch filters. Setting\nTX pruning makes it so the switch will not send out any packets with\nVLAN tags that don't match the associated VSI's switch filters.\n\nWith this patch, if the VF or PF tries to send a VLAN tagged packet with\na VLAN tag that it does not have a pruning rule for it will trigger an\nMDD event. For example, if PF0 has VLAN10 and VLAN11 interfaces and\nscapy is used to send a packet with VLAN8 then the MDD is triggered.\n\nAlso make ice_vsi_kill_vlan return a value which the caller can check\nbefore updating VLAN related data structures (counts, pruning bits, etc.).\n\nSigned-off-by: Brett Creeley <brett.creeley@intel.com>\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_main.c | 94 ++++++++++++++++++++---\n 1 file changed, 85 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex f04e124bca8c..46d8e2275647 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -349,6 +349,63 @@ static bool ice_vsi_fltr_changed(struct ice_vsi *vsi)\n \t       test_bit(ICE_VSI_FLAG_VLAN_FLTR_CHANGED, vsi->flags);\n }\n \n+/**\n+ * ice_cfg_vlan_pruning - enable or disable VLAN pruning on the VSI\n+ * @vsi: VSI to enable or disable VLAN pruning on\n+ * @ena: set to true to enable VLAN pruning and false to disable it\n+ *\n+ * returns 0 if VSI is updated, negative otherwise\n+ */\n+static int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena)\n+{\n+\tstruct ice_vsi_ctx *ctxt;\n+\tstruct device *dev;\n+\tint status;\n+\n+\tif (!vsi)\n+\t\treturn -EINVAL;\n+\n+\tdev = &vsi->back->pdev->dev;\n+\tctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL);\n+\tif (!ctxt)\n+\t\treturn -ENOMEM;\n+\n+\tctxt->info = vsi->info;\n+\n+\tif (ena) {\n+\t\tctxt->info.sec_flags |=\n+\t\t\tICE_AQ_VSI_SEC_TX_VLAN_PRUNE_ENA <<\n+\t\t\tICE_AQ_VSI_SEC_TX_PRUNE_ENA_S;\n+\t\tctxt->info.sw_flags2 |= ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;\n+\t} else {\n+\t\tctxt->info.sec_flags &=\n+\t\t\t~(ICE_AQ_VSI_SEC_TX_VLAN_PRUNE_ENA <<\n+\t\t\t  ICE_AQ_VSI_SEC_TX_PRUNE_ENA_S);\n+\t\tctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;\n+\t}\n+\n+\tctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID |\n+\t\t\t\t\t\tICE_AQ_VSI_PROP_SW_VALID);\n+\tctxt->vsi_num = vsi->vsi_num;\n+\tstatus = ice_aq_update_vsi(&vsi->back->hw, ctxt, NULL);\n+\tif (status) {\n+\t\tnetdev_err(vsi->netdev, \"%sabling VLAN pruning on VSI %d failed, err = %d, aq_err = %d\\n\",\n+\t\t\t   ena ? \"Ena\" : \"Dis\", vsi->vsi_num, status,\n+\t\t\t   vsi->back->hw.adminq.sq_last_status);\n+\t\tgoto err_out;\n+\t}\n+\n+\tvsi->info.sec_flags = ctxt->info.sec_flags;\n+\tvsi->info.sw_flags2 = ctxt->info.sw_flags2;\n+\n+\tdevm_kfree(dev, ctxt);\n+\treturn 0;\n+\n+err_out:\n+\tdevm_kfree(dev, ctxt);\n+\treturn -EIO;\n+}\n+\n /**\n  * ice_vsi_sync_fltr - Update the VSI filter list to the HW\n  * @vsi: ptr to the VSI\n@@ -3126,7 +3183,7 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev,\n {\n \tstruct ice_netdev_priv *np = netdev_priv(netdev);\n \tstruct ice_vsi *vsi = np->vsi;\n-\tint ret = 0;\n+\tint ret;\n \n \tif (vid >= VLAN_N_VID) {\n \t\tnetdev_err(netdev, \"VLAN id requested %d is out of range %d\\n\",\n@@ -3137,6 +3194,13 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev,\n \tif (vsi->info.pvid)\n \t\treturn -EINVAL;\n \n+\t/* Enable VLAN pruning when VLAN 0 is added */\n+\tif (unlikely(!vid)) {\n+\t\tret = ice_cfg_vlan_pruning(vsi, true);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n \t/* Add all VLAN ids including 0 to the switch filter. VLAN id 0 is\n \t * needed to continue allowing all untagged packets since VLAN prune\n \t * list is applied to all packets by the switch\n@@ -3153,16 +3217,19 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev,\n  * ice_vsi_kill_vlan - Remove VSI membership for a given VLAN\n  * @vsi: the VSI being configured\n  * @vid: VLAN id to be removed\n+ *\n+ * Returns 0 on success and negative on failure\n  */\n-static void ice_vsi_kill_vlan(struct ice_vsi *vsi, u16 vid)\n+static int ice_vsi_kill_vlan(struct ice_vsi *vsi, u16 vid)\n {\n \tstruct ice_fltr_list_entry *list;\n \tstruct ice_pf *pf = vsi->back;\n \tLIST_HEAD(tmp_add_list);\n+\tint status = 0;\n \n \tlist = devm_kzalloc(&pf->pdev->dev, sizeof(*list), GFP_KERNEL);\n \tif (!list)\n-\t\treturn;\n+\t\treturn -ENOMEM;\n \n \tlist->fltr_info.lkup_type = ICE_SW_LKUP_VLAN;\n \tlist->fltr_info.fwd_id.vsi_id = vsi->vsi_num;\n@@ -3174,11 +3241,14 @@ static void ice_vsi_kill_vlan(struct ice_vsi *vsi, u16 vid)\n \tINIT_LIST_HEAD(&list->list_entry);\n \tlist_add(&list->list_entry, &tmp_add_list);\n \n-\tif (ice_remove_vlan(&pf->hw, &tmp_add_list))\n+\tif (ice_remove_vlan(&pf->hw, &tmp_add_list)) {\n \t\tdev_err(&pf->pdev->dev, \"Error removing VLAN %d on vsi %i\\n\",\n \t\t\tvid, vsi->vsi_num);\n+\t\tstatus = -EIO;\n+\t}\n \n \tice_free_fltr_list(&pf->pdev->dev, &tmp_add_list);\n+\treturn status;\n }\n \n /**\n@@ -3194,19 +3264,25 @@ static int ice_vlan_rx_kill_vid(struct net_device *netdev,\n {\n \tstruct ice_netdev_priv *np = netdev_priv(netdev);\n \tstruct ice_vsi *vsi = np->vsi;\n+\tint status;\n \n \tif (vsi->info.pvid)\n \t\treturn -EINVAL;\n \n-\t/* return code is ignored as there is nothing a user\n-\t * can do about failure to remove and a log message was\n-\t * already printed from the other function\n+\t/* Make sure ice_vsi_kill_vlan is successful before updating VLAN\n+\t * information\n \t */\n-\tice_vsi_kill_vlan(vsi, vid);\n+\tstatus = ice_vsi_kill_vlan(vsi, vid);\n+\tif (status)\n+\t\treturn status;\n \n \tclear_bit(vid, vsi->active_vlans);\n \n-\treturn 0;\n+\t/* Disable VLAN pruning when VLAN 0 is removed */\n+\tif (unlikely(!vid))\n+\t\tstatus = ice_cfg_vlan_pruning(vsi, false);\n+\n+\treturn status;\n }\n \n /**\n",
    "prefixes": [
        "v3",
        "13/15"
    ]
}