changeset 719 | 03d5b96632fb |
parent 712 | 14f899ac51f0 |
child 721 | ebc2fd3e09e5 |
718:80df6930e7e6 | 719:03d5b96632fb |
---|---|
92 ec_slave_t *slave /**< EtherCAT slave */ |
92 ec_slave_t *slave /**< EtherCAT slave */ |
93 ) |
93 ) |
94 { |
94 { |
95 ec_eoe_t **priv; |
95 ec_eoe_t **priv; |
96 int result, i; |
96 int result, i; |
97 char name[20]; |
97 char name[EC_DATAGRAM_NAME_SIZE]; |
98 |
98 |
99 eoe->slave = slave; |
99 eoe->slave = slave; |
100 |
100 |
101 ec_datagram_init(&eoe->datagram); |
101 ec_datagram_init(&eoe->datagram); |
102 eoe->state = ec_eoe_state_rx_start; |
102 eoe->state = ec_eoe_state_rx_start; |
118 eoe->rate_jiffies = 0; |
118 eoe->rate_jiffies = 0; |
119 |
119 |
120 /* device name eoe<MASTER>[as]<SLAVE>, because networking scripts don't |
120 /* device name eoe<MASTER>[as]<SLAVE>, because networking scripts don't |
121 * like hyphens etc. in interface names. */ |
121 * like hyphens etc. in interface names. */ |
122 if (slave->sii_alias) { |
122 if (slave->sii_alias) { |
123 sprintf(name, "eoe%ua%u", slave->master->index, slave->sii_alias); |
123 snprintf(name, EC_DATAGRAM_NAME_SIZE, |
124 "eoe%ua%u", slave->master->index, slave->sii_alias); |
|
124 } else { |
125 } else { |
125 sprintf(name, "eoe%us%u", slave->master->index, slave->ring_position); |
126 snprintf(name, EC_DATAGRAM_NAME_SIZE, |
126 } |
127 "eoe%us%u", slave->master->index, slave->ring_position); |
128 } |
|
129 |
|
130 snprintf(eoe->datagram.name, EC_DATAGRAM_NAME_SIZE, name); |
|
127 |
131 |
128 if (!(eoe->dev = alloc_netdev(sizeof(ec_eoe_t *), name, ether_setup))) { |
132 if (!(eoe->dev = alloc_netdev(sizeof(ec_eoe_t *), name, ether_setup))) { |
129 EC_ERR("Unable to allocate net_device %s for EoE handler!\n", name); |
133 EC_ERR("Unable to allocate net_device %s for EoE handler!\n", name); |
130 goto out_return; |
134 goto out_return; |
131 } |
135 } |
305 eoe->tx_rate = eoe->tx_counter * 8; |
309 eoe->tx_rate = eoe->tx_counter * 8; |
306 eoe->rx_counter = 0; |
310 eoe->rx_counter = 0; |
307 eoe->tx_counter = 0; |
311 eoe->tx_counter = 0; |
308 eoe->rate_jiffies = jiffies; |
312 eoe->rate_jiffies = jiffies; |
309 } |
313 } |
314 ec_datagram_output_stats(&eoe->datagram); |
|
310 } |
315 } |
311 |
316 |
312 /*****************************************************************************/ |
317 /*****************************************************************************/ |
313 |
318 |
314 /** |
319 /** |