get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1165385,
    "url": "http://patchwork.ozlabs.org/api/patches/1165385/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190920091724.51767-10-alice.michael@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": "<20190920091724.51767-10-alice.michael@intel.com>",
    "list_archive_url": null,
    "date": "2019-09-20T09:17:24",
    "name": "[next,S10,10/10] i40e: Refactoring VF MAC filters counting to make more reliable",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ddd56640cfcccac3d0fcef063c2cf5ce7367d92e",
    "submitter": {
        "id": 71123,
        "url": "http://patchwork.ozlabs.org/api/people/71123/?format=api",
        "name": "Michael, Alice",
        "email": "alice.michael@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/20190920091724.51767-10-alice.michael@intel.com/mbox/",
    "series": [
        {
            "id": 131821,
            "url": "http://patchwork.ozlabs.org/api/series/131821/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=131821",
            "date": "2019-09-20T09:17:15",
            "name": "[next,S10,01/10] i40e: Fix for persistent lldp support",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/131821/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1165385/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1165385/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 ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 46Zgw41RgWz9sNf\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 21 Sep 2019 03:40:04 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id CB79187C89;\n\tFri, 20 Sep 2019 17:40:01 +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 fbru3rUZTeXD; Fri, 20 Sep 2019 17:40:00 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 108DE87F8E;\n\tFri, 20 Sep 2019 17:39:59 +0000 (UTC)",
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id A6CC41BF2C6\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Sep 2019 17:39:54 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id A3E4320401\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Sep 2019 17:39:54 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id YxIyFC6kW3Rs for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Sep 2019 17:39:53 +0000 (UTC)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 7657820419\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Sep 2019 17:39:53 +0000 (UTC)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t20 Sep 2019 10:39:52 -0700",
            "from alicemic-1.jf.intel.com ([10.166.17.62])\n\tby fmsmga004.fm.intel.com with ESMTP; 20 Sep 2019 10:39:52 -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.64,529,1559545200\"; d=\"scan'208\";a=\"212635347\"",
        "From": "Alice Michael <alice.michael@intel.com>",
        "To": "alice.michael@intel.com,\n\tintel-wired-lan@lists.osuosl.org",
        "Date": "Fri, 20 Sep 2019 02:17:24 -0700",
        "Message-Id": "<20190920091724.51767-10-alice.michael@intel.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190920091724.51767-1-alice.michael@intel.com>",
        "References": "<20190920091724.51767-1-alice.michael@intel.com>",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [next PATCH S10 10/10] i40e: Refactoring VF MAC\n\tfilters counting to make more reliable",
        "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": "Aleksandr Loktionov <aleksandr.loktionov@intel.com>",
        "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: Aleksandr Loktionov <aleksandr.loktionov@intel.com>\n\nThis patch prepares ground for the next VF MAC address change fix.\nIt lets untrusted VF to delete any VF mac filter, but it still\ndoesn't let untrusted VF to add mac filter not setup by PF.\nIt removes information duplication in num_mac mac filters counter.\nAnd improves exact h/w mac filters usage checking in the\ni40e_check_vf_permission() function by counting mac2add_cnt.\nIt also improves logging because now all mac addresses will be validated\nfirst and corresponding messages will be logged.\n\nSigned-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e.h        |  1 +\n drivers/net/ethernet/intel/i40e/i40e_main.c   | 19 ++++++++\n .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 45 ++++++++-----------\n .../ethernet/intel/i40e/i40e_virtchnl_pf.h    |  1 -\n 4 files changed, 39 insertions(+), 27 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h\nindex 2af9f6308f84..cb6367334ca7 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e.h\n@@ -1118,6 +1118,7 @@ struct i40e_mac_filter *i40e_add_mac_filter(struct i40e_vsi *vsi,\n \t\t\t\t\t    const u8 *macaddr);\n int i40e_del_mac_filter(struct i40e_vsi *vsi, const u8 *macaddr);\n bool i40e_is_vsi_in_vlan(struct i40e_vsi *vsi);\n+int i40e_count_filters(struct i40e_vsi *vsi);\n struct i40e_mac_filter *i40e_find_mac(struct i40e_vsi *vsi, const u8 *macaddr);\n void i40e_vlan_stripping_enable(struct i40e_vsi *vsi);\n #ifdef CONFIG_I40E_DCB\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 22394da6cb94..495389a28ed4 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -1109,6 +1109,25 @@ void i40e_update_stats(struct i40e_vsi *vsi)\n \ti40e_update_vsi_stats(vsi);\n }\n \n+/**\n+ * i40e_count_filters - counts VSI mac filters\n+ * @vsi: the VSI to be searched\n+ *\n+ * Returns count of mac filters\n+ **/\n+int i40e_count_filters(struct i40e_vsi *vsi)\n+{\n+\tstruct i40e_mac_filter *f;\n+\tstruct hlist_node *h;\n+\tint bkt;\n+\tint cnt = 0;\n+\n+\thash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist)\n+\t\t++cnt;\n+\n+\treturn cnt;\n+}\n+\n /**\n  * i40e_find_filter - Search VSI filter list for specific mac/vlan filter\n  * @vsi: the VSI to be searched\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\nindex 134bf4e37156..7787766d0eb8 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c\n@@ -955,7 +955,6 @@ static void i40e_free_vf_res(struct i40e_vf *vf)\n \t\ti40e_vsi_release(pf->vsi[vf->lan_vsi_idx]);\n \t\tvf->lan_vsi_idx = 0;\n \t\tvf->lan_vsi_id = 0;\n-\t\tvf->num_mac = 0;\n \t}\n \n \t/* do the accounting and remove additional ADq VSI's */\n@@ -2548,20 +2547,12 @@ static inline int i40e_check_vf_permission(struct i40e_vf *vf,\n \t\t\t\t\t   struct virtchnl_ether_addr_list *al)\n {\n \tstruct i40e_pf *pf = vf->pf;\n+\tstruct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx];\n+\tint mac2add_cnt = 0;\n \tint i;\n \n-\t/* If this VF is not privileged, then we can't add more than a limited\n-\t * number of addresses. Check to make sure that the additions do not\n-\t * push us over the limit.\n-\t */\n-\tif (!test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) &&\n-\t    (vf->num_mac + al->num_elements) > I40E_VC_MAX_MAC_ADDR_PER_VF) {\n-\t\tdev_err(&pf->pdev->dev,\n-\t\t\t\"Cannot add more MAC addresses, VF is not trusted, switch the VF to trusted to add more functionality\\n\");\n-\t\treturn -EPERM;\n-\t}\n-\n \tfor (i = 0; i < al->num_elements; i++) {\n+\t\tstruct i40e_mac_filter *f;\n \t\tu8 *addr = al->list[i].addr;\n \n \t\tif (is_broadcast_ether_addr(addr) ||\n@@ -2585,8 +2576,24 @@ static inline int i40e_check_vf_permission(struct i40e_vf *vf,\n \t\t\t\t\"VF attempting to override administratively set MAC address, bring down and up the VF interface to resume normal operation\\n\");\n \t\t\treturn -EPERM;\n \t\t}\n+\n+\t\t/*count filters that really will be added*/\n+\t\tf = i40e_find_mac(vsi, addr);\n+\t\tif (!f)\n+\t\t\t++mac2add_cnt;\n \t}\n \n+\t/* If this VF is not privileged, then we can't add more than a limited\n+\t * number of addresses. Check to make sure that the additions do not\n+\t * push us over the limit.\n+\t */\n+\tif (!test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps) &&\n+\t    (i40e_count_filters(vsi) + mac2add_cnt) >\n+\t\t    I40E_VC_MAX_MAC_ADDR_PER_VF) {\n+\t\tdev_err(&pf->pdev->dev,\n+\t\t\t\"Cannot add more MAC addresses, VF is not trusted, switch the VF to trusted to add more functionality\\n\");\n+\t\treturn -EPERM;\n+\t}\n \treturn 0;\n }\n \n@@ -2640,8 +2647,6 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg)\n \t\t\t\tret = I40E_ERR_PARAM;\n \t\t\t\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n \t\t\t\tgoto error_param;\n-\t\t\t} else {\n-\t\t\t\tvf->num_mac++;\n \t\t\t}\n \t\t\tif (is_valid_ether_addr(al->list[i].addr))\n \t\t\t\tether_addr_copy(vf->default_lan_addr.addr,\n@@ -2692,16 +2697,6 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg)\n \t\t\tret = I40E_ERR_INVALID_MAC_ADDR;\n \t\t\tgoto error_param;\n \t\t}\n-\n-\t\tif (vf->pf_set_mac &&\n-\t\t    ether_addr_equal(al->list[i].addr,\n-\t\t\t\t     vf->default_lan_addr.addr)) {\n-\t\t\tdev_err(&pf->pdev->dev,\n-\t\t\t\t\"MAC addr %pM has been set by PF, cannot delete it for VF %d, reset VF to change MAC addr\\n\",\n-\t\t\t\tvf->default_lan_addr.addr, vf->vf_id);\n-\t\t\tret = I40E_ERR_PARAM;\n-\t\t\tgoto error_param;\n-\t\t}\n \t}\n \tvsi = pf->vsi[vf->lan_vsi_idx];\n \n@@ -2712,8 +2707,6 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg)\n \t\t\tret = I40E_ERR_INVALID_MAC_ADDR;\n \t\t\tspin_unlock_bh(&vsi->mac_filter_hash_lock);\n \t\t\tgoto error_param;\n-\t\t} else {\n-\t\t\tvf->num_mac--;\n \t\t}\n \n \tspin_unlock_bh(&vsi->mac_filter_hash_lock);\ndiff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\nindex 7164b9bb294f..1ce06240a702 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\n+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h\n@@ -101,7 +101,6 @@ struct i40e_vf {\n \tbool link_up;\t\t/* only valid if VF link is forced */\n \tbool queues_enabled;\t/* true if the VF queues are enabled */\n \tbool spoofchk;\n-\tu16 num_mac;\n \tu16 num_vlan;\n \n \t/* ADq related variables */\n",
    "prefixes": [
        "next",
        "S10",
        "10/10"
    ]
}