Message ID | 1252490406-27951-2-git-send-email-remi@remlab.net |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
Hi Remi, > drivers/net/usb/cdc-phonet.c | 15 +++++++++++++++ > include/linux/phonet.h | 3 +++ > 2 files changed, 18 insertions(+), 0 deletions(-) > > diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c > index 0ca5916..97e54d9 100644 > --- a/drivers/net/usb/cdc-phonet.c > +++ b/drivers/net/usb/cdc-phonet.c > @@ -27,6 +27,7 @@ > #include <linux/netdevice.h> > #include <linux/if_arp.h> > #include <linux/if_phonet.h> > +#include <linux/phonet.h> > > #define PN_MEDIA_USB 0x1B > > @@ -256,6 +257,19 @@ static int usbpn_close(struct net_device *dev) > return usb_set_interface(pnd->usb, num, !pnd->active_setting); > } > > +static int usbpn_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) > +{ > + struct if_phonet_req *req = (struct if_phonet_req *)ifr; > + > + switch (cmd) { > + case SIOCPNGAUTOCONF: > + req->ifr_phonet_autoconf.device = PN_DEV_PC; > + printk(KERN_CRIT"device is PN_DEV_PC\n"); > + return 0; > + } > + return -ENOIOCTLCMD; > +} > + am I understanding this correctly, that even for the USB ones we still have to execute that ioctl() and can not just auto configure them all the time? For the USB ones, I would expect to should plug them in and they are getting configured right away. Regards Marcel -- 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
On Wed, 09 Sep 2009 12:24:10 +0200, Marcel Holtmann <marcel@holtmann.org> wrote: > am I understanding this correctly, that even for the USB ones we still > have to execute that ioctl() and can not just auto configure them all > the time? For the USB ones, I would expect to should plug them in and > they are getting configured right away. The other patch makes the stack use the ioctl() internally. But now I see that I forgot some debug statement :( Still, something needs to ifconfig up/ip link set up.
Hi Remi, > > am I understanding this correctly, that even for the USB ones we still > > have to execute that ioctl() and can not just auto configure them all > > the time? For the USB ones, I would expect to should plug them in and > > they are getting configured right away. > > The other patch makes the stack use the ioctl() internally. > But now I see that I forgot some debug statement :( > > Still, something needs to ifconfig up/ip link set up. the ifup/ifdown is fine. And if the addresses get set when I plug the device in, that looks good to me. Regards Marcel -- 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
From: Rémi Denis-Courmont <remi@remlab.net> Date: Wed, 9 Sep 2009 13:00:06 +0300 > From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> > > Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> Applied. -- 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
Le vendredi 11 septembre 2009 22:38:35 David Miller, vous avez écrit : > From: Rémi Denis-Courmont <remi@remlab.net> > Date: Wed, 9 Sep 2009 13:00:06 +0300 > > > From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> > > > > Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> > > Applied. THanks and oops, I just had an updated patch set coming. I guess I will rebase it then.
diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c index 0ca5916..97e54d9 100644 --- a/drivers/net/usb/cdc-phonet.c +++ b/drivers/net/usb/cdc-phonet.c @@ -27,6 +27,7 @@ #include <linux/netdevice.h> #include <linux/if_arp.h> #include <linux/if_phonet.h> +#include <linux/phonet.h> #define PN_MEDIA_USB 0x1B @@ -256,6 +257,19 @@ static int usbpn_close(struct net_device *dev) return usb_set_interface(pnd->usb, num, !pnd->active_setting); } +static int usbpn_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) +{ + struct if_phonet_req *req = (struct if_phonet_req *)ifr; + + switch (cmd) { + case SIOCPNGAUTOCONF: + req->ifr_phonet_autoconf.device = PN_DEV_PC; + printk(KERN_CRIT"device is PN_DEV_PC\n"); + return 0; + } + return -ENOIOCTLCMD; +} + static int usbpn_set_mtu(struct net_device *dev, int new_mtu) { if ((new_mtu < PHONET_MIN_MTU) || (new_mtu > PHONET_MAX_MTU)) @@ -269,6 +283,7 @@ static const struct net_device_ops usbpn_ops = { .ndo_open = usbpn_open, .ndo_stop = usbpn_close, .ndo_start_xmit = usbpn_xmit, + .ndo_do_ioctl = usbpn_ioctl, .ndo_change_mtu = usbpn_set_mtu, }; diff --git a/include/linux/phonet.h b/include/linux/phonet.h index 82b45d1..1ef5a07 100644 --- a/include/linux/phonet.h +++ b/include/linux/phonet.h @@ -99,6 +99,9 @@ struct sockaddr_pn { __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3]; } __attribute__ ((packed)); +/* Well known address */ +#define PN_DEV_PC 0x10 + static inline __u16 pn_object(__u8 addr, __u16 port) { return (addr << 8) | (port & 0x3ff);