daniel-p-carvalho opened a new pull request, #20786:
URL: https://github.com/apache/nuttx/pull/20786

   ## Summary
   
   The PIC32MZ-W1 has no factory programmed Ethernet station address 
(EMAC1SA0..2 reset to zero, unlike the PIC32MZ EC/EF), so the Ethernet 
interface came up as 00:00:00:00:00:00 and the address had to be assigned from 
user space (`ifconfig eth0 hw ...`) before it could carry any traffic. A board 
has no way to give it one at build time.
   
   Add `PIC32MZ_ETH_MACADDR` (a `hex` option, like 
`CLICKER2_STM32_RNDIS_MACADDR`) to give the interface a fixed address when the 
driver registers it. The default of zero keeps the current behavior: the 
address programmed at reset, or one assigned later with `SIOCSIFHWADDR`. The 
existing code in `pic32mz_ifup()` already programs a non-zero `d_mac` into the 
registers, so nothing else changes.
   
   ## Impact
   
   New option, default zero: no change for existing configurations (the code is 
compiled out). A fixed address is the same for every board built from the 
configuration, so it has to be a locally administered one that is unique in the 
network, or be overridden at run time.
   
   ## Testing
   
   Host: Ubuntu Linux, XC32 v6.00. Target: EV49N51A (PIC32MZ-W1), `nsh`-based 
configuration with the Ethernet driver and 
`CONFIG_PIC32MZ_ETH_MACADDR=0x02e0deadbeef`.
   
   - Before: `eth0` shows `HWaddr 00:00:00:00:00:00` until `ifconfig eth0 hw 
...` is run.
   - After: right after boot, without any command, `ifconfig` shows `eth0 ... 
HWaddr 02:e0:de:ad:be:ef`. The interface comes up and pings a host over the 
cable, and bridged with the Wi-Fi interface it answers ARP and forwards traffic 
(0% loss).
   - `checkpatch` passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to