datapath: Define constants for versions of GENL families.
authorJesse Gross <jesse@nicira.com>
Sun, 23 Oct 2011 01:22:18 +0000 (18:22 -0700)
committerJesse Gross <jesse@nicira.com>
Sun, 23 Oct 2011 18:24:19 +0000 (11:24 -0700)
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>
datapath/datapath.c
include/linux/openvswitch.h
lib/dpif-linux.c

index de2f76b0b51207a8a616e6a1592ef328b34a2962..11a2a110514c3b7cd714181df0fb32e341f276cd 100644 (file)
@@ -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
 };
 
index 190bf79e272bee4d906e2d7bfdc97f192058428f..5bfe4886612f08862ead865badac3d5c4f8ecc7e 100644 (file)
@@ -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)
 \f
 #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 {
 \f
 #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,
index 2466f9159e6dba75b1b15bdc05d49fec463a8c28..c5628b7eb6d8abfd45a0412a44575f98a574be25 100644 (file)
@@ -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;