librmnetctl: use own IFLA enum instead of VLAN
There's no need to cannibalize VLAN's enum for its attributes when we can
just create our own. This is much cleaner, and is more easily extensible
when new features are added in the future.
Change-Id: I51a2e4aec9ae5764422b5a7665d2cdc8248f59bf
Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
diff --git a/rmnetctl/src/librmnetctl.c b/rmnetctl/src/librmnetctl.c
index 8e60aef..fcc4ed7 100644
--- a/rmnetctl/src/librmnetctl.c
+++ b/rmnetctl/src/librmnetctl.c
@@ -96,6 +96,15 @@
char data[NLMSG_DATA_SIZE];
};
+/* IFLA Attributes for the RT RmNet driver */
+enum {
+ RMNETCTL_IFLA_UNSPEC,
+ RMNETCTL_IFLA_MUX_ID,
+ RMNETCTL_IFLA_FLAGS,
+ RMNETCTL_IFLA_DFC_QOS,
+ __RMNETCTL_IFLA_MAX,
+};
+
/* Flow message types sent to DFC driver */
enum {
/* Activate flow */
@@ -1180,7 +1189,7 @@
if (rc != RMNETCTL_SUCCESS)
return rc;
- rc = rta_put_u16(req, reqsize, IFLA_VLAN_ID, index);
+ rc = rta_put_u16(req, reqsize, RMNETCTL_IFLA_MUX_ID, index);
if (rc != RMNETCTL_SUCCESS)
return rc;
@@ -1188,7 +1197,7 @@
flags.mask = flagconfig;
flags.flags = flagconfig;
- rc = rta_put(req, reqsize, IFLA_VLAN_FLAGS, sizeof(flags),
+ rc = rta_put(req, reqsize, RMNETCTL_IFLA_FLAGS, sizeof(flags),
&flags);
if (rc != RMNETCTL_SUCCESS)
return rc;
@@ -1239,7 +1248,7 @@
if (rc != RMNETCTL_SUCCESS)
return rc;
- rc = rta_put(req, reqsize, IFLA_VLAN_EGRESS_QOS, sizeof(*flowinfo),
+ rc = rta_put(req, reqsize, RMNETCTL_IFLA_DFC_QOS, sizeof(*flowinfo),
flowinfo);
if (rc != RMNETCTL_SUCCESS)
return rc;
@@ -1501,7 +1510,7 @@
struct nlmsg req;
struct nlmsghdr *resp;
struct rtattr *attrs, *linkinfo, *datainfo;
- struct rtattr *tb[IFLA_VLAN_MAX + 1];
+ struct rtattr *tb[__RMNETCTL_IFLA_MAX];
unsigned int devindex = 0;
int resp_len;
@@ -1569,15 +1578,15 @@
}
/* Parse all the rmnet-specific information from the kernel */
- rta_parse(tb, IFLA_VLAN_MAX + 1, RTA_DATA(datainfo),
+ rta_parse(tb, __RMNETCTL_IFLA_MAX, RTA_DATA(datainfo),
RTA_PAYLOAD(datainfo));
- if (tb[IFLA_VLAN_ID] && mux_id)
- *mux_id = *((uint16_t *)RTA_DATA(tb[IFLA_VLAN_ID]));
- if (tb[IFLA_VLAN_FLAGS] && flagconfig) {
+ if (tb[RMNETCTL_IFLA_MUX_ID] && mux_id)
+ *mux_id = *((uint16_t *)RTA_DATA(tb[RMNETCTL_IFLA_MUX_ID]));
+ if (tb[RMNETCTL_IFLA_FLAGS] && flagconfig) {
struct ifla_vlan_flags *flags;
flags = (struct ifla_vlan_flags *)
- RTA_DATA(tb[IFLA_VLAN_FLAGS]);
+ RTA_DATA(tb[RMNETCTL_IFLA_FLAGS]);
*flagconfig = flags->flags;
}