summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_rl.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1998-11-18 21:03:58 +0000
committerwpaul <wpaul@FreeBSD.org>1998-11-18 21:03:58 +0000
commitbfffd9b00f78d62bef14b804ae483cdd5f9711bc (patch)
tree593f0ad688135d7e189d9d421e83420b7e9712fa /sys/pci/if_rl.c
parenta160e8a6ea147a23b10f891a41b6ea9ac392d99e (diff)
downloadFreeBSD-src-bfffd9b00f78d62bef14b804ae483cdd5f9711bc.zip
FreeBSD-src-bfffd9b00f78d62bef14b804ae483cdd5f9711bc.tar.gz
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.
Diffstat (limited to 'sys/pci/if_rl.c')
-rw-r--r--sys/pci/if_rl.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c
index d9ec512..33d676a 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;
OpenPOWER on IntegriCloud