Hi, On Mon, Sep 14, 2015 at 2:20 PM, laurent vaudoit <[email protected]> wrote:
> Hi Patrik, > > On Thu, Sep 10, 2015 at 12:24 PM, Patrik Flykt < > [email protected]> wrote: > >> On Thu, 2015-09-10 at 11:41 +0200, laurent vaudoit wrote: >> >> > On Thu, Sep 10, 2015 at 11:35 AM, Patrik Flykt < >> [email protected] >> > > wrote: >> > > >> > > Hi, >> > > >> > > On Wed, 2015-09-09 at 16:52 +0200, laurent vaudoit wrote: >> > > > So i've made a little modification in plugin/ethernet.c (inspired >> from >> > > > the vlan management). >> > > > The evolution consist in checking if the interface use the dsa >> driver, >> > > > and in this case, add to service name the switch port number (as >> > > > connman add the vlanid to the service name). >> > > >> > > What exactly is this dsa driver? Is it upstream or provided by a >> vendor? >> > > >> > dsa is the "distributed switch architecture" driver, which is upstream. >> > under this there is the chip driver for the switch, who communicate >> trhough >> > mdio interface with the chip. >> > In my case, it is a new developped driver as the chip was not supported >> by >> > kernel, but there is allready some driver existing (marvell for example) >> > source code is under net/dsa/ >> >> Sounds like a plan. Send a patch after you have tested it. >> > > We are running some test and most of our use case are ok. > The only thing we do not understand, is that if the dhcp cleitn do not get > an ip adress, > we were expecting that the board get an ip in 169.254... through link > local? > Is there something we missed? > > After some analysis, it seems that ipv4ll is launch only on one service if dhcp timeout. So when we have more than one services, only the first one get an ip from link local. Is there any reason for this behaviour? It seems not to be linked to our "DSA patch", who is in attachment. > >> Cheers, >> >> Patrik >> > > Regards Laurent > Regards > Laurent > >> >> _______________________________________________ >> connman mailing list >> [email protected] >> https://lists.connman.net/mailman/listinfo/connman >> > >
From 1b58bc565c3e9e1a005b3eac496e25acfd786f8e Mon Sep 17 00:00:00 2001 From: Laurent Vaudoit <[email protected]> Date: Mon, 14 Sep 2015 15:49:10 +0200 Subject: [PATCH] add dsa interface support --- plugins/ethernet.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/plugins/ethernet.c b/plugins/ethernet.c index d176508..072dc7f 100644 --- a/plugins/ethernet.c +++ b/plugins/ethernet.c @@ -32,6 +32,7 @@ #include <linux/if_vlan.h> #include <linux/sockios.h> +#include <linux/ethtool.h> #ifndef IFF_LOWER_UP #define IFF_LOWER_UP 0x10000 @@ -83,6 +84,56 @@ static int get_vlan_vid(const char *ifname) return vid; } +static int get_dsa_port(const char *ifname) +{ + int sk; + int dsaport=-1; + struct ifreq ifr; + struct ethtool_cmd cmd; + struct ethtool_drvinfo drvinfocmd; + + sk = socket(AF_INET, SOCK_STREAM, 0); + if (sk < 0) + return -errno; + + memset(&ifr, 0, sizeof(ifr)); + strcpy(ifr.ifr_name, ifname); + + /* get driver info */ + drvinfocmd.cmd = ETHTOOL_GDRVINFO; + ifr.ifr_data = (caddr_t)&drvinfocmd; + + /* ioctl failed: */ + if (ioctl(sk, SIOCETHTOOL, &ifr) != 0) + { + DBG("Cannot get driver infos\n"); + + } + else + { + + if(strcmp(drvinfocmd.driver,"dsa") == 0) + { + /* get dsa port*/ + cmd.cmd = ETHTOOL_GSET; + ifr.ifr_data = (caddr_t)&cmd; + + /* ioctl failed: */ + if (ioctl(sk, SIOCETHTOOL, &ifr) != 0) + { + DBG("Cannot get device settings\n"); + + } + else + dsaport = cmd.phy_address; + } + } + close(sk); + + return dsaport; + +} + static int eth_network_probe(struct connman_network *network) { DBG("network %p", network); @@ -126,7 +177,7 @@ static void add_network(struct connman_device *device, struct ethernet_data *ethernet) { struct connman_network *network; - int index, vid; + int index, vid,dsaport; char *ifname; network = connman_network_create("carrier", @@ -140,6 +191,7 @@ static void add_network(struct connman_device *device, if (!ifname) return; vid = get_vlan_vid(ifname); + dsaport = get_dsa_port(ifname); connman_network_set_name(network, "Wired"); @@ -149,7 +201,7 @@ static void add_network(struct connman_device *device, } if (!eth_tethering) { - char group[10] = "cable"; + char group[16] = "cable"; /* * Prevent service from starting the reconnect * procedure as we do not want the DHCP client @@ -157,6 +209,8 @@ static void add_network(struct connman_device *device, */ if (vid >= 0) snprintf(group, sizeof(group), "%03x_cable", vid); + if (dsaport >= 0) + snprintf(group, sizeof(group), "%03x_cable", dsaport); connman_network_set_group(network, group); } -- 1.9.1
_______________________________________________ connman mailing list [email protected] https://lists.connman.net/mailman/listinfo/connman
