get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1086446,
    "url": "http://patchwork.ozlabs.org/api/patches/1086446/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190416172128.27184-12-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": "<20190416172128.27184-12-anirudh.venkataramanan@intel.com>",
    "list_archive_url": null,
    "date": "2019-04-16T17:21:24",
    "name": "[S18,11/15] ice: Add function to program ethertype based filter rule on VSIs",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "5de648dcec52ca361ad1f08875ba4c9dd79c7e56",
    "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/20190416172128.27184-12-anirudh.venkataramanan@intel.com/mbox/",
    "series": [
        {
            "id": 103105,
            "url": "http://patchwork.ozlabs.org/api/series/103105/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=103105",
            "date": "2019-04-16T17:21:13",
            "name": "Fixes and feature updates for ice",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/103105/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1086446/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1086446/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.137; helo=fraxinus.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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\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 44kBxy3LZhz9s00\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 17 Apr 2019 03:22:14 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 1753585F18;\n\tTue, 16 Apr 2019 17:22:13 +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 6-wIzkkOmxYR; Tue, 16 Apr 2019 17:22:09 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 8F79985ED2;\n\tTue, 16 Apr 2019 17:22:09 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id BFEB31BF28D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 16 Apr 2019 17:22:05 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id BB26F870FA\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 16 Apr 2019 17:22:05 +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 hgbOQPeJ3ar4 for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 16 Apr 2019 17:22:03 +0000 (UTC)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 88B19870B4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 16 Apr 2019 17:22:02 +0000 (UTC)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t16 Apr 2019 10:22:02 -0700",
            "from shasta.jf.intel.com ([10.166.244.191])\n\tby fmsmga006.fm.intel.com with ESMTP; 16 Apr 2019 10:22:02 -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.60,358,1549958400\"; d=\"scan'208\";a=\"338040576\"",
        "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Tue, 16 Apr 2019 10:21:24 -0700",
        "Message-Id": "<20190416172128.27184-12-anirudh.venkataramanan@intel.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20190416172128.27184-1-anirudh.venkataramanan@intel.com>",
        "References": "<20190416172128.27184-1-anirudh.venkataramanan@intel.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH S18 11/15] ice: Add function to program\n\tethertype based filter rule on VSIs",
        "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>",
        "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: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>\n\nThis patch adds function to program VSI with ethertype based filter rule,\nso that all flow control frames would be disallowed from being transmitted\nto the client, in order to prevent malicious VSI, especially VF from\nsending out PAUSE or PFC frames, and then control other VSIs traffic.\n\nSigned-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n[Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> cleaned up commit message]\n---\n drivers/net/ethernet/intel/ice/ice.h        |  2 +\n drivers/net/ethernet/intel/ice/ice_lib.c    | 55 +++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_switch.c | 59 +++++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_switch.h |  4 ++\n 4 files changed, 120 insertions(+)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h\nindex 6f970edf50c7..792e6e42030e 100644\n--- a/drivers/net/ethernet/intel/ice/ice.h\n+++ b/drivers/net/ethernet/intel/ice/ice.h\n@@ -255,6 +255,8 @@ struct ice_vsi {\n \n \ts16 vf_id;\t\t\t/* VF ID for SR-IOV VSIs */\n \n+\tu16 ethtype;\t\t\t/* Ethernet protocol for pause frame */\n+\n \t/* RSS config */\n \tu16 rss_table_size;\t/* HW RSS table size */\n \tu16 rss_size;\t\t/* Allocated RSS queues */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex 7a88bf639376..fbf1eba0cc2a 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -2250,6 +2250,46 @@ ice_vsi_set_q_vectors_reg_idx(struct ice_vsi *vsi)\n \treturn -EINVAL;\n }\n \n+/**\n+ * ice_vsi_add_rem_eth_mac - Program VSI ethertype based filter with rule\n+ * @vsi: the VSI being configured\n+ * @add_rule: boolean value to add or remove ethertype filter rule\n+ */\n+static void\n+ice_vsi_add_rem_eth_mac(struct ice_vsi *vsi, bool add_rule)\n+{\n+\tstruct ice_fltr_list_entry *list;\n+\tstruct ice_pf *pf = vsi->back;\n+\tLIST_HEAD(tmp_add_list);\n+\tenum ice_status status;\n+\n+\tlist = devm_kzalloc(&pf->pdev->dev, sizeof(*list), GFP_KERNEL);\n+\tif (!list)\n+\t\treturn;\n+\n+\tlist->fltr_info.lkup_type = ICE_SW_LKUP_ETHERTYPE;\n+\tlist->fltr_info.fltr_act = ICE_DROP_PACKET;\n+\tlist->fltr_info.flag = ICE_FLTR_TX;\n+\tlist->fltr_info.src_id = ICE_SRC_ID_VSI;\n+\tlist->fltr_info.vsi_handle = vsi->idx;\n+\tlist->fltr_info.l_data.ethertype_mac.ethertype = vsi->ethtype;\n+\n+\tINIT_LIST_HEAD(&list->list_entry);\n+\tlist_add(&list->list_entry, &tmp_add_list);\n+\n+\tif (add_rule)\n+\t\tstatus = ice_add_eth_mac(&pf->hw, &tmp_add_list);\n+\telse\n+\t\tstatus = ice_remove_eth_mac(&pf->hw, &tmp_add_list);\n+\n+\tif (status)\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"Failure Adding or Removing Ethertype on VSI %i error: %d\\n\",\n+\t\t\tvsi->vsi_num, status);\n+\n+\tice_free_fltr_list(&pf->pdev->dev, &tmp_add_list);\n+}\n+\n /**\n  * ice_vsi_setup - Set up a VSI by a given type\n  * @pf: board private structure\n@@ -2285,6 +2325,9 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,\n \n \tvsi->port_info = pi;\n \tvsi->vsw = pf->first_sw;\n+\tif (vsi->type == ICE_VSI_PF)\n+\t\tvsi->ethtype = ETH_P_PAUSE;\n+\n \tif (vsi->type == ICE_VSI_VF)\n \t\tvsi->vf_id = vf_id;\n \n@@ -2382,6 +2425,15 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,\n \t\tgoto unroll_vector_base;\n \t}\n \n+\t/* Add switch rule to drop all Tx Flow Control Frames, of look up\n+\t * type ETHERTYPE from VSIs, and restrict malicious VF from sending\n+\t * out PAUSE or PFC frames. If enabled, FW can still send FC frames.\n+\t * The rule is added once for PF VSI in order to create appropriate\n+\t * recipe, since VSI/VSI list is ignored with drop action...\n+\t */\n+\tif (vsi->type == ICE_VSI_PF)\n+\t\tice_vsi_add_rem_eth_mac(vsi, true);\n+\n \treturn vsi;\n \n unroll_vector_base:\n@@ -2740,6 +2792,9 @@ int ice_vsi_release(struct ice_vsi *vsi)\n \t\tpf->num_avail_hw_msix += pf->num_vf_msix;\n \t}\n \n+\tif (vsi->type == ICE_VSI_PF)\n+\t\tice_vsi_add_rem_eth_mac(vsi, false);\n+\n \tice_remove_vsi_fltr(&pf->hw, vsi->idx);\n \tice_rm_vsi_lan_cfg(vsi->port_info, vsi->idx);\n \tice_vsi_delete(vsi);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c\nindex b7975971403d..471003ba1e99 100644\n--- a/drivers/net/ethernet/intel/ice/ice_switch.c\n+++ b/drivers/net/ethernet/intel/ice/ice_switch.c\n@@ -1969,6 +1969,65 @@ ice_add_vlan(struct ice_hw *hw, struct list_head *v_list)\n \treturn 0;\n }\n \n+/**\n+ * ice_add_eth_mac - Add ethertype and MAC based filter rule\n+ * @hw: pointer to the hardware structure\n+ * @em_list: list of ether type MAC filter, MAC is optional\n+ */\n+enum ice_status\n+ice_add_eth_mac(struct ice_hw *hw, struct list_head *em_list)\n+{\n+\tstruct ice_fltr_list_entry *em_list_itr;\n+\n+\tif (!em_list || !hw)\n+\t\treturn ICE_ERR_PARAM;\n+\n+\tlist_for_each_entry(em_list_itr, em_list, list_entry) {\n+\t\tenum ice_sw_lkup_type l_type =\n+\t\t\tem_list_itr->fltr_info.lkup_type;\n+\n+\t\tif (l_type != ICE_SW_LKUP_ETHERTYPE_MAC &&\n+\t\t    l_type != ICE_SW_LKUP_ETHERTYPE)\n+\t\t\treturn ICE_ERR_PARAM;\n+\n+\t\tem_list_itr->fltr_info.flag = ICE_FLTR_TX;\n+\t\tem_list_itr->status = ice_add_rule_internal(hw, l_type,\n+\t\t\t\t\t\t\t    em_list_itr);\n+\t\tif (em_list_itr->status)\n+\t\t\treturn em_list_itr->status;\n+\t}\n+\treturn 0;\n+}\n+\n+/**\n+ * ice_remove_eth_mac - Remove an ethertype (or MAC) based filter rule\n+ * @hw: pointer to the hardware structure\n+ * @em_list: list of ethertype or ethertype MAC entries\n+ */\n+enum ice_status\n+ice_remove_eth_mac(struct ice_hw *hw, struct list_head *em_list)\n+{\n+\tstruct ice_fltr_list_entry *em_list_itr, *tmp;\n+\n+\tif (!em_list || !hw)\n+\t\treturn ICE_ERR_PARAM;\n+\n+\tlist_for_each_entry_safe(em_list_itr, tmp, em_list, list_entry) {\n+\t\tenum ice_sw_lkup_type l_type =\n+\t\t\tem_list_itr->fltr_info.lkup_type;\n+\n+\t\tif (l_type != ICE_SW_LKUP_ETHERTYPE_MAC &&\n+\t\t    l_type != ICE_SW_LKUP_ETHERTYPE)\n+\t\t\treturn ICE_ERR_PARAM;\n+\n+\t\tem_list_itr->status = ice_remove_rule_internal(hw, l_type,\n+\t\t\t\t\t\t\t       em_list_itr);\n+\t\tif (em_list_itr->status)\n+\t\t\treturn em_list_itr->status;\n+\t}\n+\treturn 0;\n+}\n+\n /**\n  * ice_rem_sw_rule_info\n  * @hw: pointer to the hardware structure\ndiff --git a/drivers/net/ethernet/intel/ice/ice_switch.h b/drivers/net/ethernet/intel/ice/ice_switch.h\nindex 88eb4be4d5a4..732b0b9b2e15 100644\n--- a/drivers/net/ethernet/intel/ice/ice_switch.h\n+++ b/drivers/net/ethernet/intel/ice/ice_switch.h\n@@ -218,6 +218,10 @@ enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw);\n enum ice_status ice_update_sw_rule_bridge_mode(struct ice_hw *hw);\n enum ice_status ice_add_mac(struct ice_hw *hw, struct list_head *m_lst);\n enum ice_status ice_remove_mac(struct ice_hw *hw, struct list_head *m_lst);\n+enum ice_status\n+ice_add_eth_mac(struct ice_hw *hw, struct list_head *em_list);\n+enum ice_status\n+ice_remove_eth_mac(struct ice_hw *hw, struct list_head *em_list);\n void ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_handle);\n enum ice_status\n ice_add_vlan(struct ice_hw *hw, struct list_head *m_list);\n",
    "prefixes": [
        "S18",
        "11/15"
    ]
}