From e0b8bc252fe1e9805248956dbeac615cda8ba105 Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Tue, 3 Oct 2000 18:11:36 +0000 Subject: [PATCH] Add support for the AMD Am79c976 PCnet/PRO controller chip. For now this just involves adding the chip ID to the supported list: the PCnet/PRO is compatible with the PCnet/FAST+ and friends and should "just work" with this driver. Also try to handle mbuf allocation failures in the receive handler more gracefully. --- share/man/man4/pcn.4 | 4 ++-- sys/pci/if_pcn.c | 10 +++++++++- sys/pci/if_pcnreg.h | 14 +------------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/share/man/man4/pcn.4 b/share/man/man4/pcn.4 index e61bdf2d9d88..f80023c1a1cb 100644 --- a/share/man/man4/pcn.4 +++ b/share/man/man4/pcn.4 @@ -44,8 +44,8 @@ The .Nm driver provides support for PCI ethernet adapters and embedded -controllers based on the AMD PCnet/FAST, PCnet/FAST+ and PCnet/Home -ethernet controller chips. +controllers based on the AMD PCnet/FAST, PCnet/FAST+, PCnet/PRO +and PCnet/Home ethernet controller chips. .Pp The PCnet/PCI chips include a 100Mbps ethernet MAC and support both a serial and MII-compliant transceiver interface. diff --git a/sys/pci/if_pcn.c b/sys/pci/if_pcn.c index 1bfcbed6a577..a2eb8efb1140 100644 --- a/sys/pci/if_pcn.c +++ b/sys/pci/if_pcn.c @@ -410,6 +410,7 @@ static int pcn_probe(dev) case Am79C971: case Am79C972: case Am79C973: + case Am79C976: case Am79C978: break; default: @@ -761,7 +762,14 @@ static void pcn_rxeof(sc) continue; } - pcn_newbuf(sc, i, NULL); + if (pcn_newbuf(sc, i, NULL)) { + /* Ran out of mbufs; recycle this one. */ + pcn_newbuf(sc, i, m); + ifp->if_ierrors++; + PCN_INC(i, PCN_RX_LIST_CNT); + continue; + } + PCN_INC(i, PCN_RX_LIST_CNT); /* No errors; receive the packet. */ diff --git a/sys/pci/if_pcnreg.h b/sys/pci/if_pcnreg.h index dc234b62895f..0b0a79ad282a 100644 --- a/sys/pci/if_pcnreg.h +++ b/sys/pci/if_pcnreg.h @@ -212,19 +212,6 @@ /* * Chip ID values. */ -/* Chip types */ -#define LANCE 1 /* Am7990 */ -#define C_LANCE 2 /* Am79C90 */ -#define PCnet_ISA 3 /* Am79C960 */ -#define PCnet_ISAplus 4 /* Am79C961 */ -#define PCnet_ISA_II 5 /* Am79C961A */ -#define PCnet_32 6 /* Am79C965 */ -#define PCnet_PCI 7 /* Am79C970 */ -#define PCnet_PCI_II 8 /* Am79C970A */ -#define PCnet_FAST 9 /* Am79C971 */ -#define PCnet_FASTplus 10 /* Am79C972 */ -#define PCnet_Home 11 /* Am79C978 */ - /* CSR88-89: Chip ID masks */ #define AMD_MASK 0x003 #define PART_MASK 0xffff @@ -238,6 +225,7 @@ #define Am79C972 0x2624 #define Am79C973 0x2625 #define Am79C978 0x2626 +#define Am79C976 0x2628 /* * Advanced feature control (CSR122)