Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/818092/?format=api
{ "id": 818092, "url": "http://patchwork.ozlabs.org/api/patches/818092/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170925083230.1193-10-jiri@resnulli.us/", "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": "<20170925083230.1193-10-jiri@resnulli.us>", "list_archive_url": null, "date": "2017-09-25T08:32:29", "name": "[net-next,09/10] mlxsw: spectrum_dpipe: Add support for adjacency table dump", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "d30945aa128560ba58f9a22e84631b61ef115cd0", "submitter": { "id": 15321, "url": "http://patchwork.ozlabs.org/api/people/15321/?format=api", "name": "Jiri Pirko", "email": "jiri@resnulli.us" }, "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/20170925083230.1193-10-jiri@resnulli.us/mbox/", "series": [ { "id": 4898, "url": "http://patchwork.ozlabs.org/api/series/4898/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=4898", "date": "2017-09-25T08:32:21", "name": "mlxsw: Add router adjacency dpipe table", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/4898/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/818092/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/818092/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>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=resnulli-us.20150623.gappssmtp.com\n\theader.i=@resnulli-us.20150623.gappssmtp.com\n\theader.b=\"Ayl2hF2f\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y0y5V1pgcz9tX3\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 25 Sep 2017 18:33:02 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S934303AbdIYIdA (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 25 Sep 2017 04:33:00 -0400", "from mail-wr0-f196.google.com ([209.85.128.196]:38840 \"EHLO\n\tmail-wr0-f196.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S934142AbdIYIcj (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 25 Sep 2017 04:32:39 -0400", "by mail-wr0-f196.google.com with SMTP id p37so1436301wrb.5\n\tfor <netdev@vger.kernel.org>; Mon, 25 Sep 2017 01:32:39 -0700 (PDT)", "from localhost (ip-89-177-136-69.net.upcbroadband.cz.\n\t[89.177.136.69]) by smtp.gmail.com with ESMTPSA id\n\t109sm3558991wrc.25.2017.09.25.01.32.37\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tMon, 25 Sep 2017 01:32:38 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=resnulli-us.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=hdMc5hT0GPU3DwKVDLb92wNFqlxcDEexIRHGiBg4vdE=;\n\tb=Ayl2hF2fgolODKTxG3zSIkhz4TpapUI5uJmv0WbFbkB71bAszQifFJdLMjrl0555Qm\n\tQ13Z2SrJzHiiMGaP9Bsh5MZtWHvYz3wxjzLF8YJDk27NvjPPCcVIHEq+OhUjgsJHabpk\n\tPYqLHWOXmZnhwQGZQIa3XA08QleFX51LcaTSDcoJIU+hlHqM6GQ2gQWf+KevkRF1aIP5\n\tuRPk9z1bkh+Sul17XU761uyLEIai9JgtTgc6W/1nKDy5HJPcxSWep/dTI6Uc3ZOw/h2j\n\t6CZin//NaBBvc512PjQqHQbUugR4Wnq5C/Eh4uQMWmMHe5SlfGwNVc4/rbgwA70M08Mo\n\t6uJw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=hdMc5hT0GPU3DwKVDLb92wNFqlxcDEexIRHGiBg4vdE=;\n\tb=Fg1k1MuR0H8XW4jGdLH5/DQqKW+t6j1OcQTFlfCJ1H7Mya/4yrnYa03ZW9S2eyQklt\n\tnv/JbWx5L0N3M1pCygGSsk/N863J6dDLvqxUcvbQv8Bx9+eIZxxZKKx/UumzyEk1pEXK\n\tT1XDipgB7EwLsTAkQlxoFPRWMa4FGlpaobLsnTrFKjxluEIKxlCiqfM3J2D+ZgGPajAO\n\tfxVuXrlFaW5274piGLVr6iVY4PR8WQFD21YKeJ9a22mzJww5kXF+Y7iUJku5f2Fnzs6H\n\tjbNKVVnIxznOl2c2C/bjI7IzTzkOXLyEnY8EkX1YtCIH4OA3i1aaqy0NwmqODAiVHi2e\n\tILSw==", "X-Gm-Message-State": "AHPjjUjMHlI5WzB9AbMLN+eesAzakpoZDs219yHEZTLgfXKLgOJqOc/e\n\tFSIzOwsqO5ayIrVBuC1zThMHsqM/", "X-Google-Smtp-Source": "AOwi7QC8auKLboXLBmeW45L9xoxT7/2JdOGk3aFrkuUPSfgGquW3Vs6mU1e1Wzt42+V7ExeGtJZnYA==", "X-Received": "by 10.223.163.18 with SMTP id c18mr5504124wrb.211.1506328358325; \n\tMon, 25 Sep 2017 01:32:38 -0700 (PDT)", "From": "Jiri Pirko <jiri@resnulli.us>", "To": "netdev@vger.kernel.org", "Cc": "davem@davemloft.net, arkadis@mellanox.com, idosch@mellanox.com,\n\tmlxsw@mellanox.com", "Subject": "[patch net-next 09/10] mlxsw: spectrum_dpipe: Add support for\n\tadjacency table dump", "Date": "Mon, 25 Sep 2017 10:32:29 +0200", "Message-Id": "<20170925083230.1193-10-jiri@resnulli.us>", "X-Mailer": "git-send-email 2.9.5", "In-Reply-To": "<20170925083230.1193-1-jiri@resnulli.us>", "References": "<20170925083230.1193-1-jiri@resnulli.us>", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "From: Arkadi Sharshevsky <arkadis@mellanox.com>\n\nAdd support for adjacency table dump.\n\nSigned-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>\nSigned-off-by: Jiri Pirko <jiri@mellanox.com>\n---\n .../net/ethernet/mellanox/mlxsw/spectrum_dpipe.c | 238 +++++++++++++++++++++\n 1 file changed, 238 insertions(+)", "diff": "diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c\nindex ca16f89..e6755a9 100644\n--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c\n+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c\n@@ -895,6 +895,243 @@ static u64 mlxsw_sp_dpipe_table_adj_size(struct mlxsw_sp *mlxsw_sp)\n \treturn size;\n }\n \n+enum mlxsw_sp_dpipe_table_adj_match {\n+\tMLXSW_SP_DPIPE_TABLE_ADJ_MATCH_INDEX,\n+\tMLXSW_SP_DPIPE_TABLE_ADJ_MATCH_HASH_INDEX,\n+\tMLXSW_SP_DPIPE_TABLE_ADJ_MATCH_COUNT,\n+};\n+\n+enum mlxsw_sp_dpipe_table_adj_action {\n+\tMLXSW_SP_DPIPE_TABLE_ADJ_ACTION_DST_MAC,\n+\tMLXSW_SP_DPIPE_TABLE_ADJ_ACTION_ERIF_PORT,\n+\tMLXSW_SP_DPIPE_TABLE_ADJ_ACTION_COUNT,\n+};\n+\n+static void\n+mlxsw_sp_dpipe_table_adj_match_action_prepare(struct devlink_dpipe_match *matches,\n+\t\t\t\t\t struct devlink_dpipe_action *actions)\n+{\n+\tstruct devlink_dpipe_action *action;\n+\tstruct devlink_dpipe_match *match;\n+\n+\tmatch = &matches[MLXSW_SP_DPIPE_TABLE_ADJ_MATCH_INDEX];\n+\tmatch->type = DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT;\n+\tmatch->header = &mlxsw_sp_dpipe_header_metadata;\n+\tmatch->field_id = MLXSW_SP_DPIPE_FIELD_METADATA_ADJ_INDEX;\n+\n+\tmatch = &matches[MLXSW_SP_DPIPE_TABLE_ADJ_MATCH_HASH_INDEX];\n+\tmatch->type = DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT;\n+\tmatch->header = &mlxsw_sp_dpipe_header_metadata;\n+\tmatch->field_id = MLXSW_SP_DPIPE_FIELD_METADATA_ADJ_HASH_INDEX;\n+\n+\taction = &actions[MLXSW_SP_DPIPE_TABLE_ADJ_ACTION_DST_MAC];\n+\taction->type = DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY;\n+\taction->header = &devlink_dpipe_header_ethernet;\n+\taction->field_id = DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC;\n+\n+\taction = &actions[MLXSW_SP_DPIPE_TABLE_ADJ_ACTION_ERIF_PORT];\n+\taction->type = DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY;\n+\taction->header = &mlxsw_sp_dpipe_header_metadata;\n+\taction->field_id = MLXSW_SP_DPIPE_FIELD_METADATA_ERIF_PORT;\n+}\n+\n+static int\n+mlxsw_sp_dpipe_table_adj_entry_prepare(struct devlink_dpipe_entry *entry,\n+\t\t\t\t struct devlink_dpipe_value *match_values,\n+\t\t\t\t struct devlink_dpipe_match *matches,\n+\t\t\t\t struct devlink_dpipe_value *action_values,\n+\t\t\t\t struct devlink_dpipe_action *actions)\n+{\tstruct devlink_dpipe_value *action_value;\n+\tstruct devlink_dpipe_value *match_value;\n+\tstruct devlink_dpipe_action *action;\n+\tstruct devlink_dpipe_match *match;\n+\n+\tentry->match_values = match_values;\n+\tentry->match_values_count = MLXSW_SP_DPIPE_TABLE_ADJ_MATCH_COUNT;\n+\n+\tentry->action_values = action_values;\n+\tentry->action_values_count = MLXSW_SP_DPIPE_TABLE_ADJ_ACTION_COUNT;\n+\n+\tmatch = &matches[MLXSW_SP_DPIPE_TABLE_ADJ_MATCH_INDEX];\n+\tmatch_value = &match_values[MLXSW_SP_DPIPE_TABLE_ADJ_MATCH_INDEX];\n+\n+\tmatch_value->match = match;\n+\tmatch_value->value_size = sizeof(u32);\n+\tmatch_value->value = kmalloc(match_value->value_size, GFP_KERNEL);\n+\tif (!match_value->value)\n+\t\treturn -ENOMEM;\n+\n+\tmatch = &matches[MLXSW_SP_DPIPE_TABLE_ADJ_MATCH_HASH_INDEX];\n+\tmatch_value = &match_values[MLXSW_SP_DPIPE_TABLE_ADJ_MATCH_HASH_INDEX];\n+\n+\tmatch_value->match = match;\n+\tmatch_value->value_size = sizeof(u32);\n+\tmatch_value->value = kmalloc(match_value->value_size, GFP_KERNEL);\n+\tif (!match_value->value)\n+\t\treturn -ENOMEM;\n+\n+\taction = &actions[MLXSW_SP_DPIPE_TABLE_ADJ_ACTION_DST_MAC];\n+\taction_value = &action_values[MLXSW_SP_DPIPE_TABLE_ADJ_ACTION_DST_MAC];\n+\n+\taction_value->action = action;\n+\taction_value->value_size = sizeof(u64);\n+\taction_value->value = kmalloc(action_value->value_size, GFP_KERNEL);\n+\tif (!action_value->value)\n+\t\treturn -ENOMEM;\n+\n+\taction = &actions[MLXSW_SP_DPIPE_TABLE_ADJ_ACTION_ERIF_PORT];\n+\taction_value = &action_values[MLXSW_SP_DPIPE_TABLE_ADJ_ACTION_ERIF_PORT];\n+\n+\taction_value->action = action;\n+\taction_value->value_size = sizeof(u32);\n+\taction_value->value = kmalloc(action_value->value_size, GFP_KERNEL);\n+\tif (!action_value->value)\n+\t\treturn -ENOMEM;\n+\n+\treturn 0;\n+}\n+\n+static void\n+__mlxsw_sp_dpipe_table_adj_entry_fill(struct devlink_dpipe_entry *entry,\n+\t\t\t\t u32 adj_index, u32 adj_hash_index,\n+\t\t\t\t unsigned char *ha,\n+\t\t\t\t struct mlxsw_sp_rif *rif)\n+{\n+\tstruct devlink_dpipe_value *value;\n+\tu32 *p_rif_value;\n+\tu32 *p_index;\n+\n+\tvalue = &entry->match_values[MLXSW_SP_DPIPE_TABLE_ADJ_MATCH_INDEX];\n+\tp_index = value->value;\n+\t*p_index = adj_index;\n+\n+\tvalue = &entry->match_values[MLXSW_SP_DPIPE_TABLE_ADJ_MATCH_HASH_INDEX];\n+\tp_index = value->value;\n+\t*p_index = adj_hash_index;\n+\n+\tvalue = &entry->action_values[MLXSW_SP_DPIPE_TABLE_ADJ_ACTION_DST_MAC];\n+\tether_addr_copy(value->value, ha);\n+\n+\tvalue = &entry->action_values[MLXSW_SP_DPIPE_TABLE_ADJ_ACTION_ERIF_PORT];\n+\tp_rif_value = value->value;\n+\t*p_rif_value = mlxsw_sp_rif_index(rif);\n+\tvalue->mapping_value = mlxsw_sp_rif_dev_ifindex(rif);\n+\tvalue->mapping_valid = true;\n+}\n+\n+static void mlxsw_sp_dpipe_table_adj_entry_fill(struct mlxsw_sp *mlxsw_sp,\n+\t\t\t\t\t\tstruct mlxsw_sp_nexthop *nh,\n+\t\t\t\t\t\tstruct devlink_dpipe_entry *entry)\n+{\n+\tstruct mlxsw_sp_rif *rif = mlxsw_sp_nexthop_rif(nh);\n+\tunsigned char *ha = mlxsw_sp_nexthop_ha(nh);\n+\tu32 adj_hash_index = 0;\n+\tu32 adj_index = 0;\n+\tint err;\n+\n+\tmlxsw_sp_nexthop_indexes(nh, &adj_index, &adj_hash_index);\n+\t__mlxsw_sp_dpipe_table_adj_entry_fill(entry, adj_index,\n+\t\t\t\t\t adj_hash_index, ha, rif);\n+\terr = mlxsw_sp_nexthop_counter_get(mlxsw_sp, nh, &entry->counter);\n+\tif (!err)\n+\t\tentry->counter_valid = true;\n+}\n+\n+static int\n+mlxsw_sp_dpipe_table_adj_entries_get(struct mlxsw_sp *mlxsw_sp,\n+\t\t\t\t struct devlink_dpipe_entry *entry,\n+\t\t\t\t bool counters_enabled,\n+\t\t\t\t struct devlink_dpipe_dump_ctx *dump_ctx)\n+{\n+\tstruct mlxsw_sp_nexthop *nh;\n+\tint entry_index = 0;\n+\tint nh_count_max;\n+\tint nh_count = 0;\n+\tint nh_skip;\n+\tint j;\n+\tint err;\n+\n+\trtnl_lock();\n+\tnh_count_max = mlxsw_sp_dpipe_table_adj_size(mlxsw_sp);\n+start_again:\n+\terr = devlink_dpipe_entry_ctx_prepare(dump_ctx);\n+\tif (err)\n+\t\tgoto err_ctx_prepare;\n+\tj = 0;\n+\tnh_skip = nh_count;\n+\tmlxsw_sp_nexthop_for_each(nh, mlxsw_sp->router) {\n+\t\tif (!mlxsw_sp_nexthop_offload(nh) ||\n+\t\t mlxsw_sp_nexthop_group_has_ipip(nh))\n+\t\t\tcontinue;\n+\n+\t\tif (nh_count < nh_skip)\n+\t\t\tgoto skip;\n+\n+\t\tmlxsw_sp_dpipe_table_adj_entry_fill(mlxsw_sp, nh, entry);\n+\t\tentry->index = entry_index;\n+\t\terr = devlink_dpipe_entry_ctx_append(dump_ctx, entry);\n+\t\tif (err) {\n+\t\t\tif (err == -EMSGSIZE) {\n+\t\t\t\tif (!j)\n+\t\t\t\t\tgoto err_entry_append;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tgoto err_entry_append;\n+\t\t}\n+\t\tentry_index++;\n+\t\tj++;\n+skip:\n+\t\tnh_count++;\n+\t}\n+\n+\tdevlink_dpipe_entry_ctx_close(dump_ctx);\n+\tif (nh_count != nh_count_max)\n+\t\tgoto start_again;\n+\trtnl_unlock();\n+\n+\treturn 0;\n+\n+err_ctx_prepare:\n+err_entry_append:\n+\trtnl_unlock();\n+\treturn err;\n+}\n+\n+static int\n+mlxsw_sp_dpipe_table_adj_entries_dump(void *priv, bool counters_enabled,\n+\t\t\t\t struct devlink_dpipe_dump_ctx *dump_ctx)\n+{\n+\tstruct devlink_dpipe_value action_values[MLXSW_SP_DPIPE_TABLE_ADJ_ACTION_COUNT];\n+\tstruct devlink_dpipe_value match_values[MLXSW_SP_DPIPE_TABLE_ADJ_MATCH_COUNT];\n+\tstruct devlink_dpipe_action actions[MLXSW_SP_DPIPE_TABLE_ADJ_ACTION_COUNT];\n+\tstruct devlink_dpipe_match matches[MLXSW_SP_DPIPE_TABLE_ADJ_MATCH_COUNT];\n+\tstruct devlink_dpipe_entry entry = {0};\n+\tstruct mlxsw_sp *mlxsw_sp = priv;\n+\tint err;\n+\n+\tmemset(matches, 0, MLXSW_SP_DPIPE_TABLE_ADJ_MATCH_COUNT *\n+\t\t\t sizeof(matches[0]));\n+\tmemset(match_values, 0, MLXSW_SP_DPIPE_TABLE_ADJ_MATCH_COUNT *\n+\t\t\t\tsizeof(match_values[0]));\n+\tmemset(actions, 0, MLXSW_SP_DPIPE_TABLE_ADJ_ACTION_COUNT *\n+\t\t\t sizeof(actions[0]));\n+\tmemset(action_values, 0, MLXSW_SP_DPIPE_TABLE_ADJ_ACTION_COUNT *\n+\t\t\t\t sizeof(action_values[0]));\n+\n+\tmlxsw_sp_dpipe_table_adj_match_action_prepare(matches, actions);\n+\terr = mlxsw_sp_dpipe_table_adj_entry_prepare(&entry,\n+\t\t\t\t\t\t match_values, matches,\n+\t\t\t\t\t\t action_values, actions);\n+\tif (err)\n+\t\tgoto out;\n+\n+\terr = mlxsw_sp_dpipe_table_adj_entries_get(mlxsw_sp, &entry,\n+\t\t\t\t\t\t counters_enabled, dump_ctx);\n+out:\n+\tdevlink_dpipe_entry_clear(&entry);\n+\treturn err;\n+}\n+\n static u64\n mlxsw_sp_dpipe_table_adj_size_get(void *priv)\n {\n@@ -911,6 +1148,7 @@ mlxsw_sp_dpipe_table_adj_size_get(void *priv)\n static struct devlink_dpipe_table_ops mlxsw_sp_dpipe_table_adj_ops = {\n \t.matches_dump = mlxsw_sp_dpipe_table_adj_matches_dump,\n \t.actions_dump = mlxsw_sp_dpipe_table_adj_actions_dump,\n+\t.entries_dump = mlxsw_sp_dpipe_table_adj_entries_dump,\n \t.size_get = mlxsw_sp_dpipe_table_adj_size_get,\n };\n \n", "prefixes": [ "net-next", "09/10" ] }