MCPcopy Create free account
hub / github.com/F-Stack/f-stack / virtio_mac_addr_set

Function virtio_mac_addr_set

dpdk/drivers/net/virtio/virtio_ethdev.c:958–982  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

956}
957
958static int
959virtio_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr)
960{
961 struct virtio_hw *hw = dev->data->dev_private;
962
963 memcpy(hw->mac_addr, mac_addr, RTE_ETHER_ADDR_LEN);
964
965 /* Use atomic update if available */
966 if (virtio_with_feature(hw, VIRTIO_NET_F_CTRL_MAC_ADDR)) {
967 struct virtio_pmd_ctrl ctrl;
968 int len = RTE_ETHER_ADDR_LEN;
969
970 ctrl.hdr.class = VIRTIO_NET_CTRL_MAC;
971 ctrl.hdr.cmd = VIRTIO_NET_CTRL_MAC_ADDR_SET;
972
973 memcpy(ctrl.data, mac_addr, RTE_ETHER_ADDR_LEN);
974 return virtio_send_command(hw->cvq, &ctrl, &len, 1);
975 }
976
977 if (!virtio_with_feature(hw, VIRTIO_NET_F_MAC))
978 return -ENOTSUP;
979
980 virtio_set_hwaddr(hw);
981 return 0;
982}
983
984#define CLB_VAL_IDX 0
985#define CLB_MSK_IDX 1

Callers

nothing calls this directly

Calls 4

virtio_with_featureFunction · 0.85
virtio_send_commandFunction · 0.85
virtio_set_hwaddrFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected