Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/619522/?format=api
{ "id": 619522, "url": "http://patchwork.ozlabs.org/api/patches/619522/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20160507020951.3203.46579.stgit@terminator23.jf.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": "<20160507020951.3203.46579.stgit@terminator23.jf.intel.com>", "list_archive_url": null, "date": "2016-05-07T02:09:51", "name": "[v1,next-queue] net: ixgbe: Fix deleting link filters for cls_u32 offloads", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "60bbbc000c0fdd1e843479d755fa33b17b151f09", "submitter": { "id": 68504, "url": "http://patchwork.ozlabs.org/api/people/68504/?format=api", "name": "Nambiar, Amritha", "email": "amritha.nambiar@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/20160507020951.3203.46579.stgit@terminator23.jf.intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/619522/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/619522/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 hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id 3r1sqc5jBTz9t3w\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 7 May 2016 12:22:35 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id B0D1C946BC;\n\tSat, 7 May 2016 02:22:34 +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 PV68f8o0Dv6v; Sat, 7 May 2016 02:22:33 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 547B693618;\n\tSat, 7 May 2016 02:22:33 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 483971C0FA3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 7 May 2016 02:22:31 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 42FBD8C071\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 7 May 2016 02:22: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 k6oTnPXYpZwx for <intel-wired-lan@lists.osuosl.org>;\n\tSat, 7 May 2016 02:22:30 +0000 (UTC)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 4CA338B983\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 7 May 2016 02:22:30 +0000 (UTC)", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga102.fm.intel.com with ESMTP; 06 May 2016 19:22:29 -0700", "from terminator23.jf.intel.com ([10.166.46.76])\n\tby orsmga003.jf.intel.com with ESMTP; 06 May 2016 19:22: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-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.24,589,1455004800\"; d=\"scan'208\";a=\"800880948\"", "From": "Amritha Nambiar <amritha.nambiar@intel.com>", "To": "john.r.fastabend@intel.com, sridhar.samudrala@intel.com,\n\tintel-wired-lan@lists.osuosl.org, jeffrey.t.kirsher@intel.com,\n\tamritha.nambiar@intel.com", "Date": "Fri, 06 May 2016 19:09:51 -0700", "Message-ID": "<20160507020951.3203.46579.stgit@terminator23.jf.intel.com>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH] [v1,\n\tnext-queue] net: ixgbe: Fix deleting link filters for cls_u32\n\toffloads", "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>", "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": "On deleting filters which are links to a child hash table, the filters\nin the child hash table must be cleared from the hardware if there\nis no link between the parent and child hash table.\n\nVerified with the following filters:\n\n# tc qdisc add dev enp5s0f1 ingress\n# ethtool -K enp5s0f1 hw-tc-offload on\n\nCreate a child hash table:\n# tc filter add dev enp5s0f1 parent ffff: protocol ip prio 99 \\\n\thandle 1: u32 divisor 1\n\nLink to the child hash table from parent hash table:\n# tc filter add dev enp5s0f1 protocol ip parent ffff: prio 99 \\\n\thandle 800:0:10 u32 ht 800: link 1: \\\n\toffset at 0 mask 0f00 shift 6 plus 0 eat \\\n\tmatch ip protocol 6 ff match ip dst 15.0.0.1/32\n\nAdd filters into child hash table:\n# tc filter add dev enp5s0f1 parent ffff: protocol ip \\\n\thandle 1:0:2 u32 ht 1: \\\n\tmatch tcp src 22 ffff action drop\n# tc filter add dev enp5s0f1 parent ffff: protocol ip \\\n handle 1:0:3 u32 ht 1: \\\n match tcp src 33 ffff action drop\n\nDelete link filter from parent hash table:\n# tc filter del dev enp5s0f1 parent ffff: prio 99 \\\n\thandle 800:0:10 u32\n\nSigned-off-by: Amritha Nambiar <amritha.nambiar@intel.com>\n---\n drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 75 ++++++++++++++++++++++--\n drivers/net/ethernet/intel/ixgbe/ixgbe_model.h | 4 +\n 2 files changed, 72 insertions(+), 7 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\nindex 7bbf9b1..24a20ce 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c\n@@ -8308,14 +8308,50 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc)\n static int ixgbe_delete_clsu32(struct ixgbe_adapter *adapter,\n \t\t\t struct tc_cls_u32_offload *cls)\n {\n+\tu32 hdl = cls->knode.handle;\n \tu32 uhtid = TC_U32_USERHTID(cls->knode.handle);\n-\tu32 loc;\n-\tint err;\n+\tu32 loc = cls->knode.handle & 0xfffff;\n+\tint err = 0, i, j;\n+\tstruct ixgbe_jump_table *jump = NULL;\n+\n+\tif (loc > IXGBE_MAX_HW_ENTRIES)\n+\t\treturn -EINVAL;\n \n \tif ((uhtid != 0x800) && (uhtid >= IXGBE_MAX_LINK_HANDLE))\n \t\treturn -EINVAL;\n \n-\tloc = cls->knode.handle & 0xfffff;\n+\t/* Clear this filter in the link data it is associated with */\n+\tif (uhtid != 0x800) {\n+\t\tjump = adapter->jump_tables[uhtid];\n+\t\tif (jump)\n+\t\t\tclear_bit(loc - 1, jump->child_loc_map);\n+\t}\n+\n+\t/* Check if the filter being deleted is a link */\n+\tfor (i = 1; i < IXGBE_MAX_LINK_HANDLE; i++) {\n+\t\tjump = adapter->jump_tables[i];\n+\t\tif (jump && jump->link_hdl == hdl) {\n+\t\t\t/* Delete filters in the hardware in the child hash\n+\t\t\t * table associated with this link\n+\t\t\t */\n+\t\t\tfor (j = 0; j < IXGBE_MAX_HW_ENTRIES; j++) {\n+\t\t\t\tif (!test_bit(j, jump->child_loc_map))\n+\t\t\t\t\tcontinue;\n+\t\t\t\tspin_lock(&adapter->fdir_perfect_lock);\n+\t\t\t\terr = ixgbe_update_ethtool_fdir_entry(adapter,\n+\t\t\t\t\t\t\t\t NULL,\n+\t\t\t\t\t\t\t\t j + 1);\n+\t\t\t\tspin_unlock(&adapter->fdir_perfect_lock);\n+\t\t\t\tclear_bit(j, jump->child_loc_map);\n+\t\t\t}\n+\t\t\t/* Remove resources for this link */\n+\t\t\tkfree(jump->input);\n+\t\t\tkfree(jump->mask);\n+\t\t\tkfree(jump);\n+\t\t\tadapter->jump_tables[i] = NULL;\n+\t\t\treturn err;\n+\t\t}\n+\t}\n \n \tspin_lock(&adapter->fdir_perfect_lock);\n \terr = ixgbe_update_ethtool_fdir_entry(adapter, NULL, loc);\n@@ -8549,6 +8585,18 @@ static int ixgbe_configure_clsu32(struct ixgbe_adapter *adapter,\n \t\tif (!test_bit(link_uhtid - 1, &adapter->tables))\n \t\t\treturn err;\n \n+\t\t/* Multiple filters as links to the same hash table are not\n+\t\t * supported. To add a new filter with the same next header\n+\t\t * but different match/jump conditions, create a new hash table\n+\t\t * and link to it.\n+\t\t */\n+\t\tif (adapter->jump_tables[link_uhtid] &&\n+\t\t (adapter->jump_tables[link_uhtid])->link_hdl) {\n+\t\t\te_err(drv, \"Link filter exists for link: %x\\n\",\n+\t\t\t link_uhtid);\n+\t\t\treturn err;\n+\t\t}\n+\n \t\tfor (i = 0; nexthdr[i].jump; i++) {\n \t\t\tif (nexthdr[i].o != cls->knode.sel->offoff ||\n \t\t\t nexthdr[i].s != cls->knode.sel->offshift ||\n@@ -8566,10 +8614,12 @@ static int ixgbe_configure_clsu32(struct ixgbe_adapter *adapter,\n \t\t\tmask = kzalloc(sizeof(*mask), GFP_KERNEL);\n \t\t\tif (!mask) {\n \t\t\t\terr = -ENOMEM;\n-\t\t\t\tgoto free_input;\n+\t\t\t\tgoto err_out;\n \t\t\t}\n \t\t\tjump->input = input;\n \t\t\tjump->mask = mask;\n+\t\t\tjump->link_hdl = cls->knode.handle;\n+\n \t\t\terr = ixgbe_clsu32_build_input(input, mask, cls,\n \t\t\t\t\t\t field_ptr, &nexthdr[i]);\n \t\t\tif (!err) {\n@@ -8587,7 +8637,7 @@ static int ixgbe_configure_clsu32(struct ixgbe_adapter *adapter,\n \tmask = kzalloc(sizeof(*mask), GFP_KERNEL);\n \tif (!mask) {\n \t\terr = -ENOMEM;\n-\t\tgoto free_input;\n+\t\tgoto err_out;\n \t}\n \n \tif ((uhtid != 0x800) && (adapter->jump_tables[uhtid])) {\n@@ -8628,14 +8678,25 @@ static int ixgbe_configure_clsu32(struct ixgbe_adapter *adapter,\n \t\tixgbe_update_ethtool_fdir_entry(adapter, input, input->sw_idx);\n \tspin_unlock(&adapter->fdir_perfect_lock);\n \n+\tif ((uhtid != 0x800) && (adapter->jump_tables[uhtid])) {\n+\t\tstruct ixgbe_jump_table *link = adapter->jump_tables[uhtid];\n+\n+\t\tif (test_bit(loc - 1, link->child_loc_map)) {\n+\t\t\te_err(drv, \"Filter: %x exists in hash table: %x\\n\",\n+\t\t\t loc, uhtid);\n+\t\t\terr = -EINVAL;\n+\t\t\tgoto free_mask;\n+\t\t}\n+\t\tset_bit(loc - 1, link->child_loc_map);\n+\t}\n \tkfree(mask);\n \treturn err;\n err_out_w_lock:\n \tspin_unlock(&adapter->fdir_perfect_lock);\n err_out:\n-\tkfree(mask);\n-free_input:\n \tkfree(input);\n+free_mask:\n+\tkfree(mask);\n free_jump:\n \tkfree(jump);\n \treturn err;\ndiff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_model.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_model.h\nindex a8bed3d..538a1c54 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_model.h\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_model.h\n@@ -42,8 +42,12 @@ struct ixgbe_jump_table {\n \tstruct ixgbe_mat_field *mat;\n \tstruct ixgbe_fdir_filter *input;\n \tunion ixgbe_atr_input *mask;\n+\tu32 link_hdl;\n+\tunsigned long child_loc_map[32];\n };\n \n+#define IXGBE_MAX_HW_ENTRIES 2045\n+\n static inline int ixgbe_mat_prgm_sip(struct ixgbe_fdir_filter *input,\n \t\t\t\t union ixgbe_atr_input *mask,\n \t\t\t\t u32 val, u32 m)\n", "prefixes": [ "v1", "next-queue" ] }