--- a/devices/ccat/module.h Tue May 06 17:32:10 2014 +0200
+++ b/devices/ccat/module.h Thu Jun 05 16:07:52 2014 +0200
@@ -22,6 +22,7 @@
#define _CCAT_H_
#include <linux/cdev.h>
+#include <linux/hrtimer.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include "CCatDefinitions.h"
@@ -80,15 +81,15 @@
* @data: the bytes of the ethernet frame
*/
struct ccat_eth_frame {
- uint32_t reserved1;
- uint32_t received:1;
- uint32_t reserved2:31;
- uint16_t length;
- uint16_t reserved3;
- uint32_t sent:1;
- uint32_t reserved4:31;
- uint64_t timestamp;
- uint8_t data[0x800 - 3 * sizeof(uint64_t)];
+ u32 reserved1;
+ u32 received:1;
+ u32 reserved2:31;
+ u16 length;
+ u16 reserved3;
+ u32 sent:1;
+ u32 reserved4:31;
+ u64 timestamp;
+ u8 data[0x800 - 3 * sizeof(u64)];
};
/**
@@ -148,14 +149,12 @@
* struct ccat_eth_priv - CCAT Ethernet/EtherCAT Master function (netdev)
* @ccatdev: pointer to the parent struct ccat_device
* @netdev: the net_device structure used by the kernel networking stack
- * @poll_thread: is used to poll status registers like link state
- * @rx_thread: thread which does housekeeping of RX DMA descriptors
- * @tx_thread: thread which does housekeeping of TX DMA descriptors
* @next_tx_frame: pointer to the next TX DMA descriptor, which the tx_thread should check for availablity
* @info: holds a copy of the CCAT Ethernet/EtherCAT Master function information block (read from PCI config space)
* @reg: register addresses in PCI config space of the Ethernet/EtherCAT Master function
* @rx_fifo: DMA fifo used for RX DMA descriptors
* @tx_fifo: DMA fifo used for TX DMA descriptors
+ * @poll_timer: interval timer used to poll CCAT for events like link changed, rx done, tx done
* @rx_bytes: number of bytes received -> reported with ndo_get_stats64()
* @rx_dropped: number of received frames, which were dropped -> reported with ndo_get_stats64()
* @tx_bytes: number of bytes send -> reported with ndo_get_stats64()
@@ -164,25 +163,24 @@
struct ccat_eth_priv {
const struct ccat_device *ccatdev;
struct net_device *netdev;
- struct task_struct *poll_thread;
- struct task_struct *rx_thread;
- struct task_struct *tx_thread;
- const struct ccat_eth_frame *next_tx_frame; /* next frame the tx_thread should check for availability */
+ const struct ccat_eth_frame *next_tx_frame;
CCatInfoBlock info;
struct ccat_eth_register reg;
struct ccat_eth_dma_fifo rx_fifo;
struct ccat_eth_dma_fifo tx_fifo;
+ struct hrtimer poll_timer;
atomic64_t rx_bytes;
atomic64_t rx_dropped;
atomic64_t tx_bytes;
atomic64_t tx_dropped;
ec_device_t *ecdev;
void (*carrier_off) (struct net_device * const netdev);
+ bool (*carrier_ok) (struct net_device *const netdev);
void (*carrier_on) (struct net_device * const netdev);
void (*kfree_skb_any) (struct sk_buff * skb);
void (*start_queue) (struct net_device * const netdev);
void (*stop_queue) (struct net_device * const netdev);
- void (*tx_fifo_full) (struct net_device * const dev,
+ void (*tx_fifo_full) (struct ccat_eth_priv * const priv,
const struct ccat_eth_frame * const frame);
void (*unregister) (struct net_device * const netdev);
};