Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/sys/arch/acorn26/podulebus Pullup revisions 1.6-1.7 (re...



details:   https://anonhg.NetBSD.org/src/rev/59321c13246d
branches:  netbsd-1-6
changeset: 529953:59321c13246d
user:      jmc <jmc%NetBSD.org@localhost>
date:      Mon Jan 27 05:25:52 2003 +0000

description:
Pullup revisions 1.6-1.7 (requested by bouyer in ticket #1096)
 Zero out the NIC memory when padding packet to
 ETHER_MIN_LEN-ETHER_CRC_LEN sc->write_mbuf now return len of
 buffer, including padding.

diffstat:

 sys/arch/acorn26/podulebus/if_eh.c |  23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diffs (68 lines):

diff -r ff7337ba1a5e -r 59321c13246d sys/arch/acorn26/podulebus/if_eh.c
--- a/sys/arch/acorn26/podulebus/if_eh.c        Mon Jan 27 05:14:44 2003 +0000
+++ b/sys/arch/acorn26/podulebus/if_eh.c        Mon Jan 27 05:25:52 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_eh.c,v 1.2.4.1 2002/11/01 11:13:06 tron Exp $ */
+/* $NetBSD: if_eh.c,v 1.2.4.2 2003/01/27 05:25:52 jmc Exp $ */
 
 /*-
  * Copyright (c) 2000 Ben Harris
@@ -52,7 +52,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: if_eh.c,v 1.2.4.1 2002/11/01 11:13:06 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eh.c,v 1.2.4.2 2003/01/27 05:25:52 jmc Exp $");
 
 #include <sys/systm.h>
 #include <sys/device.h>
@@ -231,7 +231,7 @@
        /* dsc->rcr_proto? */
 
        /* Follow NE2000 driver here. */
-        dsc->dcr_reg = ED_DCR_FT1 | ED_DCR_LS;
+       dsc->dcr_reg = ED_DCR_FT1 | ED_DCR_LS;
        if (sc->sc_flags & EHF_16BIT)
                dsc->dcr_reg |= ED_DCR_WTS;
 
@@ -347,10 +347,15 @@
        bus_space_handle_t nich = dsc->sc_regh;
        bus_space_tag_t datat = sc->sc_datat;
        bus_space_handle_t datah = sc->sc_datah;
-       int savelen;
+       int savelen, padlen;
        int maxwait = 100;      /* about 120us */
 
        savelen = m->m_pkthdr.len;
+       if (savelen < ETHER_MIN_LEN - ETHER_CRC_LEN) {
+               padlen = ETHER_MIN_LEN - ETHER_CRC_LEN - savelen;
+               savelen = ETHER_MIN_LEN - ETHER_CRC_LEN;
+       } else
+               padlen = 0;
 
        /*
         * Set-up procedure per DP83902A data sheet:
@@ -412,6 +417,11 @@
                        if (m->m_len)
                                bus_space_write_multi_1(datat, datah, 0,
                                    mtod(m, u_int8_t *), m->m_len);
+               if (padlen) {
+                       for(; padlen > 0; padlen--)
+                               bus_space_write_1(asict, asich,
+                                   NE2000_ASIC_DATA, 0);
+               }
        } else {
                /* NE2000s are a bit trickier. */
                u_int8_t *data, savebyte[2];
@@ -483,6 +493,11 @@
                        bus_space_write_stream_2(datat, datah, 0,
                            *(u_int16_t *)savebyte);
                }
+               if (padlen)
+                       for(; padlen > 0; padlen -= 2)
+                               bus_space_write_stream_2(asict, asich,
+                                   NE2000_ASIC_DATA, 0);
+               }
        }
        NIC_BARRIER(nict, nich);
 



Home | Main Index | Thread Index | Old Index