summaryrefslogtreecommitdiff
path: root/lib/match.c
Commit message (Collapse)AuthorAgeFilesLines
...
* classifier: Change type used for priorities from 'unsigned int' to 'int'.Ben Pfaff2014-10-301-6/+5
| | | | | | | | | | | | | | | | OpenFlow has priorities in the 16-bit unsigned range, from 0 to 65535. In the classifier, it is sometimes useful to be able to have values below and above this range. With the 'unsigned int' type used for priorities until now, there were no values below the range, so some code worked around it by converting priorities to 64-bit signed integers. This didn't seem so great to me given that a plain 'int' also had the needed range. This commit therefore changes the type used for priorities to int. The interesting parts of this change are in pvector.h and classifier.c, where one can see the elimination of the use of int64_t. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* Use magic ETH_ADDR_LEN instead of 6 for Ethernet address length.Wang Sheng-Hui2014-10-221-2/+3
| | | | | | | | | ETH_ADDR_LEN is defined in lib/packets.h, valued 6. Use this macro instead of magic number 6 to represent the length of eth mac address. Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* lib/match: Do not format undefined fields.Jarno Rajahalme2014-10-061-104/+7
| | | | | | | | | | | | | | Add function flow_wildcards_init_for_packet() that can be used to set sensible wildcards when megaflows are disabled. Before this, we set all the mask bits to ones, which caused printing tunnel, mpls, and/or transport port fields even for packets for which it makes no sense. This has the side effect of generating different megaflow masks for different packet types, so there will be more than one kind of mask in the datapath classifier. This should not make practical difference, as megaflows should not be disabled when performance is important. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib: Unify flags parsing and formatting.Jarno Rajahalme2014-09-081-2/+9
| | | | | | | | | | | | | | Use the "+-" syntax more uniformly when printing masked flags, and use the syntax of delimited 1-flags also for formatting fully masked TCP flags. The "+-" syntax only deals with masked flags, but if there are many of those, the printout becomes long and confusing. Typically there are many flags only when flags are fully masked, but even then most of them are zeros, so it makes sense to print the flags that are set (ones) and omit the zero flags. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* meta-flow: Add 64-bit registers.Ben Pfaff2014-07-281-0/+15
| | | | | | | | | These 64-bit registers are intended to conform with the OpenFlow 1.5 draft specification. EXT-244. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* flow: extend it to carry IGMP protocol informationFlavio Leitner2014-06-241-1/+7
| | | | | | | Add IGMP info to struct flow, flow compose and flow extract. Signed-off-by: Flavio Leitner <fbl@redhat.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* lib/flow: fix minimatch_extract() ICMPv6 parsingJarno Rajahalme2014-06-021-0/+1
| | | | | | | | | | | | | | | This patch addresses two bugs related to ICMPv6(NDP) packets: - In miniflow_extract() push the words in the correct order - In parse_icmpv6() use sizeof struct, not size of struct * match_wc_init() has been modified, to include the nd_target field when the transport layer protocol is ICMPv6 A testcase has been added to detect the bugs. Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* lib/flow: Maintain miniflow offline values explicitly.Jarno Rajahalme2014-04-291-2/+2
| | | | | | | This allows use of miniflows that have all of their values inline. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* lib: Inline functions used in classifier_lookup.Jarno Rajahalme2014-04-291-33/+0
| | | | | | | | | | | | | This helps about 1% in TCP_CRR performance test. However, this also helps by clearly showing the classifier_lookup() cost in perf reports as one item. This also cleans up the flow/match APIs from functionality only used by the classifier, making is more straightforward to evolve them later. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* lib/flow: Introduce miniflow_extract().Jarno Rajahalme2014-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | miniflow_extract() extracts packet headers directly to a miniflow, which is a compressed form of the struct flow. This does not require a large struct to be cleared to begin with, and accesses less memory. These performance benefits should allow this to be used in the DPDK datapath. miniflow_extract() takes a miniflow as an input/output parameter. On input the buffer for values to be extracted must be properly initialized. On output the map contains ones for all the fields that have been extracted. Some struct flow fields are reordered to make miniflow_extract to progress in the logical order. Some explicit "inline" keywords are necessary for GCC to optimize this properly. Also, macros are used for same reason instead of inline functions for pushing data to the miniflow. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
* ofproto/bond: Implement bond megaflow using recirculationAndy Zhou2014-04-071-0/+28
| | | | | | | | | | | | | | | | Infrastructure to enable megaflow support for bond ports using recirculation. This patch adds the following features: * Generate RECIRC action when bond can benefit from recirculation. * Populate post recirculation rules in a hidden table. Currently table 254. * Uses post recirculation rules for bond rebalancing * A recirculation implementation in dpif-netdev. The goal of this patch is to be able to megaflow bond outputs and thus greatly improve performance. However, this patch does not actually improve the megaflow generation. It is left for a later commit. Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib/flow: add dp_hash and recirc_id to struct flowAndy Zhou2014-03-251-1/+31
| | | | | Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Enhance userspace support for MPLS, for up to 3 labels.Ben Pfaff2014-02-041-29/+71
| | | | | | | | | This commit makes the userspace support for MPLS more complete. Now up to 3 labels are supported. Signed-off-by: Ben Pfaff <blp@nicira.com> Co-authored-by: Simon Horman <horms@verge.net.au> Signed-off-by: Simon Horman <horms@verge.net.au>
* lib/flow: Skip minimask value checks.Jarno Rajahalme2013-12-201-10/+11
| | | | | | | | | | | | | | | We allow zero 'values' in a miniflow for it to have the same map as the corresponding minimask. Minimasks themselves never have zero data values, though. Document this and optimize the code accordingly. v2: - Made miniflow_get_map_in_range() to return data offset instead of a pointer via the last parameter. - Simplified minimatch_hash_in_range() by removing pointer arithmetic. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib: refactor match_format() output functionsAndy Zhou2013-12-041-45/+35
| | | | | | | | Refactor to remove some duplicated logic in match_format() implemenation and make the output more uniform. Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib: More intuitive syntax for TCP flags matching.Jarno Rajahalme2013-12-021-3/+4
| | | | | | | | | | | Allow TCP flags match specification with symbolic flag names. TCP flags are optionally specified as a string of flag names, each preceded by '+' when the flag must be one, or '-' when the flag must be zero. Any flags not explicitly included are wildcarded. The existing hex syntax is still allowed, and is used in flow dumps when all the flags are matched. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Classifier: Staged subtable matching.Jarno Rajahalme2013-11-191-1/+26
| | | | | | | | | | | Subtable lookup is performed in ranges defined for struct flow, starting from metadata (registers, in_port, etc.), then L2 header, L3, and finally L4 ports. Whenever it is found that there are no matches in the current subtable, the rest of the subtable can be skipped. The rationale of this logic is that as many fields as possible can remain wildcarded. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
* util: Make raw_ctz() accept 64-bit integers.Ben Pfaff2013-11-181-1/+1
| | | | | | | | | Having a single function that can do raw_ctz() on any integer type is easier for callers to get right, and there is no real downside in the implementation. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* miniflow: Use 64-bit map.Jarno Rajahalme2013-11-181-9/+4
| | | | Signed-off By: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* TCP flags matching support.Jarno Rajahalme2013-10-291-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tcp_flags=flags/mask Bitwise match on TCP flags. The flags and mask are 16-bit num‐ bers written in decimal or in hexadecimal prefixed by 0x. Each 1-bit in mask requires that the corresponding bit in port must match. Each 0-bit in mask causes the corresponding bit to be ignored. TCP protocol currently defines 9 flag bits, and additional 3 bits are reserved (must be transmitted as zero), see RFCs 793, 3168, and 3540. The flag bits are, numbering from the least significant bit: 0: FIN No more data from sender. 1: SYN Synchronize sequence numbers. 2: RST Reset the connection. 3: PSH Push function. 4: ACK Acknowledgement field significant. 5: URG Urgent pointer field significant. 6: ECE ECN Echo. 7: CWR Congestion Windows Reduced. 8: NS Nonce Sum. 9-11: Reserved. 12-15: Not matchable, must be zero. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
* More accurate wildcarding and fragment handling.Jarno Rajahalme2013-10-171-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch gets rid of the need for having explicit padding in struct flow as new fields are being added. flow_wildcards_init_exact(), which used to set bits in both compiler generated and explicit padding, is removed. match_wc_init() is now used instead, which generates the mask based on a given flow, setting bits only in fields which make sense. Places where random bits were placed in struct flow have been changed to only set random bits on fields that are significant in the given context. This avoids setting padding bits. - lib/flow: - Properly initialize struct flow also in places we used to zero out padding before. - Add flow_random_hash_fields() used for testing. - Remove flow_wildcards_init_exact() to avoid initializing masks where compiler generated padding has bits set. - lib/match.c match_wc_init(): Wildcard transport layer fields for later fragments, remove match_init_exact(), which used flow_wildcards_init_exact(). - tests/test-flows.c: use match_wc_init() instead of match_init_exact() - tests/flowgen.pl: generate more accurate packets and flows when fragmenting, mark unavailable fields as wildcarded. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Remove unused variables and functions.Jarno Rajahalme2013-09-271-4/+0
| | | | | | | | Found by Clang. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* Remove mpls_depth field from flowSimon Horman2013-09-271-1/+1
| | | | | | | | | | | | | | | | | | | | | Rather than tracking the MPLS depth as a field in the flow, which is an entirely poor place for it, just track the delta to the MPLS depth during translation. This logic was developed while implementing recirculation and intended to be used to detect when recirculation should occur. This variant of the patch uses the logic to determine if processing of actions should stop due to an MPLS action which cannot be translated (without recirculation). A side-effect of this patch is that it resolves a bug whereby ovs-vswitchd will abort due to to an assertion on eth_type_mpls(ctx->xin->flow.dl_type) in compose_mpls_pop_action(() if the actions of a flow include pop_mpls twice without a push_mpls in between. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* match: New function minimatch_matches_flow().Ben Pfaff2013-09-261-1/+30
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* openvswitch/types.h: New macros OVS_BE16_MAX, OVS_BE32_MAX, OVS_BE64_MAX.Ben Pfaff2013-09-171-15/+15
| | | | | | These seem slightly nicer than e.g. htons(UINT16_MAX). Signed-off-by: Ben Pfaff <blp@nicira.com>
* classifier: New function cls_rule_move().Ben Pfaff2013-08-271-0/+9
| | | | | | | This function will acquire its first user in an upcoming commit. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* ofp-util: Add SCTP supportJoe Stringer2013-08-221-0/+4
| | | | | | Reviewed-by: Simon Horman <horms@verge.net.au> Signed-off-by: Joe Stringer <joe@wand.net.nz> Signed-off-by: Ben Pfaff <blp@nicira.com>
* flow: Enable matching on new field 'pkt_mark'.Jesse Gross2013-08-131-4/+17
| | | | | | | | | | | | | | | The Linux kernel datapath enables matching and setting the skb mark but this functionality is currently used only internally by ovs-vswitchd. This exposes it through NXM to enable external controllers to interact with other kernel subsystems. Although this is simply exporting the skb mark, the intention is that this is a platform independent mechanism to access some system metadata and therefore may have different implementations on various systems. Bug #17855 Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* flow: Rename skb_mark to pkt_mark.Jesse Gross2013-08-131-8/+8
| | | | | | | | | | | | | | | | | | | | The skb_mark field is currently only available with the Linux datapath and is only used internally. However, it is desirable to expose this through OpenFlow and when it is exposed ideally it would not be system- specific. In preparation for this, skb_mark is rename to pkt_mark in internal data structures for consistency. This does not rename the Linux interfaces because doing so would break the API. It would not necessarily be desirable to do anyways since in Linux-specific code it is clearer to use the actual name rather than a generic one. This can lead to confusion in some places, however, because we do not always strictly separate generic and platform dependent code (one example is actions). This seems inevitable though at this point if the lower and upper layers have different names (as they must given the above requirements). Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* ovs-ofctl: Bug fix in flow_format()Andy Zhou2013-07-161-12/+13
| | | | | | | | | | | | | | | | Fix a corner case bug where ARP packet with ARP opcode value of 1 would cause tp_src and tp_dst to appear in the output string. This bug caused some output from flow_format() to not be accepted by 'ovs-appctl ofproto/trace' Added test coverage by using ARP opcode 1 in one unit test case, that would have exposed the bug. Bug #18334 Signed-off-by: Andy Zhou <azhou@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Create specific types for ofp and odp portAlex Wang2013-06-201-5/+5
| | | | | | | | | | | | Until now, datapath ports and openflow ports were both represented by unsigned integers of various sizes. With implicit conversions, etc., it is easy to mix them up and use one where the other is expected. This commit creates two typedefs, ofp_port_t and odp_port_t. Both of these two types are marked by "__attribute__((bitwise))" so that sparse can be used to detect any misuse. Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* OpenFlow-level flow-based tunneling support.Jarno Rajahalme2013-05-101-4/+0
| | | | | | | | | | | | | | | | | | | | | Adds tun_src and tun_dst match and set capabilities via new NXM fields NXM_NX_TUN_IPV4_SRC and NXM_NX_TUN_IPV4_DST. This allows management of large number of tunnels via the flow tables, without requiring the tunnels to be pre-configured. Flow-based tunnels can be configured with options remote_ip=flow and local_ip=flow. local_ip=flow requires remote_ip=flow. When set, the tunnel remote IP address and/or local IP address is set from the flow, instead of the tunnel configuration. Example: $ ovs-vsctl add-port br0 gre -- set Interface gre ofport_request=1 type=gre options:remote_ip=flow options:key=flow $ ovs-ofctl add-flow br0 "in_port=LOCAL actions=set_tunnel:1,set_field:192.168.0.1->tun_dst,output:1" $ ovs-ofctl add-flow br0 "in_port=1 tun_src=192.168.0.1 tun_id=1 actions=LOCAL" Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* match: Correct formatting of MPLSSimon Horman2013-04-241-20/+10
| | | | | | | | | | | | | | | | | | | | | | | 1. mpls or mplsm should be included in the formatted match instead of dl_type=0xXXXX if the dl_type of the match is ETH_TYPE_MPLS or ETH_TYPE_MPLS_MCAST respectively. This is consistent with the treatment of other dl_types in match_format(). 2. Add formatting of MPLS TTL to match_format(). The format is mpls_ttl=YY. 3. Set the mpls_lse mask of a match to all 1's if the dl_type of the flow is ETH_TYPE_MPLS or ETH_TYPE_MPLS_MCAST. This will cause mpls_label=LLLL,mpls_tc=W,mpls_ttl=YY,mpls_bos=Z to be included with the match is formatted. 4. mpls(label:LLLL,tc:W,ttl:TT,bos:Z) and mplsm(label:LLLL,tc:W,ttl:TT,bos:Z) should not be included in a formatted match as this is not consistent with the formatting of other match elements. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Remove encal_dl_type from struct flowSimon Horman2013-03-151-1/+1
| | | | | | | | | | | | | | | | There were plans to use this in conjunction with inner/outer flows, however that plan has been changed in favour of using recirculation. This leaves us with the current usage. encal_dl_type is currently only used to allow decoding of packets used in the test suite. However, this is a bit of a fudge and the packets may be provided as hexadecimal instead. Also remove comments from parse_l2_5_onward() relating to MPLS which are not in keeping with the commenting throughout the rest of the function. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Jesse Gross <jesse@nicira.com>
* Revert "match: Only print tp_src and tp_dst for TCP and UDP."Justin Pettit2013-02-221-2/+1
| | | | | | | | | This reverts commit 9a9a690cc0bc07bb2a0fa01221492cdab61673e3. This commit broke some unit tests, and I want to think about how to address them. I also noticed other fields we should also not print. Signed-off-by: Justin Pettit <jpettit@nicira.com>
* match: Only print tp_src and tp_dst for TCP and UDP.Justin Pettit2013-02-211-1/+2
| | | | | | | | | When printing a match, we would print "tp_src" and "tp_dst" if the packet wasn't ICMPv4 or ICMPv6. Unfortunately, this doesn't cover ARP. This changes the check to only print those keys if the network protocol is TCP or UDP. Signed-off-by: Justin Pettit <jpettit@nicira.com>
* User-Space MPLS actions and matchesSimon Horman2013-02-051-1/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements use-space datapath and non-datapath code to match and use the datapath API set out in Leo Alterman's patch "user-space datapath: Add basic MPLS support to kernel". The resulting MPLS implementation supports: * Pushing a single MPLS label * Poping a single MPLS label * Modifying an MPLS lable using set-field or load actions that act on the label value, tc and bos bit. * There is no support for manipulating the TTL this is considered future work. The single-level push pop limitation is implemented by processing push, pop and set-field/load actions in order and discarding information that would require multiple levels of push/pop to be supported. e.g. push,push -> the first push is discarded pop,pop -> the first pop is discarded This patch is based heavily on work by Ravi K. Cc: Ravi K <rkerur@gmail.com> Reviewed-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* packets: Create global helper is_ip_any().Ethan Jackson2013-01-281-3/+2
| | | | | | Used outside of meta-flow in future patches. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* Replace most uses of assert by ovs_assert.Ben Pfaff2013-01-161-2/+1
| | | | | | | | This is a straight search-and-replace, except that I also removed #include <assert.h> from each file where there were no assert calls left. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* openflow: Print in_port as string for reserved/special ports.Gurucharan Shetty2013-01-091-1/+4
| | | | | | | | | | | | | | | | Currently, when we add a flow with in_port=65534, we get the following warning. "ofp_util|WARN|referring to port LOCAL as 65534 is deprecated for compatibility with future versions of OpenFlow." But ovs-ofctl, while dumping flows uses 65534 instead of LOCAL. The same is true for other reserved ports. This patch corrects that. Bug #14118. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* vswitchd: log skb_mark and skb_priorityAnsis Atteka2012-12-181-0/+30
| | | | | | | This patch adds logging support for skb_mark and skb_priority. Acked-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Ansis Atteka <aatteka@nicira.com>
* vswitchd: Log all tunnel parameters of given flow.Pravin B Shelar2012-11-211-14/+108
| | | | Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
* datapath: add skb mark matching and set actionAnsis Atteka2012-11-211-1/+2
| | | | | | | This patch adds support for skb mark matching and set action. Acked-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Ansis Atteka <aatteka@nicira.com>
* Process RARP packets with ethertype 0x8035 similar to ARP packets.Mehak Mahajan2012-11-021-5/+12
| | | | | | | With this commit, OVS will match the data in the RARP packets having ethertype 0x8035, in the same way as the data in the ARP packets. Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
* ARP packets must have print arp_tpa/arp_spa instead of nw_dst/nw_src.Mehak Mahajan2012-10-221-0/+3
| | | | | | | | | | With a previous commit 953cc1888321346e6c4175fbc0a3f66d34913ea3, the ovs logs were re-formatted such that they can be input into the ofproto/trace. For ARP packets, ofproto/trace expects arp_tpa/arp_spa instead of nw_dst/nw_src. Signed-off-by: Mehak Mahajan <mmahajan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* Do not print ICMP fields for non IP packets.Mehak Mahajan2012-10-221-2/+4
| | | | | | | | | | | | The packet's nw_proto field overlaps with the ARP opcode field. The nw_proto for ICMP packets is 1. Hence when the packet is an ARP request (opcode 1), we erroneously print the ICMP code and ICMP type for ARP frames as well. With this commit, the ICMP code and ICMP type will be printed only if the packet is an IP packet and the nw_proto is ICMP. Signed-off-by: Mehak Mahajan <mmahajan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* Change logging format for flows to that accepted by ofproto/trace.Mehak Mahajan2012-10-221-0/+82
| | | | | | | | | | | flow_format() logs packets contents. However, the format used is not the format accepted by ofproto/trace. Hence it becomes difficult to trace the packets using the debugs printed. With this commit, the logging of the packet contents is done in a format that is accepted by ofproto/trace. This will make debugging easier. Signed-off-by: Mehak Mahajan <mmahajan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* flow: Extend struct flow to contain tunnel outer header.Jesse Gross2012-10-031-5/+10
| | | | | | | | | | | Soon the kernel will begin supplying the information about the outer IP header for tunneled packets and userspace will need to be able to track it as part of the flow. For the time being this is only used internally by OVS and not exposed outwards to OpenFlow. As a result, this threads the information throughout userspace but simply stores the existing tun_id in it. Signed-off-by: Jesse Gross <jesse@nicira.com>
* Introduce sparse flows and masks, to reduce memory usage and improve speed.Ben Pfaff2012-09-041-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | | A cls_rule is 324 bytes on i386 now. The cost of a flow table lookup is currently proportional to this size, which is going to continue to grow. However, the required cost of a flow table lookup, with the classifier that we currently use, is only proportional to the number of bits that a rule actually matches. This commit implements that optimization by replacing the match inside "struct cls_rule" by a sparse representation. This reduces struct cls_rule to 100 bytes on i386. There is still some headroom for further optimization following this commit: - I suspect that adding an 'n' member to struct miniflow would make miniflow operations faster, since popcount() has some cost. - It's probably possible to replace the "struct minimatch" in cls_rule by just a "struct miniflow", since the cls_rule's cls_table has a copy of the minimask. - Some of the miniflow operations aren't well-optimized. Signed-off-by: Ben Pfaff <blp@nicira.com>
* classifier: Break cls_rule 'flow' and 'wc' members into new "struct match".Ben Pfaff2012-09-041-0/+775
Signed-off-by: Ben Pfaff <blp@nicira.com>