Re: [ovs-dev] [PATCH] stp: Fix bpdu tx problem in listening state
On Wed, Mar 12, 2014 at 1:41 PM, Ben Pfaff wrote: > On Sun, Mar 09, 2014 at 05:48:52PM +0800, kmindg wrote: >> The restriction only allows to send bpdu in forwarding state in >> compose_output_action__. But a port could send bpdu in listening >> and learning state according to comments in lib/stp.h(State of >> an STP port). >> >> Signed-off-by: kmindg > > This appears to fix a bug, but I'm not sure exactly how bad that bug is, > or what the symptoms of it are. Does this patch mean that currently OVS > isn't sending out BPDUs in certain STP states? (In other words, that > STP is currently broken?) Yes, currently OVS isn't sending out BPDUs in listening and learning states. But those two states are temporary, the stp port will be in forwarding state and send out BPDUs eventually (In the default configuration listening and learning states last 15+15 second). So this minor problem may only increase the convergence time, in my opinion. ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH 2/4] connmgr: Remove unnecessary reason fixup logic
> On Wed, Mar 12, 2014 at 12:00:12PM +0900, YAMAMOTO Takashi wrote: >> > A packet_in message may be sent for one of two reasons. >> > >> > 1. As the result of an controller action supplied in a rule. >> >This is executed if a packet matches the match for the rule. >> >The packet_in reason is explicitly part of the action and >> >is thus correct. >> >> for OFPACT_CONTROLLER (NX thing) it's correct. >> for OFPACT_OUTPUT (OF standard way), it isn't. >> >> for the latter, reason=OFPR_ACTION is hardcoded in xlate_output_action. >> OF1.3 (1.3.3 5.4.) states reason=table-miss for table-miss flow entry >> and thus needs the fixup logic in question. > > Thanks, I think understand now. > > But I wonder if there are some problems that cause the fixup never to be > invoked. i'm sure it worked correctly, at least when the patch was merged. > > i. For the reasons described in patch 3 of this series >rule_dpif_is_table_miss() always returns false and thus >pin->generated_by_table_miss is always false. > >This means that the if condition in wire_reason() is never true. table-miss flows (in the sense of OF1.3) are not OVS internal flows. they are ordinary flows with priority=0 and empty match. a controller can freely install and remove them. > > ii. It seems to me that the fixup should be invoked if > pin->generated_by_table_miss is false as what you describe > immediately above is that the fixup logic is needed > explicit output actions rather than for table misses. i guess you are confused by ofproto->miss_rule and OF1.3 table-miss flows. they are different things. generated_by_table_miss is true if the pin is caused by OF1.3 table-miss flow. it isn't for ofproto->miss_rule. YAMAMOTO Takashi > > And I believe there are further problems which we reach (like a bonus level > of an arcade game) once the above issues are addressed: > > Bonus i. The reason is forced to no_match even for > OFPACT_CONTROLLER with reason set to action. > >I wonder if this could be resolved by adding a from_output_action >field to struct ofproto_packet_in and setting it using a parameter >passed to execute_controller_action(). > > Bonus ii. parse_controller() emits an output action rather than a > controller action if the reason is action and the controller_id > is 0. This seems to assume that an output action always > has action as its reason. But as we know this is not > the case for OpenFlow 1.3+ > > I propose simplifying parse_controller() to always emit > a controller action. > > My proposal is as follows: > > * Drop this patch > * Address the issues described above > * Add a test to exercise the fixup (I have one locally) > * Rebase patch 4 of this series > > > Does that sound reasonable to you or am I still confused about > how this is fixup? > >> >> YAMAMOTO Takashi >> >> > >> > 2. As the result of the failure to match a packet against any rule. >> >In this case a rule present in TBL_INTERNAL is used. This rule >> >has the packet_in reason set to OFPR_NO_MATCH. >> > >> >This is the behaviour described in OpenFlow 1.1 and 1.2 when >> >a miss occurs. And to date it is the behaviour provided >> >by Open vSwtich for all OpenFlow versions. >> > >> >When this behaviour is in effect OFPR_NO_MATCH is the desired >> >packet_in reason and by virtue of the TBL_INTERNAL rule described >> >above is always that value. >> > >> > So for both cases the packet_in reason is always correct. >> > And following this reasoning there seems to be no need to fix it up. >> > >> > What there is a need for, which this patch does not address, is for packets >> > to be dropped rather than forwarded to OpenFlow1.3 controllers when a miss >> > occurs and an alternate behaviour has not been selected using Table Mod. I >> > plan to address this in subsequent patches. >> > >> > As well as not been necessary, I believe that the logic that this patch >> > removes has not been executed because pin->generated_by_table_miss is never >> > true without a separate patch that I have proposed, "ofproto-dpip: Set >> > generated_by_table_miss for miss rule". So I do not expect there to be any >> > run-time affect of this change. >> > >> > This patch does not remove pin->generated_by_table_miss, although it >> > is now set but never used, as I plan to use when implementing the >> > OpenFlow1.3 drop-on-miss behaviour described above. >> > >> > Cc: YAMAMOTO Takashi >> > Signed-off-by: Simon Horman >> > --- >> > ofproto/connmgr.c | 32 >> > 1 file changed, 4 insertions(+), 28 deletions(-) >> > >> > diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c >> > index 033ab7d..954a0f9 100644 >> > --- a/ofproto/connmgr.c >> > +++ b/ofproto/connmgr.c >> > @@ -1452,8 +1452,7 @@ ofconn_send(const struct ofconn *ofconn, struct >> > ofpbuf *msg, >> > ^L >> > /* Sending asynchronou
Re: [ovs-dev] [PATCH 2/4] connmgr: Remove unnecessary reason fixup logic
On Wed, Mar 12, 2014 at 05:00:09PM +0900, YAMAMOTO Takashi wrote: > > On Wed, Mar 12, 2014 at 12:00:12PM +0900, YAMAMOTO Takashi wrote: > >> > A packet_in message may be sent for one of two reasons. > >> > > >> > 1. As the result of an controller action supplied in a rule. > >> >This is executed if a packet matches the match for the rule. > >> >The packet_in reason is explicitly part of the action and > >> >is thus correct. > >> > >> for OFPACT_CONTROLLER (NX thing) it's correct. > >> for OFPACT_OUTPUT (OF standard way), it isn't. > >> > >> for the latter, reason=OFPR_ACTION is hardcoded in xlate_output_action. > >> OF1.3 (1.3.3 5.4.) states reason=table-miss for table-miss flow entry > >> and thus needs the fixup logic in question. > > > > Thanks, I think understand now. > > > > But I wonder if there are some problems that cause the fixup never to be > > invoked. > > i'm sure it worked correctly, at least when the patch was merged. > > > > > i. For the reasons described in patch 3 of this series > >rule_dpif_is_table_miss() always returns false and thus > >pin->generated_by_table_miss is always false. > > > >This means that the if condition in wire_reason() is never true. > > table-miss flows (in the sense of OF1.3) are not OVS internal flows. > they are ordinary flows with priority=0 and empty match. > a controller can freely install and remove them. > > > > > ii. It seems to me that the fixup should be invoked if > > pin->generated_by_table_miss is false as what you describe > > immediately above is that the fixup logic is needed > > explicit output actions rather than for table misses. > > i guess you are confused by ofproto->miss_rule and OF1.3 table-miss flows. > they are different things. generated_by_table_miss is true if the pin > is caused by OF1.3 table-miss flow. it isn't for ofproto->miss_rule. Yes, I was not aware of that. > > YAMAMOTO Takashi > > > > > And I believe there are further problems which we reach (like a bonus level > > of an arcade game) once the above issues are addressed: > > > > Bonus i. The reason is forced to no_match even for > > OFPACT_CONTROLLER with reason set to action. > > > > I wonder if this could be resolved by adding a from_output_action > > field to struct ofproto_packet_in and setting it using a parameter > > passed to execute_controller_action(). > > > > Bonus ii. parse_controller() emits an output action rather than a > > controller action if the reason is action and the controller_id > > is 0. This seems to assume that an output action always > > has action as its reason. But as we know this is not > > the case for OpenFlow 1.3+ > > > > I propose simplifying parse_controller() to always emit > > a controller action. > > > > My proposal is as follows: > > > > * Drop this patch > > * Address the issues described above > > * Add a test to exercise the fixup (I have one locally) > > * Rebase patch 4 of this series > > > > > > Does that sound reasonable to you or am I still confused about > > how this is fixup? > > > >> > >> YAMAMOTO Takashi > >> > >> > > >> > 2. As the result of the failure to match a packet against any rule. > >> >In this case a rule present in TBL_INTERNAL is used. This rule > >> >has the packet_in reason set to OFPR_NO_MATCH. > >> > > >> >This is the behaviour described in OpenFlow 1.1 and 1.2 when > >> >a miss occurs. And to date it is the behaviour provided > >> >by Open vSwtich for all OpenFlow versions. > >> > > >> >When this behaviour is in effect OFPR_NO_MATCH is the desired > >> >packet_in reason and by virtue of the TBL_INTERNAL rule described > >> >above is always that value. > >> > > >> > So for both cases the packet_in reason is always correct. > >> > And following this reasoning there seems to be no need to fix it up. > >> > > >> > What there is a need for, which this patch does not address, is for > >> > packets > >> > to be dropped rather than forwarded to OpenFlow1.3 controllers when a > >> > miss > >> > occurs and an alternate behaviour has not been selected using Table Mod. > >> > I > >> > plan to address this in subsequent patches. > >> > > >> > As well as not been necessary, I believe that the logic that this patch > >> > removes has not been executed because pin->generated_by_table_miss is > >> > never > >> > true without a separate patch that I have proposed, "ofproto-dpip: Set > >> > generated_by_table_miss for miss rule". So I do not expect there to be > >> > any > >> > run-time affect of this change. > >> > > >> > This patch does not remove pin->generated_by_table_miss, although it > >> > is now set but never used, as I plan to use when implementing the > >> > OpenFlow1.3 drop-on-miss behaviour described above. > >> > > >> > Cc: YAMAMOTO Takashi > >> > Signed-off-by: Simon Horman > >> > --- > >> > ofproto/connmgr.c | 32
[ovs-dev] [PATCH 3/3] learn.at: fix a race in "self-modifying flow with hard_timeout" test
Signed-off-by: YAMAMOTO Takashi --- tests/learn.at | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/learn.at b/tests/learn.at index 8807723..e656c97 100644 --- a/tests/learn.at +++ b/tests/learn.at @@ -381,25 +381,31 @@ ADD_OF_PORTS([br0], 1, 2, 3) ovs-appctl time/stop # Set up flow table for TCPv4 port learning. -AT_CHECK([[ovs-ofctl add-flow br0 'actions=load:3->NXM_NX_REG0[0..15],learn(table=0,hard_timeout=5,priority=65535,NXM_OF_ETH_SRC[],NXM_OF_VLAN_TCI[0..11],output:NXM_NX_REG0[0..15]),output:2']]) +AT_CHECK([[ovs-ofctl add-flow br0 'actions=load:3->NXM_NX_REG0[0..15],learn(table=0,hard_timeout=10,priority=65535,NXM_OF_ETH_SRC[],NXM_OF_VLAN_TCI[0..11],output:NXM_NX_REG0[0..15]),output:2']]) # Trace some packets arriving. The particular packets don't matter. for i in `seq 1 10`; do ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)' -ovs-appctl time/warp 10 if [[ $i -eq 1 ]]; then sleep 1 fi +ovs-appctl time/warp 10 done # Trace some packets arriving. This is is a different flow from the previous. -# Note that we advance time by 1 second between each packet here. +# Note that we advance time by 2 second between each packet here. for i in `seq 1 10`; do ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)' -ovs-appctl time/warp 1000 -if [[ $i -eq 1 ]]; then +# Note: hard_timeout should fire immediately after #6 packet. +# #7 packet re-install the flow and the following 3 packets +# (#8, #9, #10) use the flow. +# it's difficult to predict the exact timing of rule expiry +# because it's affected by flow dumper thread via udpif_dump_seq. +# hard_timeout value for this test was chosen to overcome the uncertainty. +if [[ $i -eq 1 -o $i -eq 6 -o $i -eq 7 ]]; then sleep 1 fi +ovs-appctl time/warp 2000 done # Check that the first packet of each flow went out port 2 and the rest out @@ -416,9 +422,10 @@ OFPST_PORT reply: 1 ports # Check for the learning entry. ovs-appctl time/warp 1000 +sleep 1 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], -[[ n_packets=3, n_bytes=180, actions=load:0x3->NXM_NX_REG0[0..15],learn(table=0,hard_timeout=5,priority=65535,NXM_OF_ETH_SRC[],NXM_OF_VLAN_TCI[0..11],output:NXM_NX_REG0[0..15]),output:2 - n_packets=3, n_bytes=180, hard_timeout=5, priority=65535,vlan_tci=0x/0x0fff,dl_src=50:54:00:00:00:06 actions=output:3 +[[ n_packets=3, n_bytes=180, actions=load:0x3->NXM_NX_REG0[0..15],learn(table=0,hard_timeout=10,priority=65535,NXM_OF_ETH_SRC[],NXM_OF_VLAN_TCI[0..11],output:NXM_NX_REG0[0..15]),output:2 + n_packets=3, n_bytes=180, hard_timeout=10, priority=65535,vlan_tci=0x/0x0fff,dl_src=50:54:00:00:00:06 actions=output:3 NXST_FLOW reply: ]]) OVS_VSWITCHD_STOP -- 1.8.3.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH 1/3] learn.at: wrap long comments
Signed-off-by: YAMAMOTO Takashi --- tests/learn.at | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/learn.at b/tests/learn.at index 9bd3c44..b88ea12 100644 --- a/tests/learn.at +++ b/tests/learn.at @@ -350,7 +350,8 @@ for i in `seq 1 10`; do fi done -# Check that the first packet of each flow went out port 2 and the rest out port 3. +# Check that the first packet of each flow went out port 2 and the rest out +# port 3. AT_CHECK( [(ovs-ofctl dump-ports br0 2; ovs-ofctl dump-ports br0 3) | STRIP_XIDS], [0], [OFPST_PORT reply: 1 ports @@ -401,7 +402,8 @@ for i in `seq 1 10`; do fi done -# Check that the first packet of each flow went out port 2 and the rest out port 3. +# Check that the first packet of each flow went out port 2 and the rest out +# port 3. AT_CHECK( [(ovs-ofctl dump-ports br0 2; ovs-ofctl dump-ports br0 3) | STRIP_XIDS], [0], [OFPST_PORT reply: 1 ports -- 1.8.3.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH 2/3] learn.at: fix a comment
Signed-off-by: YAMAMOTO Takashi --- tests/learn.at | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/learn.at b/tests/learn.at index b88ea12..8807723 100644 --- a/tests/learn.at +++ b/tests/learn.at @@ -372,7 +372,7 @@ NXST_FLOW reply: OVS_VSWITCHD_STOP AT_CLEANUP -# This test is much like the previous, but adds idle timeouts and sends +# This test is much like the previous, but adds hard timeouts and sends # two different flows to the bridge. This tests that the statistics are # attributed correctly. AT_SETUP([learning action - self-modifying flow with hard_timeout]) -- 1.8.3.1 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] Rackspace Users
Hi, Found your company is interested in *Rackspace Users*. We provide Top Decision Makers information like Name, Email, Title, Phone Number and Company Name, Address, Revenue, Employees Size and other details. Few of the *Technology* are mentioned below as per you interest: *AT&T SAVVIS Sirius NetApp RightScale Amazon* Verizon and many more.. We also provide IT Decision Makers, Sales and Marketing Decision Makers, C-level Titles and Decision Makers from all Departments. Please let me know your thoughts so that I can send you cost of the list. Appreciate your time and look forward to hear from you. Regards *Addie Taylor* Data Specialist | List acquisition | Technology Lists | Email/Data Appending | Search Engine Optimization | To opt out response REMOVE ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH v2] ovsdb-server: Truncate file for Windows.
There is no ftruncate() in visual studio. There is a _chsize_s() which has a similar functionality. Signed-off-by: Gurucharan Shetty --- include/windows/windefs.h |1 + lib/util.c| 12 lib/util.h|1 + 3 files changed, 14 insertions(+) diff --git a/include/windows/windefs.h b/include/windows/windefs.h index dcfa20b..6d36adc 100644 --- a/include/windows/windefs.h +++ b/include/windows/windefs.h @@ -22,6 +22,7 @@ #include #include #include +#include #define inline __inline #define __func__ __FUNCTION__ diff --git a/lib/util.c b/lib/util.c index 68a1ce6..6353e9c 100644 --- a/lib/util.c +++ b/lib/util.c @@ -1688,4 +1688,16 @@ ovs_lasterror_to_string(void) { return ovs_format_message(GetLastError()); } + +int +ftruncate(int fd, off_t length) +{ +int error; + +error = _chsize_s(fd, length); +if (error) { +return -1; +} +return 0; +} #endif diff --git a/lib/util.h b/lib/util.h index 9afe10e..53039da 100644 --- a/lib/util.h +++ b/lib/util.h @@ -493,6 +493,7 @@ uint64_t bitwise_get(const void *src, unsigned int src_len, char *ovs_format_message(int error); char *ovs_lasterror_to_string(void); +int ftruncate(int fd, off_t length); #endif #ifdef __cplusplus -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH v2] uuid: Use current time to compute sha.
Windows does not have the getppid(), getuid(), getgid() functions. We do get a random seed from CryptGenRandom(). That seed along with process id and current time hopefully is good enough. Signed-off-by: Gurucharan Shetty --- lib/uuid.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/uuid.c b/lib/uuid.c index 315c851..df1206e 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -206,31 +206,33 @@ error: } static void +sha1_update_int(struct sha1_ctx *sha1_ctx, uintmax_t x) +{ + sha1_update(sha1_ctx, &x, sizeof x); +} + +static void do_init(void) { uint8_t sha1[SHA1_DIGEST_SIZE]; struct sha1_ctx sha1_ctx; uint8_t random_seed[16]; struct timeval now; -pid_t pid, ppid; -uid_t uid; -gid_t gid; /* Get seed data. */ get_entropy_or_die(random_seed, sizeof random_seed); xgettimeofday(&now); -pid = getpid(); -ppid = getppid(); -uid = getuid(); -gid = getgid(); /* Convert seed into key. */ sha1_init(&sha1_ctx); sha1_update(&sha1_ctx, random_seed, sizeof random_seed); -sha1_update(&sha1_ctx, &pid, sizeof pid); -sha1_update(&sha1_ctx, &ppid, sizeof ppid); -sha1_update(&sha1_ctx, &uid, sizeof uid); -sha1_update(&sha1_ctx, &gid, sizeof gid); +sha1_update(&sha1_ctx, &now, sizeof now); +sha1_update_int(&sha1_ctx, getpid()); +#ifndef _WIN32 +sha1_update_int(&sha1_ctx, getppid()); +sha1_update_int(&sha1_ctx, getuid()); +sha1_update_int(&sha1_ctx, getgid()); +#endif sha1_final(&sha1_ctx, sha1); /* Generate key. */ -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH v2] ofp-print: __attribute__ format in visual studio.
Visual studio does not understand __attribute__ format. Signed-off-by: Gurucharan Shetty --- lib/ofp-print.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ofp-print.c b/lib/ofp-print.c index 06e64f6..5b53366 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -572,7 +572,7 @@ ofp_print_switch_config(struct ds *string, const struct ofp_switch_config *osc) static void print_wild(struct ds *string, const char *leader, int is_wild, int verbosity, const char *format, ...) -__attribute__((format(printf, 5, 6))); +PRINTF_FORMAT(5, 6); static void print_wild(struct ds *string, const char *leader, int is_wild, int verbosity, const char *format, ...) -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH v2] ofp-print: __attribute__ format in visual studio.
On Wed, Mar 12, 2014 at 08:12:14AM -0700, Gurucharan Shetty wrote: > Visual studio does not understand __attribute__ format. > > Signed-off-by: Gurucharan Shetty Acked-by: Ben Pfaff ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH v2] ovsdb-server: Truncate file for Windows.
On Wed, Mar 12, 2014 at 08:12:15AM -0700, Gurucharan Shetty wrote: > There is no ftruncate() in visual studio. There is a _chsize_s() > which has a similar functionality. > > Signed-off-by: Gurucharan Shetty Acked-by: Ben Pfaff ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH v2] uuid: Use current time to compute sha.
On Wed, Mar 12, 2014 at 08:12:16AM -0700, Gurucharan Shetty wrote: > Windows does not have the getppid(), getuid(), getgid() functions. > We do get a random seed from CryptGenRandom(). That seed along with > process id and current time hopefully is good enough. > > Signed-off-by: Gurucharan Shetty Acked-by: Ben Pfaff ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH V3 2/5] dpif-netdev: Implement the API functions to allow multiple handler threads read upcall.
> > > PATCH -> V2: > > > > - explain the drop of upcall queueing priority in dpif-netdev. > > > > - use mhash to calculate the 5-tuple hash. > > > > > > Why does dpif_netdev_recv_set() ignore its 'enable' argument? > > > > I saw in current dpif-netdev.c, the dpif_netdev_recv_set() does nothing. > > > > I didn't ask for the reason. But now seems to be the good time, do you > know > > why it is not implemented? > > > > If there is the need, I'd like follow the dpif-provider definition and > > implement it. > > I don't know why it does nothing. I see that it has been that way for > years, so obviously it is not particularly harmful. But I would prefer > to follow the definition, if it does not require too much work to do so. > > Cool, I'll add this. > > > As written, flow_hash_5tuple() will incorporate ICMP type and code > > > into the hash (because those are stored into tp_src and tp_dst). Is > > > that desirable? > > > > > > > > > I'm okay with that. I think counting ICMP type and code in hash will not > > cause > > particular handler receiving unfairly more ICMP related upcalls. (Is > this > > what you > > concerned?) > > I am not concerned about fairness in this case. I am wondering whether > one should ensure ordered delivery of ICMP with different type and > code. My guess is that it does not matter, so let's leave this as-is > unless anyone speaks up. This will require the datapath to distinguish such special packets and send them to the same PID. Also, can you give me an example that we will have a userspace action to send packet like ICMP to userspace? I can only think of sampling. And I cannot think of other example where the reordering would happen. > > Also, want to ask that if there is any issue with the first patch? > > I don't recall what I thought about it, I'll look at it again now. > ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH V3 1/5] dpif: Change dpif API to allow multiple handler threads read upcall.
> - fold in Ben's clarification. > > - refine the comments. > > - invoke dpif_handlers_set() in udpif_set_threads(). this is a bug. > > the previous code will cause the handlers polling from closed > > fd. > > I'm still trying to figure out whether I properly understand the new > API. Here's a suggested replacement for the first paragraph of the > comment on 'port_get_pid'. Is it correct? > > /* Returns the Netlink PID value to supply in OVS_ACTION_ATTR_USERSPACE > * actions as the OVS_USERSPACE_ATTR_PID attribute's value, for use in > * flows whose packets arrived on port 'port_no'. In the case where > the > * provider allocates multiple Netlink PIDs to a single port, it may > use > * 'hash' to spread load among them. The caller need not use a > particular > * hash function, because it is not generally necessary to avoid > reordering > * between packets received via flow misses (which are spread among > PIDs by > * the datapath internally) and those received via userspace actions > (which > * are spread via the return value of this function). A 5-tuple hash > is > * suitable. > > Thanks for pointing out the reordering issue, the suggested comment makes sense. I'm not sure if it is good grammar, but can I add one more 'between' like below? /* Returns the Netlink PID value to supply in OVS_ACTION_ATTR_USERSPACE * actions as the OVS_USERSPACE_ATTR_PID attribute's value, for use in * flows whose packets arrived on port 'port_no'. In the case where the * provider allocates multiple Netlink PIDs to a single port, it may use * 'hash' to spread load among them. The caller need not use a particular * hash function, because it is not generally necessary to avoid reordering * between packets received via flow misses (which are spread among PIDs by * the datapath internally) and *between *those received via userspace actions (which * are spread via the return value of this function), (e.g. sampling actions). * A 5-tuple hash is suitable. Hope to hear more about the API, Alex Wang, ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] configure: Include pthread-win32 libraries for Windows build.
From: Gurucharan Shetty Signed-off-by: Gurucharan Shetty Signed-off-by: Saurabh Shah Co-authored-by: Saurabh Shah --- BUILD.Windows |7 ++- Makefile.am |2 ++ build-aux/cccl |2 +- lib/automake.mk |5 + m4/openvswitch.m4 | 21 + ofproto/automake.mk |4 6 files changed, 39 insertions(+), 2 deletions(-) diff --git a/BUILD.Windows b/BUILD.Windows index ea931eb..c640e28 100644 --- a/BUILD.Windows +++ b/BUILD.Windows @@ -34,6 +34,11 @@ If after the above step, a 'which link' inside MSYS's bash says, "/bin/link.exe", rename /bin/link.exe to something else so that the Visual studio's linker is used. +* For pthread support, install the library, dll and includes of pthreads-win32 +project from +ftp://sourceware.org/pub/pthreads-win32/prebuilt-dll-2-9-1-release to a +directory (e.g.: C:/pthread). + * Get the Open vSwitch sources from either cloning the repo using git or from a distribution tar ball. @@ -49,7 +54,7 @@ or from a distribution tar ball. % ./configure CC=./build-aux/cccl LD="`which link`" LIBS="-lws2_32 ..." \ --prefix="C:/openvswitch/usr" --localstatedir="C:/openvswitch/var" \ ---sysconfdir="C:/openvswitch/etc" +--sysconfdir="C:/openvswitch/etc" --with-pthread="C:/pthread" * Run make for the ported executables in the top source directory, e.g.: diff --git a/Makefile.am b/Makefile.am index 6a2aca2..b5d33ac 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,6 +14,8 @@ AM_LDFLAGS = $(SSL_LDFLAGS) if WIN32 AM_CPPFLAGS += -I $(top_srcdir)/include/windows +AM_CPPFLAGS += $(PTHREAD_INCLUDES) +AM_LDFLAGS += $(PTHREAD_LDFLAGS) endif AM_CPPFLAGS += $(SSL_INCLUDES) diff --git a/build-aux/cccl b/build-aux/cccl index 855f183..d6915aa 100644 --- a/build-aux/cccl +++ b/build-aux/cccl @@ -91,7 +91,7 @@ EOF -L*) path=`echo "$1" | sed 's/-L//'` -linkopt="$linkopt ${slash}LIBPATH:\"$path\"" +linkopt="$linkopt ${slash}LIBPATH:$path" cl_linkopt="${slash}link ${slash}LIBPATH:\"$path\"" ;; diff --git a/lib/automake.mk b/lib/automake.mk index b1688ef..c2cfb16 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -8,6 +8,11 @@ lib_LTLIBRARIES += lib/libopenvswitch.la lib_libopenvswitch_la_LIBADD = $(SSL_LIBS) + +if WIN32 +lib_libopenvswitch_la_LIBADD += ${PTHREAD_LIBS} +endif + lib_libopenvswitch_la_LDFLAGS = -release $(VERSION) lib_libopenvswitch_la_SOURCES = \ diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index 7a0465b..fa741f6 100644 --- a/m4/openvswitch.m4 +++ b/m4/openvswitch.m4 @@ -63,6 +63,27 @@ AC_DEFUN([OVS_CHECK_WIN32], [WIN32=no]) AM_CONDITIONAL([WIN32], [test "$WIN32" = yes]) if test "$WIN32" = yes; then + AC_ARG_WITH([pthread], + [AS_HELP_STRING([--with-pthread=DIR], +[root of the pthread-win32 directory])], + [ +case "$withval" in +"" | y | ye | yes | n | no) +AC_MSG_ERROR([Invalid --with-pthread value]) + ;; +*) +PTHREAD_INCLUDES="-I$withval/include" +PTHREAD_LDFLAGS="-L$withval/lib/x86" +PTHREAD_LIBS="-lpthreadVC2" +AC_SUBST([PTHREAD_INCLUDES]) +AC_SUBST([PTHREAD_LDFLAGS]) +AC_SUBST([PTHREAD_LIBS]) + ;; +esac + ], [ +AC_MSG_ERROR([pthread directory not specified]) + ] + ) AC_DEFINE([WIN32], [1], [Define to 1 if building on WIN32.]) AH_BOTTOM([#ifdef WIN32 #include "include/windows/windefs.h" diff --git a/ofproto/automake.mk b/ofproto/automake.mk index 1308820..448138b 100644 --- a/ofproto/automake.mk +++ b/ofproto/automake.mk @@ -47,6 +47,10 @@ ofproto_libofproto_la_SOURCES = \ ofproto_libofproto_la_CPPFLAGS = $(AM_CPPFLAGS) ofproto_libofproto_la_CFLAGS = $(AM_CFLAGS) ofproto_libofproto_la_LIBADD = lib/libsflow.la +if WIN32 +ofproto_libofproto_la_LIBADD += ${PTHREAD_LIBS} +endif + # Distribute this generated file in order not to require Python at # build time if ofproto/ipfix.xml is not modified. -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] windows/netinet: Import ip6.h and icmp6.h from netbsd.
There are a few structure definitions that is used from these headers. The keyword "__packed" has been removed from the headers as the corresponding Linux headers don't do packing. Signed-off-by: Gurucharan Shetty --- COPYING |4 + debian/copyright.in |2 + include/windows/netinet/icmp6.h | 774 +++ include/windows/netinet/ip6.h | 318 4 files changed, 1098 insertions(+) diff --git a/COPYING b/COPYING index f5bdb2d..2003830 100644 --- a/COPYING +++ b/COPYING @@ -26,6 +26,10 @@ The following files are licensed under the 2-clause BSD license. include/windows/getopt.h lib/getopt_long.c +The following files are licensed under the 3-clause BSD-license +include/windows/netinet/icmp6.h +include/windows/netinet/ip6.h + Files under the xenserver directory are licensed on a file-by-file basis. Refer to each file for details. diff --git a/debian/copyright.in b/debian/copyright.in index af6c586..c6c9ad2 100644 --- a/debian/copyright.in +++ b/debian/copyright.in @@ -15,6 +15,8 @@ Upstream Copyright Holders: Copyright (c) 2011 Gaetano Catalli Copyright (C) 2000-2003 Geoffrey Wossum (gwos...@acm.org) Copyright (C) 2000 The NetBSD Foundation, Inc. + Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + Copyright (c) 1982, 1986, 1993 The Regents of the University of California. License: diff --git a/include/windows/netinet/icmp6.h b/include/windows/netinet/icmp6.h index e69de29..6b581aa 100644 --- a/include/windows/netinet/icmp6.h +++ b/include/windows/netinet/icmp6.h @@ -0,0 +1,774 @@ +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + *may be used to endorse or promote products derived from this software + *without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + *may be used to endorse or promote products derived from this software + *without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _NETINET_ICMP6_H_ +#define _NE
[ovs-dev] [PATCH] ovsdb: Do not look for symbolic links for db creation.
We start with not supporting symbolic links for database creation in Windows. Signed-off-by: Gurucharan Shetty --- ovsdb/log.c |4 1 file changed, 4 insertions(+) diff --git a/ovsdb/log.c b/ovsdb/log.c index 807b983..48fa847 100644 --- a/ovsdb/log.c +++ b/ovsdb/log.c @@ -91,6 +91,7 @@ ovsdb_log_open(const char *name, enum ovsdb_log_open_mode open_mode, } else if (open_mode == OVSDB_LOG_READ_WRITE) { flags = O_RDWR; } else if (open_mode == OVSDB_LOG_CREATE) { +#ifndef _WIN32 if (stat(name, &s) == -1 && errno == ENOENT && lstat(name, &s) == 0 && S_ISLNK(s.st_mode)) { /* 'name' is a dangling symlink. We want to create the file that @@ -101,6 +102,9 @@ ovsdb_log_open(const char *name, enum ovsdb_log_open_mode open_mode, } else { flags = O_RDWR | O_CREAT | O_EXCL; } +#else +flags = O_RDWR | O_CREAT | O_EXCL; +#endif } else { OVS_NOT_REACHED(); } -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] bfd: Remove unnecessary include of netlink header.
Signed-off-by: Gurucharan Shetty --- lib/bfd.c |1 - 1 file changed, 1 deletion(-) diff --git a/lib/bfd.c b/lib/bfd.c index 5413105..1860cb6 100644 --- a/lib/bfd.c +++ b/lib/bfd.c @@ -30,7 +30,6 @@ #include "hmap.h" #include "list.h" #include "netdev.h" -#include "netlink.h" #include "odp-util.h" #include "ofpbuf.h" #include "ovs-thread.h" -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] ofp-actions: Relax build assertion condition for ofpact_nest struct.
struct ofpact has enums that are packed in case of __GNUC__. This packing does not occur for visual studio. For 'struct ofpact_nest', we are currently expecting that "struct ofpact actions[]" has an offset of 8 bytes. This condition won't be true in compilers where enums are not packed. It is good enough if struct ofpact actions[] starts at an offset which is a multiple of OFPACT_ALIGNTO. Signed-off-by: Gurucharan Shetty --- lib/ofp-actions.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ofp-actions.h b/lib/ofp-actions.h index 0f6bf70..5fd3185 100644 --- a/lib/ofp-actions.h +++ b/lib/ofp-actions.h @@ -439,7 +439,7 @@ struct ofpact_nest { uint8_t pad[OFPACT_ALIGN(sizeof(struct ofpact)) - sizeof(struct ofpact)]; struct ofpact actions[]; }; -BUILD_ASSERT_DECL(offsetof(struct ofpact_nest, actions) == OFPACT_ALIGNTO); +BUILD_ASSERT_DECL(offsetof(struct ofpact_nest, actions) % OFPACT_ALIGNTO == 0); static inline size_t ofpact_nest_get_action_len(const struct ofpact_nest *on) -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] ovsdb: fsync() for Windows.
There is no fsync() in Windows. But there is a _commit() which does the same thing. Signed-off-by: Gurucharan Shetty --- include/windows/unistd.h | 21 + 1 file changed, 21 insertions(+) diff --git a/include/windows/unistd.h b/include/windows/unistd.h index e69de29..0f553bb 100644 --- a/include/windows/unistd.h +++ b/include/windows/unistd.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2014 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _UNISTD_H +#define _UNISTD_H 1 + +#define fsync _commit + +#endif /* unistd.h */ -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] windows/sys: Define sa_family_t for easy compilation.
Signed-off-by: Gurucharan Shetty --- include/windows/sys/socket.h | 22 ++ 1 file changed, 22 insertions(+) diff --git a/include/windows/sys/socket.h b/include/windows/sys/socket.h index e69de29..ab6e822 100644 --- a/include/windows/sys/socket.h +++ b/include/windows/sys/socket.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2014 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __SYS_SOCKET_H +#define __SYS_SOCKET_H 1 + +typedef unsigned short int sa_family_t; + +#endif /* sys/socket.h */ -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] windows/net: Define name size for easy compilation.
I am not yet sure of the network name size limitation on Windows. To move forward with compilation of netdev-vport, have the same limitation as that in Linux. Signed-off-by: Gurucharan Shetty --- include/windows/net/if.h | 23 +++ 1 file changed, 23 insertions(+) diff --git a/include/windows/net/if.h b/include/windows/net/if.h index e69de29..761198c 100644 --- a/include/windows/net/if.h +++ b/include/windows/net/if.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2014 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __NET_IF_H +#define __NET_IF_H 1 + +#define IFNAMSIZ IF_NAMESIZE +#define IF_NAMESIZE 16 + +#endif /* net/if.h */ -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] windows/netinet: Add some #defines needed for Windows.
Signed-off-by: Gurucharan Shetty --- include/windows/netinet/ip.h | 25 + 1 file changed, 25 insertions(+) diff --git a/include/windows/netinet/ip.h b/include/windows/netinet/ip.h index e69de29..f37f476 100644 --- a/include/windows/netinet/ip.h +++ b/include/windows/netinet/ip.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2014 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __NETINET_IP_H +#define __NETINET_IP_H 1 + +#define IPTOS_PREC_INTERNETCONTROL 0xc0 +#define MAXTTL 255 +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 + +#endif /* netinet/ip.h */ -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] BUILD.Windows: Build idl headers separately.
idl headers won't be built, if we build individual executables e..g., "make ovsbd/ovsdb-server.exe". According to http://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html we may have to add the headers as dependecies for every executables. Currently the lack of a ovs-appctl port to Windows prevents us from running just a "make". We plan to get ovs-appctl port done soon. Till then, call out that the idl headers need to be built separately. Signed-off-by: Gurucharan Shetty --- BUILD.Windows |1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.Windows b/BUILD.Windows index c640e28..9bbaa80 100644 --- a/BUILD.Windows +++ b/BUILD.Windows @@ -58,6 +58,7 @@ or from a distribution tar ball. * Run make for the ported executables in the top source directory, e.g.: + % make lib/vswitch-idl.h lib/vtep-idl.h % make utilities/ovs-vsctl.exe ovsdb/ovsdb-server.exe OpenSSL, Open vSwitch and Visual C++ -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] ovs-thread: We don't use fork in Windows.
Signed-off-by: Gurucharan Shetty --- lib/ovs-thread.c |5 + 1 file changed, 5 insertions(+) diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c index 85de014..ed9f83e 100644 --- a/lib/ovs-thread.c +++ b/lib/ovs-thread.c @@ -332,6 +332,7 @@ assert_single_threaded_at(const char *where) pid_t xfork_at(const char *where) { +#ifndef _WIN32 pid_t pid; if (must_not_fork) { @@ -344,6 +345,10 @@ xfork_at(const char *where) VLOG_FATAL("%s: fork failed (%s)", where, ovs_strerror(errno)); } return pid; +#else +VLOG_FATAL("%s: attempted to fork but forking not allowed", where); +return 0; +#endif } /* Notes that the process must not call fork() from now on, for the specified -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] windefs: Add definition for pid_t.
Signed-off-by: Gurucharan Shetty --- include/windows/windefs.h |2 ++ 1 file changed, 2 insertions(+) diff --git a/include/windows/windefs.h b/include/windows/windefs.h index 6d36adc..0a2e064 100644 --- a/include/windows/windefs.h +++ b/include/windows/windefs.h @@ -32,4 +32,6 @@ #define u_int32_t uint32_t #define u_int64_t uint64_t +typedef int pid_t; + #endif /* windefs.h */ -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] automake: Use route-table-stub for Windows.
Signed-off-by: Gurucharan Shetty --- lib/automake.mk |1 + 1 file changed, 1 insertion(+) diff --git a/lib/automake.mk b/lib/automake.mk index c2cfb16..926767c 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -243,6 +243,7 @@ lib_libopenvswitch_la_SOURCES += \ lib/getopt_long.c \ lib/getrusage-windows.c \ lib/latch-windows.c \ + lib/route-table-stub.c \ lib/stream-fd-windows.c else lib_libopenvswitch_la_SOURCES += \ -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] netdev-vport: Don't look for ovs-monitor-ipsec's pid file.
We do not have pidfiles in Windows. And we do not yet have support for ipsec tunnels. This lets us move forward with compilation. Signed-off-by: Gurucharan Shetty --- lib/netdev-vport.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 165c1c6..f52cceb 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -433,6 +433,7 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args) static struct ovs_mutex mutex = OVS_MUTEX_INITIALIZER; static pid_t pid = 0; +#ifndef _WIN32 ovs_mutex_lock(&mutex); if (pid <= 0) { char *file_name = xasprintf("%s/%s", ovs_rundir(), @@ -441,6 +442,7 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args) free(file_name); } ovs_mutex_unlock(&mutex); +#endif if (pid < 0) { VLOG_ERR("%s: IPsec requires the ovs-monitor-ipsec daemon", -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] stream-fd-windows: Fix compilation error.
Signed-off-by: Gurucharan Shetty --- lib/stream-fd-windows.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/stream-fd-windows.c b/lib/stream-fd-windows.c index 7a4a995..db60810 100644 --- a/lib/stream-fd-windows.c +++ b/lib/stream-fd-windows.c @@ -138,7 +138,7 @@ fd_wait(struct stream *stream, enum stream_wait_type wait) break; default: -NOT_REACHED(); +OVS_NOT_REACHED(); } } -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] stdio: fseeko for Windows.
Signed-off-by: Gurucharan Shetty --- lib/stdio.c| 12 lib/stdio.h.in |3 +++ 2 files changed, 15 insertions(+) diff --git a/lib/stdio.c b/lib/stdio.c index 49a5078..5c5c924 100644 --- a/lib/stdio.c +++ b/lib/stdio.c @@ -17,6 +17,7 @@ #include #include +#include #ifdef _WIN32 #undef snprintf @@ -45,4 +46,15 @@ ovs_vsnprintf(char *s, size_t n, const char *format, va_list args) } return needed; } + +int +fseeko(FILE *stream, off_t offset, int whence) +{ +int error; +error = _fseeki64(stream, offset, whence); +if (error) { +return -1; +} +return error; +} #endif /* _WIN32 */ diff --git a/lib/stdio.h.in b/lib/stdio.h.in index 3bf1f03..7adb9ed 100644 --- a/lib/stdio.h.in +++ b/lib/stdio.h.in @@ -23,6 +23,7 @@ #include #include +#include /* Windows libc has defective snprintf() and vsnprintf(): * @@ -38,6 +39,8 @@ int ovs_snprintf(char *, size_t, const char *, ...); #undef vsnprintf #define vsnprintf ovs_vsnprintf int ovs_vsnprintf(char *, size_t, const char *, va_list); + +int fseeko(FILE *stream, off_t offset, int whence); #endif /* _WIN32 */ #endif /* stdio.h wrapper */ -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] .gitignore: Ignore visual studio created files.
Signed-off-by: Gurucharan Shetty --- .gitignore |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d205227..bd87a7f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,12 @@ *.loT *.mod.c *.o -*.o +*.obj +*.exe +*.exp +*.ilk +*.lib +*.pdb *.pyc *.so *~ -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH] timeval: Sleep instead of poll().
The WSAPoll() function, which is similar to poll() doesnot simply sleep when the fd array is NULL. So use Sleep() instead. Signed-off-by: Gurucharan Shetty --- lib/timeval.c |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/timeval.c b/lib/timeval.c index 74efa59..ef806e7 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -637,7 +637,12 @@ timeval_warp_cb(struct unixctl_conn *conn, timespec_add(&monotonic_clock.warp, &monotonic_clock.warp, &ts); ovs_mutex_unlock(&monotonic_clock.mutex); seq_change(timewarp_seq); -poll(NULL, 0, 10); /* give threads (eg. monitor) some chances to run */ +/* give threads (eg. monitor) some chances to run */ +#ifndef _WIN32 +poll(NULL, 0, 10); +#else +Sleep(10); +#endif unixctl_command_reply(conn, "warped"); } -- 1.7.9.5 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH] lib/classifier: Use a prefix tree to optimize ports wildcarding.
Jarno doesn't have that data at the moment, so here's a summary which you can put in the commit message if you'd like. To test this we took real customer ACL tables, and systematically sent every port from 1 to 65k through them to see how many megaflows are generated. If you do nothing, you end up with 65k megaflows. We have one customer who has a pretty typical firewall table, which ends up with ~200 megaflows. And another very extreme customer which ends up with ~3000 megaflows. There are techniques which are better in the sense that they result in fewer megaflows. But the decision tree has the advantage of being O(1), and generating at most 16 mask patterns. Ethan On Tue, Mar 11, 2014 at 10:09 PM, Ben Pfaff wrote: > On Mon, Mar 10, 2014 at 06:49:55PM -0700, Ethan Jackson wrote: >> Yep this is the same thing. I've successfully shown that this >> algorithm is the best for our use case and was intending to implement >> it myself. However, for many rather complicated reasons it became >> important to have a prototype implementation quickly, so Jarno >> graciously offered to pound out the implementation. >> >> On the issue of the algorithm choice. We tried a bunch of things, but >> when we simulated it against some real firewall rule sets, we found >> that the simplest is the best: a decision tree. > > Can we have some kind of quantitative explanation of the benefits in the > commit message? I know from our face-to-face discussions that you have > measured how this reduces the number of megaflows required to cover the > whole port space in various circumstances. ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
Re: [ovs-dev] [PATCH 3/3] learn.at: fix a race in "self-modifying flow with hard_timeout" test
On Wed, Mar 12, 2014 at 07:06:20PM +0900, YAMAMOTO Takashi wrote: > Signed-off-by: YAMAMOTO Takashi All applied. Thank you! ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH v2 0/3] ofproto: Support OF version-specific table-miss behaviours
OpenFlow 1.1 and 1.2 specify that if a table-miss occurs then the default behaviour is to forward the packet the controller using a packet-in message. And until this patch this is the default behaviour that Open vSwitch uses for all OpenFlow versions. OpenFlow1.3+ specifies that if a table-miss occurs then the default behaviour is simply to drop the packet. This patch implements this behaviour using the following logic: If a table-miss occurs and the table-miss behaviour for the table has not been set using a table_mod (in which case it is no longer the default setting) then: * Installing a facet in the datapath with a drop action in the if there are no pre-OF1.3 controllers connected which would receive an packet_in message. Note that this covers both the case where there are only OF1.3 controllers and the case where there are no controllers at all. * Otherwise sent a packet_in message to all pre-OF1.3 controllers. This covers both the case where there are only pre-OF1.3 controllers and there are both pre-OF1.3 and OF1.3+ controllers. Changes since v1 * Add patch to exercise table-miss flows * Do not remove *_is_table_miss * Do not remove table-miss flow packet-in reason fixup * Rebase The last patch in this series depends on "[PATCH v9 repost] ofproto: Honour Table Mod settings for table-miss handling" To aid review this series and its dependency are available in git at https://github.com/horms/openvswitch.git devel/table_miss-v2 Simon Horman (3): ofproto-dpif: Add table-miss flow tests ofproto-dpif: Differentiate between different miss types in packet in ofproto: Support OF version-specific table-miss behaviours OPENFLOW-1.1+ | 7 --- ofproto/connmgr.c | 65 +- ofproto/connmgr.h | 12 +++- ofproto/fail-open.c | 2 +- ofproto/ofproto-dpif-upcall.c | 2 +- ofproto/ofproto-dpif-xlate.c | 23 +++- ofproto/ofproto-dpif.c| 62 +++-- ofproto/ofproto-dpif.h| 9 +++ ofproto/ofproto-provider.h| 3 +- ofproto/ofproto.c | 8 +-- ofproto/ofproto.h | 22 +++- tests/ofproto-dpif.at | 126 +++--- tests/tunnel.at | 2 +- 13 files changed, 297 insertions(+), 46 deletions(-) -- 1.8.5.2 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH v2 1/3] ofproto-dpif: Add table-miss flow tests
Cc: YAMAMOTO Takashi Signed-off-by: Simon Horman -- v2 * First post --- tests/ofproto-dpif.at | 84 +++ 1 file changed, 84 insertions(+) diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index a7da1f7..9081f30 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -1313,6 +1313,90 @@ NXST_FLOW reply: OVS_VSWITCHD_STOP AT_CLEANUP + +AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)]) +OVS_VSWITCHD_START([dnl + add-port br0 p1 -- set Interface p1 type=dummy +]) +ON_EXIT([kill `cat ovs-ofctl.pid`]) + +AT_CAPTURE_FILE([ofctl_monitor.log]) +# A table-miss flow has priority 0 and no match +AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER']) + +dnl Singleton controller action. +AT_CHECK([ovs-ofctl monitor -P openflow10 --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log]) + +for i in 1 2 3 ; do +ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10),tcp_flags(0x002)' +done +OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6]) +ovs-appctl -t ovs-ofctl exit + +AT_CHECK([cat ofctl_monitor.log], [0], [dnl +OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered) +tcp,metadata=0,in_port=0,vlan_tci=0x,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=0x002 tcp_csum:0 +dnl +OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered) +tcp,metadata=0,in_port=0,vlan_tci=0x,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=0x002 tcp_csum:0 +dnl +OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered) +tcp,metadata=0,in_port=0,vlan_tci=0x,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=0x002 tcp_csum:0 +]) + +AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore]) + +AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl + n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535 +NXST_FLOW reply: +]) + +OVS_VSWITCHD_STOP +AT_CLEANUP + + +AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)]) +OVS_VSWITCHD_START([dnl + add-port br0 p1 -- set Interface p1 type=dummy +]) +ON_EXIT([kill `cat ovs-ofctl.pid`]) + +AT_CAPTURE_FILE([ofctl_monitor.log]) +# A table-miss flow has priority 0 and no match +AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER']) + +dnl Singleton controller action. +AT_CHECK([ovs-ofctl monitor -P openflow10 --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log]) + +for i in 1 2 3 ; do +ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=10),tcp_flags(0x002)' +done +OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6]) +ovs-appctl -t ovs-ofctl exit + +AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore]) + +AT_CHECK([cat ofctl_monitor.log], [0], [dnl +OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered) +tcp,metadata=0,in_port=0,vlan_tci=0x,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=0x002 tcp_csum:0 +dnl +OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered) +tcp,metadata=0,in_port=0,vlan_tci=0x,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=0x002 tcp_csum:0 +dnl +OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered) +tcp,metadata=0,in_port=0,vlan_tci=0x,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=0x002 tcp_csum:0 +]) + +AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore]) + +AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl + n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535 +OFPST_FLOW reply (OF1.3): +]) + +OVS_VSWITCHD_STOP +AT_CLEANUP + AT_SETUP([ofproto-dpif - ARP modification slow-path]) OVS_VSWITCHD_START ADD_OF_PORTS([br0], [1], [2]) -- 1.8.5.2 ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
[ovs-dev] [PATCH v2 2/3] ofproto-dpif: Differentiate between different miss types in packet in
Replace the generated_by_table_miss field of struct ofproto_packet_in with a miss_type field. The generated_by_table_miss field allowed packet-in messages generated by table-miss rules to be differentiated. This differentiation is still provided for by miss_type being set to OFPROTO_PACKET_IN_MISS_FLOW. This patch allows further differentiation by setting miss_type to OFPROTO_PACKET_IN_MISS_WITHOUT_FLOW if the packet-in message is generated by a table-miss which is not handled by a table-miss rule. This is in preparation for OpenFlow 1.3 version-specific handling of the default action for such misses. Signed-off-by: Simon Horman -- v2 * First post --- ofproto/connmgr.c | 3 ++- ofproto/connmgr.h | 11 ++- ofproto/fail-open.c | 2 +- ofproto/ofproto-dpif-upcall.c | 2 +- ofproto/ofproto-dpif-xlate.c | 18 -- ofproto/ofproto-dpif.c| 14 ++ ofproto/ofproto-dpif.h| 1 + ofproto/ofproto-provider.h| 1 + 8 files changed, 46 insertions(+), 6 deletions(-) diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index 033ab7d..fc3b84c 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -1534,7 +1534,8 @@ connmgr_send_flow_removed(struct connmgr *mgr, static enum ofp_packet_in_reason wire_reason(struct ofconn *ofconn, const struct ofproto_packet_in *pin) { -if (pin->generated_by_table_miss && pin->up.reason == OFPR_ACTION) { +if (pin->miss_type == OFPROTO_PACKET_IN_MISS_FLOW +&& pin->up.reason == OFPR_ACTION) { enum ofputil_protocol protocol = ofconn_get_protocol(ofconn); if (protocol != OFPUTIL_P_NONE diff --git a/ofproto/connmgr.h b/ofproto/connmgr.h index 3c9216f..90b5856 100644 --- a/ofproto/connmgr.h +++ b/ofproto/connmgr.h @@ -62,6 +62,15 @@ enum ofconn_async_msg_type { OAM_N_TYPES }; +enum ofproto_packet_in_miss_type { +OFPROTO_PACKET_IN_NO_MISS, /* Not a miss */ +OFPROTO_PACKET_IN_MISS_FLOW,/* Miss handled by a table-miss flow + * See OF1.3.3 section 5.4 */ +OFPROTO_PACKET_IN_MISS_WITHOUT_FLOW, +/* Miss was not handled by a table-miss + * flow */ +}; + /* A packet_in, with extra members to assist in queuing and routing it. */ struct ofproto_packet_in { struct ofputil_packet_in up; @@ -72,7 +81,7 @@ struct ofproto_packet_in { /* True if the packet_in was generated directly by a table-miss flow, that * is, a flow with priority 0 that wildcards all fields. (Our * interpretation of "directly" is "not via groups".) */ -bool generated_by_table_miss; +enum ofproto_packet_in_miss_type miss_type; }; /* Basics. */ diff --git a/ofproto/fail-open.c b/ofproto/fail-open.c index 9ac80b6..467cafa 100644 --- a/ofproto/fail-open.c +++ b/ofproto/fail-open.c @@ -130,7 +130,7 @@ send_bogus_packet_ins(struct fail_open *fo) pin.up.reason = OFPR_NO_MATCH; pin.up.fmd.in_port = OFPP_LOCAL; pin.send_len = b.size; -pin.generated_by_table_miss = false; +pin.miss_type = OFPROTO_PACKET_IN_NO_MISS; connmgr_send_packet_in(fo->connmgr, &pin); ofpbuf_uninit(&b); diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index 0d5b251..035fc3f 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -1238,7 +1238,7 @@ handle_upcalls(struct handler *handler, struct list *upcalls) pin->up.cookie = OVS_BE64_MAX; flow_get_metadata(&miss->flow, &pin->up.fmd); pin->send_len = 0; /* Not used for flow table misses. */ -pin->generated_by_table_miss = false; +pin->miss_type = OFPROTO_PACKET_IN_NO_MISS; ofproto_dpif_send_packet_in(miss->ofproto, pin); } } diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index d93e5ca..32baa22 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -2136,8 +2136,22 @@ execute_controller_action(struct xlate_ctx *ctx, int len, pin->controller_id = controller_id; pin->send_len = len; -pin->generated_by_table_miss = (ctx->rule -&& rule_dpif_is_table_miss(ctx->rule)); +/* If a rule is a table-miss rule then this is + * a table-miss handled by a table-miss rule. + * + * Else, if rule is internal and has a controller action, + * the later being implied by the rule being processed here, + * then this is a table-miss handled without a table-miss rule. + * + * Otherwise this is not a table-miss. */ +pin->miss_type = OFPROTO_PACKET_IN_NO_MISS; +if (ctx->rule) { +if (rule_dpif_is_table_miss(ctx->rule)) { +pin->miss_type = OFPROTO_PACKET_IN_MISS_FLOW; +} else if (rule_dpif_is_internal(ctx->rule)) { +pin->miss_type = OFPROTO_PACKET_IN_MISS_WITHOUT_FLOW; +} +} ofproto_
[ovs-dev] [PATCH v2 3/3] ofproto: Support OF version-specific table-miss behaviours
OpenFlow 1.1 and 1.2 specify that if a table-miss occurs then the default behaviour is to forward the packet the controller using a packet-in message. And until this patch this is the default behaviour that Open vSwitch uses for all OpenFlow versions. OpenFlow1.3+ specifies that if a table-miss occurs then the default behaviour is simply to drop the packet. This patch implements this behaviour using the following logic: If a table-miss occurs and the table-miss behaviour for the table has not been set using a table_mod (in which case it is no longer the default setting) then: * Installing a facet in the datapath with a drop action in the if there are no pre-OF1.3 controllers connected which would receive an packet_in message. Note that this covers both the case where there are only OF1.3 controllers and the case where there are no controllers at all. * Otherwise sent a packet_in message to all pre-OF1.3 controllers. This covers both the case where there are only pre-OF1.3 controllers and there are both pre-OF1.3 and OF1.3+ controllers. Signed-off-by: Simon Horman --- * Rebase - Co-exist with wire_reason() - Based on v9 of "ofproto: Honour Table Mod settings for table-miss handling" --- OPENFLOW-1.1+| 7 - ofproto/connmgr.c| 62 +++- ofproto/connmgr.h| 1 + ofproto/ofproto-dpif-xlate.c | 5 ofproto/ofproto-dpif.c | 48 ++ ofproto/ofproto-dpif.h | 8 ++ ofproto/ofproto-provider.h | 2 +- ofproto/ofproto.c| 8 +++--- ofproto/ofproto.h| 22 ++-- tests/ofproto-dpif.at| 42 +- tests/tunnel.at | 2 +- 11 files changed, 167 insertions(+), 40 deletions(-) diff --git a/OPENFLOW-1.1+ b/OPENFLOW-1.1+ index 4363d28..dd505c9 100644 --- a/OPENFLOW-1.1+ +++ b/OPENFLOW-1.1+ @@ -89,13 +89,6 @@ didn't compare the specs carefully yet.) * Add OFPMP_TABLE_FEATURES statistics. Alexander Wu has posted a patch series. [optional for OF1.3+] -* More flexible table miss support. - This requires the following. - - Change the default table-miss action (in the absense of table-miss -entry) from packet_in to drop for OF1.3+. Decide what to do if -a switch is configured to support multiple OF versions. - [required for OF1.3+] - * IPv6 extension header handling support. Fully implementing this requires kernel support. This likely will take some careful and probably time-consuming design work. The actual coding, once diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index fc3b84c..879f4fa 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -1410,6 +1410,65 @@ ofconn_receives_async_msg(const struct ofconn *ofconn, return true; } +/* The default "table-miss" behaviour for OpenFlow1.3+ is to drop the + * packet rather than to send the packet to the controller. + * + * This function returns false to indicate the packet should be dropped if + * the controller action was the result of the default table-miss behaviour + * and the controller is using OpenFlow1.3+. + * + * Otherwise true is returned to indicate the packet should be forwarded to + * the controller */ +static bool +ofconn_wants_packet_in_on_miss(struct ofconn *ofconn, + const struct ofproto_packet_in *pin) +{ +if (pin->miss_type == OFPROTO_PACKET_IN_MISS_WITHOUT_FLOW) { +enum ofputil_protocol protocol = ofconn_get_protocol(ofconn); + +if (protocol != OFPUTIL_P_NONE +&& ofputil_protocol_to_ofp_version(protocol) >= OFP13_VERSION) { +enum ofproto_table_config config; + +config = ofproto_table_get_config(ofconn->connmgr->ofproto, + pin->up.table_id); +if (config == OFPROTO_TABLE_MISS_DEFAULT) { +return false; +} +} +} +return true; +} + +/* The default "table-miss" behaviour for OpenFlow1.3+ is to drop the + * packet rather than to send the packet to the controller. + * + * This function returns false to indicate that a packet_in message + * for a "table-miss" should be sent to at least one controller. + * That is there is at least one controller with controller_id 0 + * which connected using an OpenFlow version earlier than OpenFlow1.3. + * + * False otherwise. + * + * This logic assumes that "table-miss" packet_in messages + * are always sent to controller_id 0. */ +bool +connmgr_wants_packet_in_on_miss(struct connmgr *mgr) +{ +struct ofconn *ofconn; + +LIST_FOR_EACH (ofconn, node, &mgr->all_conns) { +enum ofputil_protocol protocol = ofconn_get_protocol(ofconn); + +if (ofconn->controller_id == 0 && +(protocol == OFPUTIL_P_NONE || + ofputil_protocol_to_ofp_version(protocol) < OFP13_VERSION)) { +return tru