netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jiri Pirko <jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
Cc: ryazanov.s.a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	jasowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	Neil.Jerram-QnUH15yq9NYqDJ6do+/SaQ@public.gmane.org,
	edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	andy-QlMahl40kYEqcZcGjlUOXw@public.gmane.org,
	dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org,
	nbd-p3rKhJxN3npAfugRpC6u6w@public.gmane.org,
	f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	ronye-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org,
	buytenh-OLH4Qvv75CYX/NnBR394Jw@public.gmane.org,
	roopa-qUQiAmfTcIp+XZJcv9eMoEEOCMrvLtNR@public.gmane.org,
	jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org,
	aviadr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
	nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public.gmane.org,
	vyasevic-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org,
	dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Subject: Re: [patch net-next 10/13] openvswitch: add support for datapath hardware offload
Date: Wed, 03 Sep 2014 09:37:08 -0700	[thread overview]
Message-ID: <540743B4.9080500@gmail.com> (raw)
In-Reply-To: <1409736300-12303-11-git-send-email-jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>

On 09/03/2014 02:24 AM, Jiri Pirko wrote:
> Benefit from the possibility to work with flows in switch devices and
> use the swdev api to offload flow datapath.
>
> Signed-off-by: Jiri Pirko <jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
> ---
>   net/openvswitch/Makefile       |   3 +-
>   net/openvswitch/datapath.c     |  33 ++++++
>   net/openvswitch/datapath.h     |   3 +
>   net/openvswitch/flow_table.c   |   1 +
>   net/openvswitch/hw_offload.c   | 245 +++++++++++++++++++++++++++++++++++++++++
>   net/openvswitch/hw_offload.h   |  22 ++++
>   net/openvswitch/vport-netdev.c |   3 +
>   net/openvswitch/vport.h        |   2 +
>   8 files changed, 311 insertions(+), 1 deletion(-)
>   create mode 100644 net/openvswitch/hw_offload.c
>   create mode 100644 net/openvswitch/hw_offload.h
>
> diff --git a/net/openvswitch/Makefile b/net/openvswitch/Makefile
> index 3591cb5..5152437 100644
> --- a/net/openvswitch/Makefile
> +++ b/net/openvswitch/Makefile
> @@ -13,7 +13,8 @@ openvswitch-y := \
>   	flow_table.o \
>   	vport.o \
>   	vport-internal_dev.o \
> -	vport-netdev.o
> +	vport-netdev.o \
> +	hw_offload.o
>
>   ifneq ($(CONFIG_OPENVSWITCH_VXLAN),)
>   openvswitch-y += vport-vxlan.o
> diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
> index 75bb07f..3e43e1d 100644
> --- a/net/openvswitch/datapath.c
> +++ b/net/openvswitch/datapath.c
> @@ -57,6 +57,7 @@
>   #include "flow_netlink.h"
>   #include "vport-internal_dev.h"
>   #include "vport-netdev.h"
> +#include "hw_offload.h"
>
>   int ovs_net_id __read_mostly;
>
> @@ -864,6 +865,9 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
>   			acts = NULL;
>   			goto err_unlock_ovs;
>   		}
> +		error = ovs_hw_flow_insert(dp, new_flow);
> +		if (error)
> +			pr_warn("failed to insert flow into hw\n");

This is really close to silently failing. I think we need to
hard fail here somehow and push it back to userspace as part of
the reply and ovs_notify.

Otherwise I don't know how to manage the hardware correctly. Consider
the hardware table is full. In this case user space will continue to
add rules and they will be silently discarded. Similarly if user space
adds a flow/action that can not be supported by the hardware it will
be silently ignored.

Even if we do careful accounting on resources in user space we could
still get an ENOMEM error from sw_flow_action_create.

Same comment for the other hw commands flush/remove.

>   		if (unlikely(reply)) {
>   			error = ovs_flow_cmd_fill_info(new_flow,
> @@ -896,10 +900,18 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct genl_info *info)
>   				goto err_unlock_ovs;
>   			}
>   		}


[...]


Thanks,
John

-- 
John Fastabend         Intel Corporation

  parent reply	other threads:[~2014-09-03 16:37 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03  9:24 [patch net-next 00/13] introduce rocker switch driver with openvswitch hardware accelerated datapath Jiri Pirko
2014-09-03  9:24 ` [patch net-next 01/13] openvswitch: split flow structures into ovs specific and generic ones Jiri Pirko
     [not found]   ` <1409736300-12303-2-git-send-email-jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
2014-09-03 15:20     ` John Fastabend
     [not found]       ` <540731B9.4010603-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-03 18:42         ` Pravin Shelar
     [not found]           ` <CALnjE+rk26Om1O5_Q=8tn7eAyh4Ywen-1+UD_nCVj_geZY1HuQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-04 12:25             ` Jiri Pirko
2014-09-04 12:09         ` Jiri Pirko
2014-09-03 21:11       ` Jamal Hadi Salim
2014-09-03 18:41   ` Pravin Shelar
2014-09-03 21:22     ` Jamal Hadi Salim
     [not found]       ` <54078694.5040104-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
2014-09-03 21:59         ` Pravin Shelar
     [not found]           ` <CALnjE+qUqSK7kHSi5BZuA0hzFjMcZ8TCTd9JRG1PPmMfDmAQOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-04  1:54             ` Jamal Hadi Salim
     [not found]     ` <CALnjE+pscRmfhaWgkWCunJfjvG04RiNUAj6nefSFHrknQTC+xw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-04 12:33       ` Jiri Pirko
     [not found]         ` <20140904123323.GF1867-6KJVSR23iU5sFDB2n11ItA@public.gmane.org>
2014-09-04 20:46           ` Pravin Shelar
2014-09-17  8:34             ` Jiri Pirko
2014-09-17 22:07               ` Jesse Gross
2014-09-03  9:24 ` [patch net-next 02/13] net: rename netdev_phys_port_id to more generic name Jiri Pirko
     [not found] ` <1409736300-12303-1-git-send-email-jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
2014-09-03  9:24   ` [patch net-next 03/13] net: introduce generic switch devices support Jiri Pirko
     [not found]     ` <1409736300-12303-4-git-send-email-jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
2014-09-03 15:46       ` John Fastabend
     [not found]         ` <540737CF.4000402-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-04 12:46           ` Jiri Pirko
2014-09-03  9:24   ` [patch net-next 04/13] rtnl: expose physical switch id for particular device Jiri Pirko
2014-09-03  9:24   ` [patch net-next 05/13] net-sysfs: " Jiri Pirko
2014-09-03  9:24   ` [patch net-next 06/13] net: introduce dummy switch Jiri Pirko
2014-09-03  9:24   ` [patch net-next 07/13] dsa: implement ndo_swdev_get_id Jiri Pirko
     [not found]     ` <1409736300-12303-8-git-send-email-jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
2014-09-03 23:20       ` Florian Fainelli
     [not found]         ` <5407A25A.8050401-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-04 12:47           ` Jiri Pirko
     [not found]             ` <20140904124701.GH1867-6KJVSR23iU5sFDB2n11ItA@public.gmane.org>
2014-09-05  4:43               ` Felix Fietkau
2014-09-05  5:52                 ` Jiri Pirko
2014-09-03  9:24   ` [patch net-next 10/13] openvswitch: add support for datapath hardware offload Jiri Pirko
     [not found]     ` <1409736300-12303-11-git-send-email-jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
2014-09-03 16:37       ` John Fastabend [this message]
     [not found]         ` <540743B4.9080500-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-04 12:48           ` Jiri Pirko
     [not found]             ` <20140904124837.GI1867-6KJVSR23iU5sFDB2n11ItA@public.gmane.org>
2014-09-05  3:59               ` Simon Horman
2014-09-03  9:24   ` [patch net-next 11/13] sw_flow: add misc section to key with in_port_ifindex field Jiri Pirko
2014-09-03  9:24   ` [patch net-next 12/13] rocker: introduce rocker switch driver Jiri Pirko
2014-09-03  9:24 ` [patch net-next 08/13] net: introduce netdev_phys_item_ids_match helper Jiri Pirko
2014-09-03  9:24 ` [patch net-next 09/13] openvswitch: introduce vport_op get_netdev Jiri Pirko
2014-09-03  9:25 ` [patch net-next 13/13] switchdev: introduce Netlink API Jiri Pirko
2014-09-08 13:54 ` [patch net-next 00/13] introduce rocker switch driver with openvswitch hardware accelerated datapath Thomas Graf
2014-09-09 21:09   ` Alexei Starovoitov
2014-09-15 12:43     ` Thomas Graf
2014-09-16 15:58   ` Jiri Pirko
     [not found]     ` <20140916155832.GA1869-6KJVSR23iU488b5SBfVpbw@public.gmane.org>
2015-06-29  5:44       ` Neelakantam Gaddam
     [not found]         ` <CAOv37=BNU1-+kgTR6RUqxw7snJL6=5g-rLYhuPc1F-V0B1k7tA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-29  5:46           ` Jiri Pirko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=540743B4.9080500@gmail.com \
    --to=john.fastabend-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Neil.Jerram-QnUH15yq9NYqDJ6do+/SaQ@public.gmane.org \
    --cc=andy-QlMahl40kYEqcZcGjlUOXw@public.gmane.org \
    --cc=aviadr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=ben-/+tVBieCtBitmTQ+vhA3Yw@public.gmane.org \
    --cc=buytenh-OLH4Qvv75CYX/NnBR394Jw@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org \
    --cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
    --cc=edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=jasowang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org \
    --cc=jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org \
    --cc=john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=nbd-p3rKhJxN3npAfugRpC6u6w@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
    --cc=nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public.gmane.org \
    --cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=ronye-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=roopa-qUQiAmfTcIp+XZJcv9eMoEEOCMrvLtNR@public.gmane.org \
    --cc=ryazanov.s.a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org \
    --cc=vyasevic-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).