[ovs-dev] [PATCH v7] ofproto-dpif-ipfix: add interface Information Elements to flow key

2018-01-10 Thread Michal Weglicki
Extend flow key part of data record to include following Information Elements:
- ingressInterface
- ingressInterfaceType
- egressInterface
- egressInterfaceType
- interfaceName
- interfaceDescription

In case of input sampling we don't have information about egress port.
Define templates depending not only on protocol types, but also on flow
direction. Only egress flow will include egress information elements.

With this change, dpif_ipfix_exporter stores every port in hmap rather
than only tunnel ports. It allows to easily retrieve required
information about interfaces during sampling upcalls.

v1->v2
* Add interfaceType and interfaceDescription
* Rework ipfix_get_iface_data_record function
v2->v3: Code rebase.
v3->v4: Minor comments applied.
v4->v5: Clang complation problem fix.
v6->v7: Code rebase.

Co-authored-by: Michal Weglicki <michalx.wegli...@intel.com>
Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczer...@intel.com>
---
 ofproto/ofproto-dpif-ipfix.c | 358 +++
 ofproto/ofproto-dpif-ipfix.h |   6 +-
 ofproto/ofproto-dpif-xlate.c |   4 +-
 ofproto/ofproto-dpif.c   |  19 +--
 4 files changed, 277 insertions(+), 110 deletions(-)

diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c
index 2a43537..f691c70 100644
--- a/ofproto/ofproto-dpif-ipfix.c
+++ b/ofproto/ofproto-dpif-ipfix.c
@@ -115,11 +115,12 @@ struct dpif_ipfix_global_stats {
 };
 
 struct dpif_ipfix_port {
-struct hmap_node hmap_node; /* In struct dpif_ipfix's "tunnel_ports" hmap. 
*/
+struct hmap_node hmap_node; /* In struct dpif_ipfix's "ports" hmap. */
 struct ofport *ofport;  /* To retrieve port stats. */
 odp_port_t odp_port;
 enum dpif_ipfix_tunnel_type tunnel_type;
 uint8_t tunnel_key_length;
+uint32_t ifindex;
 };
 
 struct dpif_ipfix_exporter {
@@ -157,9 +158,9 @@ struct dpif_ipfix_flow_exporter_map_node {
 struct dpif_ipfix {
 struct dpif_ipfix_bridge_exporter bridge_exporter;
 struct hmap flow_exporter_map;  /* dpif_ipfix_flow_exporter_map_node. */
-struct hmap tunnel_ports;   /* Contains "struct dpif_ipfix_port"s.
- * It makes tunnel port lookups faster in
- * sampling upcalls. */
+struct hmap ports;  /* Contains "struct dpif_ipfix_port"s.
+ * It makes port lookups faster in sampling
+ * upcalls. */
 struct ovs_refcount ref_cnt;
 };
 
@@ -293,7 +294,8 @@ BUILD_ASSERT_DECL(sizeof(struct 
ipfix_template_field_specifier) == 8);
 /* Cf. IETF RFC 5102 Section 5.11.6. */
 enum ipfix_flow_direction {
 INGRESS_FLOW = 0x00,
-EGRESS_FLOW = 0x01
+EGRESS_FLOW = 0x01,
+NUM_IPFIX_FLOW_DIRECTION
 };
 
 /* Part of data record flow key for common metadata and Ethernet entities. */
@@ -308,6 +310,18 @@ struct ipfix_data_record_flow_key_common {
 });
 BUILD_ASSERT_DECL(sizeof(struct ipfix_data_record_flow_key_common) == 20);
 
+/* Part of data record flow key for interface information. Since some of the
+ * elements have variable length, members of this structure should be appended
+ * to the 'struct dp_packet' one by one. */
+struct ipfix_data_record_flow_key_iface {
+ovs_be32 if_index; /* (INGRESS | EGRESS)_INTERFACE */
+ovs_be32 if_type; /* (INGRESS | EGRESS)_INTERFACE_TYPE */
+uint8_t if_name_len;   /* Variable length element: INTERFACE_NAME */
+char *if_name;
+uint8_t if_descr_len; /* Variable length element: INTERFACE_DESCRIPTION */
+char *if_descr;
+};
+
 /* Part of data record flow key for VLAN entities. */
 OVS_PACKED(
 struct ipfix_data_record_flow_key_vlan {
@@ -745,7 +759,7 @@ dpif_ipfix_find_port(const struct dpif_ipfix *di,
 struct dpif_ipfix_port *dip;
 
 HMAP_FOR_EACH_IN_BUCKET (dip, hmap_node, hash_odp_port(odp_port),
- >tunnel_ports) {
+ >ports) {
 if (dip->odp_port == odp_port) {
 return dip;
 }
@@ -754,82 +768,116 @@ dpif_ipfix_find_port(const struct dpif_ipfix *di,
 }
 
 static void
-dpif_ipfix_del_port(struct dpif_ipfix *di,
+dpif_ipfix_del_port__(struct dpif_ipfix *di,
   struct dpif_ipfix_port *dip)
 OVS_REQUIRES(mutex)
 {
-hmap_remove(>tunnel_ports, >hmap_node);
+hmap_remove(>ports, >hmap_node);
 free(dip);
 }
 
+static enum dpif_ipfix_tunnel_type
+dpif_ipfix_tunnel_type(const struct ofport *ofport)
+{
+const char *type = netdev_get_type(ofport->netdev);
+
+if (type == NULL) {
+return DPIF_IPFIX_TUNNEL_UNKNOWN;
+}
+if (strcmp(type, "gre") == 0) {
+return DPIF_IPFIX_TUNNEL_GRE;
+} else if (strcmp(type, "vxlan") == 0) {
+return DPIF_IPFIX_TUNNEL_VXLAN;
+   

[ovs-dev] [PATCH v4] netdev: Custom statistics.

2018-01-09 Thread Michal Weglicki
- New get_custom_stats interface function is added to netdev. It
  allows particular netdev implementation to expose custom
  counters in dictionary format (counter name/counter value).
- New statistics are retrieved using experimenter code and
  are printed as a result to ofctl dump-ports.
- New counters are available for OpenFlow 1.4+.
- New statistics are printed to output via ofctl only if those
  are present in reply message.
- New statistics definition is added to include/openflow/intel-ext.h.
- Custom statistics are implemented only for dpdk-physical
  port type.
- DPDK-physical implementation uses xstats to collect statistics.
  Only dropped and error counters are exposed.

v1->v2:
- Buffer overrun check in parse_intel_port_custom_property.
- ofputil_append_ofp14_port_stats uses "postappend" instead
  of "reserve" during message creation.
- NEWS update.
- DPDK documentation update.
- Compilation and sparse warnings corrections.
v2->v3:
- Netdev statistics and custom statistics are inserted into
  ovsdb at the same time (in single transaction).
- ofproto_class function has been removed, direct call is
  used instead.
- Current "dump ports" test case has been adjusted to check
  also custom counters.
- Some other minor corrections.
v3->v4:
- netdev-dpdk: "management" counters are added to custom
  statistics.

Co-authored-by: Ben Pfaff <b...@ovn.org>
Signed-off-by: Ben Pfaff <b...@ovn.org>
Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
---
 Documentation/howto/dpdk.rst   |  15 ++--
 NEWS   |   5 ++
 include/openflow/intel-ext.h   |  28 ++
 include/openvswitch/netdev.h   |  17 
 include/openvswitch/ofp-util.h |   1 +
 lib/netdev-dpdk.c  | 193 -
 lib/netdev-dummy.c |  36 
 lib/netdev-linux.c |   1 +
 lib/netdev-provider.h  |  13 +++
 lib/netdev-vport.c |   1 +
 lib/netdev.c   |  27 ++
 lib/netdev.h   |   2 +
 lib/ofp-print.c|  18 
 lib/ofp-util.c | 106 --
 lib/util.c |  13 +++
 lib/util.h |   2 +
 ofproto/ofproto.c  |   3 +
 tests/ofproto.at   |   6 +-
 vswitchd/bridge.c  |  36 ++--
 19 files changed, 503 insertions(+), 20 deletions(-)

diff --git a/Documentation/howto/dpdk.rst b/Documentation/howto/dpdk.rst
index 2393c2f..587aaed 100644
--- a/Documentation/howto/dpdk.rst
+++ b/Documentation/howto/dpdk.rst
@@ -311,12 +311,16 @@ performance of non-tunnel traffic, specifically for 
smaller size packet.
 
 .. _extended-statistics:
 
-Extended Statistics

+Extended & Custom Statistics
+
 
 DPDK Extended Statistics API allows PMD to expose unique set of statistics.
 The Extended statistics are implemented and supported only for DPDK physical
-and vHost ports.
+and vHost ports. Custom statistics are dynamic set of counters which can
+vary depenend on a driver. Those statistics are implemented
+for DPDK physical ports and contain all "dropped", "error" and "management"
+counters from XSTATS. XSTATS counters list can be found here:
+<https://wiki.opnfv.org/display/fastpath/Collectd+Metrics+and+Events>`__.
 
 To enable statistics, you have to enable OpenFlow 1.4 support for OVS.
 Configure bridge br0 to support OpenFlow version 1.4::
@@ -333,8 +337,9 @@ Query the port statistics by explicitly specifying -O 
OpenFlow14 option::
 
 $ ovs-ofctl -O OpenFlow14 dump-ports br0
 
-Note: vHost ports supports only partial statistics. RX packet size based
-counter are only supported and doesn't include TX packet size counters.
+Note about "Extended Statistics": vHost ports supports only partial
+statistics. RX packet size based counter are only supported and
+doesn't include TX packet size counters.
 
 .. _port-hotplug:
 
diff --git a/NEWS b/NEWS
index a7f2def..9d95434 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,11 @@ Post-v2.8.0
  * Add support for vHost IOMMU
  * New debug appctl command 'netdev-dpdk/get-mempool-info'.
  * All the netdev-dpdk appctl commands described in ovs-vswitchd man page.
+ * Custom statistics:
+- DPDK physical ports now return custom set of "dropped", "error" and
+  "management" statistics.
+- ovs-ofctl dump-ports command now prints new of set custom statistics
+  if available (for OpenFlow 1.4+).
- vswitchd:
  * Datapath IDs may now be specified as 0x1 (etc.) instead of 16 digits.
 
diff --git a/include/openflow/intel-ext.h b/include/openflow/intel-ext.h
index 974e63e..3d73171 100644
--- a/include/openflow/intel-ext.h
+++ b/include/openflow/intel-ext.h
@@ -27,9 +27,11 @@
 
 enum intel_port_stats_subtype {
 INTEL_PORT_STA

[ovs-dev] [PATCH v3] netdev: Custom statistics.

2018-01-08 Thread Michal Weglicki
- New get_custom_stats interface function is added to netdev. It
  allows particular netdev implementation to expose custom
  counters in dictionary format (counter name/counter value).
- New statistics are retrieved using experimenter code and
  are printed as a result to ofctl dump-ports.
- New counters are available for OpenFlow 1.4+.
- New statistics are printed to output via ofctl only if those
  are present in reply message.
- New statistics definition is added to include/openflow/intel-ext.h.
- Custom statistics are implemented only for dpdk-physical
  port type.
- DPDK-physical implementation uses xstats to collect statistics.
  Only dropped and error counters are exposed.

v1->v2:
- Buffer overrun check in parse_intel_port_custom_property.
- ofputil_append_ofp14_port_stats uses "postappend" instead
  of "reserve" during message creation.
- NEWS update.
- DPDK documentation update.
- Compilation and sparse warnings corrections.
v2->v3
- Netdev statistics and custom statistics are inserted into
  ovsdb at the same time (in single transaction).
- ofproto_class function has been removed, direct call is
  used instead.
- Current "dump ports" test case has been adjusted to check
  also custom counters.
- Some other minor corrections.

Co-authored-by: Ben Pfaff <b...@ovn.org>
Signed-off-by: Ben Pfaff <b...@ovn.org>
Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
---
 Documentation/howto/dpdk.rst   |  15 ++--
 NEWS   |   5 ++
 include/openflow/intel-ext.h   |  28 ++
 include/openvswitch/netdev.h   |  17 
 include/openvswitch/ofp-util.h |   1 +
 lib/netdev-dpdk.c  | 192 -
 lib/netdev-dummy.c |  36 
 lib/netdev-linux.c |   1 +
 lib/netdev-provider.h  |  13 +++
 lib/netdev-vport.c |   1 +
 lib/netdev.c   |  27 ++
 lib/netdev.h   |   2 +
 lib/ofp-print.c|  18 
 lib/ofp-util.c | 106 +--
 lib/util.c |  13 +++
 lib/util.h |   2 +
 ofproto/ofproto.c  |   3 +
 tests/ofproto.at   |   6 +-
 vswitchd/bridge.c  |  36 ++--
 19 files changed, 502 insertions(+), 20 deletions(-)

diff --git a/Documentation/howto/dpdk.rst b/Documentation/howto/dpdk.rst
index 2393c2f..4061e40 100644
--- a/Documentation/howto/dpdk.rst
+++ b/Documentation/howto/dpdk.rst
@@ -311,12 +311,16 @@ performance of non-tunnel traffic, specifically for 
smaller size packet.
 
 .. _extended-statistics:
 
-Extended Statistics

+Extended & Custom Statistics
+
 
 DPDK Extended Statistics API allows PMD to expose unique set of statistics.
 The Extended statistics are implemented and supported only for DPDK physical
-and vHost ports.
+and vHost ports. Custom statistics are dynamic set of counters which can
+vary depenend on a driver. Those statistics are implemented
+for DPDK physical ports and contain all "dropped" and "error"
+counters from XSTATS. XSTATS counters list can be found here:
+<https://wiki.opnfv.org/display/fastpath/Collectd+Metrics+and+Events>`__.
 
 To enable statistics, you have to enable OpenFlow 1.4 support for OVS.
 Configure bridge br0 to support OpenFlow version 1.4::
@@ -333,8 +337,9 @@ Query the port statistics by explicitly specifying -O 
OpenFlow14 option::
 
 $ ovs-ofctl -O OpenFlow14 dump-ports br0
 
-Note: vHost ports supports only partial statistics. RX packet size based
-counter are only supported and doesn't include TX packet size counters.
+Note about "Extended Statistics": vHost ports supports only partial
+statistics. RX packet size based counter are only supported and
+doesn't include TX packet size counters.
 
 .. _port-hotplug:
 
diff --git a/NEWS b/NEWS
index a7f2def..28b9d5a 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,11 @@ Post-v2.8.0
  * Add support for vHost IOMMU
  * New debug appctl command 'netdev-dpdk/get-mempool-info'.
  * All the netdev-dpdk appctl commands described in ovs-vswitchd man page.
+ * Custom statistics:
+- DPDK physical ports now return custom set of "dropped" and "error"
+  statistics.
+- ovs-ofctl dump-ports command now prints new of set custom statistics
+  if available (for OpenFlow 1.4+).
- vswitchd:
  * Datapath IDs may now be specified as 0x1 (etc.) instead of 16 digits.
 
diff --git a/include/openflow/intel-ext.h b/include/openflow/intel-ext.h
index 974e63e..3d73171 100644
--- a/include/openflow/intel-ext.h
+++ b/include/openflow/intel-ext.h
@@ -27,9 +27,11 @@
 
 enum intel_port_stats_subtype {
 INTEL_PORT_STATS_RFC2819 = 1,
+INTEL_PORT_STATS_CUSTOM
 };
 
 #define INTEL_PORT_STATS_RFC2819_SIZE 184
+#define INTEL_PORT_STATS_CUSTOM_SIZE 

[ovs-dev] [PATCH v2] netdev: Custom statistics.

2017-12-05 Thread Michal Weglicki
- New get_custom_stats interface function is added to netdev. It
  allows particular netdev implementation to expose custom
  counters in dictionary format (counter name/counter value).
- New statistics are retrieved using experimenter code and
  are printed as a result to ofctl dump-ports.
- New counters are available for OpenFlow 1.4+.
- New statistics are printed to output via ofctl only if those
  are present in reply message.
- New statistics definition is added to include/openflow/intel-ext.h.
- Custom statistics are implemented only for dpdk-physical
  port type.
- DPDK-physical implementation uses xstats to collect statistics.
  Only dropped and error counters are exposed.

v1->v2:
- Buffer overrun check in parse_intel_port_custom_property.
- ofputil_append_ofp14_port_stats uses "postappend" instead
  of "reserve" during message creation.
- NEWS update.
- DPDK documentation update.
- Compilation and sparse warnings corrections.

Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
---
 Documentation/howto/dpdk.rst   |  15 ++--
 NEWS   |   6 ++
 include/openflow/intel-ext.h   |  28 ++
 include/openvswitch/netdev.h   |  17 
 include/openvswitch/ofp-util.h |   1 +
 lib/netdev-dpdk.c  | 195 -
 lib/netdev-dummy.c |   1 +
 lib/netdev-linux.c |   1 +
 lib/netdev-provider.h  |  13 +++
 lib/netdev-vport.c |   1 +
 lib/netdev.c   |  27 ++
 lib/netdev.h   |   2 +
 lib/ofp-print.c|  18 
 lib/ofp-util.c | 119 +++--
 lib/util.c |  13 +++
 lib/util.h |   2 +
 ofproto/ofproto-dpif.c |  13 +++
 ofproto/ofproto-provider.h |   4 +
 ofproto/ofproto.c  |  21 +
 ofproto/ofproto.h  |   3 +
 vswitchd/bridge.c  |  24 +
 21 files changed, 512 insertions(+), 12 deletions(-)

diff --git a/Documentation/howto/dpdk.rst b/Documentation/howto/dpdk.rst
index d123819..c99ec29 100644
--- a/Documentation/howto/dpdk.rst
+++ b/Documentation/howto/dpdk.rst
@@ -311,12 +311,16 @@ performance of non-tunnel traffic, specifically for 
smaller size packet.
 
 .. _extended-statistics:
 
-Extended Statistics

+Extended & Custom Statistics
+
 
 DPDK Extended Statistics API allows PMD to expose unique set of statistics.
 The Extended statistics are implemented and supported only for DPDK physical
-and vHost ports.
+and vHost ports. Custom statistics are dynamic set of counters which can
+vary depenend on a driver. Those statistics are implemented
+for DPDK physical ports and contain all "dropped" and "error"
+counters from XSTATS. XSTATS counters list can be found here:
+<https://wiki.opnfv.org/display/fastpath/Collectd+Metrics+and+Events>`__.
 
 To enable statistics, you have to enable OpenFlow 1.4 support for OVS.
 Configure bridge br0 to support OpenFlow version 1.4::
@@ -333,8 +337,9 @@ Query the port statistics by explicitly specifying -O 
OpenFlow14 option::
 
 $ ovs-ofctl -O OpenFlow14 dump-ports br0
 
-Note: vHost ports supports only partial statistics. RX packet size based
-counter are only supported and doesn't include TX packet size counters.
+Note about "Extended Statistics": vHost ports supports only partial
+statistics. RX packet size based counter are only supported and
+doesn't include TX packet size counters.
 
 .. _port-hotplug:
 
diff --git a/NEWS b/NEWS
index 427c8f8..727142c 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,12 @@ Post-v2.8.0
  * ovn-ctl: New commands run_nb_ovsdb and run_sb_ovsdb.
- Linux kernel 4.13
  * Add support for compiling OVS with the latest Linux 4.13 kernel
+   - DPDK:
+ * Custom statistics:
+- DPDK physical ports now return custom set of "dropped" and "error"
+  statistics.
+- ovs-ofctl dump-ports command now prints new of set custom statistics
+  if available (for OpenFlow 1.4+).
 
 v2.8.0 - 31 Aug 2017
 
diff --git a/include/openflow/intel-ext.h b/include/openflow/intel-ext.h
index 974e63e..3d73171 100644
--- a/include/openflow/intel-ext.h
+++ b/include/openflow/intel-ext.h
@@ -27,9 +27,11 @@
 
 enum intel_port_stats_subtype {
 INTEL_PORT_STATS_RFC2819 = 1,
+INTEL_PORT_STATS_CUSTOM
 };
 
 #define INTEL_PORT_STATS_RFC2819_SIZE 184
+#define INTEL_PORT_STATS_CUSTOM_SIZE 16
 
 /* Struct implements custom property type based on
  * 'ofp_prop_experimenter'. */
@@ -70,4 +72,30 @@ struct intel_port_stats_rfc2819 {
 OFP_ASSERT(sizeof (struct intel_port_stats_rfc2819) ==
INTEL_PORT_STATS_RFC2819_SIZE);
 
+/* Structure implements custom property type based on
+ * 'ofp_prop_experimenter'. It contains custom
+ * statistics in dictionary format */
+struct intel_port_custom_st

[ovs-dev] [PATCH] netdev: Custom statistics.

2017-11-28 Thread Michal Weglicki
- New get_custom_stats interface function is added to netdev. It
  allows particular netdev implementation to expose custom
  counters in dictionary format (counter name/counter value).
- New statistics are retrieved using experimenter code and
  are printed as a result to ofctl dump-ports.
- New counters are available for OpenFlow 1.4+.
- New statistics are printed to output via ofctl only if those
  are present in reply message.
- New statistics definition is added to include/openflow/intel-ext.h.
- Custom statistics are implemented only for dpdk-physical
  port type.
- DPDK-physical implementation uses xstats to collect statistics.
  Only dropped and error counters are exposed.

Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
---
 include/openflow/intel-ext.h   |  28 ++
 include/openvswitch/netdev.h   |  18 
 include/openvswitch/ofp-util.h |   1 +
 lib/netdev-dpdk.c  | 195 -
 lib/netdev-dummy.c |   1 +
 lib/netdev-linux.c |   1 +
 lib/netdev-provider.h  |  13 +++
 lib/netdev-vport.c |   1 +
 lib/netdev.c   |  50 +++
 lib/netdev.h   |   2 +
 lib/ofp-print.c|  16 
 lib/ofp-util.c |  89 ++-
 lib/string.c   |  10 +++
 ofproto/ofproto-dpif.c |  13 +++
 ofproto/ofproto-provider.h |   4 +
 ofproto/ofproto.c  |  21 +
 ofproto/ofproto.h  |   3 +
 vswitchd/bridge.c  |  24 +
 18 files changed, 485 insertions(+), 5 deletions(-)

diff --git a/include/openflow/intel-ext.h b/include/openflow/intel-ext.h
index 974e63e..3d73171 100644
--- a/include/openflow/intel-ext.h
+++ b/include/openflow/intel-ext.h
@@ -27,9 +27,11 @@
 
 enum intel_port_stats_subtype {
 INTEL_PORT_STATS_RFC2819 = 1,
+INTEL_PORT_STATS_CUSTOM
 };
 
 #define INTEL_PORT_STATS_RFC2819_SIZE 184
+#define INTEL_PORT_STATS_CUSTOM_SIZE 16
 
 /* Struct implements custom property type based on
  * 'ofp_prop_experimenter'. */
@@ -70,4 +72,30 @@ struct intel_port_stats_rfc2819 {
 OFP_ASSERT(sizeof (struct intel_port_stats_rfc2819) ==
INTEL_PORT_STATS_RFC2819_SIZE);
 
+/* Structure implements custom property type based on
+ * 'ofp_prop_experimenter'. It contains custom
+ * statistics in dictionary format */
+struct intel_port_custom_stats {
+ovs_be16 type;  /* OFPPSPT14_EXPERIMENTER. */
+ovs_be16 length;/* Length in bytes of this property excluding
+ * trailing padding. */
+ovs_be32 experimenter;  /* INTEL_VENDOR_ID. */
+ovs_be32 exp_type;  /* INTEL_PORT_STATS_*. */
+
+uint8_t pad[2];
+ovs_be16 stats_array_size;  /* number of counters. */
+
+/* Followed by:
+ *   - Exactly 'stats_array_size' array elements of
+ * dynamic structure which contains:
+ * - "NAME SIZE" - counter name size (number of characters)
+ * - "COUNTER NAME" - Exact number of characters
+ *   defined by "NAME SIZE".
+ * - "COUNTER VALUE" -  ovs_be64 counter value,
+ *   - Zero or more bytes to fill out the
+ * overall length in header.length. */
+};
+OFP_ASSERT(sizeof(struct intel_port_custom_stats) ==
+  INTEL_PORT_STATS_CUSTOM_SIZE);
+
 #endif /* openflow/intel-ext.h */
diff --git a/include/openvswitch/netdev.h b/include/openvswitch/netdev.h
index 50bafc3..0e269ac 100644
--- a/include/openvswitch/netdev.h
+++ b/include/openvswitch/netdev.h
@@ -27,6 +27,9 @@ extern "C" {
 
 struct netdev;
 
+/* Maximum name length for custom statistics counters */
+#define NETDEV_CUSTOM_STATS_NAME_SIZE 64
+
 /* Network device statistics.
  *
  * Values of unsupported statistics are set to all-1-bits (UINT64_MAX). */
@@ -85,6 +88,18 @@ struct netdev_stats {
 uint64_t rx_jabber_errors;
 };
 
+/* Structure representation of custom statistics counter */
+struct netdev_custom_counter {
+uint64_t value;
+char name[NETDEV_CUSTOM_STATS_NAME_SIZE];
+};
+
+/* Structure representation of custom statistics */
+struct netdev_custom_stats {
+uint32_t size;
+struct netdev_custom_counter *counters;
+};
+
 /* Features. */
 enum netdev_features {
 NETDEV_F_10MB_HD =1 << 0,  /* 10 Mb half-duplex rate support. */
@@ -115,6 +130,9 @@ uint64_t netdev_features_to_bps(enum netdev_features 
features,
 bool netdev_features_is_full_duplex(enum netdev_features features);
 int netdev_set_advertisements(struct netdev *, enum netdev_features advertise);
 
+void netdev_free_custom_stats_counters(struct netdev_custom_stats *);
+unsigned int netdev_get_custom_stats_size(const struct netdev_custom_stats *);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/openvswitch/ofp-util.h b/include/openvswitch/ofp-util.h
index a9e57ed..296078a 100644
--- a/include/openvswitch/ofp-

[ovs-dev] [PATCH v6 1/2] netdev-dpdk: extend netdev_dpdk_get_status to include if_type and if_descr

2017-11-14 Thread Michal Weglicki
This commit extends netdev_dpdk_get_status API to include additional
driver-related information: if_type and if_descr.

v2->v3: Code rebase.
v3->v4: Minor comments applied.
v5->v6: Adds DPDK port specific description in documentation.

Co-authored-by: Michal Weglicki <michalx.wegli...@intel.com>
Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczer...@intel.com>
---
 lib/netdev-dpdk.c|  9 
 vswitchd/vswitch.xml | 64 
 2 files changed, 73 insertions(+)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 76e79be..3560bdd 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "dirs.h"
 #include "dp-packet.h"
@@ -2509,6 +2510,14 @@ netdev_dpdk_get_status(const struct netdev *netdev, 
struct smap *args)
 smap_add_format(args, "max_vfs", "%u", dev_info.max_vfs);
 smap_add_format(args, "max_vmdq_pools", "%u", dev_info.max_vmdq_pools);
 
+/* Querying the DPDK library for iftype may be done in future, pending
+ * support; cf. RFC 3635 Section 3.2.4. */
+enum { IF_TYPE_ETHERNETCSMACD = 6 };
+
+smap_add_format(args, "if_type", "%"PRIu32, IF_TYPE_ETHERNETCSMACD);
+smap_add_format(args, "if_descr", "%s %s", rte_version(),
+   dev_info.driver_name);
+
 if (dev_info.pci_dev) {
 smap_add_format(args, "pci-vendor_id", "0x%u",
 dev_info.pci_dev->id.vendor_id);
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index c145e1a..72cf353 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -2815,6 +2815,70 @@ ovs-vsctl add-port br0 p0 -- set Interface p0 type=patch 
options:peer=p1 \
 Whether carrier is detected on .
   
+
+  
+
+  DPDK specific interface status options.
+
+
+  
+DPDK port ID.
+  
+
+  
+NUMA socket ID to which an Ethernet device is connected.
+  
+
+  
+Minimum size of RX buffer.
+  
+
+  
+Maximum configurable length of RX pkt.
+  
+
+  
+Maximum number of RX queues.
+  
+
+  
+Maximum number of TX queues.
+  
+
+  
+Maximum number of MAC addresses.
+  
+
+  
+Maximum number of hash MAC addresses for MTA and UTA.
+  
+
+  
+Maximum number of hash MAC addresses for MTA and UTA.
+Maximum number of VFs.
+  
+
+  
+Maximum number of VMDq pools.
+  
+
+  
+Interface type ID according to IANA ifTYPE MIB definitions.
+  
+
+  
+Interface description string.
+  
+
+  
+Vendor ID of PCI device.
+  
+
+  
+Device ID of PCI device.
+  
+
+  
 
 
 
-- 
1.8.3.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v6 2/2] ofproto-dpif-ipfix: add interface Information Elements to flow key

2017-11-14 Thread Michal Weglicki
Extend flow key part of data record to include following Information Elements:
- ingressInterface
- ingressInterfaceType
- egressInterface
- egressInterfaceType
- interfaceName
- interfaceDescription

In case of input sampling we don't have information about egress port.
Define templates depending not only on protocol types, but also on flow
direction. Only egress flow will include egress information elements.

With this change, dpif_ipfix_exporter stores every port in hmap rather
than only tunnel ports. It allows to easily retrieve required
information about interfaces during sampling upcalls.

v1->v2
* Add interfaceType and interfaceDescription
* Rework ipfix_get_iface_data_record function
v2->v3: Code rebase.
v3->v4: Minor comments applied.
v4->v5: Clang complation problem fix.

Co-authored-by: Michal Weglicki <michalx.wegli...@intel.com>
Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczer...@intel.com>
---
 ofproto/ofproto-dpif-ipfix.c | 358 +++
 ofproto/ofproto-dpif-ipfix.h |   6 +-
 ofproto/ofproto-dpif-xlate.c |   4 +-
 ofproto/ofproto-dpif.c   |  19 +--
 4 files changed, 277 insertions(+), 110 deletions(-)

diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c
index 4d16878..98a8e7e 100644
--- a/ofproto/ofproto-dpif-ipfix.c
+++ b/ofproto/ofproto-dpif-ipfix.c
@@ -115,11 +115,12 @@ struct dpif_ipfix_global_stats {
 };
 
 struct dpif_ipfix_port {
-struct hmap_node hmap_node; /* In struct dpif_ipfix's "tunnel_ports" hmap. 
*/
+struct hmap_node hmap_node; /* In struct dpif_ipfix's "ports" hmap. */
 struct ofport *ofport;  /* To retrieve port stats. */
 odp_port_t odp_port;
 enum dpif_ipfix_tunnel_type tunnel_type;
 uint8_t tunnel_key_length;
+uint32_t ifindex;
 };
 
 struct dpif_ipfix_exporter {
@@ -157,9 +158,9 @@ struct dpif_ipfix_flow_exporter_map_node {
 struct dpif_ipfix {
 struct dpif_ipfix_bridge_exporter bridge_exporter;
 struct hmap flow_exporter_map;  /* dpif_ipfix_flow_exporter_map_node. */
-struct hmap tunnel_ports;   /* Contains "struct dpif_ipfix_port"s.
- * It makes tunnel port lookups faster in
- * sampling upcalls. */
+struct hmap ports;  /* Contains "struct dpif_ipfix_port"s.
+ * It makes port lookups faster in sampling
+ * upcalls. */
 struct ovs_refcount ref_cnt;
 };
 
@@ -293,7 +294,8 @@ BUILD_ASSERT_DECL(sizeof(struct 
ipfix_template_field_specifier) == 8);
 /* Cf. IETF RFC 5102 Section 5.11.6. */
 enum ipfix_flow_direction {
 INGRESS_FLOW = 0x00,
-EGRESS_FLOW = 0x01
+EGRESS_FLOW = 0x01,
+NUM_IPFIX_FLOW_DIRECTION
 };
 
 /* Part of data record flow key for common metadata and Ethernet entities. */
@@ -308,6 +310,18 @@ struct ipfix_data_record_flow_key_common {
 });
 BUILD_ASSERT_DECL(sizeof(struct ipfix_data_record_flow_key_common) == 20);
 
+/* Part of data record flow key for interface information. Since some of the
+ * elements have variable length, members of this structure should be appended
+ * to the 'struct dp_packet' one by one. */
+struct ipfix_data_record_flow_key_iface {
+ovs_be32 if_index; /* (INGRESS | EGRESS)_INTERFACE */
+ovs_be32 if_type; /* (INGRESS | EGRESS)_INTERFACE_TYPE */
+uint8_t if_name_len;   /* Variable length element: INTERFACE_NAME */
+char *if_name;
+uint8_t if_descr_len; /* Variable length element: INTERFACE_DESCRIPTION */
+char *if_descr;
+};
+
 /* Part of data record flow key for VLAN entities. */
 OVS_PACKED(
 struct ipfix_data_record_flow_key_vlan {
@@ -745,7 +759,7 @@ dpif_ipfix_find_port(const struct dpif_ipfix *di,
 struct dpif_ipfix_port *dip;
 
 HMAP_FOR_EACH_IN_BUCKET (dip, hmap_node, hash_odp_port(odp_port),
- >tunnel_ports) {
+ >ports) {
 if (dip->odp_port == odp_port) {
 return dip;
 }
@@ -754,82 +768,116 @@ dpif_ipfix_find_port(const struct dpif_ipfix *di,
 }
 
 static void
-dpif_ipfix_del_port(struct dpif_ipfix *di,
+dpif_ipfix_del_port__(struct dpif_ipfix *di,
   struct dpif_ipfix_port *dip)
 OVS_REQUIRES(mutex)
 {
-hmap_remove(>tunnel_ports, >hmap_node);
+hmap_remove(>ports, >hmap_node);
 free(dip);
 }
 
+static enum dpif_ipfix_tunnel_type
+dpif_ipfix_tunnel_type(const struct ofport *ofport)
+{
+const char *type = netdev_get_type(ofport->netdev);
+
+if (type == NULL) {
+return DPIF_IPFIX_TUNNEL_UNKNOWN;
+}
+if (strcmp(type, "gre") == 0) {
+return DPIF_IPFIX_TUNNEL_GRE;
+} else if (strcmp(type, "vxlan") == 0) {
+return DPIF_IPFIX_TUNNEL_VXLAN;
+} else if

[ovs-dev] [PATCH v5 2/2] ofproto-dpif-ipfix: add interface Information Elements to flow key

2017-10-02 Thread Michal Weglicki
Extend flow key part of data record to include following Information Elements:
- ingressInterface
- ingressInterfaceType
- egressInterface
- egressInterfaceType
- interfaceName
- interfaceDescription

In case of input sampling we don't have information about egress port.
Define templates depending not only on protocol types, but also on flow
direction. Only egress flow will include egress information elements.

With this change, dpif_ipfix_exporter stores every port in hmap rather
than only tunnel ports. It allows to easily retrieve required
information about interfaces during sampling upcalls.

v1->v2
* Add interfaceType and interfaceDescription
* Rework ipfix_get_iface_data_record function
v2->v3: Code rebase.
v3->v4: Minor comments applied.
v4->v5: Clang complation problem fix.

Co-authored-by: Michal Weglicki <michalx.wegli...@intel.com>
Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczer...@intel.com>
---
 ofproto/ofproto-dpif-ipfix.c | 358 +++
 ofproto/ofproto-dpif-ipfix.h |   6 +-
 ofproto/ofproto-dpif-xlate.c |   4 +-
 ofproto/ofproto-dpif.c   |  19 +--
 4 files changed, 277 insertions(+), 110 deletions(-)

diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c
index 472c272..138c325 100644
--- a/ofproto/ofproto-dpif-ipfix.c
+++ b/ofproto/ofproto-dpif-ipfix.c
@@ -115,11 +115,12 @@ struct dpif_ipfix_global_stats {
 };
 
 struct dpif_ipfix_port {
-struct hmap_node hmap_node; /* In struct dpif_ipfix's "tunnel_ports" hmap. 
*/
+struct hmap_node hmap_node; /* In struct dpif_ipfix's "ports" hmap. */
 struct ofport *ofport;  /* To retrieve port stats. */
 odp_port_t odp_port;
 enum dpif_ipfix_tunnel_type tunnel_type;
 uint8_t tunnel_key_length;
+uint32_t ifindex;
 };
 
 struct dpif_ipfix_exporter {
@@ -157,9 +158,9 @@ struct dpif_ipfix_flow_exporter_map_node {
 struct dpif_ipfix {
 struct dpif_ipfix_bridge_exporter bridge_exporter;
 struct hmap flow_exporter_map;  /* dpif_ipfix_flow_exporter_map_node. */
-struct hmap tunnel_ports;   /* Contains "struct dpif_ipfix_port"s.
- * It makes tunnel port lookups faster in
- * sampling upcalls. */
+struct hmap ports;  /* Contains "struct dpif_ipfix_port"s.
+ * It makes port lookups faster in sampling
+ * upcalls. */
 struct ovs_refcount ref_cnt;
 };
 
@@ -293,7 +294,8 @@ BUILD_ASSERT_DECL(sizeof(struct 
ipfix_template_field_specifier) == 8);
 /* Cf. IETF RFC 5102 Section 5.11.6. */
 enum ipfix_flow_direction {
 INGRESS_FLOW = 0x00,
-EGRESS_FLOW = 0x01
+EGRESS_FLOW = 0x01,
+NUM_IPFIX_FLOW_DIRECTION
 };
 
 /* Part of data record flow key for common metadata and Ethernet entities. */
@@ -308,6 +310,18 @@ struct ipfix_data_record_flow_key_common {
 });
 BUILD_ASSERT_DECL(sizeof(struct ipfix_data_record_flow_key_common) == 20);
 
+/* Part of data record flow key for interface information. Since some of the
+ * elements have variable length, members of this structure should be appended
+ * to the 'struct dp_packet' one by one. */
+struct ipfix_data_record_flow_key_iface {
+ovs_be32 if_index; /* (INGRESS | EGRESS)_INTERFACE */
+ovs_be32 if_type; /* (INGRESS | EGRESS)_INTERFACE_TYPE */
+uint8_t if_name_len;   /* Variable length element: INTERFACE_NAME */
+char *if_name;
+uint8_t if_descr_len; /* Variable length element: INTERFACE_DESCRIPTION */
+char *if_descr;
+};
+
 /* Part of data record flow key for VLAN entities. */
 OVS_PACKED(
 struct ipfix_data_record_flow_key_vlan {
@@ -745,7 +759,7 @@ dpif_ipfix_find_port(const struct dpif_ipfix *di,
 struct dpif_ipfix_port *dip;
 
 HMAP_FOR_EACH_IN_BUCKET (dip, hmap_node, hash_odp_port(odp_port),
- >tunnel_ports) {
+ >ports) {
 if (dip->odp_port == odp_port) {
 return dip;
 }
@@ -754,82 +768,116 @@ dpif_ipfix_find_port(const struct dpif_ipfix *di,
 }
 
 static void
-dpif_ipfix_del_port(struct dpif_ipfix *di,
+dpif_ipfix_del_port__(struct dpif_ipfix *di,
   struct dpif_ipfix_port *dip)
 OVS_REQUIRES(mutex)
 {
-hmap_remove(>tunnel_ports, >hmap_node);
+hmap_remove(>ports, >hmap_node);
 free(dip);
 }
 
+static enum dpif_ipfix_tunnel_type
+dpif_ipfix_tunnel_type(const struct ofport *ofport)
+{
+const char *type = netdev_get_type(ofport->netdev);
+
+if (type == NULL) {
+return DPIF_IPFIX_TUNNEL_UNKNOWN;
+}
+if (strcmp(type, "gre") == 0) {
+return DPIF_IPFIX_TUNNEL_GRE;
+} else if (strcmp(type, "vxlan") == 0) {
+return DPIF_IPFIX_TUNNEL_VXLAN;
+} else if

[ovs-dev] [PATCH v4 2/2] ofproto-dpif-ipfix: add interface Information Elements to flow key

2017-09-26 Thread Michal Weglicki
Extend flow key part of data record to include following Information Elements:
- ingressInterface
- ingressInterfaceType
- egressInterface
- egressInterfaceType
- interfaceName
- interfaceDescription

In case of input sampling we don't have information about egress port.
Define templates depending not only on protocol types, but also on flow
direction. Only egress flow will include egress information elements.

With this change, dpif_ipfix_exporter stores every port in hmap rather
than only tunnel ports. It allows to easily retrieve required
information about interfaces during sampling upcalls.

v1->v2
* Add interfaceType and interfaceDescription
* Rework ipfix_get_iface_data_record function
v2->v3: Code rebase.
v3->v4: Minor comments applied.

Co-authored-by: Michal Weglicki <michalx.wegli...@intel.com>
Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczer...@intel.com>
---
 ofproto/ofproto-dpif-ipfix.c | 358 +++
 ofproto/ofproto-dpif-ipfix.h |   6 +-
 ofproto/ofproto-dpif-xlate.c |   4 +-
 ofproto/ofproto-dpif.c   |  19 +--
 4 files changed, 277 insertions(+), 110 deletions(-)

diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c
index 472c272..ab9192b 100644
--- a/ofproto/ofproto-dpif-ipfix.c
+++ b/ofproto/ofproto-dpif-ipfix.c
@@ -115,11 +115,12 @@ struct dpif_ipfix_global_stats {
 };
 
 struct dpif_ipfix_port {
-struct hmap_node hmap_node; /* In struct dpif_ipfix's "tunnel_ports" hmap. 
*/
+struct hmap_node hmap_node; /* In struct dpif_ipfix's "ports" hmap. */
 struct ofport *ofport;  /* To retrieve port stats. */
 odp_port_t odp_port;
 enum dpif_ipfix_tunnel_type tunnel_type;
 uint8_t tunnel_key_length;
+uint32_t ifindex;
 };
 
 struct dpif_ipfix_exporter {
@@ -157,9 +158,9 @@ struct dpif_ipfix_flow_exporter_map_node {
 struct dpif_ipfix {
 struct dpif_ipfix_bridge_exporter bridge_exporter;
 struct hmap flow_exporter_map;  /* dpif_ipfix_flow_exporter_map_node. */
-struct hmap tunnel_ports;   /* Contains "struct dpif_ipfix_port"s.
- * It makes tunnel port lookups faster in
- * sampling upcalls. */
+struct hmap ports;  /* Contains "struct dpif_ipfix_port"s.
+ * It makes port lookups faster in sampling
+ * upcalls. */
 struct ovs_refcount ref_cnt;
 };
 
@@ -293,7 +294,8 @@ BUILD_ASSERT_DECL(sizeof(struct 
ipfix_template_field_specifier) == 8);
 /* Cf. IETF RFC 5102 Section 5.11.6. */
 enum ipfix_flow_direction {
 INGRESS_FLOW = 0x00,
-EGRESS_FLOW = 0x01
+EGRESS_FLOW = 0x01,
+NUM_IPFIX_FLOW_DIRECTION
 };
 
 /* Part of data record flow key for common metadata and Ethernet entities. */
@@ -308,6 +310,18 @@ struct ipfix_data_record_flow_key_common {
 });
 BUILD_ASSERT_DECL(sizeof(struct ipfix_data_record_flow_key_common) == 20);
 
+/* Part of data record flow key for interface information. Since some of the
+ * elements have variable length, members of this structure should be appended
+ * to the 'struct dp_packet' one by one. */
+struct ipfix_data_record_flow_key_iface {
+ovs_be32 if_index; /* (INGRESS | EGRESS)_INTERFACE */
+ovs_be32 if_type; /* (INGRESS | EGRESS)_INTERFACE_TYPE */
+uint8_t if_name_len;   /* Variable length element: INTERFACE_NAME */
+char *if_name;
+uint8_t if_descr_len; /* Variable length element: INTERFACE_DESCRIPTION */
+char *if_descr;
+};
+
 /* Part of data record flow key for VLAN entities. */
 OVS_PACKED(
 struct ipfix_data_record_flow_key_vlan {
@@ -745,7 +759,7 @@ dpif_ipfix_find_port(const struct dpif_ipfix *di,
 struct dpif_ipfix_port *dip;
 
 HMAP_FOR_EACH_IN_BUCKET (dip, hmap_node, hash_odp_port(odp_port),
- >tunnel_ports) {
+ >ports) {
 if (dip->odp_port == odp_port) {
 return dip;
 }
@@ -754,82 +768,116 @@ dpif_ipfix_find_port(const struct dpif_ipfix *di,
 }
 
 static void
-dpif_ipfix_del_port(struct dpif_ipfix *di,
+dpif_ipfix_del_port__(struct dpif_ipfix *di,
   struct dpif_ipfix_port *dip)
 OVS_REQUIRES(mutex)
 {
-hmap_remove(>tunnel_ports, >hmap_node);
+hmap_remove(>ports, >hmap_node);
 free(dip);
 }
 
+static enum dpif_ipfix_tunnel_type
+dpif_ipfix_tunnel_type(const struct ofport *ofport)
+{
+const char *type = netdev_get_type(ofport->netdev);
+
+if (type == NULL) {
+return DPIF_IPFIX_TUNNEL_UNKNOWN;
+}
+if (strcmp(type, "gre") == 0) {
+return DPIF_IPFIX_TUNNEL_GRE;
+} else if (strcmp(type, "vxlan") == 0) {
+return DPIF_IPFIX_TUNNEL_VXLAN;
+} else if (strcmp(type, "lisp") == 0) {
+ 

[ovs-dev] [PATCH v4 1/2] netdev-dpdk: extend netdev_dpdk_get_status to include if_type and if_descr

2017-09-26 Thread Michal Weglicki
This commit extends netdev_dpdk_get_status API to include additional
driver-related information: if_type and if_descr.

v2->v3: Code rebase.
v3->v4: Minor comments applied.

Co-authored-by: Michal Weglicki <michalx.wegli...@intel.com>
Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczer...@intel.com>
---
 lib/netdev-dpdk.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index c60f46f..5cc70d1 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "dirs.h"
 #include "dp-packet.h"
@@ -2476,6 +2477,14 @@ netdev_dpdk_get_status(const struct netdev *netdev, 
struct smap *args)
 smap_add_format(args, "max_vfs", "%u", dev_info.max_vfs);
 smap_add_format(args, "max_vmdq_pools", "%u", dev_info.max_vmdq_pools);
 
+/* Querying the DPDK library for iftype may be done in future, pending
+ * support; cf. RFC 3635 Section 3.2.4. */
+enum { IF_TYPE_ETHERNETCSMACD = 6 };
+
+smap_add_format(args, "if_type", "%"PRIu32, IF_TYPE_ETHERNETCSMACD);
+smap_add_format(args, "if_descr", "%s %s", rte_version(),
+   dev_info.driver_name);
+
 if (dev_info.pci_dev) {
 smap_add_format(args, "pci-vendor_id", "0x%u",
 dev_info.pci_dev->id.vendor_id);
-- 
1.8.3.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v3 2/2] ofproto-dpif-ipfix: add interface Information Elements to flow key

2017-09-08 Thread Michal Weglicki
Extend flow key part of data record to include following Information Elements:
- ingressInterface
- ingressInterfaceType
- egressInterface
- egressInterfaceType
- interfaceName
- interfaceDescription

In case of input sampling we don't have information about egress port.
Define templates depending not only on protocol types, but also on flow
direction. Only egress flow will include egress information elements.

With this change, dpif_ipfix_exporter stores every port in hmap rather
than only tunnel ports. It allows to easily retrieve required
information about interfaces during sampling upcalls.

v1->v2
* Add interfaceType and interfaceDescription
* Rework ipfix_get_iface_data_record function
v2-v3: Code rebase.

Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczer...@intel.com>
Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
---
 ofproto/ofproto-dpif-ipfix.c | 356 +++
 ofproto/ofproto-dpif-ipfix.h |   6 +-
 ofproto/ofproto-dpif-xlate.c |   4 +-
 ofproto/ofproto-dpif.c   |  19 +--
 4 files changed, 275 insertions(+), 110 deletions(-)

diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c
index 472c272..1fbf11f 100644
--- a/ofproto/ofproto-dpif-ipfix.c
+++ b/ofproto/ofproto-dpif-ipfix.c
@@ -115,11 +115,12 @@ struct dpif_ipfix_global_stats {
 };
 
 struct dpif_ipfix_port {
-struct hmap_node hmap_node; /* In struct dpif_ipfix's "tunnel_ports" hmap. 
*/
+struct hmap_node hmap_node; /* In struct dpif_ipfix's "ports" hmap. */
 struct ofport *ofport;  /* To retrieve port stats. */
 odp_port_t odp_port;
 enum dpif_ipfix_tunnel_type tunnel_type;
 uint8_t tunnel_key_length;
+uint32_t ifindex;
 };
 
 struct dpif_ipfix_exporter {
@@ -157,9 +158,9 @@ struct dpif_ipfix_flow_exporter_map_node {
 struct dpif_ipfix {
 struct dpif_ipfix_bridge_exporter bridge_exporter;
 struct hmap flow_exporter_map;  /* dpif_ipfix_flow_exporter_map_node. */
-struct hmap tunnel_ports;   /* Contains "struct dpif_ipfix_port"s.
- * It makes tunnel port lookups faster in
- * sampling upcalls. */
+struct hmap ports;  /* Contains "struct dpif_ipfix_port"s.
+ * It makes port lookups faster in sampling
+ * upcalls. */
 struct ovs_refcount ref_cnt;
 };
 
@@ -293,7 +294,8 @@ BUILD_ASSERT_DECL(sizeof(struct 
ipfix_template_field_specifier) == 8);
 /* Cf. IETF RFC 5102 Section 5.11.6. */
 enum ipfix_flow_direction {
 INGRESS_FLOW = 0x00,
-EGRESS_FLOW = 0x01
+EGRESS_FLOW = 0x01,
+NUM_IPFIX_FLOW_DIRECTION
 };
 
 /* Part of data record flow key for common metadata and Ethernet entities. */
@@ -308,6 +310,18 @@ struct ipfix_data_record_flow_key_common {
 });
 BUILD_ASSERT_DECL(sizeof(struct ipfix_data_record_flow_key_common) == 20);
 
+/* Part of data record flow key for interface information. Since some of the
+ * elements have variable length, members of this structure should be appended
+ * to the 'struct dp_packet' one by one. */
+struct ipfix_data_record_flow_key_iface {
+ovs_be32 if_index; /* (INGRESS|EGRESS)_INTERFACE */
+ovs_be32 if_type; /* (INGRESS|EGRESS)_INTERFACE_TYPE */
+uint8_t if_name_len;   /* Variable length element: INTERFACE_NAME */
+char *if_name;
+uint8_t if_descr_len; /* Variable length element: INTERFACE_DESCRIPTION */
+char *if_descr;
+};
+
 /* Part of data record flow key for VLAN entities. */
 OVS_PACKED(
 struct ipfix_data_record_flow_key_vlan {
@@ -745,7 +759,7 @@ dpif_ipfix_find_port(const struct dpif_ipfix *di,
 struct dpif_ipfix_port *dip;
 
 HMAP_FOR_EACH_IN_BUCKET (dip, hmap_node, hash_odp_port(odp_port),
- >tunnel_ports) {
+ >ports) {
 if (dip->odp_port == odp_port) {
 return dip;
 }
@@ -754,82 +768,114 @@ dpif_ipfix_find_port(const struct dpif_ipfix *di,
 }
 
 static void
-dpif_ipfix_del_port(struct dpif_ipfix *di,
+dpif_ipfix_del_port__(struct dpif_ipfix *di,
   struct dpif_ipfix_port *dip)
 OVS_REQUIRES(mutex)
 {
-hmap_remove(>tunnel_ports, >hmap_node);
+hmap_remove(>ports, >hmap_node);
 free(dip);
 }
 
+static enum dpif_ipfix_tunnel_type
+dpif_ipfix_tunnel_type(const struct ofport *ofport) {
+const char *type = netdev_get_type(ofport->netdev);
+
+if (type == NULL) {
+return DPIF_IPFIX_TUNNEL_UNKNOWN;
+}
+if (strcmp(type, "gre") == 0) {
+return DPIF_IPFIX_TUNNEL_GRE;
+} else if (strcmp(type, "vxlan") == 0) {
+return DPIF_IPFIX_TUNNEL_VXLAN;
+} else if (strcmp(type, "lisp") == 0) {
+return DPIF_IPFIX_TUNNEL_LISP;
+} else if (strcmp(type, "geneve") == 0) {
+return DPIF_IPFIX

[ovs-dev] [PATCH v3 1/2] netdev-dpdk: extend netdev_dpdk_get_status to include if_type and if_descr

2017-09-08 Thread Michal Weglicki
This commit extends netdev_dpdk_get_status API to include additional
driver-related information: if_type and if_descr.

Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczer...@intel.com>
Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
---
v2-v3: Code rebase.
---
 lib/netdev-dpdk.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index f58e9be..14301dc 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "dirs.h"
 #include "dp-packet.h"
@@ -156,6 +157,11 @@ typedef uint8_t dpdk_port_t;
 #define VHOST_ENQ_RETRY_NUM 8
 #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ)
 
+/* ifType value '6' is used for all ethernet-like interfaces, regardless of
+* speed or link-layer encapsulation in use.
+* Cf. IETF RFC 3635 Section 3.2.4. */
+#define IF_TYPE_ETHERNETCSMACD 6
+
 static const struct rte_eth_conf port_conf = {
 .rxmode = {
 .mq_mode = ETH_MQ_RX_RSS,
@@ -2446,6 +2452,11 @@ netdev_dpdk_get_status(const struct netdev *netdev, 
struct smap *args)
dev_info.max_hash_mac_addrs);
 smap_add_format(args, "max_vfs", "%u", dev_info.max_vfs);
 smap_add_format(args, "max_vmdq_pools", "%u", dev_info.max_vmdq_pools);
+/* Once DPDK library supports retrieving ifType we should get this value
+ * directly from DPDK rather than hardcoding it. */
+smap_add_format(args, "if_type", "%"PRIu32, IF_TYPE_ETHERNETCSMACD);
+smap_add_format(args, "if_descr", "%s %s", rte_version(),
+   dev_info.driver_name);
 
 if (dev_info.pci_dev) {
 smap_add_format(args, "pci-vendor_id", "0x%u",
-- 
1.8.3.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [RFC PATCH 2/2] sflow: export extended NAT data

2017-08-24 Thread Michal Weglicki
With addition of sFlow output sampling, it is possible to export additional
data, which isn't available during input sampling. This patch introduces
support for exporting extend NAT data.

Signed-off-by: Przemyslaw Szczerbik 
---
 ofproto/ofproto-dpif-sflow.c | 37 +
 1 file changed, 37 insertions(+)

diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c
index b92f681..bd02bdd 100644
--- a/ofproto/ofproto-dpif-sflow.c
+++ b/ofproto/ofproto-dpif-sflow.c
@@ -878,6 +878,31 @@ dpif_sflow_tunnel_v4(uint8_t tunnel_ipproto,
 ipv4->dst_port = (OVS_FORCE uint16_t) tunnel->tp_dst;
 }
 
+static int
+dpif_sflow_ex_nat(const struct flow *flow, SFLExtended_nat *nat)
+
+{
+int ret = 0;
+uint16_t dl_type = ntohs(flow->dl_type);
+
+if (dl_type == ETH_TYPE_IP) {
+nat->src.type = SFLADDRESSTYPE_IP_V4;
+nat->dst.type = SFLADDRESSTYPE_IP_V4;
+nat->src.address.ip_v4.addr = flow->ct_nw_src;
+nat->dst.address.ip_v4.addr = flow->ct_nw_dst;
+} else if (dl_type == ETH_TYPE_IPV6) {
+nat->src.type = SFLADDRESSTYPE_IP_V6;
+nat->dst.type = SFLADDRESSTYPE_IP_V6;
+memcpy(nat->src.address.ip_v6.addr, flow->ct_ipv6_src.s6_addr, 16);
+memcpy(nat->dst.address.ip_v6.addr, flow->ct_ipv6_dst.s6_addr, 16);
+} else {
+/*XXX: Do we need to handle other cases? */
+ret = -1;
+}
+
+return ret;
+}
+
 static void
 dpif_sflow_push_mpls_lse(struct dpif_sflow_actions *sflow_actions,
  ovs_be32 lse)
@@ -1285,6 +1310,7 @@ dpif_sflow_received(struct dpif_sflow *ds, const struct 
dp_packet *packet,
 SFLFlow_sample_element hdrElem;
 SFLSampled_header *header;
 SFLFlow_sample_element switchElem;
+SFLFlow_sample_element natElem;
 uint8_t tnlInProto, tnlOutProto;
 SFLFlow_sample_element tnlInElem, tnlOutElem;
 SFLFlow_sample_element vniInElem, vniOutElem;
@@ -1343,6 +1369,14 @@ dpif_sflow_received(struct dpif_sflow *ds, const struct 
dp_packet *packet,
 
 fs.output = cookie->sflow.output;
 
+/* Add extended NAT element if src or dst address was mangled by NAT */
+bool add_ex_nat = flow->ct_state & OVS_CS_F_NAT_MASK;
+if (add_ex_nat) {
+memset(, 0, sizeof(natElem));
+natElem.tag = SFLFLOW_EX_NAT;
+add_ex_nat = !dpif_sflow_ex_nat(flow, );
+}
+
 /* Input tunnel. */
 if (flow->tunnel.ip_dst) {
memset(, 0, sizeof(tnlInElem));
@@ -1407,6 +1441,9 @@ dpif_sflow_received(struct dpif_sflow *ds, const struct 
dp_packet *packet,
 /* Submit the flow sample to be encoded into the next datagram. */
 SFLADD_ELEMENT(, );
 SFLADD_ELEMENT(, );
+if (add_ex_nat) {
+SFLADD_ELEMENT(, );
+}
 sfl_sampler_writeFlowSample(sampler, );
 
 out:
-- 
1.8.3.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v4] Update relevant artifacts to add support for DPDK 17.05.1.

2017-07-25 Thread Michal Weglicki
Upgrading to DPDK 17.05.1 stable release adds new
significant features relevant to OVS, including,
but not limited to:
- tun/tap PMD,
- VFIO hotplug support,
- Generic flow API.

Following changes are applied:
- netdev-dpdk: Changes required by DPDK API modifications.
- doc: Because of DPDK API changes, backward compatibility
  with previous DPDK releases will be broken, thus all
  relevant documentation entries are updated.
- .travis: DPDK version change from 16.11.1 to 17.05.1.
- rhel/openvswitch-fedora.spec.in: DPDK version change
  from 16.11 to 17.05.1

v1->v2: Patch rebase.
v2->v3: Fixed wrong formating after v2 patch rebase.
v3->v4: Minor documentation changes.

Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
Reviewed-by: Aaron Conole <acon...@redhat.com>
---
 .travis/linux-build.sh   |   2 +-
 Documentation/faq/releases.rst   |   1 +
 Documentation/howto/dpdk.rst |   6 +-
 Documentation/intro/install/dpdk.rst |  14 +--
 Documentation/topics/dpdk/vhost-user.rst |  12 +--
 NEWS |   1 +
 lib/netdev-dpdk.c| 144 +++
 rhel/openvswitch-fedora.spec.in  |   2 +-
 tests/dpdk/ring_client.c |   6 +-
 9 files changed, 114 insertions(+), 74 deletions(-)

diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
index f66b534..efccdf1 100755
--- a/.travis/linux-build.sh
+++ b/.travis/linux-build.sh
@@ -80,7 +80,7 @@ fi
 
 if [ "$DPDK" ]; then
 if [ -z "$DPDK_VER" ]; then
-DPDK_VER="16.11.2"
+DPDK_VER="17.05.1"
 fi
 install_dpdk $DPDK_VER
 if [ "$CC" = "clang" ]; then
diff --git a/Documentation/faq/releases.rst b/Documentation/faq/releases.rst
index 707834b..2ecc24c 100644
--- a/Documentation/faq/releases.rst
+++ b/Documentation/faq/releases.rst
@@ -161,6 +161,7 @@ Q: What DPDK version does each Open vSwitch release work 
with?
 2.5.x2.2
 2.6.x16.07.2
 2.7.x16.11.2
+2.8.x17.05.1
  ===
 
 Q: I get an error like this when I configure Open vSwitch:
diff --git a/Documentation/howto/dpdk.rst b/Documentation/howto/dpdk.rst
index af01d3e..1756c8c 100644
--- a/Documentation/howto/dpdk.rst
+++ b/Documentation/howto/dpdk.rst
@@ -528,15 +528,15 @@ described in :ref:`dpdk-testpmd`. Once compiled, run the 
application::
 
 When you finish testing, bind the vNICs back to kernel::
 
-$ $DPDK_DIR/tools/dpdk-devbind.py --bind=virtio-pci :00:03.0
-$ $DPDK_DIR/tools/dpdk-devbind.py --bind=virtio-pci :00:04.0
+$ $DPDK_DIR/usertools/dpdk-devbind.py --bind=virtio-pci :00:03.0
+$ $DPDK_DIR/usertools/dpdk-devbind.py --bind=virtio-pci :00:04.0
 
 .. note::
 
   Valid PCI IDs must be passed in above example. The PCI IDs can be retrieved
   like so::
 
-  $ $DPDK_DIR/tools/dpdk-devbind.py --status
+  $ $DPDK_DIR/usertools/dpdk-devbind.py --status
 
 More information on the dpdkvhostuser ports can be found in
 :doc:`/topics/dpdk/vhost-user`.
diff --git a/Documentation/intro/install/dpdk.rst 
b/Documentation/intro/install/dpdk.rst
index a05aa1a..20baa63 100644
--- a/Documentation/intro/install/dpdk.rst
+++ b/Documentation/intro/install/dpdk.rst
@@ -40,7 +40,7 @@ Build requirements
 In addition to the requirements described in :doc:`general`, building Open
 vSwitch with DPDK will require the following:
 
-- DPDK 16.11
+- DPDK 17.05.1
 
 - A `DPDK supported NIC`_
 
@@ -69,9 +69,9 @@ Install DPDK
 #. Download the `DPDK sources`_, extract the file and set ``DPDK_DIR``::
 
$ cd /usr/src/
-   $ wget http://fast.dpdk.org/rel/dpdk-16.11.2.tar.xz
-   $ tar xf dpdk-16.11.2.tar.xz
-   $ export DPDK_DIR=/usr/src/dpdk-stable-16.11.2
+   $ wget http://fast.dpdk.org/rel/dpdk-17.05.1.tar.xz
+   $ tar xf dpdk-17.05.1.tar.xz
+   $ export DPDK_DIR=/usr/src/dpdk-stable-17.05.1
$ cd $DPDK_DIR
 
 #. (Optional) Configure DPDK as a shared library
@@ -187,8 +187,8 @@ to the VFIO driver::
 $ modprobe vfio-pci
 $ /usr/bin/chmod a+x /dev/vfio
 $ /usr/bin/chmod 0666 /dev/vfio/*
-$ $DPDK_DIR/tools/dpdk-devbind.py --bind=vfio-pci eth1
-$ $DPDK_DIR/tools/dpdk-devbind.py --status
+$ $DPDK_DIR/usertools/dpdk-devbind.py --bind=vfio-pci eth1
+$ $DPDK_DIR/usertools/dpdk-devbind.py --status
 
 Setup OVS
 ~
@@ -569,7 +569,7 @@ Limitations
   The latest list of validated firmware versions can be found in the `DPDK
   release notes`_.
 
-.. _DPDK release notes: http://dpdk.org/doc/guides/rel_notes/release_16_11.html
+.. _DPDK release notes: http://dpdk.org/doc/guides/rel_notes/release_17_05.html
 
 Reporting Bugs
 --
diff --git a/Documentation/topics/dpdk/vhost-user.rst 
b/Documentation/topics/dpdk/vhost-user.rst
index e76da5f..a3d5de3 100644
--- a/Documentation/topics/dpdk/vhost-user.rst
+++ b/Documenta

[ovs-dev] [PATCH v3] Update relevant artifacts to add support for DPDK 17.05.1.

2017-07-19 Thread Michal Weglicki
Upgrading to DPDK 17.05.1 stable release adds new
significant features relevant to OVS, including,
but not limited to:
- tun/tap PMD,
- VFIO hotplug support,
- Generic flow API.

Following changes are applied:
- netdev-dpdk: Changes required by DPDK API modifications.
- doc: Because of DPDK API changes, backward compatibility
  with previous DPDK releases will be broken, thus all
  relevant documentation entries are updated.
- .travis: DPDK version change from 16.11.1 to 17.05.1.
- rhel/openvswitch-fedora.spec.in: DPDK version change
  from 16.11 to 17.05.1

v1->v2: Patch rebase.
v2->v3: Fixed wrong formating after v2 patch rebase.

Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
Reviewed-by: Aaron Conole <acon...@redhat.com>
---
 .travis/linux-build.sh   |   2 +-
 Documentation/intro/install/dpdk.rst |   8 +-
 Documentation/topics/dpdk/vhost-user.rst |   8 +-
 NEWS |   1 +
 lib/netdev-dpdk.c| 144 +++
 rhel/openvswitch-fedora.spec.in  |   2 +-
 tests/dpdk/ring_client.c |   6 +-
 7 files changed, 105 insertions(+), 66 deletions(-)

diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
index f66b534..efccdf1 100755
--- a/.travis/linux-build.sh
+++ b/.travis/linux-build.sh
@@ -80,7 +80,7 @@ fi
 
 if [ "$DPDK" ]; then
 if [ -z "$DPDK_VER" ]; then
-DPDK_VER="16.11.2"
+DPDK_VER="17.05.1"
 fi
 install_dpdk $DPDK_VER
 if [ "$CC" = "clang" ]; then
diff --git a/Documentation/intro/install/dpdk.rst 
b/Documentation/intro/install/dpdk.rst
index a05aa1a..4a178f3 100644
--- a/Documentation/intro/install/dpdk.rst
+++ b/Documentation/intro/install/dpdk.rst
@@ -40,7 +40,7 @@ Build requirements
 In addition to the requirements described in :doc:`general`, building Open
 vSwitch with DPDK will require the following:
 
-- DPDK 16.11
+- DPDK 17.05.1
 
 - A `DPDK supported NIC`_
 
@@ -69,9 +69,9 @@ Install DPDK
 #. Download the `DPDK sources`_, extract the file and set ``DPDK_DIR``::
 
$ cd /usr/src/
-   $ wget http://fast.dpdk.org/rel/dpdk-16.11.2.tar.xz
-   $ tar xf dpdk-16.11.2.tar.xz
-   $ export DPDK_DIR=/usr/src/dpdk-stable-16.11.2
+   $ wget http://fast.dpdk.org/rel/dpdk-17.05.1.tar.xz
+   $ tar xf dpdk-17.05.1.tar.xz
+   $ export DPDK_DIR=/usr/src/dpdk-stable-17.05.1
$ cd $DPDK_DIR
 
 #. (Optional) Configure DPDK as a shared library
diff --git a/Documentation/topics/dpdk/vhost-user.rst 
b/Documentation/topics/dpdk/vhost-user.rst
index e76da5f..9f11ea1 100644
--- a/Documentation/topics/dpdk/vhost-user.rst
+++ b/Documentation/topics/dpdk/vhost-user.rst
@@ -292,9 +292,9 @@ To begin, instantiate a guest as described in 
:ref:`dpdk-vhost-user` or
 DPDK sources to VM and build DPDK::
 
 $ cd /root/dpdk/
-$ wget http://fast.dpdk.org/rel/dpdk-16.11.2.tar.xz
-$ tar xf dpdk-16.11.2.tar.xz
-$ export DPDK_DIR=/root/dpdk/dpdk-stable-16.11.2
+$ wget http://fast.dpdk.org/rel/dpdk-17.05.1.tar.xz
+$ tar xf dpdk-17.05.1.tar.xz
+$ export DPDK_DIR=/root/dpdk/dpdk-stable-17.05.1
 $ export DPDK_TARGET=x86_64-native-linuxapp-gcc
 $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET
 $ cd $DPDK_DIR
@@ -378,7 +378,7 @@ Sample XML
 
 
   
-  
+  
   
   
 
diff --git a/NEWS b/NEWS
index d61fc5f..3f58e8b 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,7 @@ Post-v2.7.0
still can be configured via extra arguments for DPDK EAL.
  * dpdkvhostuser ports are marked as deprecated.  They will be removed
in an upcoming release.
+ * Support for DPDK v17.05.1.
- IPFIX now provides additional counters:
  * Total counters since metering process startup.
  * Per-flow TCP flag counters.
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index ea17b97..5e767e1 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -22,6 +22,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -31,7 +34,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "dirs.h"
 #include "dp-packet.h"
@@ -56,6 +59,8 @@
 #include "timeval.h"
 #include "unixctl.h"
 
+enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM};
+
 VLOG_DEFINE_THIS_MODULE(netdev_dpdk);
 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
 
@@ -171,6 +176,21 @@ static const struct rte_eth_conf port_conf = {
 },
 };
 
+/*
+ * These callbacks allow virtio-net devices to be added to vhost ports when
+ * configuration has been fully completed.
+ */
+static int new_device(int vid);
+static void destroy_device(int vid);
+static int vring_state_changed(int vid, uint16_t queue_id, int enable);
+static const struct vhost_device_ops virtio_net_device_ops =
+{
+.new_device =  new_device,
+.destr

[ovs-dev] [PATCH v2] Update relevant artifacts to add support for DPDK 17.05.1.

2017-07-14 Thread Michal Weglicki
Upgrading to DPDK 17.05.1 stable release adds new
significant features relevant to OVS, including,
but not limited to:
- tun/tap PMD,
- VFIO hotplug support,
- Generic flow API.

Following changes are applied:
- netdev-dpdk: Changes required by DPDK API modifications.
- doc: Because of DPDK API changes, backward compatibility
  with previous DPDK releases will be broken, thus all
  relevant documentation entries are updated.
- .travis: DPDK version change from 16.11.1 to 17.05.1.
- rhel/openvswitch-fedora.spec.in: DPDK version change
  from 16.11 to 17.05.1

v1->v2: Patch rebase.

Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
---
 .travis/linux-build.sh   |   2 +-
 Documentation/intro/install/dpdk.rst |  60 ++---
 Documentation/topics/dpdk/vhost-user.rst |   8 +-
 NEWS |   1 +
 lib/netdev-dpdk.c| 144 +++
 rhel/openvswitch-fedora.spec.in  |   2 +-
 tests/dpdk/ring_client.c |   6 +-
 7 files changed, 131 insertions(+), 92 deletions(-)

diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
index f66b534..efccdf1 100755
--- a/.travis/linux-build.sh
+++ b/.travis/linux-build.sh
@@ -80,7 +80,7 @@ fi
 
 if [ "$DPDK" ]; then
 if [ -z "$DPDK_VER" ]; then
-DPDK_VER="16.11.2"
+DPDK_VER="17.05.1"
 fi
 install_dpdk $DPDK_VER
 if [ "$CC" = "clang" ]; then
diff --git a/Documentation/intro/install/dpdk.rst 
b/Documentation/intro/install/dpdk.rst
index a05aa1a..017039d 100644
--- a/Documentation/intro/install/dpdk.rst
+++ b/Documentation/intro/install/dpdk.rst
@@ -1,25 +1,25 @@
 ..
-  Licensed under the Apache License, Version 2.0 (the "License"); you may
-  not use this file except in compliance with the License. You may obtain
-  a copy of the License at
+Licensed under the Apache License, Version 2.0 (the "License"); you may
+not use this file except in compliance with the License. You may obtain
+a copy of the License at
 
-  http://www.apache.org/licenses/LICENSE-2.0
+  http://www.apache.org/licenses/LICENSE-2.0
 
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-  License for the specific language governing permissions and limitations
-  under the License.
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations
+under the License.
 
-  Convention for heading levels in Open vSwitch documentation:
+Convention for heading levels in Open vSwitch documentation:
 
-  ===  Heading 0 (reserved for the title in a document)
-  ---  Heading 1
-  ~~~  Heading 2
-  +++  Heading 3
-  '''  Heading 4
+===  Heading 0 (reserved for the title in a document)
+---  Heading 1
+~~~  Heading 2
  Heading 3
+'''  Heading 4
 
-  Avoid deeper levels because they do not render well.
+Avoid deeper levels because they do not render well.
 
 ==
 Open vSwitch with DPDK
@@ -31,8 +31,8 @@ userspace.
 
 .. seealso::
 
-The :doc:`releases FAQ ` lists support for the required
-versions of DPDK for each version of Open vSwitch.
+The :doc:`releases FAQ ` lists support for the required
+versions of DPDK for each version of Open vSwitch.
 
 Build requirements
 --
@@ -40,20 +40,20 @@ Build requirements
 In addition to the requirements described in :doc:`general`, building Open
 vSwitch with DPDK will require the following:
 
-- DPDK 16.11
+- DPDK 17.05.1
 
 - A `DPDK supported NIC`_
 
-  Only required when physical ports are in use
+Only required when physical ports are in use
 
 - A suitable kernel
 
-  On Linux Distros running kernel version >= 3.0, only `IOMMU` needs to enabled
-  via the grub cmdline, assuming you are using **VFIO**. For older kernels,
-  ensure the kernel is built with ``UIO``, ``HUGETLBFS``,
-  ``PROC_PAGE_MONITOR``, ``HPET``, ``HPET_MMAP`` support. If these are not
-  present, it will be necessary to upgrade your kernel or build a custom kernel
-  with these flags enabled.
+On Linux Distros running kernel version >= 3.0, only `IOMMU` needs to enabled
+via the grub cmdline, assuming you are using **VFIO**. For older kernels,
+ensure the kernel is built with ``UIO``, ``HUGETLBFS``,
+``PROC_PAGE_MONITOR``, ``HPET``, ``HPET_MMAP`` support. If these are not
+present, it will be necessary to upgrade your kernel or build a custom kernel
+with these flags enabled.
 
 Detailed sy