Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/724786/?format=api
{ "id": 724786, "url": "http://patchwork.ozlabs.org/api/patches/724786/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170206223852.31177-5-jacob.e.keller@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": "<20170206223852.31177-5-jacob.e.keller@intel.com>", "list_archive_url": null, "date": "2017-02-06T22:38:47", "name": "[PART2,4/9] i40e: allow changing input set for ntuple filters", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "9dc569520f8e4d30c192823139db04300f1253fc", "submitter": { "id": 9784, "url": "http://patchwork.ozlabs.org/api/people/9784/?format=api", "name": "Jacob Keller", "email": "jacob.e.keller@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/20170206223852.31177-5-jacob.e.keller@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/724786/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/724786/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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\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 3vHMpY1Brfz9s1y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 7 Feb 2017 09:39:17 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id AC57430353;\n\tMon, 6 Feb 2017 22:39:15 +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 ZPhdPSJpRW6R; Mon, 6 Feb 2017 22:39:10 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 5387730A87;\n\tMon, 6 Feb 2017 22:39:02 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 101E51BFF07\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 6 Feb 2017 22:38:58 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 0F87B815B4\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 6 Feb 2017 22:38:58 +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 7oy7O31FmMiU for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 6 Feb 2017 22:38:55 +0000 (UTC)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 55129887E2\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 6 Feb 2017 22:38:55 +0000 (UTC)", "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga102.fm.intel.com with ESMTP; 06 Feb 2017 14:38:54 -0800", "from jekeller-desk.amr.corp.intel.com (HELO\n\tjekeller-desk.jekeller.internal) ([10.166.35.174])\n\tby fmsmga005.fm.intel.com with ESMTP; 06 Feb 2017 14:38:54 -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-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.33,342,1477983600\"; d=\"scan'208\";a=\"61907691\"", "From": "Jacob Keller <jacob.e.keller@intel.com>", "To": "Intel Wired LAN <intel-wired-lan@lists.osuosl.org>", "Date": "Mon, 6 Feb 2017 14:38:47 -0800", "Message-Id": "<20170206223852.31177-5-jacob.e.keller@intel.com>", "X-Mailer": "git-send-email 2.12.0.rc0.151.g8a5726c42288", "In-Reply-To": "<20170206223852.31177-1-jacob.e.keller@intel.com>", "References": "<20170206223852.31177-1-jacob.e.keller@intel.com>", "Subject": "[Intel-wired-lan] [PART2 PATCH 4/9] i40e: allow changing input set\n\tfor ntuple 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": "Add support to detect when we can update the input set for each flow\ntype.\n\nBecause the hardware only supports a single input set for all flows of\nthat matching type, the driver shall only allow the input set to change\nif there are no other configured filters for that flow type.\n\nThus, the first filter added for each flow type is allowed to change the\ninput set, and all future filters must match the same input set. Display\na diagnostic message whenever the filter input set changes, and\na warning whenever a filter cannot be accepted because it does not match\nthe configured input set.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\nChange-Id: c22e1c267ae37518bb036aca4a5694681449f283\n---\n drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 148 ++++++++++++++++++++++++-\n 1 file changed, 145 insertions(+), 3 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\nindex 5a7718e67c0a..595ede664c56 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c\n@@ -2718,12 +2718,108 @@ static int i40e_del_fdir_entry(struct i40e_vsi *vsi,\n \treturn ret;\n }\n \n+/**\n+ * i40e_flow_str - Converts a flow_type into a human readable string\n+ * @flow_type: the flow type from a flow specification\n+ *\n+ * Currently only flow types we support are included here, and the string\n+ * value attempts to match what ethtool would use to configure this flow type.\n+ **/\n+static const char *i40e_flow_str(struct ethtool_rx_flow_spec *fsp)\n+{\n+\tswitch (fsp->flow_type & ~FLOW_EXT) {\n+\tcase TCP_V4_FLOW:\n+\t\treturn \"tcp4\";\n+\tcase UDP_V4_FLOW:\n+\t\treturn \"udp4\";\n+\tcase SCTP_V4_FLOW:\n+\t\treturn \"sctp4\";\n+\tcase IP_USER_FLOW:\n+\t\treturn \"ip4\";\n+\tdefault:\n+\t\treturn \"unknown\";\n+\t}\n+}\n+\n+/**\n+ * i40e_print_input_set - Show changes between two input sets\n+ * @vsi: the vsi being configured\n+ * @old: the old input set\n+ * @new: the new input set\n+ *\n+ * Print the difference between old and new input sets by showing which series\n+ * of words are toggled on or off. Only displays the bits we actually support\n+ * changing.\n+ **/\n+static void i40e_print_input_set(struct i40e_vsi *vsi, u64 old, u64 new)\n+{\n+\tstruct i40e_pf *pf = vsi->back;\n+\tbool old_value, new_value;\n+\n+\told_value = !!(old & I40E_L3_SRC_MASK);\n+\tnew_value = !!(new & I40E_L3_SRC_MASK);\n+\tif (old_value != new_value)\n+\t\tnetif_info(pf, drv, vsi->netdev, \"L3 source address: %s -> %s\\n\",\n+\t\t\t old_value ? \"ON\" : \"OFF\",\n+\t\t\t new_value ? \"ON\" : \"OFF\");\n+\n+\told_value = !!(old & I40E_L3_DST_MASK);\n+\tnew_value = !!(new & I40E_L3_DST_MASK);\n+\tif (old_value != new_value)\n+\t\tnetif_info(pf, drv, vsi->netdev, \"L3 destination address: %s -> %s\\n\",\n+\t\t\t old_value ? \"ON\" : \"OFF\",\n+\t\t\t new_value ? \"ON\" : \"OFF\");\n+\n+\told_value = !!(old & I40E_L4_SRC_MASK);\n+\tnew_value = !!(new & I40E_L4_SRC_MASK);\n+\tif (old_value != new_value)\n+\t\tnetif_info(pf, drv, vsi->netdev, \"L4 source port: %s -> %s\\n\",\n+\t\t\t old_value ? \"ON\" : \"OFF\",\n+\t\t\t new_value ? \"ON\" : \"OFF\");\n+\n+\told_value = !!(old & I40E_L4_DST_MASK);\n+\tnew_value = !!(new & I40E_L4_DST_MASK);\n+\tif (old_value != new_value)\n+\t\tnetif_info(pf, drv, vsi->netdev, \"L4 destination port: %s -> %s\\n\",\n+\t\t\t old_value ? \"ON\" : \"OFF\",\n+\t\t\t new_value ? \"ON\" : \"OFF\");\n+\n+\told_value = !!(old & I40E_VERIFY_TAG_MASK);\n+\tnew_value = !!(new & I40E_VERIFY_TAG_MASK);\n+\tif (old_value != new_value)\n+\t\tnetif_info(pf, drv, vsi->netdev, \"SCTP verification tag: %s -> %s\\n\",\n+\t\t\t old_value ? \"ON\" : \"OFF\",\n+\t\t\t new_value ? \"ON\" : \"OFF\");\n+\n+\tnetif_info(pf, drv, vsi->netdev, \" Current input set: %0llx\\n\",\n+\t\t old);\n+\tnetif_info(pf, drv, vsi->netdev, \"Requested input set: %0llx\\n\",\n+\t\t new);\n+}\n+\n /**\n * i40e_check_fdir_input_set - Check that a given rx_flow_spec mask is valid\n * @vsi: pointer to the targeted VSI\n * @fsp: pointer to Rx flow specification\n *\n- * Ensures that a given ethtool_rx_flow_spec has a valid mask.\n+ * Ensures that a given ethtool_rx_flow_spec has a valid mask. Some support\n+ * for partial matches exists with a few limitations. First, hardware only\n+ * supports masking by word boundary (2 bytes) and not per individual bit.\n+ * Second, hardware is limited to using one mask for a flow type and cannot\n+ * use a separate mask for each filter.\n+ *\n+ * To support these limitations, if we already have a configured filter for\n+ * the specified type, this function enforces that new filters of the type\n+ * match the configured input set. Otherwise, if we do not have a filter of\n+ * the specified type, we allow the input set to be updated to match the\n+ * desired filter.\n+ *\n+ * To help ensure that administrators understand why filters weren't displayed\n+ * as supported, we print a diagnostic message displaying how the input set\n+ * would change and warning to delete the preexisting filters if required.\n+ *\n+ * Returns 0 on successful input set match, and a negative return code on\n+ * failure.\n **/\n static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,\n \t\t\t\t struct ethtool_rx_flow_spec *fsp)\n@@ -2732,17 +2828,21 @@ static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,\n \tstruct ethtool_tcpip4_spec *tcp_ip4_spec;\n \tstruct ethtool_usrip4_spec *usr_ip4_spec;\n \tu64 current_mask, new_mask;\n+\tu16 *fdir_filter_count;\n \tu16 index;\n \n \tswitch (fsp->flow_type & ~FLOW_EXT) {\n \tcase TCP_V4_FLOW:\n \t\tindex = I40E_FILTER_PCTYPE_NONF_IPV4_TCP;\n+\t\tfdir_filter_count = &pf->fd_tcp4_filter_cnt;\n \t\tbreak;\n \tcase UDP_V4_FLOW:\n \t\tindex = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;\n+\t\tfdir_filter_count = &pf->fd_udp4_filter_cnt;\n \t\tbreak;\n \tcase IP_USER_FLOW:\n \t\tindex = I40E_FILTER_PCTYPE_NONF_IPV4_OTHER;\n+\t\tfdir_filter_count = &pf->fd_ip4_filter_cnt;\n \t\tbreak;\n \tdefault:\n \t\treturn -EOPNOTSUPP;\n@@ -2752,7 +2852,15 @@ static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,\n \tcurrent_mask = i40e_read_fd_input_set(pf, index);\n \tnew_mask = current_mask;\n \n-\t/* Verify the provided mask is valid. */\n+\t/* Determine, if any, the required changes to the input set in order\n+\t * to support the provided mask.\n+\t *\n+\t * Hardware only supports masking at word (2 byte) granularity and does\n+\t * not support full bitwise masking. This implementation simplifies\n+\t * even further and only supports fully enabled or fully disabled\n+\t * masks for each field, even though we could split the ip4src and\n+\t * ip4dst fields.\n+\t */\n \tswitch (fsp->flow_type & ~FLOW_EXT) {\n \tcase TCP_V4_FLOW:\n \tcase UDP_V4_FLOW:\n@@ -2839,8 +2947,42 @@ static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,\n \t\treturn -EOPNOTSUPP;\n \t}\n \n-\tif (new_mask != current_mask)\n+\t/* If the input set doesn't need any changes then this filter is safe\n+\t * to apply.\n+\t */\n+\tif (new_mask == current_mask)\n+\t\treturn 0;\n+\n+\tnetif_info(pf, drv, vsi->netdev, \"Input set change requested for %s flows:\\n\",\n+\t\t i40e_flow_str(fsp));\n+\ti40e_print_input_set(vsi, current_mask, new_mask);\n+\n+\t/* Hardware input sets are global across multiple ports, so even the\n+\t * main port cannot change them when in MFP mode as this would impact\n+\t * any filters on the other ports.\n+\t */\n+\tif (pf->flags & I40E_FLAG_MFP_ENABLED) {\n+\t\tnetif_err(pf, drv, vsi->netdev, \"Cannot change Flow Director input sets while MFP is enabled\\n\");\n \t\treturn -EOPNOTSUPP;\n+\t}\n+\n+\t/* This filter requires us to update the input set. However, hardware\n+\t * only supports one input set per flow type, and does not support\n+\t * separate masks for each filter. This means that we can only support\n+\t * a single mask for all filters of a specific type.\n+\t *\n+\t * If we have preexisting filters, they obviously depend on the\n+\t * current programmed input set. Display a diagnostic message in this\n+\t * case explaining why the filter could not be accepted.\n+\t */\n+\tif (*fdir_filter_count) {\n+\t\tnetif_err(pf, drv, vsi->netdev, \"Cannot change input set for %s flows until %d preexisting filters are removed\\n\",\n+\t\t\t i40e_flow_str(fsp),\n+\t\t\t *fdir_filter_count);\n+\t\treturn -EOPNOTSUPP;\n+\t}\n+\n+\ti40e_write_fd_input_set(pf, index, new_mask);\n \n \treturn 0;\n }\n", "prefixes": [ "PART2", "4/9" ] }