Re: ef(4), eg(4), el(4), ex(4) and ie(4)

2015-03-31 Thread Miod Vallat
> > I'm afraid my ISA ec(4) seems to no longer work. Blinks red during POST,
> > doesn't get detected by the kernel (yes, it's jumped correctly).
> 
> Does that mean we can cvs rm the driver? :)

I think I have another one somewhere, but I can't find it at the moment.
It might have commited suicide by spontaneously jumping into the
``electronics to be recycled'' bin in the kitchen.



Re: ef(4), eg(4), el(4), ex(4) and ie(4)

2015-03-31 Thread Martin Pieuchot
On 31/03/15(Tue) 18:06, Miod Vallat wrote:
> > > What, no ec? No ep? Why play favorites???
> > 
> > You're asking for tricky ones!
> > 
> > Enjoy :)
> 
> I'm afraid my ISA ec(4) seems to no longer work. Blinks red during POST,
> doesn't get detected by the kernel (yes, it's jumped correctly).

Does that mean we can cvs rm the driver? :)



Re: ef(4), eg(4), el(4), ex(4) and ie(4)

2015-03-31 Thread Miod Vallat
> > What, no ec? No ep? Why play favorites???
> 
> You're asking for tricky ones!
> 
> Enjoy :)

I'm afraid my ISA ec(4) seems to no longer work. Blinks red during POST,
doesn't get detected by the kernel (yes, it's jumped correctly).

However, the elink3.c change works on

ep1 at pci0 dev 15 function 0 "3Com 3c590 10Mbps" rev 0x00: address 
00:a0:24:84:8a:b8, utp default utp/autoselect irq 10



Re: ef(4), eg(4), el(4), ex(4) and ie(4)

2015-03-26 Thread Ted Unangst
Martin Pieuchot wrote:
> On 26/03/15(Thu) 08:00, Ted Unangst wrote:
> > Martin Pieuchot wrote:
> > > Even our ISA Ethernet drivers can be converted to if_input().  If you
> > > still use some of these, I appreciate test reports.
> > > 
> > > I'm asking here because Miod said everybody can test them... hum hum.
> > > 
> > > Alternatively, if you think some drivers can go away, I'll summon
> > > tedu@.
> > 
> > What, no ec? No ep? Why play favorites???
> 
> You're asking for tricky ones!
> 
> Enjoy :)

You're deleting more lines than you're adding, so I did. :) Not as many
deletions as deleting the driver entirely, but I'll take what I can get.



Re: ef(4), eg(4), el(4), ex(4) and ie(4)

2015-03-26 Thread Martin Pieuchot
On 26/03/15(Thu) 08:00, Ted Unangst wrote:
> Martin Pieuchot wrote:
> > Even our ISA Ethernet drivers can be converted to if_input().  If you
> > still use some of these, I appreciate test reports.
> > 
> > I'm asking here because Miod said everybody can test them... hum hum.
> > 
> > Alternatively, if you think some drivers can go away, I'll summon
> > tedu@.
> 
> What, no ec? No ep? Why play favorites???

You're asking for tricky ones!

Enjoy :)


Index: dev/ic/elink3.c
===
RCS file: /cvs/src/sys/dev/ic/elink3.c,v
retrieving revision 1.83
diff -u -p -r1.83 elink3.c
--- dev/ic/elink3.c 14 Mar 2015 03:38:47 -  1.83
+++ dev/ic/elink3.c 26 Mar 2015 12:26:41 -
@@ -1243,8 +1243,9 @@ epread(struct ep_softc *sc)
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+   struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct mbuf *m;
-   int len;
+   int len, error = 0;
 
len = bus_space_read_2(iot, ioh, ep_w1_reg(sc, EP_W1_RX_STATUS));
 
@@ -1275,11 +1276,12 @@ again:
 #endif
 
if (len & ERR_INCOMPLETE)
-   return;
+   goto done;
 
if (len & ERR_RX) {
++ifp->if_ierrors;
-   goto abort;
+   error = 1;
+   goto done;
}
 
len &= RX_BYTES_MASK;   /* Lower 11 bits = RX bytes. */
@@ -1288,21 +1290,13 @@ again:
m = epget(sc, len);
if (m == NULL) {
ifp->if_ierrors++;
-   goto abort;
+   error = 1;
+   goto done;
}
 
++ifp->if_ipackets;
 
-#if NBPFILTER > 0
-   /*
-* Check if there's a BPF listener on this interface.
-* If so, hand off the raw packet to BPF.
-*/
-   if (ifp->if_bpf)
-   bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
-   ether_input_mbuf(ifp, m);
+   ml_enqueue(&ml, m);
 
/*
 * In periods of high traffic we can actually receive enough
@@ -1331,15 +1325,14 @@ again:
sc->sc_dev.dv_xname);
 #endif
epreset(sc);
-   return;
+   goto done;
}
goto again;
}
-
-   return;
-
-abort:
-   ep_discard_rxtop(iot, ioh);
+done:
+   if (error)
+   ep_discard_rxtop(iot, ioh);
+   if_input(ifp, &ml);
 }
 
 struct mbuf *
@@ -1347,7 +1340,6 @@ epget(struct ep_softc *sc, int totlen)
 {
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
-   struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct mbuf *m;
caddr_t data;
int len, pad, off, sh, rxreg;
@@ -1368,7 +1360,6 @@ epget(struct ep_softc *sc, int totlen)
sc->next_mb = (sc->next_mb + 1) % MAX_MBS;
 
len = MCLBYTES;
-   m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = totlen;
m->m_len = totlen;
pad = ALIGN(sizeof(struct ether_header)) - sizeof(struct ether_header);
Index: dev/ic/dp8390.c
===
RCS file: /cvs/src/sys/dev/ic/dp8390.c,v
retrieving revision 1.49
diff -u -p -r1.49 dp8390.c
--- dev/ic/dp8390.c 14 Mar 2015 03:38:47 -  1.49
+++ dev/ic/dp8390.c 26 Mar 2015 12:35:46 -
@@ -867,6 +867,7 @@ void
 dp8390_read(struct dp8390_softc *sc, int buf, u_short len)
 {
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+   struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct mbuf *m;
 
/* Pull packet off interface. */
@@ -877,17 +878,9 @@ dp8390_read(struct dp8390_softc *sc, int
}
 
ifp->if_ipackets++;
+   ml_enqueue(&ml, m);
 
-#if NBPFILTER > 0
-   /*
-* Check if there's a BPF listener on this interface.
-* If so, hand off the raw packet to bpf.
-*/
-   if (ifp->if_bpf)
-   bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
-   ether_input_mbuf(ifp, m);
+   if_input(ifp, &ml);
 }
 
 
@@ -947,14 +940,12 @@ dp8390_getmcaf(struct arpcom *ac, u_int8
 struct mbuf *
 dp8390_get(struct dp8390_softc *sc, int src, u_short total_len)
 {
-   struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct mbuf *m, *m0, *newm;
u_short len;
 
MGETHDR(m0, M_DONTWAIT, MT_DATA);
if (m0 == NULL)
return (0);
-   m0->m_pkthdr.rcvif = ifp;
m0->m_pkthdr.len = total_len;
len = MHLEN;
m = m0;



Re: ef(4), eg(4), el(4), ex(4) and ie(4)

2015-03-26 Thread Ted Unangst
Martin Pieuchot wrote:
> Even our ISA Ethernet drivers can be converted to if_input().  If you
> still use some of these, I appreciate test reports.
> 
> I'm asking here because Miod said everybody can test them... hum hum.
> 
> Alternatively, if you think some drivers can go away, I'll summon
> tedu@.

What, no ec? No ep? Why play favorites???



ef(4), eg(4), el(4), ex(4) and ie(4)

2015-03-26 Thread Martin Pieuchot
Even our ISA Ethernet drivers can be converted to if_input().  If you
still use some of these, I appreciate test reports.

I'm asking here because Miod said everybody can test them... hum hum.

Alternatively, if you think some drivers can go away, I'll summon
tedu@.

Index: isa/if_ef_isapnp.c
===
RCS file: /cvs/src/sys/dev/isa/if_ef_isapnp.c,v
retrieving revision 1.27
diff -u -p -r1.27 if_ef_isapnp.c
--- isa/if_ef_isapnp.c  22 Dec 2014 02:28:51 -  1.27
+++ isa/if_ef_isapnp.c  26 Mar 2015 11:29:22 -
@@ -671,6 +671,7 @@ efread(sc)
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+   struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct mbuf *m;
int len;
 
@@ -719,13 +720,9 @@ efread(sc)
}
 
ifp->if_ipackets++;
+   ml_enqueue(&ml, m);
 
-#if NBPFILTER > 0
-   if (ifp->if_bpf)
-   bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
-   ether_input_mbuf(ifp, m);
+   if_input(ifp, &ml);
 }
 
 struct mbuf *
@@ -735,14 +732,12 @@ efget(sc, totlen)
 {
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
-   struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct mbuf *top, **mp, *m;
int len, pad, s;
 
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
return (NULL);
-   m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = totlen;
pad = ALIGN(sizeof(struct ether_header)) - sizeof(struct ether_header);
m->m_data += pad;
Index: isa/if_eg.c
===
RCS file: /cvs/src/sys/dev/isa/if_eg.c,v
retrieving revision 1.36
diff -u -p -r1.36 if_eg.c
--- isa/if_eg.c 22 Dec 2014 02:28:51 -  1.36
+++ isa/if_eg.c 26 Mar 2015 11:28:42 -
@@ -670,8 +670,9 @@ void
 egread(struct eg_softc *sc, caddr_t buf, int len)
 {
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+   struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct mbuf *m;
-   
+
if (len <= sizeof(struct ether_header) ||
len > ETHER_MAX_LEN) {
printf("%s: invalid packet size %d; dropping\n",
@@ -688,17 +689,9 @@ egread(struct eg_softc *sc, caddr_t buf,
}
 
ifp->if_ipackets++;
+   ml_enqueue(&ml, m);
 
-#if NBPFILTER > 0
-   /*
-* Check if there's a BPF listener on this interface.
-* If so, hand off the raw packet to BPF.
-*/
-   if (ifp->if_bpf)
-   bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
-   ether_input_mbuf(ifp, m);
+   if_input(ifp, &ml);
 }
 
 /*
@@ -707,14 +700,12 @@ egread(struct eg_softc *sc, caddr_t buf,
 struct mbuf *
 egget(struct eg_softc *sc, caddr_t buf, int totlen)
 {
-   struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct mbuf *top, **mp, *m;
int len;
 
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == 0)
return (0);
-   m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = totlen;
len = MHLEN;
top = 0;
Index: isa/if_el.c
===
RCS file: /cvs/src/sys/dev/isa/if_el.c,v
retrieving revision 1.24
diff -u -p -r1.24 if_el.c
--- isa/if_el.c 22 Dec 2014 02:28:51 -  1.24
+++ isa/if_el.c 26 Mar 2015 11:28:38 -
@@ -490,6 +490,7 @@ elread(sc, len)
int len;
 {
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+   struct mbuf_list ml = MBUF_LIST_INITIALIZER();
struct mbuf *m;
 
if (len <= sizeof(struct ether_header) ||
@@ -508,17 +509,9 @@ elread(sc, len)
}
 
ifp->if_ipackets++;
+   ml_enqueue(&ml, m);
 
-#if NBPFILTER > 0
-   /*
-* Check if there's a BPF listener on this interface.
-* If so, hand off the raw packet to BPF.
-*/
-   if (ifp->if_bpf)
-   bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_IN);
-#endif
-
-   ether_input_mbuf(ifp, m);
+   if_input(ifp, &ml);
 }
 
 /*
@@ -531,7 +524,6 @@ elget(sc, totlen)
struct el_softc *sc;
int totlen;
 {
-   struct ifnet *ifp = &sc->sc_arpcom.ac_if;
int iobase = sc->sc_iobase;
struct mbuf *top, **mp, *m;
int len;
@@ -539,7 +531,6 @@ elget(sc, totlen)
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == 0)
return 0;
-   m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = totlen;
len = MHLEN;
top = 0;
Index: isa/if_ex.c
===
RCS file: /cvs/src/sys/dev/isa/if_ex.c,v
retrieving revision 1.37
diff -u -p -r1.37 if_ex.c
--- isa/if_ex.c 22 Dec 2014 02:28:51 -  1.37
+++ isa/if_ex.c 26 Mar 2015 11:24:27 -
@@ -639,6 +639,7 @@ void 
 ex_rx_intr(struct ex_softc *sc)
 {
struct ifnet *ifp = &sc->arpcom.ac_if;
+   struct mbuf_list ml = MBU