• Home
  • Raw
  • Download

Lines Matching refs:dp

136 static int queue_gso_packets(struct datapath *dp, struct sk_buff *,
138 static int queue_userspace_packet(struct datapath *dp, struct sk_buff *,
144 struct datapath *dp = NULL; in get_dp() local
152 dp = vport->dp; in get_dp()
156 return dp; in get_dp()
160 const char *ovs_dp_name(const struct datapath *dp) in ovs_dp_name() argument
162 struct vport *vport = ovs_vport_ovsl_rcu(dp, OVSP_LOCAL); in ovs_dp_name()
166 static int get_dpifindex(struct datapath *dp) in get_dpifindex() argument
173 local = ovs_vport_rcu(dp, OVSP_LOCAL); in get_dpifindex()
186 struct datapath *dp = container_of(rcu, struct datapath, rcu); in destroy_dp_rcu() local
188 free_percpu(dp->stats_percpu); in destroy_dp_rcu()
189 release_net(ovs_dp_get_net(dp)); in destroy_dp_rcu()
190 kfree(dp->ports); in destroy_dp_rcu()
191 kfree(dp); in destroy_dp_rcu()
194 static struct hlist_head *vport_hash_bucket(const struct datapath *dp, in vport_hash_bucket() argument
197 return &dp->ports[port_no & (DP_VPORT_HASH_BUCKETS - 1)]; in vport_hash_bucket()
201 struct vport *ovs_lookup_vport(const struct datapath *dp, u16 port_no) in ovs_lookup_vport() argument
206 head = vport_hash_bucket(dp, port_no); in ovs_lookup_vport()
221 struct datapath *dp = parms->dp; in new_vport() local
222 struct hlist_head *head = vport_hash_bucket(dp, vport->port_no); in new_vport()
244 struct datapath *dp = p->dp; in ovs_dp_process_packet() local
250 stats = this_cpu_ptr(dp->stats_percpu); in ovs_dp_process_packet()
253 flow = ovs_flow_tbl_lookup_stats(&dp->table, key, &n_mask_hit); in ovs_dp_process_packet()
262 error = ovs_dp_upcall(dp, skb, &upcall); in ovs_dp_process_packet()
274 ovs_execute_actions(dp, skb, key); in ovs_dp_process_packet()
285 int ovs_dp_upcall(struct datapath *dp, struct sk_buff *skb, in ovs_dp_upcall() argument
297 err = queue_userspace_packet(dp, skb, upcall_info); in ovs_dp_upcall()
299 err = queue_gso_packets(dp, skb, upcall_info); in ovs_dp_upcall()
306 stats = this_cpu_ptr(dp->stats_percpu); in ovs_dp_upcall()
315 static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb, in queue_gso_packets() argument
333 err = queue_userspace_packet(dp, skb, upcall_info); in queue_gso_packets()
402 static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, in queue_userspace_packet() argument
410 .dst_sk = ovs_dp_get_net(dp)->genl_sock, in queue_userspace_packet()
417 dp_ifindex = get_dpifindex(dp); in queue_userspace_packet()
447 if (dp->user_features & OVS_DP_F_UNALIGNED) in queue_userspace_packet()
486 if (!(dp->user_features & OVS_DP_F_UNALIGNED)) { in queue_userspace_packet()
495 err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid); in queue_userspace_packet()
512 struct datapath *dp; in ovs_packet_cmd_execute() local
572 dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex); in ovs_packet_cmd_execute()
574 if (!dp) in ovs_packet_cmd_execute()
577 input_vport = ovs_vport_rcu(dp, flow->key.phy.in_port); in ovs_packet_cmd_execute()
579 input_vport = ovs_vport_rcu(dp, OVSP_LOCAL); in ovs_packet_cmd_execute()
587 err = ovs_execute_actions(dp, packet, &flow->key); in ovs_packet_cmd_execute()
630 static void get_dp_stats(struct datapath *dp, struct ovs_dp_stats *stats, in get_dp_stats() argument
637 stats->n_flows = ovs_flow_tbl_count(&dp->table); in get_dp_stats()
638 mega_stats->n_masks = ovs_flow_tbl_num_masks(&dp->table); in get_dp_stats()
647 percpu_stats = per_cpu_ptr(dp->stats_percpu, i); in get_dp_stats()
809 struct datapath *dp; in ovs_flow_cmd_new() local
859 dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex); in ovs_flow_cmd_new()
860 if (unlikely(!dp)) { in ovs_flow_cmd_new()
865 flow = ovs_flow_tbl_lookup(&dp->table, &new_flow->unmasked_key); in ovs_flow_cmd_new()
870 error = ovs_flow_tbl_insert(&dp->table, new_flow, &mask); in ovs_flow_cmd_new()
901 flow = ovs_flow_tbl_lookup_exact(&dp->table, &match); in ovs_flow_cmd_new()
971 struct datapath *dp; in ovs_flow_cmd_set() local
1006 dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex); in ovs_flow_cmd_set()
1007 if (unlikely(!dp)) { in ovs_flow_cmd_set()
1012 flow = ovs_flow_tbl_lookup_exact(&dp->table, &match); in ovs_flow_cmd_set()
1069 struct datapath *dp; in ovs_flow_cmd_get() local
1084 dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex); in ovs_flow_cmd_get()
1085 if (!dp) { in ovs_flow_cmd_get()
1090 flow = ovs_flow_tbl_lookup_exact(&dp->table, &match); in ovs_flow_cmd_get()
1117 struct datapath *dp; in ovs_flow_cmd_del() local
1129 dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex); in ovs_flow_cmd_del()
1130 if (unlikely(!dp)) { in ovs_flow_cmd_del()
1136 err = ovs_flow_tbl_flush(&dp->table); in ovs_flow_cmd_del()
1140 flow = ovs_flow_tbl_lookup_exact(&dp->table, &match); in ovs_flow_cmd_del()
1146 ovs_flow_tbl_remove(&dp->table, flow); in ovs_flow_cmd_del()
1178 struct datapath *dp; in ovs_flow_cmd_dump() local
1181 dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex); in ovs_flow_cmd_dump()
1182 if (!dp) { in ovs_flow_cmd_dump()
1187 ti = rcu_dereference(dp->table.ti); in ovs_flow_cmd_dump()
1268 static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb, in ovs_dp_cmd_fill_info() argument
1281 ovs_header->dp_ifindex = get_dpifindex(dp); in ovs_dp_cmd_fill_info()
1283 err = nla_put_string(skb, OVS_DP_ATTR_NAME, ovs_dp_name(dp)); in ovs_dp_cmd_fill_info()
1287 get_dp_stats(dp, &dp_stats, &dp_megaflow_stats); in ovs_dp_cmd_fill_info()
1297 if (nla_put_u32(skb, OVS_DP_ATTR_USER_FEATURES, dp->user_features)) in ovs_dp_cmd_fill_info()
1318 struct datapath *dp; in lookup_datapath() local
1321 dp = get_dp(net, ovs_header->dp_ifindex); in lookup_datapath()
1326 dp = vport && vport->port_no == OVSP_LOCAL ? vport->dp : NULL; in lookup_datapath()
1328 return dp ? dp : ERR_PTR(-ENODEV); in lookup_datapath()
1333 struct datapath *dp; in ovs_dp_reset_user_features() local
1335 dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); in ovs_dp_reset_user_features()
1336 if (IS_ERR(dp)) in ovs_dp_reset_user_features()
1339 WARN(dp->user_features, "Dropping previously announced user features\n"); in ovs_dp_reset_user_features()
1340 dp->user_features = 0; in ovs_dp_reset_user_features()
1343 static void ovs_dp_change(struct datapath *dp, struct nlattr **a) in ovs_dp_change() argument
1346 dp->user_features = nla_get_u32(a[OVS_DP_ATTR_USER_FEATURES]); in ovs_dp_change()
1354 struct datapath *dp; in ovs_dp_cmd_new() local
1368 dp = kzalloc(sizeof(*dp), GFP_KERNEL); in ovs_dp_cmd_new()
1369 if (dp == NULL) in ovs_dp_cmd_new()
1372 ovs_dp_set_net(dp, hold_net(sock_net(skb->sk))); in ovs_dp_cmd_new()
1375 err = ovs_flow_tbl_init(&dp->table); in ovs_dp_cmd_new()
1379 dp->stats_percpu = netdev_alloc_pcpu_stats(struct dp_stats_percpu); in ovs_dp_cmd_new()
1380 if (!dp->stats_percpu) { in ovs_dp_cmd_new()
1385 dp->ports = kmalloc(DP_VPORT_HASH_BUCKETS * sizeof(struct hlist_head), in ovs_dp_cmd_new()
1387 if (!dp->ports) { in ovs_dp_cmd_new()
1393 INIT_HLIST_HEAD(&dp->ports[i]); in ovs_dp_cmd_new()
1399 parms.dp = dp; in ovs_dp_cmd_new()
1403 ovs_dp_change(dp, a); in ovs_dp_cmd_new()
1426 err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, in ovs_dp_cmd_new()
1430 ovs_net = net_generic(ovs_dp_get_net(dp), ovs_net_id); in ovs_dp_cmd_new()
1431 list_add_tail_rcu(&dp->list_node, &ovs_net->dps); in ovs_dp_cmd_new()
1440 kfree(dp->ports); in ovs_dp_cmd_new()
1442 free_percpu(dp->stats_percpu); in ovs_dp_cmd_new()
1444 ovs_flow_tbl_destroy(&dp->table, false); in ovs_dp_cmd_new()
1446 release_net(ovs_dp_get_net(dp)); in ovs_dp_cmd_new()
1447 kfree(dp); in ovs_dp_cmd_new()
1455 static void __dp_destroy(struct datapath *dp) in __dp_destroy() argument
1463 hlist_for_each_entry_safe(vport, n, &dp->ports[i], dp_hash_node) in __dp_destroy()
1468 list_del_rcu(&dp->list_node); in __dp_destroy()
1473 ovs_dp_detach_port(ovs_vport_ovsl(dp, OVSP_LOCAL)); in __dp_destroy()
1476 ovs_flow_tbl_destroy(&dp->table, true); in __dp_destroy()
1478 call_rcu(&dp->rcu, destroy_dp_rcu); in __dp_destroy()
1484 struct datapath *dp; in ovs_dp_cmd_del() local
1492 dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); in ovs_dp_cmd_del()
1493 err = PTR_ERR(dp); in ovs_dp_cmd_del()
1494 if (IS_ERR(dp)) in ovs_dp_cmd_del()
1497 err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, in ovs_dp_cmd_del()
1501 __dp_destroy(dp); in ovs_dp_cmd_del()
1517 struct datapath *dp; in ovs_dp_cmd_set() local
1525 dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); in ovs_dp_cmd_set()
1526 err = PTR_ERR(dp); in ovs_dp_cmd_set()
1527 if (IS_ERR(dp)) in ovs_dp_cmd_set()
1530 ovs_dp_change(dp, info->attrs); in ovs_dp_cmd_set()
1532 err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, in ovs_dp_cmd_set()
1550 struct datapath *dp; in ovs_dp_cmd_get() local
1558 dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); in ovs_dp_cmd_get()
1559 if (IS_ERR(dp)) { in ovs_dp_cmd_get()
1560 err = PTR_ERR(dp); in ovs_dp_cmd_get()
1563 err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, in ovs_dp_cmd_get()
1579 struct datapath *dp; in ovs_dp_cmd_dump() local
1584 list_for_each_entry(dp, &ovs_net->dps, list_node) { in ovs_dp_cmd_dump()
1586 ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid, in ovs_dp_cmd_dump()
1656 ovs_header->dp_ifindex = get_dpifindex(vport->dp); in ovs_vport_cmd_fill_info()
1712 struct datapath *dp; in lookup_vport() local
1720 ovs_header->dp_ifindex != get_dpifindex(vport->dp)) in lookup_vport()
1729 dp = get_dp(net, ovs_header->dp_ifindex); in lookup_vport()
1730 if (!dp) in lookup_vport()
1733 vport = ovs_vport_ovsl_rcu(dp, port_no); in lookup_vport()
1748 struct datapath *dp; in ovs_vport_cmd_new() local
1766 dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex); in ovs_vport_cmd_new()
1768 if (!dp) in ovs_vport_cmd_new()
1772 vport = ovs_vport_ovsl(dp, port_no); in ovs_vport_cmd_new()
1782 vport = ovs_vport_ovsl(dp, port_no); in ovs_vport_cmd_new()
1791 parms.dp = dp; in ovs_vport_cmd_new()
1936 struct datapath *dp; in ovs_vport_cmd_dump() local
1941 dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex); in ovs_vport_cmd_dump()
1942 if (!dp) { in ovs_vport_cmd_dump()
1950 hlist_for_each_entry_rcu(vport, &dp->ports[i], dp_hash_node) { in ovs_vport_cmd_dump()
2066 struct datapath *dp; in list_vports_from_net() local
2068 list_for_each_entry(dp, &ovs_net->dps, list_node) { in list_vports_from_net()
2074 hlist_for_each_entry(vport, &dp->ports[i], dp_hash_node) { in list_vports_from_net()
2090 struct datapath *dp, *dp_next; in ovs_exit_net() local
2097 list_for_each_entry_safe(dp, dp_next, &ovs_net->dps, list_node) in ovs_exit_net()
2098 __dp_destroy(dp); in ovs_exit_net()