summaryrefslogtreecommitdiffstats
path: root/package/swconfig
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-04-16 19:32:40 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-04-16 19:32:40 +0000
commit56f15bb5f9d1815311c5d511ae1a57d43f290e98 (patch)
treec58ce83caf0b37bca1a0297d586b5b8ae5cd24e0 /package/swconfig
parent29b1cd327d3658f39af9db68943a6c205fac602d (diff)
swconfig: Add cpu port index to help output.
Let swconfig provide the cpu port index in its help page. This is needed as e.g. Atheros switches have their cpu port at port 0, not port 5. This could allow e.g. luci to get a rough overview of the layout of the switch. Signed-off-by: Jonas Gorski <jonas.gorski+openwrt@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20939 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/swconfig')
-rw-r--r--package/swconfig/src/cli.c2
-rw-r--r--package/swconfig/src/swlib.c2
-rw-r--r--package/swconfig/src/swlib.h1
3 files changed, 4 insertions, 1 deletions
diff --git a/package/swconfig/src/cli.c b/package/swconfig/src/cli.c
index 76593ba14..eea88d812 100644
--- a/package/swconfig/src/cli.c
+++ b/package/swconfig/src/cli.c
@@ -74,7 +74,7 @@ print_attrs(const struct switch_attr *attr)
static void
list_attributes(struct switch_dev *dev)
{
- printf("Switch %d: %s(%s), ports: %d, vlans: %d\n", dev->id, dev->dev_name, dev->name, dev->ports, dev->vlans);
+ printf("Switch %d: %s(%s), ports: %d (cpu @ %d), vlans: %d\n", dev->id, dev->dev_name, dev->name, dev->ports, dev->cpu_port, dev->vlans);
printf(" --switch\n");
print_attrs(dev->ops);
printf(" --vlan\n");
diff --git a/package/swconfig/src/swlib.c b/package/swconfig/src/swlib.c
index 8a9fd7a29..59456a33d 100644
--- a/package/swconfig/src/swlib.c
+++ b/package/swconfig/src/swlib.c
@@ -586,6 +586,8 @@ add_switch(struct nl_msg *msg, void *arg)
dev->ports = nla_get_u32(tb[SWITCH_ATTR_PORTS]);
if (tb[SWITCH_ATTR_VLANS])
dev->vlans = nla_get_u32(tb[SWITCH_ATTR_VLANS]);
+ if (tb[SWITCH_ATTR_CPU_PORT])
+ dev->cpu_port = nla_get_u32(tb[SWITCH_ATTR_CPU_PORT]);
if (!sa->head) {
sa->head = dev;
diff --git a/package/swconfig/src/swlib.h b/package/swconfig/src/swlib.h
index b3c6769de..2c2fccd39 100644
--- a/package/swconfig/src/swlib.h
+++ b/package/swconfig/src/swlib.h
@@ -118,6 +118,7 @@ struct switch_dev {
const char *dev_name;
int ports;
int vlans;
+ int cpu_port;
struct switch_attr *ops;
struct switch_attr *port_ops;
struct switch_attr *vlan_ops;