summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* ofproto: Add CLI commands to show and clear mac_learning statisticsEelco Chaudron2018-07-062-1/+2
| | | | | | | | | | | | | | | | | | | Add two new commands, fdb/stats-show and fdb/stats-clear, to ovs-appctl to show and clear the new mac_learning statistics. $ ovs-appctl fdb/stats-show ovs_pvp_br0 Statistics for bridge "ovs_pvp_br0": Current/maximum MAC entries in the table: 4/2048 Total number of learned MAC entries : 4 Total number of expired MAC entries : 1 Total number of evicted MAC entries : 0 Total number of port moved MAC entries : 32 $ ovs-appctl fdb/stats-clear ovs_pvp_br0 statistics successfully cleared Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* mac-learning: Add per mac learning instance countersEelco Chaudron2018-07-062-0/+23
| | | | | | | | | | | | | | | This patch adds counters per mac_learning instance. The following counters are added: total_learned: Total number of learned MAC entries total_expired: Total number of expired MAC entries total_evicted: Total number of evicted MAC entries, i.e. entries moved out due to the table being full. total_moved : Total number of port moved MAC entries, i.e. entries where the MAC address moved to a different port. Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* mac-learning: Add additional mac-learning coverage countersEelco Chaudron2018-07-061-0/+6
| | | | | | | | | This patch adds two additional mac-learning coverage counters: - mac_learning_evicted, entries deleted due to mac table being full - mac_learning_moved, entries where the port has changed. Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* dpif-netdev: Fix a couple of comments for dp_netdev_run_meter().Justin Pettit2018-07-061-4/+4
| | | | | Signed-off-by: Justin Pettit <jpettit@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* Merge branch 'dpdk_merge' of https://github.com/istokes/ovs into HEADBen Pfaff2018-07-069-137/+1598
|\
| * dpdk: Support both shared and per port mempools.Ian Stokes2018-07-064-98/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit re-introduces the concept of shared mempools as the default memory model for DPDK devices. Per port mempools are still available but must be enabled explicitly by a user. OVS previously used a shared mempool model for ports with the same MTU and socket configuration. This was replaced by a per port mempool model to address issues flagged by users such as: https://mail.openvswitch.org/pipermail/ovs-discuss/2016-September/042560.html However the per port model potentially requires an increase in memory resource requirements to support the same number of ports and configuration as the shared port model. This is considered a blocking factor for current deployments of OVS when upgrading to future OVS releases as a user may have to redimension memory for the same deployment configuration. This may not be possible for users. This commit resolves the issue by re-introducing shared mempools as the default memory behaviour in OVS DPDK but also refactors the memory configuration code to allow for per port mempools. This patch adds a new global config option, per-port-memory, that controls the enablement of per port mempools for DPDK devices. ovs-vsctl set Open_vSwitch . other_config:per-port-memory=true This value defaults to false; to enable per port memory support, this field should be set to true when setting other global parameters on init (such as "dpdk-socket-mem", for example). Changing the value at runtime is not supported, and requires restarting the vswitch daemon. The mempool sweep functionality is also replaced with the sweep functionality from OVS 2.9 found in commits c77f692 (netdev-dpdk: Free mempool only when no in-use mbufs.) a7fb0a4 (netdev-dpdk: Add mempool reuse/free debug.) A new document to discuss the specifics of the memory models and example memory requirement calculations is also added. Signed-off-by: Ian Stokes <ian.stokes@intel.com> Acked-by: Kevin Traynor <ktraynor@redhat.com> Acked-by: Tiago Lam <tiago.lam@intel.com> Tested-by: Tiago Lam <tiago.lam@intel.com>
| * dpif-netdev: do hw flow offload in a threadYuanhan Liu2018-07-061-90/+258
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the major trigger for hw flow offload is at upcall handling, which is actually in the datapath. Moreover, the hw offload installation and modification is not that lightweight. Meaning, if there are so many flows being added or modified frequently, it could stall the datapath, which could result to packet loss. To diminish that, all those flow operations will be recorded and appended to a list. A thread is then introduced to process this list (to do the real flow offloading put/del operations). This could leave the datapath as lightweight as possible. Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org> Co-authored-by: Shahaf Shuler <shahafs@mellanox.com> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
| * netdev-dpdk: add debug for rte flow patternsYuanhan Liu2018-07-061-0/+177
| | | | | | | | | | | | | | | | | | | | | | For debug purpose. Co-authored-by: Finn Christensen <fc@napatech.com> Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org> Signed-off-by: Finn Christensen <fc@napatech.com> Co-authored-by: Shahaf Shuler <shahafs@mellanox.com> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
| * netdev-dpdk: implement flow offload with rte flowFinn Christensen2018-07-061-1/+557
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The basic yet the major part of this patch is to translate the "match" to rte flow patterns. And then, we create a rte flow with MARK + RSS actions. Afterwards, all packets match the flow will have the mark id in the mbuf. The reason RSS is needed is, for most NICs, a MARK only action is not allowed. It has to be used together with some other actions, such as QUEUE, RSS, etc. However, QUEUE action can specify one queue only, which may break the rss. Likely, RSS action is currently the best we could now. Thus, RSS action is choosen. For any unsupported flows, such as MPLS, -1 is returned, meaning the flow offload is failed and then skipped. Co-authored-by: Yuanhan Liu <yliu@fridaylinux.org> Signed-off-by: Finn Christensen <fc@napatech.com> Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org> Co-authored-by: Shahaf Shuler <shahafs@mellanox.com> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
| * dpif-netdev: retrieve flow directly from the flow markYuanhan Liu2018-07-064-6/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So that we could skip some very costly CPU operations, including but not limiting to miniflow_extract, emc lookup, dpcls lookup, etc. Thus, performance could be greatly improved. A PHY-PHY forwarding with 1000 mega flows (udp,tp_src=1000-1999) and 1 million streams (tp_src=1000-1999, tp_dst=2000-2999) show more that 260% performance boost. Note that though the heavy miniflow_extract is skipped, we still have to do per packet checking, due to we have to check the tcp_flags. Co-authored-by: Finn Christensen <fc@napatech.com> Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org> Signed-off-by: Finn Christensen <fc@napatech.com> Co-authored-by: Shahaf Shuler <shahafs@mellanox.com> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
| * flow: Introduce IP packet sanity checksYuanhan Liu2018-07-061-32/+69
| | | | | | | | | | | | | | | | | | | | | | | | Those checks were part of the miniflow extractor. Moving them out to act as a general helpers for packet validation. Co-authored-by: Finn Christensen <fc@napatech.com> Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org> Signed-off-by: Finn Christensen <fc@napatech.com> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Co-authored-by: Shahaf Shuler <shahafs@mellanox.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
| * dpif-netdev: associate flow with a mark idYuanhan Liu2018-07-062-0/+291
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most modern NICs have the ability to bind a flow with a mark, so that every packet matches such flow will have that mark present in its descriptor. The basic idea of doing that is, when we receives packets later, we could directly get the flow from the mark. That could avoid some very costly CPU operations, including (but not limiting to) miniflow_extract, emc lookup, dpcls lookup, etc. Thus, performance could be greatly improved. Thus, the major work of this patch is to associate a flow with a mark id (an uint32_t number). The association in netdev datapath is done by CMAP, while in hardware it's done by the rte_flow MARK action. One tricky thing in OVS-DPDK is, the flow tables is per-PMD. For the case there is only one phys port but with 2 queues, there could be 2 PMDs. In other words, even for a single mega flow (i.e. udp,tp_src=1000), there could be 2 different dp_netdev flows, one for each PMD. That could results to the same mega flow being offloaded twice in the hardware, worse, we may get 2 different marks and only the last one will work. To avoid that, a megaflow_to_mark CMAP is created. An entry will be added for the first PMD that wants to offload a flow. For later PMDs, it will see such megaflow is already offloaded, then the flow will not be offloaded to HW twice. Meanwhile, the mark to flow mapping becomes to 1:N mapping. That is what the mark_to_flow CMAP is for. When the first PMD wants to offload a flow, it allocates a new mark and performs the flow offload by reusing the ->flow_put method. When it succeeds, a "mark to flow" entry will be added. For later PMDs, it will get the corresponding mark by above megaflow_to_mark CMAP. Then, another "mark to flow" entry will be added. Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org> Co-authored-by: Finn Christensen <fc@napatech.com> Signed-off-by: Finn Christensen <fc@napatech.com> Co-authored-by: Shahaf Shuler <shahafs@mellanox.com> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
* | DNS: Add basic support for asynchronous DNS resolvingYifeng Sun2018-07-069-27/+440
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is a simple implementation for the proposal discussed in https://mail.openvswitch.org/pipermail/ovs-dev/2017-August/337038.html and https://mail.openvswitch.org/pipermail/ovs-dev/2017-October/340013.html. It enables ovs-vswitchd and other utilities to use DNS names when specifying OpenFlow and OVSDB remotes. Below are some of the features and limitations of this patch: - Resolving is asynchornous in daemon context, avoiding blocking main loop; - Resolving is synchronous in general utility context; - Both IPv4 and IPv6 are supported; - The resolving API is thread-safe; - Depends on the unbound library; - When multiple ip addresses are returned, only the first one is used; - /etc/nsswitch.conf isn't respected as unbound library doesn't look at it; - For async-resolving, caller need to retry later; there is no callback. Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* | dpif-netlink-rtnl: Retry smaller MTU when default MAX_MTU is too large.Yifeng Sun2018-07-061-9/+20
|/ | | | | | | | | | | | | When MAX_MTU is larger than hw supported max MTU, dpif_netlink_rtnl_create will fail. This leads to testing failure '11: datapath - ping over gre tunnel' in 'make check-kmod'. This patch fixes this issue by retrying a smaller MTU when MAX_MTU is too large. Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ofp-actions: Fix undefined behavior shifting 'int' 16 places left.Ben Pfaff2018-07-051-1/+2
| | | | | | | | | | Shifting a 16-bit signed int 16 bits is technically undefined behavior. This fixes the problem. (In practice this should be harmless in this case.) Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9049 Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* json: Avoid signed integer overflow in parsing exponents.Ben Pfaff2018-07-051-2/+11
| | | | | | | | This can't cause a crash and doesn't seem relevant to normal operation. Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9044 Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* ofp-actions: Fix buffer overread in decode_LEARN_specs().Ben Pfaff2018-07-051-1/+1
| | | | | | | | The length check was wrong for immediate arguments to "learn" actions. Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9047 Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* ofp-actions: Avoid buffer overread in BUNDLE action decoding.Ben Pfaff2018-07-051-6/+7
| | | | | | Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9052 Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* ofproto-dpif: Let the dpif report when a port is a duplicate.Ben Pfaff2018-07-051-2/+7
| | | | | | | | | | | | | | | The port_add() function checks whether the port about to be added to the dpif is already present and adds it only if it is not. This duplicates a check also present (and necessary) in each dpif and races with it as well. When a dpif has a large number of ports, the check can be expensive (it is not efficiently implemented). It would be nice to made the check cheaper, but it also seems reasonable to do as done in this patch and just let the dpif report the duplication. Reported-by: Haifeng Lin <haifeng.lin@huawei.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
* netdev-linux: Fix segfault in update_lag().Tiago Lam2018-07-051-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | A bissect shows that commit d22f892 ("netdev-linux: monitor and offload LAG slaves to TC") introduced netdev_linux_update_lag(), which is now triggering a crash in the "datapath - ping over bond" test in system-userspace-testsuite: (gdb) bt #0 0x00000000009762e7 in netdev_linux_update_lag (change=0x7ffdff013750) at lib/netdev-linux.c:728 728 if (is_netdev_linux_class(master_netdev->netdev_class)) { This fixes the crash by simply returning in case netdev_from_name() returns NULL, as this should indicate the master is not attached to the bridge. Additionally, netdev_linux_update_lag() isn't "clearing" the netdev reference it gets from netdev_from_name(), meaning its ref_cnt is incremented but never decremented. Thus, also call netdev_close() before returning. CC: John Hurley <john.hurley@netronome.com> Fixes: d22f8927 ("netdev-linux: monitor and offload LAG slaves to TC") Signed-off-by: Tiago Lam <tiago.lam@intel.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Use boolean variable values.Darrell Ball2018-07-051-1/+1
| | | | | | | | | | | | | | Traditionally, for boolean variables we use boolean values. Lets keep to that tradition. Hopefully, using false with a bool works with gcc 6.3.1; I use both recent versions of gcc (7.3) and older versions (4.x), but did not see the issue found in 165c1f0649af commit. Cc: Ian Stokes<ian.stokes@intel.com> Fixes: 165c1f0649af ("db-ctl-base: Fix compilation warnings.") Signed-off-by: Darrell Ball <dlu998@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* conntrack: Fix fragmentation checks.Darrell Ball2018-07-051-33/+22
| | | | | | | | | | | | | | | | | | The ipv4 fragmentation check is broken and allows fragments through. There were fragile and poorly maintainable checks in extract_l3_ipv* designed to save a few cycles. The checks make assumptions about what sanity checks may have been done and could be skipped based on inferring from the value of another paramater that should be unrelated (l4 pointer needing assignment). Since the benefit is minimal, remove the special checks and always do sanity checks. Four tests are added to better maintain fragmentation support. This needs backporting to 2.9. Fixes: c8b1ad49da68("conntrack: Reorder sanity checks in extract_l3_ipvx().") Fixes: a489b16854b5("conntrack: New userspace connection tracker.") Signed-off-by: Darrell Ball <dlu998@gmail.com>
* db-ctl-base: Fix compilation warnings.Ian Stokes2018-07-051-6/+4
| | | | | | | | | | | This commit fixes uninitialized variable warnings in functions cmd_create() and cmd_get() when compiling with gcc 6.3.1 and -Werror by initializing variables 'symbol' and 'new' to NULL. Cc: Alex Wang <alexw@nicira.com> Fixes: 07ff77ccb82a ("db-ctl-base: Make common database command code into library.") Signed-off-by: Ian Stokes <ian.stokes@intel.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* rconn: Suppress 'connected' log for unreliable connections.Ilya Maximets2018-07-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent assertion failure fix changed rconn workflow for unreliable connections (such as connections from ovs-ofctl) from |rconn|DBG|br-int<->unix#151: entering ACTIVE |rconn|DBG|br-int<->unix#151: connection closed by peer |rconn|DBG|br-int<->unix#151: entering DISCONNECTED To |rconn|DBG|br-int<->unix#200: entering CONNECTING |rconn|INFO|br-int<->unix#200: connected |rconn|DBG|br-int<->unix#200: entering ACTIVE |rconn|DBG|br-int<->unix#200: connection closed by peer |rconn|DBG|br-int<->unix#200: entering DISCONNECTED Many monitoring/configuring tools (ex. ovs-neutron-agent) uses ovs-ofctl frequently to check the statuses of installed flows. This produces a lot of "connected" logs, that are useless in general. Fix that by changing the log level to DBG for unreliable connections. Suggested-by: Ben Pfaff <blp@ovn.org> Fixes: c9a9b9b00bf5 ("rconn: Introduce new invariant to fix assertion failure in corner case.") Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in cmd_destroy() on error.Jakub Sitnicki2018-07-031-2/+6
| | | | | | | | Return the error via the context instead of calling ctl_fatal() so that the caller can decide how to handle it. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in cmd_clear() on error.Jakub Sitnicki2018-07-031-2/+3
| | | | | | | | Return the error via the context instead of calling ctl_fatal() so that the caller can decide how to handle it. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in cmd_remove() on error.Jakub Sitnicki2018-07-031-4/+5
| | | | | | | | Return the error via the context instead of calling ctl_fatal() so that the caller can decide how to handle it. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in cmd_get() on error.Jakub Sitnicki2018-07-031-7/+14
| | | | | | | | Return the error via the context instead of calling ctl_fatal() so that the caller can decide how to handle it. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Kill die_if_error() helper.Jakub Sitnicki2018-07-031-8/+0
| | | | | | | All users are gone. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Fix resource deallocation on error path in cmd_find().Jakub Sitnicki2018-07-031-0/+1
| | | | | | | Release resources now that we are returning to the caller on error. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Fix resource deallocation on error path in cmd_list().Jakub Sitnicki2018-07-031-0/+1
| | | | | | | Release resources now that we are returning to the caller on error. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Fix resource deallocation on error path in cmd_get().Jakub Sitnicki2018-07-031-0/+1
| | | | | | | Release resources now that we are returning to the caller on error. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Stop using die_if_error().Jakub Sitnicki2018-07-031-65/+229
| | | | | | | | | | | | | | | | | | Propagate the error via the context for the caller to handle it. Result of applying the following semantic patch (Coccinelle): @@ expression s; @@ - die_if_error(s); + ctx->error = s; + if (ctx->error) { + return; + } Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Extend ctl_context with an error message.Jakub Sitnicki2018-07-032-0/+25
| | | | | | | | Prepare for the command handlers (pre_cmd_*() cmd_*() functions) to report errors by storing them in the context. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in ctl_set_column() on error.Jakub Sitnicki2018-07-032-8/+16
| | | | | | | | | Return the error message to the caller instead of reporting it and dying so that the caller can handle the error without terminating the process if needed. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in pre_list_columns() on error.Jakub Sitnicki2018-07-031-4/+9
| | | | | | | | | Return the error message to the caller instead of reporting it and dying so that the caller can handle the error without terminating the process if needed. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in pre_parse_column_key_value() on error.Jakub Sitnicki2018-07-031-12/+17
| | | | | | | | | | | | Return the error message to the caller instead of reporting it and dying so that the caller can handle the error without terminating the process if needed. Also, we no longer return the column as it was not used by any of existing callers. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in pre_get_table() on error.Jakub Sitnicki2018-07-031-13/+20
| | | | | | | | | Return the error message to the caller instead of reporting it and dying so that the caller can handle the error without terminating the process if needed. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in pre_get_column() on error.Jakub Sitnicki2018-07-031-6/+10
| | | | | | | | | Return the error message to the caller instead of reporting it and dying so that the caller can handle the error without terminating the process if needed. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in ctl_get_row() on error.Jakub Sitnicki2018-07-032-25/+31
| | | | | | | | | Return the error message to the caller instead of reporting it and dying so that the caller can handle the error without terminating the process if needed. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in get_row_by_id() on multiple matches.Jakub Sitnicki2018-07-031-5/+18
| | | | | | | | | Signal that multiple rows match the record identifier via a new output parameter instead of reporting the problem and dying, so that the caller can handle the error without terminating the process if needed. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in create_symbol() on error.Jakub Sitnicki2018-07-031-8/+16
| | | | | | | | | Return the error message to the caller instead of reporting it and dying so that the caller can handle the error without terminating the process if needed. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in set_column() on error.Jakub Sitnicki2018-07-031-20/+41
| | | | | | | | | Return the error message to the caller instead of reporting it and dying so that the caller can handle the error without terminating the process if needed. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in check_mutable() on error.Jakub Sitnicki2018-07-031-7/+10
| | | | | | | | | Return the error message to the caller instead of reporting it and dying so that the caller can handle the error without terminating the process if needed. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in is_condition_satisfied() on error.Jakub Sitnicki2018-07-031-18/+47
| | | | | | | | | | | | Return the error message to the caller instead of reporting it and dying so that the caller can handle the error without terminating the process if needed. Also, rename the function as it is no longer a typical predicate, so that the users don't assume that the result is passed in return value. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in get_table() on error.Jakub Sitnicki2018-07-031-22/+29
| | | | | | | | | Return the error message to the caller instead of reporting it and dying so that the caller can handle the error without terminating the process if needed. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* db-ctl-base: Don't die in parse_column_names() on error.Jakub Sitnicki2018-07-031-6/+13
| | | | | | | | | Return the error message to the caller instead of reporting it and dying so that the caller can handle the error without terminating the process if needed. Signed-off-by: Jakub Sitnicki <jkbs@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* netdev-tc-offloads: Fix probing multi mask per prioRoi Dayan2018-07-021-8/+17
| | | | | | | | | | | | | | When adding TC rules we save the prio so can reuse same prio for same mask since different mask will have to use different prio. The multi mask per prio probe broke this by using a prio but get_prio_for_tc_flower() didn't know about it. Also multi mask per prio support changes the hash calculation. It's best the probe will add and del the ingress qdisc to have a clean start after it. Signed-off-by: Roi Dayan <roid@mellanox.com> Acked-by: Paul Blakey <paulb@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* netdev-linux: monitor and offload LAG slaves to TCJohn Hurley2018-06-291-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | A LAG slave cannot be added directly to an OvS bridge, nor can a OvS bridge port be added to a LAG dev. However, LAG masters can be added to OvS. Use TC blocks to indirectly offload slaves when their master is attached as a linux-netdev to an OvS bridge. In the kernel TC datapath, blocks link together netdevs in a similar way to LAG devices. For example, if a filter is added to a block then it is added to all block devices, or if stats are incremented on 1 device then the stats on the entire block are incremented. This mimics LAG devices in that if a rule is applied to the LAG master then it should be applied to all slaves etc. Monitor LAG slaves via the netlink socket in netdev-linux and, if their master is attached to the OvS bridge and has a block id, add the slave's qdisc to the same block. Similarly, if a slave is freed from a master, remove the qdisc from the masters block. Signed-off-by: John Hurley <john.hurley@netronome.com> Reviewed-by: Simon Horman <simon.horman@netronome.com> Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* netdev-linux: assign LAG devs to tc blocksJohn Hurley2018-06-291-5/+29
| | | | | | | | | | | | | | Assign block ids to LAG masters that are added to OvS as linux-netdevs and offloaded via offload API calls. Only LAG masters are assigned to blocks. To ensure uniqueness, the block ids are determined by the netdev ifindex. Implement a get_block_id op for linux netdevs to achieve this. Signed-off-by: John Hurley <john.hurley@netronome.com> Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com> Reviewed-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>