[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: RTL 8111G
From:       David Marec <david.marec () davenulle ! org>
Date:       2016-11-23 12:54:13
Message-ID: 20161123125412.GA92220 () madTurtle ! lapinbilly ! eu
[Download RAW message or body]

On Tue, Nov 22, 2016 at 11:29:22PM +0100, BERTRAND Joël wrote:
> 
> 	I don't understand your last sentences. What is the failure on 
> 'M_DONTWAIT' ?
> 

Reading your first post, I was thinking about patching the realteak driver, as the \
flag 'M_DONTWAIT' is no more used when allocating mbufs.

Starting from the last driver I found on the realteack website (1.92), here is a \
patch that make it build against FreeBSD 11-Release:



--- if_re.c.orig	2016-11-23 13:36:22.034612000 +0100
+++ if_re.c	2016-11-23 13:38:15.458230000 +0100
@@ -61,6 +61,7 @@
 #include <net/ethernet.h>
 #include <net/if_dl.h>
 #include <net/if_media.h>
+#include <net/if_var.h>
 
 #include <net/bpf.h>
 
@@ -720,7 +721,7 @@
         else
                 size =MJUM9BYTES;
         for (i = 0; i < RE_RX_BUF_NUM; i++) {
-                sc->re_desc.rx_buf[i] = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, \
size); +                sc->re_desc.rx_buf[i] = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, \
size);  if (!sc->re_desc.rx_buf[i]) {
                         //device_printf(dev, "m_getcl fail!!!\n");
                         error = ENXIO;
@@ -5432,7 +5433,7 @@
 {
         struct mbuf		*m_new = NULL;
 
-        m_new = m_defrag(m_head, M_DONTWAIT);
+        m_new = m_defrag(m_head, M_NOWAIT);
 
         if (m_new == NULL) {
                 printf("re%d: no memory for tx list", sc->re_unit);
@@ -5576,7 +5577,7 @@
 
                 sc->re_desc.tx_last_index = \
(sc->re_desc.tx_last_index+1)%RE_TX_BUF_NUM;  \
                txptr=&sc->re_desc.tx_desc[sc->re_desc.tx_last_index];
-                ifp->if_opackets++;
+                if_inc_counter(ifp,IFCOUNTER_OPACKETS,1);
                 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
         }
 
@@ -5654,7 +5655,7 @@
                 else
                         size = MJUM9BYTES;
 
-                buf = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, size);
+                buf = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, size);
                 if (buf==NULL) {
                         bError=1;
                         goto update_desc;
@@ -5719,7 +5720,7 @@
                 }
 
                 eh = mtod(m, struct ether_header *);
-                ifp->if_ipackets++;
+                if_inc_counter(ifp,IFCOUNTER_IPACKETS,1);
 #ifdef _DEBUG_
                 printf("Rcv Packet, Len=%d \n", m->m_len);
 #endif
@@ -5794,7 +5795,7 @@
 #if OS_VER < VERSION(7,0)
         re_int_task(arg, 0);
 #else
-        taskqueue_enqueue_fast(taskqueue_fast, &sc->re_inttask);
+        taskqueue_enqueue(taskqueue_fast, &sc->re_inttask);
 
         return (FILTER_HANDLED);
 #endif
@@ -5874,7 +5875,7 @@
 
 #if OS_VER>=VERSION(7,0)
         if (CSR_READ_2(sc, RE_ISR) & RE_INTRS) {
-                taskqueue_enqueue_fast(taskqueue_fast, &sc->re_inttask);
+                taskqueue_enqueue(taskqueue_fast, &sc->re_inttask);
                 return;
         }
 #endif




I made few tests on the first machine that embedds this NIC and it seems to be \
working.


-- 
David Marec

_______________________________________________
freebsd-hackers@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic