[etherlab-users] MAC address assignment of EoE capable slave
Jens Seiersen
jes at deif.com
Tue Jan 24 14:01:47 CET 2012
Hello,
We have been developing our own Ethernet-over-Ethercat capable slave module. We have currently a very simple implementation, with an microcontroller attached to an ET1100 ASIC via SPI. By enabling EOE_SUPPORT, we have been able to send and receive Ethernet data over this setup.
However we would like some more control over the assigned MAC address of the slave module. Right now, it is assigned a calculated value of 00:11:22:33:44:[some index]
We would like to set the MAC address to unique value from our own pool of MAC addresses, preferably with the command: "ifconfig eoe0s1 hw ether 00:AA:BB:CC:DD:EE"
When we do this, we get the error: "ifconfig: SIOCSIFHWADDR: Operation not supported"
As far as we can tell, is because in the initialization function: ec_eoe_init() in master/ethernet.c, an update-function is not assigned to the (*set_mac_address) function pointer of the net_device.
Would it be possible to add such a function to master/ethernet.c? An example could be:
282<http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/net/ethernet/eth.c#L282> int eth_mac_addr<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=eth_mac_addr>(struct net_device<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=net_device> *dev<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=dev>, void *p<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=p>)
283<http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/net/ethernet/eth.c#L283> {
284<http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/net/ethernet/eth.c#L284> struct sockaddr<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=sockaddr> *addr<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=addr> = p<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=p>;
285<http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/net/ethernet/eth.c#L285>
286<http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/net/ethernet/eth.c#L286> if (netif_running<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=netif_running>(dev<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=dev>))
287<http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/net/ethernet/eth.c#L287> return -EBUSY<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=EBUSY>;
288<http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/net/ethernet/eth.c#L288> if (!is_valid_ether_addr<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=is_valid_ether_addr>(addr<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=addr>->sa_data))
289<http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/net/ethernet/eth.c#L289> return -EADDRNOTAVAIL<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=EADDRNOTAVAIL>;
290<http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/net/ethernet/eth.c#L290> memcpy<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=memcpy>(dev<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=dev>->dev_addr<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=dev_addr>, addr<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=addr>->sa_data, ETH_ALEN<http://tomoyo.sourceforge.jp/cgi-bin/lxr/ident?i=ETH_ALEN>);
291<http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/net/ethernet/eth.c#L291> return 0;
292<http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/net/ethernet/eth.c#L292> }
>From linux_source/net/Ethernet/eth.c
Best regards
Jens Seiersen
DEIF Wind Power Technology
Hardware Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20120124/f9f93cb2/attachment-0002.htm>
More information about the Etherlab-users
mailing list