{"id":818944,"url":"http://patchwork.ozlabs.org/api/patches/818944/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170927062322.5476-5-jiri@resnulli.us/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/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,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170927062322.5476-5-jiri@resnulli.us>","list_archive_url":null,"date":"2017-09-27T06:23:14","name":"[net-next,v3,04/12] ipmr: Send FIB notifications on MFC and VIF entries","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"54ba431d3610402cb77970f00c9cde58f1b6bda1","submitter":{"id":15321,"url":"http://patchwork.ozlabs.org/api/people/15321/?format=json","name":"Jiri Pirko","email":"jiri@resnulli.us"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170927062322.5476-5-jiri@resnulli.us/mbox/","series":[{"id":5290,"url":"http://patchwork.ozlabs.org/api/series/5290/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=5290","date":"2017-09-27T06:23:12","name":"mlxsw: Add support for offloading IPv4 multicast routes","version":3,"mbox":"http://patchwork.ozlabs.org/series/5290/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/818944/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/818944/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=\"c2x1hF5y\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y277N6k22z9sBW\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 27 Sep 2017 16:23:44 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751922AbdI0GXm (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 27 Sep 2017 02:23:42 -0400","from mail-wr0-f195.google.com ([209.85.128.195]:35485 \"EHLO\n\tmail-wr0-f195.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751714AbdI0GX3 (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 27 Sep 2017 02:23:29 -0400","by mail-wr0-f195.google.com with SMTP id n64so3581513wrb.2\n\tfor <netdev@vger.kernel.org>; Tue, 26 Sep 2017 23:23:28 -0700 (PDT)","from localhost (jirka.pirko.cz. [84.16.102.26])\n\tby smtp.gmail.com with ESMTPSA id\n\tj6sm6259279wmg.28.2017.09.26.23.23.27\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 26 Sep 2017 23:23:27 -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=TZyH97ik9jAQbYO/pIP4fQdP8rAALjhhu4Ak6bONDm0=;\n\tb=c2x1hF5yMBLziw6vGhWHda4dtIQMH/WDeGvnoGpnC2DgHswYxjROom/T4UUEi7krLu\n\tKE4qJSgUiORvKkJKTEymywLU+0ZtVabCHmfSoPVtsDBovDFTKSRCAezK9NeLddXUK8oM\n\tjZv9biy2NsDmbd9T9tDTg3be88qUlz6VJ8C1yOd/pongXG8uz+aoMpyzxr3wQ8lZGrWK\n\tsZqrQeBXB/W81pbW0XnI//y99wT1mxt8JNJe8eY1oMkq1m8L07Ac/fiLwrdjKQkmX33i\n\tF9LpetTZr4yJB0rYpD1PzzwLw5JJwngVCxIniqVkkQEKCr+MGJmpAC5dUMd3uRKf+z4u\n\tppzw==","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=TZyH97ik9jAQbYO/pIP4fQdP8rAALjhhu4Ak6bONDm0=;\n\tb=rx9kXWsoPhnWSNAAh0wMiCn5mpwKEtnlFjmru4E9UIXgQuwfOo3SHF6K0RHQB2ucUx\n\t6ZIvkXPGk2BR3A6akcsFZJmivcV6ZbJJIu8fvKEa2gI0JR4kBjs/C5p9Gc44dLjPNL3H\n\tyFZrLGZB1evnt+A0sngqZeRrX7MdbpO6eFvaAxzW7Xd2iUjBAEsd+mkqiX8vU93cv3ud\n\txY37jB0WacmrVYdZY34heecoLSFKIq6kUBZ6QJQ8meI25psRfub/XPEyP0/Zitb9rtsw\n\td50Au1M6qvvsVzizBm2mHDB93Fm6VWpoQ/oS66conHvfhuRJURAml7+vRBj5ZxwdCnnp\n\tKn9Q==","X-Gm-Message-State":"AHPjjUjnR3FmwM81LCmG0xePZkLUtLN0L/t8AhIN3JZrD7KV5bYPHQoL\n\t51fabS/EpdqDsqRndeHHalZhh3Yb","X-Google-Smtp-Source":"AOwi7QANg64fznqZh1hqI5CqdDk/2CxNMgkfIIzWirdiRQ1fkZBSWsJ6qWkj3utJqeMjxOF7aLnFSg==","X-Received":"by 10.223.197.13 with SMTP id q13mr387463wrf.80.1506493407566;\n\tTue, 26 Sep 2017 23:23:27 -0700 (PDT)","From":"Jiri Pirko <jiri@resnulli.us>","To":"netdev@vger.kernel.org","Cc":"davem@davemloft.net, yotamg@mellanox.com, idosch@mellanox.com,\n\tmlxsw@mellanox.com, nikolay@cumulusnetworks.com, andrew@lunn.ch,\n\tlinyunsheng@huawei.com","Subject":"[patch net-next v3 04/12] ipmr: Send FIB notifications on MFC and\n\tVIF entries","Date":"Wed, 27 Sep 2017 08:23:14 +0200","Message-Id":"<20170927062322.5476-5-jiri@resnulli.us>","X-Mailer":"git-send-email 2.9.5","In-Reply-To":"<20170927062322.5476-1-jiri@resnulli.us>","References":"<20170927062322.5476-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: Yotam Gigi <yotamg@mellanox.com>\n\nUse the newly introduced notification chain to send events upon VIF and MFC\naddition and deletion. The MFC notifications are sent only on resolved MFC\nentries, as unresolved cannot be offloaded.\n\nSigned-off-by: Yotam Gigi <yotamg@mellanox.com>\nReviewed-by: Ido Schimmel <idosch@mellanox.com>\nSigned-off-by: Jiri Pirko <jiri@mellanox.com>\nReviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>\n---\n net/ipv4/ipmr.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 53 insertions(+)","diff":"diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c\nindex 49879c3..ba71bc4 100644\n--- a/net/ipv4/ipmr.c\n+++ b/net/ipv4/ipmr.c\n@@ -627,6 +627,27 @@ static int call_ipmr_vif_entry_notifier(struct notifier_block *nb,\n \treturn call_fib_notifier(nb, net, event_type, &info.info);\n }\n \n+static int call_ipmr_vif_entry_notifiers(struct net *net,\n+\t\t\t\t\t enum fib_event_type event_type,\n+\t\t\t\t\t struct vif_device *vif,\n+\t\t\t\t\t vifi_t vif_index, u32 tb_id)\n+{\n+\tstruct vif_entry_notifier_info info = {\n+\t\t.info = {\n+\t\t\t.family = RTNL_FAMILY_IPMR,\n+\t\t\t.net = net,\n+\t\t},\n+\t\t.dev = vif->dev,\n+\t\t.vif_index = vif_index,\n+\t\t.vif_flags = vif->flags,\n+\t\t.tb_id = tb_id,\n+\t};\n+\n+\tASSERT_RTNL();\n+\tnet->ipv4.ipmr_seq++;\n+\treturn call_fib_notifiers(net, event_type, &info.info);\n+}\n+\n static int call_ipmr_mfc_entry_notifier(struct notifier_block *nb,\n \t\t\t\t\tstruct net *net,\n \t\t\t\t\tenum fib_event_type event_type,\n@@ -644,6 +665,24 @@ static int call_ipmr_mfc_entry_notifier(struct notifier_block *nb,\n \treturn call_fib_notifier(nb, net, event_type, &info.info);\n }\n \n+static int call_ipmr_mfc_entry_notifiers(struct net *net,\n+\t\t\t\t\t enum fib_event_type event_type,\n+\t\t\t\t\t struct mfc_cache *mfc, u32 tb_id)\n+{\n+\tstruct mfc_entry_notifier_info info = {\n+\t\t.info = {\n+\t\t\t.family = RTNL_FAMILY_IPMR,\n+\t\t\t.net = net,\n+\t\t},\n+\t\t.mfc = mfc,\n+\t\t.tb_id = tb_id\n+\t};\n+\n+\tASSERT_RTNL();\n+\tnet->ipv4.ipmr_seq++;\n+\treturn call_fib_notifiers(net, event_type, &info.info);\n+}\n+\n /**\n  *\tvif_delete - Delete a VIF entry\n  *\t@notify: Set to 1, if the caller is a notifier_call\n@@ -651,6 +690,7 @@ static int call_ipmr_mfc_entry_notifier(struct notifier_block *nb,\n static int vif_delete(struct mr_table *mrt, int vifi, int notify,\n \t\t      struct list_head *head)\n {\n+\tstruct net *net = read_pnet(&mrt->net);\n \tstruct vif_device *v;\n \tstruct net_device *dev;\n \tstruct in_device *in_dev;\n@@ -660,6 +700,10 @@ static int vif_delete(struct mr_table *mrt, int vifi, int notify,\n \n \tv = &mrt->vif_table[vifi];\n \n+\tif (VIF_EXISTS(mrt, vifi))\n+\t\tcall_ipmr_vif_entry_notifiers(net, FIB_EVENT_VIF_DEL, v, vifi,\n+\t\t\t\t\t      mrt->id);\n+\n \twrite_lock_bh(&mrt_lock);\n \tdev = v->dev;\n \tv->dev = NULL;\n@@ -909,6 +953,7 @@ static int vif_add(struct net *net, struct mr_table *mrt,\n \tif (vifi+1 > mrt->maxvif)\n \t\tmrt->maxvif = vifi+1;\n \twrite_unlock_bh(&mrt_lock);\n+\tcall_ipmr_vif_entry_notifiers(net, FIB_EVENT_VIF_ADD, v, vifi, mrt->id);\n \treturn 0;\n }\n \n@@ -1209,6 +1254,7 @@ static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi,\n \n static int ipmr_mfc_delete(struct mr_table *mrt, struct mfcctl *mfc, int parent)\n {\n+\tstruct net *net = read_pnet(&mrt->net);\n \tstruct mfc_cache *c;\n \n \t/* The entries are added/deleted only under RTNL */\n@@ -1220,6 +1266,7 @@ static int ipmr_mfc_delete(struct mr_table *mrt, struct mfcctl *mfc, int parent)\n \t\treturn -ENOENT;\n \trhltable_remove(&mrt->mfc_hash, &c->mnode, ipmr_rht_params);\n \tlist_del_rcu(&c->list);\n+\tcall_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_DEL, c, mrt->id);\n \tmroute_netlink_event(mrt, c, RTM_DELROUTE);\n \tipmr_cache_put(c);\n \n@@ -1248,6 +1295,8 @@ static int ipmr_mfc_add(struct net *net, struct mr_table *mrt,\n \t\tif (!mrtsock)\n \t\t\tc->mfc_flags |= MFC_STATIC;\n \t\twrite_unlock_bh(&mrt_lock);\n+\t\tcall_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_REPLACE, c,\n+\t\t\t\t\t      mrt->id);\n \t\tmroute_netlink_event(mrt, c, RTM_NEWROUTE);\n \t\treturn 0;\n \t}\n@@ -1297,6 +1346,7 @@ static int ipmr_mfc_add(struct net *net, struct mr_table *mrt,\n \t\tipmr_cache_resolve(net, mrt, uc, c);\n \t\tipmr_cache_free(uc);\n \t}\n+\tcall_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_ADD, c, mrt->id);\n \tmroute_netlink_event(mrt, c, RTM_NEWROUTE);\n \treturn 0;\n }\n@@ -1304,6 +1354,7 @@ static int ipmr_mfc_add(struct net *net, struct mr_table *mrt,\n /* Close the multicast socket, and clear the vif tables etc */\n static void mroute_clean_tables(struct mr_table *mrt, bool all)\n {\n+\tstruct net *net = read_pnet(&mrt->net);\n \tstruct mfc_cache *c, *tmp;\n \tLIST_HEAD(list);\n \tint i;\n@@ -1322,6 +1373,8 @@ static void mroute_clean_tables(struct mr_table *mrt, bool all)\n \t\t\tcontinue;\n \t\trhltable_remove(&mrt->mfc_hash, &c->mnode, ipmr_rht_params);\n \t\tlist_del_rcu(&c->list);\n+\t\tcall_ipmr_mfc_entry_notifiers(net, FIB_EVENT_ENTRY_DEL, c,\n+\t\t\t\t\t      mrt->id);\n \t\tmroute_netlink_event(mrt, c, RTM_DELROUTE);\n \t\tipmr_cache_put(c);\n \t}\n","prefixes":["net-next","v3","04/12"]}