datapath.c (e8eedb85bd238613332570ac6ae683fee94fbe36) | datapath.c (12eb18f7115884b0c1513dda31b0051121116b3a) |
---|---|
1/* 2 * Copyright (c) 2007-2014 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 --- 164 unchanged lines hidden (view full) --- 173 174/* Must be called with rcu_read_lock or ovs_mutex. */ 175const char *ovs_dp_name(const struct datapath *dp) 176{ 177 struct vport *vport = ovs_vport_ovsl_rcu(dp, OVSP_LOCAL); 178 return vport->ops->get_name(vport); 179} 180 | 1/* 2 * Copyright (c) 2007-2014 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 --- 164 unchanged lines hidden (view full) --- 173 174/* Must be called with rcu_read_lock or ovs_mutex. */ 175const char *ovs_dp_name(const struct datapath *dp) 176{ 177 struct vport *vport = ovs_vport_ovsl_rcu(dp, OVSP_LOCAL); 178 return vport->ops->get_name(vport); 179} 180 |
181static int get_dpifindex(struct datapath *dp) | 181static int get_dpifindex(const struct datapath *dp) |
182{ 183 struct vport *local; 184 int ifindex; 185 186 rcu_read_lock(); 187 188 local = ovs_vport_rcu(dp, OVSP_LOCAL); 189 if (local) --- 438 unchanged lines hidden (view full) --- 628 .version = OVS_PACKET_VERSION, 629 .maxattr = OVS_PACKET_ATTR_MAX, 630 .netnsok = true, 631 .parallel_ops = true, 632 .ops = dp_packet_genl_ops, 633 .n_ops = ARRAY_SIZE(dp_packet_genl_ops), 634}; 635 | 182{ 183 struct vport *local; 184 int ifindex; 185 186 rcu_read_lock(); 187 188 local = ovs_vport_rcu(dp, OVSP_LOCAL); 189 if (local) --- 438 unchanged lines hidden (view full) --- 628 .version = OVS_PACKET_VERSION, 629 .maxattr = OVS_PACKET_ATTR_MAX, 630 .netnsok = true, 631 .parallel_ops = true, 632 .ops = dp_packet_genl_ops, 633 .n_ops = ARRAY_SIZE(dp_packet_genl_ops), 634}; 635 |
636static void get_dp_stats(struct datapath *dp, struct ovs_dp_stats *stats, | 636static void get_dp_stats(const struct datapath *dp, struct ovs_dp_stats *stats, |
637 struct ovs_dp_megaflow_stats *mega_stats) 638{ 639 int i; 640 641 memset(mega_stats, 0, sizeof(*mega_stats)); 642 643 stats->n_flows = ovs_flow_tbl_count(&dp->table); 644 mega_stats->n_masks = ovs_flow_tbl_num_masks(&dp->table); --- 702 unchanged lines hidden (view full) --- 1347 1348static struct sk_buff *ovs_dp_cmd_alloc_info(struct genl_info *info) 1349{ 1350 return genlmsg_new_unicast(ovs_dp_cmd_msg_size(), info, GFP_KERNEL); 1351} 1352 1353/* Called with rcu_read_lock or ovs_mutex. */ 1354static struct datapath *lookup_datapath(struct net *net, | 637 struct ovs_dp_megaflow_stats *mega_stats) 638{ 639 int i; 640 641 memset(mega_stats, 0, sizeof(*mega_stats)); 642 643 stats->n_flows = ovs_flow_tbl_count(&dp->table); 644 mega_stats->n_masks = ovs_flow_tbl_num_masks(&dp->table); --- 702 unchanged lines hidden (view full) --- 1347 1348static struct sk_buff *ovs_dp_cmd_alloc_info(struct genl_info *info) 1349{ 1350 return genlmsg_new_unicast(ovs_dp_cmd_msg_size(), info, GFP_KERNEL); 1351} 1352 1353/* Called with rcu_read_lock or ovs_mutex. */ 1354static struct datapath *lookup_datapath(struct net *net, |
1355 struct ovs_header *ovs_header, | 1355 const struct ovs_header *ovs_header, |
1356 struct nlattr *a[OVS_DP_ATTR_MAX + 1]) 1357{ 1358 struct datapath *dp; 1359 1360 if (!a[OVS_DP_ATTR_NAME]) 1361 dp = get_dp(net, ovs_header->dp_ifindex); 1362 else { 1363 struct vport *vport; --- 11 unchanged lines hidden (view full) --- 1375 dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); 1376 if (IS_ERR(dp)) 1377 return; 1378 1379 WARN(dp->user_features, "Dropping previously announced user features\n"); 1380 dp->user_features = 0; 1381} 1382 | 1356 struct nlattr *a[OVS_DP_ATTR_MAX + 1]) 1357{ 1358 struct datapath *dp; 1359 1360 if (!a[OVS_DP_ATTR_NAME]) 1361 dp = get_dp(net, ovs_header->dp_ifindex); 1362 else { 1363 struct vport *vport; --- 11 unchanged lines hidden (view full) --- 1375 dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); 1376 if (IS_ERR(dp)) 1377 return; 1378 1379 WARN(dp->user_features, "Dropping previously announced user features\n"); 1380 dp->user_features = 0; 1381} 1382 |
1383static void ovs_dp_change(struct datapath *dp, struct nlattr **a) | 1383static void ovs_dp_change(struct datapath *dp, struct nlattr *a[]) |
1384{ 1385 if (a[OVS_DP_ATTR_USER_FEATURES]) 1386 dp->user_features = nla_get_u32(a[OVS_DP_ATTR_USER_FEATURES]); 1387} 1388 1389static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) 1390{ 1391 struct nlattr **a = info->attrs; --- 347 unchanged lines hidden (view full) --- 1739 retval = ovs_vport_cmd_fill_info(vport, skb, portid, seq, 0, cmd); 1740 BUG_ON(retval < 0); 1741 1742 return skb; 1743} 1744 1745/* Called with ovs_mutex or RCU read lock. */ 1746static struct vport *lookup_vport(struct net *net, | 1384{ 1385 if (a[OVS_DP_ATTR_USER_FEATURES]) 1386 dp->user_features = nla_get_u32(a[OVS_DP_ATTR_USER_FEATURES]); 1387} 1388 1389static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) 1390{ 1391 struct nlattr **a = info->attrs; --- 347 unchanged lines hidden (view full) --- 1739 retval = ovs_vport_cmd_fill_info(vport, skb, portid, seq, 0, cmd); 1740 BUG_ON(retval < 0); 1741 1742 return skb; 1743} 1744 1745/* Called with ovs_mutex or RCU read lock. */ 1746static struct vport *lookup_vport(struct net *net, |
1747 struct ovs_header *ovs_header, | 1747 const struct ovs_header *ovs_header, |
1748 struct nlattr *a[OVS_VPORT_ATTR_MAX + 1]) 1749{ 1750 struct datapath *dp; 1751 struct vport *vport; 1752 1753 if (a[OVS_VPORT_ATTR_NAME]) { 1754 vport = ovs_vport_locate(net, nla_data(a[OVS_VPORT_ATTR_NAME])); 1755 if (!vport) --- 446 unchanged lines hidden --- | 1748 struct nlattr *a[OVS_VPORT_ATTR_MAX + 1]) 1749{ 1750 struct datapath *dp; 1751 struct vport *vport; 1752 1753 if (a[OVS_VPORT_ATTR_NAME]) { 1754 vport = ovs_vport_locate(net, nla_data(a[OVS_VPORT_ATTR_NAME])); 1755 if (!vport) --- 446 unchanged lines hidden --- |