Re: [ovs-dev] [PATCH v2] datapath-windows: update DESIGN document

2014-11-21 Thread Sorin Vinturis
Hi Nithin,

I have only one minor comment. Please see inline.
Other than that, looks good to me.

Acked-by: Sorin Vinturis  

Thanks,
Sorin

-Original Message-
From: dev [mailto:dev-boun...@openvswitch.org] On Behalf Of Nithin Raju
Sent: Friday, 21 November, 2014 02:28
To: dev@openvswitch.org
Subject: [ovs-dev] [PATCH v2] datapath-windows: update DESIGN document

In this patch, we update the design document to reflect the netlink based 
kernel-userspace interface implementation and a few other changes.
I have covered at a high level.

Please feel free to extend the document with more details that you think got 
missed out.

Signed-off-by: Nithin Raju 
---
 datapath-windows/DESIGN |  260 +-
 1 files changed, 164 insertions(+), 96 deletions(-)

diff --git a/datapath-windows/DESIGN b/datapath-windows/DESIGN index 
b438c44..638990d 100644
--- a/datapath-windows/DESIGN
+++ b/datapath-windows/DESIGN
@@ -1,20 +1,13 @@
OVS-on-Hyper-V Design Document
== -There has been an 
effort in the recent past to develop the Open vSwitch (OVS) -solution onto 
multiple hypervisor platforms such as FreeBSD and Microsoft -Hyper-V. VMware 
has been working on a OVS solution for Microsoft Hyper-V for -the past few 
months and has successfully completed the implementation.
-
-This document provides details of the development effort. We believe this 
-document should give enough information to members of the community who are 
-curious about the developments of OVS on Hyper-V. The community should also be 
-able to get enough information to make plans to leverage the deliverables of 
-this effort.
-
-The userspace portion of the OVS has already been ported to Hyper-V and 
-committed to the openvswitch repo. So, this document will mostly emphasize on 
-the kernel driver, though we touch upon some of the aspects of userspace as 
-well.
+There has been a community effort to develop Open vSwitch on Microsoft Hyper-V.
+In this document, we provide details of the development effort. We 
+believe this document should give enough information to understand the overall 
design.
+
+The userspace portion of the OVS has been ported to Hyper-V in a 
+separate effort, and committed to the openvswitch repo. So, this 
+document will mostly emphasize on the kernel driver, though we touch 
+upon some of the aspects of userspace as well.
 
 We cover the following topics:
 1. Background into relevant Hyper-V architecture @@ -48,13 +41,13 @@ In 
Hyper-V, the virtual machine is called the Child Partition. Each VIF or  
physical NIC on the Hyper-V extensible switch is attached via a port. Each port 
 is both on the ingress path or the egress path of the switch. The ingress path 
 is used for packets being sent out of a port, and egress is used for packet 
-being received on a port. By design, NDIS provides a layered interface, where 
-in the ingress path, higher level layers call into lower level layers, and on 
-the egress path, it is the other way round. In addition, there is a object 
-identifier (OID) interface for control operations Eg. addition of a port. The 
-workflow for the calls is similar in nature to the packets, where higher level 
-layers call into the lower level layers. A good representational diagram of 
-this architecture is in [4].
+being received on a port. By design, NDIS provides a layered interface. 
+In this layered interface, higher level layers call into lower level 
+layers, in the ingress path. In the egress path, it is the other way 
+round. In addition, there is a object identifier (OID) interface for 
+control operations Eg. addition of a port. The workflow for the calls 
+is similar in nature to the packets, where higher level layers call 
+into the lower level layers. A good representational diagram of this 
architecture is in [4].
 
 Windows Filtering Platform (WFP)[5] is a platform implemented on Hyper-V that  
provides APIs and services for filtering packets. WFP has been utilized to @@ 
-75,22 +68,23 @@ has been used to retrieve some of the configuration 
information that OVS needs.
   |   |
   +--+ +--+   | +---+  ++ |
   |  | |  |   | |   |  || |
-  | OVS- | | OVS  |   | | Virtual   |  | Virtual| |
-  | wind | |  USERSPACE   |   | | Machine #1|  | Machine #2 | |
-  |  | |  DAEMON/CTL  |   | |   |  || |
+  | ovs- | | OVS- |   | | Virtual   |  | Virtual| |
+  | *ctl | |  USERSPACE   |   | | Machine #1|  | Machine #2 | |
+  |  | |DAEMON|   | |   |  || |
   +--+-++---+-+   | +--+--+-+  ++--++ | ++
-  |  DPIF-  |   | netdev- |   ||VIF #1| |VIF #2|  | |Physical|
-  | Windows |<=>| Windows |   |+-

Re: [ovs-dev] [PATCH] datapath-windows: move vport code from Datapath.c to Vport.c

2014-11-21 Thread Sorin Vinturis
Acked-by: Sorin Vinturis 

-Original Message-
From: dev [mailto:dev-boun...@openvswitch.org] On Behalf Of Nithin Raju
Sent: Friday, 21 November, 2014 02:52
To: dev@openvswitch.org
Subject: [ovs-dev] [PATCH] datapath-windows: move vport code from Datapath.c to 
Vport.c

Plain code motion. No additional cleanup or refactoring peformed.

I'll be doing some code refactoring in subsequent patches.

Signed-off-by: Nithin Raju 
---
 datapath-windows/ovsext/Datapath.c |  750 +---
 datapath-windows/ovsext/Vport.c|  743 +++
 2 files changed, 746 insertions(+), 747 deletions(-)

diff --git a/datapath-windows/ovsext/Datapath.c 
b/datapath-windows/ovsext/Datapath.c
index bdbf72c..d57719e 100644
--- a/datapath-windows/ovsext/Datapath.c
+++ b/datapath-windows/ovsext/Datapath.c
@@ -97,14 +97,14 @@ static NetlinkCmdHandler OvsGetPidCmdHandler,
  OvsReadPacketCmdHandler,
  OvsNewDpCmdHandler,
  OvsGetDpCmdHandler,
- OvsSetDpCmdHandler,
+ OvsSetDpCmdHandler;
+
+NetlinkCmdHandlerOvsGetNetdevCmdHandler,
  OvsGetVportCmdHandler,
  OvsSetVportCmdHandler,
  OvsNewVportCmdHandler,
  OvsDeleteVportCmdHandler;
 
-NetlinkCmdHandlerOvsGetNetdevCmdHandler;
-
 static NTSTATUS HandleGetDpTransaction(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
UINT32 *replyLen);
 static NTSTATUS HandleGetDpDump(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
@@ -1352,750 +1352,6 @@ OvsSetupDumpStart(POVS_USER_PARAMS_CONTEXT usrParamsCtx)
 return InitUserDumpState(instance, msgIn);
 }
 
-static VOID
-BuildMsgOut(POVS_MESSAGE msgIn, POVS_MESSAGE msgOut, UINT16 type,
-UINT32 length, UINT16 flags)
-{
-msgOut->nlMsg.nlmsgType = type;
-msgOut->nlMsg.nlmsgFlags = flags;
-msgOut->nlMsg.nlmsgSeq = msgIn->nlMsg.nlmsgSeq;
-msgOut->nlMsg.nlmsgPid = msgIn->nlMsg.nlmsgPid;
-msgOut->nlMsg.nlmsgLen = length;
-
-msgOut->genlMsg.cmd = msgIn->genlMsg.cmd;
-msgOut->genlMsg.version = msgIn->genlMsg.version;
-msgOut->genlMsg.reserved = 0;
-}
-
-/*
- * XXX: should move out these functions to a Netlink.c or to a OvsMessage.c
- * or even make them inlined functions in Datapath.h. Can be done after the
- * first sprint once we have more code to refactor.
- */
-VOID
-BuildReplyMsgFromMsgIn(POVS_MESSAGE msgIn, POVS_MESSAGE msgOut, UINT16 flags)
-{
-BuildMsgOut(msgIn, msgOut, msgIn->nlMsg.nlmsgType, sizeof(OVS_MESSAGE),
-flags);
-}
-
-VOID
-BuildErrorMsg(POVS_MESSAGE msgIn, POVS_MESSAGE_ERROR msgOut, UINT errorCode)
-{
-BuildMsgOut(msgIn, (POVS_MESSAGE)msgOut, NLMSG_ERROR,
-sizeof(OVS_MESSAGE_ERROR), 0);
-
-msgOut->errorMsg.error = errorCode;
-msgOut->errorMsg.nlMsg = msgIn->nlMsg;
-}
-
-static NTSTATUS
-OvsCreateMsgFromVport(POVS_VPORT_ENTRY vport,
-  POVS_MESSAGE msgIn,
-  PVOID outBuffer,
-  UINT32 outBufLen,
-  int dpIfIndex)
-{
-NL_BUFFER nlBuffer;
-OVS_VPORT_FULL_STATS vportStats;
-BOOLEAN ok;
-OVS_MESSAGE msgOut;
-PNL_MSG_HDR nlMsg;
-
-NlBufInit(&nlBuffer, outBuffer, outBufLen);
-
-BuildReplyMsgFromMsgIn(msgIn, &msgOut, NLM_F_MULTI);
-msgOut.ovsHdr.dp_ifindex = dpIfIndex;
-
-ok = NlMsgPutHead(&nlBuffer, (PCHAR)&msgOut, sizeof msgOut);
-if (!ok) {
-return STATUS_INSUFFICIENT_RESOURCES;
-}
-
-ok = NlMsgPutTailU32(&nlBuffer, OVS_VPORT_ATTR_PORT_NO, vport->portNo);
-if (!ok) {
-return STATUS_INSUFFICIENT_RESOURCES;
-}
-
-ok = NlMsgPutTailU32(&nlBuffer, OVS_VPORT_ATTR_TYPE, vport->ovsType);
-if (!ok) {
-return STATUS_INSUFFICIENT_RESOURCES;
-}
-
-ok = NlMsgPutTailString(&nlBuffer, OVS_VPORT_ATTR_NAME, vport->ovsName);
-if (!ok) {
-return STATUS_INSUFFICIENT_RESOURCES;
-}
-
-/*
- * XXX: when we implement OVS_DP_ATTR_USER_FEATURES in datapath,
- * we'll need to check the OVS_DP_F_VPORT_PIDS flag: if it is set,
- * it means we have an array of pids, instead of a single pid.
- * ATM we assume we have one pid only.
-*/
-
-ok = NlMsgPutTailU32(&nlBuffer, OVS_VPORT_ATTR_UPCALL_PID,
- vport->upcallPid);
-if (!ok) {
-return STATUS_INSUFFICIENT_RESOURCES;
-}
-
-/*stats*/
-vportStats.rxPackets = vport->stats.rxPackets;
-vportStats.rxBytes = vport->stats.rxBytes;
-vportStats.txPackets = vport->stats.txPackets;
-vportStats.txBytes = vport->stats.txBytes;
-vportStats.rxErrors = vport->errStats.rxErrors;
-vportStats.txErrors = vport->errStats.txErrors;
-vportStats.rxDropped = vport->errStats.rxDropped;
-vportStats.txDropped = vport->errStats.txDropped;
-
-ok = NlMsgPutTailUnspec(&

Re: [ovs-dev] [PATCH] ovs-ofctl: Implementation of eviction on the basis of Importance

2014-11-21 Thread Saloni Jain
Hi Ben,

Thank you for reviewing the patch.

>"sparse" reported these warnings:

All the sparse warnings have been resolved

>The config field in a table description is a collection of bit-fields,
>but some of this code, such as ofp_print_table_config() and
>ofputil_append_table_desc_reply(), treats it as if it were a single
>enumeration.  Please change the code to regard it bitwise.

This comment has been incorporated in the new patch.

>Here, in ofp-util.c, please write (void) instead of ():
>   static const struct ovstableprop_map *
>   get_ovsprop_map()
>   {
>However, I don't see any value in the mapping layer between
>OFPTMPEF14_* and OFPUTIL_TABLE_EVICTION_*.  I would drop it and just
>use the OFPTMPEF14_* values directly.

The code has been changed for the same.

>I don't understand the parse_table_property() function.  It doesn't
>seem to parse anything like the description of struct
>ofp_table_mod_prop_eviction from OpenFlow 1.4.  Ditto for
>put_table_mod_eviction_property().

Table description code has been changed in accordance with the mentioned 
comments.

>In ofputil_encode_table_desc_request(), I would use an "if" statement
>to report an error for ofp_version < OFP14_VERSION.  That should cause
>less trouble as we add support for newer OpenFlow versions.

This has been incorporated.

>This commit adds a lot of related code to ofp-util.c, but it spreads
>it around the file.  I would expect that it would all be grouped
>together since it is related.

Related code has been grouped together in ofp-util.c

>Please check the indentation in ofputil_decode_table_desc().  At least
>the "while" statement seems to be mis-indented.

Done.

>ofputil_decode_table_mod() still doesn't understand any properties, so
>I would not remove the comment that mentions that.

Done.

>Please don't comment out code, as done in ofputil_encode_table_mod().

Done.

>I don't see a benefit of having a nested structure inside struct
>ofputil_table_desc.

Code has been changed for the same

>There is a missing space before the { here.   Also it doesn't make sense to 
>mention 0xff here for table_id since it's not a valid value (see the decoding
>function):
>   /* Abstract ofp14_table_desc. */
>   struct ofputil_table_desc{
>        uint8_t table_id;         /* ID of the table, 0xff indicates all 
>tables. */

Done the suggested changes.

>There is no need for this code in handle_table_desc_request() because
>higher-level code has already checked these properties for
>correctness:
>    ofpbuf_use_const(&msg, request, ntohs(request->length));
>   ofpraw_pull_assert(&msg);
>   if (ofpbuf_size(&msg) || ofpmp_more(request)) {
>       return OFPERR_OFPTFFC_EPERM;
>    }

We have rechecked the code, the higher-level code is not performing these 
checks.
Also same checking has been done for handle_table_feature_request()

>One of the lines in rule_eviction_priority() is too long.  Please read
>CodingStyle.md.  Ditto for eviction_group_add_rule().

Done the suggested formatting.

>Please document your new features in ovs-ofctl.8.in and mention it in
>NEWS.

Added the new feature in NEWS, ovs-ofctl.8.in and DESIGN.md files.

We will send the updated patch.

Thanks and Regards,
Saloni
=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] ovs-ofctl: Implementation of eviction on the basis of Importance

2014-11-21 Thread Saloni Jain
undefined
=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] ovs-ofctl: Implementation of eviction on the basis of Importance

2014-11-21 Thread Saloni Jain
undefined
=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] ovs-ofctl: Implementation of eviction on the basis of Importance

2014-11-21 Thread Saloni Jain
Hi Team,

Please ignore previous mail for the patch " [ovs-dev] [PATCH] ovs-ofctl: 
Implementation of eviction on the basis of Importance" containing text 
"undefined".
Due to some mail server problem, the patch was not sent correctly.

We will resend the patch from "rishi.ba...@tcs.com" mail-id.

Thanks and Regards,
Saloni Jain
 Tata Consultancy Services
 Mailto: saloni.j...@tcs.com
 Website: http://www.tcs.com
 
 Experience certainty.  IT Services
Business Solutions
Consulting
 

-"dev"  wrote: -
To: Ben Pfaff , dev@openvswitch.org
From: Saloni Jain 
Sent by: "dev" 
Date: 11/21/2014 03:46PM
Cc: Deepankar Gupta , Partha Datta 

Subject: [ovs-dev] [PATCH] ovs-ofctl: Implementation of eviction on the basis 
of Importance

undefined
=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] ovs-ofctl: Implementation of eviction on the basis of Importance

2014-11-21 Thread Rishi Bamba
From: Saloni Jain 

This commit enables the eviction mechanism on the basis of importance as
per the openflow specification 1.4.

ovs-ofctl -O OpenFlow14 mod-table   evict
-Enable eviction on  of . Eviction adds a mechanism
 enabling the switch to automatically eliminate entries of lower
 importance to make space for newer entries.If want to enable eviction
 on all tables, user can set the  as 'ALL'.

ovs-ofctl -O OpenFlow14 mod-table   noevict
-Disable eviction on  of .

ovs-ofctl -O OpenFlow14 dump-tables-desc 
-This command provides a way to list the current configuration
 (eviction for importance) of the tables on a , which is set
 using the mod-table command.

Signed-off-by: Saloni Jain 
Signed-off-by: Hiteshi Madan 
---
 DESIGN.md                       |   19 ++--
 NEWS                            |    2 +
 include/openflow/openflow-1.4.h |   10 ++
 lib/learning-switch.c           |    2 +
 lib/ofp-msgs.h                  |   10 ++
 lib/ofp-parse.c                 |    4 +
 lib/ofp-print.c                 |   55 +++
 lib/ofp-util.c                  |  192 ++-
 lib/ofp-util.h                  |   39 
 lib/rconn.c                     |    2 +
 ofproto/ofproto-provider.h      |    1 +
 ofproto/ofproto.c               |  146 +++--
 tests/ofproto.at                |  105 +
 utilities/ovs-ofctl.8.in        |   25 -
 utilities/ovs-ofctl.c           |   21 +
 15 files changed, 614 insertions(+), 19 deletions(-)

diff --git a/DESIGN.md b/DESIGN.md
index bd0ed27..9d961e7 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -275,13 +275,18 @@ The table for 1.3 is the same as the one shown above for 
1.2.
 
 
 OpenFlow 1.4
-
-
-OpenFlow 1.4 adds the "importance" field to flow_mods, but it does not
-explicitly specify which kinds of flow_mods set the importance.For
-consistency, Open vSwitch uses the same rule for importance as for
-idle_timeout and hard_timeout, that is, only an "ADD" flow_mod sets
-the importance.  (This issue has been filed with the ONF as EXT-496.)
+---
+OpenFlow 1.4 makes these changes:
+
+  - Adds the "importance" field to flow_mods, but it does not
+    explicitly specify which kinds of flow_mods set the importance.
+    For consistency, Open vSwitch uses the same rule for importance
+    as for idle_timeout and hard_timeout, that is, only an "ADD"
+    flow_mod sets the importance.  (This issue has been filed with
+    the ONF as EXT-496.)
+
+  - Eviction Mechanism to automatically delete entries of lower
+    importance to make space for newer entries.
 
 OFPT_PACKET_IN
 ==
diff --git a/NEWS b/NEWS
index ea8c6c0..6e7e450 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,8 @@ Post-v2.3.0
        is executed last, and only if the action set has no "output" or "group"
        action.
      * OpenFlow 1.4+ flow "importance" is now maintained in the flow table.
+     * OpenFlow 1.4+ table-mod flow eviction on basis of importance and
+       table-description requests are now supported.
    - ovs-pki: Changed message digest algorithm from MD5 to SHA-1 because
      MD5 is no longer secure and some operating systems have started to disable
      it in OpenSSL.
diff --git a/include/openflow/openflow-1.4.h b/include/openflow/openflow-1.4.h
index 7631e47..c1ac227 100644
--- a/include/openflow/openflow-1.4.h
+++ b/include/openflow/openflow-1.4.h
@@ -155,6 +155,16 @@ struct ofp14_table_mod {
 };
 OFP_ASSERT(sizeof(struct ofp14_table_mod) == 8);
 
+/* Body of reply to OFPMP_TABLE_DESC request. */
+struct ofp14_table_desc {
+    ovs_be16 length;       /* Length is padded to 64 bits. */
+    uint8_t table_id;      /* Identifier of table. Lower numbered tables are 
consulted first. */
+    uint8_t pad[1];        /* Align to 32-bits. */
+    ovs_be32 config;   /* Bitmap of OFPTC_* values. */
+    /* Followed by 0 or more OFPTMPT14_* properties. */
+};
+OFP_ASSERT(sizeof(struct ofp14_table_desc) == 8);
+
 
 /* ##  ## */
 /* ## ofp14_port_stats ## */
diff --git a/lib/learning-switch.c b/lib/learning-switch.c
index af72ae1..63c5377 100644
--- a/lib/learning-switch.c
+++ b/lib/learning-switch.c
@@ -439,6 +439,8 @@ lswitch_process_packet(struct lswitch *sw, const struct 
ofpbuf *msg)
     case OFPTYPE_METER_FEATURES_STATS_REPLY:
     case OFPTYPE_TABLE_FEATURES_STATS_REQUEST:
     case OFPTYPE_TABLE_FEATURES_STATS_REPLY:
+    case OFPTYPE_TABLE_DESC_REQUEST:
+    case OFPTYPE_TABLE_DESC_REPLY:
     case OFPTYPE_BUNDLE_CONTROL:
     case OFPTYPE_BUNDLE_ADD_MESSAGE:
     default:
diff --git a/lib/ofp-msgs.h b/lib/ofp-msgs.h
index fc69586..8d380a9 100644
--- a/lib/ofp-msgs.h
+++ b/lib/ofp-msgs.h
@@ -369,6 +369,12 @@ enum ofpraw {
     /* OFPST 1.3+ (12): struct ofp13_table_features, uint8_t[8][]. */
     OFPRAW_OFPST13_TABLE_FEATURES_REPLY,
 
+    /* OFPST 1.4+ (15): void. */
+    OFPRAW_OFPST14_TABLE_DESC_REQUEST,
+
+    /* OFPST 1.4+ (15): struct ofp14_tabl

Re: [ovs-dev] [patch V2] dpif-netdev: Garbage collect the exact match cache periodically.

2014-11-21 Thread Jarno Rajahalme
LGTM,

Acked-by: Jarno Rajahalme 

Thanks,

  Jarno


> On Nov 20, 2014, at 4:37 PM, Alex Wang  wrote:
> 
> On current master, the exact match cache entry can keep reference to
> 'struct dp_netdev_flow' even after the flow is removed from the flow
> table.  This means the free of allocated memory of the flow is delayed
> until the exact match cache entry is cleared or replaced.
> 
> If the allocated memory is ahead of chunks of freed memory on heap,
> the delay will prevent the reclaim of those freed chunks, causing
> falsely high memory utilization.
> 
> To fix the issue, this commit makes the owning thread conduct periodic
> garbage collection on the exact match cache and clear dead entries.
> 
> Signed-off-by: Alex Wang 
> 
> ---
> PATCH -> V2:
> - Adopt Jarno's suggestion and conduct slow sweep to avoid introducing
>  jitter.
> ---
> lib/dpif-netdev.c |   17 +
> 1 file changed, 17 insertions(+)
> 
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index 65df19b..265f497 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -129,6 +129,7 @@ struct emc_entry {
> 
> struct emc_cache {
> struct emc_entry entries[EM_FLOW_HASH_ENTRIES];
> +int sweep_idx;/* For emc_cache_slow_sweep(). */
> };
> 
> /* Iterate in the exact match cache through every entry that might contain a
> @@ -433,6 +434,7 @@ static void dp_netdev_del_pmds_on_numa(struct dp_netdev 
> *dp, int numa_id);
> static void dp_netdev_set_pmds_on_numa(struct dp_netdev *dp, int numa_id);
> static void dp_netdev_reset_pmd_threads(struct dp_netdev *dp);
> 
> +static inline bool emc_entry_alive(struct emc_entry *ce);
> static void emc_clear_entry(struct emc_entry *ce);
> 
> static void
> @@ -442,6 +444,7 @@ emc_cache_init(struct emc_cache *flow_cache)
> 
> BUILD_ASSERT(offsetof(struct miniflow, inline_values) == 
> sizeof(uint64_t));
> 
> +flow_cache->sweep_idx = 0;
> for (i = 0; i < ARRAY_SIZE(flow_cache->entries); i++) {
> flow_cache->entries[i].flow = NULL;
> flow_cache->entries[i].key.hash = 0;
> @@ -462,6 +465,19 @@ emc_cache_uninit(struct emc_cache *flow_cache)
> }
> }
> 
> +/* Check and clear dead flow references slowly (one entry at each
> + * invocation).  */
> +static void
> +emc_cache_slow_sweep(struct emc_cache *flow_cache)
> +{
> +struct emc_entry *entry = &flow_cache->entries[flow_cache->sweep_idx];
> +
> +if (!emc_entry_alive(entry)) {
> +emc_clear_entry(entry);
> +}
> +flow_cache->sweep_idx = (flow_cache->sweep_idx + 1) & EM_FLOW_HASH_MASK;
> +}
> +
> static struct dpif_netdev *
> dpif_netdev_cast(const struct dpif *dpif)
> {
> @@ -2332,6 +2348,7 @@ reload:
> 
> lc = 0;
> 
> +emc_cache_slow_sweep(&pmd->flow_cache);
> ovsrcu_quiesce();
> 
> atomic_read_relaxed(&pmd->change_seq, &seq);
> -- 
> 1.7.9.5
> 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [patch V2] dpif-netdev: Garbage collect the exact match cache periodically.

2014-11-21 Thread Alex Wang
Thx applied to master~

On Fri, Nov 21, 2014 at 7:48 AM, Jarno Rajahalme 
wrote:

> LGTM,
>
> Acked-by: Jarno Rajahalme 
>
> Thanks,
>
>   Jarno
>
>
> > On Nov 20, 2014, at 4:37 PM, Alex Wang  wrote:
> >
> > On current master, the exact match cache entry can keep reference to
> > 'struct dp_netdev_flow' even after the flow is removed from the flow
> > table.  This means the free of allocated memory of the flow is delayed
> > until the exact match cache entry is cleared or replaced.
> >
> > If the allocated memory is ahead of chunks of freed memory on heap,
> > the delay will prevent the reclaim of those freed chunks, causing
> > falsely high memory utilization.
> >
> > To fix the issue, this commit makes the owning thread conduct periodic
> > garbage collection on the exact match cache and clear dead entries.
> >
> > Signed-off-by: Alex Wang 
> >
> > ---
> > PATCH -> V2:
> > - Adopt Jarno's suggestion and conduct slow sweep to avoid introducing
> >  jitter.
> > ---
> > lib/dpif-netdev.c |   17 +
> > 1 file changed, 17 insertions(+)
> >
> > diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> > index 65df19b..265f497 100644
> > --- a/lib/dpif-netdev.c
> > +++ b/lib/dpif-netdev.c
> > @@ -129,6 +129,7 @@ struct emc_entry {
> >
> > struct emc_cache {
> > struct emc_entry entries[EM_FLOW_HASH_ENTRIES];
> > +int sweep_idx;/* For emc_cache_slow_sweep(). */
> > };
> >
> > /* Iterate in the exact match cache through every entry that might
> contain a
> > @@ -433,6 +434,7 @@ static void dp_netdev_del_pmds_on_numa(struct
> dp_netdev *dp, int numa_id);
> > static void dp_netdev_set_pmds_on_numa(struct dp_netdev *dp, int
> numa_id);
> > static void dp_netdev_reset_pmd_threads(struct dp_netdev *dp);
> >
> > +static inline bool emc_entry_alive(struct emc_entry *ce);
> > static void emc_clear_entry(struct emc_entry *ce);
> >
> > static void
> > @@ -442,6 +444,7 @@ emc_cache_init(struct emc_cache *flow_cache)
> >
> > BUILD_ASSERT(offsetof(struct miniflow, inline_values) ==
> sizeof(uint64_t));
> >
> > +flow_cache->sweep_idx = 0;
> > for (i = 0; i < ARRAY_SIZE(flow_cache->entries); i++) {
> > flow_cache->entries[i].flow = NULL;
> > flow_cache->entries[i].key.hash = 0;
> > @@ -462,6 +465,19 @@ emc_cache_uninit(struct emc_cache *flow_cache)
> > }
> > }
> >
> > +/* Check and clear dead flow references slowly (one entry at each
> > + * invocation).  */
> > +static void
> > +emc_cache_slow_sweep(struct emc_cache *flow_cache)
> > +{
> > +struct emc_entry *entry =
> &flow_cache->entries[flow_cache->sweep_idx];
> > +
> > +if (!emc_entry_alive(entry)) {
> > +emc_clear_entry(entry);
> > +}
> > +flow_cache->sweep_idx = (flow_cache->sweep_idx + 1) &
> EM_FLOW_HASH_MASK;
> > +}
> > +
> > static struct dpif_netdev *
> > dpif_netdev_cast(const struct dpif *dpif)
> > {
> > @@ -2332,6 +2348,7 @@ reload:
> >
> > lc = 0;
> >
> > +emc_cache_slow_sweep(&pmd->flow_cache);
> > ovsrcu_quiesce();
> >
> > atomic_read_relaxed(&pmd->change_seq, &seq);
> > --
> > 1.7.9.5
> >
>
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] datapath-windows: Support for hybrid forwarding

2014-11-21 Thread Sorin Vinturis
In a hybrid forwarding environment, there are two types of packets that
enter and leave the Hyper-V extensible switch: NVGRE packets and non-NVGRE
packets. Hybrid forwarding involves filtering the incoming traffic based
on packet type.

Thus, we must split the incoming traffic into NVGRE and non-NVGRE packets.
All non-NVGRE traffic is forwarded by the OVS extension and processed as
usual, and the NVGRE traffic is passed to NDIS to be handled by the HNV
module.

Currently, the OVS extension supports only NDIS 6.30, but hybrid forwarding
involves supporting NDIS 6.40. Thus, I have changed the necessary compiler
settings to reflect this.

More details about hybrid forwarding and the necessary NDIS 6.40 support
is provided in issue #52.

Signed-off-by: Sorin Vinturis 
Reported-by: Nithin Raju 
Reported-at: https://github.com/openvswitch/ovs-issues/issues/52
---
 datapath-windows/ovsext/PacketIO.c | 33 +++--
 datapath-windows/ovsext/ovsext.vcxproj |  6 +++---
 2 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/datapath-windows/ovsext/PacketIO.c 
b/datapath-windows/ovsext/PacketIO.c
index 1af391b..d022c45 100644
--- a/datapath-windows/ovsext/PacketIO.c
+++ b/datapath-windows/ovsext/PacketIO.c
@@ -193,6 +193,10 @@ OvsStartNBLIngress(POVS_SWITCH_CONTEXT switchContext,
 LIST_ENTRY missedPackets;
 UINT32 num = 0;
 OvsCompletionList completionList;
+PNET_BUFFER_LIST extForwardedNbls = NULL;
+PNET_BUFFER_LIST nativeForwardedNbls = NULL;
+PNET_BUFFER_LIST *nextExtForwardNbl = &extForwardedNbls;
+PNET_BUFFER_LIST *nextNativeForwardedNbl = &nativeForwardedNbls;
 
 dispatch = NDIS_TEST_SEND_AT_DISPATCH_LEVEL(SendFlags)?
 NDIS_RWL_AT_DISPATCH_LEVEL : 0;
@@ -201,8 +205,27 @@ OvsStartNBLIngress(POVS_SWITCH_CONTEXT switchContext,
 
 InitializeListHead(&missedPackets);
 OvsInitCompletionList(&completionList, switchContext, sendCompleteFlags);
-
-for (curNbl = netBufferLists; curNbl != NULL; curNbl = nextNbl) {
+
+/*
+ * Split NBL list into NBLs to be forwarded by us, and those that require
+ * native forwarding. */
+for (curNbl = netBufferLists; curNbl != NULL; curNbl = nextNbl) {
+nextNbl = curNbl->Next;
+curNbl->Next = NULL;
+fwdDetail = NET_BUFFER_LIST_SWITCH_FORWARDING_DETAIL(curNbl);
+
+if (fwdDetail->NativeForwardingRequired) {
+*nextNativeForwardedNbl = curNbl;
+nextNativeForwardedNbl = &(curNbl->Next);
+}
+else
+{
+*nextExtForwardNbl = curNbl;
+nextExtForwardNbl = &(curNbl->Next);
+}
+}
+
+for (curNbl = extForwardedNbls; curNbl != NULL; curNbl = nextNbl) {
 POVS_VPORT_ENTRY vport;
 UINT32 portNo;
 OVS_DATAPATH *datapath = &switchContext->datapath;
@@ -315,6 +338,12 @@ dropit:
 }
 }
 
+if (nativeForwardedNbls) {
+/* This is NVGRE encapsulated traffic and is forwarded to NDIS
+ * in order to be handled by the HNV module. */
+OvsSendNBLIngress(switchContext, nativeForwardedNbls, SendFlags);
+}
+
 /* Queue the missed packets. */
 OvsQueuePackets(&missedPackets, num);
 OvsFinalizeCompletionList(&completionList);
diff --git a/datapath-windows/ovsext/ovsext.vcxproj 
b/datapath-windows/ovsext/ovsext.vcxproj
index 88c9122..2a34f5d 100644
--- a/datapath-windows/ovsext/ovsext.vcxproj
+++ b/datapath-windows/ovsext/ovsext.vcxproj
@@ -104,13 +104,13 @@
   
   
 
-  
%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1
+  
%(PreprocessorDefinitions);NDIS_WDM=1;NDIS640=1
 
 
-  
%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1
+  
%(PreprocessorDefinitions);NDIS_WDM=1;NDIS640=1
 
 
-  
%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1
+  
%(PreprocessorDefinitions);NDIS_WDM=1;NDIS640=1
 
   
   
-- 
1.9.0.msysgit.0
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] datapath-windows: Support for hybrid forwarding

2014-11-21 Thread Eitan Eliahu
Hi Sorin,
This change applies only for 6.40 drivers. Unless we bump the driver version 
this code has no effect.
You may want to bump the minor version.

#define NDIS_FILTER_MAJOR_VERSION 6
#define NDIS_FILTER_MINOR_VERSION 30  < 40

driverChars.MajorNdisVersion = NDIS_FILTER_MAJOR_VERSION;
driverChars.MinorNdisVersion = NDIS_FILTER_MINOR_VERSION;

Thanks,
Eitan

-Original Message-
From: dev [mailto:dev-boun...@openvswitch.org] On Behalf Of Sorin Vinturis
Sent: Friday, November 21, 2014 8:16 AM
To: dev@openvswitch.org
Subject: [ovs-dev] [PATCH] datapath-windows: Support for hybrid forwarding

In a hybrid forwarding environment, there are two types of packets that enter 
and leave the Hyper-V extensible switch: NVGRE packets and non-NVGRE packets. 
Hybrid forwarding involves filtering the incoming traffic based on packet type.

Thus, we must split the incoming traffic into NVGRE and non-NVGRE packets.
All non-NVGRE traffic is forwarded by the OVS extension and processed as usual, 
and the NVGRE traffic is passed to NDIS to be handled by the HNV module.

Currently, the OVS extension supports only NDIS 6.30, but hybrid forwarding 
involves supporting NDIS 6.40. Thus, I have changed the necessary compiler 
settings to reflect this.

More details about hybrid forwarding and the necessary NDIS 6.40 support is 
provided in issue #52.

Signed-off-by: Sorin Vinturis 
Reported-by: Nithin Raju 
Reported-at: 
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_openvswitch_ovs-2Dissues_issues_52&d=AAIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=CWsgHUxi6ExLXY798tmo3LJ4e3geGYp56lkcH-5cLCY&m=IF9N0kgUMpt8gOjYSq3_AJkSJSQlF85oyI1sxDSezaE&s=KskXnDJSk-dizBlmk1XJga2EXqtmL6-7g7HTZF0rElo&e=
---
 datapath-windows/ovsext/PacketIO.c | 33 +++--
 datapath-windows/ovsext/ovsext.vcxproj |  6 +++---
 2 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/datapath-windows/ovsext/PacketIO.c 
b/datapath-windows/ovsext/PacketIO.c
index 1af391b..d022c45 100644
--- a/datapath-windows/ovsext/PacketIO.c
+++ b/datapath-windows/ovsext/PacketIO.c
@@ -193,6 +193,10 @@ OvsStartNBLIngress(POVS_SWITCH_CONTEXT switchContext,
 LIST_ENTRY missedPackets;
 UINT32 num = 0;
 OvsCompletionList completionList;
+PNET_BUFFER_LIST extForwardedNbls = NULL;
+PNET_BUFFER_LIST nativeForwardedNbls = NULL;
+PNET_BUFFER_LIST *nextExtForwardNbl = &extForwardedNbls;
+PNET_BUFFER_LIST *nextNativeForwardedNbl = &nativeForwardedNbls;
 
 dispatch = NDIS_TEST_SEND_AT_DISPATCH_LEVEL(SendFlags)?
 NDIS_RWL_AT_DISPATCH_LEVEL : 0; @@ 
-201,8 +205,27 @@ OvsStartNBLIngress(POVS_SWITCH_CONTEXT switchContext,
 
 InitializeListHead(&missedPackets);
 OvsInitCompletionList(&completionList, switchContext, sendCompleteFlags);
-
-for (curNbl = netBufferLists; curNbl != NULL; curNbl = nextNbl) {
+
+/*
+ * Split NBL list into NBLs to be forwarded by us, and those that require
+ * native forwarding. */
+for (curNbl = netBufferLists; curNbl != NULL; curNbl = nextNbl) {
+nextNbl = curNbl->Next;
+curNbl->Next = NULL;
+fwdDetail = NET_BUFFER_LIST_SWITCH_FORWARDING_DETAIL(curNbl);
+
+if (fwdDetail->NativeForwardingRequired) {
+*nextNativeForwardedNbl = curNbl;
+nextNativeForwardedNbl = &(curNbl->Next);
+}
+else
+{
+*nextExtForwardNbl = curNbl;
+nextExtForwardNbl = &(curNbl->Next);
+}
+}
+
+for (curNbl = extForwardedNbls; curNbl != NULL; curNbl = nextNbl) {
 POVS_VPORT_ENTRY vport;
 UINT32 portNo;
 OVS_DATAPATH *datapath = &switchContext->datapath; @@ -315,6 +338,12 
@@ dropit:
 }
 }
 
+if (nativeForwardedNbls) {
+/* This is NVGRE encapsulated traffic and is forwarded to NDIS
+ * in order to be handled by the HNV module. */
+OvsSendNBLIngress(switchContext, nativeForwardedNbls, SendFlags);
+}
+
 /* Queue the missed packets. */
 OvsQueuePackets(&missedPackets, num);
 OvsFinalizeCompletionList(&completionList);
diff --git a/datapath-windows/ovsext/ovsext.vcxproj 
b/datapath-windows/ovsext/ovsext.vcxproj
index 88c9122..2a34f5d 100644
--- a/datapath-windows/ovsext/ovsext.vcxproj
+++ b/datapath-windows/ovsext/ovsext.vcxproj
@@ -104,13 +104,13 @@
   
   
 
-  
%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1
+  
+ %(PreprocessorDefinitions);NDIS_WDM=1;NDIS640
+ =1
 
 
-  
%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1
+  
+ %(PreprocessorDefinitions);NDIS_WDM=1;NDIS640
+ =1
 
 
-  
%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1
+  
+ %(PreprocessorDefinitions);NDIS_WDM=1;NDIS640
+ =1
 
   
   
--
1.9.0.msysgit.0
___
dev mailing list
dev@openvswitch.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__openvswitch.org_mailman_lis

Re: [ovs-dev] [PATCH] cmap: Shrink cmap when load factor is below 20%.

2014-11-21 Thread Ben Pfaff
On Thu, Nov 20, 2014 at 10:11:46PM -0800, Alex Wang wrote:
> This commit adds check in cmap_remove() and shrinks the cmap by half
> if the load factor is below 20%.  This is to reduce the memory
> utilization of cmap and to avoid the allocated cmap memory occupying
> the top of heap memory, preventing the trim of heap.
> 
> Signed-off-by: Alex Wang 

Acked-by: Ben Pfaff 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] datapath-windows: do not complete an IRP when pending status returned

2014-11-21 Thread Eitan Eliahu
The driver completes a pending IRP, the IRP is being marked free by the
I/O manager which causes a system crash when the IRP is completed at
the second time.
The driver should not complete a pending IRP in the context of the
Device I/O control thread.

*** Fatal System Error: 0x0044
   
(0xFA800CF897D0,0x0F7A,0x,0x)

Break instruction exception - code 8003 (first chance)

BugCheck 44, {fa800cf897d0, f7a, 0, 0}

Probably caused by : OVSExt.sys ( OVSExt!OvsCompleteIrpRequest+3a )

Followup: MachineOwner
-

nt!DbgBreakPointWithStatus:
f800`5a100930 cc  int 3
11: kd> !analyze -v
***
* *
*Bugcheck Analysis*
* *
***

MULTIPLE_IRP_COMPLETE_REQUESTS (44)
A driver has requested that an IRP be completed (IoCompleteRequest()), but
the packet has already been completed.  This is a tough bug to find because
the easiest case, a driver actually attempted to complete its own packet
twice, is generally not what happened.  Rather, two separate drivers each
believe that they own the packet, and each attempts to complete it.  The
first actually works, and the second fails.  Tracking down which drivers
in the system actually did this is difficult, generally because the trails
of the first driver have been covered by the second.  However, the driver
stack for the current request can be found by examining the DeviceObject
fields in each of the stack locations.
Arguments:
Arg1: fa800cf897d0, Address of the IRP
Arg2: 0f7a
Arg3: 
Arg4: 

Signed-off-by: Eitan Eliahu 
---
 datapath-windows/ovsext/Datapath.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/datapath-windows/ovsext/Datapath.c 
b/datapath-windows/ovsext/Datapath.c
index b67ba44..b9d97f8 100644
--- a/datapath-windows/ovsext/Datapath.c
+++ b/datapath-windows/ovsext/Datapath.c
@@ -858,6 +858,11 @@ OvsDeviceControl(PDEVICE_OBJECT deviceObject,
 done:
 KeMemoryBarrier();
 instance->inUse = 0;
+
+/* Should not complete a pending IRP unless proceesing is completed */
+if (status == STATUS_PENDING) {
+return status;
+}
 return OvsCompleteIrpRequest(irp, (ULONG_PTR)replyLen, status);
 }
 
-- 
1.9.4.msysgit.0

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] datapath-windows: Support for hybrid forwarding

2014-11-21 Thread Nithin Raju
On Nov 21, 2014, at 8:23 AM, Eitan Eliahu 
 wrote:

> Hi Sorin,
> This change applies only for 6.40 drivers. Unless we bump the driver version 
> this code has no effect.
> You may want to bump the minor version.
> 
> #define NDIS_FILTER_MAJOR_VERSION 6
> #define NDIS_FILTER_MINOR_VERSION 30  < 40
> 
>driverChars.MajorNdisVersion = NDIS_FILTER_MAJOR_VERSION;
>driverChars.MinorNdisVersion = NDIS_FILTER_MINOR_VERSION;

+1 to that.

Also, we should use the following macro around the new code being added. Also, 
when we bump up the version, we should use the macro.
#if (NDIS_SUPPORT_NDIS640)

#endif

Thanks for the patch Sorin! I'll review it once the macros are added to make 
the code conditional.

-- Nithin
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] usermode-windows: Set the socket pid number in the NL message

2014-11-21 Thread Eitan Eliahu
The pid must be set in the NL header as the driver checks it against the pid in
the instance paired with the socket.

Signed-off-by: Eitan Eliahu 
---
 lib/netlink-socket.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index d46c831..2e02c43 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -1202,6 +1202,7 @@ pend_io_request(struct nl_sock *sock)
   OVS_CTRL_CMD_WIN_PEND_REQ, OVS_WIN_CONTROL_VERSION);
 nlmsg = nl_msg_nlmsghdr(&request);
 nlmsg->nlmsg_seq = seq;
+nlmsg->nlmsg_pid = sock->pid;
 
 ovs_header = ofpbuf_put_uninit(&request, sizeof *ovs_header);
 ovs_header->dp_ifindex = 0;
-- 
1.9.4.msysgit.0

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCHv10 ovs 12/15] datapath: Add support for unique flow identifiers.

2014-11-21 Thread Pravin Shelar
On Thu, Nov 20, 2014 at 4:33 PM, Joe Stringer  wrote:
> On 19 November 2014 15:34, Pravin Shelar  wrote:
>> On Thu, Nov 13, 2014 at 11:17 AM, Joe Stringer  
>> wrote:
>>> @@ -684,33 +691,43 @@ static size_t ovs_flow_cmd_msg_size(const struct 
>>> sw_flow_actions *acts)
>>>
>>>  /* Called with ovs_mutex or RCU read lock. */
>>>  static int ovs_flow_cmd_fill_match(const struct sw_flow *flow,
>>> -  struct sk_buff *skb)
>>> +  struct sk_buff *skb, u32 ufid_flags)
>>>  {
>>> struct nlattr *nla;
>>> int err;
>>>
>>> -   /* Fill flow key. */
>>> -   nla = nla_nest_start(skb, OVS_FLOW_ATTR_KEY);
>>> -   if (!nla)
>>> -   return -EMSGSIZE;
>>> -
>>> -   err = ovs_nla_put_flow(&flow->unmasked_key, &flow->unmasked_key, 
>>> skb,
>>> -  false);
>>> -   if (err)
>>> -   return err;
>>> -
>>> -   nla_nest_end(skb, nla);
>>> +   /* Fill flow key. If userspace didn't specify a UFID, then ignore 
>>> the
>>> +* OMIT_KEY flag. */
>>> +   if (!(ufid_flags & OVS_UFID_F_OMIT_KEY) ||
>>> +   !flow->index_by_ufid) {
>>
>> I am not sure about this check, userspace needs to send atleast ufid
>> or the unmasked key as id for flow. otherwise we shld flag error. Here
>> we can serialize flow->key.
>> There could be another function which takes care of flow-id
>> serialization where we serialize use ufid or unmasked key as flow id.
>> Lets group ufid and unmasked key together rather than masked key and
>> unmasked key which are not related.
>
> Let me start from scratch and see if this is what you're saying.
>
> fill_id() would serialize the UFID or unmasked key if UFID is not available.
> fill_key() would serialize the masked key if !(ufid_flags &
> OVS_UFID_F_OMIT_KEY) and UFID was provided (but not when the UFID is
> missing).
> fill_mask() would serialize the mask if !(ufid_flags & OVS_UFID_F_OMIT_MASK).
>
> I see key and id as related, because the flow_key serves as both the
> "match" and the "id" in the non-ufid case, so we need to know the same
> piece of information in both functions to ensure we don't serialize
> the key twice.

Lets follow new model where ID and key are two separate attributes. I
agree we also need to check for ufid in key serialization function to
handle compatibility code. Keeping masked and unmasked key separate is
easier to understand.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] usermode-windows: Set the socket pid number in the NL message

2014-11-21 Thread Nithin Raju
On Nov 21, 2014, at 5:34 PM, Eitan Eliahu 
 wrote:

> The pid must be set in the NL header as the driver checks it against the pid 
> in
> the instance paired with the socket.
> 
> Signed-off-by: Eitan Eliahu 

Acked-by: Nithin Raju 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCHv10 ovs 03/15] datapath: Add 'is_mask' to ovs_nla_put_flow().

2014-11-21 Thread Pravin Shelar
On Thu, Nov 20, 2014 at 4:15 PM, Joe Stringer  wrote:
> On 13 November 2014 11:17, Joe Stringer  wrote:
>> This function previously hid the 'is_mask' parameter from the callers,
>> which actually have better knowledge about whether it is serializing a
>> mask or not. Expose this parameter to the callers. This allows the same
>> function to be called to serialize masked keys as well as masked keys.
>>
>> To serialize an unmasked key:
>> ovs_nla_put_flow(key, key, skb, false);
>>
>> To serialize a masked key:
>> ovs_nla_put_flow(mask, key, skb, false);
>>
>> To serialize a mask:
>> ovs_nla_put_flow(key, mask, skb, true);
>
> I'll add helpers for each of these functions:
> ovs_nla_put_{un,}masked_key(), ovs_nla_put_mask() in the next version.

sounds good to me.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] datapath-windows: do not complete an IRP when pending status returned

2014-11-21 Thread Nithin Raju
On Nov 21, 2014, at 4:58 PM, Eitan Eliahu 
 wrote:
> +/* Should not complete a pending IRP unless proceesing is completed */
> +if (status == STATUS_PENDING) {
> +return status;
> +}
> return OvsCompleteIrpRequest(irp, (ULONG_PTR)replyLen, status);
> }


Acked-by: Nithin Raju 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] xen.spec: Fix xenserver build failure.

2014-11-21 Thread Alex Wang
This commit conducts similar operations as commit 2fd84d5e5
(rhel: Include pkgconfig and update header install in
Fedora/RHEL spec.) to xenserver spec file to prevent the
following rpmbuild failure.

  RPM build errors:
   Installed (but unpackaged) file(s) found:
   /usr/include/openflow/nicira-ext.h
   /usr/include/openflow/openflow-1.0.h
   /usr/include/openflow/openflow-1.1.h
   /usr/include/openflow/openflow-1.2.h
   /usr/include/openflow/openflow-1.3.h
   /usr/include/openflow/openflow-1.4.h
   /usr/include/openflow/openflow-1.5.h
   /usr/include/openflow/openflow-common.h
   /usr/include/openflow/openflow.h
   /usr/include/openvswitch/types.h
   /usr/lib/pkgconfig/libofproto.pc
   /usr/lib/pkgconfig/libopenvswitch.pc
   /usr/lib/pkgconfig/libovsdb.pc
   /usr/lib/pkgconfig/libsflow.pc

VMware-BZ: #1362092

Reported-by: Edwin Chiu 
Signed-off-by: Alex Wang 
---
 xenserver/openvswitch-xen.spec.in |2 ++
 1 file changed, 2 insertions(+)

diff --git a/xenserver/openvswitch-xen.spec.in 
b/xenserver/openvswitch-xen.spec.in
index 364277f..31ff1bf 100644
--- a/xenserver/openvswitch-xen.spec.in
+++ b/xenserver/openvswitch-xen.spec.in
@@ -139,6 +139,8 @@ rm \
 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-pki.8 \
 $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8
 (cd "$RPM_BUILD_ROOT" && rm -f usr/lib/lib*)
+(cd "$RPM_BUILD_ROOT" && rm -rf usr/include)
+(cd "$RPM_BUILD_ROOT" && rm -rf usr/lib/pkgconfig)
 
 install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
 
-- 
1.7.9.5

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v2] datapath-windows: update DESIGN document

2014-11-21 Thread Nithin Raju
On Nov 21, 2014, at 1:07 AM, Sorin Vinturis  
wrote:

> Hi Nithin,
> 
> I have only one minor comment. Please see inline.
> Other than that, looks good to me.
> 
> Acked-by: Sorin Vinturis  

Thanks again for your patient review. I've sent out a v3.

Thanks,
-- Nithin
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] cmap: Shrink cmap when load factor is below 20%.

2014-11-21 Thread Alex Wang
Thx!, applied to master,

On Fri, Nov 21, 2014 at 8:36 AM, Ben Pfaff  wrote:

> On Thu, Nov 20, 2014 at 10:11:46PM -0800, Alex Wang wrote:
> > This commit adds check in cmap_remove() and shrinks the cmap by half
> > if the load factor is below 20%.  This is to reduce the memory
> > utilization of cmap and to avoid the allocated cmap memory occupying
> > the top of heap memory, preventing the trim of heap.
> >
> > Signed-off-by: Alex Wang 
>
> Acked-by: Ben Pfaff 
>
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] xen.spec: Fix xenserver build failure.

2014-11-21 Thread Gurucharan Shetty
On Fri, Nov 21, 2014 at 11:06 AM, Alex Wang  wrote:
> This commit conducts similar operations as commit 2fd84d5e5
> (rhel: Include pkgconfig and update header install in
> Fedora/RHEL spec.) to xenserver spec file to prevent the
> following rpmbuild failure.
>
>   RPM build errors:
>Installed (but unpackaged) file(s) found:
>/usr/include/openflow/nicira-ext.h
>/usr/include/openflow/openflow-1.0.h
>/usr/include/openflow/openflow-1.1.h
>/usr/include/openflow/openflow-1.2.h
>/usr/include/openflow/openflow-1.3.h
>/usr/include/openflow/openflow-1.4.h
>/usr/include/openflow/openflow-1.5.h
>/usr/include/openflow/openflow-common.h
>/usr/include/openflow/openflow.h
>/usr/include/openvswitch/types.h
>/usr/lib/pkgconfig/libofproto.pc
>/usr/lib/pkgconfig/libopenvswitch.pc
>/usr/lib/pkgconfig/libovsdb.pc
>/usr/lib/pkgconfig/libsflow.pc
>
> VMware-BZ: #1362092
>
> Reported-by: Edwin Chiu 
> Signed-off-by: Alex Wang 

I did not test the fix. But looks correct.
Acked-by: Gurucharan Shetty 
> ---
>  xenserver/openvswitch-xen.spec.in |2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/xenserver/openvswitch-xen.spec.in 
> b/xenserver/openvswitch-xen.spec.in
> index 364277f..31ff1bf 100644
> --- a/xenserver/openvswitch-xen.spec.in
> +++ b/xenserver/openvswitch-xen.spec.in
> @@ -139,6 +139,8 @@ rm \
>  $RPM_BUILD_ROOT/usr/share/man/man8/ovs-pki.8 \
>  $RPM_BUILD_ROOT/usr/share/man/man8/ovs-test.8
>  (cd "$RPM_BUILD_ROOT" && rm -f usr/lib/lib*)
> +(cd "$RPM_BUILD_ROOT" && rm -rf usr/include)
> +(cd "$RPM_BUILD_ROOT" && rm -rf usr/lib/pkgconfig)
>
>  install -d -m 755 $RPM_BUILD_ROOT/var/lib/openvswitch
>
> --
> 1.7.9.5
>
> ___
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] xen.spec: Fix xenserver build failure.

2014-11-21 Thread Alex Wang
On Fri, Nov 21, 2014 at 11:10 AM, Gurucharan Shetty 
wrote:

> Acked-by: Gurucharan Shetty 
>

Thx for the review,

I have tested it,
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH 1/2] ofproto-dpif: add test case for OF1.4 packet-in

2014-11-21 Thread Shu Shen
The test case current fails and shows a bug when OF1.4 is used between
the controller and the switch, the packet-in message still uses OF1.3
wire protocol version.

Signed-off-by: Shu Shen 
---
 tests/ofproto-dpif.at | 44 
 1 file changed, 44 insertions(+)

diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index 5349386..d2d089b 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -2652,6 +2652,50 @@ OFPST_FLOW reply (OF1.3):
 OVS_VSWITCHD_STOP
 AT_CLEANUP
 
+
+AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
+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=OpenFlow14 add-flow br0 'priority=0 
actions=output:CONTROLLER'])
+
+dnl Singleton controller action.
+AT_CHECK([ovs-ofctl monitor -P openflow10 --protocols=OpenFlow14 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.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via 
no_match) data_len=60 (unbuffered)
+tcp,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=syn
 tcp_csum:0
+dnl
+OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via 
no_match) data_len=60 (unbuffered)
+tcp,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=syn
 tcp_csum:0
+dnl
+OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via 
no_match) data_len=60 (unbuffered)
+tcp,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=syn
 tcp_csum:0
+])
+
+AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
+
+AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | 
sort], [0], [dnl
+ n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
+OFPST_FLOW reply (OF1.4):
+])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
+
 AT_SETUP([ofproto-dpif - ARP modification slow-path])
 OVS_VSWITCHD_START
 ADD_OF_PORTS([br0], [1], [2])
-- 
1.9.1

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH 2/2] ofproto-dpif: fix OF1.4 packet-in wire protocol version

2014-11-21 Thread Shu Shen
Previously even when OF1.4 is used between the controller and the
switch, packet-in messages has OF1.3 as wire protocol version.

Signed-off-by: Shu Shen 
---
 lib/ofp-msgs.h | 2 +-
 lib/ofp-util.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/ofp-msgs.h b/lib/ofp-msgs.h
index fc69586..ad6dc6f 100644
--- a/lib/ofp-msgs.h
+++ b/lib/ofp-msgs.h
@@ -148,7 +148,7 @@ enum ofpraw {
 OFPRAW_OFPT11_PACKET_IN,
 /* OFPT 1.2 (10): struct ofp12_packet_in, uint8_t[]. */
 OFPRAW_OFPT12_PACKET_IN,
-/* OFPT 1.3 (10): struct ofp13_packet_in, uint8_t[]. */
+/* OFPT 1.3+ (10): struct ofp13_packet_in, uint8_t[]. */
 OFPRAW_OFPT13_PACKET_IN,
 /* NXT 1.0+ (17): struct nx_packet_in, uint8_t[]. */
 OFPRAW_NXT_PACKET_IN,
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 94047fa..86cf8a1 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -3527,7 +3527,7 @@ ofputil_encode_ofp12_packet_in(const struct 
ofputil_packet_in *pin,
 packet_in_size = sizeof (struct ofp12_packet_in);
 } else {
 packet_in_raw = OFPRAW_OFPT13_PACKET_IN;
-packet_in_version = OFP13_VERSION;
+packet_in_version = ofputil_protocol_to_ofp_version(protocol);
 packet_in_size = sizeof (struct ofp13_packet_in);
 }
 
@@ -3547,7 +3547,7 @@ ofputil_encode_ofp12_packet_in(const struct 
ofputil_packet_in *pin,
 opi->pi.total_len = htons(pin->total_len);
 opi->pi.reason = pin->reason;
 opi->pi.table_id = pin->table_id;
-if (protocol == OFPUTIL_P_OF13_OXM) {
+if (protocol & OFPUTIL_P_OF13_UP) {
 opi->cookie = pin->cookie;
 }
 
-- 
1.9.1

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCHv3 net] openvswitch: Don't validate IPv6 label masks.

2014-11-21 Thread David Miller
From: Joe Stringer 
Date: Wed, 19 Nov 2014 13:54:49 -0800

> When userspace doesn't provide a mask, OVS datapath generates a fully
> unwildcarded mask for the flow by copying the flow and setting all bits
> in all fields. For IPv6 label, this creates a mask that matches on the
> upper 12 bits, causing the following error:
> 
> openvswitch: netlink: Invalid IPv6 flow label value (value=, 
> max=f)
> 
> This patch ignores the label validation check for masks, avoiding this
> error.
> 
> Signed-off-by: Joe Stringer 
> ---
> v3: Alternative approach.
> Was "openvswitch: Fix mask generation for IPv6 labels."
> v2: OR lower 20 bits (upper 12 bits remain from earlier memdup)

Applied.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCHv10 ovs 01/15] tests: Add command to purge revalidators of flows.

2014-11-21 Thread Joe Stringer
Jarno, do you have time to look at this?

On 13 November 2014 11:17, Joe Stringer  wrote:
> This patch adds a new 'ovs-appctl revalidator/purge' command which
> flushes all flows from all datapaths, and updates the revalidator
> udpif_key cache at the same time.
>
> Update the ofproto-dpif fragment tests which may fail when ukeys are
> created from handler threads.
>
> Signed-off-by: Joe Stringer 
> CC: Jarno Rajahalme 
> ---
> v10: First post.
> ---
>  ofproto/ofproto-dpif-upcall.c |   20 
>  tests/ofproto-dpif.at |8 
>  2 files changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
> index 1f9c484..eba9816 100644
> --- a/ofproto/ofproto-dpif-upcall.c
> +++ b/ofproto/ofproto-dpif-upcall.c
> @@ -234,6 +234,8 @@ static void upcall_unixctl_set_flow_limit(struct 
> unixctl_conn *conn, int argc,
>  const char *argv[], void *aux);
>  static void upcall_unixctl_dump_wait(struct unixctl_conn *conn, int argc,
>   const char *argv[], void *aux);
> +static void upcall_unixctl_purge(struct unixctl_conn *conn, int argc,
> + const char *argv[], void *aux);
>
>  static struct udpif_key *ukey_create(const struct nlattr *key, size_t 
> key_len,
>   long long int used);
> @@ -273,6 +275,8 @@ udpif_create(struct dpif_backer *backer, struct dpif 
> *dpif)
>   upcall_unixctl_set_flow_limit, NULL);
>  unixctl_command_register("revalidator/wait", "", 0, 0,
>   upcall_unixctl_dump_wait, NULL);
> +unixctl_command_register("revalidator/purge", "", 0, 0,
> + upcall_unixctl_purge, NULL);
>  ovsthread_once_done(&once);
>  }
>
> @@ -1768,3 +1772,19 @@ upcall_unixctl_dump_wait(struct unixctl_conn *conn,
>  unixctl_command_reply_error(conn, "can't wait on multiple udpifs.");
>  }
>  }
> +
> +static void
> +upcall_unixctl_purge(struct unixctl_conn *conn, int argc OVS_UNUSED,
> + const char *argv[] OVS_UNUSED, void *aux OVS_UNUSED)
> +{
> +struct udpif *udpif;
> +
> +LIST_FOR_EACH (udpif, list_node, &all_udpifs) {
> +int n;
> +
> +for (n = 0; n < udpif->n_revalidators; n++) {
> +revalidator_purge(&udpif->revalidators[n]);
> +}
> +}
> +unixctl_command_reply(conn, "");
> +}
> diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
> index 5349386..eb4d4cb 100644
> --- a/tests/ofproto-dpif.at
> +++ b/tests/ofproto-dpif.at
> @@ -3410,7 +3410,7 @@ 
> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), 
> packets:0, b
>
>  mode=drop
>
> -AT_CHECK([ovs-appctl dpctl/del-flows], [0])
> +AT_CHECK([ovs-appctl revalidator/purge], [0])
>  AT_CHECK([ovs-ofctl set-frags br0 $mode])
>  for type in no first later; do
>eval flow=\$${type}_flow
> @@ -3427,7 +3427,7 @@ 
> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=later), packets:0, 
> bytes:0,
>
>  mode=nx-match
>
> -AT_CHECK([ovs-appctl dpctl/del-flows], [0])
> +AT_CHECK([ovs-appctl revalidator/purge], [0])
>  AT_CHECK([ovs-ofctl set-frags br0 $mode])
>  for type in no first later; do
>eval flow=\$${type}_flow
> @@ -3513,7 +3513,7 @@ 
> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=33419
>  recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), 
> packets:1, bytes:74, used:0.001s, actions:1
>  ])
>
> -AT_CHECK([ovs-appctl dpctl/del-flows], [0])
> +AT_CHECK([ovs-appctl revalidator/purge], [0])
>  AT_CHECK([ovs-ofctl set-frags br0 $mode])
>  for frag in 4000 6000 6008 4010; do
>printf "\n%s\n" "$mode $frag truncated transport header -"
> @@ -3527,7 +3527,7 @@ 
> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0),
>  p
>  recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), 
> packets:1, bytes:60, used:0.001s, actions:1
>  ])
>
> -AT_CHECK([ovs-appctl dpctl/del-flows], [0])
> +AT_CHECK([ovs-appctl revalidator/purge], [0])
>  AT_CHECK([ovs-ofctl set-frags br0 $mode])
>  for frag in 4000 6000 6001 4002; do
>printf "\n%s\n" "$mode $frag missing transport header-"
> --
> 1.7.10.4
>
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCHv10 ovs 01/15] tests: Add command to purge revalidators of flows.

2014-11-21 Thread Jarno Rajahalme
Looks good to me,

  Jarno

Acked-by: Jarno Rajahalme 

> On Nov 21, 2014, at 12:52 PM, Joe Stringer  wrote:
> 
> Jarno, do you have time to look at this?
> 
>> On 13 November 2014 11:17, Joe Stringer  wrote:
>> This patch adds a new 'ovs-appctl revalidator/purge' command which
>> flushes all flows from all datapaths, and updates the revalidator
>> udpif_key cache at the same time.
>> 
>> Update the ofproto-dpif fragment tests which may fail when ukeys are
>> created from handler threads.
>> 
>> Signed-off-by: Joe Stringer 
>> CC: Jarno Rajahalme 
>> ---
>> v10: First post.
>> ---
>> ofproto/ofproto-dpif-upcall.c |   20 
>> tests/ofproto-dpif.at |8 
>> 2 files changed, 24 insertions(+), 4 deletions(-)
>> 
>> diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
>> index 1f9c484..eba9816 100644
>> --- a/ofproto/ofproto-dpif-upcall.c
>> +++ b/ofproto/ofproto-dpif-upcall.c
>> @@ -234,6 +234,8 @@ static void upcall_unixctl_set_flow_limit(struct 
>> unixctl_conn *conn, int argc,
>> const char *argv[], void *aux);
>> static void upcall_unixctl_dump_wait(struct unixctl_conn *conn, int argc,
>>  const char *argv[], void *aux);
>> +static void upcall_unixctl_purge(struct unixctl_conn *conn, int argc,
>> + const char *argv[], void *aux);
>> 
>> static struct udpif_key *ukey_create(const struct nlattr *key, size_t 
>> key_len,
>>  long long int used);
>> @@ -273,6 +275,8 @@ udpif_create(struct dpif_backer *backer, struct dpif 
>> *dpif)
>>  upcall_unixctl_set_flow_limit, NULL);
>> unixctl_command_register("revalidator/wait", "", 0, 0,
>>  upcall_unixctl_dump_wait, NULL);
>> +unixctl_command_register("revalidator/purge", "", 0, 0,
>> + upcall_unixctl_purge, NULL);
>> ovsthread_once_done(&once);
>> }
>> 
>> @@ -1768,3 +1772,19 @@ upcall_unixctl_dump_wait(struct unixctl_conn *conn,
>> unixctl_command_reply_error(conn, "can't wait on multiple udpifs.");
>> }
>> }
>> +
>> +static void
>> +upcall_unixctl_purge(struct unixctl_conn *conn, int argc OVS_UNUSED,
>> + const char *argv[] OVS_UNUSED, void *aux OVS_UNUSED)
>> +{
>> +struct udpif *udpif;
>> +
>> +LIST_FOR_EACH (udpif, list_node, &all_udpifs) {
>> +int n;
>> +
>> +for (n = 0; n < udpif->n_revalidators; n++) {
>> +revalidator_purge(&udpif->revalidators[n]);
>> +}
>> +}
>> +unixctl_command_reply(conn, "");
>> +}
>> diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
>> index 5349386..eb4d4cb 100644
>> --- a/tests/ofproto-dpif.at
>> +++ b/tests/ofproto-dpif.at
>> @@ -3410,7 +3410,7 @@ 
>> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), 
>> packets:0, b
>> 
>> mode=drop
>> 
>> -AT_CHECK([ovs-appctl dpctl/del-flows], [0])
>> +AT_CHECK([ovs-appctl revalidator/purge], [0])
>> AT_CHECK([ovs-ofctl set-frags br0 $mode])
>> for type in no first later; do
>>   eval flow=\$${type}_flow
>> @@ -3427,7 +3427,7 @@ 
>> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=later), packets:0, 
>> bytes:0,
>> 
>> mode=nx-match
>> 
>> -AT_CHECK([ovs-appctl dpctl/del-flows], [0])
>> +AT_CHECK([ovs-appctl revalidator/purge], [0])
>> AT_CHECK([ovs-ofctl set-frags br0 $mode])
>> for type in no first later; do
>>   eval flow=\$${type}_flow
>> @@ -3513,7 +3513,7 @@ 
>> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=33419
>> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), 
>> packets:1, bytes:74, used:0.001s, actions:1
>> ])
>> 
>> -AT_CHECK([ovs-appctl dpctl/del-flows], [0])
>> +AT_CHECK([ovs-appctl revalidator/purge], [0])
>> AT_CHECK([ovs-ofctl set-frags br0 $mode])
>> for frag in 4000 6000 6008 4010; do
>>   printf "\n%s\n" "$mode $frag truncated transport header -"
>> @@ -3527,7 +3527,7 @@ 
>> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0),
>>  p
>> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), 
>> packets:1, bytes:60, used:0.001s, actions:1
>> ])
>> 
>> -AT_CHECK([ovs-appctl dpctl/del-flows], [0])
>> +AT_CHECK([ovs-appctl revalidator/purge], [0])
>> AT_CHECK([ovs-ofctl set-frags br0 $mode])
>> for frag in 4000 6000 6001 4002; do
>>   printf "\n%s\n" "$mode $frag missing transport header-"
>> --
>> 1.7.10.4
>> 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] datapath-windows: Support for hybrid forwarding

2014-11-21 Thread Sorin Vinturis
Hi all,

No need to change any macro regarding minor version. In ndis.h header we have 
the following:

#if (defined(NDIS640))
#define NDIS_FILTER_MAJOR_VERSION 6
#define NDIS_FILTER_MINOR_VERSION 40

I have set the preprocessor macro NDIS640=1 in the project properties, so the 
NDIS_FILTER_MINOR_VERSION macro is 40.

Also, the NDIS_SUPPORT_NDIS640 macro is set to 1 by the same NDIS640 
definition. If the NDIS_SUPPORT_NDIS640 define didn't exist the code won't 
compile. And it does correctly compile.

Thanks,
Sorin

-Original Message-
From: Nithin Raju [mailto:nit...@vmware.com] 
Sent: Friday, 21 November, 2014 19:22
To: Eitan Eliahu
Cc: Sorin Vinturis; dev@openvswitch.org
Subject: Re: [ovs-dev] [PATCH] datapath-windows: Support for hybrid forwarding

On Nov 21, 2014, at 8:23 AM, Eitan Eliahu 
 wrote:

> Hi Sorin,
> This change applies only for 6.40 drivers. Unless we bump the driver version 
> this code has no effect.
> You may want to bump the minor version.
> 
> #define NDIS_FILTER_MAJOR_VERSION 6
> #define NDIS_FILTER_MINOR_VERSION 30  < 40
> 
>driverChars.MajorNdisVersion = NDIS_FILTER_MAJOR_VERSION;
>driverChars.MinorNdisVersion = NDIS_FILTER_MINOR_VERSION;

+1 to that.

Also, we should use the following macro around the new code being added. Also, 
when we bump up the version, we should use the macro.
#if (NDIS_SUPPORT_NDIS640)

#endif

Thanks for the patch Sorin! I'll review it once the macros are added to make 
the code conditional.

-- Nithin
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] datapath-windows: Support for hybrid forwarding

2014-11-21 Thread Eitan Eliahu
Hi Sorin,
Thanks for explaining that. Do we need to have a new VS project (and driver 
name) for 6.40 driver?
Eitan

-Original Message-
From: Sorin Vinturis [mailto:svintu...@cloudbasesolutions.com] 
Sent: Friday, November 21, 2014 1:21 PM
To: Nithin Raju; Eitan Eliahu
Cc: dev@openvswitch.org
Subject: RE: [ovs-dev] [PATCH] datapath-windows: Support for hybrid forwarding

Hi all,

No need to change any macro regarding minor version. In ndis.h header we have 
the following:

#if (defined(NDIS640))
#define NDIS_FILTER_MAJOR_VERSION 6
#define NDIS_FILTER_MINOR_VERSION 40

I have set the preprocessor macro NDIS640=1 in the project properties, so the 
NDIS_FILTER_MINOR_VERSION macro is 40.

Also, the NDIS_SUPPORT_NDIS640 macro is set to 1 by the same NDIS640 
definition. If the NDIS_SUPPORT_NDIS640 define didn't exist the code won't 
compile. And it does correctly compile.

Thanks,
Sorin

-Original Message-
From: Nithin Raju [mailto:nit...@vmware.com] 
Sent: Friday, 21 November, 2014 19:22
To: Eitan Eliahu
Cc: Sorin Vinturis; dev@openvswitch.org
Subject: Re: [ovs-dev] [PATCH] datapath-windows: Support for hybrid forwarding

On Nov 21, 2014, at 8:23 AM, Eitan Eliahu 
 wrote:

> Hi Sorin,
> This change applies only for 6.40 drivers. Unless we bump the driver version 
> this code has no effect.
> You may want to bump the minor version.
> 
> #define NDIS_FILTER_MAJOR_VERSION 6
> #define NDIS_FILTER_MINOR_VERSION 30  < 40
> 
>driverChars.MajorNdisVersion = NDIS_FILTER_MAJOR_VERSION;
>driverChars.MinorNdisVersion = NDIS_FILTER_MINOR_VERSION;

+1 to that.

Also, we should use the following macro around the new code being added. Also, 
when we bump up the version, we should use the macro.
#if (NDIS_SUPPORT_NDIS640)

#endif

Thanks for the patch Sorin! I'll review it once the macros are added to make 
the code conditional.

-- Nithin
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v2] dpctl: Fix crash.

2014-11-21 Thread Pravin Shelar
Jarno, Can you review this patch?

On Wed, Nov 19, 2014 at 10:12 PM, Pravin B Shelar  wrote:
> ovs-dpctl crashed due to uninitialized router classifier. To
> fix this issue move ovs router initialization to route table
> module.
>
> Reported-by: Madhu Challa 
> Signed-off-by: Pravin B Shelar 
> ---
> v1-v2:
> Initialize route-table from dpif init.
> ---
>  lib/dpif.c |1 +
>  lib/netdev-vport.c |2 --
>  lib/ovs-router.c   |2 +-
>  lib/ovs-router.h   |2 +-
>  lib/route-table.c  |1 +
>  ofproto/ofproto-dpif.c |1 -
>  6 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/lib/dpif.c b/lib/dpif.c
> index d179d8a..844f869 100644
> --- a/lib/dpif.c
> +++ b/lib/dpif.c
> @@ -118,6 +118,7 @@ dp_initialize(void)
>  ovsthread_once_done(&once);
>  tnl_port_map_init();
>  tnl_arp_cache_init();
> +route_table_register();
>  }
>  }
>
> diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
> index 167212e..3825a09 100644
> --- a/lib/netdev-vport.c
> +++ b/lib/netdev-vport.c
> @@ -254,8 +254,6 @@ netdev_vport_construct(struct netdev *netdev_)
>  dev->tnl_cfg.dst_port = htons(LISP_DST_PORT);
>  }
>
> -route_table_register();
> -
>  return 0;
>  }
>
> diff --git a/lib/ovs-router.c b/lib/ovs-router.c
> index 6b5ba00..e4f8a08 100644
> --- a/lib/ovs-router.c
> +++ b/lib/ovs-router.c
> @@ -281,7 +281,7 @@ ovs_router_flush(void)
>
>  /* May not be called more than once. */
>  void
> -ovs_router_unixctl_register(void)
> +ovs_router_init(void)
>  {
>  classifier_init(&cls, NULL);
>  unixctl_command_register("ovs/route/add", "ipv4_addr/prefix_len 
> out_br_name gw", 2, 3,
> diff --git a/lib/ovs-router.h b/lib/ovs-router.h
> index 92d15c6..b0042cc 100644
> --- a/lib/ovs-router.h
> +++ b/lib/ovs-router.h
> @@ -24,7 +24,7 @@ extern "C" {
>  #endif
>
>  bool ovs_router_lookup(ovs_be32 ip_dst, char out_dev[], ovs_be32 *gw);
> -void ovs_router_unixctl_register(void);
> +void ovs_router_init(void);
>  #ifdef  __cplusplus
>  }
>  #endif
> diff --git a/lib/route-table.c b/lib/route-table.c
> index 6261954..63a9bd3 100644
> --- a/lib/route-table.c
> +++ b/lib/route-table.c
> @@ -96,6 +96,7 @@ route_table_register(void)
>  ovs_assert(!nln);
>  ovs_assert(!route_notifier);
>
> +ovs_router_init();
>  nln = nln_create(NETLINK_ROUTE, RTNLGRP_IPV4_ROUTE,
>   (nln_parse_func *) route_table_parse, &rtmsg);
>
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index 3f8768d..c8e11c2 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -1253,7 +1253,6 @@ construct(struct ofproto *ofproto_)
>  guarded_list_init(&ofproto->pins);
>
>  ofproto_unixctl_init();
> -ovs_router_unixctl_register();
>
>  hmap_init(&ofproto->vlandev_map);
>  hmap_init(&ofproto->realdev_vid_map);
> --
> 1.7.1
>
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] dpif-netdev: Remove redundant hash action handling.

2014-11-21 Thread Pravin Shelar
Jarno, Can you review this patch?

Thanks.

On Thu, Nov 13, 2014 at 3:03 PM, Pravin B Shelar  wrote:
> odp_execute_actions() already handles hash execution part.
>
> Signed-off-by: Pravin B Shelar 
> ---
>  lib/dpif-netdev.c |   29 +
>  1 files changed, 1 insertions(+), 28 deletions(-)
>
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index 65df19b..2afe71d 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -3111,34 +3111,6 @@ dp_execute_cb(void *aux_, struct dpif_packet 
> **packets, int cnt,
>  }
>  break;
>
> -case OVS_ACTION_ATTR_HASH: {
> -const struct ovs_action_hash *hash_act;
> -uint32_t hash;
> -
> -hash_act = nl_attr_get(a);
> -
> -for (i = 0; i < cnt; i++) {
> -
> -if (hash_act->hash_alg == OVS_HASH_ALG_L4) {
> -/* Hash need not be symmetric, nor does it need to include
> - * L2 fields. */
> -hash = hash_2words(dpif_packet_get_dp_hash(packets[i]),
> -   hash_act->hash_basis);
> -} else {
> -VLOG_WARN("Unknown hash algorithm specified "
> -  "for the hash action.");
> -hash = 2;
> -}
> -
> -if (!hash) {
> -hash = 1; /* 0 is not valid */
> -}
> -
> -dpif_packet_set_dp_hash(packets[i], hash);
> -}
> -return;
> -}
> -
>  case OVS_ACTION_ATTR_RECIRC:
>  if (*depth < MAX_RECIRC_DEPTH) {
>
> @@ -3171,6 +3143,7 @@ dp_execute_cb(void *aux_, struct dpif_packet **packets, 
> int cnt,
>  case OVS_ACTION_ATTR_SET:
>  case OVS_ACTION_ATTR_SET_MASKED:
>  case OVS_ACTION_ATTR_SAMPLE:
> +case OVS_ACTION_ATTR_HASH:
>  case OVS_ACTION_ATTR_UNSPEC:
>  case __OVS_ACTION_ATTR_MAX:
>  OVS_NOT_REACHED();
> --
> 1.7.1
>
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] datapath-windows: Support for hybrid forwarding

2014-11-21 Thread Sorin Vinturis
Hi Eitan,

We already have defined in VS build configurations for Windows 8 Debug/Release 
and Windows 8.1 Debug/Release, which will create the corresponding NDIS driver, 
6.30 or 6.40. There is no need to change the driver name. Both versions will be 
in its corresponding directory, Win8Release or Win8.1Release, and the installed 
will be configured to install the correct driver, depending on the OS version.

Regarding driver certification process, we will submit a driver package 
containing the driver file, install file and catalog file for each OS version 
we want to certify the OVS driver for.

-Sorin

-Original Message-
From: Eitan Eliahu [mailto:elia...@vmware.com] 
Sent: Friday, 21 November, 2014 23:29
To: Sorin Vinturis; Nithin Raju
Cc: dev@openvswitch.org
Subject: RE: [ovs-dev] [PATCH] datapath-windows: Support for hybrid forwarding

Hi Sorin,
Thanks for explaining that. Do we need to have a new VS project (and driver 
name) for 6.40 driver?
Eitan

-Original Message-
From: Sorin Vinturis [mailto:svintu...@cloudbasesolutions.com] 
Sent: Friday, November 21, 2014 1:21 PM
To: Nithin Raju; Eitan Eliahu
Cc: dev@openvswitch.org
Subject: RE: [ovs-dev] [PATCH] datapath-windows: Support for hybrid forwarding

Hi all,

No need to change any macro regarding minor version. In ndis.h header we have 
the following:

#if (defined(NDIS640))
#define NDIS_FILTER_MAJOR_VERSION 6
#define NDIS_FILTER_MINOR_VERSION 40

I have set the preprocessor macro NDIS640=1 in the project properties, so the 
NDIS_FILTER_MINOR_VERSION macro is 40.

Also, the NDIS_SUPPORT_NDIS640 macro is set to 1 by the same NDIS640 
definition. If the NDIS_SUPPORT_NDIS640 define didn't exist the code won't 
compile. And it does correctly compile.

Thanks,
Sorin

-Original Message-
From: Nithin Raju [mailto:nit...@vmware.com] 
Sent: Friday, 21 November, 2014 19:22
To: Eitan Eliahu
Cc: Sorin Vinturis; dev@openvswitch.org
Subject: Re: [ovs-dev] [PATCH] datapath-windows: Support for hybrid forwarding

On Nov 21, 2014, at 8:23 AM, Eitan Eliahu 
 wrote:

> Hi Sorin,
> This change applies only for 6.40 drivers. Unless we bump the driver version 
> this code has no effect.
> You may want to bump the minor version.
> 
> #define NDIS_FILTER_MAJOR_VERSION 6
> #define NDIS_FILTER_MINOR_VERSION 30  < 40
> 
>driverChars.MajorNdisVersion = NDIS_FILTER_MAJOR_VERSION;
>driverChars.MinorNdisVersion = NDIS_FILTER_MINOR_VERSION;

+1 to that.

Also, we should use the following macro around the new code being added. Also, 
when we bump up the version, we should use the macro.
#if (NDIS_SUPPORT_NDIS640)

#endif

Thanks for the patch Sorin! I'll review it once the macros are added to make 
the code conditional.

-- Nithin
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] How user actions are translated to kernel actions?

2014-11-21 Thread Masoud Moshref Javadi

Where/how are user actions translated to actions that kernel understands?
Looking at datapath/actions.c, it seems the kernel only understands 
OVS_ACTION_ATTR_* from netlink messages.


At the userside it seems that ofproto-dpif-xlate.c:xlate_actions__()  
looks for the rule by calling rule_dpif_lookup, and fills actions in ctx 
variable. But I cannot find where actions of the rule are extracted and 
converted to those that kernel understands.
Is this ofp-actions.c:ofpacts_execute_action_set() or 
ofproto-dpif-xlate.c:compose_output_action ()?


--
Masoud Moshref Javadi
Computer Engineering PhD Candidate
Ming Hsieh Department of Electrical Engineering
University of Southern California

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [ovs-issues] Account for hybrid networking in the OVS Hyper-V switch Extension (#52)

2014-11-21 Thread Sorin Vinturis
Nithin, I will send a v2 patch to with the necessary conditional code. Thanks!

From: nithinrajub [mailto:notificati...@github.com]
Sent: Friday, 21 November, 2014 23:54
To: openvswitch/ovs-issues
Cc: Sorin Vinturis
Subject: Re: [ovs-issues] Account for hybrid networking in the OVS Hyper-V 
switch Extension (#52)


[:+1:]

All we need is:
#if (NDIS_SUPPORT_NDIS640)

#else

#endif

—
Reply to this email directly or view it on 
GitHub.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] Bug#768095: openvswitch-datapath-dkms fails to build on Debian 7.7 3.2.0-4-amd64 (3.2.63-2+deb7u1)

2014-11-21 Thread Ben Pfaff
On Mon, Nov 17, 2014 at 04:38:27PM +0100, Jonathan Dupart wrote:
> Hi,
> 
> I have been bittend by this bug.
> 
> I am raising this bug severity to grave, as it renders openvswitch
> unusable after upgrading to the last stable kernel.
> 
> I tested the patch and it works flawlessly. It should be quite easy to
> update the package in stable.

I'm quite busy this week.  I would be grateful for an NMU.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v2] dpctl: Fix crash.

2014-11-21 Thread Jarno Rajahalme
Acked-by: Jarno Rajahalme  

With a small nit below,

  Jarno

On Nov 19, 2014, at 10:12 PM, Pravin B Shelar  wrote:

> ovs-dpctl crashed due to uninitialized router classifier. To
> fix this issue move ovs router initialization to route table
> module.
> 
> Reported-by: Madhu Challa 
> Signed-off-by: Pravin B Shelar 
> ---
> v1-v2:
> Initialize route-table from dpif init.
> ---
> lib/dpif.c |1 +
> lib/netdev-vport.c |2 --
> lib/ovs-router.c   |2 +-
> lib/ovs-router.h   |2 +-
> lib/route-table.c  |1 +
> ofproto/ofproto-dpif.c |1 -
> 6 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/dpif.c b/lib/dpif.c
> index d179d8a..844f869 100644
> --- a/lib/dpif.c
> +++ b/lib/dpif.c
> @@ -118,6 +118,7 @@ dp_initialize(void)
> ovsthread_once_done(&once);
> tnl_port_map_init();
> tnl_arp_cache_init();
> +route_table_register();

I did not check the details here, but I recall that all initialization should 
be done before ovsthread_once_done() is called, otherwise parallel threads may 
go on before the initialization is finished. So you should probably move 
ovsthread_once_done() call to be done after the route_table_register() call.

> }
> }
> 
> diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
> index 167212e..3825a09 100644
> --- a/lib/netdev-vport.c
> +++ b/lib/netdev-vport.c
> @@ -254,8 +254,6 @@ netdev_vport_construct(struct netdev *netdev_)
> dev->tnl_cfg.dst_port = htons(LISP_DST_PORT);
> }
> 
> -route_table_register();
> -
> return 0;
> }
> 
> diff --git a/lib/ovs-router.c b/lib/ovs-router.c
> index 6b5ba00..e4f8a08 100644
> --- a/lib/ovs-router.c
> +++ b/lib/ovs-router.c
> @@ -281,7 +281,7 @@ ovs_router_flush(void)
> 
> /* May not be called more than once. */
> void
> -ovs_router_unixctl_register(void)
> +ovs_router_init(void)
> {
> classifier_init(&cls, NULL);
> unixctl_command_register("ovs/route/add", "ipv4_addr/prefix_len 
> out_br_name gw", 2, 3,
> diff --git a/lib/ovs-router.h b/lib/ovs-router.h
> index 92d15c6..b0042cc 100644
> --- a/lib/ovs-router.h
> +++ b/lib/ovs-router.h
> @@ -24,7 +24,7 @@ extern "C" {
> #endif
> 
> bool ovs_router_lookup(ovs_be32 ip_dst, char out_dev[], ovs_be32 *gw);
> -void ovs_router_unixctl_register(void);
> +void ovs_router_init(void);
> #ifdef  __cplusplus
> }
> #endif
> diff --git a/lib/route-table.c b/lib/route-table.c
> index 6261954..63a9bd3 100644
> --- a/lib/route-table.c
> +++ b/lib/route-table.c
> @@ -96,6 +96,7 @@ route_table_register(void)
> ovs_assert(!nln);
> ovs_assert(!route_notifier);
> 
> +ovs_router_init();
> nln = nln_create(NETLINK_ROUTE, RTNLGRP_IPV4_ROUTE,
>  (nln_parse_func *) route_table_parse, &rtmsg);
> 
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index 3f8768d..c8e11c2 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -1253,7 +1253,6 @@ construct(struct ofproto *ofproto_)
> guarded_list_init(&ofproto->pins);
> 
> ofproto_unixctl_init();
> -ovs_router_unixctl_register();
> 
> hmap_init(&ofproto->vlandev_map);
> hmap_init(&ofproto->realdev_vid_map);
> -- 
> 1.7.1
> 
> ___
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] dpif-netdev: Remove redundant hash action handling.

2014-11-21 Thread Jarno Rajahalme
Acked-by: Jarno Rajahalme 

On Nov 13, 2014, at 3:03 PM, Pravin B Shelar  wrote:

> odp_execute_actions() already handles hash execution part.
> 
> Signed-off-by: Pravin B Shelar 
> ---
> lib/dpif-netdev.c |   29 +
> 1 files changed, 1 insertions(+), 28 deletions(-)
> 
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index 65df19b..2afe71d 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -3111,34 +3111,6 @@ dp_execute_cb(void *aux_, struct dpif_packet 
> **packets, int cnt,
> }
> break;
> 
> -case OVS_ACTION_ATTR_HASH: {
> -const struct ovs_action_hash *hash_act;
> -uint32_t hash;
> -
> -hash_act = nl_attr_get(a);
> -
> -for (i = 0; i < cnt; i++) {
> -
> -if (hash_act->hash_alg == OVS_HASH_ALG_L4) {
> -/* Hash need not be symmetric, nor does it need to include
> - * L2 fields. */
> -hash = hash_2words(dpif_packet_get_dp_hash(packets[i]),
> -   hash_act->hash_basis);
> -} else {
> -VLOG_WARN("Unknown hash algorithm specified "
> -  "for the hash action.");
> -hash = 2;
> -}
> -
> -if (!hash) {
> -hash = 1; /* 0 is not valid */
> -}
> -
> -dpif_packet_set_dp_hash(packets[i], hash);
> -}
> -return;
> -}
> -
> case OVS_ACTION_ATTR_RECIRC:
> if (*depth < MAX_RECIRC_DEPTH) {
> 
> @@ -3171,6 +3143,7 @@ dp_execute_cb(void *aux_, struct dpif_packet **packets, 
> int cnt,
> case OVS_ACTION_ATTR_SET:
> case OVS_ACTION_ATTR_SET_MASKED:
> case OVS_ACTION_ATTR_SAMPLE:
> +case OVS_ACTION_ATTR_HASH:
> case OVS_ACTION_ATTR_UNSPEC:
> case __OVS_ACTION_ATTR_MAX:
> OVS_NOT_REACHED();
> -- 
> 1.7.1
> 
> ___
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] How user actions are translated to kernel actions?

2014-11-21 Thread Jarno Rajahalme
OpenFlow actions are initially translated by ofproto-dpif-xlate functions. The 
kernel actions are generated by the various commit_* functions in 
lib/odp-util.c, called by the xlate functions.

Regards,

  Jarno

On Nov 21, 2014, at 2:00 PM, Masoud Moshref Javadi  wrote:

> Where/how are user actions translated to actions that kernel understands?
> Looking at datapath/actions.c, it seems the kernel only understands 
> OVS_ACTION_ATTR_* from netlink messages.
> 
> At the userside it seems that ofproto-dpif-xlate.c:xlate_actions__()  looks 
> for the rule by calling rule_dpif_lookup, and fills actions in ctx variable. 
> But I cannot find where actions of the rule are extracted and converted to 
> those that kernel understands.
> Is this ofp-actions.c:ofpacts_execute_action_set() or 
> ofproto-dpif-xlate.c:compose_output_action ()?
> 
> -- 
> Masoud Moshref Javadi
> Computer Engineering PhD Candidate
> Ming Hsieh Department of Electrical Engineering
> University of Southern California
> 
> ___
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH 1/2] ovs-ofctl: Consistently escape '-' in group documentation

2014-11-21 Thread Ben Pfaff
On Wed, Nov 19, 2014 at 12:17:53PM +0900, YAMAMOTO Takashi wrote:
> > On Wed, Nov 19, 2014 at 11:53:53AM +0900, YAMAMOTO Takashi wrote:
> >> hi,
> >> 
> >> > I am unsure of the reason for escaping '-' inside of control
> >> > sequences but regardless this patch makes the group documentation
> >> > consistent with other portions of the ovs-ofctl(8) in this regard.
> >> 
> >> afaik you should not escape hyphens.
> >> http://netbsd.gw.com/cgi-bin/man-cgi?mandoc_char++NetBSD-current
> > 
> > Thanks. So would you suggest the opposite approach to this patch:
> > replacing '\-' with '-'?
> 
> yes.
> 
> it's a good idea to check pdf output, where the difference can
> matter much.

In my opinion, in manpages, the choice between - and \- should depend
on the factors listed in the webpage you cite (which I did not know
about; thank you for the citation), but additionally upon whether one
intends the current text to be taken as literal text.  A traditional
typewriter (or computer keyboard) does not have different glyphs for
hyphen and minus sign and en dash and em dash, and so I expect literal
text, which I think of as being in a font that imitates a typewriter,
as having only one glyph for these, which looks like a minus sign.
This is what happens in typical typography in TeX derivatives such as
Texinfo and LaTeX, where writing something like @verbatim{-} or
\texttt{-} produces a minus sign.

So, when I write literal text in manpages for Open vSwitch, I always
use \- instead of -, because I want it to look like a literal text
minus sign.  This is therefore the convention you will most often find
in Open vSwitch manpages.  I do not know whether it is correct or
incorrect (maybe it is wrong), but it is what is most common in OVS.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] tunnel-push-pop.at: Make test more deterministic.

2014-11-21 Thread Jarno Rajahalme
Pravin,

Would you mind reviewing this?

  Jarno

On Nov 20, 2014, at 2:13 PM, Jarno Rajahalme  wrote:

> Using the '-march=native' broke this test in a i7 laptop, most likely
> due to a different hash implementation, which resulted in different
> datapath port number assignment accross different compilations.
> 
> Break up the ports setup so that the datapath port number assignment
> is more deterministic.
> 
> Signed-off-by: Jarno Rajahalme 
> ---
> tests/tunnel-push-pop.at |   20 ++--
> 1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/tunnel-push-pop.at b/tests/tunnel-push-pop.at
> index c552dd2..f9ea4c0 100644
> --- a/tests/tunnel-push-pop.at
> +++ b/tests/tunnel-push-pop.at
> @@ -6,21 +6,21 @@ dnl ovs router is commands are only supported on Linux for 
> now.
> AT_SKIP_IF([test "$IS_WIN32" = "yes"])
> AT_SKIP_IF([test "$IS_BSD" = "yes"])
> 
> -OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy 
> ofport_request=1\
> --- add-br int-br -- set bridge int-br 
> datapath_type=dummy \
> --- add-port int-br t2 -- set Interface t2 type=vxlan \
> +OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy 
> ofport_request=1])
> +AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], 
> [0])
> +AT_CHECK([ovs-vsctl add-port int-br t2 -- set Interface t2 type=vxlan \
>options:remote_ip=1.1.2.92 options:key=123 
> ofport_request=2\
> -- add-port int-br t1 -- set Interface t1 type=gre \
> -   options:remote_ip=1.1.2.92 options:key=456 
> ofport_request=3])
> +   options:remote_ip=1.1.2.92 options:key=456 
> ofport_request=3], [0])
> 
> AT_CHECK([ovs-appctl dpif/show], [0], [dnl
> dummy@ovs-dummy: hit:0 missed:0
>   br0:
>   br0 65534/100: (dummy)
> - p0 1/3: (dummy)
> + p0 1/1: (dummy)
>   int-br:
>   int-br 65534/2: (dummy)
> - t1 3/1: (gre: key=456, remote_ip=1.1.2.92)
> + t1 3/3: (gre: key=456, remote_ip=1.1.2.92)
>   t2 2/4789: (vxlan: key=123, remote_ip=1.1.2.92)
> ])
> 
> @@ -41,15 +41,15 @@ IP   MAC Bridge
> ])
> 
> dnl Check VXLAN tunnel pop
> -AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
> 'in_port(3),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=17,tos=0,ttl=64,frag=no),udp(src=51283,dst=4789)'],
>  [0], [stdout])
> +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
> 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=17,tos=0,ttl=64,frag=no),udp(src=51283,dst=4789)'],
>  [0], [stdout])
> AT_CHECK([tail -1 stdout], [0],
>   [Datapath actions: tnl_pop(4789)
> ])
> 
> dnl Check GRE tunnel pop
> -AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
> 'in_port(3),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'],
>  [0], [stdout])
> +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
> 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'],
>  [0], [stdout])
> AT_CHECK([tail -1 stdout], [0],
> -  [Datapath actions: tnl_pop(1)
> +  [Datapath actions: tnl_pop(3)
> ])
> 
> dnl Check VXLAN tunnel push
> @@ -63,7 +63,7 @@ dnl Check GRE tunnel push
> AT_CHECK([ovs-ofctl add-flow int-br action=3])
> AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
> 'in_port(2),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'],
>  [0], [stdout])
> AT_CHECK([tail -1 stdout], [0],
> -  [Datapath actions: 
> tnl_push(tnl_port(1),header(size=42,type=3,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=47,tos=0,ttl=64,frag=0x40),gre((flags=0x20,proto=0x6558),key=0x1c8)),out_port(100))
> +  [Datapath actions: 
> tnl_push(tnl_port(3),header(size=42,type=3,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=47,tos=0,ttl=64,frag=0x40),gre((flags=0x20,proto=0x6558),key=0x1c8)),out_port(100))
> ])
> 
> OVS_VSWITCHD_STOP
> -- 
> 1.7.10.4
> 

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] Add build of ovsext.sln using MSBuild

2014-11-21 Thread Gurucharan Shetty
On Thu, Aug 28, 2014 at 6:49 AM, Alin Serdean
 wrote:
> This commit adds to the automake build system the full build required
> by the forwarding extension solution.
>
> It will help a lot in the future CI to check the full build of the project.
>
> To configure the forwarding extension to be built one could use the following:
> ./configure CC=./build-aux/cccl LD="`which link`" LIBS="-lws2_32" \
> --prefix="C:/openvswitch/usr" --localstatedir="C:/openvswitch/var" \
> --sysconfdir="C:/openvswitch/etc" --with-pthread="C:/pthread" \
> --with-vstudioddk="Win8.1 Release"
>
> Documentation will be updated in another patch.
It looks like the documentation was not updated for this. I think it
will be useful to document.

>
> Signed-off-by: Alin Gabriel Serdean 
> ---
>  Makefile.am   | 10 ++
>  configure.ac  |  1 +
>  m4/openvswitch.m4 | 28 
>  3 files changed, 39 insertions(+)
>
> diff --git a/Makefile.am b/Makefile.am
> index b64fb62..3c2ae89 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -290,6 +290,16 @@ $(srcdir)/manpages.mk: $(MAN_ROOTS) 
> build-aux/sodepends.pl
> fi
>  CLEANFILES += manpage-dep-check
>
> +if VSTUDIO_DDK
> +ALL_LOCAL += ovsext_make
> +ovsext_make: datapath-windows/ovsext.sln
> +   MSBuild.exe datapath-windows/ovsext.sln /target:Build 
> /property:Configuration="$(VSTUDIO_CONFIG)"
> +
> +CLEAN_LOCAL += ovsext_clean
> +ovsext_clean: datapath-windows/ovsext.sln
> +   MSBuild.exe datapath-windows/ovsext.sln /target:Clean 
> /property:Configuration="$(VSTUDIO_CONFIG)"
> +endif
> +
>  dist-hook: $(DIST_HOOKS)
>  all-local: $(ALL_LOCAL)
>  clean-local: $(CLEAN_LOCAL)
> diff --git a/configure.ac b/configure.ac
> index 971c7b3..f41a9e6 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -51,6 +51,7 @@ AC_FUNC_STRERROR_R
>
>  OVS_CHECK_ESX
>  OVS_CHECK_WIN32
> +OVS_CHECK_VISUAL_STUDIO_DDK
>  OVS_CHECK_COVERAGE
>  OVS_CHECK_NDEBUG
>  OVS_CHECK_NETLINK
> diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
> index 26b8058..55aa3f0 100644
> --- a/m4/openvswitch.m4
> +++ b/m4/openvswitch.m4
> @@ -86,12 +86,40 @@ AC_DEFUN([OVS_CHECK_WIN32],
>  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"
>  #endif])
> fi])
>
> +dnl OVS_CHECK_WINDOWS
> +dnl
> +dnl Configure Visual Studio solution build
> +AC_DEFUN([OVS_CHECK_VISUAL_STUDIO_DDK], [
> +AC_ARG_WITH([vstudioddk],
> + [AS_HELP_STRING([--with-vstudioddk=version_type],
> +[Visual Studio DDK version type e.g. Win8.1 Release])],
> + [
> +case "$withval" in
> +"Win8.1 Release") ;;
> +"Win8.1 Debug") ;;
> +"Win8 Release") ;;
> +"Win8 Debug") ;;
> +*) AC_MSG_ERROR([No good Visual Studio configuration found]) ;;
> +esac
> +
> +VSTUDIO_CONFIG=$withval
> + ], [
> +VSTUDIO_CONFIG=
> + ]
> +  )
> +
> +  AC_SUBST([VSTUDIO_CONFIG])
> +  AC_DEFINE([VSTUDIO_DDK], [1], [System uses the Visual Studio DDK version 
> module.])
> +  AM_CONDITIONAL([VSTUDIO_DDK], test -n "$VSTUDIO_CONFIG")
> +])
> +
>  dnl Checks for Netlink support.
>  AC_DEFUN([OVS_CHECK_NETLINK],
>[AC_CHECK_HEADER([linux/netlink.h],
> --
> 1.9.0.msysgit.0
>
> ___
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH v2] datapath-windows: Support for hybrid forwarding

2014-11-21 Thread Sorin Vinturis
In a hybrid forwarding environment, there are two types of packets that
enter and leave the Hyper-V extensible switch: NVGRE packets and non-NVGRE
packets. Hybrid forwarding involves filtering the incoming traffic based
on packet type.

Thus, we must split the incoming traffic into NVGRE and non-NVGRE packets.
All non-NVGRE traffic is forwarded by the OVS extension and processed as
usual, and the NVGRE traffic is passed to NDIS to be handled by the HNV
module.

Necessary VS project changes regarding the compiler settings will be made
in a different patch.

More details about hybrid forwarding and the necessary NDIS 6.40 support
is provided in issue #52.

Signed-off-by: Sorin Vinturis 
Reported-by: Nithin Raju 
Reported-at: https://github.com/openvswitch/ovs-issues/issues/52
---
 datapath-windows/ovsext/PacketIO.c | 41 --
 1 file changed, 39 insertions(+), 2 deletions(-)

diff --git a/datapath-windows/ovsext/PacketIO.c 
b/datapath-windows/ovsext/PacketIO.c
index 1af391b..78b62c1 100644
--- a/datapath-windows/ovsext/PacketIO.c
+++ b/datapath-windows/ovsext/PacketIO.c
@@ -193,6 +193,10 @@ OvsStartNBLIngress(POVS_SWITCH_CONTEXT switchContext,
 LIST_ENTRY missedPackets;
 UINT32 num = 0;
 OvsCompletionList completionList;
+PNET_BUFFER_LIST extForwardedNbls = NULL;
+PNET_BUFFER_LIST nativeForwardedNbls = NULL;
+PNET_BUFFER_LIST *nextExtForwardNbl = &extForwardedNbls;
+PNET_BUFFER_LIST *nextNativeForwardedNbl = &nativeForwardedNbls;
 
 dispatch = NDIS_TEST_SEND_AT_DISPATCH_LEVEL(SendFlags)?
 NDIS_RWL_AT_DISPATCH_LEVEL : 0;
@@ -201,8 +205,35 @@ OvsStartNBLIngress(POVS_SWITCH_CONTEXT switchContext,
 
 InitializeListHead(&missedPackets);
 OvsInitCompletionList(&completionList, switchContext, sendCompleteFlags);
-
-for (curNbl = netBufferLists; curNbl != NULL; curNbl = nextNbl) {
+
+#if (NDIS_SUPPORT_NDIS640)
+/*
+ * Split NBL list into NBLs to be forwarded by us, and those that require
+ * native forwarding. */
+for (curNbl = netBufferLists; curNbl != NULL; curNbl = nextNbl) {
+nextNbl = curNbl->Next;
+curNbl->Next = NULL;
+fwdDetail = NET_BUFFER_LIST_SWITCH_FORWARDING_DETAIL(curNbl);
+
+if (fwdDetail->NativeForwardingRequired) {
+*nextNativeForwardedNbl = curNbl;
+nextNativeForwardedNbl = &(curNbl->Next);
+}
+else
+{
+*nextExtForwardNbl = curNbl;
+nextExtForwardNbl = &(curNbl->Next);
+}
+}
+#else
+UNREFERENCED_PARAMETER(nativeForwardedNbls);
+UNREFERENCED_PARAMETER(nextNativeForwardedNbl);
+UNREFERENCED_PARAMETER(nextExtForwardNbl);
+
+extForwardedNbls = netBufferLists;
+#endif
+
+for (curNbl = extForwardedNbls; curNbl != NULL; curNbl = nextNbl) {
 POVS_VPORT_ENTRY vport;
 UINT32 portNo;
 OVS_DATAPATH *datapath = &switchContext->datapath;
@@ -315,6 +346,12 @@ dropit:
 }
 }
 
+if (nativeForwardedNbls) {
+/* This is NVGRE encapsulated traffic and is forwarded to NDIS
+ * in order to be handled by the HNV module. */
+OvsSendNBLIngress(switchContext, nativeForwardedNbls, SendFlags);
+}
+
 /* Queue the missed packets. */
 OvsQueuePackets(&missedPackets, num);
 OvsFinalizeCompletionList(&completionList);
-- 
1.9.0.msysgit.0
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] datapath-windows: do not complete an IRP when pending status returned

2014-11-21 Thread Ben Pfaff
On Fri, Nov 21, 2014 at 04:58:54PM -0800, Eitan Eliahu wrote:
> The driver completes a pending IRP, the IRP is being marked free by the
> I/O manager which causes a system crash when the IRP is completed at
> the second time.
> The driver should not complete a pending IRP in the context of the
> Device I/O control thread.
> 
> *** Fatal System Error: 0x0044
>
> (0xFA800CF897D0,0x0F7A,0x,0x)
> 
> Break instruction exception - code 8003 (first chance)
> 
> BugCheck 44, {fa800cf897d0, f7a, 0, 0}
> 
> Probably caused by : OVSExt.sys ( OVSExt!OvsCompleteIrpRequest+3a )
> 
> Followup: MachineOwner
> -
> 
> nt!DbgBreakPointWithStatus:
> f800`5a100930 cc  int 3
> 11: kd> !analyze -v
> ***
> * 
> *
> *Bugcheck Analysis
> *
> * 
> *
> ***
> 
> MULTIPLE_IRP_COMPLETE_REQUESTS (44)
> A driver has requested that an IRP be completed (IoCompleteRequest()), but
> the packet has already been completed.  This is a tough bug to find because
> the easiest case, a driver actually attempted to complete its own packet
> twice, is generally not what happened.  Rather, two separate drivers each
> believe that they own the packet, and each attempts to complete it.  The
> first actually works, and the second fails.  Tracking down which drivers
> in the system actually did this is difficult, generally because the trails
> of the first driver have been covered by the second.  However, the driver
> stack for the current request can be found by examining the DeviceObject
> fields in each of the stack locations.
> Arguments:
> Arg1: fa800cf897d0, Address of the IRP
> Arg2: 0f7a
> Arg3: 
> Arg4: 
> 
> Signed-off-by: Eitan Eliahu 

Applied, thanks!
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] tunnel-push-pop.at: Make test more deterministic.

2014-11-21 Thread Pravin Shelar
On Thu, Nov 20, 2014 at 2:13 PM, Jarno Rajahalme  wrote:
> Using the '-march=native' broke this test in a i7 laptop, most likely
> due to a different hash implementation, which resulted in different
> datapath port number assignment accross different compilations.
>
> Break up the ports setup so that the datapath port number assignment
> is more deterministic.
>
> Signed-off-by: Jarno Rajahalme 
I just have following question. Otherwise looks good.

Acked-by: Pravin B Shelar 

> ---
>  tests/tunnel-push-pop.at |   20 ++--
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/tests/tunnel-push-pop.at b/tests/tunnel-push-pop.at
> index c552dd2..f9ea4c0 100644
> --- a/tests/tunnel-push-pop.at
> +++ b/tests/tunnel-push-pop.at
> @@ -6,21 +6,21 @@ dnl ovs router is commands are only supported on Linux for 
> now.
>  AT_SKIP_IF([test "$IS_WIN32" = "yes"])
>  AT_SKIP_IF([test "$IS_BSD" = "yes"])
>
> -OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy 
> ofport_request=1\
> --- add-br int-br -- set bridge int-br 
> datapath_type=dummy \
> --- add-port int-br t2 -- set Interface t2 type=vxlan \
> +OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy 
> ofport_request=1])
> +AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], 
> [0])
> +AT_CHECK([ovs-vsctl add-port int-br t2 -- set Interface t2 type=vxlan \
> options:remote_ip=1.1.2.92 options:key=123 
> ofport_request=2\
>  -- add-port int-br t1 -- set Interface t1 type=gre \
> -   options:remote_ip=1.1.2.92 options:key=456 
> ofport_request=3])
> +   options:remote_ip=1.1.2.92 options:key=456 
> ofport_request=3], [0])

is there reason for not making this ports addition into separate vsctl commands?

>
>  AT_CHECK([ovs-appctl dpif/show], [0], [dnl
>  dummy@ovs-dummy: hit:0 missed:0
> br0:
> br0 65534/100: (dummy)
> -   p0 1/3: (dummy)
> +   p0 1/1: (dummy)
> int-br:
> int-br 65534/2: (dummy)
> -   t1 3/1: (gre: key=456, remote_ip=1.1.2.92)
> +   t1 3/3: (gre: key=456, remote_ip=1.1.2.92)
> t2 2/4789: (vxlan: key=123, remote_ip=1.1.2.92)
>  ])
>
> @@ -41,15 +41,15 @@ IP   MAC Bridge
>  ])
>
>  dnl Check VXLAN tunnel pop
> -AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
> 'in_port(3),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=17,tos=0,ttl=64,frag=no),udp(src=51283,dst=4789)'],
>  [0], [stdout])
> +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
> 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=17,tos=0,ttl=64,frag=no),udp(src=51283,dst=4789)'],
>  [0], [stdout])
>  AT_CHECK([tail -1 stdout], [0],
>[Datapath actions: tnl_pop(4789)
>  ])
>
>  dnl Check GRE tunnel pop
> -AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
> 'in_port(3),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'],
>  [0], [stdout])
> +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
> 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'],
>  [0], [stdout])
>  AT_CHECK([tail -1 stdout], [0],
> -  [Datapath actions: tnl_pop(1)
> +  [Datapath actions: tnl_pop(3)
>  ])
>
>  dnl Check VXLAN tunnel push
> @@ -63,7 +63,7 @@ dnl Check GRE tunnel push
>  AT_CHECK([ovs-ofctl add-flow int-br action=3])
>  AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
> 'in_port(2),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'],
>  [0], [stdout])
>  AT_CHECK([tail -1 stdout], [0],
> -  [Datapath actions: 
> tnl_push(tnl_port(1),header(size=42,type=3,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=47,tos=0,ttl=64,frag=0x40),gre((flags=0x20,proto=0x6558),key=0x1c8)),out_port(100))
> +  [Datapath actions: 
> tnl_push(tnl_port(3),header(size=42,type=3,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=47,tos=0,ttl=64,frag=0x40),gre((flags=0x20,proto=0x6558),key=0x1c8)),out_port(100))
>  ])
>
>  OVS_VSWITCHD_STOP
> --
> 1.7.10.4
>
> ___
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] usermode-windows: Set the socket pid number in the NL message

2014-11-21 Thread Ben Pfaff
On Fri, Nov 21, 2014 at 05:34:56PM -0800, Eitan Eliahu wrote:
> The pid must be set in the NL header as the driver checks it against the pid 
> in
> the instance paired with the socket.
> 
> Signed-off-by: Eitan Eliahu 

Thanks, applied!
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] tunnel-push-pop.at: Make test more deterministic.

2014-11-21 Thread Jarno Rajahalme

On Nov 21, 2014, at 3:22 PM, Pravin Shelar  wrote:

> On Thu, Nov 20, 2014 at 2:13 PM, Jarno Rajahalme  
> wrote:
>> Using the '-march=native' broke this test in a i7 laptop, most likely
>> due to a different hash implementation, which resulted in different
>> datapath port number assignment accross different compilations.
>> 
>> Break up the ports setup so that the datapath port number assignment
>> is more deterministic.
>> 
>> Signed-off-by: Jarno Rajahalme 
> I just have following question. Otherwise looks good.
> 
> Acked-by: Pravin B Shelar 
> 

Thanks for the review. I have answered your question below

Pushed to master,

  Jarno

>> ---
>> tests/tunnel-push-pop.at |   20 ++--
>> 1 file changed, 10 insertions(+), 10 deletions(-)
>> 
>> diff --git a/tests/tunnel-push-pop.at b/tests/tunnel-push-pop.at
>> index c552dd2..f9ea4c0 100644
>> --- a/tests/tunnel-push-pop.at
>> +++ b/tests/tunnel-push-pop.at
>> @@ -6,21 +6,21 @@ dnl ovs router is commands are only supported on Linux for 
>> now.
>> AT_SKIP_IF([test "$IS_WIN32" = "yes"])
>> AT_SKIP_IF([test "$IS_BSD" = "yes"])
>> 
>> -OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy 
>> ofport_request=1\
>> --- add-br int-br -- set bridge int-br 
>> datapath_type=dummy \
>> --- add-port int-br t2 -- set Interface t2 type=vxlan \
>> +OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy 
>> ofport_request=1])
>> +AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br 
>> datapath_type=dummy], [0])
>> +AT_CHECK([ovs-vsctl add-port int-br t2 -- set Interface t2 type=vxlan \
>>options:remote_ip=1.1.2.92 options:key=123 
>> ofport_request=2\
>> -- add-port int-br t1 -- set Interface t1 type=gre \
>> -   options:remote_ip=1.1.2.92 options:key=456 
>> ofport_request=3])
>> +   options:remote_ip=1.1.2.92 options:key=456 
>> ofport_request=3], [0])
> 
> is there reason for not making this ports addition into separate vsctl 
> commands?
> 

Due to the way vxlan ODP port number is assigned, no.

>> 
>> AT_CHECK([ovs-appctl dpif/show], [0], [dnl
>> dummy@ovs-dummy: hit:0 missed:0
>>br0:
>>br0 65534/100: (dummy)
>> -   p0 1/3: (dummy)
>> +   p0 1/1: (dummy)
>>int-br:
>>int-br 65534/2: (dummy)
>> -   t1 3/1: (gre: key=456, remote_ip=1.1.2.92)
>> +   t1 3/3: (gre: key=456, remote_ip=1.1.2.92)
>>t2 2/4789: (vxlan: key=123, remote_ip=1.1.2.92)
>> ])
>> 
>> @@ -41,15 +41,15 @@ IP   MAC Bridge
>> ])
>> 
>> dnl Check VXLAN tunnel pop
>> -AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
>> 'in_port(3),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=17,tos=0,ttl=64,frag=no),udp(src=51283,dst=4789)'],
>>  [0], [stdout])
>> +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
>> 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=17,tos=0,ttl=64,frag=no),udp(src=51283,dst=4789)'],
>>  [0], [stdout])
>> AT_CHECK([tail -1 stdout], [0],
>>   [Datapath actions: tnl_pop(4789)
>> ])
>> 
>> dnl Check GRE tunnel pop
>> -AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
>> 'in_port(3),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'],
>>  [0], [stdout])
>> +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
>> 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'],
>>  [0], [stdout])
>> AT_CHECK([tail -1 stdout], [0],
>> -  [Datapath actions: tnl_pop(1)
>> +  [Datapath actions: tnl_pop(3)
>> ])
>> 
>> dnl Check VXLAN tunnel push
>> @@ -63,7 +63,7 @@ dnl Check GRE tunnel push
>> AT_CHECK([ovs-ofctl add-flow int-br action=3])
>> AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 
>> 'in_port(2),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'],
>>  [0], [stdout])
>> AT_CHECK([tail -1 stdout], [0],
>> -  [Datapath actions: 
>> tnl_push(tnl_port(1),header(size=42,type=3,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=47,tos=0,ttl=64,frag=0x40),gre((flags=0x20,proto=0x6558),key=0x1c8)),out_port(100))
>> +  [Datapath actions: 
>> tnl_push(tnl_port(3),header(size=42,type=3,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=47,tos=0,ttl=64,frag=0x40),gre((flags=0x20,proto=0x6558),key=0x1c8)),out_port(100))
>> ])
>> 
>> OVS_VSWITCHD_STOP
>> --
>> 1.7.10.4
>> 
>> ___
>> dev mailing list
>> dev@openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/ma

[ovs-dev] [PATCH] ofproto: fix checking of packet_in_mask in async config

2014-11-21 Thread Shu Shen
The check shall use wire protool reasons, which could be different from
the internal packet-in reason.

Signed-off-by: Shu Shen 
---
 ofproto/connmgr.c |  2 +-
 tests/ofproto-dpif.at | 62 +++
 2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index 627f326..46e7431 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -1677,7 +1677,7 @@ connmgr_send_packet_in(struct connmgr *mgr,
 enum ofp_packet_in_reason reason = wire_reason(ofconn, pin);
 
 if (ofconn_wants_packet_in_on_miss(ofconn, pin)
-&& ofconn_receives_async_msg(ofconn, OAM_PACKET_IN, pin->up.reason)
+&& ofconn_receives_async_msg(ofconn, OAM_PACKET_IN, reason)
 && ofconn->controller_id == pin->controller_id) {
 schedule_packet_in(ofconn, *pin, reason);
 }
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index d2d089b..684157b 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -2652,6 +2652,68 @@ OFPST_FLOW reply (OF1.3):
 OVS_VSWITCHD_STOP
 AT_CLEANUP
 
+AT_SETUP([ofproto-dpif - table-miss flow with async config (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])
+
+# Become slave (OF 1.3), which should disable everything except port status.
+ovs-appctl -t ovs-ofctl ofctl/send 
04180018000200030001
+
+# Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
+ovs-appctl -t ovs-ofctl ofctl/send 
041c00220001
+
+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
+send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
+OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
+dnl
+send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
+ master:
+   PACKET_IN: (off)
+ PORT_STATUS: (off)
+FLOW_REMOVED: (off)
+
+ slave:
+   PACKET_IN: no_match
+ PORT_STATUS: (off)
+FLOW_REMOVED: (off)
+dnl
+OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via 
no_match) data_len=60 (unbuffered)
+tcp,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=syn
 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,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=syn
 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,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=syn
 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 - table-miss flow (OpenFlow 1.4)])
 OVS_VSWITCHD_START([dnl
-- 
1.9.1

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v2] ofproto: support OFPR_GROUP reason for OF1.4 packet-in.

2014-11-21 Thread Shu Shen
Hi,

I'd like to withdraw the previous submission. I'm trying to improve it by 
splitting into smaller commits.

Please see the first few patches that add tests and fix current bugs related to 
Packet-In:
- [ovs-dev] [PATCH 1/2] ofproto-dpif: add test case for OF1.4 packet-in, 
http://openvswitch.org/pipermail/dev/2014-November/049093.html
- [ovs-dev] [PATCH 2/2] ofproto-dpif: fix OF1.4 packet-in wire  protocol 
version, http://openvswitch.org/pipermail/dev/2014-November/049094.html
- [ovs-dev] [PATCH] ofproto: fix checking of packet_in_mask in asyncconfig, 
 http://openvswitch.org/pipermail/dev/2014-November/049117.html

Support of OFPR_GROUP will come later as another patch.

Hope this improvement will help review and increase the chance to be accepted 
:-).

Thanks,
Shu


-Original Message-
From: Shu Shen 
Sent: Thursday, November 13, 2014 9:57 AM
To: dev@openvswitch.org
Cc: Shu Shen
Subject: [PATCH v2] ofproto: support OFPR_GROUP reason for OF1.4 packet-in.

Use wire_reason() to translate between different OF versions.
OF1.3 and earlier will still use OFPR_ACTION instead of
OFPR_GROUP.

Async config is initiated and checked againt OF version to
make sure OFPR_GROUP is only reported for OF1.4+. Controllers
running OF1.3+ cannot override the mask and enable OFPR_GROUP
reporting.

Signed-off-by: Shu Shen 
---
 DESIGN.md|  1 +
 OPENFLOW-1.1+.md |  1 +
 lib/ofp-msgs.h   |  2 +-
 lib/ofp-util.c   |  4 +-
 ofproto/connmgr.c| 41 +++--
 ofproto/ofproto-dpif-xlate.c |  2 +-
 tests/ofproto-dpif.at| 88 
 7 files changed, 131 insertions(+), 8 deletions(-)

diff --git a/DESIGN.md b/DESIGN.md
index bd0ed27..ff5bdf4 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -54,6 +54,7 @@ sent, an entry labeled "---" means that the message is 
suppressed.
 OFPR_NO_MATCH  yes   ---
 OFPR_ACTIONyes   ---
 OFPR_INVALID_TTL   ---   ---
+OFPR_GROUP (OF1.4+)yes   ---
 
   OFPT_FLOW_REMOVED / NXT_FLOW_REMOVED
 OFPRR_IDLE_TIMEOUT yes   ---
diff --git a/OPENFLOW-1.1+.md b/OPENFLOW-1.1+.md
index 07f7f86..96c25b9 100644
--- a/OPENFLOW-1.1+.md
+++ b/OPENFLOW-1.1+.md
@@ -180,6 +180,7 @@ OpenFlow 1.4
   * More descriptive reasons for packet-in
 Distinguish OFPR_APPLY_ACTION, OFPR_ACTION_SET, OFPR_GROUP,
 OFPR_PACKET_OUT.  NO_MATCH was renamed to OFPR_TABLE_MISS.
+(OFPR_GROUP is now supported)
 [EXT-136]
 [required for OF1.4+]
 
diff --git a/lib/ofp-msgs.h b/lib/ofp-msgs.h
index fc69586..ad6dc6f 100644
--- a/lib/ofp-msgs.h
+++ b/lib/ofp-msgs.h
@@ -148,7 +148,7 @@ enum ofpraw {
 OFPRAW_OFPT11_PACKET_IN,
 /* OFPT 1.2 (10): struct ofp12_packet_in, uint8_t[]. */
 OFPRAW_OFPT12_PACKET_IN,
-/* OFPT 1.3 (10): struct ofp13_packet_in, uint8_t[]. */
+/* OFPT 1.3+ (10): struct ofp13_packet_in, uint8_t[]. */
 OFPRAW_OFPT13_PACKET_IN,
 /* NXT 1.0+ (17): struct nx_packet_in, uint8_t[]. */
 OFPRAW_NXT_PACKET_IN,
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 94047fa..86cf8a1 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -3527,7 +3527,7 @@ ofputil_encode_ofp12_packet_in(const struct 
ofputil_packet_in *pin,
 packet_in_size = sizeof (struct ofp12_packet_in);
 } else {
 packet_in_raw = OFPRAW_OFPT13_PACKET_IN;
-packet_in_version = OFP13_VERSION;
+packet_in_version = ofputil_protocol_to_ofp_version(protocol);
 packet_in_size = sizeof (struct ofp13_packet_in);
 }
 
@@ -3547,7 +3547,7 @@ ofputil_encode_ofp12_packet_in(const struct 
ofputil_packet_in *pin,
 opi->pi.total_len = htons(pin->total_len);
 opi->pi.reason = pin->reason;
 opi->pi.table_id = pin->table_id;
-if (protocol == OFPUTIL_P_OF13_OXM) {
+if (protocol & OFPUTIL_P_OF13_UP) {
 opi->cookie = pin->cookie;
 }
 
diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index 627f326..25a52fc 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -996,6 +996,14 @@ void
 ofconn_set_protocol(struct ofconn *ofconn, enum ofputil_protocol protocol)
 {
 ofconn->protocol = protocol;
+if (!(protocol & OFPUTIL_P_OF14_UP)) {
+uint32_t *master = ofconn->master_async_config;
+uint32_t *slave = ofconn->slave_async_config;
+
+/* OFPR_GROUP is not supported before OF1.4 */
+master[OAM_PACKET_IN] &= ~(1u << OFPR_GROUP);
+slave [OAM_PACKET_IN] &= ~(1u << OFPR_GROUP);
+}
 }
 
 /* Returns the currently configured packet in format for 'ofconn', one of
@@ -1056,6 +1064,13 @@ ofconn_get_async_config(struct ofconn *ofconn,
 uint32_t *master_masks, uint32_t *slave_masks)
 {
 size_t size = sizeof ofconn->master_async_config;
+
+/* Make sure we know the protocol version and the async_config
+ * masks ar

Re: [ovs-dev] [PATCHv10 ovs 01/15] tests: Add command to purge revalidators of flows.

2014-11-21 Thread Joe Stringer
Thanks, pushed to master.

On 21 November 2014 13:05, Jarno Rajahalme  wrote:
> Looks good to me,
>
>   Jarno
>
> Acked-by: Jarno Rajahalme 
>
>> On Nov 21, 2014, at 12:52 PM, Joe Stringer  wrote:
>>
>> Jarno, do you have time to look at this?
>>
>>> On 13 November 2014 11:17, Joe Stringer  wrote:
>>> This patch adds a new 'ovs-appctl revalidator/purge' command which
>>> flushes all flows from all datapaths, and updates the revalidator
>>> udpif_key cache at the same time.
>>>
>>> Update the ofproto-dpif fragment tests which may fail when ukeys are
>>> created from handler threads.
>>>
>>> Signed-off-by: Joe Stringer 
>>> CC: Jarno Rajahalme 
>>> ---
>>> v10: First post.
>>> ---
>>> ofproto/ofproto-dpif-upcall.c |   20 
>>> tests/ofproto-dpif.at |8 
>>> 2 files changed, 24 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
>>> index 1f9c484..eba9816 100644
>>> --- a/ofproto/ofproto-dpif-upcall.c
>>> +++ b/ofproto/ofproto-dpif-upcall.c
>>> @@ -234,6 +234,8 @@ static void upcall_unixctl_set_flow_limit(struct 
>>> unixctl_conn *conn, int argc,
>>> const char *argv[], void *aux);
>>> static void upcall_unixctl_dump_wait(struct unixctl_conn *conn, int argc,
>>>  const char *argv[], void *aux);
>>> +static void upcall_unixctl_purge(struct unixctl_conn *conn, int argc,
>>> + const char *argv[], void *aux);
>>>
>>> static struct udpif_key *ukey_create(const struct nlattr *key, size_t 
>>> key_len,
>>>  long long int used);
>>> @@ -273,6 +275,8 @@ udpif_create(struct dpif_backer *backer, struct dpif 
>>> *dpif)
>>>  upcall_unixctl_set_flow_limit, NULL);
>>> unixctl_command_register("revalidator/wait", "", 0, 0,
>>>  upcall_unixctl_dump_wait, NULL);
>>> +unixctl_command_register("revalidator/purge", "", 0, 0,
>>> + upcall_unixctl_purge, NULL);
>>> ovsthread_once_done(&once);
>>> }
>>>
>>> @@ -1768,3 +1772,19 @@ upcall_unixctl_dump_wait(struct unixctl_conn *conn,
>>> unixctl_command_reply_error(conn, "can't wait on multiple udpifs.");
>>> }
>>> }
>>> +
>>> +static void
>>> +upcall_unixctl_purge(struct unixctl_conn *conn, int argc OVS_UNUSED,
>>> + const char *argv[] OVS_UNUSED, void *aux OVS_UNUSED)
>>> +{
>>> +struct udpif *udpif;
>>> +
>>> +LIST_FOR_EACH (udpif, list_node, &all_udpifs) {
>>> +int n;
>>> +
>>> +for (n = 0; n < udpif->n_revalidators; n++) {
>>> +revalidator_purge(&udpif->revalidators[n]);
>>> +}
>>> +}
>>> +unixctl_command_reply(conn, "");
>>> +}
>>> diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
>>> index 5349386..eb4d4cb 100644
>>> --- a/tests/ofproto-dpif.at
>>> +++ b/tests/ofproto-dpif.at
>>> @@ -3410,7 +3410,7 @@ 
>>> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), 
>>> packets:0, b
>>>
>>> mode=drop
>>>
>>> -AT_CHECK([ovs-appctl dpctl/del-flows], [0])
>>> +AT_CHECK([ovs-appctl revalidator/purge], [0])
>>> AT_CHECK([ovs-ofctl set-frags br0 $mode])
>>> for type in no first later; do
>>>   eval flow=\$${type}_flow
>>> @@ -3427,7 +3427,7 @@ 
>>> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=later), packets:0, 
>>> bytes:0,
>>>
>>> mode=nx-match
>>>
>>> -AT_CHECK([ovs-appctl dpctl/del-flows], [0])
>>> +AT_CHECK([ovs-appctl revalidator/purge], [0])
>>> AT_CHECK([ovs-ofctl set-frags br0 $mode])
>>> for type in no first later; do
>>>   eval flow=\$${type}_flow
>>> @@ -3513,7 +3513,7 @@ 
>>> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=33419
>>> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), 
>>> packets:1, bytes:74, used:0.001s, actions:1
>>> ])
>>>
>>> -AT_CHECK([ovs-appctl dpctl/del-flows], [0])
>>> +AT_CHECK([ovs-appctl revalidator/purge], [0])
>>> AT_CHECK([ovs-ofctl set-frags br0 $mode])
>>> for frag in 4000 6000 6008 4010; do
>>>   printf "\n%s\n" "$mode $frag truncated transport header -"
>>> @@ -3527,7 +3527,7 @@ 
>>> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0),
>>>  p
>>> recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), 
>>> packets:1, bytes:60, used:0.001s, actions:1
>>> ])
>>>
>>> -AT_CHECK([ovs-appctl dpctl/del-flows], [0])
>>> +AT_CHECK([ovs-appctl revalidator/purge], [0])
>>> AT_CHECK([ovs-ofctl set-frags br0 $mode])
>>> for frag in 4000 6000 6001 4002; do
>>>   printf "\n%s\n" "$mode $frag missing transport header-"
>>> --
>>> 1.7.10.4
>>>
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev