{"id":808296,"url":"http://patchwork.ozlabs.org/api/1.0/patches/808296/?format=json","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.0/projects/7/?format=json","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},"msgid":"<20170831155919.1366-7-jiri@resnulli.us>","date":"2017-08-31T15:59:17","name":"[net-next,repost,6/8] mlxsw: spectrum_dpipe: Add support for IPv6 host table dump","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"801162869d4ac6b3d1ae6ae893e196d32f78afe4","submitter":{"id":15321,"url":"http://patchwork.ozlabs.org/api/1.0/people/15321/?format=json","name":"Jiri Pirko","email":"jiri@resnulli.us"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.0/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170831155919.1366-7-jiri@resnulli.us/mbox/","series":[{"id":863,"url":"http://patchwork.ozlabs.org/api/1.0/series/863/?format=json","date":"2017-08-31T15:59:11","name":"mlxsw: Add IPv6 host dpipe table","version":1,"mbox":"http://patchwork.ozlabs.org/series/863/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808296/checks/","tags":{},"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=\"eqLVS4kL\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjnBZ5mPqz9sD9\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  1 Sep 2017 01:59:50 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751866AbdHaP7s (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 31 Aug 2017 11:59:48 -0400","from mail-wm0-f66.google.com ([74.125.82.66]:35329 \"EHLO\n\tmail-wm0-f66.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751813AbdHaP7d (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 31 Aug 2017 11:59:33 -0400","by mail-wm0-f66.google.com with SMTP id e204so57569wma.2\n\tfor <netdev@vger.kernel.org>; Thu, 31 Aug 2017 08:59:32 -0700 (PDT)","from localhost (jirka.pirko.cz. [84.16.102.26])\n\tby smtp.gmail.com with ESMTPSA id 53sm59845wry.35.2017.08.31.08.59.30\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tThu, 31 Aug 2017 08:59:30 -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=9X48KYDZ9fJf3VtnPwt97gXu2blmlZ9RJJ8yzBMK6L0=;\n\tb=eqLVS4kLz7TZvpGLjfZ4MfabjLtbwuyhjCjHRdWZ6bGo+cUYLOIjsvHKWpUE+r4kZm\n\tDb44AIsXOYPh9rkJAs5eXsiyvMWaNtoM9uJ8mrrKcfpxauD9oEbjKU6J2cvwbWdvniMI\n\tGrSBIsLQT0D0nR1QH8YGDGdat4LNDwMYjri2uNNkh8niCpYe+lHkpehvOX2wXfiegJw6\n\tpOxUPOwM2IHTjDKT16eYmaEix/Oe9aCsIPBlnJO5E5AtrFxfKk1IlQHuHBN2oQ2det+y\n\tP5FHiACOAhsvq5mveRIhy+XtXW7GyS5KThCQ6E10l83k73k/wxegZeBzZ9maRbQ7wlB5\n\tvEmA==","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=9X48KYDZ9fJf3VtnPwt97gXu2blmlZ9RJJ8yzBMK6L0=;\n\tb=S6NHFhAIauBVMJVDsj3U2d6ZqfjEiO/rxL44MX9h1trHj3geeZgjYxJr03LxBiXJA1\n\ts5jlkhqBAIgZ1pfgWibRe7pPeqcsnNgbnRzdjnx59OMWmpl5Av6F0i/FXUAs+5A0Lwgr\n\txp5os1/F/2QltwZGs8I0C0E+gG1xi2Gze9DRsk8tDDt6Ledp+npCXm73USvr2N+CsnHl\n\tqqZNPrHbyAvjltk5kMvy0+YRL1+fnlQOC5wBM0SPTr2U2AVDAlnJ5jZoIC5Jf6LeOxyO\n\tIzVNRys0bFBATS82Xj5taCTUJ2vraS07eIpyFGczKYKiXK8jOOIPZeWNYgEobwsYH3YE\n\tkBTQ==","X-Gm-Message-State":"AHPjjUgOeE98+J7RwEjj77tLHlXcFAhheufuat6ecm/nbp6+TS0hEUXc\n\tY66BkXV48bocRpo+YSI=","X-Google-Smtp-Source":"ADKCNb5TIxxIRlpUKWMAtm6p+CFV+Qis2TzixXq8ED4YiZ7dF1Y3AQNdoSq5fhYpTU0mIstAQnqGTQ==","X-Received":"by 10.28.13.81 with SMTP id 78mr920286wmn.7.1504195171279;\n\tThu, 31 Aug 2017 08:59:31 -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 repost 6/8] mlxsw: spectrum_dpipe: Add support for\n\tIPv6 host table dump","Date":"Thu, 31 Aug 2017 17:59:17 +0200","Message-Id":"<20170831155919.1366-7-jiri@resnulli.us>","X-Mailer":"git-send-email 2.9.3","In-Reply-To":"<20170831155919.1366-1-jiri@resnulli.us>","References":"<20170831155919.1366-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 IPv6 host 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   | 75 ++++++++++++++++++++--\n 1 file changed, 70 insertions(+), 5 deletions(-)","diff":"diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c\nindex 5924e97..75da2ef 100644\n--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c\n+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c\n@@ -386,8 +386,19 @@ mlxsw_sp_dpipe_table_host_match_action_prepare(struct devlink_dpipe_match *match\n \n \tmatch = &matches[MLXSW_SP_DPIPE_TABLE_HOST_MATCH_DIP];\n \tmatch->type = DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT;\n-\tmatch->header = &devlink_dpipe_header_ipv4;\n-\tmatch->field_id = DEVLINK_DPIPE_FIELD_IPV4_DST_IP;\n+\tswitch (type) {\n+\tcase AF_INET:\n+\t\tmatch->header = &devlink_dpipe_header_ipv4;\n+\t\tmatch->field_id = DEVLINK_DPIPE_FIELD_IPV4_DST_IP;\n+\t\tbreak;\n+\tcase AF_INET6:\n+\t\tmatch->header = &devlink_dpipe_header_ipv6;\n+\t\tmatch->field_id = DEVLINK_DPIPE_FIELD_IPV6_DST_IP;\n+\t\tbreak;\n+\tdefault:\n+\t\tWARN_ON(1);\n+\t\treturn;\n+\t}\n \n \taction->type = DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY;\n \taction->header = &devlink_dpipe_header_ethernet;\n@@ -424,7 +435,18 @@ mlxsw_sp_dpipe_table_host_entry_prepare(struct devlink_dpipe_entry *entry,\n \tmatch_value = &match_values[MLXSW_SP_DPIPE_TABLE_HOST_MATCH_DIP];\n \n \tmatch_value->match = match;\n-\tmatch_value->value_size = sizeof(u32);\n+\tswitch (type) {\n+\tcase AF_INET:\n+\t\tmatch_value->value_size = sizeof(u32);\n+\t\tbreak;\n+\tcase AF_INET6:\n+\t\tmatch_value->value_size = sizeof(struct in6_addr);\n+\t\tbreak;\n+\tdefault:\n+\t\tWARN_ON(1);\n+\t\treturn -EINVAL;\n+\t}\n+\n \tmatch_value->value = kmalloc(match_value->value_size, GFP_KERNEL);\n \tif (!match_value->value)\n \t\treturn -ENOMEM;\n@@ -479,6 +501,20 @@ mlxsw_sp_dpipe_table_host4_entry_fill(struct devlink_dpipe_entry *entry,\n }\n \n static void\n+mlxsw_sp_dpipe_table_host6_entry_fill(struct devlink_dpipe_entry *entry,\n+\t\t\t\t      struct mlxsw_sp_neigh_entry *neigh_entry,\n+\t\t\t\t      struct mlxsw_sp_rif *rif)\n+{\n+\tstruct in6_addr *dip;\n+\tunsigned char *ha;\n+\n+\tha = mlxsw_sp_neigh_entry_ha(neigh_entry);\n+\tdip = mlxsw_sp_neigh6_entry_dip(neigh_entry);\n+\n+\t__mlxsw_sp_dpipe_table_host_entry_fill(entry, rif, ha, dip);\n+}\n+\n+static void\n mlxsw_sp_dpipe_table_host_entry_fill(struct mlxsw_sp *mlxsw_sp,\n \t\t\t\t     struct devlink_dpipe_entry *entry,\n \t\t\t\t     struct mlxsw_sp_neigh_entry *neigh_entry,\n@@ -487,7 +523,18 @@ mlxsw_sp_dpipe_table_host_entry_fill(struct mlxsw_sp *mlxsw_sp,\n {\n \tint err;\n \n-\tmlxsw_sp_dpipe_table_host4_entry_fill(entry, neigh_entry, rif);\n+\tswitch (type) {\n+\tcase AF_INET:\n+\t\tmlxsw_sp_dpipe_table_host4_entry_fill(entry, neigh_entry, rif);\n+\t\tbreak;\n+\tcase AF_INET6:\n+\t\tmlxsw_sp_dpipe_table_host6_entry_fill(entry, neigh_entry, rif);\n+\t\tbreak;\n+\tdefault:\n+\t\tWARN_ON(1);\n+\t\treturn;\n+\t}\n+\n \terr = mlxsw_sp_neigh_counter_get(mlxsw_sp, neigh_entry,\n \t\t\t\t\t &entry->counter);\n \tif (!err)\n@@ -526,7 +573,13 @@ mlxsw_sp_dpipe_table_host_entries_get(struct mlxsw_sp *mlxsw_sp,\n \n \t\trif_neigh_count = 0;\n \t\tmlxsw_sp_rif_neigh_for_each(neigh_entry, rif) {\n-\t\t\tif (mlxsw_sp_neigh_entry_type(neigh_entry) != type)\n+\t\t\tint neigh_type = mlxsw_sp_neigh_entry_type(neigh_entry);\n+\n+\t\t\tif (neigh_type != type)\n+\t\t\t\tcontinue;\n+\n+\t\t\tif (neigh_type == AF_INET6 &&\n+\t\t\t    mlxsw_sp_neigh_ipv6_ignore(neigh_entry))\n \t\t\t\tcontinue;\n \n \t\t\tif (rif_neigh_count < rif_neigh_skip)\n@@ -714,6 +767,17 @@ mlxsw_sp_dpipe_table_host6_matches_dump(void *priv, struct sk_buff *skb)\n \treturn mlxsw_sp_dpipe_table_host_matches_dump(skb, AF_INET6);\n }\n \n+static int\n+mlxsw_sp_dpipe_table_host6_entries_dump(void *priv, bool counters_enabled,\n+\t\t\t\t\tstruct devlink_dpipe_dump_ctx *dump_ctx)\n+{\n+\tstruct mlxsw_sp *mlxsw_sp = priv;\n+\n+\treturn mlxsw_sp_dpipe_table_host_entries_dump(mlxsw_sp,\n+\t\t\t\t\t\t      counters_enabled,\n+\t\t\t\t\t\t      dump_ctx, AF_INET6);\n+}\n+\n static u64 mlxsw_sp_dpipe_table_host6_size_get(void *priv)\n {\n \tstruct mlxsw_sp *mlxsw_sp = priv;\n@@ -724,6 +788,7 @@ static u64 mlxsw_sp_dpipe_table_host6_size_get(void *priv)\n static struct devlink_dpipe_table_ops mlxsw_sp_host6_ops = {\n \t.matches_dump = mlxsw_sp_dpipe_table_host6_matches_dump,\n \t.actions_dump = mlxsw_sp_dpipe_table_host_actions_dump,\n+\t.entries_dump = mlxsw_sp_dpipe_table_host6_entries_dump,\n \t.size_get = mlxsw_sp_dpipe_table_host6_size_get,\n };\n \n","prefixes":["net-next","repost","6/8"]}