linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Richard B. Johnson" <root@chaos.analogic.com>
To: Chris Friesen <cfriesen@nortelnetworks.com>
Cc: "Friesen,
	Christopher [CAR:VS16:EXCH]" <cfriesen@americasm01.nt.com>,
	linux-kernel@vger.kernel.org
Subject: Re: are ioctl calls supposed to take this long?
Date: Fri, 6 Jul 2001 11:32:58 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.3.95.1010706112457.1472A-100000@chaos.analogic.com> (raw)
In-Reply-To: <3B45D5DF.17D2B3F8@nortelnetworks.com>

On Fri, 6 Jul 2001, Chris Friesen wrote:

> "Richard B. Johnson" wrote:
> > 
> > On Fri, 6 Jul 2001, Chris Friesen wrote:
> > 
> > > I am using the following snippet of code to find out some information about the
> > > MII PHY interface of my ethernet device (which uses the tulip driver).  When I
> > > did some timing measurements with gettimeofday() I found that the ioctl call
> > > takes a bit over a millisecond to complete.  This seems to me to be an awfully
> > > long time for what should be (as far as I can see) a very simple operation.
> 
> > It's not ioctl() overhead, it's what has to be done in the driver to
> > get the information you request.
> > 
> > (1)     Stop the chip
> > (2)     Read the media interface using an awful SERIAL protocol in which
> >         you manipulate 3 bits using multiple instructions, to send
> >         or receive a single BIT (not BYTE) of data. You do the 8 times
> >         per byte.
> > (3)     Restart the chip.
> 
> Are you sure about this?  In the tulip.c driver the following appears to be the
> salient code:
> 
> static int private_ioctl(struct device *dev, struct ifreq *rq, int cmd)
> {
> 	struct tulip_private *tp = (struct tulip_private *)dev->priv;
> 	long ioaddr = dev->base_addr;
> 	u16 *data = (u16 *)&rq->ifr_data;
> 	int phy = tp->phys[0] & 0x1f;
> 	long flags;
> 
> 	switch(cmd) {
> 	case SIOCDEVPRIVATE:		/* Get the address of the PHY in use. */
> 		if (tp->mii_cnt)
> 			data[0] = phy;
> 		else if (tp->flags & HAS_NWAY143)
> 			data[0] = 32;
> 		else if (tp->chip_id == COMET)
> 			data[0] = 1;
> 		else
> 			return -ENODEV;
>
               ..... This falls through to 
	SIOCDEVPRIVATE+1
 
> 
> I don't see any device stopping or reading of the media interface here.  Now
> there may be something very subtle hidden somewhere that I'm not seeing, but
> this looks like some relatively straightforward comparisons.

Look at tulip_mdio_read() and the zillions of times it's called.
It's called in SIOCDEVPRIVATE+1 when SIOCDEVPRIVATE falls through.
It falls through always, unless there is the -ENODEV error.
tulip_mdio_read() does the bit-banging junk.



Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

    I was going to compile a list of innovations that could be
    attributed to Microsoft. Once I realized that Ctrl-Alt-Del
    was handled in the BIOS, I found that there aren't any.



  reply	other threads:[~2001-07-06 15:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-06 13:34 are ioctl calls supposed to take this long? Chris Friesen
2001-07-06 14:41 ` Richard B. Johnson
2001-07-06 15:14   ` Chris Friesen
2001-07-06 15:32     ` Richard B. Johnson [this message]
2001-07-06 15:40       ` Chris Friesen
2001-07-06 18:26       ` why this 1ms delay in mdio_read? (cont'd from "are ioctl calls supposed to take this long?") Chris Friesen
2001-07-06 18:48         ` Richard B. Johnson
2001-07-06 19:35           ` Chris Friesen
2001-07-06 21:41         ` Donald Becker

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=Pine.LNX.3.95.1010706112457.1472A-100000@chaos.analogic.com \
    --to=root@chaos.analogic.com \
    --cc=cfriesen@americasm01.nt.com \
    --cc=cfriesen@nortelnetworks.com \
    --cc=linux-kernel@vger.kernel.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).