IgH EtherCAT Master  1.6.2
ethernet.c File Reference

Ethernet over EtherCAT (EoE). More...

Go to the source code of this file.

Macros

#define SUSE_VERSION   0
 
#define SUSE_PATCHLEVEL   0
 
#define EOE_DEBUG_LEVEL   1
 Defines the debug level of EoE processing. More...
 
#define EC_EOE_TX_QUEUE_SIZE   100
 Size of the EoE tx queue.
 
#define EC_EOE_TRIES   100
 Number of tries.
 

Functions

void ec_eoe_flush (ec_eoe_t *eoe)
 Empties the transmit queue. More...
 
int ec_eoe_send (ec_eoe_t *eoe)
 Sends a frame or the next fragment. More...
 
void ec_eoe_state_rx_start (ec_eoe_t *eoe)
 State: RX_START. More...
 
void ec_eoe_state_rx_check (ec_eoe_t *eoe)
 State: RX_CHECK. More...
 
void ec_eoe_state_rx_fetch (ec_eoe_t *eoe)
 State: RX_FETCH. More...
 
void ec_eoe_state_tx_start (ec_eoe_t *eoe)
 State: TX START. More...
 
void ec_eoe_state_tx_sent (ec_eoe_t *eoe)
 State: TX SENT. More...
 
int ec_eoedev_open (struct net_device *dev)
 Opens the virtual network device. More...
 
int ec_eoedev_stop (struct net_device *dev)
 Stops the virtual network device. More...
 
int ec_eoedev_tx (struct sk_buff *skb, struct net_device *dev)
 Transmits data via the virtual network device. More...
 
struct net_device_stats * ec_eoedev_stats (struct net_device *dev)
 Gets statistics about the virtual network device. More...
 
int ec_eoe_init (ec_eoe_t *eoe, ec_slave_t *slave)
 EoE constructor. More...
 
void ec_eoe_clear (ec_eoe_t *eoe)
 EoE destructor. More...
 
void ec_eoe_run (ec_eoe_t *eoe)
 Runs the EoE state machine. More...
 
void ec_eoe_queue (ec_eoe_t *eoe)
 Queues the datagram, if necessary. More...
 
int ec_eoe_is_open (const ec_eoe_t *eoe)
 Returns the state of the device. More...
 
int ec_eoe_is_idle (const ec_eoe_t *eoe)
 Returns the idle state. More...
 

Variables

static const struct net_device_ops ec_eoedev_ops
 Device operations for EoE interfaces. More...
 

Detailed Description

Ethernet over EtherCAT (EoE).

Definition in file ethernet.c.

Macro Definition Documentation

◆ EOE_DEBUG_LEVEL

#define EOE_DEBUG_LEVEL   1

Defines the debug level of EoE processing.

0 = No debug messages. 1 = Output warnings. 2 = Output actions. 3 = Output actions and frame data.

Definition at line 61 of file ethernet.c.

Function Documentation

◆ ec_eoe_flush()

void ec_eoe_flush ( ec_eoe_t eoe)

Empties the transmit queue.

Parameters
eoeEoE handler

Definition at line 247 of file ethernet.c.

◆ ec_eoe_send()

int ec_eoe_send ( ec_eoe_t eoe)

Sends a frame or the next fragment.

Returns
Zero on success, otherwise a negative error code.
Parameters
eoeEoE handler

Definition at line 272 of file ethernet.c.

◆ ec_eoe_state_rx_start()

void ec_eoe_state_rx_start ( ec_eoe_t eoe)

State: RX_START.

Starts a new receiving sequence by queueing a datagram that checks the slave's mailbox for a new EoE datagram.

Todo:
Use both devices.
Parameters
eoeEoE handler

Definition at line 413 of file ethernet.c.

◆ ec_eoe_state_rx_check()

void ec_eoe_state_rx_check ( ec_eoe_t eoe)

State: RX_CHECK.

Processes the checking datagram sent in RX_START and issues a receive datagram, if new data is available.

Parameters
eoeEoE handler

Definition at line 434 of file ethernet.c.

◆ ec_eoe_state_rx_fetch()

void ec_eoe_state_rx_fetch ( ec_eoe_t eoe)

State: RX_FETCH.

Checks if the requested data of RX_CHECK was received and processes the EoE datagram.

Parameters
eoeEoE handler

Definition at line 465 of file ethernet.c.

◆ ec_eoe_state_tx_start()

void ec_eoe_state_tx_start ( ec_eoe_t eoe)

State: TX START.

Starts a new transmit sequence. If no data is available, a new receive sequence is started instead.

Todo:
Use both devices.
Parameters
eoeEoE handler

Definition at line 642 of file ethernet.c.

◆ ec_eoe_state_tx_sent()

void ec_eoe_state_tx_sent ( ec_eoe_t eoe)

State: TX SENT.

Checks is the previous transmit datagram succeded and sends the next fragment, if necessary.

Parameters
eoeEoE handler

Definition at line 717 of file ethernet.c.

◆ ec_eoedev_open()

int ec_eoedev_open ( struct net_device *  dev)

Opens the virtual network device.

Returns
Always zero (success).
Parameters
devEoE net_device

Definition at line 783 of file ethernet.c.

◆ ec_eoedev_stop()

int ec_eoedev_stop ( struct net_device *  dev)

Stops the virtual network device.

Returns
Always zero (success).
Parameters
devEoE net_device

Definition at line 805 of file ethernet.c.

◆ ec_eoedev_tx()

int ec_eoedev_tx ( struct sk_buff *  skb,
struct net_device *  dev 
)

Transmits data via the virtual network device.

Returns
Zero on success, non-zero on failure.
Parameters
skbtransmit socket buffer
devEoE net_device

Definition at line 827 of file ethernet.c.

◆ ec_eoedev_stats()

struct net_device_stats * ec_eoedev_stats ( struct net_device *  dev)

Gets statistics about the virtual network device.

Returns
Statistics.
Parameters
devEoE net_device

Definition at line 880 of file ethernet.c.

◆ ec_eoe_init()

int ec_eoe_init ( ec_eoe_t eoe,
ec_slave_t slave 
)

EoE constructor.

Initializes the EoE handler, creates a net_device and registers it.

Returns
Zero on success, otherwise a negative error code.
Parameters
eoeEoE handler
slaveEtherCAT slave

Definition at line 111 of file ethernet.c.

◆ ec_eoe_clear()

void ec_eoe_clear ( ec_eoe_t eoe)

EoE destructor.

Unregisteres the net_device and frees allocated memory.

Parameters
eoeEoE handler

Definition at line 223 of file ethernet.c.

◆ ec_eoe_run()

void ec_eoe_run ( ec_eoe_t eoe)

Runs the EoE state machine.

Parameters
eoeEoE handler

Definition at line 343 of file ethernet.c.

◆ ec_eoe_queue()

void ec_eoe_queue ( ec_eoe_t eoe)

Queues the datagram, if necessary.

Parameters
eoeEoE handler

Definition at line 371 of file ethernet.c.

◆ ec_eoe_is_open()

int ec_eoe_is_open ( const ec_eoe_t eoe)

Returns the state of the device.

Returns
1 if the device is "up", 0 if it is "down"
Parameters
eoeEoE handler

Definition at line 385 of file ethernet.c.

◆ ec_eoe_is_idle()

int ec_eoe_is_idle ( const ec_eoe_t eoe)

Returns the idle state.

Return values
1The device is idle.
0The device is busy.
Parameters
eoeEoE handler

Definition at line 397 of file ethernet.c.

Variable Documentation

◆ ec_eoedev_ops

const struct net_device_ops ec_eoedev_ops
static
Initial value:
= {
.ndo_open = ec_eoedev_open,
.ndo_stop = ec_eoedev_stop,
.ndo_start_xmit = ec_eoedev_tx,
.ndo_get_stats = ec_eoedev_stats,
}
int ec_eoedev_tx(struct sk_buff *, struct net_device *)
Transmits data via the virtual network device.
Definition: ethernet.c:827
int ec_eoedev_open(struct net_device *)
Opens the virtual network device.
Definition: ethernet.c:783
int ec_eoedev_stop(struct net_device *)
Stops the virtual network device.
Definition: ethernet.c:805
struct net_device_stats * ec_eoedev_stats(struct net_device *)
Gets statistics about the virtual network device.
Definition: ethernet.c:880

Device operations for EoE interfaces.

Definition at line 96 of file ethernet.c.