Skip to content

lkl: add lkl_if_set_mac to support set MAC address on the interface#624

Open
clingfei wants to merge 1 commit intolkl:masterfrom
clingfei:dev
Open

lkl: add lkl_if_set_mac to support set MAC address on the interface#624
clingfei wants to merge 1 commit intolkl:masterfrom
clingfei:dev

Conversation

@clingfei
Copy link
Copy Markdown

Currently, we can only set the MAC address when using lkl_netdev_add to add a new network device. Otherwise, it will generate a random one through eth_hw_addr_random.

It would be more flexible to support dynamically MAC address configuration.

Copy link
Copy Markdown
Member

@tavip tavip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @clingfei !

Currently, we can only set the MAC address when using `lkl_netdev_add`
to add a new network device. Otherwise, it will generate a random
one through `eth_hw_addr_random`.

It would be more flexible to support dynamically MAC address configuration.

Signed-off-by: Cheng Lingfei <1599101385@qq.com>
@clingfei
Copy link
Copy Markdown
Author

Thanks for your review @tavip!

The previous commit caused checkpatch.sh to fail, and I have fixed this issue in the latest commit.

@thehajime
Copy link
Copy Markdown
Member

thanks @clingfei for the patch.

I was wondering if we can change an interface created with dpdk device, which has a configuration to the underlying part.

https://github.com/lkl/linux/blob/master/tools/lkl/lib/virtio_net_dpdk.c#L452

@clingfei
Copy link
Copy Markdown
Author

I was wondering if we can change an interface created with dpdk device, which has a configuration to the underlying part.

https://github.com/lkl/linux/blob/master/tools/lkl/lib/virtio_net_dpdk.c#L452

Currently, we can only change the LKL guest interface, not the DPDK device. If we want to change the interface for the backend, maybe we should add a set_mac for lkl_dev_net_ops and call some DPDK setter function.

Moreover, in the current DPDK config path, the auto-detected DPDK MAC takes precedence over iface->ifmac_str because config.c checks the DPDK-filled mac buffer before parsing the configured MAC. I think this also supports modifying only the guest interface without affecting the DPDK device interface.

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