|
6 | 6 | #include <linux/vringh.h>
|
7 | 7 | #include <uapi/linux/virtio_net.h>
|
8 | 8 | #include <uapi/linux/virtio_ids.h>
|
| 9 | +#include <uapi/linux/vdpa.h> |
9 | 10 | #include <linux/virtio_config.h>
|
10 | 11 | #include <linux/auxiliary_bus.h>
|
11 | 12 | #include <linux/mlx5/cq.h>
|
@@ -2524,17 +2525,20 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
|
2524 | 2525 | goto err_mtu;
|
2525 | 2526 |
|
2526 | 2527 | ndev->config.mtu = cpu_to_mlx5vdpa16(mvdev, mtu);
|
2527 |
| - ndev->config.status |= cpu_to_mlx5vdpa16(mvdev, VIRTIO_NET_S_LINK_UP); |
2528 |
| - |
2529 |
| - err = mlx5_query_nic_vport_mac_address(mdev, 0, 0, config->mac); |
2530 |
| - if (err) |
2531 |
| - goto err_mtu; |
2532 | 2528 |
|
2533 | 2529 | if (get_link_state(mvdev))
|
2534 | 2530 | ndev->config.status |= cpu_to_mlx5vdpa16(mvdev, VIRTIO_NET_S_LINK_UP);
|
2535 | 2531 | else
|
2536 | 2532 | ndev->config.status &= cpu_to_mlx5vdpa16(mvdev, ~VIRTIO_NET_S_LINK_UP);
|
2537 | 2533 |
|
| 2534 | + if (add_config->mask & (1 << VDPA_ATTR_DEV_NET_CFG_MACADDR)) { |
| 2535 | + memcpy(ndev->config.mac, add_config->net.mac, ETH_ALEN); |
| 2536 | + } else { |
| 2537 | + err = mlx5_query_nic_vport_mac_address(mdev, 0, 0, config->mac); |
| 2538 | + if (err) |
| 2539 | + goto err_mtu; |
| 2540 | + } |
| 2541 | + |
2538 | 2542 | if (!is_zero_ether_addr(config->mac)) {
|
2539 | 2543 | pfmdev = pci_get_drvdata(pci_physfn(mdev->pdev));
|
2540 | 2544 | err = mlx5_mpfs_add_mac(pfmdev, config->mac);
|
@@ -2632,6 +2636,7 @@ static int mlx5v_probe(struct auxiliary_device *adev,
|
2632 | 2636 | mgtdev->mgtdev.ops = &mdev_ops;
|
2633 | 2637 | mgtdev->mgtdev.device = mdev->device;
|
2634 | 2638 | mgtdev->mgtdev.id_table = id_table;
|
| 2639 | + mgtdev->mgtdev.config_attr_mask = (1 << VDPA_ATTR_DEV_NET_CFG_MACADDR); |
2635 | 2640 | mgtdev->madev = madev;
|
2636 | 2641 |
|
2637 | 2642 | err = vdpa_mgmtdev_register(&mgtdev->mgtdev);
|
|
0 commit comments