From 3540e44b158f0f45fc2364d99e70433fba176b21 Mon Sep 17 00:00:00 2001 From: Flavio Leitner Date: Mon, 7 Jan 2013 18:36:12 -0200 Subject: link: add carrier support Signed-off-by: Flavio Leitner Signed-off-by: Thomas Graf --- include/linux/if.h | 6 ++++++ include/linux/if_link.h | 1 + include/netlink-types.h | 1 + include/netlink/route/link.h | 7 +++++++ 4 files changed, 15 insertions(+) (limited to 'include') diff --git a/include/linux/if.h b/include/linux/if.h index 32f910f..238cf43 100644 --- a/include/linux/if.h +++ b/include/linux/if.h @@ -117,6 +117,12 @@ enum { IF_LINK_MODE_DORMANT, /* limit upward transition to dormant */ }; +/* carrier state */ +enum { + IF_CARRIER_DOWN, + IF_CARRIER_UP +}; + /* * Device mapping structure. I'd just gone off and designed a * beautiful scheme using only loadable modules with arguments diff --git a/include/linux/if_link.h b/include/linux/if_link.h index c0a1dd9..a753d11 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h @@ -142,6 +142,7 @@ enum { #define IFLA_PROMISCUITY IFLA_PROMISCUITY IFLA_NUM_TX_QUEUES, IFLA_NUM_RX_QUEUES, + IFLA_CARRIER, __IFLA_MAX }; diff --git a/include/netlink-types.h b/include/netlink-types.h index 057ea2b..46856a3 100644 --- a/include/netlink-types.h +++ b/include/netlink-types.h @@ -182,6 +182,7 @@ struct rtnl_link uint32_t l_num_tx_queues; uint32_t l_num_rx_queues; uint32_t l_group; + uint8_t l_carrier; }; struct rtnl_ncacheinfo diff --git a/include/netlink/route/link.h b/include/netlink/route/link.h index 8268b13..dbde72f 100644 --- a/include/netlink/route/link.h +++ b/include/netlink/route/link.h @@ -141,6 +141,10 @@ extern int rtnl_link_str2operstate(const char *); extern char * rtnl_link_mode2str(uint8_t, char *, size_t); extern int rtnl_link_str2mode(const char *); +/* Carrier State Translations */ +extern char * rtnl_link_carrier2str(uint8_t, char *, size_t); +extern int rtnl_link_str2carrier(const char *); + /* Access Functions */ extern void rtnl_link_set_qdisc(struct rtnl_link *, const char *); extern char * rtnl_link_get_qdisc(struct rtnl_link *); @@ -182,6 +186,9 @@ extern int rtnl_link_get_link(struct rtnl_link *); extern void rtnl_link_set_master(struct rtnl_link *, int); extern int rtnl_link_get_master(struct rtnl_link *); +extern void rtnl_link_set_carrier(struct rtnl_link *, uint8_t); +extern uint8_t rtnl_link_get_carrier(struct rtnl_link *); + extern void rtnl_link_set_operstate(struct rtnl_link *, uint8_t); extern uint8_t rtnl_link_get_operstate(struct rtnl_link *); -- cgit v1.2.1