Add fillmeup support for the realtek driver
authorKevin Klues <klueska@ros-dev.(none)>
Tue, 27 Apr 2010 05:08:32 +0000 (22:08 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:45 +0000 (17:35 -0700)
kern/arch/i686/rl8168.c

index 29ece81..d24506c 100644 (file)
@@ -512,6 +512,29 @@ void rl8168_handle_rx_packet() {
                
        } while (!(current_command & DES_LS_MASK));
 
+#ifdef __CONFIG_OSDI__
+       struct packetizer_packet *p = (struct packetizer_packet*)rx_buffer;
+       if(ntohs(p->ethertype) == PACKETIZER_ETH_TYPE) {
+               assert(fillmeup_data.proc != NULL);
+               assert(fillmeup_data.bufs != NULL);
+               struct proc *proc = fillmeup_data.proc;
+
+               int16_t lw;
+               memcpy_from_user(proc, &lw, fillmeup_data.last_written, sizeof(lw));
+               lw = (lw + 1) % (fillmeup_data.num_bufs);
+               memcpy_to_user(proc, fillmeup_data.last_written, &lw, sizeof(lw));
+               memcpy_to_user(proc, &fillmeup_data.bufs[PACKETIZER_MAX_PAYLOAD * lw], 
+                              p->payload, ntohl(p->payload_size));
+               //print_packetizer_packet(p);
+               proc_notify(fillmeup_data.proc, NE_ETC_ETC_ETC, 0);
+
+               rx_des_cur = rx_des_loop_cur;
+               kfree(rx_buffer);
+               return;
+       }
+#endif
+
+#ifdef __CONFIG_APPSERVER__
        // Treat as a syscall frontend response packet if eth_type says so
        // Will eventually go away, so not too worried about elegance here...
        #include <frontend.h>
@@ -524,6 +547,7 @@ void rl8168_handle_rx_packet() {
                kfree(rx_buffer);
                return;
        }
+#endif
 
        spin_lock(&packet_buffers_lock);