MCLGETI support for xl(4)

2010-09-16 Thread Loganaden Velvindron
Greetings,

>From brad, remove superfluous braces.

Index: src/sys/dev/ic/xl.c
===
RCS file: /cvs/src/sys/dev/ic/xl.c,v
retrieving revision 1.96
diff -u -p -r1.96 xl.c
--- src/sys/dev/ic/xl.c 7 Sep 2010 16:21:43 -   1.96
+++ src/sys/dev/ic/xl.c 16 Sep 2010 19:36:53 -
@@ -153,7 +153,6 @@ void xl_stats_update(void *);
 int xl_encap(struct xl_softc *, struct xl_chain *,
 struct mbuf * );
 void xl_rxeof(struct xl_softc *);
-int xl_rx_resync(struct xl_softc *);
 void xl_txeof(struct xl_softc *);
 void xl_txeof_90xB(struct xl_softc *);
 void xl_txeoc(struct xl_softc *);
@@ -180,6 +179,7 @@ void xl_iff(struct xl_softc *);
 void xl_iff_90x(struct xl_softc *);
 void xl_iff_905b(struct xl_softc *);
 int xl_list_rx_init(struct xl_softc *);
+void xl_fill_rx_ring(struct xl_softc *);
 int xl_list_tx_init(struct xl_softc *);
 int xl_list_tx_init_90xB(struct xl_softc *);
 void xl_wait(struct xl_softc *);
@@ -1076,8 +1076,6 @@ xl_list_rx_init(struct xl_softc *sc)
for (i = 0; i < XL_RX_LIST_CNT; i++) {
cd->xl_rx_chain[i].xl_ptr =
(struct xl_list_onefrag *)&ld->xl_rx_list[i];
-   if (xl_newbuf(sc, &cd->xl_rx_chain[i]) == ENOBUFS)
-   return(ENOBUFS);
if (i == (XL_RX_LIST_CNT - 1))
n = 0;
else
@@ -1088,11 +1086,30 @@ xl_list_rx_init(struct xl_softc *sc)
ld->xl_rx_list[i].xl_next = htole32(next);
}
 
-   cd->xl_rx_head = &cd->xl_rx_chain[0];
-
+   cd->xl_rx_prod = cd->xl_rx_cons = &cd->xl_rx_chain[0];
+   cd->xl_rx_cnt = 0;
+   xl_fill_rx_ring(sc);
return (0);
 }
 
+void
+xl_fill_rx_ring(struct xl_softc *sc)
+{  
+   struct xl_chain_data*cd;
+   struct xl_list_data *ld;
+
+   cd = &sc->xl_cdata;
+   ld = sc->xl_ldata;
+
+   while (cd->xl_rx_cnt < XL_RX_LIST_CNT) {
+   if (xl_newbuf(sc, cd->xl_rx_prod) == ENOBUFS)
+   break;
+   cd->xl_rx_prod = cd->xl_rx_prod->xl_next;
+   cd->xl_rx_cnt++;
+   }
+}
+
+
 /*
  * Initialize an RX descriptor and attach an MBUF cluster.
  */
@@ -1102,15 +1119,10 @@ xl_newbuf(struct xl_softc *sc, struct xl
struct mbuf *m_new = NULL;
bus_dmamap_tmap;
 
-   MGETHDR(m_new, M_DONTWAIT, MT_DATA);
-   if (m_new == NULL)
-   return (ENOBUFS);
-
-   MCLGET(m_new, M_DONTWAIT);
-   if (!(m_new->m_flags & M_EXT)) {
-   m_freem(m_new);
+   m_new = MCLGETI(NULL, M_DONTWAIT, &sc->sc_arpcom.ac_if, MCLBYTES);
+   
+   if (!m_new)
return (ENOBUFS);
-   }
 
m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
if (bus_dmamap_load(sc->sc_dmat, sc->sc_rx_sparemap,
@@ -1150,32 +1162,6 @@ xl_newbuf(struct xl_softc *sc, struct xl
return (0);
 }
 
-int
-xl_rx_resync(struct xl_softc *sc)
-{
-   struct xl_chain_onefrag *pos;
-   int i;
-
-   pos = sc->xl_cdata.xl_rx_head;
-
-   for (i = 0; i < XL_RX_LIST_CNT; i++) {
-   bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap,
-   ((caddr_t)pos->xl_ptr - sc->sc_listkva),
-   sizeof(struct xl_list),
-   BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
-
-   if (pos->xl_ptr->xl_status)
-   break;
-   pos = pos->xl_next;
-   }
-
-   if (i == XL_RX_LIST_CNT)
-   return (0);
-
-   sc->xl_cdata.xl_rx_head = pos;
-
-   return (EAGAIN);
-}
 
 /*
  * A frame has been uploaded: pass the resulting mbuf chain up to
@@ -1195,12 +1181,14 @@ xl_rxeof(struct xl_softc *sc)
 
 again:
 
-   while ((rxstat = letoh32(sc->xl_cdata.xl_rx_head->xl_ptr->xl_status))
-   != 0) {
-   cur_rx = sc->xl_cdata.xl_rx_head;
-   sc->xl_cdata.xl_rx_head = cur_rx->xl_next;
+   while ((rxstat = letoh32(sc->xl_cdata.xl_rx_cons->xl_ptr->xl_status))
+   != 0 && sc->xl_cdata.xl_rx_cnt > 0) {
+   cur_rx = sc->xl_cdata.xl_rx_cons;
+   m = cur_rx->xl_mbuf;  
+   cur_rx->xl_mbuf = NULL;
+   sc->xl_cdata.xl_rx_cons = cur_rx->xl_next;
+   sc->xl_cdata.xl_rx_cnt--;
total_len = rxstat & XL_RXSTAT_LENMASK;
-
bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap,
((caddr_t)cur_rx->xl_ptr - sc->sc_listkva),
sizeof(struct xl_list),
@@ -1224,6 +1212,7 @@ again:
if (rxstat & XL_RXSTAT_UP_ERROR) {
ifp->if_ierrors++;
cur_rx->xl_ptr->xl_status = htole32(0);
+   m_freem(m);
continue;
}
 
@@ -1237,22 +1226,7 @@ again:
"packet dropped\n", sc->sc_dev.dv_xname);
ifp->if_ierrors++;
cur_rx->

MCLGETI support for xl(4)

2010-09-16 Thread Loganaden Velvindron
Greetings,

>From bryan, fix tabs around while loop.

Index: src/sys/dev/ic/xl.c
===
RCS file: /cvs/src/sys/dev/ic/xl.c,v
retrieving revision 1.96
diff -u -p -r1.96 xl.c
--- src/sys/dev/ic/xl.c 7 Sep 2010 16:21:43 -   1.96
+++ src/sys/dev/ic/xl.c 16 Sep 2010 19:12:18 -
@@ -153,7 +153,6 @@ void xl_stats_update(void *);
 int xl_encap(struct xl_softc *, struct xl_chain *,
 struct mbuf * );
 void xl_rxeof(struct xl_softc *);
-int xl_rx_resync(struct xl_softc *);
 void xl_txeof(struct xl_softc *);
 void xl_txeof_90xB(struct xl_softc *);
 void xl_txeoc(struct xl_softc *);
@@ -180,6 +179,7 @@ void xl_iff(struct xl_softc *);
 void xl_iff_90x(struct xl_softc *);
 void xl_iff_905b(struct xl_softc *);
 int xl_list_rx_init(struct xl_softc *);
+void xl_fill_rx_ring(struct xl_softc *);
 int xl_list_tx_init(struct xl_softc *);
 int xl_list_tx_init_90xB(struct xl_softc *);
 void xl_wait(struct xl_softc *);
@@ -1076,8 +1076,6 @@ xl_list_rx_init(struct xl_softc *sc)
for (i = 0; i < XL_RX_LIST_CNT; i++) {
cd->xl_rx_chain[i].xl_ptr =
(struct xl_list_onefrag *)&ld->xl_rx_list[i];
-   if (xl_newbuf(sc, &cd->xl_rx_chain[i]) == ENOBUFS)
-   return(ENOBUFS);
if (i == (XL_RX_LIST_CNT - 1))
n = 0;
else
@@ -1088,11 +1086,30 @@ xl_list_rx_init(struct xl_softc *sc)
ld->xl_rx_list[i].xl_next = htole32(next);
}
 
-   cd->xl_rx_head = &cd->xl_rx_chain[0];
-
+   cd->xl_rx_prod = cd->xl_rx_cons = &cd->xl_rx_chain[0];
+   cd->xl_rx_cnt = 0;
+   xl_fill_rx_ring(sc);
return (0);
 }
 
+void
+xl_fill_rx_ring(struct xl_softc *sc)
+{  
+   struct xl_chain_data*cd;
+   struct xl_list_data *ld;
+
+   cd = &sc->xl_cdata;
+   ld = sc->xl_ldata;
+
+   while (cd->xl_rx_cnt < XL_RX_LIST_CNT) {
+   if (xl_newbuf(sc, cd->xl_rx_prod) == ENOBUFS)
+   break;
+   cd->xl_rx_prod = cd->xl_rx_prod->xl_next;
+   cd->xl_rx_cnt++;
+   }
+}
+
+
 /*
  * Initialize an RX descriptor and attach an MBUF cluster.
  */
@@ -1102,13 +1119,9 @@ xl_newbuf(struct xl_softc *sc, struct xl
struct mbuf *m_new = NULL;
bus_dmamap_tmap;
 
-   MGETHDR(m_new, M_DONTWAIT, MT_DATA);
-   if (m_new == NULL)
-   return (ENOBUFS);
-
-   MCLGET(m_new, M_DONTWAIT);
-   if (!(m_new->m_flags & M_EXT)) {
-   m_freem(m_new);
+   m_new = MCLGETI(NULL, M_DONTWAIT, &sc->sc_arpcom.ac_if, MCLBYTES);
+   
+   if (!m_new){
return (ENOBUFS);
}
 
@@ -1150,32 +1163,6 @@ xl_newbuf(struct xl_softc *sc, struct xl
return (0);
 }
 
-int
-xl_rx_resync(struct xl_softc *sc)
-{
-   struct xl_chain_onefrag *pos;
-   int i;
-
-   pos = sc->xl_cdata.xl_rx_head;
-
-   for (i = 0; i < XL_RX_LIST_CNT; i++) {
-   bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap,
-   ((caddr_t)pos->xl_ptr - sc->sc_listkva),
-   sizeof(struct xl_list),
-   BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
-
-   if (pos->xl_ptr->xl_status)
-   break;
-   pos = pos->xl_next;
-   }
-
-   if (i == XL_RX_LIST_CNT)
-   return (0);
-
-   sc->xl_cdata.xl_rx_head = pos;
-
-   return (EAGAIN);
-}
 
 /*
  * A frame has been uploaded: pass the resulting mbuf chain up to
@@ -1195,12 +1182,14 @@ xl_rxeof(struct xl_softc *sc)
 
 again:
 
-   while ((rxstat = letoh32(sc->xl_cdata.xl_rx_head->xl_ptr->xl_status))
-   != 0) {
-   cur_rx = sc->xl_cdata.xl_rx_head;
-   sc->xl_cdata.xl_rx_head = cur_rx->xl_next;
+   while ((rxstat = letoh32(sc->xl_cdata.xl_rx_cons->xl_ptr->xl_status))
+   != 0 && sc->xl_cdata.xl_rx_cnt > 0) {
+   cur_rx = sc->xl_cdata.xl_rx_cons;
+   m = cur_rx->xl_mbuf;  
+   cur_rx->xl_mbuf = NULL;
+   sc->xl_cdata.xl_rx_cons = cur_rx->xl_next;
+   sc->xl_cdata.xl_rx_cnt--;
total_len = rxstat & XL_RXSTAT_LENMASK;
-
bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap,
((caddr_t)cur_rx->xl_ptr - sc->sc_listkva),
sizeof(struct xl_list),
@@ -1224,6 +1213,7 @@ again:
if (rxstat & XL_RXSTAT_UP_ERROR) {
ifp->if_ierrors++;
cur_rx->xl_ptr->xl_status = htole32(0);
+   m_freem(m);
continue;
}
 
@@ -1237,22 +1227,7 @@ again:
"packet dropped\n", sc->sc_dev.dv_xname);
ifp->if_ierrors++;
cur_rx->xl_ptr->xl_status = htole32(0);
-   continue;
-   }
-
-   /* No errors

MCLGETI support for xl(4)

2010-09-16 Thread Loganaden Velvindron
Greetings,
Thanks bryan for testing it !
I've applied the necessary changes.

Here it is:

Index: src/sys/dev/ic/xl.c
===
RCS file: /cvs/src/sys/dev/ic/xl.c,v
retrieving revision 1.96
diff -u -p -r1.96 xl.c
--- src/sys/dev/ic/xl.c 7 Sep 2010 16:21:43 -   1.96
+++ src/sys/dev/ic/xl.c 16 Sep 2010 18:09:28 -
@@ -153,7 +153,6 @@ void xl_stats_update(void *);
 int xl_encap(struct xl_softc *, struct xl_chain *,
 struct mbuf * );
 void xl_rxeof(struct xl_softc *);
-int xl_rx_resync(struct xl_softc *);
 void xl_txeof(struct xl_softc *);
 void xl_txeof_90xB(struct xl_softc *);
 void xl_txeoc(struct xl_softc *);
@@ -180,6 +179,7 @@ void xl_iff(struct xl_softc *);
 void xl_iff_90x(struct xl_softc *);
 void xl_iff_905b(struct xl_softc *);
 int xl_list_rx_init(struct xl_softc *);
+void xl_fill_rx_ring(struct xl_softc *);
 int xl_list_tx_init(struct xl_softc *);
 int xl_list_tx_init_90xB(struct xl_softc *);
 void xl_wait(struct xl_softc *);
@@ -1076,8 +1076,6 @@ xl_list_rx_init(struct xl_softc *sc)
for (i = 0; i < XL_RX_LIST_CNT; i++) {
cd->xl_rx_chain[i].xl_ptr =
(struct xl_list_onefrag *)&ld->xl_rx_list[i];
-   if (xl_newbuf(sc, &cd->xl_rx_chain[i]) == ENOBUFS)
-   return(ENOBUFS);
if (i == (XL_RX_LIST_CNT - 1))
n = 0;
else
@@ -1088,11 +1086,30 @@ xl_list_rx_init(struct xl_softc *sc)
ld->xl_rx_list[i].xl_next = htole32(next);
}
 
-   cd->xl_rx_head = &cd->xl_rx_chain[0];
-
+   cd->xl_rx_prod = cd->xl_rx_cons = &cd->xl_rx_chain[0];
+   cd->xl_rx_cnt = 0;
+   xl_fill_rx_ring(sc);
return (0);
 }
 
+void
+xl_fill_rx_ring(struct xl_softc *sc)
+{  
+   struct xl_chain_data*cd;
+   struct xl_list_data *ld;
+
+   cd = &sc->xl_cdata;
+   ld = sc->xl_ldata;
+
+   while (cd->xl_rx_cnt < XL_RX_LIST_CNT) {
+   if (xl_newbuf(sc, cd->xl_rx_prod) == ENOBUFS)
+   break;
+   cd->xl_rx_prod = cd->xl_rx_prod->xl_next;
+   cd->xl_rx_cnt++;
+   }
+}
+
+
 /*
  * Initialize an RX descriptor and attach an MBUF cluster.
  */
@@ -1102,13 +1119,9 @@ xl_newbuf(struct xl_softc *sc, struct xl
struct mbuf *m_new = NULL;
bus_dmamap_tmap;
 
-   MGETHDR(m_new, M_DONTWAIT, MT_DATA);
-   if (m_new == NULL)
-   return (ENOBUFS);
-
-   MCLGET(m_new, M_DONTWAIT);
-   if (!(m_new->m_flags & M_EXT)) {
-   m_freem(m_new);
+   m_new = MCLGETI(NULL, M_DONTWAIT, &sc->sc_arpcom.ac_if, MCLBYTES);
+   
+   if (!m_new){
return (ENOBUFS);
}
 
@@ -1150,32 +1163,6 @@ xl_newbuf(struct xl_softc *sc, struct xl
return (0);
 }
 
-int
-xl_rx_resync(struct xl_softc *sc)
-{
-   struct xl_chain_onefrag *pos;
-   int i;
-
-   pos = sc->xl_cdata.xl_rx_head;
-
-   for (i = 0; i < XL_RX_LIST_CNT; i++) {
-   bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap,
-   ((caddr_t)pos->xl_ptr - sc->sc_listkva),
-   sizeof(struct xl_list),
-   BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
-
-   if (pos->xl_ptr->xl_status)
-   break;
-   pos = pos->xl_next;
-   }
-
-   if (i == XL_RX_LIST_CNT)
-   return (0);
-
-   sc->xl_cdata.xl_rx_head = pos;
-
-   return (EAGAIN);
-}
 
 /*
  * A frame has been uploaded: pass the resulting mbuf chain up to
@@ -1195,12 +1182,14 @@ xl_rxeof(struct xl_softc *sc)
 
 again:
 
-   while ((rxstat = letoh32(sc->xl_cdata.xl_rx_head->xl_ptr->xl_status))
-   != 0) {
-   cur_rx = sc->xl_cdata.xl_rx_head;
-   sc->xl_cdata.xl_rx_head = cur_rx->xl_next;
+   while ((rxstat = letoh32(sc->xl_cdata.xl_rx_cons->xl_ptr->xl_status))
+   != 0 && sc->xl_cdata.xl_rx_cnt > 0) {
+   cur_rx = sc->xl_cdata.xl_rx_cons;
+   m = cur_rx->xl_mbuf;  
+   cur_rx->xl_mbuf = NULL;
+   sc->xl_cdata.xl_rx_cons = cur_rx->xl_next;
+   sc->xl_cdata.xl_rx_cnt--;
total_len = rxstat & XL_RXSTAT_LENMASK;
-
bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap,
((caddr_t)cur_rx->xl_ptr - sc->sc_listkva),
sizeof(struct xl_list),
@@ -1224,6 +1213,7 @@ again:
if (rxstat & XL_RXSTAT_UP_ERROR) {
ifp->if_ierrors++;
cur_rx->xl_ptr->xl_status = htole32(0);
+   m_freem(m);
continue;
}
 
@@ -1237,22 +1227,7 @@ again:
"packet dropped\n", sc->sc_dev.dv_xname);
ifp->if_ierrors++;
cur_rx->xl_ptr->xl_status = htole32(0);
-   continue;
-   }
-
-   /* No e

Re: MCLGETI support for xl(4)

2010-09-16 Thread Brynet
This is nice, there are some minor issues with the diff.

* The xl_fill_rx_ring function body uses spaces instead of tabs.
* Around -1125,11 +1138,11, you insert a few tabs unnecessarily.
* ..and around -1195,12 +1182,14, within the while loop, spaces.
* For the header patch, more spaces.

I am seeing some neat 'netstat -m' values when using this patch on an
older P3 system, memory utilization goes down to 7/8%, reaching only 20%
when transferring a file over SSH. :-)

Without the patch it goes immediately to 25% after 'ifconfig xl0 address'.

Actually seems to perform better even, although perhaps that's my mind
playing tricks on me.

Thanks,
-Bryan.



Crociere nel Mediterraneo

2010-09-16 Thread Vacanze Nel Sole
M

[demime 1.01d removed an attachment of type image/jpeg which had a name of 
1.jpg]

[demime 1.01d removed an attachment of type image/jpeg which had a name of 
2.jpg]

[demime 1.01d removed an attachment of type image/jpeg which had a name of 
3.jpg]

[demime 1.01d removed an attachment of type image/jpeg which had a name of 
4.jpg]

[demime 1.01d removed an attachment of type image/jpeg which had a name of 
5.jpg]

[demime 1.01d removed an attachment of type image/jpeg which had a name of 
6.jpg]

[demime 1.01d removed an attachment of type image/jpeg which had a name of 
7.jpg]

[demime 1.01d removed an attachment of type image/jpeg which had a name of 
8.jpg]

[demime 1.01d removed an attachment of type image/jpeg which had a name of 
9.jpg]

[demime 1.01d removed an attachment of type image/jpeg which had a name of 
10.jpg]



Re: pfctl(8) manpage minor addition

2010-09-16 Thread Jason McIntyre
On Wed, Sep 08, 2010 at 11:55:08PM -0400, Anders Langworthy wrote:
> I couldn't find clarification on this in the manpages and it seems to
> be a common misconception.  Perhaps a note like the following would be
> beneficial? (Apologies for gmail line mangling)
> 

hi. a tweaked version of your diff committed. thanks for the mail.
jmc

Index: pfctl.8
===
RCS file: /cvs/src/sbin/pfctl/pfctl.8,v
retrieving revision 1.146
diff -u -r1.146 pfctl.8
--- pfctl.8 12 Sep 2010 16:36:20 -  1.146
+++ pfctl.8 13 Sep 2010 20:07:25 -
@@ -208,6 +208,9 @@
 Flush the queue rules.
 .It Fl F Cm rules
 Flush the filter rules.
+Note that this puts the packet filter in a
+.Cm pass all
+state.
 .It Fl F Cm states
 Flush the state table (NAT and filter).
 .It Fl F Cm Sources
@@ -222,7 +225,8 @@
 Flush all of the above.
 .El
 .It Fl f Ar file
-Load the rules contained in
+Replace the current ruleset with
+the rules contained in
 .Ar file .
 This
 .Ar file



MCLGETI support for xl(4)

2010-09-16 Thread Loganaden Velvindron
Greetings,

I've cleaned the diff a bit based on feedback from sthen@ & b...@.
Here it is:

? xl.diff
Index: xl.c
===
RCS file: /cvs/src/sys/dev/ic/xl.c,v
retrieving revision 1.96
diff -u -p -r1.96 xl.c
--- xl.c7 Sep 2010 16:21:43 -   1.96
+++ xl.c16 Sep 2010 09:59:41 -
@@ -153,7 +153,6 @@ void xl_stats_update(void *);
 int xl_encap(struct xl_softc *, struct xl_chain *,
 struct mbuf * );
 void xl_rxeof(struct xl_softc *);
-int xl_rx_resync(struct xl_softc *);
 void xl_txeof(struct xl_softc *);
 void xl_txeof_90xB(struct xl_softc *);
 void xl_txeoc(struct xl_softc *);
@@ -180,6 +179,7 @@ void xl_iff(struct xl_softc *);
 void xl_iff_90x(struct xl_softc *);
 void xl_iff_905b(struct xl_softc *);
 int xl_list_rx_init(struct xl_softc *);
+void xl_fill_rx_ring(struct xl_softc *);
 int xl_list_tx_init(struct xl_softc *);
 int xl_list_tx_init_90xB(struct xl_softc *);
 void xl_wait(struct xl_softc *);
@@ -1076,8 +1076,6 @@ xl_list_rx_init(struct xl_softc *sc)
for (i = 0; i < XL_RX_LIST_CNT; i++) {
cd->xl_rx_chain[i].xl_ptr =
(struct xl_list_onefrag *)&ld->xl_rx_list[i];
-   if (xl_newbuf(sc, &cd->xl_rx_chain[i]) == ENOBUFS)
-   return(ENOBUFS);
if (i == (XL_RX_LIST_CNT - 1))
n = 0;
else
@@ -1088,11 +1086,30 @@ xl_list_rx_init(struct xl_softc *sc)
ld->xl_rx_list[i].xl_next = htole32(next);
}
 
-   cd->xl_rx_head = &cd->xl_rx_chain[0];
-
+   cd->xl_rx_prod = cd->xl_rx_cons = &cd->xl_rx_chain[0];
+   cd->xl_rx_cnt = 0;
+   xl_fill_rx_ring(sc);
return (0);
 }
 
+void
+xl_fill_rx_ring(struct xl_softc *sc)
+{  
+struct xl_chain_data*cd;
+struct xl_list_data *ld;
+
+cd = &sc->xl_cdata;
+ld = sc->xl_ldata;
+
+while (cd->xl_rx_cnt < XL_RX_LIST_CNT) {
+if (xl_newbuf(sc, cd->xl_rx_prod) == ENOBUFS)
+break;
+   cd->xl_rx_prod = cd->xl_rx_prod->xl_next;
+cd->xl_rx_cnt++;
+}
+}
+
+
 /*
  * Initialize an RX descriptor and attach an MBUF cluster.
  */
@@ -1102,13 +1119,9 @@ xl_newbuf(struct xl_softc *sc, struct xl
struct mbuf *m_new = NULL;
bus_dmamap_tmap;
 
-   MGETHDR(m_new, M_DONTWAIT, MT_DATA);
-   if (m_new == NULL)
-   return (ENOBUFS);
-
-   MCLGET(m_new, M_DONTWAIT);
-   if (!(m_new->m_flags & M_EXT)) {
-   m_freem(m_new);
+   m_new = MCLGETI(NULL, M_DONTWAIT, &sc->sc_arpcom.ac_if, MCLBYTES);
+   
+   if (!m_new){
return (ENOBUFS);
}
 
@@ -1125,11 +1138,11 @@ xl_newbuf(struct xl_softc *sc, struct xl
0, c->map->dm_mapsize, BUS_DMASYNC_POSTREAD);
bus_dmamap_unload(sc->sc_dmat, c->map);
}
-
+   
map = c->map;
c->map = sc->sc_rx_sparemap;
sc->sc_rx_sparemap = map;
-
+   
/* Force longword alignment for packet payload. */
m_adj(m_new, ETHER_ALIGN);
 
@@ -1150,32 +1163,6 @@ xl_newbuf(struct xl_softc *sc, struct xl
return (0);
 }
 
-int
-xl_rx_resync(struct xl_softc *sc)
-{
-   struct xl_chain_onefrag *pos;
-   int i;
-
-   pos = sc->xl_cdata.xl_rx_head;
-
-   for (i = 0; i < XL_RX_LIST_CNT; i++) {
-   bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap,
-   ((caddr_t)pos->xl_ptr - sc->sc_listkva),
-   sizeof(struct xl_list),
-   BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
-
-   if (pos->xl_ptr->xl_status)
-   break;
-   pos = pos->xl_next;
-   }
-
-   if (i == XL_RX_LIST_CNT)
-   return (0);
-
-   sc->xl_cdata.xl_rx_head = pos;
-
-   return (EAGAIN);
-}
 
 /*
  * A frame has been uploaded: pass the resulting mbuf chain up to
@@ -1195,12 +1182,14 @@ xl_rxeof(struct xl_softc *sc)
 
 again:
 
-   while ((rxstat = letoh32(sc->xl_cdata.xl_rx_head->xl_ptr->xl_status))
-   != 0) {
-   cur_rx = sc->xl_cdata.xl_rx_head;
-   sc->xl_cdata.xl_rx_head = cur_rx->xl_next;
+   while ((rxstat = letoh32(sc->xl_cdata.xl_rx_cons->xl_ptr->xl_status))
+   != 0 && sc->xl_cdata.xl_rx_cnt > 0) {
+   cur_rx = sc->xl_cdata.xl_rx_cons;
+m = cur_rx->xl_mbuf;  
+cur_rx->xl_mbuf = NULL;
+   sc->xl_cdata.xl_rx_cons = cur_rx->xl_next;
+   sc->xl_cdata.xl_rx_cnt--;
total_len = rxstat & XL_RXSTAT_LENMASK;
-
bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap,
((caddr_t)cur_rx->xl_ptr - sc->sc_listkva),
sizeof(struct xl_list),
@@ -1224,6 +1213,7 @@ again:
if (rxstat & XL_RXSTAT_UP_ERROR) {
ifp->if_ierrors++;

Spam

2010-09-16 Thread Chris Jepeway
Sorry for that last msg.

Chris.

Sent from one of many  mobile devices.
Please excuse everything about this message: formatting, spelling, content &
most especially, its author.