/* Logical ports. */
#define ODPP_LOCAL ((__u16)0)
#define ODPP_NONE ((__u16)-1)
+#define ODPP_NORMAL ((__u16)-2)
/* Listening channels. */
#define _ODPL_MISS_NR 0 /* Packet missed in flow table. */
#define ODPL_SFLOW (1 << _ODPL_SFLOW_NR)
#define ODPL_ALL (ODPL_MISS | ODPL_ACTION | ODPL_SFLOW)
-/* Format of messages read from datapath fd. */
+/**
+ * struct odp_msg - format of messages read from datapath fd.
+ * @type: One of the %_ODPL_* constants.
+ * @length: Total length of message, including this header.
+ * @port: Port that received the packet embedded in this message.
+ * @reserved: Not currently used. Should be set to 0.
+ * @arg: Argument value whose meaning depends on @type.
+ *
+ * For @type == %_ODPL_MISS_NR, the header is followed by packet data. The
+ * @arg member is unused and set to 0.
+ *
+ * For @type == %_ODPL_ACTION_NR, the header is followed by packet data. The
+ * @arg member is copied from the &struct odp_action_controller that caused
+ * the &struct odp_msg to be composed.
+ *
+ * For @type == %_ODPL_SFLOW_NR, the header is followed by &struct
+ * odp_sflow_sample_header, then by an array of &union odp_action (the number
+ * of which is specified in &struct odp_sflow_sample_header), then by packet
+ * data.
+ */
struct odp_msg {
- __u32 type; /* _ODPL_MISS_NR or _ODPL_ACTION_NR. */
- __u32 length; /* Message length, including header. */
- __u16 port; /* Port on which frame was received. */
+ __u32 type;
+ __u32 length;
+ __u16 port;
__u16 reserved;
- __u32 arg; /* Argument value specified in action. */
-
- /*
- * Followed by:
- *
- * ODPL_MISS, ODPL_ACTION: packet data.
- *
- * ODPL_SFLOW: "struct odp_sflow_sample_header", followed by
- * an array of "union odp_action"s, followed by packet data.
- */
+ __u32 arg;
};
-/* Header added to sFlow sampled packet. */
+/**
+ * struct odp_sflow_sample_header - header added to sFlow sampled packet.
+ * @sample_pool: Number of packets that were candidates for sFlow sampling,
+ * regardless of whether they were actually chosen and sent down to userspace.
+ * @n_actions: Number of "union odp_action"s immediately following this header.
+ *
+ * This header follows &struct odp_msg when that structure's @type is
+ * %_ODPL_SFLOW_NR, and it is itself followed by an array of &union odp_action
+ * (the number of which is specified in @n_actions) and then by packet data.
+ */
struct odp_sflow_sample_header {
- __u64 sample_pool; /* Number of potentially sampled packets. */
- __u32 n_actions; /* Number of following "union odp_action"s. */
- __u32 reserved; /* Pad up to 64-bit boundary. */
- /* Followed by n_action "union odp_action"s. */
+ __u32 sample_pool;
+ __u32 n_actions;
};
#define ODP_PORT_INTERNAL (1 << 0) /* This port is simulated. */
__u8 dl_dst[ETH_ALEN]; /* Ethernet destination address. */
__u8 nw_proto; /* IP protocol or lower 8 bits of
ARP opcode. */
- __u8 reserved; /* Pad to 64 bits. */
+ __u8 dl_vlan_pcp; /* Input VLAN priority. */
+ __u8 nw_tos; /* IP ToS (DSCP field, 6 bits). */
+ __u8 reserved[3]; /* Align to 32-bits...must be zeroed. */
};
/* Flags for ODP_FLOW. */
#define ODPAT_SET_DL_DST 7 /* Ethernet destination address. */
#define ODPAT_SET_NW_SRC 8 /* IP source address. */
#define ODPAT_SET_NW_DST 9 /* IP destination address. */
-#define ODPAT_SET_TP_SRC 10 /* TCP/UDP source port. */
-#define ODPAT_SET_TP_DST 11 /* TCP/UDP destination port. */
-#define ODPAT_N_ACTIONS 12
+#define ODPAT_SET_NW_TOS 10 /* IP ToS/DSCP field (6 bits). */
+#define ODPAT_SET_TP_SRC 11 /* TCP/UDP source port. */
+#define ODPAT_SET_TP_DST 12 /* TCP/UDP destination port. */
+#define ODPAT_N_ACTIONS 13
struct odp_action_output {
__u16 type; /* ODPAT_OUTPUT. */
__be32 nw_addr; /* IP address. */
};
+struct odp_action_nw_tos {
+ __u16 type; /* ODPAT_SET_NW_TOS. */
+ __u8 nw_tos; /* IP ToS/DSCP field (6 bits). */
+ __u8 reserved1;
+ __u16 reserved2;
+ __u16 reserved3;
+};
+
/* Action structure for ODPAT_SET_TP_SRC/DST. */
struct odp_action_tp_port {
__u16 type; /* ODPAT_SET_TP_SRC/DST. */
struct odp_action_vlan_pcp vlan_pcp;
struct odp_action_dl_addr dl_addr;
struct odp_action_nw_addr nw_addr;
+ struct odp_action_nw_tos nw_tos;
struct odp_action_tp_port tp_port;
};