datapath: Change vport type from string to integer enumeration.
[sliver-openvswitch.git] / include / openvswitch / datapath-protocol.h
index 7661229..1d68445 100644 (file)
@@ -85,7 +85,7 @@
 #define ODP_VPORT_ATTACH        _IOR('O', 7, struct odp_port)
 #define ODP_VPORT_DETACH        _IOR('O', 8, int)
 #define ODP_VPORT_QUERY         _IOWR('O', 9, struct odp_port)
-#define ODP_VPORT_LIST          _IOWR('O', 10, struct odp_portvec)
+#define ODP_VPORT_DUMP          _IOWR('O', 10, struct odp_vport_dump)
 
 #define ODP_FLOW_GET            _IOWR('O', 13, struct odp_flowvec)
 #define ODP_FLOW_PUT            _IOWR('O', 14, struct odp_flow)
@@ -176,20 +176,41 @@ struct odp_packet {
        uint32_t len;
 };
 
-#define VPORT_TYPE_SIZE     16
 #define VPORT_CONFIG_SIZE     32
 struct odp_port {
     char devname[16];           /* IFNAMSIZ */
-    char type[VPORT_TYPE_SIZE];
+    uint32_t type;              /* One of ODP_VPORT_TYPE_*. */
     uint16_t port;
-    uint16_t reserved1;
+    uint16_t dp_idx;
     uint32_t reserved2;
     __aligned_u64 config[VPORT_CONFIG_SIZE / 8]; /* type-specific */
 };
 
-struct odp_portvec {
-    struct odp_port *ports;
-    uint32_t n_ports;
+enum odp_vport_type {
+       ODP_VPORT_TYPE_UNSPEC,
+       ODP_VPORT_TYPE_NETDEV,   /* network device */
+       ODP_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
+       ODP_VPORT_TYPE_PATCH,    /* virtual tunnel connecting two vports */
+       ODP_VPORT_TYPE_GRE,      /* GRE tunnel */
+       ODP_VPORT_TYPE_CAPWAP,   /* CAPWAP tunnel */
+       __ODP_VPORT_TYPE_MAX
+};
+
+#define ODP_VPORT_TYPE_MAX (__ODP_VPORT_TYPE_MAX - 1)
+
+/**
+ * struct odp_vport_dump - ODP_VPORT_DUMP argument.
+ * @port: Points to port structure to fill in.
+ * @port_no: Minimum port number of interest.
+ *
+ * Used to iterate through vports one at a time.  The kernel fills in @port
+ * with the information for the configured port with the smallest port number
+ * greater than or equal to @port_no.  If there is no such port, it sets
+ * @port->devname to the empty string.
+ */
+struct odp_vport_dump {
+    struct odp_port *port;
+    uint32_t port_no;
 };
 
 struct odp_flow_stats {