Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806214/?format=api
{ "id": 806214, "url": "http://patchwork.ozlabs.org/api/patches/806214/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170827110618.20599-5-saeedm@mellanox.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170827110618.20599-5-saeedm@mellanox.com>", "list_archive_url": null, "date": "2017-08-27T11:06:18", "name": "[net-next,4/4] net/mlx5e: E-switch, Add steering drop counters", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "b2ae8f1c8837a97bf257187fe0632d83931c8ca9", "submitter": { "id": 65299, "url": "http://patchwork.ozlabs.org/api/people/65299/?format=api", "name": "Saeed Mahameed", "email": "saeedm@mellanox.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170827110618.20599-5-saeedm@mellanox.com/mbox/", "series": [ { "id": 10, "url": "http://patchwork.ozlabs.org/api/series/10/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=10", "date": "2017-08-27T11:06:14", "name": "SRIOV VF VGT+ and violation counters support", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/10/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/806214/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806214/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xgCCg68Cmz9s7v\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSun, 27 Aug 2017 21:21:51 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751324AbdH0LVo (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSun, 27 Aug 2017 07:21:44 -0400", "from mail-il-dmz.mellanox.com ([193.47.165.129]:37295 \"EHLO\n\tmellanox.co.il\" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org\n\twith ESMTP id S1751135AbdH0LV3 (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Sun, 27 Aug 2017 07:21:29 -0400", "from Internal Mail-Server by MTLPINE2 (envelope-from\n\tsaeedm@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 27 Aug 2017 14:21:25 +0300", "from sws.mtl.labs.mlnx (reg-l-vrt-045-015.mtl.labs.mlnx\n\t[10.135.45.15])\n\tby labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v7RBLOYE028221;\n\tSun, 27 Aug 2017 14:21:24 +0300" ], "From": "Saeed Mahameed <saeedm@mellanox.com>", "To": "\"David S. Miller\" <davem@davemloft.net>", "Cc": "netdev@vger.kernel.org, Eugenia Emantayev <eugenia@mellanox.com>,\n\tSaeed Mahameed <saeedm@mellanox.com>", "Subject": "[PATCH net-next 4/4] net/mlx5e: E-switch, Add steering drop counters", "Date": "Sun, 27 Aug 2017 14:06:18 +0300", "Message-Id": "<20170827110618.20599-5-saeedm@mellanox.com>", "X-Mailer": "git-send-email 2.13.0", "In-Reply-To": "<20170827110618.20599-1-saeedm@mellanox.com>", "References": "<20170827110618.20599-1-saeedm@mellanox.com>", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "From: Eugenia Emantayev <eugenia@mellanox.com>\n\nAdd flow counters to count packets dropped due to drop rules\nconfigured in eswitch egress and ingress ACLs.\nThese counters will count VFs violations and incoming traffic drops.\nWill be presented on hypervisor via standard 'ip -s link show' command.\n\nExample: \"ip -s link show dev enp5s0f0\"\n\n6: enp5s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000\n link/ether 24:8a:07:a5:28:f0 brd ff:ff:ff:ff:ff:ff\n RX: bytes packets errors dropped overrun mcast\n 0 0 0 0 0 2\n TX: bytes packets errors dropped carrier collsns\n 1406 17 0 0 0 0\n vf 0 MAC 00:00:ca:fe:ca:fe, vlan 5, spoof checking off, link-state auto, trust off, query_rss off\n RX: bytes packets mcast bcast dropped\n 1666 29 14 32 0\n TX: bytes packets dropped\n 2880 44 2412\n\nSigned-off-by: Eugenia Emantayev <eugenia@mellanox.com>\nSigned-off-by: Saeed Mahameed <saeedm@mellanox.com>\n---\n drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 97 ++++++++++++++++++++--\n drivers/net/ethernet/mellanox/mlx5/core/fs_core.h | 2 +\n .../net/ethernet/mellanox/mlx5/core/fs_counters.c | 6 ++\n 3 files changed, 98 insertions(+), 7 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c\nindex a8e8670c7c8d..6c992e43e397 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c\n@@ -37,6 +37,7 @@\n #include <linux/mlx5/fs.h>\n #include \"mlx5_core.h\"\n #include \"eswitch.h\"\n+#include \"fs_core.h\"\n \n #define UPLINK_VPORT 0xFFFF\n \n@@ -1007,8 +1008,14 @@ static void esw_vport_cleanup_egress_rules(struct mlx5_eswitch *esw,\n \t\tkfree(trunk_vlan_rule);\n \t}\n \n-\tif (!IS_ERR_OR_NULL(vport->egress.drop_rule))\n+\tif (!IS_ERR_OR_NULL(vport->egress.drop_rule)) {\n+\t\tstruct mlx5_fc *drop_counter =\n+\t\t\tmlx5_flow_rule_counter(vport->egress.drop_rule);\n+\n \t\tmlx5_del_flow_rules(vport->egress.drop_rule);\n+\t\tif (drop_counter)\n+\t\t\tmlx5_fc_destroy(vport->dev, drop_counter);\n+\t}\n \n \tif (!IS_ERR_OR_NULL(vport->egress.allow_untagged_rule))\n \t\tmlx5_del_flow_rules(vport->egress.allow_untagged_rule);\n@@ -1174,8 +1181,14 @@ static void esw_vport_cleanup_ingress_rules(struct mlx5_eswitch *esw,\n {\n \tstruct mlx5_acl_vlan *trunk_vlan_rule, *tmp;\n \n-\tif (!IS_ERR_OR_NULL(vport->ingress.drop_rule))\n+\tif (!IS_ERR_OR_NULL(vport->ingress.drop_rule)) {\n+\t\tstruct mlx5_fc *drop_counter =\n+\t\t\tmlx5_flow_rule_counter(vport->ingress.drop_rule);\n+\n \t\tmlx5_del_flow_rules(vport->ingress.drop_rule);\n+\t\tif (drop_counter)\n+\t\t\tmlx5_fc_destroy(vport->dev, drop_counter);\n+\t}\n \n \tlist_for_each_entry_safe(trunk_vlan_rule, tmp,\n \t\t\t\t &vport->ingress.allowed_vlans_rules, list) {\n@@ -1222,6 +1235,8 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw,\n \tbool need_vlan_filter = !!bitmap_weight(vport->info.vlan_trunk_8021q_bitmap,\n \t\t\t\t\t\tVLAN_N_VID);\n \tstruct mlx5_acl_vlan *trunk_vlan_rule;\n+\tstruct mlx5_flow_destination dest;\n+\tstruct mlx5_fc *counter = NULL;\n \tstruct mlx5_flow_act flow_act = {0};\n \tstruct mlx5_flow_spec *spec;\n \tbool need_acl_table = true;\n@@ -1333,18 +1348,33 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw,\n \t}\n \n drop_rule:\n+\t/* Alloc ingress drop flow counter */\n+\tcounter = mlx5_fc_create(esw->dev, false);\n+\tif (IS_ERR(counter)) {\n+\t\tesw_warn(esw->dev,\n+\t\t\t \"vport[%d] configure ingress drop rule counter failed\\n\",\n+\t\t\t vport->vport);\n+\t\tcounter = NULL;\n+\t} else {\n+\t\tdest.type = MLX5_FLOW_DESTINATION_TYPE_COUNTER;\n+\t\tdest.counter = counter;\n+\t}\n+\n+\t/* Drop others rule (star rule) */\n \tmemset(spec, 0, sizeof(*spec));\n \tflow_act.action = MLX5_FLOW_CONTEXT_ACTION_DROP;\n+\tif (counter)\n+\t\tflow_act.action |= MLX5_FLOW_CONTEXT_ACTION_COUNT;\n \tvport->ingress.drop_rule =\n-\t\tmlx5_add_flow_rules(vport->ingress.acl, spec,\n-\t\t\t\t &flow_act, NULL, 0);\n+\t\tmlx5_add_flow_rules(vport->ingress.acl, spec, &flow_act, &dest, 1);\n \tif (IS_ERR(vport->ingress.drop_rule)) {\n \t\terr = PTR_ERR(vport->ingress.drop_rule);\n \t\tesw_warn(esw->dev,\n \t\t\t \"vport[%d] configure ingress drop rule, err(%d)\\n\",\n \t\t\t vport->vport, err);\n \t\tvport->ingress.drop_rule = NULL;\n-\t\tgoto out;\n+\t\tif (counter)\n+\t\t\tmlx5_fc_destroy(vport->dev, counter);\n \t}\n \n out:\n@@ -1362,6 +1392,8 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw,\n \tbool need_acl_table = vport->info.vlan || vport->info.qos ||\n \t\t\t need_vlan_filter;\n \tstruct mlx5_acl_vlan *trunk_vlan_rule;\n+\tstruct mlx5_flow_destination dest;\n+\tstruct mlx5_fc *counter = NULL;\n \tstruct mlx5_flow_act flow_act = {0};\n \tstruct mlx5_flow_spec *spec;\n \tu16 vlan_id = 0;\n@@ -1454,18 +1486,33 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw,\n \t\tlist_add(&trunk_vlan_rule->list, &vport->egress.allowed_vlans_rules);\n \t}\n \n+\t/* Alloc egress drop flow counter */\n+\tcounter = mlx5_fc_create(esw->dev, false);\n+\tif (IS_ERR(counter)) {\n+\t\tesw_warn(esw->dev,\n+\t\t\t \"vport[%d] configure egress drop rule counter failed\\n\",\n+\t\t\t vport->vport);\n+\t\tcounter = NULL;\n+\t} else {\n+\t\tdest.type = MLX5_FLOW_DESTINATION_TYPE_COUNTER;\n+\t\tdest.counter = counter;\n+\t}\n+\n \t/* Drop others rule (star rule) */\n \tmemset(spec, 0, sizeof(*spec));\n \tflow_act.action = MLX5_FLOW_CONTEXT_ACTION_DROP;\n+\tif (counter)\n+\t\tflow_act.action |= MLX5_FLOW_CONTEXT_ACTION_COUNT;\n \tvport->egress.drop_rule =\n-\t\tmlx5_add_flow_rules(vport->egress.acl, spec,\n-\t\t\t\t &flow_act, NULL, 0);\n+\t\tmlx5_add_flow_rules(vport->egress.acl, spec, &flow_act, &dest, 1);\n \tif (IS_ERR(vport->egress.drop_rule)) {\n \t\terr = PTR_ERR(vport->egress.drop_rule);\n \t\tesw_warn(esw->dev,\n \t\t\t \"vport[%d] configure egress drop rule failed, err(%d)\\n\",\n \t\t\t vport->vport, err);\n \t\tvport->egress.drop_rule = NULL;\n+\t\tif (counter)\n+\t\t\tmlx5_fc_destroy(vport->dev, counter);\n \t}\n out:\n \tif (err)\n@@ -2316,6 +2363,38 @@ int mlx5_eswitch_del_vport_trunk_range(struct mlx5_eswitch *esw,\n \treturn err;\n }\n \n+static int mlx5_eswitch_query_vport_drop_stats(struct mlx5_core_dev *dev,\n+\t\t\t\t\t int vport_idx,\n+\t\t\t\t\t u64 *rx_dropped,\n+\t\t\t\t\t u64 *tx_dropped)\n+{\n+\tstruct mlx5_eswitch *esw = dev->priv.eswitch;\n+\tstruct mlx5_vport *vport = &esw->vports[vport_idx];\n+\tstruct mlx5_fc *drop_counter;\n+\tu16 idx = 0;\n+\tu64 dummy;\n+\n+\tif (!vport->enabled)\n+\t\treturn 0;\n+\n+\tif (vport->egress.drop_rule) {\n+\t\tdrop_counter = mlx5_flow_rule_counter(vport->egress.drop_rule);\n+\t\tif (drop_counter) {\n+\t\t\tidx = drop_counter->id;\n+\t\t\tmlx5_fc_query(dev, idx, rx_dropped, &dummy);\n+\t\t}\n+\t}\n+\n+\tif (vport->ingress.drop_rule) {\n+\t\tdrop_counter = mlx5_flow_rule_counter(vport->ingress.drop_rule);\n+\t\tif (drop_counter) {\n+\t\t\tidx = drop_counter->id;\n+\t\t\tmlx5_fc_query(dev, idx, tx_dropped, &dummy);\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n int mlx5_eswitch_get_vport_stats(struct mlx5_eswitch *esw,\n \t\t\t\t int vport,\n \t\t\t\t struct ifla_vf_stats *vf_stats)\n@@ -2376,6 +2455,10 @@ int mlx5_eswitch_get_vport_stats(struct mlx5_eswitch *esw,\n \tvf_stats->broadcast =\n \t\tMLX5_GET_CTR(out, received_eth_broadcast.packets);\n \n+\tmlx5_eswitch_query_vport_drop_stats(esw->dev, vport,\n+\t\t\t\t\t &vf_stats->rx_dropped,\n+\t\t\t\t\t &vf_stats->tx_dropped);\n+\n free_out:\n \tkvfree(out);\n \treturn err;\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h\nindex 5509a752f98e..e86d75fbc0f4 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h\n@@ -221,6 +221,8 @@ void mlx5_fc_queue_stats_work(struct mlx5_core_dev *dev,\n \t\t\t unsigned long delay);\n void mlx5_fc_update_sampling_interval(struct mlx5_core_dev *dev,\n \t\t\t\t unsigned long interval);\n+int mlx5_fc_query(struct mlx5_core_dev *dev, u16 id,\n+\t\t u64 *packets, u64 *bytes);\n \n int mlx5_init_fs(struct mlx5_core_dev *dev);\n void mlx5_cleanup_fs(struct mlx5_core_dev *dev);\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c\nindex 89d1f8650033..b7ab929d5f8e 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c\n@@ -312,6 +312,12 @@ void mlx5_cleanup_fc_stats(struct mlx5_core_dev *dev)\n \t}\n }\n \n+int mlx5_fc_query(struct mlx5_core_dev *dev, u16 id,\n+\t\t u64 *packets, u64 *bytes)\n+{\n+\treturn mlx5_cmd_fc_query(dev, id, packets, bytes);\n+}\n+\n void mlx5_fc_query_cached(struct mlx5_fc *counter,\n \t\t\t u64 *bytes, u64 *packets, u64 *lastuse)\n {\n", "prefixes": [ "net-next", "4/4" ] }