| To: | Andy Fleming <afleming@xxxxxxxxxxxxx> |
|---|---|
| Subject: | Re: [RFR] gianfar ethernet driver |
| From: | Jeff Garzik <jgarzik@xxxxxxxxx> |
| Date: | Wed, 07 Jul 2004 01:27:40 -0400 |
| Cc: | Kumar Gala <kumar.gala@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxx, dwmw2@xxxxxxxxxxxxx, hadi@xxxxxxxxxx |
| In-reply-to: | <89563A5C-CFAE-11D8-BA44-000393C30512@freescale.com> |
| References: | <C681B01E-CEA9-11D8-931F-000393DBC2E8@freescale.com> <89563A5C-CFAE-11D8-BA44-000393C30512@freescale.com> |
| Sender: | netdev-bounce@xxxxxxxxxxx |
| User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510 |
Andy Fleming wrote:
7) ethtool_ops should not be kmalloc'd. Just switch out one static pointer for another, once you know the hardware you're dealing with. You _must_ have that knowledge anyway, before calling register_netdev(), otherwise you're got a race in initialization versus interface-up. 8) I recommend enabling _both_ hardware interrupt coalescing and NAPI, at the same time. Several other Linux net drivers need to be changed to do this, as well
If you see cases that hurt performance, that wants investigating. 14) surely gfar_set_mac_address() needs some sort of synchronization? Incorrect. Set-mac-address can be called when the interface is up and active, such as by the bonding driver. 15) gfar_change_mtu() synchronization appears absent? Same conditions (and response) as set-mac-address. These can be called while you're actively DMAing packets. 23) gfar_set_multi() does not appear to take into account huge multi-cast lists. Drivers usually handle large dev->mc_count by falling back to ALLMULTI behavior.
24) setting IFF_MULTICAST is suspicious at best, possibly wrong: + dev->mtu = 1500; + dev->set_multicast_list = gfar_set_multi; + dev->flags |= IFF_MULTICAST; +
28) I see you support register dump (good!), now please send the register-pretty-print patch to the ethtool package :) Nothing wrong with accessing registers as 32-bit quantities. That attribute is common to a lot of NICs. 31) infinite loops, particularly on 1-bits, are discouraged: + /* Wait for the transaction to finish */ + while (gfar_read(®base->miimind) & (MIIMIND_NOTVALID | MIIMIND_BUSY)) + cpu_relax();
The most simple is to include a counter that counts down to zero, and starts some absurdly large number like 100000. 33) merge-stopper: mii_parse_sr(). never wait for autonegotiation to complete. it is an asynchronous operation that could exceed 30 seconds.
As common sense, regardless of phy bugs, you should not be trying to configure the MAC _or_ the phy in the middle of autonegotiation. Presumeably you are using a combination of netif_stop_queue(), netif_carrier_off(), and netif_device_detach() to achieve this. 35) liberally borrow code and ideas from Ben H's sungem_phy.c. Eventually we want to move to a generic phy module. Cool. This item #35 is more of a long term "think about it" type of request. Please do not hesitate to think of ways that you could share code with sungem_phy.c, and/or make them both use the same API, and submit patches along those lines :) It's not enough to just write a driver, help change Linux for the better :) From Jamal: See my comments to jamal as well: if you guarantee that you always have room on the DMA ring for an additional skb, that check should never be needed. Some extremely cautious/paranoid programmers will add a check, with a printk noting it's a BUG (i.e. impossible) condition, such as if (unlikely(... no more descriptors ...)) {
printk(KERN_ERR "%s: BUG: no room for TX\n", dev->name);
netif_stop_queue();
spin_unlock_irqrestore();
return 1;
}... queue TX to hardware ... if (no more descriptors)
netif_stop_queue()spin_unlock_irqrestore() 2) Also its pretty scary if you are doing: txbdp->status |= TXBD_INTERRUPT for every packet. Look at other drivers, they try to do this every few packets; or enable tx mitigation to slow the rate of those interupts. Even at 10/100 speeds, you really don't want to be generating one interrupt per Tx... Jeff |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: bk16 changes to cbq, David S. Miller |
|---|---|
| Next by Date: | RE: [RFC] TCP burst control, Injong Rhee |
| Previous by Thread: | Phy layer notes (was Re: [RFR] gianfar ethernet driver), Jeff Garzik |
| Next by Thread: | Re: [RFR] gianfar ethernet driver, Jeff Garzik |
| Indexes: | [Date] [Thread] [Top] [All Lists] |