view e1000_implement_the_frame_transmission_chunk.patch @ 83:27f0e70df342

Wip on the transmission, tx init done, and tx hooked from Ethernet send
author Louis Opter <louis@lse.epitech.net>
date Sun, 08 Jul 2012 10:00:25 +0200
parents
children 6432998a8245
line wrap: on
line source

# HG changeset patch
# Parent 1a5a83776de5ecff15e42930c7741f5b4f2ada13
rathaxes: start to queue up packets in the TX ring on the e1000 sample

diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt
--- a/rathaxes/samples/e1000/e1000.blt
+++ b/rathaxes/samples/e1000/e1000.blt
@@ -597,7 +597,7 @@
 
         chunk   ::CALL()
         {
-            // this is an hack for the scope
+            // See #10
             (void)1;
             {
                 int error;
@@ -970,4 +970,31 @@
             }
         }
     }
+
+    template sequence   e1000::xmit(Ethernet::Device ctx, Socket::SKBuff skb)
+    {
+        chunk   ::CALL()
+        {
+            /*
+             * Put packets on the TX ring, must return NETDEV_TX_OK or
+             * NETDEV_TX_BUSY.
+             */
+            (void)1; // See #10
+            {
+                ${Log::info("xmit: skbuff details:")};
+            }
+            pr_info(
+                    "\t     len = %-5u data_len = %-5u head_len = %-5u\n"
+                    "\tnr_frags = %u\n"
+                    "\tgso_size = %-5u gso_segs = %-5u gso_type = %-5u\n",
+                    ${skb}->len,
+                    ${skb}->data_len,
+                    skb_headlen(${skb}),
+                    skb_shinfo(${skb})->nr_frags,
+                    skb_shinfo(${skb})->gso_size,
+                    skb_shinfo(${skb})->gso_segs,
+                    skb_shinfo(${skb})->gso_type
+            );
+        }
+    }
 }
diff --git a/rathaxes/samples/e1000/e1000.rti b/rathaxes/samples/e1000/e1000.rti
--- a/rathaxes/samples/e1000/e1000.rti
+++ b/rathaxes/samples/e1000/e1000.rti
@@ -70,6 +70,11 @@
         provided chunk  ::CALL();
     }
 
+    provided sequence   e1000::xmit(Ethernet::Device, Socket::SKBuff)
+    {
+        provided chunk  ::CALL();
+    }
+
     provided sequence   e1000::register_read32(e1000::Context, e1000::Register)
     {
         provided chunk  LKM::prototypes();
diff --git a/rathaxes/samples/e1000/lkm.rtx b/rathaxes/samples/e1000/lkm.rtx
--- a/rathaxes/samples/e1000/lkm.rtx
+++ b/rathaxes/samples/e1000/lkm.rtx
@@ -46,6 +46,7 @@
     Ethernet::send(Ethernet::Device dev, Socket::SKBuff skb)
     {
         Log::info("we have one packet to transmit!");
+        e1000::xmit(dev, skb);
     }
 
     LKM::init()