bartv
Posts: 35
Joined: Thu Aug 14, 2014 7:28 pm

CM3 with dual LAN chips

Mon Apr 10, 2017 4:19 pm

Hi all,

I would like to design a board with 2 Ethernet connectors and 5 USB ports. So the solutions would be a LAN9514 chip and a LAN9512 chip. The LAN9514 chip comes first and 1 USB connection is used for the LAN9512 chip. I've googled if it was possible, and I'm not the first that'll try it. But I couldn't get a definitive answer if it is possible. In theory it is, but I saw some problems with MAC Addresses and getting the eth0 and eth1 to work.

So, my question is, is it possible and stable? If yes, what is the best way to do it? (Hardware and software) With 2 LAN95xx chips, or is it better to do it with a LAN9514 chip and a chip just for LAN?

Thanks!

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: CM3 with dual LAN chips

Mon Apr 10, 2017 4:51 pm

I can't give a definitive answer, but your caution with regard MAC addresses is certainly valid.
The Pi partially cheats by taking that Pi serial number to derive the MAC address. That obviously fails if you have 2 SMSC95xx devices attached.
The SMSC95xx does support attaching an EEPROM, and that would be the sensible approach to ensure they are unique.

Having said that I seem to recall a recent change that the firmware now passes the mac address via device tree, and DT appears to be checked before the eeprom (https://github.com/raspberrypi/linux/bl ... 5xx.c#L973). That may need to be amended in your kernel.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

bartv
Posts: 35
Joined: Thu Aug 14, 2014 7:28 pm

Re: CM3 with dual LAN chips

Mon Apr 10, 2017 5:38 pm

6by9 wrote:I can't give a definitive answer, but your caution with regard MAC addresses is certainly valid.
The Pi partially cheats by taking that Pi serial number to derive the MAC address. That obviously fails if you have 2 SMSC95xx devices attached.
The SMSC95xx does support attaching an EEPROM, and that would be the sensible approach to ensure they are unique.

Having said that I seem to recall a recent change that the firmware now passes the mac address via device tree, and DT appears to be checked before the eeprom (https://github.com/raspberrypi/linux/bl ... 5xx.c#L973). That may need to be amended in your kernel.
So it's possible, but not without a custom kernel of some sort? I don't want to compile a custom kernel, because updating the Pi would become a pain in the ass.

Is there another solution to get 2 Ethernet connectors on a single board without customizing the kernel? Because the EEPROM isn't going to work, if I look at the GitHub code.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: CM3 with dual LAN chips

Mon Apr 10, 2017 7:39 pm

bartv wrote:So it's possible, but not without a custom kernel of some sort? I don't want to compile a custom kernel, because updating the Pi would become a pain in the ass.
You probably want PhilE to respond for a definitive answer, but a couple of thoughts.
- Checking the code it looks like you could override the device tree for each of the nodes. Exactly how I couldn't say as device tree normally isn't used on buses that can be enumerated.
- If the two SMSC95xx interfaces connect on to different ethernet networks, then there is actually no harm in having the same MAC address on the two interfaces.
- Do you actually need two physical interfaces, or could you achieve the same with VLANs?
bartv wrote:Is there another solution to get 2 Ethernet connectors on a single board without customizing the kernel? Because the EEPROM isn't going to work, if I look at the GitHub code.
Use two different chips, but you're likely to have to use EEPROMs on at least one of them.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

bartv
Posts: 35
Joined: Thu Aug 14, 2014 7:28 pm

Re: CM3 with dual LAN chips

Mon Apr 10, 2017 7:47 pm

6by9 wrote:
bartv wrote:So it's possible, but not without a custom kernel of some sort? I don't want to compile a custom kernel, because updating the Pi would become a pain in the ass.
You probably want PhilE to respond for a definitive answer, but a couple of thoughts.
- Checking the code it looks like you could override the device tree for each of the nodes. Exactly how I couldn't say as device tree normally isn't used on buses that can be enumerated.
- If the two SMSC95xx interfaces connect on to different ethernet networks, then there is actually no harm in having the same MAC address on the two interfaces.
- Do you actually need two physical interfaces, or could you achieve the same with VLANs?
bartv wrote:Is there another solution to get 2 Ethernet connectors on a single board without customizing the kernel? Because the EEPROM isn't going to work, if I look at the GitHub code.
Use two different chips, but you're likely to have to use EEPROMs on at least one of them.
I'm not familiar with VLAN, so I'd have to look into that.
But does the RPI see the ethernet ports as eth0 and eth1 or just as eth0?

The reason why I want 2 ethernet ports is because 1 ethernet port is required to connect to the internet, and 1 ethernet port is for a local network. The Pi works as a master and other Pi's can connect to the local network as slaves. So is it necessary to have multiple mac addresses? Because all I care about is that eth0 is configured with DHCP or a static IP address to connect to the internet and eth1 is configured to create it's own network for ad-hoc data communication.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: CM3 with dual LAN chips

Mon Apr 10, 2017 8:30 pm

bartv wrote:I'm not familiar with VLAN, so I'd have to look into that.
But does the RPI see the ethernet ports as eth0 and eth1 or just as eth0?
You need a managed switch to run VLANs. 802.1q support is what you're after.
Set up the switch port connected to the Pi to enable VLAN tagging. IIRC the interfaces should be configurable as eth0.1 and eth0.2, etc based on which VLAN ID you wish to use. Other ports on the switch can be set as untagged but assigned to the VLAN of interest.
eg Port 1 - tagged, VLAN 1&2, connected to the Pi
Port 2 - untagged VLAN1, connected to the internet
Ports 3-N - untagged VLAN2, connected to all other devices. Devices on these ports can't get directly to the internet and have to go via the Pi.
bartv wrote:The reason why I want 2 ethernet ports is because 1 ethernet port is required to connect to the internet, and 1 ethernet port is for a local network. The Pi works as a master and other Pi's can connect to the local network as slaves. So is it necessary to have multiple mac addresses? Because all I care about is that eth0 is configured with DHCP or a static IP address to connect to the internet and eth1 is configured to create it's own network for ad-hoc data communication.
In which case I'd expect you to be OK reusing the same MAC address, but there is a possibility that Linux may get confused.
There are a bunch of dodgy ethernet adapters that use the DM9601 chip without EEPROM, so those too show up with the same MAC address. They tend to look like http://www.ebay.co.uk/itm/3-Ports-USB-2 ... 2890415240 (I am not saying this is one of the dodgy ones!), but there are also some good ones in a very similar form factor. It'd be easy enough to grab a few of those off Ebay and test it out. Most people tend to avoid them where possible due to the issues of MAC address, and that the ethernet side is only USB1.1. I have a couple of them, but as USB OTG adapters for Pi Zero so not easy to connect 2 simultaneously.
Alternatively there are runes to allow you to reset the "live" MAC address of an adapter so you could try it out on with any two ethernet adapters on any Linux machine.

The big rule is don't connect two devices with the same MAC address to the same ethernet switch, otherwise the switch will get very confused and comms will be intermittent.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

bartv
Posts: 35
Joined: Thu Aug 14, 2014 7:28 pm

Re: CM3 with dual LAN chips

Mon Apr 10, 2017 8:52 pm

6by9 wrote:
bartv wrote:The reason why I want 2 ethernet ports is because 1 ethernet port is required to connect to the internet, and 1 ethernet port is for a local network. The Pi works as a master and other Pi's can connect to the local network as slaves. So is it necessary to have multiple mac addresses? Because all I care about is that eth0 is configured with DHCP or a static IP address to connect to the internet and eth1 is configured to create it's own network for ad-hoc data communication.
In which case I'd expect you to be OK reusing the same MAC address, but there is a possibility that Linux may get confused.
There are a bunch of dodgy ethernet adapters that use the DM9601 chip without EEPROM, so those too show up with the same MAC address. They tend to look like http://www.ebay.co.uk/itm/3-Ports-USB-2 ... 2890415240 (I am not saying this is one of the dodgy ones!), but there are also some good ones in a very similar form factor. It'd be easy enough to grab a few of those off Ebay and test it out. Most people tend to avoid them where possible due to the issues of MAC address, and that the ethernet side is only USB1.1. I have a couple of them, but as USB OTG adapters for Pi Zero so not easy to connect 2 simultaneously.
Alternatively there are runes to allow you to reset the "live" MAC address of an adapter so you could try it out on with any two ethernet adapters on any Linux machine.

The big rule is don't connect two devices with the same MAC address to the same ethernet switch, otherwise the switch will get very confused and comms will be intermittent.
I think this option will work better for me. Because we don't want to work with a switch. The best and most practical option for us is all on one board. For testing purposes we could use a RPI 3, because it has the LAN9514 chip already and we can connect a USB to Ethernet adapter to it. If it works, why wouldn't it work on a board for the CM3, right?

I'll try this tomorrow evening. But why would Linux get confused? Because of the same MAC Address? And what is Linux going to do? Switch eth0 with eth1 after reboot or just don't show 1 of them? Because it has to work stable, that would be nice. And we aren't going to use both LAN ports on 1 network. It'll always be 1 for the internet and 1 for ad-hoc networking, so that wouldn't be an issue.

I hope I don't encounter any issues with the dual LAN via USB test tomorrow. But in theory, even with the same mac addresses, it would work? And even stable?

Also, thanks for your fast responses and feedback! I hope @PhilE gives some of his thoughts and that I can give a definitive answer to the "Dual LAN" problems encountered by myself and other users.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: CM3 with dual LAN chips

Tue Apr 11, 2017 9:37 am

bartv wrote:I think this option will work better for me. Because we don't want to work with a switch. The best and most practical option for us is all on one board. For testing purposes we could use a RPI 3, because it has the LAN9514 chip already and we can connect a USB to Ethernet adapter to it. If it works, why wouldn't it work on a board for the CM3, right?
No reason why it shouldn't.
bartv wrote:I'll try this tomorrow evening. But why would Linux get confused? Because of the same MAC Address? And what is Linux going to do? Switch eth0 with eth1 after reboot or just don't show 1 of them? Because it has to work stable, that would be nice. And we aren't going to use both LAN ports on 1 network. It'll always be 1 for the internet and 1 for ad-hoc networking, so that wouldn't be an issue.

I hope I don't encounter any issues with the dual LAN via USB test tomorrow. But in theory, even with the same mac addresses, it would work? And even stable?
Theory would say that as long as the network layers have been correctly partitioned, the duplicate MAC address at layer 2 of the OSI 7 layer model shouldn't affect the IP routing at level 3 as long as they are kept on independent networks. Reality can sometimes differ and I simply don't know the answer with Linux.
...
Phil's not in this week, but a quick conversation with another colleague ended with "oh, I've got this SMSC9514 dev board - let's plug it into a normal Pi and you've then got 2 9514's connected". The dev board has a MAC address EEPROM on it too :)

After screwing up my sdcard I used a different card with an old image and having the two SMSC9514s connected is fine. The first one takes the serial number based MAC address and is eth0. The second one takes the MAC address from the EEPROM and is eth1.
Even after doing an rpi-update to get the absolute latest firmware all looks good too. So perhaps my concerns were unfounded if you fit and program an EEPROM for at least one of the SMSC95xx chips. I can't easily test with the same MAC address on both interfaces.

I'd still like to get Phil to comment. The firmware appears to fill in /proc/device-tree/soc/[email protected]/[email protected]/[email protected]/local-mac-address with the serial number based MAC address. That path appears to be unique to the first SMSC9514 but confirmation would be useful.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23066
Joined: Sat Jul 30, 2011 7:41 pm

Re: CM3 with dual LAN chips

Tue Apr 11, 2017 9:40 am

The Pi3 already has a duel LAN since it can have an ethernet AND a Wireless connection at the same time. They have different mac addresses IIRC.

When you add a USB to ethernet adapter, its the adaptor itself that provides a MAC address I think.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

bartv
Posts: 35
Joined: Thu Aug 14, 2014 7:28 pm

Re: CM3 with dual LAN chips

Tue Apr 11, 2017 10:13 am

6by9 wrote:Phil's not in this week, but a quick conversation with another colleague ended with "oh, I've got this SMSC9514 dev board - let's plug it into a normal Pi and you've then got 2 9514's connected". The dev board has a MAC address EEPROM on it too :)

After screwing up my sdcard I used a different card with an old image and having the two SMSC9514s connected is fine. The first one takes the serial number based MAC address and is eth0. The second one takes the MAC address from the EEPROM and is eth1.
Even after doing an rpi-update to get the absolute latest firmware all looks good too. So perhaps my concerns were unfounded if you fit and program an EEPROM for at least one of the SMSC95xx chips. I can't easily test with the same MAC address on both interfaces.

I'd still like to get Phil to comment. The firmware appears to fill in /proc/device-tree/soc/[email protected]/[email protected]/[email protected]/local-mac-address with the serial number based MAC address. That path appears to be unique to the first SMSC9514 but confirmation would be useful.
You've used the EVB9514 board? (http://www.microchip.com/DevelopmentToo ... NO=EVB9514). We would just sort-of copy that board with an EEPROM. We're just looking for a pre-programmed MAC EEPROM for the LAN95xx chip.

I'm going to try it with a USB to Ethernet adapter at home to see how the Pi on Raspbian with a clean install reacts on the Ethernet adapter. I'll let you know how the Pi reacts. But is the best solution to have 2 EEPROM's, so 1 for the LAN9514 chip and 1 for the LAN9512 chip, or doesn't it make a difference?
jamesh wrote:The Pi3 already has a duel LAN since it can have an ethernet AND a Wireless connection at the same time. They have different mac addresses IIRC.

When you add a USB to ethernet adapter, its the adaptor itself that provides a MAC address I think.
If I'm correct, the MAC addresses are different indeed. But I'll let you know if the MAC address is different with a USB to Ethernet adapter than eth0.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: CM3 with dual LAN chips

Tue Apr 11, 2017 10:59 am

bartv wrote:You've used the EVB9514 board? (http://www.microchip.com/DevelopmentToo ... NO=EVB9514). We would just sort-of copy that board with an EEPROM. We're just looking for a pre-programmed MAC EEPROM for the LAN95xx chip.
That's the beast. Thanks for the link as we were thinking of getting some more and were going to have to approach Microchip with a vague plea. Having a product reference makes life easier.
bartv wrote:I'm going to try it with a USB to Ethernet adapter at home to see how the Pi on Raspbian with a clean install reacts on the Ethernet adapter. I'll let you know how the Pi reacts. But is the best solution to have 2 EEPROM's, so 1 for the LAN9514 chip and 1 for the LAN9512 chip, or doesn't it make a difference?
It'll be quite happy with two random USB ethernet adapters. I tend to run my Pi's here in the office with an external network adapters for various reasons.
The issue was over using the same MAC address on multiple interfaces.
Normally it should never happen, but there was a chance of it due to the way the SMSC95xx is used on the Pi.
If you do go down the EEPROM route then you need an allocation of MAC addresses to program, although Microchip do appear to sell ready programmed EEPROMs.
jamesh wrote:The Pi3 already has a duel LAN since it can have an ethernet AND a Wireless connection at the same time. They have different mac addresses IIRC.

When you add a USB to ethernet adapter, its the adaptor itself that provides a MAC address I think.
If I'm correct, the MAC addresses are different indeed. But I'll let you know if the MAC address is different with a USB to Ethernet adapter than eth0.[/quote]
Yes, WLAN and SMSC9514 have different MAC addresses, although both with the b8:27:eb prefix for Raspberry Pi. I don't know where the one for the WLAN is stored - quite possibly it's been programmed into the Wifi chip itself.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

bartv
Posts: 35
Joined: Thu Aug 14, 2014 7:28 pm

Re: CM3 with dual LAN chips

Tue Apr 11, 2017 11:19 am

6by9 wrote:It'll be quite happy with two random USB ethernet adapters. I tend to run my Pi's here in the office with an external network adapters for various reasons.
The issue was over using the same MAC address on multiple interfaces.
Normally it should never happen, but there was a chance of it due to the way the SMSC95xx is used on the Pi.
If you do go down the EEPROM route then you need an allocation of MAC addresses to program, although Microchip do appear to sell ready programmed EEPROMs.
I saw the pre-programmed EEPROMs with MAC addresses. But I couldn't find a suitable EEPROM for the LAN95xx chipset, because the EEPROM is not only used for MAC addresses but also for some different settings (correct me if I'm wrong).

The 93AA46AE48 is for LAN9xxx chipsets, but LAN95xx chipsets aren't listed. If you have a suggestion for a pre-programmed EEPROM from the URL you posted that'll work with the LAN95xx chipsets, that'd be fantastic.

There is a tool to program it myself. So I could let the Pi execute a command on first boot to write a MAC address on the EEPROM. But I don't know if that will work, because the MAC addresses will most likely be the same at first boot, so the Pi may have problems to identify which eth is which chip I think.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: CM3 with dual LAN chips

Tue Apr 11, 2017 12:00 pm

bartv wrote:I saw the pre-programmed EEPROMs with MAC addresses. But I couldn't find a suitable EEPROM for the LAN95xx chipset, because the EEPROM is not only used for MAC addresses but also for some different settings (correct me if I'm wrong).

The 93AA46AE48 is for LAN9xxx chipsets, but LAN95xx chipsets aren't listed. If you have a suggestion for a pre-programmed EEPROM from the URL you posted that'll work with the LAN95xx chipsets, that'd be fantastic.

There is a tool to program it myself. So I could let the Pi execute a command on first boot to write a MAC address on the EEPROM. But I don't know if that will work, because the MAC addresses will most likely be the same at first boot, so the Pi may have problems to identify which eth is which chip I think.
It'd be worth contacting Microchip. I have no direct relationship with them, I'm just going through the same pages that you can see.
I'd be surprised if the EEPROM layout differed between their chips, but stranger things have happened. The datasheets are all there, so you could compare their EEPROM requirements whilst waiting for MicroChip to respond.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

bartv
Posts: 35
Joined: Thu Aug 14, 2014 7:28 pm

Re: CM3 with dual LAN chips

Tue Apr 11, 2017 12:09 pm

6by9 wrote:
bartv wrote:I saw the pre-programmed EEPROMs with MAC addresses. But I couldn't find a suitable EEPROM for the LAN95xx chipset, because the EEPROM is not only used for MAC addresses but also for some different settings (correct me if I'm wrong).

The 93AA46AE48 is for LAN9xxx chipsets, but LAN95xx chipsets aren't listed. If you have a suggestion for a pre-programmed EEPROM from the URL you posted that'll work with the LAN95xx chipsets, that'd be fantastic.

There is a tool to program it myself. So I could let the Pi execute a command on first boot to write a MAC address on the EEPROM. But I don't know if that will work, because the MAC addresses will most likely be the same at first boot, so the Pi may have problems to identify which eth is which chip I think.
It'd be worth contacting Microchip. I have no direct relationship with them, I'm just going through the same pages that you can see.
I'd be surprised if the EEPROM layout differed between their chips, but stranger things have happened. The datasheets are all there, so you could compare their EEPROM requirements whilst waiting for MicroChip to respond.
I've contacted MicroChip for this issue. I'm going to compare the datasheets in the evening and I'll post my findings!
Thanks for the help so far!

bartv
Posts: 35
Joined: Thu Aug 14, 2014 7:28 pm

Re: CM3 with dual LAN chips

Tue Apr 11, 2017 6:28 pm

I've bought an USB to LAN (TP-Link UE300) and it works out of the box. It has a different MAC address than eth0.
eth0 has a LAN to internet connection, so that the "master" can connect to the internet. eth1 is set up as a ad-hoc network with dnsmasq, so a quite simple ad-hoc network. I've booted another Pi and connected it with an ethernet cable from the master eth1 to the eth0 of the "slave", and it works!

The only difference is that the TP-Link UE300 will most likely have an EEPROM with a MAC address programmed on it. I'll figure that out once I've opened the UE300 case. So on the circuit I'll have to add a EEPROM with MAC address on 1 of the LAN95xx chipsets, or I'll have to use this, or another, chipset with a build-in EEPROM with MAC address. I'll keep you posted!

JamesPi123
Posts: 110
Joined: Fri Sep 23, 2016 10:02 pm
Location: Inside my Pi
Contact: Website

Re: CM3 with dual LAN chips

Thu Apr 13, 2017 2:09 am

You could use a USB hub and 2 USB - ethernet adaptors

bartv
Posts: 35
Joined: Thu Aug 14, 2014 7:28 pm

Re: CM3 with dual LAN chips

Thu Apr 13, 2017 11:29 am

None of the pre-programmed Microchips are compatible with the LAN95xx chipset. So they suggested to buy MAC addresses from IEEE and program them ourself. We'll be better of using another USB-to-LAN chipset with build-in EEPROM/MAC address , because it's more efficient for us.
JamesPi123 wrote:You could use a USB hub and 2 USB - ethernet adaptors
We could do that, but like I said, we want everything on 1 board. So that's nog gonna work for us. It will work, but it's not the most beautiful way to do it.

plugwash
Forum Moderator
Forum Moderator
Posts: 3433
Joined: Wed Dec 28, 2011 11:45 pm

Re: CM3 with dual LAN chips

Thu Apr 13, 2017 12:01 pm

If it supplies enough ports using one LAN951x with the MAC supplied by the Pi and one other USB to Ethernet chip with it's own MAC is probably a good option.

bartv
Posts: 35
Joined: Thu Aug 14, 2014 7:28 pm

Re: CM3 with dual LAN chips

Thu Apr 13, 2017 12:08 pm

plugwash wrote:If it supplies enough ports using one LAN951x with the MAC supplied by the Pi and one other USB to Ethernet chip with it's own MAC is probably a good option.
I think we will go for that option. If we don't have enough USB ports, we could just simply add another USB hub without LAN port. But after some discussion, we're not sure if we're going to use the dual LAN or some serial connection. I've opened a topic for this (viewtopic.php?f=44&t=180508) to get other people opinions for our specific case.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: CM3 with dual LAN chips

Thu Apr 13, 2017 12:16 pm

bartv wrote:None of the pre-programmed Microchips are compatible with the LAN95xx chipset. So they suggested to buy MAC addresses from IEEE and program them ourself. We'll be better of using another USB-to-LAN chipset with build-in EEPROM/MAC address , because it's more efficient for us.
Wow, I was not expecting that response from them, and I actually partly fail to see why.

http://ww1.microchip.com/downloads/en/D ... 02306A.pdf page 19
EEPROM Address EEPROM Contents
00h 0xA5
01h MAC Address [7:0]
02h MAC Address [15:8]
03h MAC Address [23:16]
04h MAC Address [31:24]
05h MAC Address [39:32]
06h MAC Address [47:40]
http://ww1.microchip.com/downloads/en/D ... c/9221.pdf page 38
On power-up, hard reset or soft reset, the EEPROM controller attempts to read the first byte of data
from the EEPROM (address 00h). If the value A5h is read from the first address, then the EEPROM
controller will assume that an external Serial EEPROM is present. The EEPROM controller will then
access the next EEPROM byte and send it to the MAC Address register byte 0 (ADDRL[7:0]). This
process will be repeated for the next five bytes of the MAC Address, thus
fully programming the 48-bit MAC address.
Those look pretty much the same, but I guess it is all the other register values used on 9514 that are the issue. One would have hoped that invalid values would have just been ignored, but I guess not.

As originally proposed, you would have the option of using SMSC9514 with a custom kernel if that overhead is acceptable. I haven't discussed it with the others, but seeing as the module parameter change to the SMSC9514 driver is a custom change for Pi, adding 1 to the address for each interface using that chip would probably be acceptable to be merged to the Pi standard kernel.
Or check whether your use case is happy with having the same MAC address on the two interfaces. As originally stated it may be OK, but be very carfeul not to connect the two interfaces to the same switch. Checking the runes, "sudo ip link set down eth0" "sudo ip link set eth0 address 01:23:45:67:89:01" "sudo ip link set up eth0" should reassign the MAC address of the interface, so you can test with 2 random ethernet adapters. (It does seem to object to the Pi Towers b8:27:eb prefix though, not sure why).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

bartv
Posts: 35
Joined: Thu Aug 14, 2014 7:28 pm

Re: CM3 with dual LAN chips

Thu Apr 13, 2017 12:27 pm

6by9 wrote:
bartv wrote:None of the pre-programmed Microchips are compatible with the LAN95xx chipset. So they suggested to buy MAC addresses from IEEE and program them ourself. We'll be better of using another USB-to-LAN chipset with build-in EEPROM/MAC address , because it's more efficient for us.
Wow, I was not expecting that response from them, and I actually partly fail to see why.

http://ww1.microchip.com/downloads/en/D ... 02306A.pdf page 19
EEPROM Address EEPROM Contents
00h 0xA5
01h MAC Address [7:0]
02h MAC Address [15:8]
03h MAC Address [23:16]
04h MAC Address [31:24]
05h MAC Address [39:32]
06h MAC Address [47:40]
http://ww1.microchip.com/downloads/en/D ... c/9221.pdf page 38
On power-up, hard reset or soft reset, the EEPROM controller attempts to read the first byte of data
from the EEPROM (address 00h). If the value A5h is read from the first address, then the EEPROM
controller will assume that an external Serial EEPROM is present. The EEPROM controller will then
access the next EEPROM byte and send it to the MAC Address register byte 0 (ADDRL[7:0]). This
process will be repeated for the next five bytes of the MAC Address, thus
fully programming the 48-bit MAC address.
Those look pretty much the same, but I guess it is all the other register values used on 9514 that are the issue. One would have hoped that invalid values would have just been ignored, but I guess not.
I thought so too. But it's not only that, it's also the organization of the EEPROM.
This is their response:
Microchip wrote:Unfortunately, Microchip’s pre-programmed EEPROM are 128 x 8 bit organization only and not compatible to the LAN951x
which requires 256/512 x 8 bit organizations.
You can purchase the MAC addresses from IEEE and program parts yourself.
We provide EEPROM programming tools for LAN951x.
6by9 wrote:As originally proposed, you would have the option of using SMSC9514 with a custom kernel if that overhead is acceptable. I haven't discussed it with the others, but seeing as the module parameter change to the SMSC9514 driver is a custom change for Pi, adding 1 to the address for each interface using that chip would probably be acceptable to be merged to the Pi standard kernel.
A custom kernel can be made, but I'm not a big fan of using custom kernels. I don't know much about custom kernels and driver software, so I'll just leave that to the Raspbian guys and trusting them instead of building a kernel myself with the risk that it's not stable.
6by9 wrote:Or check whether your use case is happy with having the same MAC address on the two interfaces. As originally stated it may be OK, but be very carfeul not to connect the two interfaces to the same switch. Checking the runes, "sudo ip link set down eth0" "sudo ip link set eth0 address 01:23:45:67:89:01" "sudo ip link set up eth0" should reassign the MAC address of the interface, so you can test with 2 random ethernet adapters. (It does seem to object to the Pi Towers b8:27:eb prefix though, not sure why).
I'll try that this evening, reassigning the MAC address of eth0 and eth1 to the same address and see if Linux is going to be happy about it. But I don't know if that's the best way to do it, because it can become unstable or give complications I think. But I'll keep you posted!

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: CM3 with dual LAN chips

Thu Apr 13, 2017 12:44 pm

bartv wrote:I thought so too. But it's not only that, it's also the organization of the EEPROM.
This is their response:
Microchip wrote:Unfortunately, Microchip’s pre-programmed EEPROM are 128 x 8 bit organization only and not compatible to the LAN951x
which requires 256/512 x 8 bit organizations.
You can purchase the MAC addresses from IEEE and program parts yourself.
We provide EEPROM programming tools for LAN951x.
Ah, so too small as well. It still seems bonkers that they don't read out the MAC address and ignore the rest!
bartv wrote:
6by9 wrote:Or check whether your use case is happy with having the same MAC address on the two interfaces. As originally stated it may be OK, but be very carfeul not to connect the two interfaces to the same switch. Checking the runes, "sudo ip link set down eth0" "sudo ip link set eth0 address 01:23:45:67:89:01" "sudo ip link set up eth0" should reassign the MAC address of the interface, so you can test with 2 random ethernet adapters. (It does seem to object to the Pi Towers b8:27:eb prefix though, not sure why).
I'll try that this evening, reassigning the MAC address of eth0 and eth1 to the same address and see if Linux is going to be happy about it. But I don't know if that's the best way to do it, because it can become unstable or give complications I think. But I'll keep you posted!
Test your specific use case.
Network bridges (layer 2 linking of networks) may cause issues, but anything routing/proxying (layer 3 or 7 linking) should be fine.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

bartv
Posts: 35
Joined: Thu Aug 14, 2014 7:28 pm

Re: CM3 with dual LAN chips

Thu Apr 13, 2017 1:01 pm

6by9 wrote:Test your specific use case.
Network bridges (layer 2 linking of networks) may cause issues, but anything routing/proxying (layer 3 or 7 linking) should be fine.
I'll do that this evening and I will post my findings! Thanks!

bartv
Posts: 35
Joined: Thu Aug 14, 2014 7:28 pm

Re: CM3 with dual LAN chips

Thu Apr 13, 2017 5:05 pm

I've spoofed the USB-to-LAN chip like @6by9 said, but then it doesn't work at all. With just a simple spoof like you suggested, everything stays the same, except I can't connect to the "slave" (the other connected Pi via the eth1 network). If I do it with ifconfig, so

Code: Select all

ifconfig eth1 hw ether XX:XX:XX:XX:XX:XX
, dnsmasq is confused and doesn't work anymore.

So the best option is to have 2 MAC addresses. So 1 with EEPROM and 1 can go without. But, I can't find a chipset that has a build-in MAC address. Or at least, I can't confirm it. And it has to work with the Pi drivers...

So any suggestions what to do next? I've found the RTL8153 (Is USB3.0, so RTL8152b is maybe a better solution?), the AX88772B and the LAN9500. Microchip only has USB-to-LAN chipsets without built-in MAC addresses, and the EEPROM's with pre-programmed MAC addresses are for LAN chipsets, so not USB-to-LAN chipsets afaik. Or is there someone that knows which pre-programmed EEPROM might work with the LAN9500? (http://www.microchip.com/design-centers ... ress-chips).

bartv
Posts: 35
Joined: Thu Aug 14, 2014 7:28 pm

Re: CM3 with dual LAN chips

Fri Apr 14, 2017 11:09 am

6by9 wrote:I'd still like to get Phil to comment. The firmware appears to fill in /proc/device-tree/soc/[email protected]/[email protected]/[email protected]/local-mac-address with the serial number based MAC address. That path appears to be unique to the first SMSC9514 but confirmation would be useful.
I've updated my kernel to 4.9.y, and looked at the device tree option @6by9 said. It looks promising. But what I'm trying to figure out is, when I connect another LAN95xx chip, where is it located? Because the LAN9514 chip is now located at /proc/device-tree/soc/[email protected], is the second going to be located at, for example, /proc/device-tree/soc/[email protected]?

What matters is, is the second ethernet local-mac-address going to be located at another address than /proc/device-tree/soc/[email protected]/[email protected]/[email protected]/local-mac-address? And is it always going to be at the same address on another board? Because that would be the best solution for my problem!

Return to “Compute Module”