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 03/13] net: introduce generic switch devices support
Date: Wed, 03 Sep 2014 08:46:23 -0700	[thread overview]
Message-ID: <540737CF.4000402@gmail.com> (raw)
In-Reply-To: <1409736300-12303-4-git-send-email-jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>

On 09/03/2014 02:24 AM, Jiri Pirko wrote:
> The goal of this is to provide a possibility to suport various switch
> chips. Drivers should implement relevant ndos to do so. Now there is a
> couple of ndos defines:
> - for getting physical switch id is in place.
> - for work with flows.
>
> Note that user can use random port netdevice to access the switch.
>
> Signed-off-by: Jiri Pirko <jiri-rHqAuBHg3fBzbRFIqnYvSA@public.gmane.org>
> ---


[...]

>   struct netpoll_info;
> @@ -997,6 +999,24 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
>    *	Callback to use for xmit over the accelerated station. This
>    *	is used in place of ndo_start_xmit on accelerated net
>    *	devices.
> + *
> + * int (*ndo_swdev_get_id)(struct net_device *dev,
> + *			   struct netdev_phys_item_id *psid);
> + *	Called to get an ID of the switch chip this port is part of.
> + *	If driver implements this, it indicates that it represents a port
> + *	of a switch chip.
> + *
> + * int (*ndo_swdev_flow_insert)(struct net_device *dev,
> + *				const struct sw_flow *flow);
> + *	Called to insert a flow into switch device. If driver does
> + *	not implement this, it is assumed that the hw does not have
> + *	a capability to work with flows.
> + *
> + * int (*ndo_swdev_flow_remove)(struct net_device *dev,
> + *				const struct sw_flow *flow);
> + *	Called to remove a flow from switch device. If driver does
> + *	not implement this, it is assumed that the hw does not have
> + *	a capability to work with flows.
>    */
>   struct net_device_ops {
>   	int			(*ndo_init)(struct net_device *dev);
> @@ -1146,6 +1166,14 @@ struct net_device_ops {
>   							struct net_device *dev,
>   							void *priv);
>   	int			(*ndo_get_lock_subclass)(struct net_device *dev);
> +#ifdef CONFIG_NET_SWITCHDEV
> +	int			(*ndo_swdev_get_id)(struct net_device *dev,
> +						    struct netdev_phys_item_id *psid);
> +	int			(*ndo_swdev_flow_insert)(struct net_device *dev,
> +							 const struct sw_flow *flow);
> +	int			(*ndo_swdev_flow_remove)(struct net_device *dev,
> +							 const struct sw_flow *flow);

Not really a critique of your patch but I'll need to extend this
with a ndo_swdev_flow_dump() to get the fields. Without this if
your user space side ever restarts, gets out of sync there is no
way to get back in sync.

Also with hardware that has multiple flow tables we need to indicate
the table to insert the flow into. One concrete reason to do this
is to create atomic updates of multiple ACLs. The idea is to create
a new ACL table build the table up and then link it in. This can be
added when its needed my opensource drivers don't support this yet
either but maybe adding multiple tables to rocker switch will help
flush this out.

Finally we need some way to drive capabilities out of the swdev.
Even rocker switch needs this to indicate it doesn't support matching
on all the sw_flow fields. Without this its not clear to me how to
manage the device from user space. I tried writing user space daemon
for the simpler flow director interface and the try and see model
breaks quickly.

> +#endif
>   };
>
>   /**
> diff --git a/include/net/sw_flow.h b/include/net/sw_flow.h
> index 21724f1..3af7758 100644
> --- a/include/net/sw_flow.h
> +++ b/include/net/sw_flow.h
> @@ -81,7 +81,21 @@ struct sw_flow_mask {
>   	struct sw_flow_key key;
>   };
>
> +enum sw_flow_action_type {
> +	SW_FLOW_ACTION_TYPE_OUTPUT,
> +	SW_FLOW_ACTION_TYPE_VLAN_PUSH,
> +	SW_FLOW_ACTION_TYPE_VLAN_POP,
> +};
> +

OK my previous comment about having another patch to create
generic actions seems to be resolved here. I'm not sure how
important it is but if we abstract the flow types away from
OVS is there any reason not to reuse and relabel the action
types as well? I guess we can't break userspace API but maybe
a 1:1 mapping would be better?

>   struct sw_flow_action {
> +	enum sw_flow_action_type type;
> +	union {
> +		u32 out_port_ifindex;
> +		struct {
> +			__be16 vlan_proto;
> +			u16 vlan_tci;
> +		} vlan;
> +	};
>   };

[...]

I think my comments could be addressed with additional patches
if you want. I could help but it will be another week or so
before I have some time. The biggest issue IMO is the lack of
capabilities queries.

Thanks,
John


-- 
John Fastabend         Intel Corporation

  parent reply	other threads:[~2014-09-03 15:46 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 [this message]
     [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
     [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=540737CF.4000402@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).