Re: [ovs-dev] [PATCH] rhel: Environment file option for northd service

2016-11-15 Thread Babu Shanmugam



On Tuesday 15 November 2016 08:11 PM, Russell Bryant wrote:



On Tue, Nov 15, 2016 at 6:19 AM, > wrote:


From: Babu Shanmugam >

Since the northd service starts the DB servers as well, it will be
better to have an environment file options in the systemd unit
file for
northd service.
The environment file is expected to define NORTHD_OPTS
which will have additional parameters to be passed to ovn-ctl script
that starts ovn-northd.

Signed-off-by: Babu Shanmugam >
---
 rhel/usr_lib_systemd_system_ovn-northd.service | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rhel/usr_lib_systemd_system_ovn-northd.service
b/rhel/usr_lib_systemd_system_ovn-northd.service
index 5b3b03a..12230e9 100644
--- a/rhel/usr_lib_systemd_system_ovn-northd.service
+++ b/rhel/usr_lib_systemd_system_ovn-northd.service
@@ -7,6 +7,7 @@ After=openvswitch.service
 [Service]
 Type=oneshot
 RemainAfterExit=yes
+EnvironmentFile=-/etc/sysconfig/ovn-northd
 Environment=OVS_RUNDIR=%t/openvswitch OVS_DBDIR=/var/lib/openvswitch
-ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_northd
+ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_northd
$NORTHD_OPTS
 ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_northd


I'm not sure this is necessary.  I believe something close enough is 
possible with systemd already.


https://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F

or:

"Example 2. Overriding vendor settings"
https://www.freedesktop.org/software/systemd/man/systemd.unit.html

For ovn-northd, you would create a directory and config file, 
/etc/systemd/system/ovn-northd.d/local.conf, with contents like:


[System]
Environment=MY_ENV_VAR=VALUE "MY_ENV_VAR2=VALUE 2"



Thanks for the information, Russell. This patch can be abandoned.


--
Russell Bryant


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


Re: [ovs-dev] [PATCH] sflow: Expose ethernet and vlan stats via sFlow

2016-11-15 Thread Neil McKee
Hi Robert,

It seems like there are three separable things here:

(1) filling in the multicast and broadcast counters that were missing from
the generic interface counters structure.  This is great -- assuming it's
portable across OS versions etc.

(2) adding the ethernet counters structure.  This sometimes seems like a
lot just to distinguish a few different kinds of errors,  but I appreciate
that it can be important to do that.

(3) adding vlan counters for every vlan that an interface belongs to -- I
not sure about this one.   What if an interface is on a whole set of vlans?
  This vlan counters structure has hardly ever been used.  Certainly not in
this per-interface, per-vlan way.  I don't think any sFlow collectors would
know what to make of it.  And  since the packet-samples include vlan info
it is already possible to derive vlan traffic estimates by interface (and
by src/dst MAC, IP etc.) from them.

So I think I'm voting for (1),  maybe (2) but not (3).   What do you think?

Neil


--
Neil McKee
InMon Corp.
http://www.inmon.com

On Tue, Nov 15, 2016 at 2:47 AM, Robert Wojciechowicz <
robertx.wojciechow...@intel.com> wrote:

> Expose existing netdev stats via sFlow.
> Export sFlow ETHERNET structure with available counters.
> Map existing stats to counters in the GENERIC INTERFACE
> sFlow structure.
> Export sFlow VLAN structure with available counters.
> Adjust unit test to accommodate these new counters.
>
> Signed-off-by: Robert Wojciechowicz 
> ---
>  lib/sflow.h  |   2 +
>  lib/sflow_receiver.c |   2 +-
>  ofproto/ofproto-dpif-sflow.c |  52 +-
>  ofproto/ofproto-dpif.c   |   8 ++
>  ofproto/ofproto-provider.h   |   8 ++
>  ofproto/ofproto.c|  16 +++
>  ofproto/ofproto.h|   1 +
>  tests/ofproto-dpif.at| 225 ++
> +
>  tests/test-sflow.c   |  43 -
>  9 files changed, 332 insertions(+), 25 deletions(-)
>
> diff --git a/lib/sflow.h b/lib/sflow.h
> index 95bedd9..5beadc4 100644
> --- a/lib/sflow.h
> +++ b/lib/sflow.h
> @@ -502,6 +502,8 @@ typedef struct _SFLVlan_counters {
>  u_int32_t discards;
>  } SFLVlan_counters;
>
> +#define SFL_CTR_VLAN_XDR_SIZE 28
> +
>  /* OpenFlow port */
>  typedef struct {
>  u_int64_t datapath_id;
> diff --git a/lib/sflow_receiver.c b/lib/sflow_receiver.c
> index cde1359..8474628 100644
> --- a/lib/sflow_receiver.c
> +++ b/lib/sflow_receiver.c
> @@ -649,7 +649,7 @@ static int computeCountersSampleSize(SFLReceiver
> *receiver, SFL_COUNTERS_SAMPLE_
> case SFLCOUNTERS_ETHERNET: elemSiz = SFL_CTR_ETHERNET_XDR_SIZE;
> break;
> case SFLCOUNTERS_TOKENRING: elemSiz = 
> sizeof(elem->counterBlock.tokenring);
> break;
> case SFLCOUNTERS_VG: elemSiz = sizeof(elem->counterBlock.vg);
> break;
> -   case SFLCOUNTERS_VLAN: elemSiz = sizeof(elem->counterBlock.vlan);
> break;
> +   case SFLCOUNTERS_VLAN: elemSiz = SFL_CTR_VLAN_XDR_SIZE; break;
> case SFLCOUNTERS_LACP: elemSiz = SFL_CTR_LACP_XDR_SIZE; break;
> case SFLCOUNTERS_OPENFLOWPORT: elemSiz =
> SFL_CTR_OPENFLOWPORT_XDR_SIZE; break;
> case SFLCOUNTERS_PORTNAME: elemSiz = stringEncodingLength(>
> counterBlock.portName.portName); break;
> diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c
> index 9ea8851..21adba7 100644
> --- a/ofproto/ofproto-dpif-sflow.c
> +++ b/ofproto/ofproto-dpif-sflow.c
> @@ -298,13 +298,17 @@ sflow_agent_get_counters(void *ds_, SFLPoller
> *poller,
>  {
>  struct dpif_sflow *ds = ds_;
>  SFLCounters_sample_element elem, lacp_elem, of_elem, name_elem;
> +SFLCounters_sample_element eth_elem;
> +SFLCounters_sample_element vlan_elem;
>  enum netdev_features current;
>  struct dpif_sflow_port *dsp;
>  SFLIf_counters *counters;
> +SFLEthernet_counters* eth_counters;
>  struct netdev_stats stats;
>  enum netdev_flags flags;
>  struct lacp_slave_stats lacp_stats;
>  const char *ifName;
> +int vlan_id = 0;
>
>  dsp = dpif_sflow_find_port(ds, u32_to_odp(poller->bridgePort));
>  if (!dsp) {
> @@ -343,14 +347,14 @@ sflow_agent_get_counters(void *ds_, SFLPoller
> *poller,
>  counters->ifInOctets = stats.rx_bytes;
>  counters->ifInUcastPkts = stats.rx_packets;
>  counters->ifInMulticastPkts = stats.multicast;
> -counters->ifInBroadcastPkts = -1;
> +counters->ifInBroadcastPkts = stats.rx_broadcast_packets;
>  counters->ifInDiscards = stats.rx_dropped;
>  counters->ifInErrors = stats.rx_errors;
>  counters->ifInUnknownProtos = -1;
>  counters->ifOutOctets = stats.tx_bytes;
>  counters->ifOutUcastPkts = stats.tx_packets;
> -counters->ifOutMulticastPkts = -1;
> -counters->ifOutBroadcastPkts = -1;
> +counters->ifOutMulticastPkts = stats.tx_multicast_packets;
> +counters->ifOutBroadcastPkts = stats.tx_broadcast_packets;
>  counters->ifOutDiscards = stats.tx_dropped;
> 

[ovs-dev] [PATCH] netdev: Fix sockaddr cast warning.

2016-11-15 Thread Pravin B Shelar
Following warning was reported by Travis:-

lib/netdev.c:1916:19: error: cast from 'struct sockaddr *' to 'struct
sockaddr_in *' increases required alignment from 2 to 4
[-Werror,-Wcast-align]
sin = (struct sockaddr_in *) ifa->ifa_netmask;
  ^~~
lib/netdev.c:1924:20: error: cast from 'struct sockaddr *' to 'struct
sockaddr_in6 *' increases required alignment from 2 to 4
[-Werror,-Wcast-align]
sin6 = (struct sockaddr_in6 *) ifa->ifa_netmask;

Fixes: 3f31aded6 ("netdev: fix netmask in netdev_get_addrs").
Signed-off-by: Pravin B Shelar 
---
 lib/netdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/netdev.c b/lib/netdev.c
index ad90ef6..ee9b461 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -1913,7 +1913,7 @@ netdev_get_addrs(const char dev[], struct in6_addr 
**paddr,
 
 sin = ALIGNED_CAST(const struct sockaddr_in *, ifa->ifa_addr);
 in6_addr_set_mapped_ipv4(_array[i], sin->sin_addr.s_addr);
-sin = (struct sockaddr_in *) ifa->ifa_netmask;
+sin = ALIGNED_CAST(const struct sockaddr_in *, ifa->ifa_netmask);
 in6_addr_set_mapped_ipv4(_array[i], sin->sin_addr.s_addr);
 i++;
 } else if (family == AF_INET6) {
@@ -1921,7 +1921,7 @@ netdev_get_addrs(const char dev[], struct in6_addr 
**paddr,
 
 sin6 = ALIGNED_CAST(const struct sockaddr_in6 *, ifa->ifa_addr);
 memcpy(_array[i], >sin6_addr, sizeof *addr_array);
-sin6 = (struct sockaddr_in6 *) ifa->ifa_netmask;
+sin6 = ALIGNED_CAST(const struct sockaddr_in6 *, ifa->ifa_netmask);
 memcpy(_array[i], >sin6_addr, sizeof *mask_array);
 i++;
 }
-- 
1.8.3.1

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


[ovs-dev] openvswitch is marked for autoremoval from testing

2016-11-15 Thread Debian testing autoremoval watch
openvswitch 2.3.0+git20140819-4 is marked for autoremoval from testing on 
2016-12-15

It is affected by these RC bugs:
828478: openvswitch: FTBFS with openssl 1.1.0

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


Re: [ovs-dev] [PATCH 3/3] netdev-dpdk: Restore flags of dpdk netdev

2016-11-15 Thread Daniele Di Proietto
2016-11-11 5:44 GMT-08:00 Binbin Xu :

> If the eth device starts failed or vhost port is not running,
> the flags of dpdk netdev should be restored.
>
> Signed-off-by: Binbin Xu 
> ---
>  lib/netdev-dpdk.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index 4ed7274..0d8da16 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -2151,8 +2151,12 @@ netdev_dpdk_update_flags__(struct netdev_dpdk *dev,
>  if (dev->type == DPDK_DEV_ETH) {
>  if (dev->flags & NETDEV_UP) {
>  err = rte_eth_dev_start(dev->port_id);
> -if (err)
> +if (err) {
> +VLOG_INFO("Start eth dev %s failed: %d\n",
> +dev->up.name, err);
> +dev->flags = *old_flagsp;
>  return -err;
> +}
>  }
>
>  if (dev->flags & NETDEV_PROMISC) {
> @@ -2179,6 +2183,8 @@ netdev_dpdk_update_flags__(struct netdev_dpdk *dev,
>  memset(>stats, 0, sizeof dev->stats);
>  rte_spinlock_unlock(>stats_lock);
>  }
> +} else {
> +dev->flags = *old_flagsp;
>  }
>  }


I noticed that if I bring the device up or down while traffic is flowing,
ovs-vswitchd crashes.  I think we're not supposed to call
rte_eth_dev_stop() while the device is running, so I sent a patch that
checks for the flags in the rx/tx routines.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] dpif-netdev: non-pmd thread static_tx_qid should be constant

2016-11-15 Thread Daniele Di Proietto
2016-10-28 4:32 GMT-07:00 Patrik Andersson 
:

> The non-pmd thread static_tx_qid is assumed to be equal to the highest
> core ID + 1. The function dp_netdev_del_pmds_on_numa() invalidates
> this assumption by re-distributing the static_tx_qid:s on all pmd and
> non-pmd threads of the "other" numa.
>
> There might be a number of unwanted effects due to the non-pmd thread
> static_tx_qid being changed. The actual fault, observed in OVS 2.5, was a
> crash due to the TX burst queues containing a NULL packet buffer pointer
> in the range of valid buffers, presumably caused by a race condition.
>
> In OVS 2.6 TX burst queues have been removed, nevertheless the current
> behavior is incorrect.
>
> The correction makes dp_netdev_del_pmds_on_numa() honor the constancy
> of the non-pmd static_tx_qid value by excluding all non-pmd threads
> from the deletion and from the re-ordering of the static_tx_qid.
>
> Signed-off-by: Patrik Andersson 
>

Applied to master and branch-2.6, thanks!
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 2/3] netdev-dpdk: Fix the issue of physical port's admin state configuration

2016-11-15 Thread Daniele Di Proietto
2016-11-11 5:44 GMT-08:00 Binbin Xu :

> When we set physical port's admin state via ovs-appctl, the application
> seems to work and returns "OK". But the application doesn't work perfectly,
> the state stored in database doesn't change.
>
> Signed-off-by: Binbin Xu 
>

Applied to master and branch-2.6, thanks
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 1/3] netdev-dpdk: Can't set specified vhost port's admin state

2016-11-15 Thread Daniele Di Proietto
2016-11-11 5:44 GMT-08:00 Binbin Xu :

> When we set a vhost port's admin state via ovs-appctl, the
> application doesn't work and returns the information
> "Not a DPDK Interface".
>
> Signed-off-by: Binbin Xu 
>

Thanks for the patch

I'm thinking about removing the 'ovs-appctl netdev-dpdk/set-admin-state'
command, because we can use

ovs-ofctl mod-port br0 dpdk0 up
ovs-ofctl mod-port br0 dpdk0 down

but as long as we keep it should work for vhost, so I applied this to master
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 17/17] ovs-numa: Remove unused functions.

2016-11-15 Thread Daniele Di Proietto
ovs-numa doesn't need to keep the state of the pmd threads, it is an
implementation detail of dpif-netdev.

Signed-off-by: Daniele Di Proietto 
---
 lib/ovs-numa.c | 168 -
 lib/ovs-numa.h |   7 ---
 2 files changed, 175 deletions(-)

diff --git a/lib/ovs-numa.c b/lib/ovs-numa.c
index a6e999b..6599542 100644
--- a/lib/ovs-numa.c
+++ b/lib/ovs-numa.c
@@ -70,8 +70,6 @@ struct cpu_core {
 struct ovs_list list_node; /* In 'numa_node->cores' list. */
 struct numa_node *numa;/* numa node containing the core. */
 unsigned core_id;  /* Core id. */
-bool available;/* If the core can be pinned. */
-bool pinned;   /* If a thread has been pinned to the core. */
 };
 
 /* Contains all 'struct numa_node's. */
@@ -119,7 +117,6 @@ insert_new_cpu_core(struct numa_node *n, unsigned core_id)
 ovs_list_insert(>cores, >list_node);
 c->core_id = core_id;
 c->numa = n;
-c->available = true;
 
 return c;
 }
@@ -340,18 +337,6 @@ ovs_numa_core_id_is_valid(unsigned core_id)
 return found_numa_and_core && core_id < ovs_numa_get_n_cores();
 }
 
-bool
-ovs_numa_core_is_pinned(unsigned core_id)
-{
-struct cpu_core *core = get_core_by_core_id(core_id);
-
-if (core) {
-return core->pinned;
-}
-
-return false;
-}
-
 /* Returns the number of numa nodes. */
 int
 ovs_numa_get_n_numas(void)
@@ -396,97 +381,6 @@ ovs_numa_get_n_cores_on_numa(int numa_id)
 return OVS_CORE_UNSPEC;
 }
 
-/* Returns the number of cpu cores that are available and unpinned
- * on numa node.  Returns OVS_CORE_UNSPEC if 'numa_id' is invalid. */
-int
-ovs_numa_get_n_unpinned_cores_on_numa(int numa_id)
-{
-struct numa_node *numa = get_numa_by_numa_id(numa_id);
-
-if (numa) {
-struct cpu_core *core;
-int count = 0;
-
-LIST_FOR_EACH(core, list_node, >cores) {
-if (core->available && !core->pinned) {
-count++;
-}
-}
-return count;
-}
-
-return OVS_CORE_UNSPEC;
-}
-
-/* Given 'core_id', tries to pin that core.  Returns true, if succeeds.
- * False, if the core has already been pinned, or if it is invalid or
- * not available. */
-bool
-ovs_numa_try_pin_core_specific(unsigned core_id)
-{
-struct cpu_core *core = get_core_by_core_id(core_id);
-
-if (core) {
-if (core->available && !core->pinned) {
-core->pinned = true;
-return true;
-}
-}
-
-return false;
-}
-
-/* Searches through all cores for an unpinned and available core.  Returns
- * the 'core_id' if found and sets the 'core->pinned' to true.  Otherwise,
- * returns OVS_CORE_UNSPEC. */
-unsigned
-ovs_numa_get_unpinned_core_any(void)
-{
-struct cpu_core *core;
-
-HMAP_FOR_EACH(core, hmap_node, _cpu_cores) {
-if (core->available && !core->pinned) {
-core->pinned = true;
-return core->core_id;
-}
-}
-
-return OVS_CORE_UNSPEC;
-}
-
-/* Searches through all cores on numa node with 'numa_id' for an
- * unpinned and available core.  Returns the core_id if found and
- * sets the 'core->pinned' to true.  Otherwise, returns OVS_CORE_UNSPEC. */
-unsigned
-ovs_numa_get_unpinned_core_on_numa(int numa_id)
-{
-struct numa_node *numa = get_numa_by_numa_id(numa_id);
-
-if (numa) {
-struct cpu_core *core;
-
-LIST_FOR_EACH(core, list_node, >cores) {
-if (core->available && !core->pinned) {
-core->pinned = true;
-return core->core_id;
-}
-}
-}
-
-return OVS_CORE_UNSPEC;
-}
-
-/* Unpins the core with 'core_id'. */
-void
-ovs_numa_unpin_core(unsigned core_id)
-{
-struct cpu_core *core = get_core_by_core_id(core_id);
-
-if (core) {
-core->pinned = false;
-}
-}
-
 /* Given the 'numa_id', returns dump of all cores on the numa node. */
 struct ovs_numa_dump *
 ovs_numa_dump_cores_on_numa(int numa_id)
@@ -632,68 +526,6 @@ ovs_numa_dump_destroy(struct ovs_numa_dump *dump)
 free(dump);
 }
 
-/* Reads the cpu mask configuration from 'cmask' and sets the
- * 'available' of corresponding cores.  For unspecified cores,
- * sets 'available' to false. */
-void
-ovs_numa_set_cpu_mask(const char *cmask)
-{
-int core_id = 0;
-int i;
-
-if (!found_numa_and_core) {
-return;
-}
-
-/* If no mask specified, resets the 'available' to true for all cores. */
-if (!cmask) {
-struct cpu_core *core;
-
-HMAP_FOR_EACH(core, hmap_node, _cpu_cores) {
-core->available = true;
-}
-
-return;
-}
-
-for (i = strlen(cmask) - 1; i >= 0; i--) {
-char hex = toupper((unsigned char)cmask[i]);
-int bin, j;
-
-if (hex >= '0' && hex <= '9') {
-bin = hex - '0';
-} else if (hex >= 'A' && hex <= 'F') {
-bin = hex - 'A' + 10;
-} else {
-

[ovs-dev] [PATCH 16/17] dpif-netdev: Centralized threads and queues handling code.

2016-11-15 Thread Daniele Di Proietto
Currently we have three different code paths that deal with pmd threads
and queues, in response to different input

1. When a port is added
2. When a port is deleted
3. When the cpumask changes or a port must be reconfigured.

1. and 2. are carefully written to minimize disruption to the running
datapath, while 3. brings down all the threads reconfigure all the ports
and restarts everything.

This commit removes the three separate code paths by introducing the
reconfigure_datapath() function, that takes care of adapting the pmd
threads and queues to the current datapath configuration, no matter how
we got there.

This aims at simplifying mantenaince and introduces a long overdue
improvement: port reconfiguration (can happen quite frequently for
dpdkvhost ports) is now done without shutting down the whole datapath,
but just by temporarily removing the port that needs to be reconfigured
(while the rest of the datapath is running).

We now also recompute the rxq scheduling from scratch every time a port
is added of deleted.  This means that the queues will be more balanced,
especially when dealing with explicit rxq-affinity from the user
(without shutting down the threads and restarting them), but it also
means that adding or deleting a port might cause existing queues to be
moved between pmd threads.  This negative effect can be avoided by
taking into account the existing distribution when computing the new
scheduling, but I considered code clarity and fast reconfiguration more
important than optimizing port addition or removal (a port is added and
removed only once, but can be reconfigured many times)

Lastly, this commit moves the pmd threads state away from ovs-numa.  Now
the pmd threads state is kept only in dpif-netdev.

Signed-off-by: Daniele Di Proietto 
---
 lib/dpif-netdev.c | 899 +++---
 tests/pmd.at  |   3 +-
 2 files changed, 453 insertions(+), 449 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 0a88df3..93de684 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -289,6 +289,7 @@ struct dp_netdev_rxq {
   pinned. RXQ_CORE_UNPINNED if the
   queue doesn't need to be pinned to a
   particular core. */
+struct dp_netdev_pmd_thread *pmd;  /* pmd thread that will poll this 
queue. */
 };
 
 /* A port in a netdev-based datapath. */
@@ -304,6 +305,7 @@ struct dp_netdev_port {
 struct ovs_mutex txq_used_mutex;
 char *type; /* Port type as requested by user. */
 char *rxq_affinity_list;/* Requested affinity of rx queues. */
+bool need_reconfigure;  /* True if we should reconfigure netdev. */
 };
 
 /* Contained by struct dp_netdev_flow's 'stats' member.  */
@@ -506,7 +508,7 @@ struct dp_netdev_pmd_thread {
 
 /* Queue id used by this pmd thread to send packets on all netdevs if
  * XPS disabled for this netdev. All static_tx_qid's are unique and less
- * than 'ovs_numa_get_n_cores() + 1'. */
+ * than 'cmap_count(dp->poll_threads)'. */
 const int static_tx_qid;
 
 struct ovs_mutex port_mutex;/* Mutex for 'poll_list' and 'tx_ports'. */
@@ -536,6 +538,9 @@ struct dp_netdev_pmd_thread {
  * reporting to the user */
 unsigned long long stats_zero[DP_N_STATS];
 uint64_t cycles_zero[PMD_N_CYCLES];
+
+/* Set to true if the pmd thread needs to be reloaded. */
+bool need_reload;
 };
 
 /* Interface to netdev-based datapath. */
@@ -580,29 +585,26 @@ static void dp_netdev_destroy_pmd(struct 
dp_netdev_pmd_thread *pmd);
 static void dp_netdev_set_nonpmd(struct dp_netdev *dp)
 OVS_REQUIRES(dp->port_mutex);
 
+static void *pmd_thread_main(void *);
 static struct dp_netdev_pmd_thread *dp_netdev_get_pmd(struct dp_netdev *dp,
   unsigned core_id);
 static struct dp_netdev_pmd_thread *
 dp_netdev_pmd_get_next(struct dp_netdev *dp, struct cmap_position *pos);
-static void dp_netdev_destroy_all_pmds(struct dp_netdev *dp);
-static void dp_netdev_stop_pmds(struct dp_netdev *dp);
-static void dp_netdev_start_pmds(struct dp_netdev *dp)
-OVS_REQUIRES(dp->port_mutex);
+static void dp_netdev_destroy_all_pmds(struct dp_netdev *dp, bool non_pmd);
 static void dp_netdev_pmd_clear_ports(struct dp_netdev_pmd_thread *pmd);
-static void dp_netdev_del_port_from_all_pmds(struct dp_netdev *dp,
- struct dp_netdev_port *port);
-static void dp_netdev_add_port_to_pmds(struct dp_netdev *dp,
-   struct dp_netdev_port *port);
 static void dp_netdev_add_port_tx_to_pmd(struct dp_netdev_pmd_thread *pmd,
- struct dp_netdev_port *port);
+ struct dp_netdev_port *port)
+OVS_REQUIRES(pmd->port_mutex);
+static void 

[ovs-dev] [PATCH 11/17] dpctl: Avoid making assumptions on pmd threads.

2016-11-15 Thread Daniele Di Proietto
Currently dpctl depends on ovs-numa module to delete and create flows on
different pmd threads for pmd devices.

The next commits will move away the pmd threads state from ovs-numa to
dpif-netdev, so the ovs-numa interface will not be supported.

Also, the assignment between ports and thread is an implementation
detail of dpif-netdev, dpctl shouldn't know anything about it.

This commit changes the dpif_flow_put() and dpif_flow_del() calls to
iterate over all the pmd threads, if pmd_id is PMD_ID_NULL.

A simple test is added.

Signed-off-by: Daniele Di Proietto 
---
 lib/dpctl.c   | 107 
 lib/dpif-netdev.c | 180 +-
 lib/dpif.c|   6 +-
 lib/dpif.h|  12 +++-
 tests/pmd.at  |  44 +
 5 files changed, 194 insertions(+), 155 deletions(-)

diff --git a/lib/dpctl.c b/lib/dpctl.c
index edccb7f..ae789ea 100644
--- a/lib/dpctl.c
+++ b/lib/dpctl.c
@@ -40,7 +40,6 @@
 #include "netlink.h"
 #include "odp-util.h"
 #include "openvswitch/ofpbuf.h"
-#include "ovs-numa.h"
 #include "packets.h"
 #include "openvswitch/shash.h"
 #include "simap.h"
@@ -876,43 +875,12 @@ out_freefilter:
 return error;
 }
 
-/* Extracts the in_port from the parsed keys, and returns the reference
- * to the 'struct netdev *' of the dpif port.  On error, returns NULL.
- * Users must call 'netdev_close()' after finish using the returned
- * reference. */
-static struct netdev *
-get_in_port_netdev_from_key(struct dpif *dpif, const struct ofpbuf *key)
-{
-const struct nlattr *in_port_nla;
-struct netdev *dev = NULL;
-
-in_port_nla = nl_attr_find(key, 0, OVS_KEY_ATTR_IN_PORT);
-if (in_port_nla) {
-struct dpif_port dpif_port;
-odp_port_t port_no;
-int error;
-
-port_no = ODP_PORT_C(nl_attr_get_u32(in_port_nla));
-error = dpif_port_query_by_number(dpif, port_no, _port);
-if (error) {
-goto out;
-}
-
-netdev_open(dpif_port.name, dpif_port.type, );
-dpif_port_destroy(_port);
-}
-
-out:
-return dev;
-}
-
 static int
 dpctl_put_flow(int argc, const char *argv[], enum dpif_flow_put_flags flags,
struct dpctl_params *dpctl_p)
 {
 const char *key_s = argv[argc - 2];
 const char *actions_s = argv[argc - 1];
-struct netdev *in_port_netdev = NULL;
 struct dpif_flow_stats stats;
 struct dpif_port dpif_port;
 struct dpif_port_dump port_dump;
@@ -968,39 +936,15 @@ dpctl_put_flow(int argc, const char *argv[], enum 
dpif_flow_put_flags flags,
 goto out_freeactions;
 }
 
-/* For DPDK interface, applies the operation to all pmd threads
- * on the same numa node. */
-in_port_netdev = get_in_port_netdev_from_key(dpif, );
-if (in_port_netdev && netdev_is_pmd(in_port_netdev)) {
-int numa_id;
-
-numa_id = netdev_get_numa_id(in_port_netdev);
-if (ovs_numa_numa_id_is_valid(numa_id)) {
-struct ovs_numa_dump *dump = ovs_numa_dump_cores_on_numa(numa_id);
-struct ovs_numa_info *iter;
-
-FOR_EACH_CORE_ON_NUMA (iter, dump) {
-if (ovs_numa_core_is_pinned(iter->core_id)) {
-error = dpif_flow_put(dpif, flags,
-  key.data, key.size,
-  mask.size == 0 ? NULL : mask.data,
-  mask.size, actions.data,
-  actions.size, ufid_present ?  : 
NULL,
-  iter->core_id, 
dpctl_p->print_statistics ?  : NULL);
-}
-}
-ovs_numa_dump_destroy(dump);
-} else {
-error = EINVAL;
-}
-} else {
-error = dpif_flow_put(dpif, flags,
-  key.data, key.size,
-  mask.size == 0 ? NULL : mask.data,
-  mask.size, actions.data,
-  actions.size, ufid_present ?  : NULL,
-  PMD_ID_NULL, dpctl_p->print_statistics ?  
: NULL);
-}
+/* The flow will be added on all pmds currently in the datapath. */
+error = dpif_flow_put(dpif, flags,
+  key.data, key.size,
+  mask.size == 0 ? NULL : mask.data,
+  mask.size, actions.data,
+  actions.size, ufid_present ?  : NULL,
+  PMD_ID_NULL,
+  dpctl_p->print_statistics ?  : NULL);
+
 if (error) {
 dpctl_error(dpctl_p, error, "updating flow table");
 goto out_freeactions;
@@ -1021,7 +965,6 @@ out_freekeymask:
 ofpbuf_uninit();
 ofpbuf_uninit();
 dpif_close(dpif);
-netdev_close(in_port_netdev);
 return error;
 }
 
@@ -1110,7 +1053,6 @@ static int
 dpctl_del_flow(int argc, const 

[ovs-dev] [PATCH 10/17] dpif-netdev: Make 'static_tx_qid' const.

2016-11-15 Thread Daniele Di Proietto
Since previous commit, 'static_tx_qid' doesn't need to be atomic and is
actually never touched (except for initialization), so it can be made
const.

Signed-off-by: Daniele Di Proietto 
---
 lib/dpif-netdev.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 59cfaae..36e04f6 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -496,7 +496,7 @@ struct dp_netdev_pmd_thread {
 /* Queue id used by this pmd thread to send packets on all netdevs if
  * XPS disabled for this netdev. All static_tx_qid's are unique and less
  * than 'ovs_numa_get_n_cores() + 1'. */
-atomic_int static_tx_qid;
+const int static_tx_qid;
 
 struct ovs_mutex port_mutex;/* Mutex for 'poll_list' and 'tx_ports'. */
 /* List of rx queues to poll. */
@@ -3285,10 +3285,9 @@ dp_netdev_configure_pmd(struct dp_netdev_pmd_thread 
*pmd, struct dp_netdev *dp,
 pmd->numa_id = numa_id;
 pmd->poll_cnt = 0;
 
-atomic_init(>static_tx_qid,
-(core_id == NON_PMD_CORE_ID)
-? ovs_numa_get_n_cores()
-: get_n_pmd_threads(dp));
+*CONST_CAST(int *, >static_tx_qid) = (core_id == NON_PMD_CORE_ID)
+  ? ovs_numa_get_n_cores()
+  : get_n_pmd_threads(dp);
 
 ovs_refcount_init(>ref_cnt);
 latch_init(>exit_latch);
@@ -4393,7 +4392,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch 
*packets_,
 if (dynamic_txqs) {
 tx_qid = dpif_netdev_xps_get_tx_qid(pmd, p, now);
 } else {
-atomic_read_relaxed(>static_tx_qid, _qid);
+tx_qid = pmd->static_tx_qid;
 }
 
 netdev_send(p->port->netdev, tx_qid, packets_, may_steal,
-- 
2.10.2

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


[ovs-dev] [PATCH 07/17] dpif-netdev: Use a boolean instead of pmd->port_seq.

2016-11-15 Thread Daniele Di Proietto
There's no need for a sequence number, since the main thread has to wait
for the pmd thread, so there's no chance that an update will be
undetected.

A seq object will be introduced for another purpose in the next commit,
and changing this to boolean makes the code more readable.

Signed-off-by: Daniele Di Proietto 
---
 lib/dpif-netdev.c | 19 +++
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 81366b2..23546b9 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -485,7 +485,7 @@ struct dp_netdev_pmd_thread {
 unsigned long long last_cycles;
 
 struct latch exit_latch;/* For terminating the pmd thread. */
-atomic_uint change_seq; /* For reloading pmd ports. */
+atomic_bool reload; /* Do we need to reload ports? */
 pthread_t thread;
 unsigned core_id;   /* CPU core id of this pmd thread. */
 int numa_id;/* numa node id of this pmd thread. */
@@ -527,8 +527,6 @@ struct dp_netdev_pmd_thread {
 uint64_t cycles_zero[PMD_N_CYCLES];
 };
 
-#define PMD_INITIAL_SEQ 1
-
 /* Interface to netdev-based datapath. */
 struct dpif_netdev {
 struct dpif dpif;
@@ -1202,8 +1200,6 @@ dpif_netdev_get_stats(const struct dpif *dpif, struct 
dpif_dp_stats *stats)
 static void
 dp_netdev_reload_pmd__(struct dp_netdev_pmd_thread *pmd)
 {
-int old_seq;
-
 if (pmd->core_id == NON_PMD_CORE_ID) {
 ovs_mutex_lock(>dp->non_pmd_mutex);
 ovs_mutex_lock(>port_mutex);
@@ -1214,7 +1210,7 @@ dp_netdev_reload_pmd__(struct dp_netdev_pmd_thread *pmd)
 }
 
 ovs_mutex_lock(>cond_mutex);
-atomic_add_relaxed(>change_seq, 1, _seq);
+atomic_store_relaxed(>reload, true);
 ovs_mutex_cond_wait(>cond, >cond_mutex);
 ovs_mutex_unlock(>cond_mutex);
 }
@@ -3131,7 +3127,6 @@ pmd_thread_main(void *f_)
 struct dp_netdev_pmd_thread *pmd = f_;
 unsigned int lc = 0;
 struct rxq_poll *poll_list;
-unsigned int port_seq = PMD_INITIAL_SEQ;
 bool exiting;
 int poll_cnt;
 int i;
@@ -3159,7 +3154,7 @@ reload:
 }
 
 if (lc++ > 1024) {
-unsigned int seq;
+bool reload;
 
 lc = 0;
 
@@ -3169,9 +3164,8 @@ reload:
 emc_cache_slow_sweep(>flow_cache);
 }
 
-atomic_read_relaxed(>change_seq, );
-if (seq != port_seq) {
-port_seq = seq;
+atomic_read_relaxed(>reload, );
+if (reload) {
 break;
 }
 }
@@ -3228,6 +3222,7 @@ static void
 dp_netdev_pmd_reload_done(struct dp_netdev_pmd_thread *pmd)
 {
 ovs_mutex_lock(>cond_mutex);
+atomic_store_relaxed(>reload, false);
 xpthread_cond_signal(>cond);
 ovs_mutex_unlock(>cond_mutex);
 }
@@ -3322,7 +3317,7 @@ dp_netdev_configure_pmd(struct dp_netdev_pmd_thread *pmd, 
struct dp_netdev *dp,
 
 ovs_refcount_init(>ref_cnt);
 latch_init(>exit_latch);
-atomic_init(>change_seq, PMD_INITIAL_SEQ);
+atomic_init(>reload, false);
 xpthread_cond_init(>cond, NULL);
 ovs_mutex_init(>cond_mutex);
 ovs_mutex_init(>flow_mutex);
-- 
2.10.2

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


[ovs-dev] [PATCH 08/17] dpif-netdev: Block pmd threads if there are no ports.

2016-11-15 Thread Daniele Di Proietto
There's no reason for a pmd thread to perform its main loop if there are
no queues in its poll_list.

This commit introduces a seq object on which the pmd thread can be
blocked, if there are no queues.

When the main thread wants to reload a pmd threads it must now change
the seq object (in case it's blocked) and set 'reload' to true.

This is useful to avoid wasting CPU cycles and is also necessary for a
future commit.

Signed-off-by: Daniele Di Proietto 
---
 lib/dpif-netdev.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 23546b9..6c2ad29 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -485,6 +485,8 @@ struct dp_netdev_pmd_thread {
 unsigned long long last_cycles;
 
 struct latch exit_latch;/* For terminating the pmd thread. */
+struct seq *reload_seq;
+uint64_t last_reload_seq;
 atomic_bool reload; /* Do we need to reload ports? */
 pthread_t thread;
 unsigned core_id;   /* CPU core id of this pmd thread. */
@@ -1210,6 +1212,7 @@ dp_netdev_reload_pmd__(struct dp_netdev_pmd_thread *pmd)
 }
 
 ovs_mutex_lock(>cond_mutex);
+seq_change(pmd->reload_seq);
 atomic_store_relaxed(>reload, true);
 ovs_mutex_cond_wait(>cond, >cond_mutex);
 ovs_mutex_unlock(>cond_mutex);
@@ -3148,6 +3151,13 @@ reload:
 netdev_rxq_get_queue_id(poll_list[i].rx));
 }
 
+if (!poll_cnt) {
+while (seq_read(pmd->reload_seq) == pmd->last_reload_seq) {
+seq_wait(pmd->reload_seq, pmd->last_reload_seq);
+poll_block();
+}
+}
+
 for (;;) {
 for (i = 0; i < poll_cnt; i++) {
 dp_netdev_process_rxq_port(pmd, poll_list[i].port, 
poll_list[i].rx);
@@ -3223,6 +3233,7 @@ dp_netdev_pmd_reload_done(struct dp_netdev_pmd_thread 
*pmd)
 {
 ovs_mutex_lock(>cond_mutex);
 atomic_store_relaxed(>reload, false);
+pmd->last_reload_seq = seq_read(pmd->reload_seq);
 xpthread_cond_signal(>cond);
 ovs_mutex_unlock(>cond_mutex);
 }
@@ -3317,6 +3328,8 @@ dp_netdev_configure_pmd(struct dp_netdev_pmd_thread *pmd, 
struct dp_netdev *dp,
 
 ovs_refcount_init(>ref_cnt);
 latch_init(>exit_latch);
+pmd->reload_seq = seq_create();
+pmd->last_reload_seq = seq_read(pmd->reload_seq);
 atomic_init(>reload, false);
 xpthread_cond_init(>cond, NULL);
 ovs_mutex_init(>cond_mutex);
@@ -3356,6 +3369,7 @@ dp_netdev_destroy_pmd(struct dp_netdev_pmd_thread *pmd)
 cmap_destroy(>flow_table);
 ovs_mutex_destroy(>flow_mutex);
 latch_destroy(>exit_latch);
+seq_destroy(pmd->reload_seq);
 xpthread_cond_destroy(>cond);
 ovs_mutex_destroy(>cond_mutex);
 ovs_mutex_destroy(>port_mutex);
-- 
2.10.2

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


[ovs-dev] [PATCH 01/17] dpif-netdev: Fix memory leak.

2016-11-15 Thread Daniele Di Proietto
We keep all the per-port classifiers around, since they can be reused,
but when a pmd thread is destroyed we should free them.

Found using valgrind.

Fixes: 3453b4d62a98("dpif-netdev: dpcls per in_port with sorted
subtables")

Signed-off-by: Daniele Di Proietto 
---
 lib/dpif-netdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index c477248..c19d3e8 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -3330,6 +3330,7 @@ dp_netdev_destroy_pmd(struct dp_netdev_pmd_thread *pmd)
 /* All flows (including their dpcls_rules) have been deleted already */
 CMAP_FOR_EACH (cls, node, >classifiers) {
 dpcls_destroy(cls);
+free(cls);
 }
 cmap_destroy(>classifiers);
 cmap_destroy(>flow_table);
-- 
2.10.2

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


Re: [ovs-dev] relationship between dpcls_rule and dp_netdev_flow

2016-11-15 Thread Jarno Rajahalme

> On Nov 15, 2016, at 3:35 PM, Joo Kim  wrote:
> 
> Hello,
> 
> In this OVS (2.6) code below,
> It seems that a dp_netdev_flow obj contains a dpcls_rule struct, and given
> a dpcls_rule, it gets the corresponding dp_netdev_flow via
> dp_netdev_flow_cast().
> Does it mean dpcls_rule  and dp_netdev_flow have an 1-1 mapping
> relationship?

Yes, as you saw from the code, the relationship is 1:1.

> But, as I understand,  dpcls_rule could have a wildcard which can match
> multiple flows. Then, how does dp_netdev_flow_cast() (which seems to assume
> 1-1 mapping) make sense?
> 

You are tripping over the overloaded term ‘flow’ here. struct dp_netdev_flow 
and the associated struct dpcls_rule always have the same wildcarding. A 
wildcarded dpcls_rule, and therefore dp_netdev_flow, can match multiple 
transport connections, or multiple “exact match flows”.

  Jarno

> 
> struct dp_netdev_flow {
>const struct flow flow;  /* Unmasked flow that created this entry.
> */
>/* Hash table index by unmasked flow. */
>const struct cmap_node node; /* In owning dp_netdev_pmd_thread's */
> /* 'flow_table'. */
> …
>/* Packet classification. */
>struct dpcls_rule cr;/* In owning dp_netdev's 'cls'. */
>/* 'cr' must be the last member. */
> };
> 
> 
> 
> static struct dp_netdev_flow *
> dp_netdev_flow_cast(const struct dpcls_rule *cr)
> {
>return cr ? CONTAINER_OF(cr, struct dp_netdev_flow, cr) : NULL;
> }
> 
> 
> static struct dp_netdev_flow *
> dp_netdev_pmd_lookup_flow(struct dp_netdev_pmd_thread *pmd,
>  const struct netdev_flow_key *key,
>  int *lookup_num_p)
> {
>struct dpcls *cls;
>struct dpcls_rule *rule;
>odp_port_t in_port = u32_to_odp(MINIFLOW_GET_U32(>mf, in_port));
>   struct dp_netdev_flow *netdev_flow = NULL;
> 
>cls = dp_netdev_pmd_lookup_dpcls(pmd, in_port);
>if (OVS_LIKELY(cls)) {
>dpcls_lookup(cls, key, , 1, lookup_num_p);
>netdev_flow = dp_netdev_flow_cast(rule);  <
>}
>return netdev_flow;
> }
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev

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


Re: [ovs-dev] [PATCH net-next v13 0/8] openvswitch: support for layer 3 encapsulated packets

2016-11-15 Thread Yang, Yi Y
Got it, thanks, I'll follow your discussion thread.

-Original Message-
From: Thadeu Lima de Souza Cascardo [mailto:casca...@cascardo.eti.br] 
Sent: Wednesday, November 16, 2016 3:01 AM
To: Yang, Yi Y ; Jiri Benc ; 
net...@vger.kernel.org
Cc: d...@openvswitch.org; Simon Horman ; 
egar...@redhat.com
Subject: Re: [ovs-dev] [PATCH net-next v13 0/8] openvswitch: support for layer 
3 encapsulated packets

On November 15, 2016 11:57:21 AM GMT-02:00, "Yang, Yi Y"  
wrote:
>Hi, Jiri
>
>I'm very glad to see you're continuing this work :-), I asked Simon 
>about this twice, but nobody replies. I also remember Cascardo has a 
>patch set to collaborate with this patch set, I asked Cascardo, but 
>nobody responds, will you continue to do Cascardo's " create tunnel 
>devices using rtnetlink interface" patch set? I test the old one v3, 
>that can work with vxlan module in kernel, but if I build ovs with 
>option " --with-linux=/lib/modules/`uname -r`/build", ovs vxlan module 
>is built in vport_vxlan module, when I create vxlan-gpe port, kernel 
>will automatically load vxlan module in the kernel instead of using the 
>APIs in vport_vxlan module.
>
>Cascardo, are you still working on this?
>
>-Original Message-
>From: netdev-ow...@vger.kernel.org
>[mailto:netdev-ow...@vger.kernel.org] On Behalf Of Jiri Benc
>Sent: Thursday, November 10, 2016 11:28 PM
>To: net...@vger.kernel.org
>Cc: d...@openvswitch.org; Pravin Shelar ; Lorand Jakab 
>; Simon Horman 
>Subject: [PATCH net-next v13 0/8] openvswitch: support for layer 3 
>encapsulated packets
>
>At the core of this patch set is removing the assumption in Open 
>vSwitch datapath that all packets have Ethernet header.
>
>The implementation relies on the presence of pop_eth and push_eth 
>actions in datapath flows to facilitate adding and removing Ethernet 
>headers as appropriate. The construction of such flows is left up to 
>user-space.
>
>This series is based on work by Simon Horman, Lorand Jakab, Thomas 
>Morin and others. I kept Lorand's and Simon's s-o-b in the patches that 
>are derived from v11 to record their authorship of parts of the code.
>
>Changes from v12 to v13:
>
>* Addressed Pravin's feedback.
>* Removed the GRE vport conversion patch; L3 GRE ports should be 
>created by
>  rtnetlink instead.
>
>Main changes from v11 to v12:
>
>* The patches were restructured and split differently for easier 
>review.
>* They were rebased and adjusted to the current net-next. Especially 
>MPLS handling is different (and easier) thanks to the recent MPLS GSO 
>rework.
>* Several bugs were discovered and fixed. The most notable is fragment
>handling: header adjustment for ARPHRD_NONE devices on tx needs to be 
>done after refragmentation, not before it. This required significant 
>changes in the patchset. Another one is stricter checking of attributes 
>(match on
>L2
>  vs. L3 packet) at the kernel level.
>* Instead of is_layer3 bool, a mac_proto field is used.
>
>Jiri Benc (8):
>  openvswitch: use hard_header_len instead of hardcoded ETH_HLEN
>  openvswitch: add mac_proto field to the flow key
>  openvswitch: pass mac_proto to ovs_vport_send
>  openvswitch: support MPLS push and pop for L3 packets
>  openvswitch: add processing of L3 packets
>  openvswitch: netlink: support L3 packets
>  openvswitch: add Ethernet push and pop actions
>  openvswitch: allow L3 netdev ports
>
> include/uapi/linux/openvswitch.h |  15 
> net/openvswitch/actions.c| 111 +---
> net/openvswitch/datapath.c   |  13 +--
> net/openvswitch/flow.c   | 105 +--
> net/openvswitch/flow.h   |  22 +
>net/openvswitch/flow_netlink.c   | 179
>++-
> net/openvswitch/vport-netdev.c   |   9 +-
> net/openvswitch/vport.c  |  31 +--
> net/openvswitch/vport.h  |   2 +-
> 9 files changed, 353 insertions(+), 134 deletions(-)
>
>--
>1.8.3.1
>
>___
>dev mailing list
>d...@openvswitch.org
>https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Hi.

I am still working on this. Just see my recent discussion with Pravin about the 
way to support out of tree drivers. If you have any opinion on that, please 
share on that thread, preferably with a patch. It's likely that Eric Garver 
will take this task as he was already working with me.

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


Re: [ovs-dev] [PATCH 1/4] ovn: Support DNAT with port.

2016-11-15 Thread nickcooper-zhangtonghao
I got it. Thank you explaining this. Can you review the v1 of NAT command,
and other patches ? Thanks very much.

http://patchwork.ozlabs.org/patch/680778/ 

http://patchwork.ozlabs.org/patch/680777/ 

http://patchwork.ozlabs.org/patch/689737/ 


Thanks.
Nick

> On Nov 15, 2016, at 11:58 PM, Guru Shetty  wrote:
> 
> We can do that with LB.

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


Re: [ovs-dev] [PATCH net-next v13 0/8] openvswitch: support for layer 3 encapsulated packets

2016-11-15 Thread Thadeu Lima de Souza Cascardo
On November 15, 2016 11:57:21 AM GMT-02:00, "Yang, Yi Y"  
wrote:
>Hi, Jiri
>
>I'm very glad to see you're continuing this work :-), I asked Simon
>about this twice, but nobody replies. I also remember Cascardo has a
>patch set to collaborate with this patch set, I asked Cascardo, but
>nobody responds, will you continue to do Cascardo's " create tunnel
>devices using rtnetlink interface" patch set? I test the old one v3,
>that can work with vxlan module in kernel, but if I build ovs with
>option " --with-linux=/lib/modules/`uname -r`/build", ovs vxlan module
>is built in vport_vxlan module, when I create vxlan-gpe port, kernel
>will automatically load vxlan module in the kernel instead of using the
>APIs in vport_vxlan module. 
>
>Cascardo, are you still working on this?
>
>-Original Message-
>From: netdev-ow...@vger.kernel.org
>[mailto:netdev-ow...@vger.kernel.org] On Behalf Of Jiri Benc
>Sent: Thursday, November 10, 2016 11:28 PM
>To: net...@vger.kernel.org
>Cc: d...@openvswitch.org; Pravin Shelar ; Lorand Jakab
>; Simon Horman 
>Subject: [PATCH net-next v13 0/8] openvswitch: support for layer 3
>encapsulated packets
>
>At the core of this patch set is removing the assumption in Open
>vSwitch datapath that all packets have Ethernet header.
>
>The implementation relies on the presence of pop_eth and push_eth
>actions in datapath flows to facilitate adding and removing Ethernet
>headers as appropriate. The construction of such flows is left up to
>user-space.
>
>This series is based on work by Simon Horman, Lorand Jakab, Thomas
>Morin and others. I kept Lorand's and Simon's s-o-b in the patches that
>are derived from v11 to record their authorship of parts of the code.
>
>Changes from v12 to v13:
>
>* Addressed Pravin's feedback.
>* Removed the GRE vport conversion patch; L3 GRE ports should be
>created by
>  rtnetlink instead.
>
>Main changes from v11 to v12:
>
>* The patches were restructured and split differently for easier
>review.
>* They were rebased and adjusted to the current net-next. Especially
>MPLS
>handling is different (and easier) thanks to the recent MPLS GSO
>rework.
>* Several bugs were discovered and fixed. The most notable is fragment
>handling: header adjustment for ARPHRD_NONE devices on tx needs to be
>done
>after refragmentation, not before it. This required significant changes
>in
>the patchset. Another one is stricter checking of attributes (match on
>L2
>  vs. L3 packet) at the kernel level.
>* Instead of is_layer3 bool, a mac_proto field is used.
>
>Jiri Benc (8):
>  openvswitch: use hard_header_len instead of hardcoded ETH_HLEN
>  openvswitch: add mac_proto field to the flow key
>  openvswitch: pass mac_proto to ovs_vport_send
>  openvswitch: support MPLS push and pop for L3 packets
>  openvswitch: add processing of L3 packets
>  openvswitch: netlink: support L3 packets
>  openvswitch: add Ethernet push and pop actions
>  openvswitch: allow L3 netdev ports
>
> include/uapi/linux/openvswitch.h |  15 
> net/openvswitch/actions.c| 111 +---
> net/openvswitch/datapath.c   |  13 +--
> net/openvswitch/flow.c   | 105 +--
> net/openvswitch/flow.h   |  22 +
>net/openvswitch/flow_netlink.c   | 179
>++-
> net/openvswitch/vport-netdev.c   |   9 +-
> net/openvswitch/vport.c  |  31 +--
> net/openvswitch/vport.h  |   2 +-
> 9 files changed, 353 insertions(+), 134 deletions(-)
>
>--
>1.8.3.1
>
>___
>dev mailing list
>d...@openvswitch.org
>https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Hi.

I am still working on this. Just see my recent discussion with Pravin about the 
way to support out of tree drivers. If you have any opinion on that, please 
share on that thread, preferably with a patch. It's likely that Eric Garver 
will take this task as he was already working with me.

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


[ovs-dev] Proposal to move the Python lib to its own repo

2016-11-15 Thread Terry Wilson
The Python library isn't dependent on the code in the OVS tree. It
being in-tree has a few shortcomings. My rationale for recommending
the split:

* Simple features and bugfixes for the Python lib can't be used by
other projects (like Neutron) until the very latest OVS release is
widely supported

* Python 3 support is only available in version 2.6.0+ even though the
code would work for previous releases

* Implying that the Python lib and OVS versions are related when they
aren't is confusing

* A separate repo would allow adding committers that are familiar with
the Python code, but less familiar with the C code.

* As a Python-only project, it could be more easily tested, built, and
packaged according to Python project best practices.


The current build process requires the Python code, but this is easily
remedied by using git submodules. People tend to reflexively dislike
them, but they are perfect for this application. The OVS tree can lock
to any particular commit for the new python-ovs repo and be guaranteed
that changes don't break the ovs build. I made a fork to show how
simple the change would be:

https://github.com/otherwiseguy/ovs/commit/6766131b42807829ea78dbc43d164db8926030e7

commit 6766131b42807829ea78dbc43d164db8926030e7
Author: Terry Wilson 
Date:   Mon Nov 14 16:03:43 2016 -0600

Move python dir to a submodule

diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000..db21481
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "python"]
+   path = python
+   url = https://github.com/otherwiseguy/python-ovs
diff --git a/Makefile.am b/Makefile.am
index a14d48b..2ce40ee 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -225,7 +225,7 @@ dist-hook-git: distfiles
  (cd datapath && $(MAKE) distfiles);   \
  (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) |\
LC_ALL=C sort -u > all-distfiles;   \
- (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' |\
+ (cd $(srcdir) && git ls-files) | grep -v
'python\|\.git\(ignore\|modules\)$$' | \
LC_ALL=C sort -u > all-gitfiles;\
  LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
  if test -s missing-distfiles; then\
diff --git a/boot.sh b/boot.sh
index 05dd359..d9a48fa 100755
--- a/boot.sh
+++ b/boot.sh
@@ -1,2 +1,3 @@
 #! /bin/sh
+[ -d .git ] && git submodule update --init --recursive
 autoreconf --install --force
diff --git a/python b/python
new file mode 16
index 000..dd34813
--- /dev/null
+++ b/python
@@ -0,0 +1 @@
+Subproject commit dd348134a6e186725fe5aaa8d0a482fee0a88f2a

... < snip deleting python/ >

Feel free to check it out and verify that it works. I split out the
python directory here as a test
https://github.com/otherwiseguy/python-ovs.

As far as versioning, we could just pick a starting value of the new
library of something like 3.0.0, breaking it out from the OVS
versioning.

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


Re: [ovs-dev] [PATCH 1/4] ovn: Support DNAT with port.

2016-11-15 Thread Guru Shetty
On 15 November 2016 at 06:30, nickcooper-zhangtonghao 
wrote:

> Hi Guru Shetty.
> LB may support DNAT with port. But in some case, there is only a public ip
> address set on the gateway router, which is connected to multiple VMs. Thus
> this public ip address need to be projected to multiple private ip address.
> They denote a one to many relationship not one to one.
>
> I don't have many public ip, so it is not possible to do VIP:port =
> PrivateIP:port. I hope that we can do VIP:port1 = PrivateIP1:port1,
> VIP:port2 = PrivateIP2:port2 ...
>

We can do that with LB.



>
> Thanks.
> Nick
>
> On Nov 14, 2016, at 11:56 PM, Guru Shetty  wrote:
>
> We do support it right now via LB right? i.e. one VIP:port =
> PrivateIP:Port. With just one target, it acts the same as a DNAT.
>
>
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] rhel: Environment file option for northd service

2016-11-15 Thread Russell Bryant
On Tue, Nov 15, 2016 at 6:19 AM,  wrote:

> From: Babu Shanmugam 
>
> Since the northd service starts the DB servers as well, it will be
> better to have an environment file options in the systemd unit file for
> northd service.
> The environment file is expected to define NORTHD_OPTS
> which will have additional parameters to be passed to ovn-ctl script
> that starts ovn-northd.
>
> Signed-off-by: Babu Shanmugam 
> ---
>  rhel/usr_lib_systemd_system_ovn-northd.service | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/rhel/usr_lib_systemd_system_ovn-northd.service
> b/rhel/usr_lib_systemd_system_ovn-northd.service
> index 5b3b03a..12230e9 100644
> --- a/rhel/usr_lib_systemd_system_ovn-northd.service
> +++ b/rhel/usr_lib_systemd_system_ovn-northd.service
> @@ -7,6 +7,7 @@ After=openvswitch.service
>  [Service]
>  Type=oneshot
>  RemainAfterExit=yes
> +EnvironmentFile=-/etc/sysconfig/ovn-northd
>  Environment=OVS_RUNDIR=%t/openvswitch OVS_DBDIR=/var/lib/openvswitch
> -ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_northd
> +ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_northd
> $NORTHD_OPTS
>  ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_northd
>

I'm not sure this is necessary.  I believe something close enough is
possible with systemd already.

https://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F

or:

"Example 2. Overriding vendor settings"
https://www.freedesktop.org/software/systemd/man/systemd.unit.html

For ovn-northd, you would create a directory and config file,
/etc/systemd/system/ovn-northd.d/local.conf, with contents like:

[System]
Environment=MY_ENV_VAR=VALUE "MY_ENV_VAR2=VALUE 2"

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


[ovs-dev] FW: OVS 2.6.1 DPDK 16.07 issue: pthread_mutex_lock failed (Resource deadlock avoided) in

2016-11-15 Thread Yang, Yi Y
Hi, all

I found this issue when I use ovs 2.6.1 and dpdk 16.07, the error is located in 
the line "ovs_mutex_lock(>mutex);" in get_stats() in lib/netdev-vport.c, 
it looks like a deadlock is detected, so resulted in ovs-vswitchd coredump, 
anybody noticed this issue? How can we fix it? this has bothered me two days.


static int
get_stats(const struct netdev *netdev, struct netdev_stats *stats)
{
struct netdev_vport *dev = netdev_vport_cast(netdev);

ovs_mutex_lock(>mutex);
/* Passing only collected counters */
stats->tx_packets = dev->stats.tx_packets;
stats->tx_bytes = dev->stats.tx_bytes;
stats->rx_packets = dev->stats.rx_packets;
stats->rx_bytes = dev->stats.rx_bytes;
ovs_mutex_unlock(>mutex);

return 0;
}

If I commented out lock and unlock, I'll get the ovs log:

ovs_rcu(urcu3)|WARN|blocked 32000 ms waiting for revalidator8 to quiesce

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


[ovs-dev] quick loan

2016-11-15 Thread James Reardon


Do you need a personal,cooperate business loan to finance your business or 
refinance your mortgage?If your answer is YES kindly reply to 
waynep201...@gmail.com for details as we offer loan at 4% interest rate 
annually.



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


Re: [ovs-dev] [PATCH 1/4] ovn: Support DNAT with port.

2016-11-15 Thread nickcooper-zhangtonghao
Hi Guru Shetty.
LB may support DNAT with port. But in some case, there is only a public ip 
address set on the gateway router, which is connected to multiple VMs. Thus 
this public ip address need to be projected to multiple private ip address. 
They denote a one to many relationship not one to one.

I don't have many public ip, so it is not possible to do VIP:port = 
PrivateIP:port. I hope that we can do VIP:port1 = PrivateIP1:port1, 
VIP:port2 = PrivateIP2:port2 ...

Thanks.
Nick

> On Nov 14, 2016, at 11:56 PM, Guru Shetty  wrote:
> 
> We do support it right now via LB right? i.e. one VIP:port = PrivateIP:Port. 
> With just one target, it acts the same as a DNAT. 

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


Re: [ovs-dev] [PATCH net-next v13 0/8] openvswitch: support for layer 3 encapsulated packets

2016-11-15 Thread Yang, Yi Y
Hi, Jiri

I'm very glad to see you're continuing this work :-), I asked Simon about this 
twice, but nobody replies. I also remember Cascardo has a patch set to 
collaborate with this patch set, I asked Cascardo, but nobody responds, will 
you continue to do Cascardo's " create tunnel devices using rtnetlink 
interface" patch set? I test the old one v3, that can work with vxlan module in 
kernel, but if I build ovs with option " --with-linux=/lib/modules/`uname 
-r`/build", ovs vxlan module is built in vport_vxlan module, when I create 
vxlan-gpe port, kernel will automatically load vxlan module in the kernel 
instead of using the APIs in vport_vxlan module. 

Cascardo, are you still working on this?

-Original Message-
From: netdev-ow...@vger.kernel.org [mailto:netdev-ow...@vger.kernel.org] On 
Behalf Of Jiri Benc
Sent: Thursday, November 10, 2016 11:28 PM
To: net...@vger.kernel.org
Cc: d...@openvswitch.org; Pravin Shelar ; Lorand Jakab 
; Simon Horman 
Subject: [PATCH net-next v13 0/8] openvswitch: support for layer 3 encapsulated 
packets

At the core of this patch set is removing the assumption in Open vSwitch 
datapath that all packets have Ethernet header.

The implementation relies on the presence of pop_eth and push_eth actions in 
datapath flows to facilitate adding and removing Ethernet headers as 
appropriate. The construction of such flows is left up to user-space.

This series is based on work by Simon Horman, Lorand Jakab, Thomas Morin and 
others. I kept Lorand's and Simon's s-o-b in the patches that are derived from 
v11 to record their authorship of parts of the code.

Changes from v12 to v13:

* Addressed Pravin's feedback.
* Removed the GRE vport conversion patch; L3 GRE ports should be created by
  rtnetlink instead.

Main changes from v11 to v12:

* The patches were restructured and split differently for easier review.
* They were rebased and adjusted to the current net-next. Especially MPLS
  handling is different (and easier) thanks to the recent MPLS GSO rework.
* Several bugs were discovered and fixed. The most notable is fragment
  handling: header adjustment for ARPHRD_NONE devices on tx needs to be done
  after refragmentation, not before it. This required significant changes in
  the patchset. Another one is stricter checking of attributes (match on L2
  vs. L3 packet) at the kernel level.
* Instead of is_layer3 bool, a mac_proto field is used.

Jiri Benc (8):
  openvswitch: use hard_header_len instead of hardcoded ETH_HLEN
  openvswitch: add mac_proto field to the flow key
  openvswitch: pass mac_proto to ovs_vport_send
  openvswitch: support MPLS push and pop for L3 packets
  openvswitch: add processing of L3 packets
  openvswitch: netlink: support L3 packets
  openvswitch: add Ethernet push and pop actions
  openvswitch: allow L3 netdev ports

 include/uapi/linux/openvswitch.h |  15 
 net/openvswitch/actions.c| 111 +---
 net/openvswitch/datapath.c   |  13 +--
 net/openvswitch/flow.c   | 105 +--
 net/openvswitch/flow.h   |  22 +
 net/openvswitch/flow_netlink.c   | 179 ++-
 net/openvswitch/vport-netdev.c   |   9 +-
 net/openvswitch/vport.c  |  31 +--
 net/openvswitch/vport.h  |   2 +-
 9 files changed, 353 insertions(+), 134 deletions(-)

--
1.8.3.1

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


[ovs-dev] [PATCH] utilities: Use FQDN for external_ids:hostname in Openvswitch table

2016-11-15 Thread bschanmu
From: Babu Shanmugam 

Openstack compute manager uses FQDN to check for the hypervisors to
which the ports are bound.

Without this fix, no instances can be launched as the hypervisor's hostname
mismatches.

Signed-off-by: Babu Shanmugam 
---
 utilities/ovs-ctl.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index ce3fb58..79979c3 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -108,7 +108,7 @@ set_system_ids () {
 esac
 set "$@" external-ids:system-id="\"$SYSTEM_ID\""
 
-set "$@" external-ids:hostname="\"$(hostname)\""
+set "$@" external-ids:hostname="\"$(hostname -f)\""
 
 if test X"$SYSTEM_TYPE" != X; then
 set "$@" system-type="\"$SYSTEM_TYPE\""
-- 
1.9.1

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


[ovs-dev] [PATCH] rhel: Environment file option for northd service

2016-11-15 Thread bschanmu
From: Babu Shanmugam 

Since the northd service starts the DB servers as well, it will be
better to have an environment file options in the systemd unit file for
northd service.
The environment file is expected to define NORTHD_OPTS
which will have additional parameters to be passed to ovn-ctl script
that starts ovn-northd.

Signed-off-by: Babu Shanmugam 
---
 rhel/usr_lib_systemd_system_ovn-northd.service | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rhel/usr_lib_systemd_system_ovn-northd.service 
b/rhel/usr_lib_systemd_system_ovn-northd.service
index 5b3b03a..12230e9 100644
--- a/rhel/usr_lib_systemd_system_ovn-northd.service
+++ b/rhel/usr_lib_systemd_system_ovn-northd.service
@@ -7,6 +7,7 @@ After=openvswitch.service
 [Service]
 Type=oneshot
 RemainAfterExit=yes
+EnvironmentFile=-/etc/sysconfig/ovn-northd
 Environment=OVS_RUNDIR=%t/openvswitch OVS_DBDIR=/var/lib/openvswitch
-ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_northd
+ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_northd $NORTHD_OPTS
 ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_northd
-- 
1.9.1

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


[ovs-dev] [PATCH] sflow: Expose ethernet and vlan stats via sFlow

2016-11-15 Thread Robert Wojciechowicz
Expose existing netdev stats via sFlow.
Export sFlow ETHERNET structure with available counters.
Map existing stats to counters in the GENERIC INTERFACE
sFlow structure.
Export sFlow VLAN structure with available counters.
Adjust unit test to accommodate these new counters.

Signed-off-by: Robert Wojciechowicz 
---
 lib/sflow.h  |   2 +
 lib/sflow_receiver.c |   2 +-
 ofproto/ofproto-dpif-sflow.c |  52 +-
 ofproto/ofproto-dpif.c   |   8 ++
 ofproto/ofproto-provider.h   |   8 ++
 ofproto/ofproto.c|  16 +++
 ofproto/ofproto.h|   1 +
 tests/ofproto-dpif.at| 225 +++
 tests/test-sflow.c   |  43 -
 9 files changed, 332 insertions(+), 25 deletions(-)

diff --git a/lib/sflow.h b/lib/sflow.h
index 95bedd9..5beadc4 100644
--- a/lib/sflow.h
+++ b/lib/sflow.h
@@ -502,6 +502,8 @@ typedef struct _SFLVlan_counters {
 u_int32_t discards;
 } SFLVlan_counters;
 
+#define SFL_CTR_VLAN_XDR_SIZE 28
+
 /* OpenFlow port */
 typedef struct {
 u_int64_t datapath_id;
diff --git a/lib/sflow_receiver.c b/lib/sflow_receiver.c
index cde1359..8474628 100644
--- a/lib/sflow_receiver.c
+++ b/lib/sflow_receiver.c
@@ -649,7 +649,7 @@ static int computeCountersSampleSize(SFLReceiver *receiver, 
SFL_COUNTERS_SAMPLE_
case SFLCOUNTERS_ETHERNET: elemSiz = SFL_CTR_ETHERNET_XDR_SIZE; break;
case SFLCOUNTERS_TOKENRING: elemSiz = 
sizeof(elem->counterBlock.tokenring); break;
case SFLCOUNTERS_VG: elemSiz = sizeof(elem->counterBlock.vg); break;
-   case SFLCOUNTERS_VLAN: elemSiz = sizeof(elem->counterBlock.vlan); break;
+   case SFLCOUNTERS_VLAN: elemSiz = SFL_CTR_VLAN_XDR_SIZE; break;
case SFLCOUNTERS_LACP: elemSiz = SFL_CTR_LACP_XDR_SIZE; break;
case SFLCOUNTERS_OPENFLOWPORT: elemSiz = SFL_CTR_OPENFLOWPORT_XDR_SIZE; 
break;
case SFLCOUNTERS_PORTNAME: elemSiz = 
stringEncodingLength(>counterBlock.portName.portName); break;
diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c
index 9ea8851..21adba7 100644
--- a/ofproto/ofproto-dpif-sflow.c
+++ b/ofproto/ofproto-dpif-sflow.c
@@ -298,13 +298,17 @@ sflow_agent_get_counters(void *ds_, SFLPoller *poller,
 {
 struct dpif_sflow *ds = ds_;
 SFLCounters_sample_element elem, lacp_elem, of_elem, name_elem;
+SFLCounters_sample_element eth_elem;
+SFLCounters_sample_element vlan_elem;
 enum netdev_features current;
 struct dpif_sflow_port *dsp;
 SFLIf_counters *counters;
+SFLEthernet_counters* eth_counters;
 struct netdev_stats stats;
 enum netdev_flags flags;
 struct lacp_slave_stats lacp_stats;
 const char *ifName;
+int vlan_id = 0;
 
 dsp = dpif_sflow_find_port(ds, u32_to_odp(poller->bridgePort));
 if (!dsp) {
@@ -343,14 +347,14 @@ sflow_agent_get_counters(void *ds_, SFLPoller *poller,
 counters->ifInOctets = stats.rx_bytes;
 counters->ifInUcastPkts = stats.rx_packets;
 counters->ifInMulticastPkts = stats.multicast;
-counters->ifInBroadcastPkts = -1;
+counters->ifInBroadcastPkts = stats.rx_broadcast_packets;
 counters->ifInDiscards = stats.rx_dropped;
 counters->ifInErrors = stats.rx_errors;
 counters->ifInUnknownProtos = -1;
 counters->ifOutOctets = stats.tx_bytes;
 counters->ifOutUcastPkts = stats.tx_packets;
-counters->ifOutMulticastPkts = -1;
-counters->ifOutBroadcastPkts = -1;
+counters->ifOutMulticastPkts = stats.tx_multicast_packets;
+counters->ifOutBroadcastPkts = stats.tx_broadcast_packets;
 counters->ifOutDiscards = stats.tx_dropped;
 counters->ifOutErrors = stats.tx_errors;
 counters->ifPromiscuousMode = 0;
@@ -407,6 +411,48 @@ sflow_agent_get_counters(void *ds_, SFLPoller *poller,
   (OVS_FORCE uint32_t)dsp->ofport->ofp_port;
 SFLADD_ELEMENT(cs, _elem);
 
+/* Include ethernet counters */
+memset(_elem, 0, sizeof eth_elem);
+eth_elem.tag = SFLCOUNTERS_ETHERNET;
+eth_counters = _elem.counterBlock.ethernet;
+eth_counters->dot3StatsAlignmentErrors = stats.rx_frame_errors;
+eth_counters->dot3StatsFCSErrors = stats.rx_crc_errors;
+eth_counters->dot3StatsFrameTooLongs = stats.rx_oversize_errors;
+SFL_UNDEF_COUNTER(eth_counters->dot3StatsSingleCollisionFrames);
+SFL_UNDEF_COUNTER(eth_counters->dot3StatsMultipleCollisionFrames);
+SFL_UNDEF_COUNTER(eth_counters->dot3StatsSQETestErrors);
+SFL_UNDEF_COUNTER(eth_counters->dot3StatsDeferredTransmissions);
+SFL_UNDEF_COUNTER(eth_counters->dot3StatsLateCollisions);
+SFL_UNDEF_COUNTER(eth_counters->dot3StatsExcessiveCollisions);
+SFL_UNDEF_COUNTER(eth_counters->dot3StatsInternalMacTransmitErrors);
+SFL_UNDEF_COUNTER(eth_counters->dot3StatsCarrierSenseErrors);
+SFL_UNDEF_COUNTER(eth_counters->dot3StatsInternalMacReceiveErrors);
+SFL_UNDEF_COUNTER(eth_counters->dot3StatsSymbolErrors);
+SFLADD_ELEMENT(cs, _elem);
+
+/* 

[ovs-dev] [PATCH 2/3] ovs-router: report error when failing to insert route

2016-11-15 Thread Thadeu Lima de Souza Cascardo
Signed-off-by: Thadeu Lima de Souza Cascardo 
---
 lib/ovs-router.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ovs-router.c b/lib/ovs-router.c
index e27514a..e29d462 100644
--- a/lib/ovs-router.c
+++ b/lib/ovs-router.c
@@ -316,7 +316,7 @@ ovs_router_add(struct unixctl_conn *conn, int argc,
 }
 err = ovs_router_insert__(plen + 32, , plen, argv[2], );
 if (err) {
-unixctl_command_reply(conn, "Error while inserting route.");
+unixctl_command_reply_error(conn, "Error while inserting route.");
 } else {
 unixctl_command_reply(conn, "OK");
 }
-- 
2.7.4

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