-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use MAC from EEPROM for Interfaces #329
Conversation
Merge current master to 201803
Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>
Please fix the test. #Closed |
syncd/scripts/syncd_init_common.sh
Outdated
@@ -54,7 +54,7 @@ config_syncd_mlnx() | |||
[ -e /dev/sxdevs/sxcdev ] || ( mkdir -p /dev/sxdevs && mknod /dev/sxdevs/sxcdev c 231 193 ) | |||
|
|||
# Read MAC address and align the last 6 bits. | |||
MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') | |||
MAC_ADDRESS=$(od -vt x1 -An /sys/bus/i2c/devices/8-0051/eeprom | xargs printf "0x%s " | xargs printf "%02x:" | awk 'BEGIN { FS=":"; i=8+1+2+1} {while(i<NF) {type=$i; len=("0x"$(i+1));if(type!="24") {i=i+2+len} else {print substr($0, (i+1)*3+1, len*3-1); break}}}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider to use python -c to simplify the manipulation. #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing testing is required. Code improvement is not necessary but highly suggested.
ok |
retest this please |
Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>
@@ -54,7 +54,7 @@ config_syncd_mlnx() | |||
[ -e /dev/sxdevs/sxcdev ] || ( mkdir -p /dev/sxdevs && mknod /dev/sxdevs/sxcdev c 231 193 ) | |||
|
|||
# Read MAC address and align the last 6 bits. | |||
MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') | |||
MAC_ADDRESS=$(sonic-cfggen -d -v DEVICE_METADATA.localhost.mac) | |||
last_byte=$(python -c "print '$MAC_ADDRESS'[-2:]") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably I can remove last byte masking as it is already done for the MAC in DB
* Use MAC from EEPROM for Interfaces Signed-off-by: Andriy Moroz <c_andriym@mellanox.com> * Use platform MAC from DB Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>
* Use MAC from EEPROM for Interfaces Signed-off-by: Andriy Moroz <c_andriym@mellanox.com> * Use platform MAC from DB Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>
* Use MAC from EEPROM for Interfaces Signed-off-by: Andriy Moroz <c_andriym@mellanox.com> * Use platform MAC from DB Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>
* sonic-utilities: Format show vlan config output * Format the output of show vlan config Signed-off-by: chenhu <chenhu@didichuxing.com> * [acl_loader] fix show acl table ports Signed-off-by: chenhu <chenhu@didiglobal.com> * [acl_loader] sort show acl table ports Signed-off-by: chenhu <chenhu@didiglobal.com>
This reverts commit 7a51a85.
Signed-off-by: Andriy Moroz c_andriym@mellanox.com
- What I did
Updated syncd init script to pass MAC from EEPROM to SAI for Mellanox platforms. Interfaces will be created with this MAC
- How I did it
updated syncd init script (syncd_init_common.sh)
- How to verify it
Start SONiC and make sure MACs on Interfaces are similar to one returned by command
od -vt x1 -An /sys/bus/i2c/devices/8-0051/eeprom | xargs printf "0x%s " | xargs printf "%02x:" | awk 'BEGIN { FS=":"; i=8+1+2+1} {while(i<NF) {type=$i; len=("0x"$(i+1));if(type!="24") {i=i+2+len} else {print substr($0, (i+1)3+1, len3-1); break}}}'
some bits in last byte may differ