devices/ccat/module.h
branchstable-1.5
changeset 2576 f6a5b3bb0594
parent 2573 ad9a35065387
child 2578 d707b650fa52
equal deleted inserted replaced
2575:bf5a90b3dd05 2576:f6a5b3bb0594
    89  * @sent: is set to 1 by the CCAT when data was transmitted
    89  * @sent: is set to 1 by the CCAT when data was transmitted
    90  * @timestamp: a 64 bit EtherCAT timestamp
    90  * @timestamp: a 64 bit EtherCAT timestamp
    91  * @data: the bytes of the ethernet frame
    91  * @data: the bytes of the ethernet frame
    92  */
    92  */
    93 struct ccat_eth_frame {
    93 struct ccat_eth_frame {
    94 	u32 reserved1;
    94 	__le32 reserved1;
    95 	u32 received:1;
    95 	__le32 rx_flags;
    96 	u32 reserved2:31;
    96 #define CCAT_FRAME_RECEIVED 0x1
    97 	u16 length;
    97 	__le16 length;
    98 	u16 reserved3;
    98 	__le16 reserved3;
    99 	u32 sent:1;
    99 	__le32 tx_flags;
   100 	u32 reserved4:31;
   100 #define CCAT_FRAME_SENT 0x1
   101 	u64 timestamp;
   101 	__le64 timestamp;
   102 	u8 data[0x800 - 3 * sizeof(u64)];
   102 	u8 data[0x800 - 3 * sizeof(u64)];
   103 #define CCAT_ETH_FRAME_HEAD_LEN offsetof(struct ccat_eth_frame, data)
   103 #define CCAT_ETH_FRAME_HEAD_LEN offsetof(struct ccat_eth_frame, data)
   104 };
   104 };
   105 
   105 
   106 /**
   106 /**
   128  * @add: callback used to add a frame to this fifo
   128  * @add: callback used to add a frame to this fifo
   129  * @reg: PCI register address of this DMA fifo
   129  * @reg: PCI register address of this DMA fifo
   130  * @dma: information about the associated DMA memory
   130  * @dma: information about the associated DMA memory
   131  */
   131  */
   132 struct ccat_eth_dma_fifo {
   132 struct ccat_eth_dma_fifo {
   133 	void (*add) (struct ccat_eth_frame *, struct ccat_eth_dma_fifo *);
   133 	void (*add) (struct ccat_eth_dma_fifo *, struct ccat_eth_frame *);
   134 	void __iomem *reg;
   134 	void __iomem *reg;
       
   135 	const struct ccat_eth_frame *end;
       
   136 	struct ccat_eth_frame *next;
   135 	struct ccat_dma dma;
   137 	struct ccat_dma dma;
   136 };
   138 };
   137 
   139 
   138 /**
   140 /**
   139  * struct ccat_device - CCAT device representation
   141  * struct ccat_device - CCAT device representation
   172 
   174 
   173 /**
   175 /**
   174  * struct ccat_eth_priv - CCAT Ethernet/EtherCAT Master function (netdev)
   176  * struct ccat_eth_priv - CCAT Ethernet/EtherCAT Master function (netdev)
   175  * @ccatdev: pointer to the parent struct ccat_device
   177  * @ccatdev: pointer to the parent struct ccat_device
   176  * @netdev: the net_device structure used by the kernel networking stack
   178  * @netdev: the net_device structure used by the kernel networking stack
   177  * @next_tx_frame: pointer to the next TX DMA descriptor, which the tx_thread should check for availablity
       
   178  * @info: holds a copy of the CCAT Ethernet/EtherCAT Master function information block (read from PCI config space)
   179  * @info: holds a copy of the CCAT Ethernet/EtherCAT Master function information block (read from PCI config space)
   179  * @reg: register addresses in PCI config space of the Ethernet/EtherCAT Master function
   180  * @reg: register addresses in PCI config space of the Ethernet/EtherCAT Master function
   180  * @rx_fifo: DMA fifo used for RX DMA descriptors
   181  * @rx_fifo: DMA fifo used for RX DMA descriptors
   181  * @tx_fifo: DMA fifo used for TX DMA descriptors
   182  * @tx_fifo: DMA fifo used for TX DMA descriptors
   182  * @poll_timer: interval timer used to poll CCAT for events like link changed, rx done, tx done
   183  * @poll_timer: interval timer used to poll CCAT for events like link changed, rx done, tx done
   186  * @tx_dropped: number of frames requested to send, which were dropped -> reported with ndo_get_stats64()
   187  * @tx_dropped: number of frames requested to send, which were dropped -> reported with ndo_get_stats64()
   187  */
   188  */
   188 struct ccat_eth_priv {
   189 struct ccat_eth_priv {
   189 	const struct ccat_device *ccatdev;
   190 	const struct ccat_device *ccatdev;
   190 	struct net_device *netdev;
   191 	struct net_device *netdev;
   191 	const struct ccat_eth_frame *next_tx_frame;
       
   192 	struct ccat_info_block info;
   192 	struct ccat_info_block info;
   193 	struct ccat_eth_register reg;
   193 	struct ccat_eth_register reg;
   194 	struct ccat_eth_dma_fifo rx_fifo;
   194 	struct ccat_eth_dma_fifo rx_fifo;
   195 	struct ccat_eth_dma_fifo tx_fifo;
   195 	struct ccat_eth_dma_fifo tx_fifo;
   196 	struct hrtimer poll_timer;
   196 	struct hrtimer poll_timer;
   203 	bool (*carrier_ok) (const struct net_device * netdev);
   203 	bool (*carrier_ok) (const struct net_device * netdev);
   204 	void (*carrier_on) (struct net_device * netdev);
   204 	void (*carrier_on) (struct net_device * netdev);
   205 	void (*kfree_skb_any) (struct sk_buff * skb);
   205 	void (*kfree_skb_any) (struct sk_buff * skb);
   206 	void (*start_queue) (struct net_device * netdev);
   206 	void (*start_queue) (struct net_device * netdev);
   207 	void (*stop_queue) (struct net_device * netdev);
   207 	void (*stop_queue) (struct net_device * netdev);
   208 	void (*tx_fifo_full) (struct ccat_eth_priv * priv,
       
   209 			      const struct ccat_eth_frame * frame);
       
   210 	void (*unregister) (struct net_device * netdev);
   208 	void (*unregister) (struct net_device * netdev);
   211 };
   209 };
   212 
   210 
   213 /**
   211 /**
   214  * same as: typedef struct _CCatInfoBlockOffs from CCatDefinitions.h
   212  * same as: typedef struct _CCatInfoBlockOffs from CCatDefinitions.h