aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-11-19 09:19:38 -0500
committerDavid S. Miller <davem@davemloft.net>2013-11-19 16:39:06 -0500
commit68eb55031da7c967d954e5f9415cd05f4abdb692 (patch)
tree75751944b0c808ba191bcc6a752389593c41e805 /net/openvswitch
parent62b68e99faa802352e9cb2ae91adecd8dfddf1b8 (diff)
genetlink: pass family to functions using groups
This doesn't really change anything, but prepares for the next patch that will change the APIs to pass the group ID within the family, rather than the global group ID. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch')
-rw-r--r--net/openvswitch/datapath.c35
-rw-r--r--net/openvswitch/datapath.h1
-rw-r--r--net/openvswitch/dp_notify.c5
3 files changed, 26 insertions, 15 deletions
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 3e2bb15fd717..5c19846b1d2a 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -61,10 +61,11 @@
61 61
62int ovs_net_id __read_mostly; 62int ovs_net_id __read_mostly;
63 63
64static void ovs_notify(struct sk_buff *skb, struct genl_info *info, 64static void ovs_notify(struct genl_family *family,
65 struct sk_buff *skb, struct genl_info *info,
65 struct genl_multicast_group *grp) 66 struct genl_multicast_group *grp)
66{ 67{
67 genl_notify(skb, genl_info_net(info), info->snd_portid, 68 genl_notify(family, skb, genl_info_net(info), info->snd_portid,
68 grp->id, info->nlhdr, GFP_KERNEL); 69 grp->id, info->nlhdr, GFP_KERNEL);
69} 70}
70 71
@@ -877,9 +878,10 @@ static int ovs_flow_cmd_new_or_set(struct sk_buff *skb, struct genl_info *info)
877 ovs_unlock(); 878 ovs_unlock();
878 879
879 if (!IS_ERR(reply)) 880 if (!IS_ERR(reply))
880 ovs_notify(reply, info, &ovs_dp_flow_multicast_group); 881 ovs_notify(&dp_flow_genl_family, reply, info,
882 &ovs_dp_flow_multicast_group);
881 else 883 else
882 genl_set_err(sock_net(skb->sk), 0, 884 genl_set_err(&dp_flow_genl_family, sock_net(skb->sk), 0,
883 ovs_dp_flow_multicast_group.id, PTR_ERR(reply)); 885 ovs_dp_flow_multicast_group.id, PTR_ERR(reply));
884 return 0; 886 return 0;
885 887
@@ -990,7 +992,8 @@ static int ovs_flow_cmd_del(struct sk_buff *skb, struct genl_info *info)
990 ovs_flow_free(flow, true); 992 ovs_flow_free(flow, true);
991 ovs_unlock(); 993 ovs_unlock();
992 994
993 ovs_notify(reply, info, &ovs_dp_flow_multicast_group); 995 ovs_notify(&dp_flow_genl_family, reply, info,
996 &ovs_dp_flow_multicast_group);
994 return 0; 997 return 0;
995unlock: 998unlock:
996 ovs_unlock(); 999 ovs_unlock();
@@ -1237,7 +1240,8 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
1237 1240
1238 ovs_unlock(); 1241 ovs_unlock();
1239 1242
1240 ovs_notify(reply, info, &ovs_dp_datapath_multicast_group); 1243 ovs_notify(&dp_datapath_genl_family, reply, info,
1244 &ovs_dp_datapath_multicast_group);
1241 return 0; 1245 return 0;
1242 1246
1243err_destroy_local_port: 1247err_destroy_local_port:
@@ -1302,7 +1306,8 @@ static int ovs_dp_cmd_del(struct sk_buff *skb, struct genl_info *info)
1302 __dp_destroy(dp); 1306 __dp_destroy(dp);
1303 ovs_unlock(); 1307 ovs_unlock();
1304 1308
1305 ovs_notify(reply, info, &ovs_dp_datapath_multicast_group); 1309 ovs_notify(&dp_datapath_genl_family, reply, info,
1310 &ovs_dp_datapath_multicast_group);
1306 1311
1307 return 0; 1312 return 0;
1308unlock: 1313unlock:
@@ -1326,14 +1331,15 @@ static int ovs_dp_cmd_set(struct sk_buff *skb, struct genl_info *info)
1326 info->snd_seq, OVS_DP_CMD_NEW); 1331 info->snd_seq, OVS_DP_CMD_NEW);
1327 if (IS_ERR(reply)) { 1332 if (IS_ERR(reply)) {
1328 err = PTR_ERR(reply); 1333 err = PTR_ERR(reply);
1329 genl_set_err(sock_net(skb->sk), 0, 1334 genl_set_err(&dp_datapath_genl_family, sock_net(skb->sk), 0,
1330 ovs_dp_datapath_multicast_group.id, err); 1335 ovs_dp_datapath_multicast_group.id, err);
1331 err = 0; 1336 err = 0;
1332 goto unlock; 1337 goto unlock;
1333 } 1338 }
1334 1339
1335 ovs_unlock(); 1340 ovs_unlock();
1336 ovs_notify(reply, info, &ovs_dp_datapath_multicast_group); 1341 ovs_notify(&dp_datapath_genl_family, reply, info,
1342 &ovs_dp_datapath_multicast_group);
1337 1343
1338 return 0; 1344 return 0;
1339unlock: 1345unlock:
@@ -1425,7 +1431,7 @@ static const struct nla_policy vport_policy[OVS_VPORT_ATTR_MAX + 1] = {
1425 [OVS_VPORT_ATTR_OPTIONS] = { .type = NLA_NESTED }, 1431 [OVS_VPORT_ATTR_OPTIONS] = { .type = NLA_NESTED },
1426}; 1432};
1427 1433
1428static struct genl_family dp_vport_genl_family = { 1434struct genl_family dp_vport_genl_family = {
1429 .id = GENL_ID_GENERATE, 1435 .id = GENL_ID_GENERATE,
1430 .hdrsize = sizeof(struct ovs_header), 1436 .hdrsize = sizeof(struct ovs_header),
1431 .name = OVS_VPORT_FAMILY, 1437 .name = OVS_VPORT_FAMILY,
@@ -1595,7 +1601,8 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info)
1595 goto exit_unlock; 1601 goto exit_unlock;
1596 } 1602 }
1597 1603
1598 ovs_notify(reply, info, &ovs_dp_vport_multicast_group); 1604 ovs_notify(&dp_vport_genl_family, reply, info,
1605 &ovs_dp_vport_multicast_group);
1599 1606
1600exit_unlock: 1607exit_unlock:
1601 ovs_unlock(); 1608 ovs_unlock();
@@ -1642,7 +1649,8 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
1642 BUG_ON(err < 0); 1649 BUG_ON(err < 0);
1643 1650
1644 ovs_unlock(); 1651 ovs_unlock();
1645 ovs_notify(reply, info, &ovs_dp_vport_multicast_group); 1652 ovs_notify(&dp_vport_genl_family, reply, info,
1653 &ovs_dp_vport_multicast_group);
1646 return 0; 1654 return 0;
1647 1655
1648exit_free: 1656exit_free:
@@ -1679,7 +1687,8 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
1679 err = 0; 1687 err = 0;
1680 ovs_dp_detach_port(vport); 1688 ovs_dp_detach_port(vport);
1681 1689
1682 ovs_notify(reply, info, &ovs_dp_vport_multicast_group); 1690 ovs_notify(&dp_vport_genl_family, reply, info,
1691 &ovs_dp_vport_multicast_group);
1683 1692
1684exit_unlock: 1693exit_unlock:
1685 ovs_unlock(); 1694 ovs_unlock();
diff --git a/net/openvswitch/datapath.h b/net/openvswitch/datapath.h
index d3d14a58aa91..4067ea41be28 100644
--- a/net/openvswitch/datapath.h
+++ b/net/openvswitch/datapath.h
@@ -177,6 +177,7 @@ static inline struct vport *ovs_vport_ovsl(const struct datapath *dp, int port_n
177} 177}
178 178
179extern struct notifier_block ovs_dp_device_notifier; 179extern struct notifier_block ovs_dp_device_notifier;
180extern struct genl_family dp_vport_genl_family;
180extern struct genl_multicast_group ovs_dp_vport_multicast_group; 181extern struct genl_multicast_group ovs_dp_vport_multicast_group;
181 182
182void ovs_dp_process_received_packet(struct vport *, struct sk_buff *); 183void ovs_dp_process_received_packet(struct vport *, struct sk_buff *);
diff --git a/net/openvswitch/dp_notify.c b/net/openvswitch/dp_notify.c
index 3d55ead6095c..f4b66c84ea0b 100644
--- a/net/openvswitch/dp_notify.c
+++ b/net/openvswitch/dp_notify.c
@@ -34,13 +34,14 @@ static void dp_detach_port_notify(struct vport *vport)
34 OVS_VPORT_CMD_DEL); 34 OVS_VPORT_CMD_DEL);
35 ovs_dp_detach_port(vport); 35 ovs_dp_detach_port(vport);
36 if (IS_ERR(notify)) { 36 if (IS_ERR(notify)) {
37 genl_set_err(ovs_dp_get_net(dp), 0, 37 genl_set_err(&dp_vport_genl_family, ovs_dp_get_net(dp), 0,
38 ovs_dp_vport_multicast_group.id, 38 ovs_dp_vport_multicast_group.id,
39 PTR_ERR(notify)); 39 PTR_ERR(notify));
40 return; 40 return;
41 } 41 }
42 42
43 genlmsg_multicast_netns(ovs_dp_get_net(dp), notify, 0, 43 genlmsg_multicast_netns(&dp_vport_genl_family,
44 ovs_dp_get_net(dp), notify, 0,
44 ovs_dp_vport_multicast_group.id, 45 ovs_dp_vport_multicast_group.id,
45 GFP_KERNEL); 46 GFP_KERNEL);
46} 47}