Re: [ovs-dev] Congratulations on your Award. Kindly Contact Me For More Details on your Award
___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
[ovs-dev] [PATCH] packet_type: Force _ETHERTYPE mask in netlink messages
The kernel does not understand packet_type so it's implicitly encoded by the absence of _ETHERNET and presence of _ETHERTYPE. For non-Ethernet we need to force the mask for _ETHERTYPE otherwise the kernel's match_validate() will complain. The mask use to always be set in xlate_wc_init() and xlate_wc_finish(), but that changed for non-Ethernet frames with the commit listed in Fixes. Fixes: 3d4b2e6eb74e ("userspace: Add OXM field MFF_PACKET_TYPE") Signed-off-by: Eric Garver --- lib/odp-util.c | 11 ++- tests/packet-type-aware.at | 4 ++-- tests/system-userspace-packet-type-aware.at | 8 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/odp-util.c b/lib/odp-util.c index f4c0b665068f..956d9608b220 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -4588,7 +4588,16 @@ odp_flow_key_from_flow__(const struct odp_flow_key_parms *parms, goto unencap; } -nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, data->dl_type); +if (export_mask && flow->packet_type != htonl(PT_ETH)) { +/* The kernel does not yet explicitly support packet_type. However, it + * implicitly supports it by the absence of _ETHERNET and the presence + * of _ETHERTYPE. This mean we must force an exact match on the + * _ETHERTYPE. + */ +nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, OVS_BE16_MAX); +} else { +nl_msg_put_be16(buf, OVS_KEY_ATTR_ETHERTYPE, data->dl_type); +} if (eth_type_vlan(flow->dl_type)) { goto unencap; diff --git a/tests/packet-type-aware.at b/tests/packet-type-aware.at index 110407857786..43756eba3041 100644 --- a/tests/packet-type-aware.at +++ b/tests/packet-type-aware.at @@ -407,8 +407,8 @@ AT_CHECK([ recirc_id(0),in_port(br-p2),packet_type(ns=0,id=0),eth(dst=aa:55:00:00:00:01),eth_type(0x0800),ipv4(src=20.0.0.2,dst=20.0.0.1,proto=47,frag=no), packets:1, bytes:122, used:0.0s, actions:set(ipv4(src=10.0.0.2,dst=10.0.0.1)),tnl_pop(gre_sys) recirc_id(0),in_port(br-p3),packet_type(ns=0,id=0),eth(dst=aa:55:00:00:00:02),eth_type(0x0800),ipv4(src=30.0.0.3,dst=30.0.0.2,proto=47,frag=no), packets:1, bytes:122, used:0.0s, actions:set(ipv4(src=20.0.0.3,dst=20.0.0.2)),tnl_pop(gre_sys) recirc_id(0),in_port(n3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(dst=192.168.10.10,tos=0/0x3,frag=no), packets:1, bytes:98, used:0.0s, actions:pop_eth,tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=aa:55:00:00:00:02,src=aa:55:00:00:00:03,dl_type=0x0800),ipv4(src=30.0.0.3,dst=30.0.0.2,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x800))),out_port(br-p3)) -tunnel(src=10.0.0.2,dst=10.0.0.1,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=1,id=0x800),ipv4(dst=192.168.10.10,frag=no), packets:1, bytes:84, used:0.0s, actions:push_eth(src=00:00:00:00:00:00,dst=aa:55:aa:55:00:01),n1 -tunnel(src=20.0.0.3,dst=20.0.0.2,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=1,id=0x800),ipv4(dst=192.168.10.10,tos=0/0x3,frag=no), packets:1, bytes:84, used:0.0s, actions:tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=aa:55:00:00:00:01,src=aa:55:00:00:00:02,dl_type=0x0800),ipv4(src=20.0.0.2,dst=20.0.0.1,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x800))),out_port(br-p2)) +tunnel(src=10.0.0.2,dst=10.0.0.1,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=1,id=0x800),eth_type(0x0800),ipv4(dst=192.168.10.10,frag=no), packets:1, bytes:84, used:0.0s, actions:push_eth(src=00:00:00:00:00:00,dst=aa:55:aa:55:00:01),n1 +tunnel(src=20.0.0.3,dst=20.0.0.2,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=1,id=0x800),eth_type(0x0800),ipv4(dst=192.168.10.10,tos=0/0x3,frag=no), packets:1, bytes:84, used:0.0s, actions:tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=aa:55:00:00:00:01,src=aa:55:00:00:00:02,dl_type=0x0800),ipv4(src=20.0.0.2,dst=20.0.0.1,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x800))),out_port(br-p2)) ]) # Clear up megaflow cache diff --git a/tests/system-userspace-packet-type-aware.at b/tests/system-userspace-packet-type-aware.at index 65d81ce8ecdd..b405b2520edd 100644 --- a/tests/system-userspace-packet-type-aware.at +++ b/tests/system-userspace-packet-type-aware.at @@ -355,8 +355,8 @@ recirc_id(0),in_port(6),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), p recirc_id(0),in_port(7),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:2, bytes:244, used:0.0s, actions:10 recirc_id(0),in_port(8),packet_type(ns=0,id=0),eth(dst=aa:55:00:00:00:01),eth_type(0x0800),ipv4(src=20.0.0.2,dst=20.0.0.1,proto=47,frag=no), packets:2, bytes:244, used:0.0s, actions:set(ipv4(src=10.0.0.2,dst=10.0.0.1)),tnl_pop(14) recirc_id(0),in_port(9),packet_type(ns=0,id=0),eth(dst=aa:55:00:00:00:02),eth_type(0x0800),ipv4(src=30.0.0.3,dst=30.0.0.2,proto=47,frag=no), packets:2, bytes:244, used:0.0s, actions:set(ipv4(src=20.0.0.3,dst=20.0.0.2)),tnl_pop(14) -tunnel(s
[ovs-dev] [PATCH] netdev: fix missing shifts of VXLAN_EXT_GPE
Contrary to the comment by the enum value, these are actually regular enum values that need shifted. VXLAN_EXT_GBP for example is used as a netlink value for vports. Fixes: 875ab13020b1 ("userspace: Handling of versatile tunnel ports") Signed-off-by: Eric Garver --- datapath/linux/compat/include/linux/openvswitch.h | 5 +++-- lib/netdev-vport.c| 7 --- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h index 91d31401ae71..9d08dacae5cc 100644 --- a/datapath/linux/compat/include/linux/openvswitch.h +++ b/datapath/linux/compat/include/linux/openvswitch.h @@ -290,8 +290,9 @@ enum ovs_vport_attr { enum { OVS_VXLAN_EXT_UNSPEC, - OVS_VXLAN_EXT_GBP, /* Flag or __u32 */ - OVS_VXLAN_EXT_GPE = 8, /* Flag or __u32 */ + OVS_VXLAN_EXT_GBP, + /* place new values here to fill gap. */ + OVS_VXLAN_EXT_GPE = 8, __OVS_VXLAN_EXT_MAX, }; diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 7de58b8a313e..64a3ba3c46ff 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -407,7 +407,8 @@ tunnel_supported_layers(const char *type, return TNL_L3; } else if (!strcmp(type, "gre")) { return TNL_L2 | TNL_L3; -} else if (!strcmp(type, "vxlan") && tnl_cfg->exts & OVS_VXLAN_EXT_GPE) { +} else if (!strcmp(type, "vxlan") + && tnl_cfg->exts & (1 << OVS_VXLAN_EXT_GPE)) { return TNL_L2 | TNL_L3; } else { return TNL_L2; @@ -545,8 +546,8 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args, char **errp) enum tunnel_layers layers = tunnel_supported_layers(type, &tnl_cfg); const char *full_type = (strcmp(type, "vxlan") ? type - : tnl_cfg.exts & OVS_VXLAN_EXT_GPE ? "VXLAN-GPE" - : "VXLAN (without GPE"); + : (tnl_cfg.exts & (1 << OVS_VXLAN_EXT_GPE) +? "VXLAN-GPE" : "VXLAN (without GPE")); const char *packet_type = smap_get(args, "packet_type"); if (!packet_type) { tnl_cfg.pt_mode = default_pt_mode(layers); -- 2.12.0 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
[ovs-dev] [PATCH 4/4] netdev: fix crash when interface option is changed to invalid value
When trying to modify an interface option (e.g. remote IP of a GRE port) to an invalid value, the vswitchd does crash. For instance: ovs-vsctl add-br br0 ovs-vsctl add-port br0 gre0 -- set interface gre0 type=gre \ options:remote_ip=10.0.0.2 ovs-vsctl set interface gre0 options:remote_ip=9.9.9 The bug is caused by trying to dereference a NULL pointer. It was introduced by the commit 9fff138ec3a6. Before that, the NULL pointer was handled by the VLOG_WARN_BUF macro. Signed-off-by: Zoltán Balogh CC: Daniele Di Proietto Fixes: 9fff138ec3a6 ("netdev: Add 'errp' to set_config().") --- lib/netdev.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/netdev.c b/lib/netdev.c index a7840a8..26e87a2 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -469,7 +469,11 @@ netdev_set_config(struct netdev *netdev, const struct smap *args, char **errp) "%s: could not set configuration (%s)", netdev_get_name(netdev), ovs_strerror(error)); if (verbose_error) { -*errp = verbose_error; +if (errp) { +*errp = verbose_error; +} else { +free(verbose_error); +} } } return error; -- 1.9.1 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
[ovs-dev] [PATCH 3/4] ofproto-dpif-xlate: drop L3 packets on L2 legacy port
This commit drops packet during xlate if it is a L3 packet and output port packet_type is legacy_l2. It completes PTAP unit tests with: - Send L3 packet over patch port. - Output L2/L3 packet to ports with different packet_type properties. Signed-off-by: Zoltán Balogh --- ofproto/ofproto-dpif-xlate.c | 23 +++- tests/packet-type-aware.at | 304 +++ 2 files changed, 320 insertions(+), 7 deletions(-) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 575c59e..a157fc9 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -3314,6 +3314,14 @@ check_output_prerequisites(struct xlate_ctx *ctx, return false; } } + +if (xport->pt_mode == NETDEV_PT_LEGACY_L2 && + flow->packet_type != htonl(PT_ETH)) { +xlate_report(ctx, OFT_WARN, "Trying to send non-Ethernet packet " + "through legacy L2 port. Dropping packet."); +return false; +} + return true; } @@ -3347,6 +3355,10 @@ compose_output_action__(struct xlate_ctx *ctx, ofp_port_t ofp_port, odp_port_t out_port, odp_port, odp_tnl_port; bool is_native_tunnel = false; uint8_t dscp; +struct eth_addr flow_dl_dst = flow->dl_dst; +struct eth_addr flow_dl_src = flow->dl_src; +ovs_be32 flow_packet_type = flow->packet_type; +ovs_be16 flow_dl_type = flow->dl_type; /* If 'struct flow' gets additional metadata, we'll need to zero it out * before traversing a patch port. */ @@ -3363,13 +3375,6 @@ compose_output_action__(struct xlate_ctx *ctx, ofp_port_t ofp_port, flow->packet_type = PACKET_TYPE_BE(OFPHTN_ETHERTYPE, ntohs(flow->dl_type)); } -} else { -/* Add dummy Ethernet header for legacy L2 port. */ -if (xport->pt_mode == NETDEV_PT_LEGACY_L2) { -flow->packet_type = htonl(PT_ETH); -flow->dl_dst = eth_addr_zero; -flow->dl_src = eth_addr_zero; -} } if (xport->peer) { @@ -3629,6 +3634,10 @@ compose_output_action__(struct xlate_ctx *ctx, ofp_port_t ofp_port, /* Restore flow */ memcpy(flow->vlans, flow_vlans, sizeof flow->vlans); flow->nw_tos = flow_nw_tos; +flow->dl_dst = flow_dl_dst; +flow->dl_src = flow_dl_src; +flow->packet_type = flow_packet_type; +flow->dl_type = flow_dl_type; } static void diff --git a/tests/packet-type-aware.at b/tests/packet-type-aware.at index 1104078..a1be7ca 100644 --- a/tests/packet-type-aware.at +++ b/tests/packet-type-aware.at @@ -461,3 +461,307 @@ aa55aa550003461e7d1a95a108004554f89540004001ac90c0a80a14c0a80a1e0800736f0c1e OVS_VSWITCHD_STOP(["/The Open vSwitch kernel module is probably not loaded/d"]) AT_CLEANUP + + +AT_SETUP([ptap - L3 over patch port]) + + +# L3 over patch port +# +# (192.168.10.10) (192.168.10.30) +#n0 n1 +# | | +# +--o--+ +--o--+ +# | br0 | | br1 | +# +--o--+ +--o---o--+ +# p0 |p1 | gre1 (ptap) +# +---+ 10.0.0.1 +# +# LOCAL +# +--o--+ +# | br2 | +# +--o--+ +# | +#n2 +# 10.0.0.2 + +HWADDR_BRP2=aa:55:00:00:00:02 + +OVS_VSWITCHD_START([dnl +-- add-br br1 \ +-- set bridge br1 datapath_type=dummy fail-mode=secure \ +-- add-br br2 \ +-- set bridge br2 datapath_type=dummy fail-mode=secure \ + other_config:hwaddr=\"$HWADDR_BRP2\" \ +-- add-port br0 p0 \ +-- set interface p0 type=patch options:peer=p1 ofport_request=10 \ +-- add-port br1 p1 \ +-- set interface p1 type=patch options:peer=p0 ofport_request=20 \ +-- add-port br0 n0 \ +-- set interface n0 type=dummy ofport_request=30 \ +-- add-port br1 n1 \ +-- set interface n1 type=dummy options:tx_pcap=n1.pcap ofport_request=40 \ +-- add-port br2 n2 \ +-- set interface n2 type=dummy options:tx_pcap=n2.pcap ofport_request=50 \ +-- add-port br1 gre1 \ +-- set interface gre1 type=gre options:remote_ip=10.0.0.2 \ + options:packet_type=ptap ofport_request=100 +]) + +### Verify datapath configuration +AT_CHECK([ +ovs-appctl dpif/show | grep -v hit | sed 's/\t//g' | sed 's./[[0-9]]\{1,\}..' +], [0], [dnl +br0: +br0 65534: (dummy-internal) +n0 30: (dummy) +p0 10/none: (patch: peer=p1) +br1: +br1 65534: (dummy-internal) +gre1 100: (gre: packet_type=ptap, remote_ip=10.0.0.2) +n1 40: (dummy) +p1 20/none: (patch: peer=p0) +br2: +br2 65534: (dummy-internal) +n2 50: (dummy) +]) + +AT_CHECK([ +ovs-appctl netdev-dummy/ip4addr br2 10.0.0.1/24 && +ovs-appctl ovs/route/add 10.
[ovs-dev] [PATCH 2/4] Translation of generic encap and decap actions
From: Jan Scheurich This commit implements a skeleton for the translation of generic encap and decap actions in ofproto-dpif and adds support to encap and decap an Ethernet header. In general translation of encap commits pending actions and then rewrites struct flow in accordance with the new packet type and header. In the case of encap(ethernet) it suffices to change the packet type from (1, Ethertype) to (0,0) and set the dl_type accordingly. A new pending_encap flag in xlate ctx is set to mark that an corresponding datapath encap action must be triggered at the next commit. In the case of encap(ethernet) ofproto generetas a push_eth action. The general case for translation of decap() is to emit a datapath action to decap the current outermost header and then recirculate the packet to reparse the inner headers. In the special case of an Ethernet packet, decap() just changes the packet type from (0,0) to (1, dl_type) without a need to recirculate. The emission of the pop_eth action for the datapath is postponed to the next commit. Hence encap(ethernet) and decap() on an Ethernet packet are OF octions that only incur a cost in the dataplane when a modifed packet is actually committed, e.g. because it is sent out. They can freely be used for normalizing the packet type in the OF pipeline without degrading performance. Signed-off-by: Jan Scheurich Signed-off-by: Yi Yang --- lib/odp-util.c | 84 +- lib/odp-util.h | 3 +- ofproto/ofproto-dpif-xlate.c | 97 +++- 3 files changed, 153 insertions(+), 31 deletions(-) diff --git a/lib/odp-util.c b/lib/odp-util.c index f4c0b66..d9fee4f 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -5862,13 +5862,17 @@ put_ethernet_key(const struct ovs_key_ethernet *eth, struct flow *flow) } static void -commit_set_ether_addr_action(const struct flow *flow, struct flow *base_flow, - struct ofpbuf *odp_actions, - struct flow_wildcards *wc, - bool use_masked) +commit_set_ether_action(const struct flow *flow, struct flow *base_flow, +struct ofpbuf *odp_actions, +struct flow_wildcards *wc, +bool use_masked) { struct ovs_key_ethernet key, base, mask; +if (flow->packet_type != htonl(PT_ETH)) { +return; +} + get_ethernet_key(flow, &key); get_ethernet_key(base_flow, &base); get_ethernet_key(&wc->masks, &mask); @@ -5881,29 +5885,6 @@ commit_set_ether_addr_action(const struct flow *flow, struct flow *base_flow, } static void -commit_ether_action(const struct flow *flow, struct flow *base_flow, -struct ofpbuf *odp_actions, struct flow_wildcards *wc, -bool use_masked) -{ -if (flow->packet_type == htonl(PT_ETH)) { -if (base_flow->packet_type != htonl(PT_ETH)) { -odp_put_push_eth_action(odp_actions, &flow->dl_src, &flow->dl_dst); -base_flow->packet_type = flow->packet_type; -base_flow->dl_src = flow->dl_src; -base_flow->dl_dst = flow->dl_dst; -} else { -commit_set_ether_addr_action(flow, base_flow, odp_actions, wc, - use_masked); -} -} else { -if (base_flow->packet_type == htonl(PT_ETH)) { -odp_put_pop_eth_action(odp_actions); -base_flow->packet_type = flow->packet_type; -} -} -} - -static void commit_vlan_action(const struct flow* flow, struct flow *base, struct ofpbuf *odp_actions, struct flow_wildcards *wc) { @@ -6340,6 +6321,50 @@ commit_set_pkt_mark_action(const struct flow *flow, struct flow *base_flow, } } +static void +commit_packet_type_change(const struct flow *flow, + struct flow *base_flow, + struct ofpbuf *odp_actions, + struct flow_wildcards *wc, + bool pending_encap) +{ +if (flow->packet_type == base_flow->packet_type) { +return; +} + +if (pending_encap) { +switch (ntohl(flow->packet_type)) { +case PT_ETH: { +/* push_eth */ +odp_put_push_eth_action(odp_actions, &flow->dl_src, +&flow->dl_dst); +base_flow->packet_type = flow->packet_type; +base_flow->dl_src = flow->dl_src; +base_flow->dl_dst = flow->dl_dst; +break; +} +default: +/* Only the above protocols are supported for encap. The check + * is done at action decoding. */ +OVS_NOT_REACHED(); +} +} else { +if (pt_ns(flow->packet_type) == OFPHTN_ETHERTYPE && +base_flow->packet_type == htonl(PT_ETH)) { +/* pop_eth */ +odp_put_pop_eth_action(odp
[ovs-dev] [PATCH 1/4] Add OF actions for generic encap and decap
From: Jan Scheurich This commit adds support for the OpenFlow actions generic encap and decap (as specified in ONF EXT-382) to the OVS control plane. CLI syntax for encap action with properties: encap(hdr=) encap(hdr=, prop(class=,type=,val=), prop(class=,type=,val())) CLI syntax for decap action: decap() decap(packet_type(ns=,type=)) The first header supported for encap and decap is "ethernet" to convert packets between packet_type (1,Ethertype) and (0,0). Signed-off-by: Jan Scheurich Signed-off-by: Yi Yang --- include/openflow/openflow-common.h | 1 + include/openvswitch/automake.mk| 1 + include/openvswitch/ofp-actions.h | 31 include/openvswitch/ofp-ed-props.h | 69 +++ include/openvswitch/ofp-errors.h | 9 + lib/automake.mk| 1 + lib/ofp-actions.c | 368 - lib/ofp-ed-props.c | 150 +++ lib/packets.h | 3 +- ofproto/ofproto-dpif-xlate.c | 11 +- 10 files changed, 633 insertions(+), 11 deletions(-) create mode 100644 include/openvswitch/ofp-ed-props.h create mode 100644 lib/ofp-ed-props.c diff --git a/include/openflow/openflow-common.h b/include/openflow/openflow-common.h index 3a0a575..2776712 100644 --- a/include/openflow/openflow-common.h +++ b/include/openflow/openflow-common.h @@ -465,6 +465,7 @@ enum ofp_header_type_namespaces { OFPHTN_IP_PROTO = 2,/* ns_type is a IP protocol number. */ OFPHTN_UDP_TCP_PORT = 3,/* ns_type is a TCP or UDP port. */ OFPHTN_IPV4_OPTION = 4, /* ns_type is an IPv4 option number. */ +__OFPHTN_MAX }; #endif /* openflow/openflow-common.h */ diff --git a/include/openvswitch/automake.mk b/include/openvswitch/automake.mk index 699d9d7..c8e67a2 100644 --- a/include/openvswitch/automake.mk +++ b/include/openvswitch/automake.mk @@ -12,6 +12,7 @@ openvswitchinclude_HEADERS = \ include/openvswitch/meta-flow.h \ include/openvswitch/ofpbuf.h \ include/openvswitch/ofp-actions.h \ + include/openvswitch/ofp-ed-props.h \ include/openvswitch/ofp-errors.h \ include/openvswitch/ofp-msgs.h \ include/openvswitch/ofp-parse.h \ diff --git a/include/openvswitch/ofp-actions.h b/include/openvswitch/ofp-actions.h index 7b4aa92..33021e5 100644 --- a/include/openvswitch/ofp-actions.h +++ b/include/openvswitch/ofp-actions.h @@ -25,6 +25,7 @@ #include "openvswitch/ofp-util.h" #include "openvswitch/ofp-errors.h" #include "openvswitch/types.h" +#include "openvswitch/ofp-ed-props.h" struct vl_mff_map; @@ -89,6 +90,10 @@ struct vl_mff_map; OFPACT(PUSH_MPLS, ofpact_push_mpls, ofpact, "push_mpls")\ OFPACT(POP_MPLS,ofpact_pop_mpls,ofpact, "pop_mpls") \ \ +/* Generic encap & decap */ \ +OFPACT(ENCAP, ofpact_encap, props, "encap") \ +OFPACT(DECAP, ofpact_decap, ofpact, "decap")\ +\ /* Metadata. */ \ OFPACT(SET_TUNNEL, ofpact_tunnel, ofpact, "set_tunnel") \ OFPACT(SET_QUEUE, ofpact_queue, ofpact, "set_queue")\ @@ -969,6 +974,32 @@ struct ofpact_unroll_xlate { ovs_be64 rule_cookie; /* OVS_BE64_MAX if none. */ }; +/* OFPACT_ENCAP. + * + * Used for OFPAT_ENCAP. */ + +#define OFPACT_ENCAP_MAX_PROP_SIZE 256 + +struct ofpact_encap { +struct ofpact ofpact; +ovs_be32 new_pkt_type;/* Packet type of the header to add. */ +uint16_t hdr_size;/* New header size in bytes. */ +uint16_t n_props; /* Number of encap properties. */ +struct ofpact_ed_prop props[0]; /* Properties in internal format. */ +}; + +/* OFPACT_DECAP. + * + * Used for OFPAT_DECAP. */ +struct ofpact_decap { +struct ofpact ofpact; +ovs_be32 new_pkt_type; /* New packet type. The special value + (0,0xFFFE) "Use next proto" is used to + request OvS to automatically set the + new packet type based on the decap'ed + header's next protocol.*/ +}; + /* Converting OpenFlow to ofpacts. */ enum ofperr ofpacts_pull_openflow_actions(struct ofpbuf *openflow, unsigned int actions_len, diff --git a/include/openvswitch/ofp-ed-props.h b/include/openvswitch/ofp-ed-props.h new file mode 100644 index 000..1db7e56 --- /dev/null +++ b/include/openvswitch/ofp-ed-props.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2017 Intel, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance
[ovs-dev] [PATCH 0/4] basic encap/decap
This series is a continuation of other patch series initiated by Jan Scheurich before. These were already applied to the master branch: - userspace: Support for L3 tunneling https://mail.openvswitch.org/pipermail/ovs-dev/2017-June/87.html - Packet type aware pipeline https://mail.openvswitch.org/pipermail/ovs-dev/2017-June/334512.html The main purpose of this series is to add support for the OpenFlow actions generic encap and decap (ONF EXT-382) to the OVS control plane. It implements a skeleton for translation of generic encap and decap actions in ofproto-dpif and provides support to encap and decap an Ethernet header. Furthermore it contains bug fixes. Jan Scheurich (2) Add OF actions for generic encap and decap. Translation of generic encap and decap actions. Zoltán Balogh (2) ofproto-dpif-xlate: drop L3 packets on L2 legacy port. netdev: fix crash when interface option is changed to invalid value. include/openflow/openflow-common.h | 1 + include/openvswitch/automake.mk| 1 + include/openvswitch/ofp-actions.h | 31 include/openvswitch/ofp-ed-props.h | 69 +++ include/openvswitch/ofp-errors.h | 9 + lib/automake.mk| 1 + lib/netdev.c | 6 +- lib/odp-util.c | 84 ++--- lib/odp-util.h | 3 +- lib/ofp-actions.c | 368 - lib/ofp-ed-props.c | 150 +++ lib/packets.h | 3 +- ofproto/ofproto-dpif-xlate.c | 129 - tests/packet-type-aware.at | 304 ++ 14 files changed, 1109 insertions(+), 50 deletions(-) ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [PATCH 2/5] lib/dp-packet: copy additional packet info when do packet copy
>-Original Message- >From: 仇大玉 [mailto:qiud...@chinac.com] >Sent: Tuesday, June 27, 2017 3:31 AM >To: Kavanagh, Mark B ; Michael Qiu >; d...@openvswitch.org >Cc: b...@ovn.org; db...@vmware.com >Subject: Re: [PATCH 2/5] lib/dp-packet: copy additional packet info when do >packet copy > > > >在 2017/6/26 23:07, Kavanagh, Mark B 写道: >>> From: Michael Qiu [mailto:qdy220091...@gmail.com] >>> Sent: Monday, June 19, 2017 6:29 AM >>> To: d...@openvswitch.org >>> Cc: Kavanagh, Mark B ; b...@ovn.org; >db...@vmware.com; Michael Qiu >>> >>> Subject: [PATCH 2/5] lib/dp-packet: copy additional packet info when do >packet copy >>> >>> From: Michael Qiu >>> >>> Currently, when doing packet copy, lots of DPDK mbuf's info >>> will be missed, like packet type, ol_flags, etc. >>> Those information is very important for DPDK to do >>> packets processing. >>> >>> Signed-off-by: Michael Qiu >>> --- >>> lib/dp-packet.c | 3 +++ >>> lib/netdev-dpdk.c | 4 >>> 2 files changed, 7 insertions(+) >>> >>> diff --git a/lib/dp-packet.c b/lib/dp-packet.c >>> index ee2c449..9f872a1 100644 >>> --- a/lib/dp-packet.c >>> +++ b/lib/dp-packet.c >>> @@ -179,6 +179,9 @@ dp_packet_clone_with_headroom(const struct dp_packet >*buffer, size_t >>> headroom) >>> new_buffer->packet_type = buffer->packet_type; >>> #ifdef DPDK_NETDEV >>> new_buffer->mbuf.ol_flags = buffer->mbuf.ol_flags; >>> +new_buffer->mbuf.tx_offload = buffer->mbuf.tx_offload; >>> +new_buffer->mbuf.packet_type = buffer->mbuf.packet_type; >>> +new_buffer->mbuf.nb_segs = buffer->mbuf.nb_segs; >> Hi Michael, >> >> In what use case would this information be useful? >> >> Mirroring, perhaps? > >When doing offloading, we need tx_offload flag(although upstream does >not support yet), also when doing packet copy, we need nb_segs field. Yes, I understand that; I guess what I was really asking is 'what is the series of actions for which this information would be useful?'. Looking at the code, my guess is that the info is relevant when a packet (which is marked for some form of offload) is cloned (odp_execute_clone), and that cloned packet is sent out to a phy port (via odp_execute_actions). > >> >>> #else >>> new_buffer->rss_hash_valid = buffer->rss_hash_valid; >>> #endif >>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c >>> index bba4de3..0485872 100644 >>> --- a/lib/netdev-dpdk.c >>> +++ b/lib/netdev-dpdk.c >>> @@ -1804,6 +1804,10 @@ dpdk_do_tx_copy(struct netdev *netdev, int qid, >struct dp_packet_batch >>> *batch) >>> memcpy(rte_pktmbuf_mtod(pkts[newcnt], void *), >>> dp_packet_data(batch->packets[i]), size); >>> >>> +pkts[newcnt]->nb_segs = batch->packets[i]->mbuf.nb_segs; >>> +pkts[newcnt]->ol_flags = batch->packets[i]->mbuf.ol_flags; >>> +pkts[newcnt]->packet_type = batch->packets[i]->mbuf.packet_type; >>> +pkts[newcnt]->tx_offload = batch->packets[i]->mbuf.tx_offload; >> Could you give an example of when it would be useful to copy info from mbufs >which originate from non-DPDK source? >> AFIA, non-DPDK sources don't currently update these particular fields - if >I've missed something though, please let me know. > >What happens when a packet from DPDK be copied twice? >DPDK(VM virtio)--(flooding)->non-DPDK(patch port)--(copy)->DPDK(NIC)? Perfect - that makes sense. > > >> >>> rte_pktmbuf_data_len(pkts[newcnt]) = size; >>> rte_pktmbuf_pkt_len(pkts[newcnt]) = size; >>> >>> -- >>> 1.8.3.1 >> ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
[ovs-dev] [PATCH] Update relevant artifacts to add support for DPDK 17.05.1.
Upgrading to DPDK 17.05.1 stable release adds new significant features relevant to OVS, including, but not limited to: - tun/tap PMD, - VFIO hotplug support, - Generic flow API. Following changes are applied: - netdev-dpdk: Changes required by DPDK API modifications. - doc: Because of DPDK API changes, backward compatibility with previous DPDK releases will be broken, thus all relevant documentation entries are updated. - .travis: DPDK version change from 16.11.1 to 17.05.1. - rhel/openvswitch-fedora.spec.in: DPDK version change from 16.11 to 17.05.1 Signed-off-by: Michal Weglicki --- .travis/linux-build.sh | 2 +- Documentation/intro/install/dpdk.rst | 8 +- Documentation/topics/dpdk/vhost-user.rst | 8 +- NEWS | 1 + lib/netdev-dpdk.c| 144 +++ rhel/openvswitch-fedora.spec.in | 2 +- tests/dpdk/ring_client.c | 6 +- 7 files changed, 105 insertions(+), 66 deletions(-) diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh index 8750d68..efccdf1 100755 --- a/.travis/linux-build.sh +++ b/.travis/linux-build.sh @@ -80,7 +80,7 @@ fi if [ "$DPDK" ]; then if [ -z "$DPDK_VER" ]; then -DPDK_VER="16.11.1" +DPDK_VER="17.05.1" fi install_dpdk $DPDK_VER if [ "$CC" = "clang" ]; then diff --git a/Documentation/intro/install/dpdk.rst b/Documentation/intro/install/dpdk.rst index e83f852..4a178f3 100644 --- a/Documentation/intro/install/dpdk.rst +++ b/Documentation/intro/install/dpdk.rst @@ -40,7 +40,7 @@ Build requirements In addition to the requirements described in :doc:`general`, building Open vSwitch with DPDK will require the following: -- DPDK 16.11 +- DPDK 17.05.1 - A `DPDK supported NIC`_ @@ -69,9 +69,9 @@ Install DPDK #. Download the `DPDK sources`_, extract the file and set ``DPDK_DIR``:: $ cd /usr/src/ - $ wget http://fast.dpdk.org/rel/dpdk-16.11.1.tar.xz - $ tar xf dpdk-16.11.1.tar.xz - $ export DPDK_DIR=/usr/src/dpdk-stable-16.11.1 + $ wget http://fast.dpdk.org/rel/dpdk-17.05.1.tar.xz + $ tar xf dpdk-17.05.1.tar.xz + $ export DPDK_DIR=/usr/src/dpdk-stable-17.05.1 $ cd $DPDK_DIR #. (Optional) Configure DPDK as a shared library diff --git a/Documentation/topics/dpdk/vhost-user.rst b/Documentation/topics/dpdk/vhost-user.rst index 6b0bf9b..9f11ea1 100644 --- a/Documentation/topics/dpdk/vhost-user.rst +++ b/Documentation/topics/dpdk/vhost-user.rst @@ -292,9 +292,9 @@ To begin, instantiate a guest as described in :ref:`dpdk-vhost-user` or DPDK sources to VM and build DPDK:: $ cd /root/dpdk/ -$ wget http://fast.dpdk.org/rel/dpdk-16.11.1.tar.xz -$ tar xf dpdk-16.11.1.tar.xz -$ export DPDK_DIR=/root/dpdk/dpdk-stable-16.11.1 +$ wget http://fast.dpdk.org/rel/dpdk-17.05.1.tar.xz +$ tar xf dpdk-17.05.1.tar.xz +$ export DPDK_DIR=/root/dpdk/dpdk-stable-17.05.1 $ export DPDK_TARGET=x86_64-native-linuxapp-gcc $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET $ cd $DPDK_DIR @@ -378,7 +378,7 @@ Sample XML - + diff --git a/NEWS b/NEWS index 4ea7e62..8c1331f 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ Post-v2.7.0 still can be configured via extra arguments for DPDK EAL. * dpdkvhostuser ports are marked as deprecated. They will be removed in an upcoming release. + * Support for DPDK v17.05.1. - IPFIX now provides additional counters: * Total counters since metering process startup. * Per-flow TCP flag counters. diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index bba4de3..580a279 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -22,6 +22,9 @@ #include #include #include +#include +#include +#include #include #include @@ -31,7 +34,7 @@ #include #include #include -#include +#include #include "dirs.h" #include "dp-packet.h" @@ -56,6 +59,8 @@ #include "timeval.h" #include "unixctl.h" +enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM}; + VLOG_DEFINE_THIS_MODULE(netdev_dpdk); static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20); @@ -171,6 +176,21 @@ static const struct rte_eth_conf port_conf = { }, }; +/* + * These callbacks allow virtio-net devices to be added to vhost ports when + * configuration has been fully completed. + */ +static int new_device(int vid); +static void destroy_device(int vid); +static int vring_state_changed(int vid, uint16_t queue_id, int enable); +static const struct vhost_device_ops virtio_net_device_ops = +{ +.new_device = new_device, +.destroy_device = destroy_device, +.vring_state_changed = vring_state_changed, +.features_changed = NULL +}; + enum { DPDK_RING_SIZE = 256 }; BUILD_ASSERT_DECL(IS_POW2(DPDK_RING_SIZE)); enum { DRAIN_TSC = 20ULL }; @@ -412,8 +432,8 @@ struct netdev_rxq_dpdk {
[ovs-dev] [PATCH] treewide: .gitignore updates
Signed-off-by: Lance Richardson --- ovn/utilities/.gitignore | 2 ++ tests/.gitignore | 2 ++ vtep/.gitignore | 1 + 3 files changed, 5 insertions(+) diff --git a/ovn/utilities/.gitignore b/ovn/utilities/.gitignore index dbc3719..1d01e0b 100644 --- a/ovn/utilities/.gitignore +++ b/ovn/utilities/.gitignore @@ -7,3 +7,5 @@ /ovn-trace.8 /ovn-detrace /ovn-detrace.1 +/ovn-docker-overlay-driver +/ovn-docker-underlay-driver diff --git a/tests/.gitignore b/tests/.gitignore index 586d73f..294e6fb 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -53,3 +53,5 @@ /testsuite.log /test-lib /testsuite.tmp.orig +/valgrind.[0-9]* +/valgrind/ diff --git a/vtep/.gitignore b/vtep/.gitignore index 2f13512..4a6c33c 100644 --- a/vtep/.gitignore +++ b/vtep/.gitignore @@ -1,5 +1,6 @@ /Makefile /Makefile.in +/ovs-vtep /vtep-ctl /vtep-ctl.8 /vtep-idl.c -- 2.9.4 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [RFC PATCH v2] Update relevant artifacts to add support for DPDK 17.05.1.
>From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev-boun...@openvswitch.org] >On Behalf Of mweglicx >Sent: Thursday, June 29, 2017 10:55 AM >To: d...@openvswitch.org >Subject: [ovs-dev] [RFC PATCH v2] Update relevant artifacts to add support for >DPDK 17.05.1. > >Patch is marked as RFC because DPDK 17.05.1 is not yet >published. > >Upgrading to DPDK 17.05.1 stable release adds new >significant features relevant to OVS, including, >but not limited to: >- tun/tap PMD, >- VFIO hotplug support, >- Generic flow API. > >Following changes are applied: >- netdev-dpdk: Changes required by DPDK API modifications. >- doc: Because of DPDK API changes, backward compatibility > with previous DPDK releases will be broken, thus all > relevant documentation entries are updated. >- .travis: DPDK version change from 16.11.1 to 17.05.1. >- rhel/openvswitch-fedora.spec.in: DPDK version change > from 16.11 to 17.05.1 > >v1->v2: Minor review comments. > >Signed-off-by: Michal Weglicki Hi Michal, The patch LGTM. Since DPDK v17.05.1 has now been released, feel free to push a non-RFC patch, which I'll ACK. Thanks, Mark >--- > .travis/linux-build.sh | 2 +- > Documentation/intro/install/dpdk.rst | 8 +- > Documentation/topics/dpdk/vhost-user.rst | 8 +- > NEWS | 1 + > lib/netdev-dpdk.c| 144 +++--- >- > rhel/openvswitch-fedora.spec.in | 2 +- > tests/dpdk/ring_client.c | 6 +- > 7 files changed, 105 insertions(+), 66 deletions(-) > >diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh >index 8750d68..efccdf1 100755 >--- a/.travis/linux-build.sh >+++ b/.travis/linux-build.sh >@@ -80,7 +80,7 @@ fi > > if [ "$DPDK" ]; then > if [ -z "$DPDK_VER" ]; then >-DPDK_VER="16.11.1" >+DPDK_VER="17.05.1" > fi > install_dpdk $DPDK_VER > if [ "$CC" = "clang" ]; then >diff --git a/Documentation/intro/install/dpdk.rst >b/Documentation/intro/install/dpdk.rst >index e83f852..4a178f3 100644 >--- a/Documentation/intro/install/dpdk.rst >+++ b/Documentation/intro/install/dpdk.rst >@@ -40,7 +40,7 @@ Build requirements > In addition to the requirements described in :doc:`general`, building Open > vSwitch with DPDK will require the following: > >-- DPDK 16.11 >+- DPDK 17.05.1 > > - A `DPDK supported NIC`_ > >@@ -69,9 +69,9 @@ Install DPDK > #. Download the `DPDK sources`_, extract the file and set ``DPDK_DIR``:: > >$ cd /usr/src/ >- $ wget http://fast.dpdk.org/rel/dpdk-16.11.1.tar.xz >- $ tar xf dpdk-16.11.1.tar.xz >- $ export DPDK_DIR=/usr/src/dpdk-stable-16.11.1 >+ $ wget http://fast.dpdk.org/rel/dpdk-17.05.1.tar.xz >+ $ tar xf dpdk-17.05.1.tar.xz >+ $ export DPDK_DIR=/usr/src/dpdk-stable-17.05.1 >$ cd $DPDK_DIR > > #. (Optional) Configure DPDK as a shared library >diff --git a/Documentation/topics/dpdk/vhost-user.rst >b/Documentation/topics/dpdk/vhost-user.rst >index 6b0bf9b..9f11ea1 100644 >--- a/Documentation/topics/dpdk/vhost-user.rst >+++ b/Documentation/topics/dpdk/vhost-user.rst >@@ -292,9 +292,9 @@ To begin, instantiate a guest as described in :ref:`dpdk- >vhost-user` or > DPDK sources to VM and build DPDK:: > > $ cd /root/dpdk/ >-$ wget http://fast.dpdk.org/rel/dpdk-16.11.1.tar.xz >-$ tar xf dpdk-16.11.1.tar.xz >-$ export DPDK_DIR=/root/dpdk/dpdk-stable-16.11.1 >+$ wget http://fast.dpdk.org/rel/dpdk-17.05.1.tar.xz >+$ tar xf dpdk-17.05.1.tar.xz >+$ export DPDK_DIR=/root/dpdk/dpdk-stable-17.05.1 > $ export DPDK_TARGET=x86_64-native-linuxapp-gcc > $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET > $ cd $DPDK_DIR >@@ -378,7 +378,7 @@ Sample XML > > > >- >+ > > > >diff --git a/NEWS b/NEWS >index 4ea7e62..8c1331f 100644 >--- a/NEWS >+++ b/NEWS >@@ -20,6 +20,7 @@ Post-v2.7.0 >still can be configured via extra arguments for DPDK EAL. > * dpdkvhostuser ports are marked as deprecated. They will be removed >in an upcoming release. >+ * Support for DPDK v17.05.1. >- IPFIX now provides additional counters: > * Total counters since metering process startup. > * Per-flow TCP flag counters. >diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c >index bba4de3..580a279 100644 >--- a/lib/netdev-dpdk.c >+++ b/lib/netdev-dpdk.c >@@ -22,6 +22,9 @@ > #include > #include > #include >+#include >+#include >+#include > > #include > #include >@@ -31,7 +34,7 @@ > #include > #include > #include >-#include >+#include > > #include "dirs.h" > #include "dp-packet.h" >@@ -56,6 +59,8 @@ > #include "timeval.h" > #include "unixctl.h" > >+enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM}; >+ > VLOG_DEFINE_THIS_MODULE(netdev_dpdk); > static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20); > >@@ -171,6 +176,21 @@ static const struct rte_eth_conf port_conf = { > }, > }; > >+/* >+ *
Re: [ovs-dev] [PATCH v3 0/6] netdev-dpdk: Use intermediate queue during packet transmission.
Please, checkout my implementation of packet batching on dpif-netdev layer: https://mail.openvswitch.org/pipermail/ovs-dev/2017-June/334774.html Want to hear your opinion. Best regards, Ilya Maximets. ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
[ovs-dev] [PATCH 3/3] netdev: Remove useless cutlen.
Cutlen already applied while processing OVS_ACTION_ATTR_OUTPUT. Signed-off-by: Ilya Maximets --- lib/netdev-bsd.c | 3 --- lib/netdev-dpdk.c | 5 - lib/netdev-dummy.c | 2 -- lib/netdev-linux.c | 3 --- 4 files changed, 13 deletions(-) diff --git a/lib/netdev-bsd.c b/lib/netdev-bsd.c index dfc4225..7454d03 100644 --- a/lib/netdev-bsd.c +++ b/lib/netdev-bsd.c @@ -699,9 +699,6 @@ netdev_bsd_send(struct netdev *netdev_, int qid OVS_UNUSED, const void *data = dp_packet_data(batch->packets[i]); size_t size = dp_packet_size(batch->packets[i]); -/* Truncate the packet if it is configured. */ -size -= dp_packet_get_cutlen(batch->packets[i]); - while (!error) { ssize_t retval; if (dev->tap_fd >= 0) { diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 53f0d20..125817b 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1780,8 +1780,6 @@ dpdk_do_tx_copy(struct netdev *netdev, int qid, struct dp_packet_batch *batch) int newcnt = 0; int i; -dp_packet_batch_apply_cutlen(batch); - for (i = 0; i < batch->count; i++) { int size = dp_packet_size(batch->packets[i]); @@ -1840,7 +1838,6 @@ netdev_dpdk_vhost_send(struct netdev *netdev, int qid, dpdk_do_tx_copy(netdev, qid, batch); dp_packet_delete_batch(batch, true); } else { -dp_packet_batch_apply_cutlen(batch); __netdev_dpdk_vhost_send(netdev, qid, batch->packets, batch->count); } return 0; @@ -1871,8 +1868,6 @@ netdev_dpdk_send__(struct netdev_dpdk *dev, int qid, int cnt = batch->count; struct rte_mbuf **pkts = (struct rte_mbuf **) batch->packets; -dp_packet_batch_apply_cutlen(batch); - cnt = netdev_dpdk_filter_packet_len(dev, pkts, cnt); cnt = netdev_dpdk_qos_run(dev, pkts, cnt); dropped = batch->count - cnt; diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c index ea52795..9920498 100644 --- a/lib/netdev-dummy.c +++ b/lib/netdev-dummy.c @@ -1072,8 +1072,6 @@ netdev_dummy_send(struct netdev *netdev, int qid OVS_UNUSED, break; } -size -= dp_packet_get_cutlen(packet); - if (size < ETH_HEADER_LEN) { error = EMSGSIZE; break; diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index a8b3b7f..30575fb 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -1234,9 +1234,6 @@ netdev_linux_send(struct netdev *netdev_, int qid OVS_UNUSED, size_t size = dp_packet_size(batch->packets[i]); ssize_t retval; -/* Truncate the packet if it is configured. */ -size -= dp_packet_get_cutlen(batch->packets[i]); - if (!is_tap_netdev(netdev_)) { /* Use our AF_PACKET socket to send to this device. */ struct iovec iov; -- 2.7.4 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
[ovs-dev] [PATCH 2/3] netdev: Remove unused may_steal.
Not needed anymore because 'may_steal' already handled on dpif-netdev layer and always true; Signed-off-by: Ilya Maximets --- lib/dpif-netdev.c | 2 +- lib/netdev-bsd.c | 4 ++-- lib/netdev-dpdk.c | 25 +++-- lib/netdev-dummy.c| 4 ++-- lib/netdev-linux.c| 4 ++-- lib/netdev-provider.h | 7 +++ lib/netdev.c | 12 lib/netdev.h | 2 +- 8 files changed, 26 insertions(+), 34 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index de3269c..e49f665 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -3102,7 +3102,7 @@ dp_netdev_pmd_flush_output_packets(struct dp_netdev_pmd_thread *pmd, tx_qid = pmd->static_tx_qid; } -netdev_send(p->port->netdev, tx_qid, &p->output_pkts, true, +netdev_send(p->port->netdev, tx_qid, &p->output_pkts, dynamic_txqs); dp_packet_batch_init(&p->output_pkts); } diff --git a/lib/netdev-bsd.c b/lib/netdev-bsd.c index 6cc83d3..dfc4225 100644 --- a/lib/netdev-bsd.c +++ b/lib/netdev-bsd.c @@ -680,7 +680,7 @@ netdev_bsd_rxq_drain(struct netdev_rxq *rxq_) */ static int netdev_bsd_send(struct netdev *netdev_, int qid OVS_UNUSED, -struct dp_packet_batch *batch, bool may_steal, +struct dp_packet_batch *batch, bool concurrent_txq OVS_UNUSED) { struct netdev_bsd *dev = netdev_bsd_cast(netdev_); @@ -731,7 +731,7 @@ netdev_bsd_send(struct netdev *netdev_, int qid OVS_UNUSED, } ovs_mutex_unlock(&dev->mutex); -dp_packet_delete_batch(batch, may_steal); +dp_packet_delete_batch(batch, true); return error; } diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 5ad9244..53f0d20 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1833,12 +1833,12 @@ dpdk_do_tx_copy(struct netdev *netdev, int qid, struct dp_packet_batch *batch) static int netdev_dpdk_vhost_send(struct netdev *netdev, int qid, struct dp_packet_batch *batch, - bool may_steal, bool concurrent_txq OVS_UNUSED) + bool concurrent_txq OVS_UNUSED) { -if (OVS_UNLIKELY(!may_steal || batch->packets[0]->source != DPBUF_DPDK)) { +if (OVS_UNLIKELY(batch->packets[0]->source != DPBUF_DPDK)) { dpdk_do_tx_copy(netdev, qid, batch); -dp_packet_delete_batch(batch, may_steal); +dp_packet_delete_batch(batch, true); } else { dp_packet_batch_apply_cutlen(batch); __netdev_dpdk_vhost_send(netdev, qid, batch->packets, batch->count); @@ -1848,11 +1848,11 @@ netdev_dpdk_vhost_send(struct netdev *netdev, int qid, static inline void netdev_dpdk_send__(struct netdev_dpdk *dev, int qid, - struct dp_packet_batch *batch, bool may_steal, + struct dp_packet_batch *batch, bool concurrent_txq) { if (OVS_UNLIKELY(!(dev->flags & NETDEV_UP))) { -dp_packet_delete_batch(batch, may_steal); +dp_packet_delete_batch(batch, true); return; } @@ -1861,12 +1861,11 @@ netdev_dpdk_send__(struct netdev_dpdk *dev, int qid, rte_spinlock_lock(&dev->tx_q[qid].tx_lock); } -if (OVS_UNLIKELY(!may_steal || - batch->packets[0]->source != DPBUF_DPDK)) { +if (OVS_UNLIKELY(batch->packets[0]->source != DPBUF_DPDK)) { struct netdev *netdev = &dev->up; dpdk_do_tx_copy(netdev, qid, batch); -dp_packet_delete_batch(batch, may_steal); +dp_packet_delete_batch(batch, true); } else { int dropped; int cnt = batch->count; @@ -1894,12 +1893,11 @@ netdev_dpdk_send__(struct netdev_dpdk *dev, int qid, static int netdev_dpdk_eth_send(struct netdev *netdev, int qid, - struct dp_packet_batch *batch, bool may_steal, - bool concurrent_txq) + struct dp_packet_batch *batch, bool concurrent_txq) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); -netdev_dpdk_send__(dev, qid, batch, may_steal, concurrent_txq); +netdev_dpdk_send__(dev, qid, batch, concurrent_txq); return 0; } @@ -2858,8 +2856,7 @@ dpdk_ring_open(const char dev_name[], dpdk_port_t *eth_port_id) static int netdev_dpdk_ring_send(struct netdev *netdev, int qid, - struct dp_packet_batch *batch, bool may_steal, - bool concurrent_txq) + struct dp_packet_batch *batch, bool concurrent_txq) { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); unsigned i; @@ -2872,7 +2869,7 @@ netdev_dpdk_ring_send(struct netdev *netdev, int qid, dp_packet_rss_invalidate(batch->packets[i]); } -netdev_dpdk_send__(dev, qid, batch, may_steal, concurrent_txq); +netdev_dpdk_send__(dev, qid, batch, concurrent_txq); return 0; } diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
[ovs-dev] [PATCH 1/3] dpif-netdev: Output packet batching.
While processing incoming batch of packets they are scattered across many per-flow batches and sent separately. This becomes an issue while using more than a few flows. For example if we have balanced-tcp OvS bonding with 2 ports there will be 256 datapath internal flows for each dp_hash pattern. This will lead to scattering of a single recieved batch across all of that 256 per-flow batches and invoking send for each packet separately. This behaviour greatly degrades overall performance of netdev_send because of inability to use advantages of vectorized transmit functions. But the half (if 2 ports in bonding) of datapath flows will have the same output actions. This means that we can collect them in a single place back and send at once using single call to netdev_send. This patch introduces per-port packet batch for output packets for that purpose. Output packet batch can't be overflowed because it has the same size as maximum recieve burst (NETDEV_MAX_BURST) and it flushed after the finishing of each burst processing. 'output_pkts' batch is thread local and located in send port cache. Signed-off-by: Ilya Maximets --- lib/dpif-netdev.c | 81 +++ 1 file changed, 58 insertions(+), 23 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 4e29085..de3269c 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -494,6 +494,7 @@ struct tx_port { int qid; long long last_used; struct hmap_node node; +struct dp_packet_batch output_pkts; }; /* PMD: Poll modes drivers. PMD accesses devices via polling to eliminate @@ -625,9 +626,10 @@ static void dp_netdev_execute_actions(struct dp_netdev_pmd_thread *pmd, size_t actions_len, long long now); static void dp_netdev_input(struct dp_netdev_pmd_thread *, -struct dp_packet_batch *, odp_port_t port_no); +struct dp_packet_batch *, +odp_port_t port_no, long long now); static void dp_netdev_recirculate(struct dp_netdev_pmd_thread *, - struct dp_packet_batch *); + struct dp_packet_batch *, long long now); static void dp_netdev_disable_upcall(struct dp_netdev *); static void dp_netdev_pmd_reload_done(struct dp_netdev_pmd_thread *pmd); @@ -657,6 +659,8 @@ static void dp_netdev_add_rxq_to_pmd(struct dp_netdev_pmd_thread *pmd, static void dp_netdev_del_rxq_from_pmd(struct dp_netdev_pmd_thread *pmd, struct rxq_poll *poll) OVS_REQUIRES(pmd->port_mutex); +static void dp_netdev_pmd_flush_output_packets(struct dp_netdev_pmd_thread *, + long long now); static void reconfigure_datapath(struct dp_netdev *dp) OVS_REQUIRES(dp->port_mutex); static bool dp_netdev_pmd_try_ref(struct dp_netdev_pmd_thread *pmd); @@ -2800,6 +2804,7 @@ dpif_netdev_execute(struct dpif *dpif, struct dpif_execute *execute) struct dp_netdev *dp = get_dp_netdev(dpif); struct dp_netdev_pmd_thread *pmd; struct dp_packet_batch pp; +long long now = time_msec(); if (dp_packet_size(execute->packet) < ETH_HEADER_LEN || dp_packet_size(execute->packet) > UINT16_MAX) { @@ -2842,8 +2847,8 @@ dpif_netdev_execute(struct dpif *dpif, struct dpif_execute *execute) dp_packet_batch_init_packet(&pp, execute->packet); dp_netdev_execute_actions(pmd, &pp, false, execute->flow, - execute->actions, execute->actions_len, - time_msec()); + execute->actions, execute->actions_len, now); +dp_netdev_pmd_flush_output_packets(pmd, now); if (pmd->core_id == NON_PMD_CORE_ID) { ovs_mutex_unlock(&dp->non_pmd_mutex); @@ -3080,6 +3085,31 @@ cycles_count_end(struct dp_netdev_pmd_thread *pmd, } static void +dp_netdev_pmd_flush_output_packets(struct dp_netdev_pmd_thread *pmd, + long long now) +{ +struct tx_port *p; + +HMAP_FOR_EACH (p, node, &pmd->send_port_cache) { +if (!dp_packet_batch_is_empty(&p->output_pkts)) { +int tx_qid; +bool dynamic_txqs; + +dynamic_txqs = p->port->dynamic_txqs; +if (dynamic_txqs) { +tx_qid = dpif_netdev_xps_get_tx_qid(pmd, p, now); +} else { +tx_qid = pmd->static_tx_qid; +} + +netdev_send(p->port->netdev, tx_qid, &p->output_pkts, true, +dynamic_txqs); +dp_packet_batch_init(&p->output_pkts); +} +} +} + +static void dp_netdev_process_rxq_port(struct dp_netdev_pmd_thread *pmd, struct netdev_rxq *rx, odp_port_t port_no) @@ -3092,10 +3122,13 @@ dp_netdev_process_rxq_port(struct dp_netdev
[ovs-dev] [PATCH 0/3] Output packet batching.
This patch-set inspired by [1] from Bhanuprakash Bodireddy. Implementation of [1] looks very complex and introduces many pitfalls for later code modifications like possible packet stucks. This version targeted to make simple and flexible output packet batching on higher level without introducing and even simplifying netdev layer. Patch set consists of 3 patches. All the functionality introduced in the first patch. Two others are just cleanups of netdevs to not do unnecessary things. Basic testing of 'PVP with OVS bonding on phy ports' scenario shows significant performance improvement. More accurate and intensive testing required. [1] [PATCH 0/6] netdev-dpdk: Use intermediate queue during packet transmission. https://mail.openvswitch.org/pipermail/ovs-dev/2017-June/334762.html Ilya Maximets (3): dpif-netdev: Output packet batching. netdev: Remove unused may_steal. netdev: Remove useless cutlen. lib/dpif-netdev.c | 81 --- lib/netdev-bsd.c | 7 ++--- lib/netdev-dpdk.c | 30 +++ lib/netdev-dummy.c| 6 ++-- lib/netdev-linux.c| 7 ++--- lib/netdev-provider.h | 7 ++--- lib/netdev.c | 12 +++- lib/netdev.h | 2 +- 8 files changed, 83 insertions(+), 69 deletions(-) -- 2.7.4 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
[ovs-dev] [PATCH v2] dp-packet: Copy trunc flag on batch clone.
Without this applying of the cutlen action will not work on copied batch. Cutlen works for linux and dummy netdevs only because they tries to apply it per-packet inside send function. Cutlen action doesn't work for dpdk ports in case batch clone occured because invoked by the 'dp_packet_batch_apply_cutlen()'. CC: Andy Zhou Fixes: 72c84bc2db23 ("dp-packet: Enhance packet batch APIs.") Signed-off-by: Ilya Maximets --- lib/dp-packet.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/dp-packet.h b/lib/dp-packet.h index d2549b1..38282bd 100644 --- a/lib/dp-packet.h +++ b/lib/dp-packet.h @@ -739,6 +739,7 @@ dp_packet_batch_clone(struct dp_packet_batch *dst, DP_PACKET_BATCH_FOR_EACH (packet, src) { dp_packet_batch_add(dst, dp_packet_clone(packet)); } +dst->trunc = src->trunc; } static inline void -- 2.7.4 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [PATCH] dp-packet: Copy trunc flug on batch clone.
Sorry for the typo in the subject. I'll respin with only that change. s/flug/flag/. On 30.06.2017 13:05, Ilya Maximets wrote: > Without this applying of the cutlen action will not work > on copied batch. Cutlen works for linux and dummy netdevs > only because they tries to apply it per-packet inside > send function. > > Cutlen action doesn't work for dpdk ports in case batch clone > occured because invoked by the batch apply action. > > CC: Andy Zhou > Fixes: 72c84bc2db23 ("dp-packet: Enhance packet batch APIs.") > Signed-off-by: Ilya Maximets > --- > lib/dp-packet.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/dp-packet.h b/lib/dp-packet.h > index d2549b1..38282bd 100644 > --- a/lib/dp-packet.h > +++ b/lib/dp-packet.h > @@ -739,6 +739,7 @@ dp_packet_batch_clone(struct dp_packet_batch *dst, > DP_PACKET_BATCH_FOR_EACH (packet, src) { > dp_packet_batch_add(dst, dp_packet_clone(packet)); > } > +dst->trunc = src->trunc; > } > > static inline void > ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
[ovs-dev] [PATCH] dp-packet: Copy trunc flug on batch clone.
Without this applying of the cutlen action will not work on copied batch. Cutlen works for linux and dummy netdevs only because they tries to apply it per-packet inside send function. Cutlen action doesn't work for dpdk ports in case batch clone occured because invoked by the batch apply action. CC: Andy Zhou Fixes: 72c84bc2db23 ("dp-packet: Enhance packet batch APIs.") Signed-off-by: Ilya Maximets --- lib/dp-packet.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/dp-packet.h b/lib/dp-packet.h index d2549b1..38282bd 100644 --- a/lib/dp-packet.h +++ b/lib/dp-packet.h @@ -739,6 +739,7 @@ dp_packet_batch_clone(struct dp_packet_batch *dst, DP_PACKET_BATCH_FOR_EACH (packet, src) { dp_packet_batch_add(dst, dp_packet_clone(packet)); } +dst->trunc = src->trunc; } static inline void -- 2.7.4 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [PATCH] ofproto-dpif-ipfix: add support for per-flow drop counters
Hi Ben, Let me provide more details. I configured per-bridge IPFIX sampling with following command: $ ovs-vsctl -- set Bridge br1 ipfix=@i -- --id=@i create IPFIX 'targets="127.0.0.1:4739"' \ obs_domain_id=123 obs_point_id=1 cache_active_timeout=10 \ cache_max_flows=13 other_config:enable-tunnel-sampling=false sampling=1 When I generate traffic and dump flows I get this output: $ ovs-appctl dpif/dump-flows br1 recirc_id(0),in_port(7),eth(src=00:00:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0800), ipv4(frag=no), packets:3, bytes:102, used:3.128s, actions:userspace(pid=4292743264,ipfix(output_port=4294967295)),userspace(pid=4292743264, ipfix(output_port=2)),2,userspace(pid=4292743264,ipfix(output_port=5)),5 As you can see, "userspace" action is present, rather than "sample" action. I also tried configuring per-flow IPFIX sampling and adding clone action: $ ovs-vsctl -- --id=@br1 get Bridge br1 -- --id=@cs create Flow_Sample_Collector_Set id=1 \ bridge=@br1 ipfix=@i -- --id=@i create IPFIX 'targets="127.0.0.1:4739"' \ obs_domain_id=124 obs_point_id=456 $ ovs-ofctl add-flow br1 'table=0,priority=12, \ actions=sample(probability=65535,collector_set_id=1,obs_domain_id=124, \ obs_point_id=456),resubmit(,1)' $ ovs-ofctl add-flow br1 'table=1,priority=10,actions=clone(output:2,output:3)' In this case I also couldn't see "sample" or "clone" action, even though traffic was hitting rules added by me. $ ovs-ofctl dump-flows br1 cookie=0x0, duration=7.375s, table=0, n_packets=0, n_bytes=0, priority=0 actions=NORMAL cookie=0x0, duration=7.113s, table=0, n_packets=3, n_bytes=102, priority=12 actions=sample(probability=65535,collector_set_id=1,obs_domain_id=124,obs_point_id=456, resubmit(,1) cookie=0x0, duration=7.103s, table=1, n_packets=3, n_bytes=102, priority=10 actions=clone(output:2,output:3) $ ovs-appctl dpif/dump-flows br1 recirc_id(0),in_port(7),eth_type(0x0800),ipv4(frag=no),packets:2,bytes:68,used:5.976s, actions:userspace(pid=4292741676,flow_sample(probability=65535,collector_set_id=1, obs_domain_id=124,obs_point_id=456,output_port=4294967295)) Any ideas how to trigger a "sample" or "clone" action during IPFIX upcall? I suppose I could somehow force OvS to add those actions with ovs-appctl commands. However, I'm looking for a usual use case where those actions would be present. Are you absolutely sure that those actions need to be handled? Thanks, Przemek > -Original Message- > From: Szczerbik, PrzemyslawX > Sent: Thursday, June 22, 2017 9:20 AM > To: 'Ben Pfaff' > Cc: 'd...@openvswitch.org' > Subject: RE: [ovs-dev] [PATCH] ofproto-dpif-ipfix: add support for per-flow > drop > counters > > Hi Ben, > > I'm having issues with configuring flows to see "sample" or "clone" actions > during > IPFIX upcall. > Most of the time I only see "userspace" and "output" actions, which surprises > me > quite a bit. > Even when I configure per-bridge IPFIX sampling there is no "sample" action. > > I'd appreciate any suggestions how to configure flows to see those actions > during > IPFIX upcall. > > Regards, > Przemek > > > -Original Message- > > From: Szczerbik, PrzemyslawX > > Sent: Tuesday, June 20, 2017 8:46 AM > > To: Ben Pfaff > > Cc: d...@openvswitch.org > > Subject: RE: [ovs-dev] [PATCH] ofproto-dpif-ipfix: add support for per-flow > drop > > counters > > > > Hi Ben, > > > > Thanks for your feedback. I can start working on implementing your > suggestions. > > > > Please keep in mind that IPFIX counters are based on probability, which > > means > > they won't necessarily reflect precise values. > > As you can see it's difficult to determine, with 100% accuracy, at sampling > > stage > > whether packet is going to be dropped at some point. > > I suppose there always is a possibility that next action might drop the > > packet > and > > it we won't detect it. > > > > I think that this patch (with addition of your requested changes) covers > > majority > > of cases which is good enough for IPFIX protocol. > > > > Regards, > > Przemek > > > > > -Original Message- > > > From: Ben Pfaff [mailto:b...@ovn.org] > > > Sent: Wednesday, June 14, 2017 10:23 PM > > > To: Szczerbik, PrzemyslawX > > > Cc: d...@openvswitch.org > > > Subject: Re: [ovs-dev] [PATCH] ofproto-dpif-ipfix: add support for > > > per-flow > > drop > > > counters > > > > > > On Tue, Jun 13, 2017 at 02:25:15PM +0100, Przemyslaw Szczerbik wrote: > > > > Patch based on RFC 5102, section 5.10. It implements per-flow drop > counters: > > > > - droppedPacketDeltaCount > > > > - droppedPacketTotalCount > > > > - droppedOctetDeltaCount > > > > - droppedOctetTotalCount > > > > > > > > In order to determine if packet is going to be dropped, flow actions > associated > > > > with packet are read. If there is no OVS_ACTION_ATTR_OUTPUT action, > > packet > > > will > > > > be dropped. > > > > > > > > Signed