aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2011-10-22 18:22:18 -0700
committerJesse Gross <jesse@nicira.com>2011-10-23 11:24:19 -0700
commit69685a8882e40d846f7bcdbb6a55d3cce517cc26 (patch)
tree736d6125033ce794e29e49825d5b3478b64aff3e
parent21f7563cef5f3e5ab52c15ade58594c2dfdb7195 (diff)
datapath: Define constants for versions of GENL families.
Currently we hard code the versions of our GENL families to 1 but it's nicer to have symbolic constants. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
-rw-r--r--datapath/datapath.c8
-rw-r--r--include/linux/openvswitch.h4
-rw-r--r--lib/dpif-linux.c9
3 files changed, 13 insertions, 8 deletions
diff --git a/datapath/datapath.c b/datapath/datapath.c
index de2f76b0..11a2a110 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -348,7 +348,7 @@ static struct genl_family dp_packet_genl_family = {
.id = GENL_ID_GENERATE,
.hdrsize = sizeof(struct ovs_header),
.name = OVS_PACKET_FAMILY,
- .version = 1,
+ .version = OVS_PACKET_VERSION,
.maxattr = OVS_PACKET_ATTR_MAX
};
@@ -863,7 +863,7 @@ static struct genl_family dp_flow_genl_family = {
.id = GENL_ID_GENERATE,
.hdrsize = sizeof(struct ovs_header),
.name = OVS_FLOW_FAMILY,
- .version = 1,
+ .version = OVS_FLOW_VERSION,
.maxattr = OVS_FLOW_ATTR_MAX
};
@@ -1252,7 +1252,7 @@ static struct genl_family dp_datapath_genl_family = {
.id = GENL_ID_GENERATE,
.hdrsize = sizeof(struct ovs_header),
.name = OVS_DATAPATH_FAMILY,
- .version = 1,
+ .version = OVS_DATAPATH_VERSION,
.maxattr = OVS_DP_ATTR_MAX
};
@@ -1589,7 +1589,7 @@ static struct genl_family dp_vport_genl_family = {
.id = GENL_ID_GENERATE,
.hdrsize = sizeof(struct ovs_header),
.name = OVS_VPORT_FAMILY,
- .version = 1,
+ .version = OVS_VPORT_VERSION,
.maxattr = OVS_VPORT_ATTR_MAX
};
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h
index 190bf79e..5bfe4886 100644
--- a/include/linux/openvswitch.h
+++ b/include/linux/openvswitch.h
@@ -46,6 +46,7 @@
#define OVS_DATAPATH_FAMILY "ovs_datapath"
#define OVS_DATAPATH_MCGROUP "ovs_datapath"
+#define OVS_DATAPATH_VERSION 0x1
enum ovs_datapath_cmd {
OVS_DP_CMD_UNSPEC,
@@ -116,6 +117,7 @@ struct ovs_vport_stats {
#define OVSP_LOCAL ((__u16)0)
#define OVS_PACKET_FAMILY "ovs_packet"
+#define OVS_PACKET_VERSION 0x1
enum ovs_packet_cmd {
OVS_PACKET_CMD_UNSPEC,
@@ -173,6 +175,7 @@ enum ovs_vport_type {
#define OVS_VPORT_FAMILY "ovs_vport"
#define OVS_VPORT_MCGROUP "ovs_vport"
+#define OVS_VPORT_VERSION 0x1
enum ovs_vport_cmd {
OVS_VPORT_CMD_UNSPEC,
@@ -238,6 +241,7 @@ enum {
#define OVS_FLOW_FAMILY "ovs_flow"
#define OVS_FLOW_MCGROUP "ovs_flow"
+#define OVS_FLOW_VERSION 0x1
enum ovs_flow_cmd {
OVS_FLOW_CMD_UNSPEC,
diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index 2466f915..c5628b7e 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -832,7 +832,7 @@ dpif_linux_encode_execute(int dp_ifindex,
buf = ofpbuf_new(128 + actions_len + packet->size);
nl_msg_put_genlmsghdr(buf, 0, ovs_packet_family, NLM_F_REQUEST,
- OVS_PACKET_CMD_EXECUTE, 1);
+ OVS_PACKET_CMD_EXECUTE, OVS_PACKET_VERSION);
execute = ofpbuf_put_uninit(buf, sizeof *execute);
execute->dp_ifindex = dp_ifindex;
@@ -1389,7 +1389,7 @@ dpif_linux_vport_to_ofpbuf(const struct dpif_linux_vport *vport,
struct ovs_header *ovs_header;
nl_msg_put_genlmsghdr(buf, 0, ovs_vport_family, NLM_F_REQUEST | NLM_F_ECHO,
- vport->cmd, 1);
+ vport->cmd, OVS_VPORT_VERSION);
ovs_header = ofpbuf_put_uninit(buf, sizeof *ovs_header);
ovs_header->dp_ifindex = vport->dp_ifindex;
@@ -1549,7 +1549,8 @@ dpif_linux_dp_to_ofpbuf(const struct dpif_linux_dp *dp, struct ofpbuf *buf)
struct ovs_header *ovs_header;
nl_msg_put_genlmsghdr(buf, 0, ovs_datapath_family,
- NLM_F_REQUEST | NLM_F_ECHO, dp->cmd, 1);
+ NLM_F_REQUEST | NLM_F_ECHO, dp->cmd,
+ OVS_DATAPATH_VERSION);
ovs_header = ofpbuf_put_uninit(buf, sizeof *ovs_header);
ovs_header->dp_ifindex = dp->dp_ifindex;
@@ -1708,7 +1709,7 @@ dpif_linux_flow_to_ofpbuf(const struct dpif_linux_flow *flow,
nl_msg_put_genlmsghdr(buf, 0, ovs_flow_family,
NLM_F_REQUEST | flow->nlmsg_flags,
- flow->cmd, 1);
+ flow->cmd, OVS_FLOW_VERSION);
ovs_header = ofpbuf_put_uninit(buf, sizeof *ovs_header);
ovs_header->dp_ifindex = flow->dp_ifindex;