lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150925043640.GB18915@ketchup.lan>
Date:	Fri, 25 Sep 2015 00:36:40 -0400
From:	Vivien Didelot <vivien.didelot@...oirfairelinux.com>
To:	Jiri Pirko <jiri@...nulli.us>
Cc:	netdev@...r.kernel.org, davem@...emloft.net, idosch@...lanox.com,
	eladr@...lanox.com, sfeldma@...il.com, f.fainelli@...il.com,
	linux@...ck-us.net, rami.rosen@...el.com,
	roopa@...ulusnetworks.com, pjonnala@...adcom.com, andrew@...n.ch,
	gospo@...ulusnetworks.com, Jiri Pirko <jiri@...lanox.com>
Subject: Re: [patch net-next v3 02/10] switchdev: introduce transaction item
 queue for attr_set and obj_add

Hi Jiri,

On Sep. Thursday 24 (39) 10:02 AM, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@...lanox.com>
> 
> Now, the memory allocation in prepare/commit state is done separatelly
> in each driver (rocker). Introduce the similar mechanism in generic
> switchdev code, in form of queue. That can be used not only for memory
> allocations, but also for different items. Abort item destruction
> is handled as well.
> 
> Signed-off-by: Jiri Pirko <jiri@...lanox.com>

[...]

>  /**
>   * struct switchdev_ops - switchdev operations
>   *
> @@ -94,9 +110,11 @@ struct switchdev_ops {
>  	int	(*switchdev_port_attr_get)(struct net_device *dev,
>  					   struct switchdev_attr *attr);
>  	int	(*switchdev_port_attr_set)(struct net_device *dev,
> -					   struct switchdev_attr *attr);
> +					   struct switchdev_attr *attr,
> +					   struct switchdev_trans *trans);
>  	int	(*switchdev_port_obj_add)(struct net_device *dev,
> -					  struct switchdev_obj *obj);
> +					  struct switchdev_obj *obj,
> +					  struct switchdev_trans *trans);
>  	int	(*switchdev_port_obj_del)(struct net_device *dev,
>  					  struct switchdev_obj *obj);
>  	int	(*switchdev_port_obj_dump)(struct net_device *dev,

This version is better than the current state, but it's too bad we
didn't get feedback yet on the real purpose of this 2-phase model...

Anyway, if we do need that, my wish would be to at least make it
optional. What do you think about having an optional prepare op?

    int (*switchdev_port_obj_prepare)(struct net_device *dev,
                                      struct switchdev_obj *obj,
                                      struct switchdev_prepare *prep);

So that the switchdev_port_obj_add function may look like this:

    int switchdev_port_obj_add(struct net_device *dev,
                               struct switchdev_obj *obj)
    {
        struct switchdev_prepare prep;
        int err;

        ASSERT_RTNL();

        switchdev_trans_init(&prep);

        err = __switchdev_port_obj_prepare(dev, obj, &prep);
        if (!err)
            err = __switchdev_port_obj_add(dev, obj, &prep);

        switchdev_prepare_items_destroy(dev, &prep);

        return err;
    }

So drivers can implement the prepare operation if they want to setup a
transaction. You won't have to carry a boolean around, no need for extra
switchdev_trans_ph_{prepare,commit} helpers, and drivers add operation
become simpler.

Same goes for attr_set for sure. Note that I suggest "switchdev_prepare"
instead of "switchdev_trans" to avoid renaming commits and being more
explicit, but it doesn't really matter.

Thanks,
-v
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ