aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/include
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-12-23 19:24:30 +0000
committerJohn Crispin <blogic@openwrt.org>2015-12-23 19:24:30 +0000
commitf9013beb5865bc5caef9291cff109755675681ce (patch)
treeee24108e1e8e0f29880323fcf501e3678835c87a /target/linux/generic/files/include
parent0e7bf9b5faf59e33b9764cc17f30b995c56321e7 (diff)
downloadmaster-187ad058-f9013beb5865bc5caef9291cff109755675681ce.tar.gz
master-187ad058-f9013beb5865bc5caef9291cff109755675681ce.tar.bz2
master-187ad058-f9013beb5865bc5caef9291cff109755675681ce.zip
swconfig: add SWITCH_TYPE_LINK and support sending link info to user space
So far we were sending link data as a string. It got some drawbacks: 1) Didn't allow writing clean user space apps reading link state. It was needed to do some screen scraping. 2) Forced whole PORT_LINK communication to be string based. Adding support for *setting* port link required passing string and parting it in the kernel space. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@47997 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic/files/include')
-rw-r--r--target/linux/generic/files/include/linux/switch.h2
-rw-r--r--target/linux/generic/files/include/uapi/linux/switch.h16
2 files changed, 18 insertions, 0 deletions
diff --git a/target/linux/generic/files/include/linux/switch.h b/target/linux/generic/files/include/linux/switch.h
index 4291364562..eac35f9135 100644
--- a/target/linux/generic/files/include/linux/switch.h
+++ b/target/linux/generic/files/include/linux/switch.h
@@ -122,6 +122,7 @@ struct switch_dev {
struct mutex sw_mutex;
struct switch_port *portbuf;
struct switch_portmap *portmap;
+ struct switch_port_link linkbuf;
char buf[128];
@@ -148,6 +149,7 @@ struct switch_val {
const char *s;
u32 i;
struct switch_port *ports;
+ struct switch_port_link *link;
} value;
};
diff --git a/target/linux/generic/files/include/uapi/linux/switch.h b/target/linux/generic/files/include/uapi/linux/switch.h
index a59b23953a..c0071a415a 100644
--- a/target/linux/generic/files/include/uapi/linux/switch.h
+++ b/target/linux/generic/files/include/uapi/linux/switch.h
@@ -50,6 +50,7 @@ enum {
SWITCH_ATTR_OP_VALUE_INT,
SWITCH_ATTR_OP_VALUE_STR,
SWITCH_ATTR_OP_VALUE_PORTS,
+ SWITCH_ATTR_OP_VALUE_LINK,
SWITCH_ATTR_OP_DESCRIPTION,
/* port lists */
SWITCH_ATTR_PORT,
@@ -86,6 +87,7 @@ enum switch_val_type {
SWITCH_TYPE_INT,
SWITCH_TYPE_STRING,
SWITCH_TYPE_PORTS,
+ SWITCH_TYPE_LINK,
SWITCH_TYPE_NOVAL,
};
@@ -97,6 +99,20 @@ enum {
SWITCH_PORT_ATTR_MAX
};
+/* link nested attributes */
+enum {
+ SWITCH_LINK_UNSPEC,
+ SWITCH_LINK_FLAG_LINK,
+ SWITCH_LINK_FLAG_DUPLEX,
+ SWITCH_LINK_FLAG_ANEG,
+ SWITCH_LINK_FLAG_TX_FLOW,
+ SWITCH_LINK_FLAG_RX_FLOW,
+ SWITCH_LINK_SPEED,
+ SWITCH_LINK_FLAG_EEE_100BASET,
+ SWITCH_LINK_FLAG_EEE_1000BASET,
+ SWITCH_LINK_ATTR_MAX,
+};
+
#define SWITCH_ATTR_DEFAULTS_OFFSET 0x1000