[ovs-dev] [PATCH 3/3] datapath: Add 32-bit compatibility ioctls.

Jesse Gross jesse at nicira.com
Thu May 13 00:38:40 UTC 2010


On Mon, May 10, 2010 at 2:13 PM, Ben Pfaff <blp at nicira.com> wrote:
>
> @@ -40,6 +40,7 @@
>  #include <linux/workqueue.h>
>  #include <linux/dmi.h>
>  #include <net/inet_ecn.h>
> +#include <linux/compat.h>
>
>  #include "openvswitch/datapath-protocol.h"
>  #include "datapath.h"
>

Probably should include odp-compat.h here.


> +       switch (cmd) {
> +       case ODP_DP_DESTROY:
> +       case ODP_PORT_DETACH:
> +       case ODP_FLOW_FLUSH:
> +               /* Ioctls that don't need any translation at all. */
> +               return openvswitch_ioctl(f, cmd, argp);
>

ODP_PORT_DETACH uses its argp as a pointer so it needs translation.  It
probably also should have a ODP_PORT_DETACH32 defined for it.


> +#define ODP_FLOW_DEL32         _IOWR('O', 17, struct compat_odp_flow)
> +#define ODP_EXECUTE32          _IOR('O', 18, struct compat_odp_execute)
> +#define ODP_FLOW_DEL32         _IOWR('O', 17, struct compat_odp_flow)
> +#define ODP_EXECUTE32          _IOR('O', 18, struct compat_odp_execute)
>

ODP_EXECUTE32 is defined twice.


>
> +#ifdef CONFIG_COMPAT
> +int
> +compat_vport_add(struct compat_odp_vport_add *ucompat)
> +{
> +       struct compat_odp_vport_add compat;
> +       struct odp_vport_add vport_config;
> +
> +       if (copy_from_user(&compat, ucompat, sizeof(struct
> compat_odp_vport_add)))
> +               return -EFAULT;
> +
> +       memcpy(vport_config.port_type, compat.port_type, VPORT_TYPE_SIZE);
> +       memcpy(vport_config.devname, compat.devname, IFNAMSIZ);
> +       vport_config.config = compat_ptr(compat.config);
> +
> +       return do_vport_add(&vport_config);
> +}
> +#endif
>

We may need to propagate whether this is a compat ioctl or not to the vport
implementer.  Currently none of them have embedded pointers in their config
though.

The rest looks good.  I have a feeling that this is going to be a pain going
forward though.  It seems like it might be nice to group together and
isolate the compat code but that would also probably make it less likely to
get updated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20100512/a5bc45b3/attachment-0003.html>


More information about the dev mailing list