Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vdpa_sim: store parsed MAC address in a buffer

As preparation for the next patches, we store the MAC address,
parsed during the vdpasim_create(), in a buffer that will be used
to fill 'config' together with other configurations.

Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20201215144256.155342-11-sgarzare@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Stefano Garzarella and committed by
Michael S. Tsirkin
cf1a3b35 a13b5918

+7 -3
+7 -3
drivers/vdpa/vdpa_sim/vdpa_sim.c
··· 40 40 module_param(macaddr, charp, 0); 41 41 MODULE_PARM_DESC(macaddr, "Ethernet MAC address"); 42 42 43 + u8 macaddr_buf[ETH_ALEN]; 44 + 43 45 struct vdpasim_virtqueue { 44 46 struct vringh vring; 45 47 struct vringh_kiov iov; ··· 398 396 goto err_iommu; 399 397 400 398 if (macaddr) { 401 - mac_pton(macaddr, vdpasim->config.mac); 402 - if (!is_valid_ether_addr(vdpasim->config.mac)) { 399 + mac_pton(macaddr, macaddr_buf); 400 + if (!is_valid_ether_addr(macaddr_buf)) { 403 401 ret = -EADDRNOTAVAIL; 404 402 goto err_iommu; 405 403 } 406 404 } else { 407 - eth_random_addr(vdpasim->config.mac); 405 + eth_random_addr(macaddr_buf); 408 406 } 409 407 410 408 for (i = 0; i < dev_attr->nvqs; i++) ··· 540 538 541 539 config->mtu = cpu_to_vdpasim16(vdpasim, 1500); 542 540 config->status = cpu_to_vdpasim16(vdpasim, VIRTIO_NET_S_LINK_UP); 541 + memcpy(config->mac, macaddr_buf, ETH_ALEN); 542 + 543 543 return 0; 544 544 } 545 545