~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/openvswitch/dp_notify.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /net/openvswitch/dp_notify.c (Version linux-6.11.5) and /net/openvswitch/dp_notify.c (Version linux-4.16.18)


  1 // SPDX-License-Identifier: GPL-2.0-only       << 
  2 /*                                                  1 /*
  3  * Copyright (c) 2007-2012 Nicira, Inc.             2  * Copyright (c) 2007-2012 Nicira, Inc.
                                                   >>   3  *
                                                   >>   4  * This program is free software; you can redistribute it and/or
                                                   >>   5  * modify it under the terms of version 2 of the GNU General Public
                                                   >>   6  * License as published by the Free Software Foundation.
                                                   >>   7  *
                                                   >>   8  * This program is distributed in the hope that it will be useful, but
                                                   >>   9  * WITHOUT ANY WARRANTY; without even the implied warranty of
                                                   >>  10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
                                                   >>  11  * General Public License for more details.
                                                   >>  12  *
                                                   >>  13  * You should have received a copy of the GNU General Public License
                                                   >>  14  * along with this program; if not, write to the Free Software
                                                   >>  15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
                                                   >>  16  * 02110-1301, USA
  4  */                                                17  */
  5                                                    18 
  6 #include <linux/netdevice.h>                       19 #include <linux/netdevice.h>
  7 #include <net/genetlink.h>                         20 #include <net/genetlink.h>
  8 #include <net/netns/generic.h>                     21 #include <net/netns/generic.h>
  9                                                    22 
 10 #include "datapath.h"                              23 #include "datapath.h"
 11 #include "vport-internal_dev.h"                    24 #include "vport-internal_dev.h"
 12 #include "vport-netdev.h"                          25 #include "vport-netdev.h"
 13                                                    26 
 14 static void dp_detach_port_notify(struct vport     27 static void dp_detach_port_notify(struct vport *vport)
 15 {                                                  28 {
 16         struct sk_buff *notify;                    29         struct sk_buff *notify;
 17         struct datapath *dp;                       30         struct datapath *dp;
 18                                                    31 
 19         dp = vport->dp;                            32         dp = vport->dp;
 20         notify = ovs_vport_cmd_build_info(vpor     33         notify = ovs_vport_cmd_build_info(vport, ovs_dp_get_net(dp),
 21                                           0, 0     34                                           0, 0, OVS_VPORT_CMD_DEL);
 22         ovs_dp_detach_port(vport);                 35         ovs_dp_detach_port(vport);
 23         if (IS_ERR(notify)) {                      36         if (IS_ERR(notify)) {
 24                 genl_set_err(&dp_vport_genl_fa     37                 genl_set_err(&dp_vport_genl_family, ovs_dp_get_net(dp), 0,
 25                              0, PTR_ERR(notify     38                              0, PTR_ERR(notify));
 26                 return;                            39                 return;
 27         }                                          40         }
 28                                                    41 
 29         genlmsg_multicast_netns(&dp_vport_genl     42         genlmsg_multicast_netns(&dp_vport_genl_family,
 30                                 ovs_dp_get_net     43                                 ovs_dp_get_net(dp), notify, 0,
 31                                 0, GFP_KERNEL)     44                                 0, GFP_KERNEL);
 32 }                                                  45 }
 33                                                    46 
 34 void ovs_dp_notify_wq(struct work_struct *work     47 void ovs_dp_notify_wq(struct work_struct *work)
 35 {                                                  48 {
 36         struct ovs_net *ovs_net = container_of     49         struct ovs_net *ovs_net = container_of(work, struct ovs_net, dp_notify_work);
 37         struct datapath *dp;                       50         struct datapath *dp;
 38                                                    51 
 39         ovs_lock();                                52         ovs_lock();
 40         list_for_each_entry(dp, &ovs_net->dps,     53         list_for_each_entry(dp, &ovs_net->dps, list_node) {
 41                 int i;                             54                 int i;
 42                                                    55 
 43                 for (i = 0; i < DP_VPORT_HASH_     56                 for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++) {
 44                         struct vport *vport;       57                         struct vport *vport;
 45                         struct hlist_node *n;      58                         struct hlist_node *n;
 46                                                    59 
 47                         hlist_for_each_entry_s     60                         hlist_for_each_entry_safe(vport, n, &dp->ports[i], dp_hash_node) {
 48                                 if (vport->ops     61                                 if (vport->ops->type == OVS_VPORT_TYPE_INTERNAL)
 49                                         contin     62                                         continue;
 50                                                    63 
 51                                 if (!(netif_is !!  64                                 if (!(vport->dev->priv_flags & IFF_OVS_DATAPATH))
 52                                         dp_det     65                                         dp_detach_port_notify(vport);
 53                         }                          66                         }
 54                 }                                  67                 }
 55         }                                          68         }
 56         ovs_unlock();                              69         ovs_unlock();
 57 }                                                  70 }
 58                                                    71 
 59 static int dp_device_event(struct notifier_blo     72 static int dp_device_event(struct notifier_block *unused, unsigned long event,
 60                            void *ptr)              73                            void *ptr)
 61 {                                                  74 {
 62         struct ovs_net *ovs_net;                   75         struct ovs_net *ovs_net;
 63         struct net_device *dev = netdev_notifi     76         struct net_device *dev = netdev_notifier_info_to_dev(ptr);
 64         struct vport *vport = NULL;                77         struct vport *vport = NULL;
 65                                                    78 
 66         if (!ovs_is_internal_dev(dev))             79         if (!ovs_is_internal_dev(dev))
 67                 vport = ovs_netdev_get_vport(d     80                 vport = ovs_netdev_get_vport(dev);
 68                                                    81 
 69         if (!vport)                                82         if (!vport)
 70                 return NOTIFY_DONE;                83                 return NOTIFY_DONE;
 71                                                    84 
 72         if (event == NETDEV_UNREGISTER) {          85         if (event == NETDEV_UNREGISTER) {
 73                 /* upper_dev_unlink and decrem     86                 /* upper_dev_unlink and decrement promisc immediately */
 74                 ovs_netdev_detach_dev(vport);      87                 ovs_netdev_detach_dev(vport);
 75                                                    88 
 76                 /* schedule vport destroy, dev     89                 /* schedule vport destroy, dev_put and genl notification */
 77                 ovs_net = net_generic(dev_net(     90                 ovs_net = net_generic(dev_net(dev), ovs_net_id);
 78                 queue_work(system_wq, &ovs_net     91                 queue_work(system_wq, &ovs_net->dp_notify_work);
 79         }                                          92         }
 80                                                    93 
 81         return NOTIFY_DONE;                        94         return NOTIFY_DONE;
 82 }                                                  95 }
 83                                                    96 
 84 struct notifier_block ovs_dp_device_notifier =     97 struct notifier_block ovs_dp_device_notifier = {
 85         .notifier_call = dp_device_event           98         .notifier_call = dp_device_event
 86 };                                                 99 };
 87                                                   100 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php