Skip to content
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

Merged
merged 3 commits into from
Jul 3, 2018

Conversation

andriymoroz-mlnx
Copy link
Contributor

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

lguohan and others added 2 commits May 30, 2018 18:41
Merge current master to 201803
Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>
@qiluo-msft
Copy link
Contributor

qiluo-msft commented Jun 12, 2018

Please fix the test. #Closed

@@ -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}}}')
Copy link
Contributor

@qiluo-msft qiluo-msft Jun 12, 2018

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

Copy link
Contributor

@qiluo-msft qiluo-msft left a 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.

@andriymoroz-mlnx
Copy link
Contributor Author

ok
looks like it may take some time...
as a workaround to resolve the issue you can manually fix syncd:/usr/bin/syncd_init_common.sh on the switch and restart it

@andriymoroz-mlnx
Copy link
Contributor Author

retest this please

@andriymoroz-mlnx andriymoroz-mlnx changed the base branch from 201803 to master June 14, 2018 15:16
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:]")
Copy link
Contributor Author

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

@lguohan lguohan merged commit 9846397 into sonic-net:master Jul 3, 2018
lguohan pushed a commit that referenced this pull request Oct 13, 2018
* 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>
volodymyrsamotiy pushed a commit to volodymyrsamotiy/sonic-sairedis that referenced this pull request Jul 30, 2019
* 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>
pettershao-ragilenetworks pushed a commit to pettershao-ragilenetworks/sonic-sairedis that referenced this pull request Nov 18, 2022
* 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>
jianyuewu pushed a commit to jianyuewu/sonic-sairedis that referenced this pull request Feb 7, 2025
* 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>
jianyuewu pushed a commit to jianyuewu/sonic-sairedis that referenced this pull request Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants