diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2007-10-21 03:49:55 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2007-10-21 03:49:55 +0000 |
commit | a32a3a310f9898d998690cd51326e536299f931a (patch) | |
tree | 98232ea40f680525d9962ad5b51b01dfe6aa1909 /sys/dev/pci | |
parent | 61ed879288aa48918945767f96b7fc9a79963158 (diff) |
Allow for the adjustment of the number of RX descriptors
for the newer generations of em(4) chipsets independently
from the first two generations (82542/82543). The first
two generations have hardware errata limiting the upper
maximum to 256 descriptors. The number of RX descriptors
has not been adjusted yet.
ok beck@ henning@ dlg@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_em.c | 18 | ||||
-rw-r--r-- | sys/dev/pci/if_em.h | 3 |
2 files changed, 14 insertions, 7 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index 48d8e9e1171..5836760f5ae 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.173 2007/10/01 15:34:48 krw Exp $ */ +/* $OpenBSD: if_em.c,v 1.174 2007/10/21 03:49:54 brad Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include <dev/pci/if_em.h> @@ -329,8 +329,12 @@ em_attach(struct device *parent, struct device *self, void *aux) } sc->tx_desc_base = (struct em_tx_desc *)sc->txdma.dma_vaddr; - rsize = EM_ROUNDUP(sc->num_rx_desc * sizeof(struct em_rx_desc), - EM_MAX_RXD * sizeof(struct em_rx_desc)); + if (sc->hw.mac_type >= em_82544) + rsize = EM_ROUNDUP(sc->num_rx_desc * sizeof(struct em_rx_desc), + EM_MAX_RXD * sizeof(struct em_rx_desc)); + else + rsize = EM_ROUNDUP(sc->num_rx_desc * sizeof(struct em_rx_desc), + EM_MAX_RXD_82543 * sizeof(struct em_rx_desc)); rsize = EM_ROUNDUP(rsize, PAGE_SIZE); /* Allocate Receive Descriptor ring */ @@ -631,11 +635,13 @@ em_init(void *arg) em_stop(sc); if (ifp->if_flags & IFF_UP) { - if (sc->hw.mac_type >= em_82544) + if (sc->hw.mac_type >= em_82544) { sc->num_tx_desc = EM_MAX_TXD; - else + sc->num_rx_desc = EM_MAX_RXD; + } else { sc->num_tx_desc = EM_MAX_TXD_82543; - sc->num_rx_desc = EM_MAX_RXD; + sc->num_rx_desc = EM_MAX_RXD_82543; + } } else { sc->num_tx_desc = EM_MIN_TXD; sc->num_rx_desc = EM_MIN_RXD; diff --git a/sys/dev/pci/if_em.h b/sys/dev/pci/if_em.h index 00b0575a23f..a8a137ff553 100644 --- a/sys/dev/pci/if_em.h +++ b/sys/dev/pci/if_em.h @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ /* $FreeBSD: if_em.h,v 1.26 2004/09/01 23:22:41 pdeuskar Exp $ */ -/* $OpenBSD: if_em.h,v 1.35 2007/05/30 06:29:17 ckuethe Exp $ */ +/* $OpenBSD: if_em.h,v 1.36 2007/10/21 03:49:54 brad Exp $ */ #ifndef _EM_H_DEFINED_ #define _EM_H_DEFINED_ @@ -112,6 +112,7 @@ POSSIBILITY OF SUCH DAMAGE. * (num_tx_desc * sizeof(struct em_tx_desc)) % 128 == 0 */ #define EM_MIN_RXD 12 +#define EM_MAX_RXD_82543 256 #define EM_MAX_RXD 256 /* |