Adding a general function get_linklayer() for parsing linklayer types.
Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
---
tc/tc_util.c | 18 ++++++++++++++++++
tc/tc_util.h | 2 ++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/tc/tc_util.c b/tc/tc_util.c
index cdbae42..f8472c5 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -435,6 +435,24 @@ int action_a2n(char *arg, int *result)
return 0;
}
+// Function for parsing linklayer type
+int get_linklayer(unsigned int *val, char *arg)
+{
+ int res;
+ if (matches(arg, "ethernet") == 0)
+ res = LINKLAYER_ETHERNET;
+ else if (matches(arg, "atm") == 0)
+ res = LINKLAYER_ATM;
+ else if (matches(arg, "adsl") == 0)
+ res = LINKLAYER_ATM;
+ else
+ return -1; /* Indicate error */
+
+ *val = res;
+ return 0;
+}
+
+
void print_tm(FILE * f, const struct tcf_t *tm)
{
int hz = get_user_hz();
diff --git a/tc/tc_util.h b/tc/tc_util.h
index 120d6ce..5b8253a 100644
--- a/tc/tc_util.h
+++ b/tc/tc_util.h
@@ -62,6 +62,8 @@ extern char * sprint_time(__u32 time, char *buf);
extern char * sprint_ticks(__u32 ticks, char *buf);
extern char * sprint_percent(__u32 percent, char *buf);
+extern int get_linklayer(unsigned int *val, char *arg);
+
extern void print_tcstats_attr(FILE *fp, struct rtattr *tb[], char *prefix, struct rtattr **xstats);
extern void print_tcstats2_attr(FILE *fp, struct rtattr *rta, char *prefix, struct rtattr **xstats);
--
1.5.3
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html| Srivatsa Vaddagiri | containers (was Re: -mm merge plans for 2.6.23) |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Benjamin Herrenschmidt | Re: [PATCH] Remove process freezer from suspend to RAM pathway |
git: | |
| Jarek Poplawski | [PATCH take 2] pkt_sched: Protect gen estimators under est_lock. |
| David Miller | [GIT]: Networking |
| Gerhard Pircher | 3c59x: shared interrupt problem |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
