78 * @sent: is set to 1 by the CCAT when data was transmitted |
79 * @sent: is set to 1 by the CCAT when data was transmitted |
79 * @timestamp: a 64 bit EtherCAT timestamp |
80 * @timestamp: a 64 bit EtherCAT timestamp |
80 * @data: the bytes of the ethernet frame |
81 * @data: the bytes of the ethernet frame |
81 */ |
82 */ |
82 struct ccat_eth_frame { |
83 struct ccat_eth_frame { |
83 uint32_t reserved1; |
84 u32 reserved1; |
84 uint32_t received:1; |
85 u32 received:1; |
85 uint32_t reserved2:31; |
86 u32 reserved2:31; |
86 uint16_t length; |
87 u16 length; |
87 uint16_t reserved3; |
88 u16 reserved3; |
88 uint32_t sent:1; |
89 u32 sent:1; |
89 uint32_t reserved4:31; |
90 u32 reserved4:31; |
90 uint64_t timestamp; |
91 u64 timestamp; |
91 uint8_t data[0x800 - 3 * sizeof(uint64_t)]; |
92 u8 data[0x800 - 3 * sizeof(u64)]; |
92 }; |
93 }; |
93 |
94 |
94 /** |
95 /** |
95 * struct ccat_eth_register - CCAT register addresses in the PCI BAR |
96 * struct ccat_eth_register - CCAT register addresses in the PCI BAR |
96 * @mii: address of the CCAT management interface register |
97 * @mii: address of the CCAT management interface register |
146 |
147 |
147 /** |
148 /** |
148 * struct ccat_eth_priv - CCAT Ethernet/EtherCAT Master function (netdev) |
149 * struct ccat_eth_priv - CCAT Ethernet/EtherCAT Master function (netdev) |
149 * @ccatdev: pointer to the parent struct ccat_device |
150 * @ccatdev: pointer to the parent struct ccat_device |
150 * @netdev: the net_device structure used by the kernel networking stack |
151 * @netdev: the net_device structure used by the kernel networking stack |
151 * @poll_thread: is used to poll status registers like link state |
|
152 * @rx_thread: thread which does housekeeping of RX DMA descriptors |
|
153 * @tx_thread: thread which does housekeeping of TX DMA descriptors |
|
154 * @next_tx_frame: pointer to the next TX DMA descriptor, which the tx_thread should check for availablity |
152 * @next_tx_frame: pointer to the next TX DMA descriptor, which the tx_thread should check for availablity |
155 * @info: holds a copy of the CCAT Ethernet/EtherCAT Master function information block (read from PCI config space) |
153 * @info: holds a copy of the CCAT Ethernet/EtherCAT Master function information block (read from PCI config space) |
156 * @reg: register addresses in PCI config space of the Ethernet/EtherCAT Master function |
154 * @reg: register addresses in PCI config space of the Ethernet/EtherCAT Master function |
157 * @rx_fifo: DMA fifo used for RX DMA descriptors |
155 * @rx_fifo: DMA fifo used for RX DMA descriptors |
158 * @tx_fifo: DMA fifo used for TX DMA descriptors |
156 * @tx_fifo: DMA fifo used for TX DMA descriptors |
|
157 * @poll_timer: interval timer used to poll CCAT for events like link changed, rx done, tx done |
159 * @rx_bytes: number of bytes received -> reported with ndo_get_stats64() |
158 * @rx_bytes: number of bytes received -> reported with ndo_get_stats64() |
160 * @rx_dropped: number of received frames, which were dropped -> reported with ndo_get_stats64() |
159 * @rx_dropped: number of received frames, which were dropped -> reported with ndo_get_stats64() |
161 * @tx_bytes: number of bytes send -> reported with ndo_get_stats64() |
160 * @tx_bytes: number of bytes send -> reported with ndo_get_stats64() |
162 * @tx_dropped: number of frames requested to send, which were dropped -> reported with ndo_get_stats64() |
161 * @tx_dropped: number of frames requested to send, which were dropped -> reported with ndo_get_stats64() |
163 */ |
162 */ |
164 struct ccat_eth_priv { |
163 struct ccat_eth_priv { |
165 const struct ccat_device *ccatdev; |
164 const struct ccat_device *ccatdev; |
166 struct net_device *netdev; |
165 struct net_device *netdev; |
167 struct task_struct *poll_thread; |
166 const struct ccat_eth_frame *next_tx_frame; |
168 struct task_struct *rx_thread; |
|
169 struct task_struct *tx_thread; |
|
170 const struct ccat_eth_frame *next_tx_frame; /* next frame the tx_thread should check for availability */ |
|
171 CCatInfoBlock info; |
167 CCatInfoBlock info; |
172 struct ccat_eth_register reg; |
168 struct ccat_eth_register reg; |
173 struct ccat_eth_dma_fifo rx_fifo; |
169 struct ccat_eth_dma_fifo rx_fifo; |
174 struct ccat_eth_dma_fifo tx_fifo; |
170 struct ccat_eth_dma_fifo tx_fifo; |
|
171 struct hrtimer poll_timer; |
175 atomic64_t rx_bytes; |
172 atomic64_t rx_bytes; |
176 atomic64_t rx_dropped; |
173 atomic64_t rx_dropped; |
177 atomic64_t tx_bytes; |
174 atomic64_t tx_bytes; |
178 atomic64_t tx_dropped; |
175 atomic64_t tx_dropped; |
179 ec_device_t *ecdev; |
176 ec_device_t *ecdev; |
180 void (*carrier_off) (struct net_device * const netdev); |
177 void (*carrier_off) (struct net_device * const netdev); |
|
178 bool (*carrier_ok) (struct net_device *const netdev); |
181 void (*carrier_on) (struct net_device * const netdev); |
179 void (*carrier_on) (struct net_device * const netdev); |
182 void (*kfree_skb_any) (struct sk_buff * skb); |
180 void (*kfree_skb_any) (struct sk_buff * skb); |
183 void (*start_queue) (struct net_device * const netdev); |
181 void (*start_queue) (struct net_device * const netdev); |
184 void (*stop_queue) (struct net_device * const netdev); |
182 void (*stop_queue) (struct net_device * const netdev); |
185 void (*tx_fifo_full) (struct net_device * const dev, |
183 void (*tx_fifo_full) (struct ccat_eth_priv * const priv, |
186 const struct ccat_eth_frame * const frame); |
184 const struct ccat_eth_frame * const frame); |
187 void (*unregister) (struct net_device * const netdev); |
185 void (*unregister) (struct net_device * const netdev); |
188 }; |
186 }; |
189 |
187 |
190 /** |
188 /** |