From 552a0ec7c393949e41e0a9bc599dd8ae2a62cadc Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Wed, 18 Nov 1998 21:03:58 +0000 Subject: [PATCH] The Accton 1207D adapter uses a chip called the MXP 5030 (or 5038) which is either a RealTek 8139 in disguise or a RealTek workalike. This commit fixes the PCI vendor/device ID for this device and updates the description string to reflect the actual identity of the device. I also changed the transmit encapsulation routine to always to buffer copies on transmit. We end up doing this 99% of the time anyway. I also tweaked the code that pads packets out to the minimum length (60) bytes. I was fixing up the m_pkthdr.len value but not m_len. I don't think this makes that much difference in the grand scheme of things, but it makes me feel better. --- sys/pci/if_rl.c | 49 +++++++++++++++++++++++----------------------- sys/pci/if_rlreg.h | 14 ++++++++++--- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c index d9ec5121d093..33d676a53f71 100644 --- a/sys/pci/if_rl.c +++ b/sys/pci/if_rl.c @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_rl.c,v 1.13 1998/10/07 22:51:30 wpaul Exp $ + * $Id: if_rl.c,v 1.14 1998/11/18 20:27:28 wpaul Exp $ */ /* @@ -133,7 +133,7 @@ #ifndef lint static char rcsid[] = - "$Id: if_rl.c,v 1.13 1998/10/07 22:51:30 wpaul Exp $"; + "$Id: if_rl.c,v 1.14 1998/11/18 20:27:28 wpaul Exp $"; #endif /* @@ -144,8 +144,8 @@ static struct rl_type rl_devs[] = { "RealTek 8129 10/100BaseTX" }, { RT_VENDORID, RT_DEVICEID_8139, "RealTek 8139 10/100BaseTX" }, - { RT_VENDORID_ALT, RT_DEVICEID_8139_ALT, - "RealTek 8139 10/100BaseTX" }, + { ACCTON_VENDORID, ACCTON_DEVICEID_5030, + "Accton MPX 5030/5038 10/100BaseTX" }, { 0, 0, NULL } }; @@ -1571,6 +1571,7 @@ static int rl_encap(sc, c, m_head) struct mbuf *m_head; { struct mbuf *m; + struct mbuf *m_new = NULL; /* * There are two possible encapsulation mechanisms @@ -1587,34 +1588,32 @@ static int rl_encap(sc, c, m_head) m = m_head; - if (m->m_pkthdr.len > MHLEN || (mtod(m, u_int32_t) & 0x00000003)) { - struct mbuf *m_new = NULL; - - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - printf("rl%d: no memory for tx list", sc->rl_unit); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); + if (m_new == NULL) { + printf("rl%d: no memory for tx list", sc->rl_unit); + return(1); + } + if (m_head->m_pkthdr.len > MHLEN) { + MCLGET(m_new, M_DONTWAIT); + if (!(m_new->m_flags & M_EXT)) { + m_freem(m_new); + printf("rl%d: no memory for tx list", + sc->rl_unit); return(1); } - if (m_head->m_pkthdr.len > MHLEN) { - MCLGET(m_new, M_DONTWAIT); - if (!(m_new->m_flags & M_EXT)) { - m_freem(m_new); - printf("rl%d: no memory for tx list", - sc->rl_unit); - return(1); - } - } - m_copydata(m_head, 0, m_head->m_pkthdr.len, - mtod(m_new, caddr_t)); - m_new->m_pkthdr.len = m_new->m_len = m_head->m_pkthdr.len; - m_freem(m_head); - m_head = m_new; } + m_copydata(m_head, 0, m_head->m_pkthdr.len, + mtod(m_new, caddr_t)); + m_new->m_pkthdr.len = m_new->m_len = m_head->m_pkthdr.len; + m_freem(m_head); + m_head = m_new; /* Pad frames to at least 60 bytes. */ - if (m_head->m_pkthdr.len < RL_MIN_FRAMELEN) + if (m_head->m_pkthdr.len < RL_MIN_FRAMELEN) { m_head->m_pkthdr.len += (RL_MIN_FRAMELEN - m_head->m_pkthdr.len); + m_head->m_len = m_head->m_pkthdr.len; + } c->rl_mbuf = m_head; diff --git a/sys/pci/if_rlreg.h b/sys/pci/if_rlreg.h index 45956dd1ff3f..1825dbc400c6 100644 --- a/sys/pci/if_rlreg.h +++ b/sys/pci/if_rlreg.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_rlreg.h,v 1.12 1998/10/07 22:52:34 wpaul Exp $ + * $Id: if_rlreg.h,v 1.13 1998/11/18 20:27:28 wpaul Exp $ */ /* @@ -387,14 +387,22 @@ struct rl_softc { * RealTek PCI vendor ID */ #define RT_VENDORID 0x10EC -#define RT_VENDORID_ALT 0x1211 + +/* + * Accton PCI vendor ID + */ +#define ACCTON_VENDORID 0x1113 /* * RealTek chip device IDs. */ #define RT_DEVICEID_8129 0x8129 #define RT_DEVICEID_8139 0x8139 -#define RT_DEVICEID_8139_ALT 0x1211 + +/* + * Accton MPX 5030/5038 device ID. + */ +#define ACCTON_DEVICEID_5030 0x1211 /* * Texas Instruments PHY identifiers