diff options
author | Ben Pfaff <blp@nicira.com> | 2010-05-13 15:25:27 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2010-05-13 15:29:51 -0700 |
commit | 3fbd517acfd8dba2cd75fa234b0eb3337d202d33 (patch) | |
tree | 97319cfbf75de5b1df2632441d37ffefc63591ff /datapath/odp-compat.h | |
parent | 776f10ce0f008e95b457f8c6b69b9748d8d1fdbd (diff) |
datapath: Add 32-bit compatibility ioctls.
When a 32-bit userspace program runs on a 64-bit kernel, data structures
that contain members whose sizes or alignments change from 32- to 64-bit
must be translated when they are passed to ioctls. This commit adds such
support for openvswitch_mod.
We should really reconsider some parts of the Open vSwitch ioctl interface
to avoid needing as much translation as we do.
Lightly tested with 32-bit userspace on sparc64.
Diffstat (limited to 'datapath/odp-compat.h')
-rw-r--r-- | datapath/odp-compat.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/datapath/odp-compat.h b/datapath/odp-compat.h new file mode 100644 index 00000000..3d7b803f --- /dev/null +++ b/datapath/odp-compat.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2010 Nicira Networks. + * Distributed under the terms of the GNU GPL version 2. + * + * Significant portions of this file may be copied from parts of the Linux + * kernel, by Linus Torvalds and others. + */ + +#ifndef ODP_COMPAT_H +#define ODP_COMPAT_H 1 + +/* 32-bit ioctl compatibility definitions for datapath protocol. */ + +#ifdef CONFIG_COMPAT +#include "openvswitch/datapath-protocol.h" +#include <linux/compat.h> + +#define ODP_PORT_LIST32 _IOWR('O', 10, struct compat_odp_portvec) +#define ODP_PORT_GROUP_SET32 _IOR('O', 11, struct compat_odp_port_group) +#define ODP_PORT_GROUP_GET32 _IOWR('O', 12, struct compat_odp_port_group) +#define ODP_FLOW_GET32 _IOWR('O', 13, struct compat_odp_flow) +#define ODP_FLOW_PUT32 _IOWR('O', 14, struct compat_odp_flow) +#define ODP_FLOW_LIST32 _IOWR('O', 15, struct compat_odp_flowvec) +#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_VPORT_ADD32 _IOR('O', 21, struct compat_odp_vport_add) +#define ODP_VPORT_MOD32 _IOR('O', 22, struct compat_odp_vport_mod) + +struct compat_odp_portvec { + compat_uptr_t ports; + u32 n_ports; +}; + +struct compat_odp_port_group { + compat_uptr_t ports; + u16 n_ports; /* Number of ports. */ + u16 group; /* Group number. */ +}; + +struct compat_odp_flow { + struct odp_flow_stats stats; + struct odp_flow_key key; + compat_uptr_t actions; + u32 n_actions; + u32 flags; +}; + +struct compat_odp_flow_put { + struct compat_odp_flow flow; + u32 flags; +}; + +struct compat_odp_flowvec { + compat_uptr_t flows; + u32 n_flows; +}; + +struct compat_odp_execute { + u16 in_port; + u16 reserved1; + u32 reserved2; + + compat_uptr_t actions; + u32 n_actions; + + compat_uptr_t data; + u32 length; +}; + +struct compat_odp_vport_add { + char port_type[VPORT_TYPE_SIZE]; + char devname[16]; /* IFNAMSIZ */ + compat_uptr_t config; +}; + +struct compat_odp_vport_mod { + char devname[16]; /* IFNAMSIZ */ + compat_uptr_t config; +}; +#endif /* CONFIG_COMPAT */ + +#endif /* odp-compat.h */ |