Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/853260/?format=api
{ "id": 853260, "url": "http://patchwork.ozlabs.org/api/patches/853260/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20171227132532.24219-1-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": "<20171227132532.24219-1-alice.michael@intel.com>", "list_archive_url": null, "date": "2017-12-27T13:25:32", "name": "[next,S84-V2,12/13] i40e: disallow programming multiple filters with same criteria", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "86b4630b0afaa6bfab94c3957c18713449220bce", "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/20171227132532.24219-1-alice.michael@intel.com/mbox/", "series": [ { "id": 20419, "url": "http://patchwork.ozlabs.org/api/series/20419/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=20419", "date": "2017-12-27T13:25:32", "name": null, "version": 1, "mbox": "http://patchwork.ozlabs.org/series/20419/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/853260/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/853260/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>)", "Received": [ "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\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 3z6R0210y2z9s71\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 28 Dec 2017 08:32:34 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id F3E5F86DC4;\n\tWed, 27 Dec 2017 21:32:31 +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 X0Gvj7yv4cbf; Wed, 27 Dec 2017 21:32:29 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 5756086DB4;\n\tWed, 27 Dec 2017 21:32:29 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 94B591BFC4F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 27 Dec 2017 21:32:28 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 911E486FFB\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 27 Dec 2017 21:32:28 +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 LnabMM4YplCG for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 27 Dec 2017 21:32:28 +0000 (UTC)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id E9A0286FC7\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 27 Dec 2017 21:32:27 +0000 (UTC)", "from orsmga005.jf.intel.com ([10.7.209.41])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Dec 2017 13:32:27 -0800", "from alicemic-2.jf.intel.com ([10.166.16.121])\n\tby orsmga005.jf.intel.com with ESMTP; 27 Dec 2017 13:32:27 -0800" ], "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.45,467,1508828400\"; d=\"scan'208\";a=\"187521870\"", "From": "Alice Michael <alice.michael@intel.com>", "To": "alice.michael@intel.com,\n\tintel-wired-lan@lists.osuosl.org", "Date": "Wed, 27 Dec 2017 08:25:32 -0500", "Message-Id": "<20171227132532.24219-1-alice.michael@intel.com>", "X-Mailer": "git-send-email 2.9.5", "Subject": "[Intel-wired-lan] [next PATCH S84-V2 12/13] i40e: disallow\n\tprogramming multiple filters with same criteria", "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: Jacob Keller <jacob.e.keller@intel.com>\n\nOur hardware does not allow situations where two filters might conflict\nwhen matching. Essentially hardware only programs one filter for each\nset of matching criteria. We don't support filters with overlapping\ninput sets, because each flow type can only use a single input set.\n\nAdditionally, different flow types will never have overlapping matches,\nbecause of how the hardware parses the flow type before checking\nmatching criteria.\n\nFor this reason, we do not need or use the location number when\nprogramming filters to hardware.\n\nIn order to avoid confusing scenarios with filters that match the same\ncriteria but program the flow to different queues, do not allow multiple\nfilters that match identical criteria to be programmed.\n\nThis ensures that we avoid odd scenarios when deleting filters, and when\nprogramming new filters that match the same criteria.\n\nInstead, users that wish to update the criteria for a filter must use\nthe same location id, or must delete all the matching filters first.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 87 ++++++++++++++++++++++++++\n 1 file changed, 87 insertions(+)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\nindex 9f6e4f0..83021c7 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n@@ -3841,6 +3841,87 @@ static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,\n }\n \n /**\n+ * i40e_match_fdir_filter - Return true of two filters match\n+ * @a: pointer to filter struct\n+ * @b: pointer to filter struct\n+ *\n+ * Returns true if the two filters match exactly the same criteria. I.e. they\n+ * match the same flow type and have the same parameters. We don't need to\n+ * check any input-set since all filters of the same flow type must use the\n+ * same input set.\n+ **/\n+static bool i40e_match_fdir_filter(struct i40e_fdir_filter *a,\n+\t\t\t\t struct i40e_fdir_filter *b)\n+{\n+\t/* The filters do not much if any of these criteria differ. */\n+\tif (a->dst_ip != b->dst_ip ||\n+\t a->src_ip != b->src_ip ||\n+\t a->dst_port != b->dst_port ||\n+\t a->src_port != b->src_port ||\n+\t a->flow_type != b->flow_type ||\n+\t a->ip4_proto != b->ip4_proto)\n+\t\treturn false;\n+\n+\treturn true;\n+}\n+\n+/**\n+ * i40e_disallow_matching_filters - Check that new filters differ\n+ * @vsi: pointer to the targeted VSI\n+ * @input: new filter to check\n+ *\n+ * Due to hardware limitations, it is not possible for two filters that match\n+ * similar criteria to be programmed at the same time. This is true for a few\n+ * reasons:\n+ *\n+ * (a) all filters matching a particular flow type must use the same input\n+ * set, that is they must match the same criteria.\n+ * (b) different flow types will never match the same packet, as the flow type\n+ * is decided by hardware before checking which rules apply.\n+ * (c) hardware has no way to distinguish which order filters apply in.\n+ *\n+ * Due to this, we can't really support using the location data to order\n+ * filters in the hardware parsing. It is technically possible for the user to\n+ * request two filters matching the same criteria but which select different\n+ * queues. In this case, rather than keep both filters in the list, we reject\n+ * the 2nd filter when the user requests adding it.\n+ *\n+ * This avoids needing to track location for programming the filter to\n+ * hardware, and ensures that we avoid some strange scenarios involving\n+ * deleting filters which match the same criteria.\n+ **/\n+static int i40e_disallow_matching_filters(struct i40e_vsi *vsi,\n+\t\t\t\t\t struct i40e_fdir_filter *input)\n+{\n+\tstruct i40e_pf *pf = vsi->back;\n+\tstruct i40e_fdir_filter *rule;\n+\tstruct hlist_node *node2;\n+\n+\t/* Loop through every filter, and check that it doesn't match */\n+\thlist_for_each_entry_safe(rule, node2,\n+\t\t\t\t &pf->fdir_filter_list, fdir_node) {\n+\t\t/* Don't check the filters match if they share the same fd_id,\n+\t\t * since the new filter is actually just updating the target\n+\t\t * of the old filter.\n+\t\t */\n+\t\tif (rule->fd_id == input->fd_id)\n+\t\t\tcontinue;\n+\n+\t\t/* If any filters match, then print a warning message to the\n+\t\t * kernel message buffer and bail out.\n+\t\t */\n+\t\tif (i40e_match_fdir_filter(rule, input)) {\n+\t\t\tdev_warn(&pf->pdev->dev,\n+\t\t\t\t \"Existing user defined filter %d already matches this flow.\\n\",\n+\t\t\t\t rule->fd_id);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/**\n * i40e_add_fdir_ethtool - Add/Remove Flow Director filters\n * @vsi: pointer to the targeted VSI\n * @cmd: command to get or set RX flow classification rules\n@@ -3952,6 +4033,11 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,\n \t\tinput->flex_offset = userdef.flex_offset;\n \t}\n \n+\t/* Avoid programming two filters with identical match criteria. */\n+\tret = i40e_disallow_matching_filters(vsi, input);\n+\tif (ret)\n+\t\tgoto free_filter_memory;\n+\n \t/* Add the input filter to the fdir_input_list, possibly replacing\n \t * a previous filter. Do not free the input structure after adding it\n \t * to the list as this would cause a use-after-free bug.\n@@ -3965,6 +4051,7 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,\n remove_sw_rule:\n \thlist_del(&input->fdir_node);\n \tpf->fdir_pf_active_filters--;\n+free_filter_memory:\n \tkfree(input);\n \treturn ret;\n }\n", "prefixes": [ "next", "S84-V2", "12/13" ] }