Greetings,

As of Linux kernel version 2.6.18.1 the xmit_lock member of the net_device structure is no longer directly accessible. Access to xmit_lock is now provided through a set of new functions (netif_tx_*) in netdevice.h.

At the end of this post I've attached a patch that will make PF_RING buildable against a 2.6.18 kernel. It is untested, but I reviewed it quite thoroughly. Nonetheless, I'd appreciate it if you'd take the time to review the patch and provide me with feedback. If it passes muster, I'd also like to know what the proper path is to introduce the patch into the codebase.

This problem has made me curious as to whether I should avoid running PF_RING with an up to date kernel. Is there a de facto standard kernel version for running PF_RING stably?

Thank you,

Matthew Roth
InterMedia Marketing Solutions
Software Engineer and Systems Developer

==================== Patch Begins Below This Line ====================
--- orig/PF_RING/kernel/net/ring/ring_packet.c 2006-10-27 14:28:23.000000000 -0400 +++ patch/PF_RING/kernel/net/ring/ring_packet.c 2006-10-27 16:01:31.000000000 -0400
@@ -550,25 +550,37 @@

    /* send it */
    if (pfr->reflector_dev->xmit_lock_owner != cpu) {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
      spin_lock_bh(&pfr->reflector_dev->xmit_lock);
      pfr->reflector_dev->xmit_lock_owner = cpu;
      spin_unlock_bh(&pfr->reflector_dev->xmit_lock);
+#else
+      netif_tx_lock_bh(pfr->reflector_dev);
+#endif

      if (pfr->reflector_dev->hard_start_xmit(skb,
                          pfr->reflector_dev) == 0) {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
        spin_lock_bh(&pfr->reflector_dev->xmit_lock);
    pfr->reflector_dev->xmit_lock_owner = -1;
-    skb->data += displ;
    spin_unlock_bh(&pfr->reflector_dev->xmit_lock);
+#else
+        netif_tx_unlock_bh(pfr->reflector_dev);
+#endif
+        skb->data += displ;
#if defined(RING_DEBUG)
    printk("++ hard_start_xmit succeeded\n");
#endif
    return; /* OK */
      }

+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
      spin_lock_bh(&pfr->reflector_dev->xmit_lock);
      pfr->reflector_dev->xmit_lock_owner = -1;
      spin_unlock_bh(&pfr->reflector_dev->xmit_lock);
+#else
+      netif_tx_unlock_bh(pfr->reflector_dev);
+#endif
    }

#if defined(RING_DEBUG)


_______________________________________________
Ntop-misc mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-misc

Reply via email to