{"id":817940,"url":"http://patchwork.ozlabs.org/api/patches/817940/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170924172212.10096-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":"<20170924172212.10096-5-jiri@resnulli.us>","list_archive_url":null,"date":"2017-09-24T17:22:04","name":"[net-next,v2,04/12] ipmr: Send FIB notifications on MFC and VIF entries","commit_ref":null,"pull_url":null,"state":"changes-requested","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/20170924172212.10096-5-jiri@resnulli.us/mbox/","series":[{"id":4828,"url":"http://patchwork.ozlabs.org/api/series/4828/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=4828","date":"2017-09-24T17:22:00","name":"mlxsw: Add support for offloading IPv4 multicast routes","version":2,"mbox":"http://patchwork.ozlabs.org/series/4828/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/817940/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/817940/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=\"UvsStZxE\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y0Ytr0KxXz9sRq\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 25 Sep 2017 03:22:28 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752763AbdIXRWX (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSun, 24 Sep 2017 13:22:23 -0400","from mail-wm0-f68.google.com ([74.125.82.68]:35735 \"EHLO\n\tmail-wm0-f68.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752629AbdIXRWT (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Sun, 24 Sep 2017 13:22:19 -0400","by mail-wm0-f68.google.com with SMTP id e64so5328715wmi.2\n\tfor <netdev@vger.kernel.org>; Sun, 24 Sep 2017 10:22:18 -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\tt36sm7717851wrc.28.2017.09.24.10.22.17\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSun, 24 Sep 2017 10:22:17 -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=UvsStZxE/drmwVQzBSAzFsdKua3rYoLgHtWjLYw1HCCl+HgWmPXTrh4TgY5BzbA0Mc\n\te8cMA0tYJJRsdmdJP2xGjXXNX+X/6PiDu82eU/nCB+exOeop+nX1SZJHp1ZKvrYjrlel\n\tgOhrRCdmBvusALL06ojzw+Ef4pBqAIz0vlJ/ppgdIkIkIuFFtZCDitXNrtYEoltw98H7\n\tG6B+f+mhxhNy1GWuMdioBU4RdalIaCo6VimjhKJkmXnEJlSCseMU/6vFD2QTRjd7dATW\n\tJWSwEOEsLqcxTSFCwkIH4LgN7favh01QrjYzmeYPSFGSkj1w1mdXPAhiGwadjahFZfgc\n\tPi5A==","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=EaKECIW49mFHJNBcPHwwVklq3t7zT5ZCLXFDkIsZqQke7hSZhqJea+qqNPn+G7V/7j\n\teOVAMO8vpMZLM1Xw3uH8B/Pl2EJD22tjxTARd+9IoEJKduYUWEcDe82Bl+81SJRj+hw2\n\tpLnFG4P6hMc4qWeVIjTvJjUzC8BHa+BNU1f/1VIt01M0IvAksyde/4IKgn7zu3xs0sF8\n\tecqYptlrIvSg2TguiXn1T4BEGaQC2sycgtuWsxvGQOA4kYfWjk7LweqBPexrQuLrnGTh\n\t2ZefotxZ7mrBvNahkj4bXRVUDpjr0ORuvErx9EylvEEVjaFDwKFpxTkH/UpfJf1UA0FG\n\tgBLQ==","X-Gm-Message-State":"AHPjjUj227+kCn1cEQkWVBjkp1NLAC6oAiPj61o60a6Cz20cJT3AAa22\n\tUSuBGTgJSo39Jra2eZ6s8/ltM827","X-Google-Smtp-Source":"AOwi7QAjk1rhkbU57gK3pggA+HmReXhxfnDPGyaE6SX2DzbGD+VCcrnPD1DWqB6ZyetgiwcHd/V7Qw==","X-Received":"by 10.28.105.156 with SMTP id z28mr9212538wmh.73.1506273737723; \n\tSun, 24 Sep 2017 10:22:17 -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","Subject":"[patch net-next v2 04/12] ipmr: Send FIB notifications on MFC and\n\tVIF entries","Date":"Sun, 24 Sep 2017 19:22:04 +0200","Message-Id":"<20170924172212.10096-5-jiri@resnulli.us>","X-Mailer":"git-send-email 2.9.5","In-Reply-To":"<20170924172212.10096-1-jiri@resnulli.us>","References":"<20170924172212.10096-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","v2","04/12"]}