Module: xenomai-gch
Branch: for-forge
Commit: 0a43badd83ba96cefbfa085e9efdb5ed24796dc3
URL:    
http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=0a43badd83ba96cefbfa085e9efdb5ed24796dc3

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Sat Nov 15 23:30:59 2014 +0100

rtnet: add more netdev compatibility functions

Needed for newer versions of drivers

---

 kernel/drivers/net/stack/include/rtdev.h  |   34 ++++++++++++++++++++++++++++-
 kernel/drivers/net/stack/include/rtskb.h  |   12 ++++++++++
 kernel/drivers/net/stack/include/rtwlan.h |    8 -------
 3 files changed, 45 insertions(+), 9 deletions(-)

diff --git a/kernel/drivers/net/stack/include/rtdev.h 
b/kernel/drivers/net/stack/include/rtdev.h
index e0b0669..5af153f 100644
--- a/kernel/drivers/net/stack/include/rtdev.h
+++ b/kernel/drivers/net/stack/include/rtdev.h
@@ -46,6 +46,8 @@
 #define NETIF_F_LLTX                    4096
 #endif
 
+#define RTDEV_TX_OK            0
+#define RTDEV_TX_BUSY  1
 
 enum rtnet_link_state {
        __RTNET_LINK_STATE_XOFF = 0,
@@ -156,7 +158,6 @@ struct rtnet_device {
                                       struct rtskb *skb);
 };
 
-
 struct rtnet_core_cmd;
 
 struct rtdev_event_hook {
@@ -229,6 +230,37 @@ void rtdev_unmap_rtskb(struct rtskb *skb);
 
 struct rtskb *rtnetdev_alloc_rtskb(struct rtnet_device *dev, unsigned int 
size);
 
+#define rtnetdev_priv(dev) ((dev)->priv)
+
+#define rtdev_emerg(__dev, format, args...) \
+       pr_emerg("%s: " format, (__dev)->name, ##args)
+#define rtdev_alert(__dev, format, args...) \
+       pr_alert("%s: " format, (__dev)->name, ##args)
+#define rtdev_crit(__dev, format, args...) \
+       pr_crit("%s: " format, (__dev)->name, ##args)
+#define rtdev_err(__dev, format, args...) \
+       pr_err("%s: " format, (__dev)->name, ##args)
+#define rtdev_warn(__dev, format, args...) \
+       pr_warn("%s: " format, (__dev)->name, ##args)
+#define rtdev_notice(__dev, format, args...) \
+       pr_notice("%s: " format, (__dev)->name, ##args)
+#define rtdev_info(__dev, format, args...) \
+       pr_info("%s: " format, (__dev)->name, ##args)
+#define rtdev_dbg(__dev, format, args...) \
+       pr_debug("%s: " format, (__dev)->name, ##args)
+
+#ifdef VERBOSE_DEBUG
+#define rtdev_vdbg rtdev_dbg
+#else
+#define rtdev_vdbg(__dev, format, args...)                     \
+({                                                             \
+       if (0)                                                  \
+               pr_debug("%s: " format, (__dev)->name, ##args); \
+                                                               \
+       0;                                                      \
+})
+#endif
+
 #endif  /* __KERNEL__ */
 
 #endif  /* __RTDEV_H_ */
diff --git a/kernel/drivers/net/stack/include/rtskb.h 
b/kernel/drivers/net/stack/include/rtskb.h
index fa385ef..a6ef860 100644
--- a/kernel/drivers/net/stack/include/rtskb.h
+++ b/kernel/drivers/net/stack/include/rtskb.h
@@ -295,6 +295,18 @@ extern void kfree_rtskb(struct rtskb *skb);
 #define dev_kfree_rtskb(a)  kfree_rtskb(a)
 
 
+#define rtskb_checksum_none_assert(skb) (skb->ip_summed = CHECKSUM_NONE)
+
+static inline void rtskb_tx_timestamp(struct rtskb *skb)
+{
+       nanosecs_abs_t *ts = skb->xmit_stamp;
+
+       if (!ts)
+               return;
+
+       *ts = cpu_to_be64(rtdm_clock_read() + *ts);
+}
+
 /***
  *  rtskb_queue_init - initialize the queue
  *  @queue
diff --git a/kernel/drivers/net/stack/include/rtwlan.h 
b/kernel/drivers/net/stack/include/rtwlan.h
index c59315a..47d816f 100644
--- a/kernel/drivers/net/stack/include/rtwlan.h
+++ b/kernel/drivers/net/stack/include/rtwlan.h
@@ -129,14 +129,6 @@
 #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
 #define MAC_ARG(x) 
((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
 
-/*
- * pointer to private data.
- */
-static inline void * rtnetdev_priv(struct rtnet_device *rtnet_dev)
-{
-    return (char *)rtnet_dev + ((sizeof(struct rtnet_device) + 31) & ~31);
-}
-
 #ifdef CONFIG_RTWLAN_DEBUG
 #define RTWLAN_DEBUG_PRINTK(__message...)      do{ rtdm_printk(__message); 
}while(0)
 #define RTWLAN_DEBUG(__message,__args...)      RTWLAN_DEBUG_PRINTK(KERN_DEBUG  
"rtwlan->%s: Debug - " __message,__FUNCTION__,##__args);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to