netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paulius Zaleckas <paulius.zaleckas-Ft0m5Q12RQ9xBelEqimL3w@public.gmane.org>
To: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC] Patch to option HSO driver to the kernel
Date: Wed, 16 Apr 2008 14:54:09 +0300	[thread overview]
Message-ID: <4805E8E1.3090200@teltonika.lt> (raw)
In-Reply-To: <4805C469.7050408-Ft0m5Q12RQ9xBelEqimL3w@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 440 bytes --]

Paulius Zaleckas wrote:
> Paulius Zaleckas wrote:
>> Reworked MAC address generation from USB serial number
>> Now it is very similar to the one done in the cdc_ether.c
>>
>> Filip: Does the dummy MAC address have to start with 0xFA?
>>
> 
> Hopefully fixed last bug in MAC address generation.
> Patch against latest Greg unified patch.
> Don't use my previous patch.
> 

Incremental patch. Converted ethtool ioctl to ethtool_ops.

Paulius

[-- Attachment #2: hso_ethtool_ops.patch --]
[-- Type: text/x-patch, Size: 2993 bytes --]

--- linux-2.6-hso/drivers/net/usb/hso.c	2008-04-16 14:47:53.000000000 +0300
+++ linux-2.6-hso-my/drivers/net/usb/hso.c	2008-04-16 14:40:49.000000000 +0300
@@ -853,61 +853,24 @@ static int hso_net_start_xmit(struct sk_
 	return result;
 }
 
-static int hso_net_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
+static void hso_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info)
 {
 	struct hso_net *odev = netdev_priv(net);
-	u32 usercmd = 0;
 	char tmp[40];
 
-	switch (cmd) {
-	case SIOCETHTOOL:
-		/* net specific */
-		if (copy_from_user(&usercmd, rq->ifr_data, sizeof(usercmd)))
-			return -EFAULT;
-
-		switch (usercmd) {
-		case ETHTOOL_GDRVINFO:
-			{
-			/* get driver info */
-			struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
-			strncpy(info.driver, driver_name, ETHTOOL_BUSINFO_LEN);
-			strncpy(info.version, DRIVER_VERSION,
-				ETHTOOL_BUSINFO_LEN);
-			sprintf(tmp, "usb%d:%d",
-				odev->parent->usb->bus->busnum,
-				odev->parent->usb->devnum);
-			strncpy(info.bus_info, tmp, ETHTOOL_BUSINFO_LEN);
-			sprintf(tmp, "%s %x.%x", driver_name,
-				((odev->bcdCDC & 0xff00) >> 8),
-				(odev->bcdCDC & 0x00ff));
-			strncpy(info.fw_version, tmp, ETHTOOL_BUSINFO_LEN);
-			if (copy_to_user(rq->ifr_data, &info, sizeof(info)))
-				return -EFAULT;
-
-			return 0;
-			}
-		case ETHTOOL_GLINK:
-			{
-			/* get link status */
-			struct ethtool_value edata = { ETHTOOL_GLINK };
-
-			edata.data = netif_carrier_ok(net);
-			if (copy_to_user(rq->ifr_data, &edata, sizeof(edata)))
-				return -EFAULT;
-
-			return 0;
-			}
-		default:
-			dev_warn(&net->dev, "Got unsupported ioctl: %x\n",
-				 usercmd);
-			/* the ethtool user space tool relies on this */
-			return -EOPNOTSUPP;
-		}
-	default:
-		return -ENOTTY;	/* per ioctl man page */
-	}
+	strncpy(info->driver, driver_name, ETHTOOL_BUSINFO_LEN);
+	strncpy(info->version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN);
+	usb_make_path(odev->parent->usb, info->bus_info, sizeof info->bus_info);
+	sprintf(tmp, "%s %x.%x", driver_name, ((odev->bcdCDC & 0xff00) >> 8),
+		(odev->bcdCDC & 0x00ff));
+	strncpy(info->fw_version, tmp, ETHTOOL_BUSINFO_LEN);
 }
 
+static struct ethtool_ops ops = {
+	.get_drvinfo = hso_get_drvinfo,
+	.get_link = ethtool_op_get_link
+};
+
 static struct net_device_stats *hso_net_get_stats(struct net_device *net)
 {
 	return &((struct hso_net *)netdev_priv(net))->stats;
@@ -2281,7 +2244,6 @@ static void hso_net_init(struct net_devi
 	net->open = hso_net_open;
 	net->stop = hso_net_close;
 	net->hard_start_xmit = hso_net_start_xmit;
-	net->do_ioctl = hso_net_ioctl;
 	net->get_stats = hso_net_get_stats;
 	net->tx_timeout = hso_net_tx_timeout;
 	net->watchdog_timeo = HSO_NET_TX_TIMEOUT;
@@ -2289,6 +2251,7 @@ static void hso_net_init(struct net_devi
 	net->flags |= IFF_NOARP;
 	net->mtu = DEFAULT_MTU - 14;
 	net->tx_queue_len = 10;
+	SET_ETHTOOL_OPS(net, &ops);
 	hso_net->skb_rx_buf = NULL;
 	hso_net->rx_parse_state = WAIT_IP;
 	hso_net->wMaxSegmentSize = DEFAULT_MTU;

  parent reply	other threads:[~2008-04-16 11:54 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-14 21:32 [RFC] Patch to option HSO driver to the kernel Greg KH
2008-04-15  4:30 ` Oliver Hartkopp
     [not found]   ` <48042F7F.8030608-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
2008-04-15 16:11     ` Greg KH
     [not found]       ` <20080415161158.GE9704-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2008-04-15 17:53         ` Oliver Hartkopp
     [not found] ` <20080414213238.GB28833-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2008-04-14 21:59   ` Matthew Dharm
2008-04-14 22:42     ` Andrew Bird (Sphere Systems)
2008-04-14 23:03       ` Greg KH
     [not found]         ` <20080414230309.GA1672-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2008-04-15  8:01           ` Filip Aben
2008-04-15 15:40             ` Greg KH
2008-04-14 23:20   ` Paulius Zaleckas
2008-04-15  8:10     ` Oliver Neukum
     [not found]       ` <200804151010.33688.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-04-15  8:58         ` Paulius Zaleckas
     [not found]           ` <48046E4A.3060901-Ft0m5Q12RQ9xBelEqimL3w@public.gmane.org>
2008-04-15 15:39             ` Greg KH
2008-04-15 11:44   ` Oliver Neukum
     [not found]     ` <200804151344.42085.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-04-15 16:06       ` Greg KH
2008-04-15 13:06   ` Oliver Neukum
     [not found]     ` <200804151506.21856.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-04-15 16:08       ` Greg KH
2008-04-15 16:08     ` Greg KH
2008-04-15 13:25   ` Oliver Neukum
2008-04-15 14:12     ` Filip Aben
2008-04-15 14:14       ` Oliver Neukum
2008-04-15 15:03         ` Filip Aben
2008-04-15 15:34           ` Greg KH
     [not found]             ` <20080415153408.GB7996-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2008-04-15 16:24               ` Filip Aben
2008-04-15 17:58                 ` Oliver Neukum
2008-04-15 18:46             ` Oliver Neukum
     [not found]               ` <200804152046.44018.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-04-15 19:00                 ` Greg KH
2008-04-15 19:14                   ` Stephen Hemminger
2008-04-15 19:27                     ` Greg KH
2008-04-15 20:17                   ` Oliver Neukum
     [not found]                     ` <200804152217.25451.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-04-15 22:18                       ` Greg KH
2008-04-17 12:15                   ` Oliver Neukum
2008-04-17 21:35                     ` Greg KH
2008-04-15 22:49   ` Paulius Zaleckas
     [not found]     ` <480530E6.8020700-Ft0m5Q12RQ9xBelEqimL3w@public.gmane.org>
2008-04-16  9:18       ` Paulius Zaleckas
     [not found]         ` <4805C469.7050408-Ft0m5Q12RQ9xBelEqimL3w@public.gmane.org>
2008-04-16 11:54           ` Paulius Zaleckas [this message]
     [not found]             ` <4805E8E1.3090200-Ft0m5Q12RQ9xBelEqimL3w@public.gmane.org>
2008-04-16 12:03               ` Oliver Neukum
     [not found]                 ` <200804161403.20955.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-04-16 12:12                   ` Paulius Zaleckas
     [not found]                     ` <4805ED16.3080104-Ft0m5Q12RQ9xBelEqimL3w@public.gmane.org>
2008-04-16 13:43                       ` Oliver Neukum
     [not found]                         ` <200804161543.23584.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-04-16 13:55                           ` Paulius Zaleckas
2008-04-17 14:32                             ` Oliver Neukum
     [not found]                               ` <200804171632.12972.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-04-17 21:47                                 ` Paulius Zaleckas
     [not found]                                   ` <4807C56F.5060804-Ft0m5Q12RQ9xBelEqimL3w@public.gmane.org>
2008-04-17 22:31                                     ` Chetty, Jay
2008-04-18  6:51                                     ` Oliver Neukum
2008-04-18 15:18                                 ` Paulius Zaleckas
2008-04-21 11:45                                   ` Oliver Neukum
2008-04-21 12:38                                     ` Paulius Zaleckas
     [not found]                                       ` <480C8AD8.9050609-Ft0m5Q12RQ9xBelEqimL3w@public.gmane.org>
2008-04-21 12:50                                         ` Oliver Neukum
     [not found]                                           ` <200804211450.27093.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2008-04-21 13:00                                             ` Paulius Zaleckas
2008-04-17 21:33                         ` Greg KH
2008-04-16 15:15               ` Paulius Zaleckas
2008-04-16 13:11   ` Paulius Zaleckas
2008-04-15 13:55 ` Oliver Neukum
2008-04-15 16:10   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4805E8E1.3090200@teltonika.lt \
    --to=paulius.zaleckas-ft0m5q12rq9xbeleqiml3w@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).